@kingstinct/react-native-healthkit 6.1.0 → 7.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.
- package/README.md +7 -5
- package/app.plugin.js +69 -0
- package/ios/Constants.swift +28 -0
- package/ios/Helpers.swift +152 -0
- package/ios/ReactNativeHealthkit.m +24 -0
- package/ios/ReactNativeHealthkit.swift +534 -728
- package/ios/Serializers.swift +206 -0
- package/lib/commonjs/hooks/useHealthkitAuthorization.js +0 -6
- package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +2 -9
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +1 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js +0 -6
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js.map +1 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +1 -6
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentCategorySample.js +1 -7
- package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js +0 -10
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentWorkout.js +0 -10
- package/lib/commonjs/hooks/useMostRecentWorkout.js.map +1 -1
- package/lib/commonjs/hooks/useSources.js +0 -5
- package/lib/commonjs/hooks/useSources.js.map +1 -1
- package/lib/commonjs/hooks/useStatisticsForQuantity.js +1 -7
- package/lib/commonjs/hooks/useStatisticsForQuantity.js.map +1 -1
- package/lib/commonjs/hooks/useSubscribeToChanges.js +0 -8
- package/lib/commonjs/hooks/useSubscribeToChanges.js.map +1 -1
- package/lib/commonjs/index.ios.js +6 -33
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +7 -11
- 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 +166 -250
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/test-utils.js +1 -3
- package/lib/commonjs/test-utils.js.map +1 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/deleteQuantitySample.js +0 -4
- package/lib/commonjs/utils/deleteQuantitySample.js.map +1 -1
- package/lib/commonjs/utils/deleteSamples.js +0 -4
- package/lib/commonjs/utils/deleteSamples.js.map +1 -1
- package/lib/commonjs/utils/deserializeCategorySample.js +2 -3
- package/lib/commonjs/utils/deserializeCategorySample.js.map +1 -1
- package/lib/commonjs/utils/deserializeCategorySample.test.js +3 -5
- package/lib/commonjs/utils/deserializeCategorySample.test.js.map +1 -1
- package/lib/commonjs/utils/deserializeCorrelation.js +2 -7
- package/lib/commonjs/utils/deserializeCorrelation.js.map +1 -1
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js +2 -3
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
- package/lib/commonjs/utils/deserializeSample.js +2 -3
- package/lib/commonjs/utils/deserializeSample.js.map +1 -1
- package/lib/commonjs/utils/deserializeWorkout.js +2 -3
- package/lib/commonjs/utils/deserializeWorkout.js.map +1 -1
- package/lib/commonjs/utils/ensureMetadata.js +0 -2
- package/lib/commonjs/utils/ensureMetadata.js.map +1 -1
- package/lib/commonjs/utils/ensureUnit.js +0 -5
- package/lib/commonjs/utils/ensureUnit.js.map +1 -1
- package/lib/commonjs/utils/getDateOfBirth.js +0 -4
- package/lib/commonjs/utils/getDateOfBirth.js.map +1 -1
- package/lib/commonjs/utils/getMostRecentCategorySample.js +1 -5
- package/lib/commonjs/utils/getMostRecentCategorySample.js.map +1 -1
- package/lib/commonjs/utils/getMostRecentQuantitySample.js +1 -5
- package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +1 -1
- package/lib/commonjs/utils/getMostRecentWorkout.js +0 -4
- package/lib/commonjs/utils/getMostRecentWorkout.js.map +1 -1
- package/lib/commonjs/utils/getPreferredUnit.js +0 -4
- package/lib/commonjs/utils/getPreferredUnit.js.map +1 -1
- package/lib/commonjs/utils/getPreferredUnits.js +0 -4
- package/lib/commonjs/utils/getPreferredUnits.js.map +1 -1
- package/lib/commonjs/utils/getPreferredUnitsTyped.js +0 -11
- package/lib/commonjs/utils/getPreferredUnitsTyped.js.map +1 -1
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js +4 -6
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js.map +1 -1
- package/lib/commonjs/utils/prepareOptions.js +0 -4
- package/lib/commonjs/utils/prepareOptions.js.map +1 -1
- package/lib/commonjs/utils/queryCategorySamples.js +3 -14
- package/lib/commonjs/utils/queryCategorySamples.js.map +1 -1
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js +22 -0
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js.map +1 -0
- package/lib/commonjs/utils/queryCorrelationSamples.js +1 -7
- package/lib/commonjs/utils/queryCorrelationSamples.js.map +1 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js +3 -13
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js.map +1 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js +22 -0
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -0
- package/lib/commonjs/utils/queryQuantitySamples.js +3 -15
- package/lib/commonjs/utils/queryQuantitySamples.js.map +1 -1
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js +24 -0
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js.map +1 -0
- package/lib/commonjs/utils/querySources.js +0 -4
- package/lib/commonjs/utils/querySources.js.map +1 -1
- package/lib/commonjs/utils/queryStatisticsForQuantity.js +3 -7
- package/lib/commonjs/utils/queryStatisticsForQuantity.js.map +1 -1
- package/lib/commonjs/utils/queryWorkouts.js +1 -8
- package/lib/commonjs/utils/queryWorkouts.js.map +1 -1
- package/lib/commonjs/utils/requestAuthorization.js +4 -6
- package/lib/commonjs/utils/requestAuthorization.js.map +1 -1
- package/lib/commonjs/utils/saveCategorySample.js +0 -4
- package/lib/commonjs/utils/saveCategorySample.js.map +1 -1
- package/lib/commonjs/utils/saveCorrelationSample.js +3 -7
- package/lib/commonjs/utils/saveCorrelationSample.js.map +1 -1
- package/lib/commonjs/utils/saveQuantitySample.js +0 -4
- package/lib/commonjs/utils/saveQuantitySample.js.map +1 -1
- package/lib/commonjs/utils/saveWorkoutSample.js +3 -8
- package/lib/commonjs/utils/saveWorkoutSample.js.map +1 -1
- package/lib/commonjs/utils/serializeDate.js +0 -2
- package/lib/commonjs/utils/serializeDate.js.map +1 -1
- package/lib/commonjs/utils/serializeDate.test.js +0 -2
- package/lib/commonjs/utils/serializeDate.test.js.map +1 -1
- package/lib/commonjs/utils/subscribeToChanges.js +0 -7
- package/lib/commonjs/utils/subscribeToChanges.js.map +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.js +0 -2
- package/lib/module/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.test.js +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.test.js.map +1 -1
- package/lib/module/hooks/useIsHealthDataAvailable.js +0 -3
- package/lib/module/hooks/useIsHealthDataAvailable.js.map +1 -1
- package/lib/module/hooks/useIsHealthDataAvailable.test.js +1 -1
- package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +1 -1
- package/lib/module/hooks/useMostRecentCategorySample.js +1 -3
- package/lib/module/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/module/hooks/useMostRecentQuantitySample.js +0 -5
- package/lib/module/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/module/hooks/useMostRecentWorkout.js +0 -5
- package/lib/module/hooks/useMostRecentWorkout.js.map +1 -1
- package/lib/module/hooks/useSources.js +0 -2
- package/lib/module/hooks/useSources.js.map +1 -1
- package/lib/module/hooks/useStatisticsForQuantity.js +1 -3
- package/lib/module/hooks/useStatisticsForQuantity.js.map +1 -1
- package/lib/module/hooks/useSubscribeToChanges.js +0 -5
- package/lib/module/hooks/useSubscribeToChanges.js.map +1 -1
- package/lib/module/index.ios.js +6 -0
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js +8 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest.setup.js +3 -0
- package/lib/module/jest.setup.js.map +1 -1
- package/lib/module/native-types.js +134 -201
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/test-utils.js +0 -2
- package/lib/module/test-utils.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/deleteQuantitySample.js +0 -2
- package/lib/module/utils/deleteQuantitySample.js.map +1 -1
- package/lib/module/utils/deleteSamples.js +0 -2
- package/lib/module/utils/deleteSamples.js.map +1 -1
- package/lib/module/utils/deserializeCategorySample.js +2 -2
- package/lib/module/utils/deserializeCategorySample.js.map +1 -1
- package/lib/module/utils/deserializeCategorySample.test.js +3 -2
- package/lib/module/utils/deserializeCategorySample.test.js.map +1 -1
- package/lib/module/utils/deserializeCorrelation.js +2 -4
- package/lib/module/utils/deserializeCorrelation.js.map +1 -1
- package/lib/module/utils/deserializeHeartbeatSeriesSample.js +2 -2
- package/lib/module/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
- package/lib/module/utils/deserializeSample.js +2 -2
- package/lib/module/utils/deserializeSample.js.map +1 -1
- package/lib/module/utils/deserializeWorkout.js +2 -2
- package/lib/module/utils/deserializeWorkout.js.map +1 -1
- package/lib/module/utils/ensureMetadata.js +0 -1
- package/lib/module/utils/ensureMetadata.js.map +1 -1
- package/lib/module/utils/ensureUnit.js +0 -3
- package/lib/module/utils/ensureUnit.js.map +1 -1
- package/lib/module/utils/getDateOfBirth.js +0 -2
- package/lib/module/utils/getDateOfBirth.js.map +1 -1
- package/lib/module/utils/getMostRecentCategorySample.js +1 -3
- package/lib/module/utils/getMostRecentCategorySample.js.map +1 -1
- package/lib/module/utils/getMostRecentQuantitySample.js +1 -3
- package/lib/module/utils/getMostRecentQuantitySample.js.map +1 -1
- package/lib/module/utils/getMostRecentWorkout.js +0 -2
- package/lib/module/utils/getMostRecentWorkout.js.map +1 -1
- package/lib/module/utils/getPreferredUnit.js +0 -2
- package/lib/module/utils/getPreferredUnit.js.map +1 -1
- package/lib/module/utils/getPreferredUnits.js +0 -2
- package/lib/module/utils/getPreferredUnits.js.map +1 -1
- package/lib/module/utils/getPreferredUnitsTyped.js +0 -8
- package/lib/module/utils/getPreferredUnitsTyped.js.map +1 -1
- package/lib/module/utils/getRequestStatusForAuthorization.js +4 -4
- package/lib/module/utils/getRequestStatusForAuthorization.js.map +1 -1
- package/lib/module/utils/prepareOptions.js +0 -2
- package/lib/module/utils/prepareOptions.js.map +1 -1
- package/lib/module/utils/queryCategorySamples.js +3 -10
- package/lib/module/utils/queryCategorySamples.js.map +1 -1
- package/lib/module/utils/queryCategorySamplesWithAnchor.js +14 -0
- package/lib/module/utils/queryCategorySamplesWithAnchor.js.map +1 -0
- package/lib/module/utils/queryCorrelationSamples.js +1 -3
- package/lib/module/utils/queryCorrelationSamples.js.map +1 -1
- package/lib/module/utils/queryHeartbeatSeriesSamples.js +3 -9
- package/lib/module/utils/queryHeartbeatSeriesSamples.js.map +1 -1
- package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js +14 -0
- package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -0
- package/lib/module/utils/queryQuantitySamples.js +3 -10
- package/lib/module/utils/queryQuantitySamples.js.map +1 -1
- package/lib/module/utils/queryQuantitySamplesWithAnchor.js +16 -0
- package/lib/module/utils/queryQuantitySamplesWithAnchor.js.map +1 -0
- package/lib/module/utils/querySources.js +0 -2
- package/lib/module/utils/querySources.js.map +1 -1
- package/lib/module/utils/queryStatisticsForQuantity.js +3 -4
- package/lib/module/utils/queryStatisticsForQuantity.js.map +1 -1
- package/lib/module/utils/queryWorkouts.js +1 -3
- package/lib/module/utils/queryWorkouts.js.map +1 -1
- package/lib/module/utils/requestAuthorization.js +4 -4
- package/lib/module/utils/requestAuthorization.js.map +1 -1
- package/lib/module/utils/saveCategorySample.js +0 -2
- package/lib/module/utils/saveCategorySample.js.map +1 -1
- package/lib/module/utils/saveCorrelationSample.js +3 -4
- package/lib/module/utils/saveCorrelationSample.js.map +1 -1
- package/lib/module/utils/saveQuantitySample.js +0 -2
- package/lib/module/utils/saveQuantitySample.js.map +1 -1
- package/lib/module/utils/saveWorkoutSample.js +3 -5
- package/lib/module/utils/saveWorkoutSample.js.map +1 -1
- package/lib/module/utils/serializeDate.js +0 -1
- package/lib/module/utils/serializeDate.js.map +1 -1
- package/lib/module/utils/serializeDate.test.js.map +1 -1
- package/lib/module/utils/subscribeToChanges.js +0 -3
- package/lib/module/utils/subscribeToChanges.js.map +1 -1
- package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +2 -3
- package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +2 -3
- package/lib/typescript/src/index.ios.d.ts +4 -1
- package/lib/typescript/src/native-types.d.ts +66 -63
- package/lib/typescript/src/types.d.ts +3 -3
- package/lib/typescript/src/utils/deleteQuantitySample.d.ts +1 -1
- package/lib/typescript/src/utils/deleteSamples.d.ts +1 -1
- package/lib/typescript/src/utils/getMostRecentCategorySample.d.ts +1 -1
- package/lib/typescript/src/utils/getMostRecentQuantitySample.d.ts +1 -1
- package/lib/typescript/src/utils/getMostRecentWorkout.d.ts +1 -1
- package/lib/typescript/src/utils/getPreferredUnit.d.ts +1 -1
- package/lib/typescript/src/utils/getPreferredUnits.d.ts +1 -1
- package/lib/typescript/src/utils/queryCategorySamples.d.ts +3 -8
- package/lib/typescript/src/utils/queryCategorySamplesWithAnchor.d.ts +10 -0
- package/lib/typescript/src/utils/queryCorrelationSamples.d.ts +1 -1
- package/lib/typescript/src/utils/queryHeartbeatSeriesSamples.d.ts +2 -2
- package/lib/typescript/src/utils/queryHeartbeatSeriesSamplesWithAnchor.d.ts +10 -0
- package/lib/typescript/src/utils/queryQuantitySamples.d.ts +4 -9
- package/lib/typescript/src/utils/queryQuantitySamplesWithAnchor.d.ts +12 -0
- package/lib/typescript/src/utils/querySources.d.ts +1 -1
- package/package.json +20 -18
- package/src/hooks/useHealthkitAuthorization.test.ts +1 -1
- package/src/hooks/useIsHealthDataAvailable.test.ts +1 -1
- package/src/hooks/useMostRecentCategorySample.ts +3 -4
- package/src/hooks/useMostRecentQuantitySample.ts +2 -3
- package/src/hooks/useStatisticsForQuantity.ts +1 -1
- package/src/index.ios.tsx +6 -0
- package/src/index.tsx +10 -5
- package/src/jest.setup.ts +3 -0
- package/src/native-types.ts +28 -7
- package/src/utils/deserializeCategorySample.test.ts +1 -1
- package/src/utils/getMostRecentCategorySample.ts +1 -1
- package/src/utils/getMostRecentQuantitySample.ts +1 -1
- package/src/utils/queryCategorySamples.ts +6 -18
- package/src/utils/queryCategorySamplesWithAnchor.ts +39 -0
- package/src/utils/queryCorrelationSamples.ts +2 -2
- package/src/utils/queryHeartbeatSeriesSamples.ts +3 -8
- package/src/utils/queryHeartbeatSeriesSamplesWithAnchor.ts +33 -0
- package/src/utils/queryQuantitySamples.ts +8 -18
- package/src/utils/queryQuantitySamplesWithAnchor.ts +46 -0
- package/src/utils/queryStatisticsForQuantity.ts +1 -1
- package/src/utils/queryWorkouts.ts +1 -1
- package/src/utils/saveCorrelationSample.ts +1 -1
- package/src/utils/saveWorkoutSample.ts +1 -1
- package/android/.project +0 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/build.gradle +0 -130
- package/android/gradle.properties +0 -4
- package/android/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/kingstinctreactnativehealthkit/ReactNativeHealthkitModule.kt +0 -24
- package/android/src/main/java/com/kingstinctreactnativehealthkit/ReactNativeHealthkitPackage.kt +0 -20
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import Native from '../native-types';
|
|
2
|
-
|
|
3
2
|
async function saveCategorySample(identifier, value, options) {
|
|
4
3
|
const start = (options === null || options === void 0 ? void 0 : options.start) || (options === null || options === void 0 ? void 0 : options.end) || new Date();
|
|
5
4
|
const end = (options === null || options === void 0 ? void 0 : options.end) || (options === null || options === void 0 ? void 0 : options.start) || new Date();
|
|
6
5
|
const metadata = (options === null || options === void 0 ? void 0 : options.metadata) || {};
|
|
7
6
|
return Native.saveCategorySample(identifier, value, start.toISOString(), end.toISOString(), metadata || {});
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
export default saveCategorySample;
|
|
11
9
|
//# sourceMappingURL=saveCategorySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","saveCategorySample","identifier","value","options","start","end","Date","metadata","toISOString"],"sources":["saveCategorySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategoryValueForIdentifier, MetadataMapperForCategoryIdentifier } from '../native-types'\n\nasync function saveCategorySample<T extends HKCategoryTypeIdentifier>(\n identifier: T,\n value: HKCategoryValueForIdentifier<T>,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCategoryIdentifier<T>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveCategorySample(\n identifier,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata || {},\n )\n}\n\nexport default saveCategorySample\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","saveCategorySample","identifier","value","options","start","end","Date","metadata","toISOString"],"sources":["saveCategorySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategoryValueForIdentifier, MetadataMapperForCategoryIdentifier } from '../native-types'\n\nasync function saveCategorySample<T extends HKCategoryTypeIdentifier>(\n identifier: T,\n value: HKCategoryValueForIdentifier<T>,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCategoryIdentifier<T>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveCategorySample(\n identifier,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata || {},\n )\n}\n\nexport default saveCategorySample\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC,eAAeC,kBAAkBA,CAC/BC,UAAa,EACbC,KAAsC,EACtCC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,MAAID,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC;EAC1D,MAAMD,GAAG,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,MAAIF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIE,IAAI,CAAC,CAAC;EACxD,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,QAAQ,KAAI,CAAC,CAAC;EAExC,OAAOR,MAAM,CAACC,kBAAkB,CAC9BC,UAAU,EACVC,KAAK,EACLE,KAAK,CAACI,WAAW,CAAC,CAAC,EACnBH,GAAG,CAACG,WAAW,CAAC,CAAC,EACjBD,QAAQ,IAAI,CAAC,CACf,CAAC;AACH;AAEA,eAAeP,kBAAkB"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
1
|
import ensureMetadata from './ensureMetadata';
|
|
3
|
-
|
|
2
|
+
import Native from '../native-types';
|
|
4
3
|
async function saveCorrelationSample(typeIdentifier, samples, options) {
|
|
5
4
|
const start = ((options === null || options === void 0 ? void 0 : options.start) || new Date()).toISOString();
|
|
6
5
|
const end = ((options === null || options === void 0 ? void 0 : options.end) || new Date()).toISOString();
|
|
7
|
-
return Native.saveCorrelationSample(typeIdentifier, samples.map(s => ({
|
|
6
|
+
return Native.saveCorrelationSample(typeIdentifier, samples.map(s => ({
|
|
7
|
+
...s,
|
|
8
8
|
metadata: ensureMetadata(s.metadata)
|
|
9
9
|
})), start, end, ensureMetadata(options === null || options === void 0 ? void 0 : options.metadata));
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
export default saveCorrelationSample;
|
|
13
12
|
//# sourceMappingURL=saveCorrelationSample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ensureMetadata","Native","saveCorrelationSample","typeIdentifier","samples","options","start","Date","toISOString","end","map","s","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((s) => ({ ...s, metadata: ensureMetadata(s.metadata) })),\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,CAAC,KAAM;IAAE,GAAGA,CAAC;IAAEC,QAAQ,EAAEZ,cAAc,CAACW,CAAC,CAACC,QAAQ;EAAE,CAAC,CAAC,CAAC,EACpEN,KAAK,EACLG,GAAG,EACHT,cAAc,CAACK,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,QAAQ,CAClC,CAAC;AACH;AAEA,eAAeV,qBAAqB"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import Native from '../native-types';
|
|
2
|
-
|
|
3
2
|
async function saveQuantitySample(identifier, unit, value, options) {
|
|
4
3
|
const start = (options === null || options === void 0 ? void 0 : options.start) || (options === null || options === void 0 ? void 0 : options.end) || new Date();
|
|
5
4
|
const end = (options === null || options === void 0 ? void 0 : options.end) || (options === null || options === void 0 ? void 0 : options.start) || new Date();
|
|
6
5
|
const metadata = (options === null || options === void 0 ? void 0 : options.metadata) || {};
|
|
7
6
|
return Native.saveQuantitySample(identifier, unit, value, start.toISOString(), end.toISOString(), metadata);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
export default saveQuantitySample;
|
|
11
9
|
//# sourceMappingURL=saveQuantitySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","saveQuantitySample","identifier","unit","value","options","start","end","Date","metadata","toISOString"],"sources":["saveQuantitySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { MetadataMapperForQuantityIdentifier, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function saveQuantitySample<TType extends HKQuantityTypeIdentifier>(\n identifier: TType,\n unit: UnitForIdentifier<TType>,\n value: number,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForQuantityIdentifier<TType>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveQuantitySample(\n identifier,\n unit,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata,\n )\n}\n\nexport default saveQuantitySample\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","saveQuantitySample","identifier","unit","value","options","start","end","Date","metadata","toISOString"],"sources":["saveQuantitySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { MetadataMapperForQuantityIdentifier, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function saveQuantitySample<TType extends HKQuantityTypeIdentifier>(\n identifier: TType,\n unit: UnitForIdentifier<TType>,\n value: number,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForQuantityIdentifier<TType>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveQuantitySample(\n identifier,\n unit,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata,\n )\n}\n\nexport default saveQuantitySample\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC,eAAeC,kBAAkBA,CAC/BC,UAAiB,EACjBC,IAA8B,EAC9BC,KAAa,EACbC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,MAAID,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC;EAC1D,MAAMD,GAAG,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,MAAIF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIE,IAAI,CAAC,CAAC;EACxD,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,QAAQ,KAAI,CAAC,CAAC;EAExC,OAAOT,MAAM,CAACC,kBAAkB,CAC9BC,UAAU,EACVC,IAAI,EACJC,KAAK,EACLE,KAAK,CAACI,WAAW,CAAC,CAAC,EACnBH,GAAG,CAACG,WAAW,CAAC,CAAC,EACjBD,QACF,CAAC;AACH;AAEA,eAAeR,kBAAkB"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
1
|
import ensureMetadata from './ensureMetadata';
|
|
3
|
-
|
|
2
|
+
import Native from '../native-types';
|
|
4
3
|
async function saveWorkoutSample(typeIdentifier, quantities, _start, options) {
|
|
5
4
|
const start = _start.toISOString();
|
|
6
|
-
|
|
7
5
|
const end = ((options === null || options === void 0 ? void 0 : options.end) || new Date()).toISOString();
|
|
8
|
-
return Native.saveWorkoutSample(typeIdentifier, quantities.map(s => ({
|
|
6
|
+
return Native.saveWorkoutSample(typeIdentifier, quantities.map(s => ({
|
|
7
|
+
...s,
|
|
9
8
|
metadata: ensureMetadata(s.metadata)
|
|
10
9
|
})), start, end, ensureMetadata(options === null || options === void 0 ? void 0 : options.metadata));
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
export default saveWorkoutSample;
|
|
14
12
|
//# sourceMappingURL=saveWorkoutSample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ensureMetadata","Native","saveWorkoutSample","typeIdentifier","quantities","_start","options","start","toISOString","end","Date","map","s","metadata"],"sources":["saveWorkoutSample.ts"],"sourcesContent":["import ensureMetadata from './ensureMetadata'\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 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(((s) => ({ ...s, metadata: ensureMetadata(s.metadata) }))),\n start,\n end,\n ensureMetadata(options?.metadata),\n )\n}\n\nexport default saveWorkoutSample\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAKpC,eAAeC,iBAAiBA,CAC9BC,cAA2B,EAC3BC,UAAgD,EAChDC,MAAY,EACZC,OAGC,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,CAAGC,CAAC,KAAM;IAAE,GAAGA,CAAC;IAAEC,QAAQ,EAAEb,cAAc,CAACY,CAAC,CAACC,QAAQ;EAAE,CAAC,CAAE,CAAC,EACzEN,KAAK,EACLE,GAAG,EACHT,cAAc,CAACM,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,QAAQ,CAClC,CAAC;AACH;AAEA,eAAeX,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["serializeDate","date","Date","toISOString"],"sources":["serializeDate.ts"],"sourcesContent":["const serializeDate = (date?: Date | null): string => (\n (date || new Date(-1)).toISOString()\n)\n\nexport default serializeDate\n"],"mappings":"AAAA,MAAMA,aAAa,GAAIC,
|
|
1
|
+
{"version":3,"names":["serializeDate","date","Date","toISOString"],"sources":["serializeDate.ts"],"sourcesContent":["const serializeDate = (date?: Date | null): string => (\n (date || new Date(-1)).toISOString()\n)\n\nexport default serializeDate\n"],"mappings":"AAAA,MAAMA,aAAa,GAAIC,IAAkB,IACvC,CAACA,IAAI,IAAI,IAAIC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAEC,WAAW,CAAC,CACpC;AAED,eAAeH,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["serializeDate","describe","it","expect","Date","toBe","date","toISOString"],"sources":["serializeDate.test.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\ndescribe('serializeDate', () => {\n it('should serialize zero date', () => {\n expect(serializeDate(new Date(0))).toBe('1970-01-01T00:00:00.000Z')\n })\n\n it('should serialize date', () => {\n const date = new Date()\n expect(serializeDate(date)).toBe(date.toISOString())\n })\n\n it('should serialize null date', () => {\n expect(serializeDate(null)).toBe('1969-12-31T23:59:59.999Z')\n })\n})\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["serializeDate","describe","it","expect","Date","toBe","date","toISOString"],"sources":["serializeDate.test.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\ndescribe('serializeDate', () => {\n it('should serialize zero date', () => {\n expect(serializeDate(new Date(0))).toBe('1970-01-01T00:00:00.000Z')\n })\n\n it('should serialize date', () => {\n const date = new Date()\n expect(serializeDate(date)).toBe(date.toISOString())\n })\n\n it('should serialize null date', () => {\n expect(serializeDate(null)).toBe('1969-12-31T23:59:59.999Z')\n })\n})\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3CC,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9BC,EAAE,CAAC,4BAA4B,EAAE,MAAM;IACrCC,MAAM,CAACH,aAAa,CAAC,IAAII,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,0BAA0B,CAAC;EACrE,CAAC,CAAC;EAEFH,EAAE,CAAC,uBAAuB,EAAE,MAAM;IAChC,MAAMI,IAAI,GAAG,IAAIF,IAAI,CAAC,CAAC;IACvBD,MAAM,CAACH,aAAa,CAACM,IAAI,CAAC,CAAC,CAACD,IAAI,CAACC,IAAI,CAACC,WAAW,CAAC,CAAC,CAAC;EACtD,CAAC,CAAC;EAEFL,EAAE,CAAC,4BAA4B,EAAE,MAAM;IACrCC,MAAM,CAACH,aAAa,CAAC,IAAI,CAAC,CAAC,CAACK,IAAI,CAAC,0BAA0B,CAAC;EAC9D,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import Native, { EventEmitter } from '../native-types';
|
|
2
|
-
|
|
3
2
|
const subscribeToChanges = async (identifier, callback) => {
|
|
4
3
|
const subscription = EventEmitter.addListener('onChange', _ref => {
|
|
5
4
|
let {
|
|
6
5
|
typeIdentifier
|
|
7
6
|
} = _ref;
|
|
8
|
-
|
|
9
7
|
if (typeIdentifier === identifier) {
|
|
10
8
|
callback();
|
|
11
9
|
}
|
|
@@ -19,6 +17,5 @@ const subscribeToChanges = async (identifier, callback) => {
|
|
|
19
17
|
return Native.unsubscribeQuery(queryId);
|
|
20
18
|
};
|
|
21
19
|
};
|
|
22
|
-
|
|
23
20
|
export default subscribeToChanges;
|
|
24
21
|
//# sourceMappingURL=subscribeToChanges.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","EventEmitter","subscribeToChanges","identifier","callback","subscription","addListener","typeIdentifier","queryId","subscribeToObserverQuery","catch","error","remove","Promise","reject","unsubscribeQuery"],"sources":["subscribeToChanges.ts"],"sourcesContent":["import Native, { EventEmitter } from '../native-types'\n\nimport type { HKSampleTypeIdentifier } from '..'\n\nconst subscribeToChanges = async (\n identifier: HKSampleTypeIdentifier,\n callback: () => void,\n) => {\n const subscription = EventEmitter.addListener(\n 'onChange',\n ({ typeIdentifier }) => {\n if (typeIdentifier === identifier) {\n callback()\n }\n },\n )\n\n const queryId = await Native.subscribeToObserverQuery(identifier).catch(\n async (error) => {\n subscription.remove()\n return Promise.reject(error)\n },\n )\n\n return async () => {\n subscription.remove()\n return Native.unsubscribeQuery(queryId)\n }\n}\n\nexport default subscribeToChanges\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","EventEmitter","subscribeToChanges","identifier","callback","subscription","addListener","_ref","typeIdentifier","queryId","subscribeToObserverQuery","catch","error","remove","Promise","reject","unsubscribeQuery"],"sources":["subscribeToChanges.ts"],"sourcesContent":["import Native, { EventEmitter } from '../native-types'\n\nimport type { HKSampleTypeIdentifier } from '..'\n\nconst subscribeToChanges = async (\n identifier: HKSampleTypeIdentifier,\n callback: () => void,\n) => {\n const subscription = EventEmitter.addListener(\n 'onChange',\n ({ typeIdentifier }) => {\n if (typeIdentifier === identifier) {\n callback()\n }\n },\n )\n\n const queryId = await Native.subscribeToObserverQuery(identifier).catch(\n async (error) => {\n subscription.remove()\n return Promise.reject(error)\n },\n )\n\n return async () => {\n subscription.remove()\n return Native.unsubscribeQuery(queryId)\n }\n}\n\nexport default subscribeToChanges\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,YAAY,QAAQ,iBAAiB;AAItD,MAAMC,kBAAkB,GAAG,MAAAA,CACzBC,UAAkC,EAClCC,QAAoB,KACjB;EACH,MAAMC,YAAY,GAAGJ,YAAY,CAACK,WAAW,CAC3C,UAAU,EACVC,IAAA,IAAwB;IAAA,IAAvB;MAAEC;IAAe,CAAC,GAAAD,IAAA;IACjB,IAAIC,cAAc,KAAKL,UAAU,EAAE;MACjCC,QAAQ,CAAC,CAAC;IACZ;EACF,CACF,CAAC;EAED,MAAMK,OAAO,GAAG,MAAMT,MAAM,CAACU,wBAAwB,CAACP,UAAU,CAAC,CAACQ,KAAK,CACrE,MAAOC,KAAK,IAAK;IACfP,YAAY,CAACQ,MAAM,CAAC,CAAC;IACrB,OAAOC,OAAO,CAACC,MAAM,CAACH,KAAK,CAAC;EAC9B,CACF,CAAC;EAED,OAAO,YAAY;IACjBP,YAAY,CAACQ,MAAM,CAAC,CAAC;IACrB,OAAOb,MAAM,CAACgB,gBAAgB,CAACP,OAAO,CAAC;EACzC,CAAC;AACH,CAAC;AAED,eAAeP,kBAAkB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { HKCategoryTypeIdentifier } from '../native-types';
|
|
2
|
-
|
|
3
|
-
declare function useMostRecentCategorySample<TCategory extends HKCategoryTypeIdentifier>(identifier: TCategory): HKCategorySample<TCategory> | null;
|
|
1
|
+
import type { HKCategorySampleRaw, HKCategoryTypeIdentifier } from '../native-types';
|
|
2
|
+
declare function useMostRecentCategorySample<TCategory extends HKCategoryTypeIdentifier>(identifier: TCategory): HKCategorySampleRaw<TCategory> | null;
|
|
4
3
|
export default useMostRecentCategorySample;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
|
|
2
|
-
|
|
3
|
-
declare function useMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit?: TUnit): HKQuantitySample<TIdentifier, UnitForIdentifier<TIdentifier>> | null;
|
|
1
|
+
import type { HKQuantitySampleRaw, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
|
|
2
|
+
declare function useMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit?: TUnit): HKQuantitySampleRaw<TIdentifier, UnitForIdentifier<TIdentifier>> | null;
|
|
4
3
|
export default useMostRecentQuantitySample;
|
|
@@ -11,7 +11,7 @@ import saveCorrelationSample from './utils/saveCorrelationSample';
|
|
|
11
11
|
import saveQuantitySample from './utils/saveQuantitySample';
|
|
12
12
|
import saveWorkoutSample from './utils/saveWorkoutSample';
|
|
13
13
|
declare const Healthkit: {
|
|
14
|
-
authorizationStatusFor: (type: import("./native-types").HealthkitReadAuthorization) => Promise<
|
|
14
|
+
authorizationStatusFor: (type: import("./native-types").HealthkitReadAuthorization) => Promise<import("./native-types").HKAuthorizationStatus>;
|
|
15
15
|
isHealthDataAvailable: () => Promise<boolean>;
|
|
16
16
|
canAccessProtectedData: () => Promise<boolean>;
|
|
17
17
|
disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
@@ -30,9 +30,12 @@ declare const Healthkit: {
|
|
|
30
30
|
getPreferredUnits: import("./utils/getPreferredUnits").GetPreferredUnitsFn;
|
|
31
31
|
getRequestStatusForAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[]) => Promise<import("./native-types").HKAuthorizationRequestStatus>;
|
|
32
32
|
queryCategorySamples: import("./utils/queryCategorySamples").QueryCategorySamplesFn;
|
|
33
|
+
queryCategorySamplesWithAnchor: import("./utils/queryCategorySamplesWithAnchor").QueryCategorySamplesWithAnchorFn;
|
|
33
34
|
queryCorrelationSamples: import("./utils/queryCorrelationSamples").QueryCorrelationSamplesFn;
|
|
34
35
|
queryHeartbeatSeriesSamples: import("./utils/queryHeartbeatSeriesSamples").QueryHeartbeatSeriesSamplesFn;
|
|
36
|
+
queryHeartbeatSeriesSamplesWithAnchor: import("./utils/queryHeartbeatSeriesSamplesWithAnchor").QueryHeartbeatSeriesSamplesFn;
|
|
35
37
|
queryQuantitySamples: import("./utils/queryQuantitySamples").QueryQuantitySamplesFn;
|
|
38
|
+
queryQuantitySamplesWithAnchor: import("./utils/queryQuantitySamplesWithAnchor").QueryQuantitySamplesWithAnchorFn;
|
|
36
39
|
queryStatisticsForQuantity: typeof queryStatisticsForQuantity;
|
|
37
40
|
queryWorkouts: typeof queryWorkouts;
|
|
38
41
|
querySources: import("./utils/querySources").QuerySourcesFn;
|
|
@@ -103,7 +103,7 @@ export declare enum HKQuantityTypeIdentifier {
|
|
|
103
103
|
waterTemperature = "HKQuantityTypeIdentifierWaterTemperature",
|
|
104
104
|
appleSleepingWristTemperature = "HKQuantityTypeIdentifierAppleSleepingWristTemperature"
|
|
105
105
|
}
|
|
106
|
-
export
|
|
106
|
+
export type TypeToUnitMapping = {
|
|
107
107
|
readonly [key in HKQuantityTypeIdentifier]: HKUnit;
|
|
108
108
|
};
|
|
109
109
|
export declare enum HKCategoryValueLowCardioFitnessEvent {
|
|
@@ -182,9 +182,9 @@ export declare enum HKCategoryTypeIdentifier {
|
|
|
182
182
|
vomiting = "HKCategoryTypeIdentifierVomiting",
|
|
183
183
|
wheezing = "HKCategoryTypeIdentifierWheezing"
|
|
184
184
|
}
|
|
185
|
-
export
|
|
186
|
-
export
|
|
187
|
-
export
|
|
185
|
+
export type HKSampleTypeIdentifier = HKCategoryTypeIdentifier | HKCorrelationTypeIdentifier | HKQuantityTypeIdentifier | typeof HKAudiogramTypeIdentifier | typeof HKDataTypeIdentifierHeartbeatSeries | typeof HKWorkoutRouteTypeIdentifier | typeof HKWorkoutTypeIdentifier | `${HKCategoryTypeIdentifier}` | `${HKCorrelationTypeIdentifier}` | `${HKQuantityTypeIdentifier}`;
|
|
186
|
+
export type HealthkitReadAuthorization = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier | `${HKCharacteristicTypeIdentifier}` | `${HKSampleTypeIdentifier}`;
|
|
187
|
+
export type HealthkitWriteAuthorization = HKSampleTypeIdentifier;
|
|
188
188
|
export declare enum HKCategoryValueAppleStandHour {
|
|
189
189
|
stood = 0,
|
|
190
190
|
idle = 1
|
|
@@ -268,7 +268,7 @@ export declare enum HKWorkoutActivityType {
|
|
|
268
268
|
fitnessGaming = 76,
|
|
269
269
|
other = 3000
|
|
270
270
|
}
|
|
271
|
-
export
|
|
271
|
+
export type HKGenericMetadata = {
|
|
272
272
|
readonly [key: string]: HKQuantity | boolean | number | string | undefined;
|
|
273
273
|
readonly HKExternalUUID?: string;
|
|
274
274
|
readonly HKTimeZone?: string;
|
|
@@ -336,7 +336,7 @@ export declare enum HKAuthorizationStatus {
|
|
|
336
336
|
sharingDenied = 1,
|
|
337
337
|
sharingAuthorized = 2
|
|
338
338
|
}
|
|
339
|
-
export
|
|
339
|
+
export type HKQuantity<TIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>> = {
|
|
340
340
|
readonly unit: TUnit;
|
|
341
341
|
readonly quantity: number;
|
|
342
342
|
};
|
|
@@ -376,7 +376,7 @@ export declare enum HKStatisticsOptions {
|
|
|
376
376
|
mostRecent = "mostRecent",
|
|
377
377
|
separateBySource = "separateBySource"
|
|
378
378
|
}
|
|
379
|
-
export
|
|
379
|
+
export type QueryStatisticsResponseRaw<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>> = {
|
|
380
380
|
readonly averageQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
381
381
|
readonly maximumQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
382
382
|
readonly minimumQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
@@ -436,32 +436,32 @@ export declare enum HKCategoryValueSeverity {
|
|
|
436
436
|
export declare enum HKCategoryValueNotApplicable {
|
|
437
437
|
notApplicable = 0
|
|
438
438
|
}
|
|
439
|
-
export
|
|
439
|
+
export type HKCategoryValue = HKCategoryValueAppetiteChanges | HKCategoryValueCervicalMucusQuality | HKCategoryValueLowCardioFitnessEvent | HKCategoryValueMenstrualFlow | HKCategoryValueOvulationTestResult | HKCategoryValuePresence | HKCategoryValueSeverity | HKCategoryValueSleepAnalysis | number;
|
|
440
440
|
export declare enum HKInsulinDeliveryReason {
|
|
441
441
|
basal = 1,
|
|
442
442
|
bolus = 2
|
|
443
443
|
}
|
|
444
|
-
export
|
|
444
|
+
export type MetadataMapperForQuantityIdentifier<TQuantityTypeIdentifier = HKQuantityTypeIdentifier> = TQuantityTypeIdentifier extends HKQuantityTypeIdentifier.insulinDelivery ? HKGenericMetadata & {
|
|
445
445
|
readonly HKInsulinDeliveryReason: HKInsulinDeliveryReason;
|
|
446
446
|
} : TQuantityTypeIdentifier extends HKQuantityTypeIdentifier.bloodGlucose ? HKGenericMetadata & {
|
|
447
447
|
readonly HKBloodGlucoseMealTime?: number;
|
|
448
448
|
} : TQuantityTypeIdentifier extends HKQuantityTypeIdentifier.heartRate ? HKGenericMetadata & {
|
|
449
449
|
readonly HKHeartRateMotionContext?: HKHeartRateMotionContext;
|
|
450
450
|
} : HKGenericMetadata;
|
|
451
|
-
export
|
|
451
|
+
export type MetadataMapperForCorrelationIdentifier<TCorrelationTypeIdentifier = HKCorrelationTypeIdentifier> = TCorrelationTypeIdentifier extends HKCorrelationTypeIdentifier.food ? HKGenericMetadata & {
|
|
452
452
|
readonly HKFoodType?: string;
|
|
453
453
|
} : HKGenericMetadata;
|
|
454
|
-
export
|
|
455
|
-
export
|
|
454
|
+
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;
|
|
455
|
+
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;
|
|
456
456
|
declare enum HKCategoryValuePregnancyTestResult {
|
|
457
457
|
positive = 2,
|
|
458
458
|
negative = 1,
|
|
459
459
|
indeterminate = 3
|
|
460
460
|
}
|
|
461
|
-
export
|
|
461
|
+
export type HKHeartbeatSeriesSampleMetadata = HKGenericMetadata & {
|
|
462
462
|
readonly HKMetadataKeyAlgorithmVersion: string;
|
|
463
463
|
};
|
|
464
|
-
export
|
|
464
|
+
export type MetadataMapperForCategoryIdentifier<T extends HKCategoryTypeIdentifier> = T extends HKCategoryTypeIdentifier.sexualActivity ? HKGenericMetadata & {
|
|
465
465
|
readonly HKSexualActivityProtectionUsed: boolean;
|
|
466
466
|
} : T extends HKCategoryTypeIdentifier.menstrualFlow ? HKGenericMetadata & {
|
|
467
467
|
readonly HKMenstrualCycleStart: boolean;
|
|
@@ -506,18 +506,18 @@ export declare enum HKUnits {
|
|
|
506
506
|
Count = "count",
|
|
507
507
|
InternationalUnit = "IU"
|
|
508
508
|
}
|
|
509
|
-
export
|
|
510
|
-
export
|
|
511
|
-
export
|
|
512
|
-
export
|
|
513
|
-
export
|
|
514
|
-
export
|
|
515
|
-
export
|
|
516
|
-
export
|
|
517
|
-
export
|
|
518
|
-
export
|
|
519
|
-
export
|
|
520
|
-
export
|
|
509
|
+
export type MeterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Meter}`;
|
|
510
|
+
export type LiterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Liter}`;
|
|
511
|
+
export type GramUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Gram}`;
|
|
512
|
+
export type PascalUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Pascal}`;
|
|
513
|
+
export type SecondUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Second}`;
|
|
514
|
+
export type JouleUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Joule}`;
|
|
515
|
+
export type HertzUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Hertz}`;
|
|
516
|
+
export type VoltUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Volt}`;
|
|
517
|
+
export type SiemenUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Siemen}`;
|
|
518
|
+
export type MoleUnit<MolarMass extends number> = `mol<${MolarMass}>`;
|
|
519
|
+
export type MoleUnitWith<MolarMass extends number, Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}mol<${MolarMass}>`;
|
|
520
|
+
export type FrequencyUnit = HertzUnit<HKMetricPrefix>;
|
|
521
521
|
/**
|
|
522
522
|
* More SI prefixes also available as literals, just type the string
|
|
523
523
|
* @example 'cm', 'km'
|
|
@@ -533,7 +533,7 @@ export declare enum UnitOfLength {
|
|
|
533
533
|
Yards = "yd",
|
|
534
534
|
Miles = "mi"
|
|
535
535
|
}
|
|
536
|
-
export
|
|
536
|
+
export type LengthUnit = MeterUnit<HKMetricPrefix> | UnitOfLength;
|
|
537
537
|
/**
|
|
538
538
|
* More SI prefixes also available as literals, just type the string
|
|
539
539
|
* @example 'ml', 'cl'
|
|
@@ -551,7 +551,7 @@ export declare enum UnitOfVolume {
|
|
|
551
551
|
*/
|
|
552
552
|
Liter = "l"
|
|
553
553
|
}
|
|
554
|
-
export
|
|
554
|
+
export type VolumeUnit = LiterUnit<HKMetricPrefix> | UnitOfVolume;
|
|
555
555
|
/**
|
|
556
556
|
* More SI prefixes also available as literals, just type the string
|
|
557
557
|
* @example 'mg', 'kg'
|
|
@@ -570,7 +570,7 @@ export declare enum UnitOfMass {
|
|
|
570
570
|
* More SI prefixes also available as literals, just type the string
|
|
571
571
|
* @example 'mg', 'kg'
|
|
572
572
|
*/
|
|
573
|
-
export
|
|
573
|
+
export type MassUnit = GramUnit<HKMetricPrefix> | UnitOfMass;
|
|
574
574
|
/**
|
|
575
575
|
* More SI prefixes also available as literals, just type the string
|
|
576
576
|
* @example 'kPa', 'hPa'
|
|
@@ -591,7 +591,7 @@ export declare enum UnitOfPressure {
|
|
|
591
591
|
* More SI prefixes also available as literals, just type the string
|
|
592
592
|
* @example 'kPa', 'hPa'
|
|
593
593
|
*/
|
|
594
|
-
export
|
|
594
|
+
export type PressureUnit = PascalUnit<HKMetricPrefix> | UnitOfPressure;
|
|
595
595
|
/**
|
|
596
596
|
* More SI prefixes also available as literals, just type the string
|
|
597
597
|
* @example 'ms'
|
|
@@ -610,7 +610,7 @@ export declare enum UnitOfTime {
|
|
|
610
610
|
* More SI prefixes also available as literals, just type the string
|
|
611
611
|
* @example 'ms'
|
|
612
612
|
*/
|
|
613
|
-
export
|
|
613
|
+
export type TimeUnit = SecondUnit<HKMetricPrefix> | UnitOfTime;
|
|
614
614
|
export declare enum TemperatureUnit {
|
|
615
615
|
DegreesCelsius = "degC",
|
|
616
616
|
DegreesFahrenheit = "degF",
|
|
@@ -630,15 +630,15 @@ export declare enum UnitOfEnergy {
|
|
|
630
630
|
*/
|
|
631
631
|
Joules = "J"
|
|
632
632
|
}
|
|
633
|
-
export
|
|
633
|
+
export type EnergyUnit = JouleUnit<HKMetricPrefix> | UnitOfEnergy;
|
|
634
634
|
export declare enum BloodGlucoseUnit {
|
|
635
635
|
GlucoseMmolPerL = "mmol<180.15588000005408>/l",
|
|
636
636
|
GlucoseMgPerDl = "mg/dL"
|
|
637
637
|
}
|
|
638
|
-
export
|
|
639
|
-
export
|
|
640
|
-
export
|
|
641
|
-
export
|
|
638
|
+
export type SpeedUnit<TLength extends LengthUnit, TTime extends TimeUnit> = `${TLength}/${TTime}`;
|
|
639
|
+
export type CountPerTime<TTime extends TimeUnit> = `count/${TTime}`;
|
|
640
|
+
export type HKUnit = BloodGlucoseUnit | CountPerTime<TimeUnit> | EnergyUnit | FrequencyUnit | HKUnits | LengthUnit | MassUnit | PressureUnit | SpeedUnit<LengthUnit, TimeUnit> | TemperatureUnit | TimeUnit | VolumeUnit | `${BloodGlucoseUnit}` | `${EnergyUnit}` | `${FrequencyUnit}` | `${HKUnits}` | `${LengthUnit}` | `${MassUnit}` | `${PressureUnit}` | `${TemperatureUnit}` | `${TimeUnit}` | `${VolumeUnit}`;
|
|
641
|
+
export type HKDevice = {
|
|
642
642
|
readonly name: string;
|
|
643
643
|
readonly firmwareVersion: string | null;
|
|
644
644
|
readonly hardwareVersion: string;
|
|
@@ -648,17 +648,17 @@ export declare type HKDevice = {
|
|
|
648
648
|
readonly softwareVersion: string;
|
|
649
649
|
readonly udiDeviceIdentifier: string | null;
|
|
650
650
|
};
|
|
651
|
-
export
|
|
651
|
+
export type HKSource = {
|
|
652
652
|
readonly name: string;
|
|
653
653
|
readonly bundleIdentifier: string;
|
|
654
654
|
};
|
|
655
|
-
export
|
|
655
|
+
export type HKSourceRevision = {
|
|
656
656
|
readonly source: HKSource;
|
|
657
657
|
readonly version: string;
|
|
658
658
|
readonly operatingSystemVersion?: string;
|
|
659
659
|
readonly productType?: string;
|
|
660
660
|
};
|
|
661
|
-
export
|
|
661
|
+
export type HKQuantitySampleRaw<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = {
|
|
662
662
|
readonly uuid: string;
|
|
663
663
|
readonly device?: HKDevice;
|
|
664
664
|
readonly quantityType: TQuantityIdentifier;
|
|
@@ -669,11 +669,11 @@ export declare type HKQuantitySampleRaw<TQuantityIdentifier extends HKQuantityTy
|
|
|
669
669
|
readonly metadata: MetadataMapperForQuantityIdentifier<TQuantityIdentifier>;
|
|
670
670
|
readonly sourceRevision?: HKSourceRevision;
|
|
671
671
|
};
|
|
672
|
-
export
|
|
672
|
+
export type HKHeartbeatRaw = {
|
|
673
673
|
readonly timeSinceSeriesStart: number;
|
|
674
674
|
readonly precededByGap: boolean;
|
|
675
675
|
};
|
|
676
|
-
export
|
|
676
|
+
export type HKHeartbeatSeriesSampleRaw = {
|
|
677
677
|
readonly uuid: string;
|
|
678
678
|
readonly device?: HKDevice;
|
|
679
679
|
readonly startDate: string;
|
|
@@ -682,9 +682,9 @@ export declare type HKHeartbeatSeriesSampleRaw = {
|
|
|
682
682
|
readonly metadata?: HKHeartbeatSeriesSampleMetadata;
|
|
683
683
|
readonly sourceRevision?: HKSourceRevision;
|
|
684
684
|
};
|
|
685
|
-
export
|
|
686
|
-
export
|
|
687
|
-
export
|
|
685
|
+
export type HKQuantitySampleRawForSaving<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = Omit<HKQuantitySampleRaw<TQuantityIdentifier, TUnit>, 'device' | 'endDate' | 'startDate' | 'uuid'>;
|
|
686
|
+
export type HKCategorySampleRawForSaving<TCategory extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier> = Omit<HKCategorySampleRaw<TCategory>, 'device' | 'endDate' | 'startDate' | 'uuid'>;
|
|
687
|
+
export type HKWorkoutRaw<TEnergy extends EnergyUnit, TDistance extends LengthUnit> = {
|
|
688
688
|
readonly uuid: string;
|
|
689
689
|
readonly device?: HKDevice;
|
|
690
690
|
readonly workoutActivityType: HKWorkoutActivityType;
|
|
@@ -706,13 +706,13 @@ export declare enum HKCharacteristicTypeIdentifier {
|
|
|
706
706
|
wheelchairUse = "HKCharacteristicTypeIdentifierWheelchairUse",
|
|
707
707
|
activityMoveMode = "HKCharacteristicTypeIdentifierActivityMoveMode"
|
|
708
708
|
}
|
|
709
|
-
export
|
|
709
|
+
export type WritePermissions = {
|
|
710
710
|
readonly [key in HKCategoryTypeIdentifier | HKCharacteristicTypeIdentifier | HKQuantityTypeIdentifier]: boolean;
|
|
711
711
|
};
|
|
712
|
-
export
|
|
712
|
+
export type ReadPermissions = {
|
|
713
713
|
readonly [key in HKCategoryTypeIdentifier | HKCharacteristicTypeIdentifier | HKQuantityTypeIdentifier]: boolean;
|
|
714
714
|
};
|
|
715
|
-
export
|
|
715
|
+
export type HKCategorySampleRaw<T extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier> = {
|
|
716
716
|
readonly uuid: string;
|
|
717
717
|
readonly device?: HKDevice;
|
|
718
718
|
readonly categoryType: T;
|
|
@@ -722,48 +722,48 @@ export declare type HKCategorySampleRaw<T extends HKCategoryTypeIdentifier = HKC
|
|
|
722
722
|
readonly metadata: MetadataMapperForCategoryIdentifier<T>;
|
|
723
723
|
readonly sourceRevision?: HKSourceRevision;
|
|
724
724
|
};
|
|
725
|
-
export
|
|
725
|
+
export type DeletedCategorySampleRaw<T extends HKCategoryTypeIdentifier> = {
|
|
726
726
|
readonly uuid: string;
|
|
727
727
|
readonly metadata: MetadataMapperForCategoryIdentifier<T>;
|
|
728
728
|
};
|
|
729
|
-
export
|
|
729
|
+
export type DeletedHeartbeatSeriesSampleRaw = {
|
|
730
730
|
readonly uuid: string;
|
|
731
731
|
readonly metadata: HKHeartbeatSeriesSampleMetadata;
|
|
732
732
|
};
|
|
733
|
-
export
|
|
733
|
+
export type DeletedQuantitySampleRaw<T extends HKQuantityTypeIdentifier> = {
|
|
734
734
|
readonly uuid: string;
|
|
735
735
|
readonly metadata: MetadataMapperForQuantityIdentifier<T>;
|
|
736
736
|
};
|
|
737
|
-
export
|
|
737
|
+
export type QueryCategorySamplesResponseRaw<T extends HKCategoryTypeIdentifier> = {
|
|
738
738
|
readonly samples: readonly HKCategorySampleRaw<T>[];
|
|
739
739
|
readonly deletedSamples: readonly DeletedCategorySampleRaw<T>[];
|
|
740
740
|
readonly newAnchor: string;
|
|
741
741
|
};
|
|
742
|
-
export
|
|
742
|
+
export type QueryHeartbeatSeriesSamplesResponseRaw = {
|
|
743
743
|
readonly samples: readonly HKHeartbeatSeriesSampleRaw[];
|
|
744
744
|
readonly deletedSamples: readonly DeletedHeartbeatSeriesSampleRaw[];
|
|
745
745
|
readonly newAnchor: string;
|
|
746
746
|
};
|
|
747
|
-
export
|
|
747
|
+
export type QueryQuantitySamplesResponseRaw<T extends HKQuantityTypeIdentifier> = {
|
|
748
748
|
readonly samples: readonly HKQuantitySampleRaw<T>[];
|
|
749
749
|
readonly deletedSamples: readonly DeletedQuantitySampleRaw<T>[];
|
|
750
750
|
readonly newAnchor: string;
|
|
751
751
|
};
|
|
752
|
-
export
|
|
752
|
+
export type HKCorrelationRaw<TIdentifier extends HKCorrelationTypeIdentifier> = {
|
|
753
753
|
readonly correlationType: HKCorrelationTypeIdentifier;
|
|
754
754
|
readonly objects: readonly (HKCategorySampleRaw | HKQuantitySampleRaw)[];
|
|
755
755
|
readonly metadata: MetadataMapperForCorrelationIdentifier<TIdentifier>;
|
|
756
756
|
readonly startDate: string;
|
|
757
757
|
readonly endDate: string;
|
|
758
758
|
};
|
|
759
|
-
|
|
759
|
+
type QueryId = string;
|
|
760
760
|
export declare enum HKUpdateFrequency {
|
|
761
761
|
immediate = 1,
|
|
762
762
|
hourly = 2,
|
|
763
763
|
daily = 3,
|
|
764
764
|
weekly = 4
|
|
765
765
|
}
|
|
766
|
-
export
|
|
766
|
+
export type WorkoutLocation = {
|
|
767
767
|
readonly longitude: number;
|
|
768
768
|
readonly latitude: number;
|
|
769
769
|
readonly altitude: number;
|
|
@@ -774,12 +774,12 @@ export declare type WorkoutLocation = {
|
|
|
774
774
|
readonly verticalAccuracy: number;
|
|
775
775
|
readonly distance: number | null;
|
|
776
776
|
};
|
|
777
|
-
export
|
|
777
|
+
export type WorkoutRoute = {
|
|
778
778
|
readonly locations: readonly WorkoutLocation[];
|
|
779
779
|
readonly HKMetadataKeySyncIdentifier?: string;
|
|
780
780
|
readonly HKMetadataKeySyncVersion?: number;
|
|
781
781
|
};
|
|
782
|
-
|
|
782
|
+
type ReactNativeHealthkitTypeNative = {
|
|
783
783
|
isHealthDataAvailable(): Promise<boolean>;
|
|
784
784
|
canAccessProtectedData(): Promise<boolean>;
|
|
785
785
|
getBloodType(): Promise<HKBloodType>;
|
|
@@ -795,16 +795,19 @@ declare type ReactNativeHealthkitTypeNative = {
|
|
|
795
795
|
readonly queryCorrelationSamples: <TIdentifier extends HKCorrelationTypeIdentifier>(typeIdentifier: TIdentifier, from: string, to: string) => Promise<readonly HKCorrelationRaw<TIdentifier>[]>;
|
|
796
796
|
subscribeToObserverQuery(identifier: HKSampleTypeIdentifier): Promise<QueryId>;
|
|
797
797
|
unsubscribeQuery(queryId: QueryId): Promise<boolean>;
|
|
798
|
-
authorizationStatusFor(type: HealthkitReadAuthorization): Promise<
|
|
798
|
+
authorizationStatusFor(type: HealthkitReadAuthorization): Promise<HKAuthorizationStatus>;
|
|
799
799
|
getRequestStatusForAuthorization(write: WritePermissions, read: ReadPermissions): Promise<HKAuthorizationRequestStatus>;
|
|
800
800
|
requestAuthorization(write: WritePermissions, read: ReadPermissions): Promise<boolean>;
|
|
801
801
|
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>;
|
|
802
802
|
readonly deleteQuantitySample: <TIdentifier extends HKQuantityTypeIdentifier>(typeIdentifier: TIdentifier, uuid: string) => Promise<boolean>;
|
|
803
803
|
readonly deleteSamples: <TIdentifier extends HKQuantityTypeIdentifier>(identifier: TIdentifier, start: string, end: string) => Promise<boolean>;
|
|
804
804
|
readonly queryWorkoutSamples: <TEnergy extends EnergyUnit, TDistance extends LengthUnit>(energyUnit: TEnergy, distanceUnit: TDistance, from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKWorkoutRaw<TEnergy, TDistance>[]>;
|
|
805
|
-
readonly queryCategorySamples: <T extends HKCategoryTypeIdentifier>(identifier: T, from: string, to: string, limit: number, ascending: boolean
|
|
806
|
-
readonly
|
|
807
|
-
readonly
|
|
805
|
+
readonly queryCategorySamples: <T extends HKCategoryTypeIdentifier>(identifier: T, from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKCategorySampleRaw<T>[]>;
|
|
806
|
+
readonly queryQuantitySamples: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit, from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKQuantitySampleRaw<TIdentifier>[]>;
|
|
807
|
+
readonly queryCategorySamplesWithAnchor: <T extends HKCategoryTypeIdentifier>(identifier: T, from: string, to: string, limit: number, anchor: string) => Promise<QueryCategorySamplesResponseRaw<T>>;
|
|
808
|
+
readonly queryQuantitySamplesWithAnchor: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit, from: string, to: string, limit: number, anchor: string) => Promise<QueryQuantitySamplesResponseRaw<TIdentifier>>;
|
|
809
|
+
readonly queryHeartbeatSeriesSamples: (from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKHeartbeatSeriesSampleRaw[]>;
|
|
810
|
+
readonly queryHeartbeatSeriesSamplesWithAnchor: (from: string, to: string, limit: number, anchor: string) => Promise<QueryHeartbeatSeriesSamplesResponseRaw>;
|
|
808
811
|
readonly querySources: <TIdentifier extends HKCategoryTypeIdentifier | HKQuantityTypeIdentifier>(identifier: TIdentifier) => Promise<readonly HKSource[]>;
|
|
809
812
|
readonly saveCategorySample: <T extends HKCategoryTypeIdentifier>(identifier: T, value: HKCategoryValueForIdentifier<T>, start: string, end: string, metadata: unknown) => Promise<boolean>;
|
|
810
813
|
readonly queryStatisticsForQuantity: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: HKQuantityTypeIdentifier, unit: TUnit, from: string, to: string, options: readonly HKStatisticsOptions[]) => Promise<QueryStatisticsResponseRaw<TIdentifier, TUnit>>;
|
|
@@ -812,7 +815,7 @@ declare type ReactNativeHealthkitTypeNative = {
|
|
|
812
815
|
readonly getWorkoutRoutes: (workoutUUID: string) => Promise<readonly WorkoutRoute[]>;
|
|
813
816
|
};
|
|
814
817
|
declare const Native: ReactNativeHealthkitTypeNative;
|
|
815
|
-
|
|
818
|
+
type OnChangeCallback = ({ typeIdentifier, }: {
|
|
816
819
|
readonly typeIdentifier: HKSampleTypeIdentifier;
|
|
817
820
|
}) => void;
|
|
818
821
|
interface HealthkitEventEmitter extends NativeEventEmitter {
|