@kingstinct/react-native-healthkit 7.1.1 → 7.3.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/ios/Constants.swift +1 -1
- package/ios/Helpers.swift +6 -0
- package/ios/ReactNativeHealthkit.m +8 -1
- package/ios/ReactNativeHealthkit.swift +204 -74
- package/lib/commonjs/index.ios.js +4 -0
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jest.setup.js +3 -1
- package/lib/commonjs/jest.setup.js.map +1 -1
- package/lib/commonjs/native-types.js +5 -5
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/ensureTotals.js +12 -0
- package/lib/commonjs/utils/ensureTotals.js.map +1 -0
- package/lib/commonjs/utils/getWorkoutPlanById.js +14 -0
- package/lib/commonjs/utils/getWorkoutPlanById.js.map +1 -0
- package/lib/commonjs/utils/saveCorrelationSample.js +20 -4
- package/lib/commonjs/utils/saveCorrelationSample.js.map +1 -1
- package/lib/commonjs/utils/saveWorkoutRoute.js +27 -0
- package/lib/commonjs/utils/saveWorkoutRoute.js.map +1 -0
- package/lib/commonjs/utils/saveWorkoutSample.js +21 -4
- package/lib/commonjs/utils/saveWorkoutSample.js.map +1 -1
- package/lib/module/index.ios.js +4 -0
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest.setup.js +3 -1
- package/lib/module/jest.setup.js.map +1 -1
- package/lib/module/native-types.js +3 -3
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/types.js +5 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/ensureTotals.js +5 -0
- package/lib/module/utils/ensureTotals.js.map +1 -0
- package/lib/module/utils/getWorkoutPlanById.js +6 -0
- package/lib/module/utils/getWorkoutPlanById.js.map +1 -0
- package/lib/module/utils/saveCorrelationSample.js +20 -4
- package/lib/module/utils/saveCorrelationSample.js.map +1 -1
- package/lib/module/utils/saveWorkoutRoute.js +19 -0
- package/lib/module/utils/saveWorkoutRoute.js.map +1 -0
- package/lib/module/utils/saveWorkoutSample.js +21 -4
- package/lib/module/utils/saveWorkoutSample.js.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.ios.d.ts +4 -0
- package/lib/typescript/src/native-types.d.ts +102 -78
- package/lib/typescript/src/types.d.ts +16 -3
- package/lib/typescript/src/utils/ensureTotals.d.ts +2 -0
- package/lib/typescript/src/utils/getWorkoutPlanById.d.ts +5 -0
- package/lib/typescript/src/utils/saveWorkoutRoute.d.ts +3 -0
- package/lib/typescript/src/utils/saveWorkoutSample.d.ts +5 -1
- package/package.json +1 -1
- package/src/index.ios.tsx +4 -0
- package/src/index.tsx +3 -1
- package/src/jest.setup.ts +3 -1
- package/src/native-types.ts +158 -114
- package/src/types.ts +17 -2
- package/src/utils/ensureTotals.ts +5 -0
- package/src/utils/getWorkoutPlanById.ts +7 -0
- package/src/utils/saveCorrelationSample.ts +10 -1
- package/src/utils/saveWorkoutRoute.ts +21 -0
- package/src/utils/saveWorkoutSample.ts +15 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ensureMetadata","Native","saveCorrelationSample","typeIdentifier","samples","options","start","Date","toISOString","end","map","
|
|
1
|
+
{"version":3,"names":["ensureMetadata","Native","saveCorrelationSample","typeIdentifier","samples","options","start","Date","toISOString","end","map","sample","startDate","endDate","rest","updatedSample","metadata"],"sources":["saveCorrelationSample.ts"],"sourcesContent":["import ensureMetadata from './ensureMetadata'\nimport Native from '../native-types'\n\nimport type { MetadataMapperForCorrelationIdentifier, HKCorrelationTypeIdentifier } from '../native-types'\nimport type { HKCategorySampleForSaving, HKQuantitySampleForSaving } from '../types'\n\nasync function saveCorrelationSample<\n TIdentifier extends HKCorrelationTypeIdentifier,\n TSamples extends readonly(\n | HKCategorySampleForSaving\n | HKQuantitySampleForSaving\n )[]\n>(\n typeIdentifier: TIdentifier,\n samples: TSamples,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCorrelationIdentifier<TIdentifier>;\n },\n) {\n const start = (options?.start || new Date()).toISOString()\n const end = (options?.end || new Date()).toISOString()\n\n return Native.saveCorrelationSample(\n typeIdentifier,\n samples.map((sample) => {\n const { startDate, endDate, ...rest } = sample\n const updatedSample = {\n ...rest,\n ...(startDate && { startDate: new Date(startDate).toISOString() }),\n ...(endDate && { endDate: new Date(endDate).toISOString() }),\n }\n\n return { ...updatedSample, metadata: ensureMetadata(sample.metadata) }\n }),\n start,\n end,\n ensureMetadata(options?.metadata),\n )\n}\n\nexport default saveCorrelationSample\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAKpC,eAAeC,qBAAqBA,CAOlCC,cAA2B,EAC3BC,OAAiB,EACjBC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAC,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIC,IAAI,CAAC,CAAC,EAAEC,WAAW,CAAC,CAAC;EAC1D,MAAMC,GAAG,GAAG,CAAC,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,GAAG,KAAI,IAAIF,IAAI,CAAC,CAAC,EAAEC,WAAW,CAAC,CAAC;EAEtD,OAAOP,MAAM,CAACC,qBAAqB,CACjCC,cAAc,EACdC,OAAO,CAACM,GAAG,CAAEC,MAAM,IAAK;IACtB,MAAM;MAAEC,SAAS;MAAEC,OAAO;MAAE,GAAGC;IAAK,CAAC,GAAGH,MAAM;IAC9C,MAAMI,aAAa,GAAG;MACpB,GAAGD,IAAI;MACP,IAAIF,SAAS,IAAI;QAAEA,SAAS,EAAE,IAAIL,IAAI,CAACK,SAAS,CAAC,CAACJ,WAAW,CAAC;MAAE,CAAC,CAAC;MAClE,IAAIK,OAAO,IAAI;QAAEA,OAAO,EAAE,IAAIN,IAAI,CAACM,OAAO,CAAC,CAACL,WAAW,CAAC;MAAE,CAAC;IAC7D,CAAC;IAED,OAAO;MAAE,GAAGO,aAAa;MAAEC,QAAQ,EAAEhB,cAAc,CAACW,MAAM,CAACK,QAAQ;IAAE,CAAC;EACxE,CAAC,CAAC,EACFV,KAAK,EACLG,GAAG,EACHT,cAAc,CAACK,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEW,QAAQ,CAClC,CAAC;AACH;AAEA,eAAed,qBAAqB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Native from '../native-types';
|
|
2
|
+
async function saveWorkoutRoute(workoutUUID, locations) {
|
|
3
|
+
return Native.saveWorkoutRoute(workoutUUID, locations.map(location => {
|
|
4
|
+
const {
|
|
5
|
+
timestamp,
|
|
6
|
+
...rest
|
|
7
|
+
} = location;
|
|
8
|
+
return {
|
|
9
|
+
...rest,
|
|
10
|
+
...(timestamp ? {
|
|
11
|
+
timestamp: new Date(timestamp).toISOString()
|
|
12
|
+
} : {
|
|
13
|
+
timestamp: ''
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
export default saveWorkoutRoute;
|
|
19
|
+
//# sourceMappingURL=saveWorkoutRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Native","saveWorkoutRoute","workoutUUID","locations","map","location","timestamp","rest","Date","toISOString"],"sources":["saveWorkoutRoute.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { CLLocationForSaving } from '../types'\n\nasync function saveWorkoutRoute(\n workoutUUID: string,\n locations: readonly CLLocationForSaving[],\n) {\n return Native.saveWorkoutRoute(\n workoutUUID,\n locations.map((location) => {\n const { timestamp, ...rest } = location\n return {\n ...rest,\n ...(timestamp ? { timestamp: new Date(timestamp).toISOString() } : { timestamp: '' }),\n }\n }),\n )\n}\n\nexport default saveWorkoutRoute\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC,eAAeC,gBAAgBA,CAC7BC,WAAmB,EACnBC,SAAyC,EACzC;EACA,OAAOH,MAAM,CAACC,gBAAgB,CAC5BC,WAAW,EACXC,SAAS,CAACC,GAAG,CAAEC,QAAQ,IAAK;IAC1B,MAAM;MAAEC,SAAS;MAAE,GAAGC;IAAK,CAAC,GAAGF,QAAQ;IACvC,OAAO;MACL,GAAGE,IAAI;MACP,IAAID,SAAS,GAAG;QAAEA,SAAS,EAAE,IAAIE,IAAI,CAACF,SAAS,CAAC,CAACG,WAAW,CAAC;MAAE,CAAC,GAAG;QAAEH,SAAS,EAAE;MAAG,CAAC;IACtF,CAAC;EACH,CAAC,CACH,CAAC;AACH;AAEA,eAAeL,gBAAgB"}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import ensureMetadata from './ensureMetadata';
|
|
2
|
+
import ensureTotals from './ensureTotals';
|
|
2
3
|
import Native from '../native-types';
|
|
3
4
|
async function saveWorkoutSample(typeIdentifier, quantities, _start, options) {
|
|
4
5
|
const start = _start.toISOString();
|
|
5
6
|
const end = ((options === null || options === void 0 ? void 0 : options.end) || new Date()).toISOString();
|
|
6
|
-
return Native.saveWorkoutSample(typeIdentifier, quantities.map(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
return Native.saveWorkoutSample(typeIdentifier, quantities.map(quantity => {
|
|
8
|
+
const {
|
|
9
|
+
startDate,
|
|
10
|
+
endDate,
|
|
11
|
+
...rest
|
|
12
|
+
} = quantity;
|
|
13
|
+
const updatedQuantity = {
|
|
14
|
+
...rest,
|
|
15
|
+
...(startDate && {
|
|
16
|
+
startDate: startDate.toISOString()
|
|
17
|
+
}),
|
|
18
|
+
...(endDate && {
|
|
19
|
+
endDate: endDate.toISOString()
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
...updatedQuantity,
|
|
24
|
+
metadata: ensureMetadata(quantity.metadata)
|
|
25
|
+
};
|
|
26
|
+
}), start, end, ensureTotals(options === null || options === void 0 ? void 0 : options.totals), ensureMetadata(options === null || options === void 0 ? void 0 : options.metadata));
|
|
10
27
|
}
|
|
11
28
|
export default saveWorkoutSample;
|
|
12
29
|
//# sourceMappingURL=saveWorkoutSample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ensureMetadata","Native","saveWorkoutSample","typeIdentifier","quantities","_start","options","start","toISOString","end","Date","map","
|
|
1
|
+
{"version":3,"names":["ensureMetadata","ensureTotals","Native","saveWorkoutSample","typeIdentifier","quantities","_start","options","start","toISOString","end","Date","map","quantity","startDate","endDate","rest","updatedQuantity","metadata","totals"],"sources":["saveWorkoutSample.ts"],"sourcesContent":["import ensureMetadata from './ensureMetadata'\nimport ensureTotals from './ensureTotals'\nimport Native from '../native-types'\n\nimport type { HKWorkoutActivityType, HKWorkoutMetadata } from '../native-types'\nimport type { HKQuantitySampleForSaving } from '../types'\n\nasync function saveWorkoutSample<TIdentifier extends HKWorkoutActivityType>(\n typeIdentifier: TIdentifier,\n quantities: readonly HKQuantitySampleForSaving[],\n _start: Date,\n options?: {\n readonly end?: Date;\n readonly totals?: {\n readonly distance?: number;\n readonly energyBurned?: number;\n }\n readonly metadata?: HKWorkoutMetadata;\n },\n) {\n const start = _start.toISOString()\n const end = (options?.end || new Date()).toISOString()\n\n return Native.saveWorkoutSample(\n typeIdentifier,\n quantities.map((quantity) => {\n const { startDate, endDate, ...rest } = quantity\n const updatedQuantity = {\n ...rest,\n ...(startDate && { startDate: startDate.toISOString() }),\n ...(endDate && { endDate: endDate.toISOString() }),\n }\n return { ...updatedQuantity, metadata: ensureMetadata(quantity.metadata) }\n }),\n start,\n end,\n ensureTotals(options?.totals),\n ensureMetadata(options?.metadata),\n )\n}\n\nexport default saveWorkoutSample\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,MAAM,MAAM,iBAAiB;AAKpC,eAAeC,iBAAiBA,CAC9BC,cAA2B,EAC3BC,UAAgD,EAChDC,MAAY,EACZC,OAOC,EACD;EACA,MAAMC,KAAK,GAAGF,MAAM,CAACG,WAAW,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,CAAC,CAAAH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC,EAAEF,WAAW,CAAC,CAAC;EAEtD,OAAOP,MAAM,CAACC,iBAAiB,CAC7BC,cAAc,EACdC,UAAU,CAACO,GAAG,CAAEC,QAAQ,IAAK;IAC3B,MAAM;MAAEC,SAAS;MAAEC,OAAO;MAAE,GAAGC;IAAK,CAAC,GAAGH,QAAQ;IAChD,MAAMI,eAAe,GAAG;MACtB,GAAGD,IAAI;MACP,IAAIF,SAAS,IAAI;QAAEA,SAAS,EAAEA,SAAS,CAACL,WAAW,CAAC;MAAE,CAAC,CAAC;MACxD,IAAIM,OAAO,IAAI;QAAEA,OAAO,EAAEA,OAAO,CAACN,WAAW,CAAC;MAAE,CAAC;IACnD,CAAC;IACD,OAAO;MAAE,GAAGQ,eAAe;MAAEC,QAAQ,EAAElB,cAAc,CAACa,QAAQ,CAACK,QAAQ;IAAE,CAAC;EAC5E,CAAC,CAAC,EACFV,KAAK,EACLE,GAAG,EACHT,YAAY,CAACM,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEY,MAAM,CAAC,EAC7BnB,cAAc,CAACO,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEW,QAAQ,CAClC,CAAC;AACH;AAEA,eAAef,iBAAiB"}
|
|
@@ -20,6 +20,7 @@ declare const _default: {
|
|
|
20
20
|
getMostRecentCategorySample: typeof import("./utils/getMostRecentCategorySample").default;
|
|
21
21
|
getMostRecentWorkout: import("./utils/getMostRecentWorkout").GetMostRecentWorkoutFn;
|
|
22
22
|
getWorkoutRoutes: (workoutUUID: string) => Promise<readonly import("./native-types").WorkoutRoute[]>;
|
|
23
|
+
getWorkoutPlanById: typeof import("./utils/getWorkoutPlanById").default;
|
|
23
24
|
getPreferredUnit: import("./utils/getPreferredUnit").GetPreferredUnitFn;
|
|
24
25
|
getPreferredUnits: import("./utils/getPreferredUnits").GetPreferredUnitsFn;
|
|
25
26
|
getRequestStatusForAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[]) => Promise<HKAuthorizationRequestStatus>;
|
|
@@ -40,6 +41,7 @@ declare const _default: {
|
|
|
40
41
|
saveCorrelationSample: typeof import("./utils/saveCorrelationSample").default;
|
|
41
42
|
saveQuantitySample: typeof import("./utils/saveQuantitySample").default;
|
|
42
43
|
saveWorkoutSample: typeof import("./utils/saveWorkoutSample").default;
|
|
44
|
+
saveWorkoutRoute: typeof import("./utils/saveWorkoutRoute").default;
|
|
43
45
|
subscribeToChanges: (identifier: import("./native-types").HKSampleTypeIdentifier, callback: () => void) => Promise<() => Promise<boolean>>;
|
|
44
46
|
useMostRecentCategorySample: typeof import("./hooks/useMostRecentCategorySample").default;
|
|
45
47
|
useMostRecentQuantitySample: typeof import("./hooks/useMostRecentQuantitySample").default;
|
|
@@ -5,11 +5,13 @@ import useSubscribeToChanges from './hooks/useSubscribeToChanges';
|
|
|
5
5
|
import { HKQuantityTypeIdentifier } from './native-types';
|
|
6
6
|
import getMostRecentCategorySample from './utils/getMostRecentCategorySample';
|
|
7
7
|
import getMostRecentQuantitySample from './utils/getMostRecentQuantitySample';
|
|
8
|
+
import getWorkoutPlanById from './utils/getWorkoutPlanById';
|
|
8
9
|
import queryStatisticsForQuantity from './utils/queryStatisticsForQuantity';
|
|
9
10
|
import queryWorkouts from './utils/queryWorkouts';
|
|
10
11
|
import saveCategorySample from './utils/saveCategorySample';
|
|
11
12
|
import saveCorrelationSample from './utils/saveCorrelationSample';
|
|
12
13
|
import saveQuantitySample from './utils/saveQuantitySample';
|
|
14
|
+
import saveWorkoutRoute from './utils/saveWorkoutRoute';
|
|
13
15
|
import saveWorkoutSample from './utils/saveWorkoutSample';
|
|
14
16
|
/**
|
|
15
17
|
* @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}
|
|
@@ -84,6 +86,7 @@ declare const _default: {
|
|
|
84
86
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}
|
|
85
87
|
*/
|
|
86
88
|
getWorkoutRoutes: (workoutUUID: string) => Promise<readonly import("./native-types").WorkoutRoute[]>;
|
|
89
|
+
getWorkoutPlanById: typeof getWorkoutPlanById;
|
|
87
90
|
getPreferredUnit: import("./utils/getPreferredUnit").GetPreferredUnitFn;
|
|
88
91
|
getPreferredUnits: import("./utils/getPreferredUnits").GetPreferredUnitsFn;
|
|
89
92
|
getRequestStatusForAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[]) => Promise<import("./native-types").HKAuthorizationRequestStatus>;
|
|
@@ -108,6 +111,7 @@ declare const _default: {
|
|
|
108
111
|
saveCorrelationSample: typeof saveCorrelationSample;
|
|
109
112
|
saveQuantitySample: typeof saveQuantitySample;
|
|
110
113
|
saveWorkoutSample: typeof saveWorkoutSample;
|
|
114
|
+
saveWorkoutRoute: typeof saveWorkoutRoute;
|
|
111
115
|
subscribeToChanges: (identifier: import("./native-types").HKSampleTypeIdentifier, callback: () => void) => Promise<() => Promise<boolean>>;
|
|
112
116
|
/**
|
|
113
117
|
* @returns the most recent sample for the given category type.
|
|
@@ -9,7 +9,7 @@ export declare const HKWorkoutTypeIdentifier: "HKWorkoutTypeIdentifier";
|
|
|
9
9
|
* Represents a type that identifies activity summary objects.
|
|
10
10
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkactivitysummarytype Apple Docs HKActivitySummaryType}
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const HKActivitySummaryTypeIdentifier: "HKActivitySummaryTypeIdentifier";
|
|
13
13
|
/**
|
|
14
14
|
* Represents an audiogram type identifier.
|
|
15
15
|
* @see {@link https://developer.apple.com/documentation/healthkit/HKAudiogramSampleType Apple Docs HKAudiogramSampleType}
|
|
@@ -36,24 +36,24 @@ export declare enum HKQuantityTypeIdentifier {
|
|
|
36
36
|
*/
|
|
37
37
|
bodyMassIndex = "HKQuantityTypeIdentifierBodyMassIndex",
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
* Body Fat Percentage
|
|
40
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierbodyfatpercentage Apple Docs HKQuantityTypeIdentifierBodyFatPercentage}
|
|
41
|
+
*/
|
|
42
42
|
bodyFatPercentage = "HKQuantityTypeIdentifierBodyFatPercentage",
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
* Height
|
|
45
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierheight Apple Docs HKQuantityTypeIdentifierHeight}
|
|
46
|
+
*/
|
|
47
47
|
height = "HKQuantityTypeIdentifierHeight",
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
* Body Mass
|
|
50
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierbodymass Apple Docs HKQuantityTypeIdentifierBodyMass}
|
|
51
|
+
*/
|
|
52
52
|
bodyMass = "HKQuantityTypeIdentifierBodyMass",
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
* Lean Body Mass
|
|
55
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierleanbodymass Apple Docs HKQuantityTypeIdentifierLeanBodyMass}
|
|
56
|
+
*/
|
|
57
57
|
leanBodyMass = "HKQuantityTypeIdentifierLeanBodyMass",
|
|
58
58
|
/**
|
|
59
59
|
* Waist Circumference
|
|
@@ -180,7 +180,7 @@ export declare enum HKQuantityTypeIdentifier {
|
|
|
180
180
|
* Heart Rate Variability SDNN
|
|
181
181
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierheartratevariabilitysdnn Apple Docs HKQuantityTypeIdentifierHeartRateVariabilitySDNN}
|
|
182
182
|
* @since iOS 11.0
|
|
183
|
-
|
|
183
|
+
*/
|
|
184
184
|
heartRateVariabilitySDNN = "HKQuantityTypeIdentifierHeartRateVariabilitySDNN",
|
|
185
185
|
/**
|
|
186
186
|
* Oxygen Saturation
|
|
@@ -257,20 +257,20 @@ export declare enum HKQuantityTypeIdentifier {
|
|
|
257
257
|
*/
|
|
258
258
|
headphoneAudioExposure = "HKQuantityTypeIdentifierHeadphoneAudioExposure",
|
|
259
259
|
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
* Dietary Fat Total
|
|
261
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryfattotal Apple Docs HKQuantityTypeIdentifierDietaryFatTotal}
|
|
262
|
+
* @since iOS 8
|
|
263
|
+
*/
|
|
264
264
|
dietaryFatTotal = "HKQuantityTypeIdentifierDietaryFatTotal",
|
|
265
265
|
/**
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
* Dietary Fat Polyunsaturated
|
|
267
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryfatpolyunsaturated Apple Docs HKQuantityTypeIdentifierDietaryFatPolyunsaturated}
|
|
268
|
+
*/
|
|
269
269
|
dietaryFatPolyunsaturated = "HKQuantityTypeIdentifierDietaryFatPolyunsaturated",
|
|
270
270
|
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
* Dietary Fat Monounsaturated
|
|
272
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryfatmonounsaturated Apple Docs HKQuantityTypeIdentifierDietaryFatMonounsaturated}
|
|
273
|
+
*/
|
|
274
274
|
dietaryFatMonounsaturated = "HKQuantityTypeIdentifierDietaryFatMonounsaturated",
|
|
275
275
|
/**
|
|
276
276
|
* Dietary Fat Saturated
|
|
@@ -278,24 +278,24 @@ export declare enum HKQuantityTypeIdentifier {
|
|
|
278
278
|
*/
|
|
279
279
|
dietaryFatSaturated = "HKQuantityTypeIdentifierDietaryFatSaturated",
|
|
280
280
|
/**
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
* Dietary Cholesterol
|
|
282
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietarycholesterol Apple Docs HKQuantityTypeIdentifierDietaryCholesterol}
|
|
283
|
+
*/
|
|
284
284
|
dietaryCholesterol = "HKQuantityTypeIdentifierDietaryCholesterol",
|
|
285
285
|
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
* Dietary Sodium
|
|
287
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietarysodium Apple Docs HKQuantityTypeIdentifierDietarySodium}
|
|
288
|
+
*/
|
|
289
289
|
dietarySodium = "HKQuantityTypeIdentifierDietarySodium",
|
|
290
290
|
/**
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
* Dietary Carbohydrates
|
|
292
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietarycarbohydrates Apple Docs HKQuantityTypeIdentifierDietaryCarbohydrates}
|
|
293
|
+
*/
|
|
294
294
|
dietaryCarbohydrates = "HKQuantityTypeIdentifierDietaryCarbohydrates",
|
|
295
295
|
/**
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
* Dietary Fiber
|
|
297
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryfiber Apple Docs HKQuantityTypeIdentifierDietaryFiber}
|
|
298
|
+
*/
|
|
299
299
|
dietaryFiber = "HKQuantityTypeIdentifierDietaryFiber",
|
|
300
300
|
/**
|
|
301
301
|
* Dietary Sugar
|
|
@@ -353,49 +353,49 @@ export declare enum HKQuantityTypeIdentifier {
|
|
|
353
353
|
*/
|
|
354
354
|
dietaryCalcium = "HKQuantityTypeIdentifierDietaryCalcium",
|
|
355
355
|
/**
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
* Dietary Iron
|
|
357
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryiron Apple Docs HKQuantityTypeIdentifierDietaryIron}
|
|
358
|
+
*/
|
|
359
359
|
dietaryIron = "HKQuantityTypeIdentifierDietaryIron",
|
|
360
360
|
/**
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
* Dietary Thiamin
|
|
362
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietarythiamin Apple Docs HKQuantityTypeIdentifierDietaryThiamin}
|
|
363
|
+
*/
|
|
364
364
|
dietaryThiamin = "HKQuantityTypeIdentifierDietaryThiamin",
|
|
365
365
|
/**
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
366
|
+
* Dietary Riboflavin
|
|
367
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryriboflavin Apple Docs HKQuantityTypeIdentifierDietaryRiboflavin}
|
|
368
|
+
*/
|
|
369
369
|
dietaryRiboflavin = "HKQuantityTypeIdentifierDietaryRiboflavin",
|
|
370
370
|
/**
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
* Dietary Niacin
|
|
372
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryniacin Apple Docs HKQuantityTypeIdentifierDietaryNiacin}
|
|
373
|
+
*/
|
|
374
374
|
dietaryNiacin = "HKQuantityTypeIdentifierDietaryNiacin",
|
|
375
375
|
/**
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
* Dietary Folate
|
|
377
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryfolate Apple Docs HKQuantityTypeIdentifierDietaryFolate}
|
|
378
|
+
*/
|
|
379
379
|
dietaryFolate = "HKQuantityTypeIdentifierDietaryFolate",
|
|
380
380
|
/**
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
* Dietary Biotin
|
|
382
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietarybiotin Apple Docs HKQuantityTypeIdentifierDietaryBiotin}
|
|
383
|
+
*/
|
|
384
384
|
dietaryBiotin = "HKQuantityTypeIdentifierDietaryBiotin",
|
|
385
385
|
/**
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
386
|
+
* Dietary Pantothenic Acid
|
|
387
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietarypantothenicacid Apple Docs HKQuantityTypeIdentifierDietaryPantothenicAcid}
|
|
388
|
+
*/
|
|
389
389
|
dietaryPantothenicAcid = "HKQuantityTypeIdentifierDietaryPantothenicAcid",
|
|
390
390
|
/**
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
* Dietary Phosphorus
|
|
392
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryphosphorus Apple Docs HKQuantityTypeIdentifierDietaryPhosphorus}
|
|
393
|
+
*/
|
|
394
394
|
dietaryPhosphorus = "HKQuantityTypeIdentifierDietaryPhosphorus",
|
|
395
395
|
/**
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
* Dietary Iodine
|
|
397
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierdietaryiodine Apple Docs HKQuantityTypeIdentifierDietaryIodine}
|
|
398
|
+
*/
|
|
399
399
|
dietaryIodine = "HKQuantityTypeIdentifierDietaryIodine",
|
|
400
400
|
/**
|
|
401
401
|
* Dietary Magnesium
|
|
@@ -713,7 +713,7 @@ export declare enum HKCategoryTypeIdentifier {
|
|
|
713
713
|
vomiting = "HKCategoryTypeIdentifierVomiting",
|
|
714
714
|
wheezing = "HKCategoryTypeIdentifierWheezing"
|
|
715
715
|
}
|
|
716
|
-
export type HKSampleTypeIdentifier = HKCategoryTypeIdentifier | HKCorrelationTypeIdentifier | HKQuantityTypeIdentifier | typeof
|
|
716
|
+
export type HKSampleTypeIdentifier = HKCategoryTypeIdentifier | HKCorrelationTypeIdentifier | HKQuantityTypeIdentifier | typeof HKActivitySummaryTypeIdentifier | typeof HKAudiogramTypeIdentifier | typeof HKDataTypeIdentifierHeartbeatSeries | typeof HKWorkoutRouteTypeIdentifier | typeof HKWorkoutTypeIdentifier | `${HKCategoryTypeIdentifier}` | `${HKCorrelationTypeIdentifier}` | `${HKQuantityTypeIdentifier}`;
|
|
717
717
|
export type HealthkitReadAuthorization = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier | `${HKCharacteristicTypeIdentifier}` | `${HKSampleTypeIdentifier}`;
|
|
718
718
|
export type HealthkitWriteAuthorization = HKSampleTypeIdentifier;
|
|
719
719
|
export declare enum HKCategoryValueAppleStandHour {
|
|
@@ -1030,7 +1030,7 @@ export type MetadataMapperForQuantityIdentifier<TQuantityTypeIdentifier = HKQuan
|
|
|
1030
1030
|
export type MetadataMapperForCorrelationIdentifier<TCorrelationTypeIdentifier = HKCorrelationTypeIdentifier> = TCorrelationTypeIdentifier extends HKCorrelationTypeIdentifier.food ? HKGenericMetadata & {
|
|
1031
1031
|
readonly HKFoodType?: string;
|
|
1032
1032
|
} : HKGenericMetadata;
|
|
1033
|
-
export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> = T extends HKQuantityTypeIdentifier.bloodGlucose ? BloodGlucoseUnit : T extends HKQuantityTypeIdentifier.appleExerciseTime | HKQuantityTypeIdentifier.appleMoveTime | HKQuantityTypeIdentifier.appleStandTime ? TimeUnit : T extends HKQuantityTypeIdentifier.activeEnergyBurned | HKQuantityTypeIdentifier.basalEnergyBurned | HKQuantityTypeIdentifier.dietaryEnergyConsumed ? EnergyUnit : T extends HKQuantityTypeIdentifier.distanceCycling | HKQuantityTypeIdentifier.distanceDownhillSnowSports | HKQuantityTypeIdentifier.distanceSwimming | HKQuantityTypeIdentifier.distanceWalkingRunning | HKQuantityTypeIdentifier.distanceWheelchair | HKQuantityTypeIdentifier.sixMinuteWalkTestDistance | HKQuantityTypeIdentifier.waistCircumference ? LengthUnit : T extends HKQuantityTypeIdentifier.bodyFatPercentage | HKQuantityTypeIdentifier.oxygenSaturation | HKQuantityTypeIdentifier.walkingAsymmetryPercentage | HKQuantityTypeIdentifier.walkingDoubleSupportPercentage ? HKUnits.Percent : T extends HKQuantityTypeIdentifier.basalBodyTemperature | HKQuantityTypeIdentifier.basalBodyTemperature ? TemperatureUnit : T extends HKQuantityTypeIdentifier.stairAscentSpeed | HKQuantityTypeIdentifier.stairDescentSpeed | HKQuantityTypeIdentifier.walkingSpeed | HKQuantityTypeIdentifier.walkingSpeed ? SpeedUnit<LengthUnit, TimeUnit> : T extends HKQuantityTypeIdentifier.flightsClimbed | HKQuantityTypeIdentifier.numberOfAlcoholicBeverages | HKQuantityTypeIdentifier.numberOfTimesFallen | HKQuantityTypeIdentifier.pushCount | HKQuantityTypeIdentifier.stepCount | HKQuantityTypeIdentifier.swimmingStrokeCount ? HKUnits.Count : T extends HKQuantityTypeIdentifier.dietaryBiotin | HKQuantityTypeIdentifier.dietaryCaffeine | HKQuantityTypeIdentifier.dietaryCalcium | HKQuantityTypeIdentifier.dietaryCarbohydrates | HKQuantityTypeIdentifier.dietaryChloride | HKQuantityTypeIdentifier.dietaryCholesterol | HKQuantityTypeIdentifier.dietaryChromium | HKQuantityTypeIdentifier.dietaryCopper | HKQuantityTypeIdentifier.dietaryFatMonounsaturated | HKQuantityTypeIdentifier.dietaryFatPolyunsaturated | HKQuantityTypeIdentifier.dietaryFatSaturated | HKQuantityTypeIdentifier.dietaryFatTotal | HKQuantityTypeIdentifier.dietaryFiber | HKQuantityTypeIdentifier.dietaryFolate | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIron | HKQuantityTypeIdentifier.dietaryMagnesium | HKQuantityTypeIdentifier.dietaryManganese | HKQuantityTypeIdentifier.dietaryMolybdenum | HKQuantityTypeIdentifier.dietaryNiacin | HKQuantityTypeIdentifier.dietaryPantothenicAcid | HKQuantityTypeIdentifier.dietaryPhosphorus | HKQuantityTypeIdentifier.dietaryPotassium | HKQuantityTypeIdentifier.dietaryProtein | HKQuantityTypeIdentifier.dietaryRiboflavin | HKQuantityTypeIdentifier.dietarySelenium | HKQuantityTypeIdentifier.dietarySodium | HKQuantityTypeIdentifier.dietarySugar | HKQuantityTypeIdentifier.dietaryThiamin | HKQuantityTypeIdentifier.dietaryVitaminA | HKQuantityTypeIdentifier.dietaryVitaminB6 | HKQuantityTypeIdentifier.dietaryVitaminB12 | HKQuantityTypeIdentifier.dietaryVitaminC | HKQuantityTypeIdentifier.dietaryVitaminD | HKQuantityTypeIdentifier.dietaryVitaminE | HKQuantityTypeIdentifier.dietaryVitaminK | HKQuantityTypeIdentifier.dietaryZinc ? MassUnit : T extends HKQuantityTypeIdentifier.dietaryWater ? VolumeUnit : T extends HKQuantityTypeIdentifier.insulinDelivery ? HKUnits.InternationalUnit | `${HKUnits.InternationalUnit}` : T extends HKQuantityTypeIdentifier.heartRate | HKQuantityTypeIdentifier.restingHeartRate | HKQuantityTypeIdentifier.walkingHeartRateAverage ? CountPerTime<TimeUnit> : HKUnit;
|
|
1033
|
+
export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> = T extends HKQuantityTypeIdentifier.bloodGlucose ? BloodGlucoseUnit : T extends HKQuantityTypeIdentifier.appleExerciseTime | HKQuantityTypeIdentifier.appleMoveTime | HKQuantityTypeIdentifier.appleStandTime ? TimeUnit : T extends HKQuantityTypeIdentifier.activeEnergyBurned | HKQuantityTypeIdentifier.basalEnergyBurned | HKQuantityTypeIdentifier.dietaryEnergyConsumed ? EnergyUnit : T extends HKQuantityTypeIdentifier.distanceCycling | HKQuantityTypeIdentifier.distanceDownhillSnowSports | HKQuantityTypeIdentifier.distanceSwimming | HKQuantityTypeIdentifier.distanceWalkingRunning | HKQuantityTypeIdentifier.distanceWheelchair | HKQuantityTypeIdentifier.sixMinuteWalkTestDistance | HKQuantityTypeIdentifier.waistCircumference ? LengthUnit : T extends HKQuantityTypeIdentifier.bodyFatPercentage | HKQuantityTypeIdentifier.oxygenSaturation | HKQuantityTypeIdentifier.walkingAsymmetryPercentage | HKQuantityTypeIdentifier.walkingDoubleSupportPercentage ? HKUnits.Percent : T extends HKQuantityTypeIdentifier.basalBodyTemperature | HKQuantityTypeIdentifier.basalBodyTemperature ? TemperatureUnit : T extends HKQuantityTypeIdentifier.runningSpeed | HKQuantityTypeIdentifier.stairAscentSpeed | HKQuantityTypeIdentifier.stairDescentSpeed | HKQuantityTypeIdentifier.walkingSpeed | HKQuantityTypeIdentifier.walkingSpeed ? SpeedUnit<LengthUnit, TimeUnit> : T extends HKQuantityTypeIdentifier.flightsClimbed | HKQuantityTypeIdentifier.numberOfAlcoholicBeverages | HKQuantityTypeIdentifier.numberOfTimesFallen | HKQuantityTypeIdentifier.pushCount | HKQuantityTypeIdentifier.stepCount | HKQuantityTypeIdentifier.swimmingStrokeCount ? HKUnits.Count : T extends HKQuantityTypeIdentifier.dietaryBiotin | HKQuantityTypeIdentifier.dietaryCaffeine | HKQuantityTypeIdentifier.dietaryCalcium | HKQuantityTypeIdentifier.dietaryCarbohydrates | HKQuantityTypeIdentifier.dietaryChloride | HKQuantityTypeIdentifier.dietaryCholesterol | HKQuantityTypeIdentifier.dietaryChromium | HKQuantityTypeIdentifier.dietaryCopper | HKQuantityTypeIdentifier.dietaryFatMonounsaturated | HKQuantityTypeIdentifier.dietaryFatPolyunsaturated | HKQuantityTypeIdentifier.dietaryFatSaturated | HKQuantityTypeIdentifier.dietaryFatTotal | HKQuantityTypeIdentifier.dietaryFiber | HKQuantityTypeIdentifier.dietaryFolate | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIron | HKQuantityTypeIdentifier.dietaryMagnesium | HKQuantityTypeIdentifier.dietaryManganese | HKQuantityTypeIdentifier.dietaryMolybdenum | HKQuantityTypeIdentifier.dietaryNiacin | HKQuantityTypeIdentifier.dietaryPantothenicAcid | HKQuantityTypeIdentifier.dietaryPhosphorus | HKQuantityTypeIdentifier.dietaryPotassium | HKQuantityTypeIdentifier.dietaryProtein | HKQuantityTypeIdentifier.dietaryRiboflavin | HKQuantityTypeIdentifier.dietarySelenium | HKQuantityTypeIdentifier.dietarySodium | HKQuantityTypeIdentifier.dietarySugar | HKQuantityTypeIdentifier.dietaryThiamin | HKQuantityTypeIdentifier.dietaryVitaminA | HKQuantityTypeIdentifier.dietaryVitaminB6 | HKQuantityTypeIdentifier.dietaryVitaminB12 | HKQuantityTypeIdentifier.dietaryVitaminC | HKQuantityTypeIdentifier.dietaryVitaminD | HKQuantityTypeIdentifier.dietaryVitaminE | HKQuantityTypeIdentifier.dietaryVitaminK | HKQuantityTypeIdentifier.dietaryZinc ? MassUnit : T extends HKQuantityTypeIdentifier.dietaryWater ? VolumeUnit : T extends HKQuantityTypeIdentifier.insulinDelivery ? HKUnits.InternationalUnit | `${HKUnits.InternationalUnit}` : T extends HKQuantityTypeIdentifier.heartRate | HKQuantityTypeIdentifier.restingHeartRate | HKQuantityTypeIdentifier.walkingHeartRateAverage ? CountPerTime<TimeUnit> : HKUnit;
|
|
1034
1034
|
export type HKCategoryValueForIdentifier<T extends HKCategoryTypeIdentifier> = T extends HKCategoryTypeIdentifier.cervicalMucusQuality ? HKCategoryValueCervicalMucusQuality : T extends HKCategoryTypeIdentifier.menstrualFlow ? HKCategoryValueMenstrualFlow : T extends HKCategoryTypeIdentifier.ovulationTestResult ? HKCategoryValueOvulationTestResult : T extends HKCategoryTypeIdentifier.sleepAnalysis ? HKCategoryValueSleepAnalysis : T extends HKCategoryTypeIdentifier.highHeartRateEvent | HKCategoryTypeIdentifier.intermenstrualBleeding | HKCategoryTypeIdentifier.mindfulSession | HKCategoryTypeIdentifier.sexualActivity ? HKCategoryValueNotApplicable : T extends HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.acne | HKCategoryTypeIdentifier.bladderIncontinence | HKCategoryTypeIdentifier.bloating | HKCategoryTypeIdentifier.breastPain | HKCategoryTypeIdentifier.chestTightnessOrPain | HKCategoryTypeIdentifier.chills | HKCategoryTypeIdentifier.constipation | HKCategoryTypeIdentifier.coughing | HKCategoryTypeIdentifier.diarrhea | HKCategoryTypeIdentifier.dizziness | HKCategoryTypeIdentifier.drySkin | HKCategoryTypeIdentifier.fainting | HKCategoryTypeIdentifier.fatigue | HKCategoryTypeIdentifier.fever | HKCategoryTypeIdentifier.generalizedBodyAche | HKCategoryTypeIdentifier.hairLoss | HKCategoryTypeIdentifier.headache | HKCategoryTypeIdentifier.heartburn | HKCategoryTypeIdentifier.hotFlashes | HKCategoryTypeIdentifier.lossOfSmell | HKCategoryTypeIdentifier.lossOfTaste | HKCategoryTypeIdentifier.lowerBackPain | HKCategoryTypeIdentifier.memoryLapse | HKCategoryTypeIdentifier.moodChanges | HKCategoryTypeIdentifier.nausea | HKCategoryTypeIdentifier.nightSweats | HKCategoryTypeIdentifier.pelvicPain | HKCategoryTypeIdentifier.rapidPoundingOrFlutteringHeartbeat | HKCategoryTypeIdentifier.runnyNose | HKCategoryTypeIdentifier.shortnessOfBreath | HKCategoryTypeIdentifier.sinusCongestion | HKCategoryTypeIdentifier.skippedHeartbeat | HKCategoryTypeIdentifier.soreThroat | HKCategoryTypeIdentifier.vaginalDryness | HKCategoryTypeIdentifier.vomiting | HKCategoryTypeIdentifier.wheezing ? HKCategoryValueSeverity : T extends HKCategoryTypeIdentifier.appetiteChanges | HKCategoryTypeIdentifier.sleepChanges ? HKCategoryValuePresence : T extends HKCategoryTypeIdentifier.lowCardioFitnessEvent ? HKCategoryValueLowCardioFitnessEvent : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.appleStandHour ? HKCategoryValueAppleStandHour : number;
|
|
1035
1035
|
/**
|
|
1036
1036
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepregnancytestresult Apple Docs }
|
|
@@ -1276,8 +1276,24 @@ export type HKHeartbeatSeriesSampleRaw = {
|
|
|
1276
1276
|
readonly metadata?: HKHeartbeatSeriesSampleMetadata;
|
|
1277
1277
|
readonly sourceRevision?: HKSourceRevision;
|
|
1278
1278
|
};
|
|
1279
|
-
export type
|
|
1280
|
-
|
|
1279
|
+
export type CLLocationRawForSaving = {
|
|
1280
|
+
readonly latitude: number;
|
|
1281
|
+
readonly longitude: number;
|
|
1282
|
+
readonly altitude: number;
|
|
1283
|
+
readonly horizontalAccuracy: number;
|
|
1284
|
+
readonly verticalAccuracy: number;
|
|
1285
|
+
readonly course: number;
|
|
1286
|
+
readonly speed: number;
|
|
1287
|
+
readonly timestamp: string;
|
|
1288
|
+
};
|
|
1289
|
+
export type HKQuantitySampleRawForSaving<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = Omit<HKQuantitySampleRaw<TQuantityIdentifier, TUnit>, 'device' | 'endDate' | 'startDate' | 'uuid'> & {
|
|
1290
|
+
readonly startDate?: string;
|
|
1291
|
+
readonly endDate?: string;
|
|
1292
|
+
};
|
|
1293
|
+
export type HKCategorySampleRawForSaving<TCategory extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier> = Omit<HKCategorySampleRaw<TCategory>, 'device' | 'endDate' | 'startDate' | 'uuid'> & {
|
|
1294
|
+
readonly startDate?: string;
|
|
1295
|
+
readonly endDate?: string;
|
|
1296
|
+
};
|
|
1281
1297
|
export interface HKWorkoutEvent {
|
|
1282
1298
|
readonly type: HKWorkoutEventType;
|
|
1283
1299
|
readonly startDate: string;
|
|
@@ -1376,8 +1392,8 @@ export type HKCorrelationRaw<TIdentifier extends HKCorrelationTypeIdentifier> =
|
|
|
1376
1392
|
};
|
|
1377
1393
|
type QueryId = string;
|
|
1378
1394
|
/**
|
|
1379
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkupdatefrequency Apple Docs }
|
|
1380
|
-
*/
|
|
1395
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkupdatefrequency Apple Docs }
|
|
1396
|
+
*/
|
|
1381
1397
|
export declare enum HKUpdateFrequency {
|
|
1382
1398
|
immediate = 1,
|
|
1383
1399
|
hourly = 2,
|
|
@@ -1412,32 +1428,36 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
1412
1428
|
getFitzpatrickSkinType(): Promise<HKFitzpatrickSkinType>;
|
|
1413
1429
|
readonly getWheelchairUse: () => Promise<HKWheelchairUse>;
|
|
1414
1430
|
/**
|
|
1415
|
-
|
|
1416
|
-
|
|
1431
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery Apple Docs }
|
|
1432
|
+
*/
|
|
1417
1433
|
readonly enableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier, updateFrequency: HKUpdateFrequency) => Promise<boolean>;
|
|
1418
1434
|
/**
|
|
1419
1435
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery Apple Docs }
|
|
1420
1436
|
*/
|
|
1421
1437
|
readonly disableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier) => Promise<boolean>;
|
|
1422
1438
|
/**
|
|
1423
|
-
|
|
1424
|
-
|
|
1439
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery Apple Docs }
|
|
1440
|
+
*/
|
|
1425
1441
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
1426
1442
|
readonly saveCorrelationSample: <TIdentifier extends HKCorrelationTypeIdentifier, TSamples extends readonly (HKCategorySampleRawForSaving | HKQuantitySampleRawForSaving)[]>(typeIdentifier: TIdentifier, samples: TSamples, start: string, end: string, metadata: MetadataMapperForCorrelationIdentifier<TIdentifier>) => Promise<boolean>;
|
|
1427
|
-
readonly saveWorkoutSample: (typeIdentifier: HKWorkoutActivityType, quantities: readonly HKQuantitySampleRawForSaving[], start: string, end: string,
|
|
1443
|
+
readonly saveWorkoutSample: (typeIdentifier: HKWorkoutActivityType, quantities: readonly HKQuantitySampleRawForSaving[], start: string, end: string, totals: {
|
|
1444
|
+
readonly distance?: number;
|
|
1445
|
+
readonly energyBurned?: number;
|
|
1446
|
+
}, metadata: HKWorkoutMetadata) => Promise<string | null>;
|
|
1447
|
+
readonly saveWorkoutRoute: (workoutUUID: string, locations: readonly CLLocationRawForSaving[]) => Promise<boolean>;
|
|
1428
1448
|
readonly queryCorrelationSamples: <TIdentifier extends HKCorrelationTypeIdentifier>(typeIdentifier: TIdentifier, from: string, to: string) => Promise<readonly HKCorrelationRaw<TIdentifier>[]>;
|
|
1429
1449
|
subscribeToObserverQuery(identifier: HKSampleTypeIdentifier): Promise<QueryId>;
|
|
1430
1450
|
unsubscribeQuery(queryId: QueryId): Promise<boolean>;
|
|
1431
1451
|
/**
|
|
1432
|
-
|
|
1433
|
-
|
|
1452
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus Apple Docs }
|
|
1453
|
+
*/
|
|
1434
1454
|
authorizationStatusFor(type: HealthkitReadAuthorization): Promise<HKAuthorizationStatus>;
|
|
1435
1455
|
/**
|
|
1436
|
-
|
|
1456
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/2994346-getrequeststatusforauthorization Apple Docs }
|
|
1437
1457
|
*/
|
|
1438
1458
|
getRequestStatusForAuthorization(write: WritePermissions, read: ReadPermissions): Promise<HKAuthorizationRequestStatus>;
|
|
1439
1459
|
/**
|
|
1440
|
-
|
|
1460
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs }
|
|
1441
1461
|
*/
|
|
1442
1462
|
requestAuthorization(write: WritePermissions, read: ReadPermissions): Promise<boolean>;
|
|
1443
1463
|
readonly saveQuantitySample: <TType extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TType> = UnitForIdentifier<TType>>(identifier: TType, unit: TUnit, value: number, start: string, end: string, metadata: unknown) => Promise<boolean>;
|
|
@@ -1455,6 +1475,10 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
1455
1475
|
readonly queryStatisticsForQuantity: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: HKQuantityTypeIdentifier, unit: TUnit, from: string, to: string, options: readonly HKStatisticsOptions[]) => Promise<QueryStatisticsResponseRaw<TIdentifier, TUnit>>;
|
|
1456
1476
|
readonly getPreferredUnits: (identifiers: readonly HKQuantityTypeIdentifier[]) => Promise<TypeToUnitMapping>;
|
|
1457
1477
|
readonly getWorkoutRoutes: (workoutUUID: string) => Promise<readonly WorkoutRoute[]>;
|
|
1478
|
+
readonly getWorkoutPlanById: (workoutUUID: string) => Promise<{
|
|
1479
|
+
readonly id: string;
|
|
1480
|
+
readonly activityType: HKWorkoutActivityType;
|
|
1481
|
+
} | null>;
|
|
1458
1482
|
};
|
|
1459
1483
|
declare const Native: ReactNativeHealthkitTypeNative;
|
|
1460
1484
|
type OnChangeCallback = ({ typeIdentifier, }: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnergyUnit, HKCategorySampleRaw, HKCategoryTypeIdentifier, HKCorrelationRaw, HKCorrelationTypeIdentifier, HKDevice, HKHeartbeatSeriesSampleRaw, HKQuantityTypeIdentifier, HKSourceRevision, HKUnit, HKWorkoutRaw, LengthUnit, MetadataMapperForQuantityIdentifier, QueryStatisticsResponseRaw, UnitForIdentifier } from './native-types';
|
|
1
|
+
import type { CLLocationRawForSaving, EnergyUnit, HKCategorySampleRaw, HKCategoryTypeIdentifier, HKCorrelationRaw, HKCorrelationTypeIdentifier, HKDevice, HKHeartbeatSeriesSampleRaw, HKQuantityTypeIdentifier, HKSourceRevision, HKUnit, HKWorkoutRaw, LengthUnit, MetadataMapperForQuantityIdentifier, QueryStatisticsResponseRaw, UnitForIdentifier } from './native-types';
|
|
2
2
|
export * from './native-types';
|
|
3
3
|
/**
|
|
4
4
|
* Options for querying workouts.
|
|
@@ -80,12 +80,18 @@ export interface QueryStatisticsResponse<TIdentifier extends HKQuantityTypeIdent
|
|
|
80
80
|
* Represents a category sample for saving.
|
|
81
81
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategorysample Apple Docs HKCategorySample}
|
|
82
82
|
*/
|
|
83
|
-
export type HKCategorySampleForSaving = Omit<HKCategorySample, 'device' | 'endDate' | 'startDate' | 'uuid'
|
|
83
|
+
export type HKCategorySampleForSaving = Omit<HKCategorySample, 'device' | 'endDate' | 'startDate' | 'uuid'> & {
|
|
84
|
+
readonly startDate?: Date;
|
|
85
|
+
readonly endDate?: Date;
|
|
86
|
+
};
|
|
84
87
|
/**
|
|
85
88
|
* Represents a quantity sample for saving.
|
|
86
89
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkquantitysample Apple Docs HKQuantitySample}
|
|
87
90
|
*/
|
|
88
|
-
export type HKQuantitySampleForSaving = Omit<HKQuantitySample, 'device' | 'endDate' | 'startDate' | 'uuid'
|
|
91
|
+
export type HKQuantitySampleForSaving = Omit<HKQuantitySample, 'device' | 'endDate' | 'startDate' | 'uuid'> & {
|
|
92
|
+
readonly startDate?: Date;
|
|
93
|
+
readonly endDate?: Date;
|
|
94
|
+
};
|
|
89
95
|
/**
|
|
90
96
|
* Represents a correlation.
|
|
91
97
|
* @template TIdentifier The correlation type identifier.
|
|
@@ -96,3 +102,10 @@ export interface HKCorrelation<TIdentifier extends HKCorrelationTypeIdentifier>
|
|
|
96
102
|
readonly startDate: Date;
|
|
97
103
|
readonly endDate: Date;
|
|
98
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Represents a location sample for saving.
|
|
107
|
+
* @see {@link https://developer.apple.com/documentation/corelocation/cllocation Apple Docs CLLocation}
|
|
108
|
+
*/
|
|
109
|
+
export type CLLocationForSaving = Omit<CLLocationRawForSaving, 'timestamp'> & {
|
|
110
|
+
readonly timestamp: number;
|
|
111
|
+
};
|
|
@@ -2,6 +2,10 @@ import type { HKWorkoutActivityType, HKWorkoutMetadata } from '../native-types';
|
|
|
2
2
|
import type { HKQuantitySampleForSaving } from '../types';
|
|
3
3
|
declare function saveWorkoutSample<TIdentifier extends HKWorkoutActivityType>(typeIdentifier: TIdentifier, quantities: readonly HKQuantitySampleForSaving[], _start: Date, options?: {
|
|
4
4
|
readonly end?: Date;
|
|
5
|
+
readonly totals?: {
|
|
6
|
+
readonly distance?: number;
|
|
7
|
+
readonly energyBurned?: number;
|
|
8
|
+
};
|
|
5
9
|
readonly metadata?: HKWorkoutMetadata;
|
|
6
|
-
}): Promise<
|
|
10
|
+
}): Promise<string | null>;
|
|
7
11
|
export default saveWorkoutSample;
|
package/package.json
CHANGED
package/src/index.ios.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import getMostRecentWorkout from './utils/getMostRecentWorkout'
|
|
|
16
16
|
import getPreferredUnit from './utils/getPreferredUnit'
|
|
17
17
|
import getPreferredUnits from './utils/getPreferredUnits'
|
|
18
18
|
import getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'
|
|
19
|
+
import getWorkoutPlanById from './utils/getWorkoutPlanById'
|
|
19
20
|
import queryCategorySamples from './utils/queryCategorySamples'
|
|
20
21
|
import queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'
|
|
21
22
|
import queryCorrelationSamples from './utils/queryCorrelationSamples'
|
|
@@ -30,6 +31,7 @@ import requestAuthorization from './utils/requestAuthorization'
|
|
|
30
31
|
import saveCategorySample from './utils/saveCategorySample'
|
|
31
32
|
import saveCorrelationSample from './utils/saveCorrelationSample'
|
|
32
33
|
import saveQuantitySample from './utils/saveQuantitySample'
|
|
34
|
+
import saveWorkoutRoute from './utils/saveWorkoutRoute'
|
|
33
35
|
import saveWorkoutSample from './utils/saveWorkoutSample'
|
|
34
36
|
import subscribeToChanges from './utils/subscribeToChanges'
|
|
35
37
|
|
|
@@ -149,6 +151,7 @@ export default {
|
|
|
149
151
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}
|
|
150
152
|
*/
|
|
151
153
|
getWorkoutRoutes,
|
|
154
|
+
getWorkoutPlanById,
|
|
152
155
|
|
|
153
156
|
getPreferredUnit,
|
|
154
157
|
getPreferredUnits,
|
|
@@ -181,6 +184,7 @@ export default {
|
|
|
181
184
|
saveCorrelationSample,
|
|
182
185
|
saveQuantitySample,
|
|
183
186
|
saveWorkoutSample,
|
|
187
|
+
saveWorkoutRoute,
|
|
184
188
|
|
|
185
189
|
// subscriptions
|
|
186
190
|
subscribeToChanges,
|
package/src/index.tsx
CHANGED
|
@@ -77,10 +77,12 @@ const Healthkit = {
|
|
|
77
77
|
requestAuthorization: UnavailableFn(Promise.resolve(false)),
|
|
78
78
|
deleteQuantitySample: UnavailableFn(Promise.resolve(false)),
|
|
79
79
|
deleteSamples: UnavailableFn(Promise.resolve(false)),
|
|
80
|
+
getWorkoutPlanById: UnavailableFn(Promise.resolve(null)),
|
|
80
81
|
saveCategorySample: UnavailableFn(Promise.resolve(false)),
|
|
81
82
|
saveCorrelationSample: UnavailableFn(Promise.resolve(false)),
|
|
82
83
|
saveQuantitySample: UnavailableFn(Promise.resolve(false)),
|
|
83
|
-
saveWorkoutSample: UnavailableFn(Promise.resolve(
|
|
84
|
+
saveWorkoutSample: UnavailableFn(Promise.resolve(null)),
|
|
85
|
+
saveWorkoutRoute: UnavailableFn(Promise.resolve(false)),
|
|
84
86
|
subscribeToChanges: UnavailableFn(Promise.resolve(async () => Promise.resolve(false))),
|
|
85
87
|
useMostRecentCategorySample: UnavailableFn(null),
|
|
86
88
|
useMostRecentQuantitySample: UnavailableFn(null),
|
package/src/jest.setup.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { NativeModule, NativeModules } from 'react-native'
|
|
|
2
2
|
|
|
3
3
|
import type Native from './native-types'
|
|
4
4
|
|
|
5
|
-
const mockModule:
|
|
5
|
+
const mockModule: NativeModule & typeof Native = {
|
|
6
6
|
isHealthDataAvailable: jest.fn(),
|
|
7
7
|
addListener: jest.fn(),
|
|
8
8
|
removeListeners: jest.fn(),
|
|
@@ -39,6 +39,8 @@ const mockModule: (NativeModule & typeof Native) = {
|
|
|
39
39
|
unsubscribeQuery: jest.fn(),
|
|
40
40
|
// Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)
|
|
41
41
|
canAccessProtectedData: jest.fn(),
|
|
42
|
+
saveWorkoutRoute: jest.fn(),
|
|
43
|
+
getWorkoutPlanById: jest.fn(),
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
NativeModules.ReactNativeHealthkit = mockModule
|