@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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","ensureUnit","type","providedUnit","unit","getPreferredUnits"],"sources":["ensureUnit.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nconst ensureUnit = async <\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n type: TIdentifier,\n providedUnit?: TUnit,\n) => {\n if (providedUnit) {\n return providedUnit\n }\n const unit = await Native.getPreferredUnits([type])\n return unit[type] as TUnit\n}\n\nexport default ensureUnit\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","ensureUnit","type","providedUnit","unit","getPreferredUnits"],"sources":["ensureUnit.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nconst ensureUnit = async <\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n type: TIdentifier,\n providedUnit?: TUnit,\n) => {\n if (providedUnit) {\n return providedUnit\n }\n const unit = await Native.getPreferredUnits([type])\n return unit[type] as TUnit\n}\n\nexport default ensureUnit\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC,MAAMC,UAAU,GAAG,MAAAA,CAIjBC,IAAiB,EACjBC,YAAoB,KACjB;EACH,IAAIA,YAAY,EAAE;IAChB,OAAOA,YAAY;EACrB;EACA,MAAMC,IAAI,GAAG,MAAMJ,MAAM,CAACK,iBAAiB,CAAC,CAACH,IAAI,CAAC,CAAC;EACnD,OAAOE,IAAI,CAACF,IAAI,CAAC;AACnB,CAAC;AAED,eAAeD,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","getDateOfBirth","dateOfBirth","Date"],"sources":["getDateOfBirth.ts"],"sourcesContent":["import Native from '../native-types'\n\nconst getDateOfBirth = async () => {\n const dateOfBirth = await Native.getDateOfBirth()\n return new Date(dateOfBirth)\n}\n\nexport default getDateOfBirth\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","getDateOfBirth","dateOfBirth","Date"],"sources":["getDateOfBirth.ts"],"sourcesContent":["import Native from '../native-types'\n\nconst getDateOfBirth = async () => {\n const dateOfBirth = await Native.getDateOfBirth()\n return new Date(dateOfBirth)\n}\n\nexport default getDateOfBirth\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,MAAMC,cAAc,GAAG,MAAAA,CAAA,KAAY;EACjC,MAAMC,WAAW,GAAG,MAAMF,MAAM,CAACC,cAAc,CAAC,CAAC;EACjD,OAAO,IAAIE,IAAI,CAACD,WAAW,CAAC;AAC9B,CAAC;AAED,eAAeD,cAAc"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import queryCategorySamples from './queryCategorySamples';
|
|
2
|
-
|
|
3
2
|
async function getMostRecentCategorySample(identifier) {
|
|
4
3
|
const samples = await queryCategorySamples(identifier, {
|
|
5
4
|
limit: 1,
|
|
6
5
|
ascending: false
|
|
7
6
|
});
|
|
8
|
-
return samples
|
|
7
|
+
return samples[0] || null;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
export default getMostRecentCategorySample;
|
|
12
10
|
//# sourceMappingURL=getMostRecentCategorySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["queryCategorySamples","getMostRecentCategorySample","identifier","samples","limit","ascending"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n) {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples
|
|
1
|
+
{"version":3,"names":["queryCategorySamples","getMostRecentCategorySample","identifier","samples","limit","ascending"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n) {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples[0] || null\n}\n\nexport default getMostRecentCategorySample\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,wBAAwB;AAIzD,eAAeC,2BAA2BA,CAGxCC,UAAa,EACb;EACA,MAAMC,OAAO,GAAG,MAAMH,oBAAoB,CAACE,UAAU,EAAE;IACrDE,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,OAAOF,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC3B;AAEA,eAAeF,2BAA2B"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import queryQuantitySamples from './queryQuantitySamples';
|
|
2
|
-
|
|
3
2
|
async function getMostRecentQuantitySample(identifier, unit) {
|
|
4
3
|
const samples = await queryQuantitySamples(identifier, {
|
|
5
4
|
limit: 1,
|
|
6
5
|
unit
|
|
7
6
|
});
|
|
8
|
-
return samples
|
|
7
|
+
return samples[0] || null;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
export default getMostRecentQuantitySample;
|
|
12
10
|
//# sourceMappingURL=getMostRecentQuantitySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["queryQuantitySamples","getMostRecentQuantitySample","identifier","unit","samples","limit"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n) {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n return samples
|
|
1
|
+
{"version":3,"names":["queryQuantitySamples","getMostRecentQuantitySample","identifier","unit","samples","limit"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n) {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n return samples[0] || null\n}\n\nexport default getMostRecentQuantitySample\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,wBAAwB;AAIzD,eAAeC,2BAA2BA,CAIxCC,UAAuB,EACvBC,IAAW,EACX;EACA,MAAMC,OAAO,GAAG,MAAMJ,oBAAoB,CAACE,UAAU,EAAE;IACrDG,KAAK,EAAE,CAAC;IACRF;EACF,CAAC,CAAC;EACF,OAAOC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC3B;AAEA,eAAeH,2BAA2B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import queryWorkouts from './queryWorkouts';
|
|
2
|
-
|
|
3
2
|
const getMostRecentWorkout = async options => {
|
|
4
3
|
const workouts = await queryWorkouts({
|
|
5
4
|
limit: 1,
|
|
@@ -9,6 +8,5 @@ const getMostRecentWorkout = async options => {
|
|
|
9
8
|
});
|
|
10
9
|
return workouts[0] || null;
|
|
11
10
|
};
|
|
12
|
-
|
|
13
11
|
export default getMostRecentWorkout;
|
|
14
12
|
//# sourceMappingURL=getMostRecentWorkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["queryWorkouts","getMostRecentWorkout","options","workouts","limit","ascending","energyUnit","distanceUnit"],"sources":["getMostRecentWorkout.ts"],"sourcesContent":["import queryWorkouts from './queryWorkouts'\n\nimport type { EnergyUnit, LengthUnit } from '../native-types'\nimport type { HKWorkout, QueryWorkoutsOptions } from '../types'\n\nexport type GetMostRecentWorkoutFn = <\n TEnergy extends EnergyUnit,\n TDistance extends LengthUnit\n>(\n options?: Pick<\n QueryWorkoutsOptions<TEnergy, TDistance>,\n 'distanceUnit' | 'energyUnit'\n >\n) => Promise<HKWorkout<TEnergy, TDistance> | null>;\n\nconst getMostRecentWorkout: GetMostRecentWorkoutFn = async (options) => {\n const workouts = await queryWorkouts({\n limit: 1,\n ascending: false,\n energyUnit: options?.energyUnit,\n distanceUnit: options?.distanceUnit,\n })\n\n return workouts[0] || null\n}\n\nexport default getMostRecentWorkout\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["queryWorkouts","getMostRecentWorkout","options","workouts","limit","ascending","energyUnit","distanceUnit"],"sources":["getMostRecentWorkout.ts"],"sourcesContent":["import queryWorkouts from './queryWorkouts'\n\nimport type { EnergyUnit, LengthUnit } from '../native-types'\nimport type { HKWorkout, QueryWorkoutsOptions } from '../types'\n\nexport type GetMostRecentWorkoutFn = <\n TEnergy extends EnergyUnit,\n TDistance extends LengthUnit\n>(\n options?: Pick<\n QueryWorkoutsOptions<TEnergy, TDistance>,\n 'distanceUnit' | 'energyUnit'\n >\n) => Promise<HKWorkout<TEnergy, TDistance> | null>;\n\nconst getMostRecentWorkout: GetMostRecentWorkoutFn = async (options) => {\n const workouts = await queryWorkouts({\n limit: 1,\n ascending: false,\n energyUnit: options?.energyUnit,\n distanceUnit: options?.distanceUnit,\n })\n\n return workouts[0] || null\n}\n\nexport default getMostRecentWorkout\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAe3C,MAAMC,oBAA4C,GAAG,MAAOC,OAAO,IAAK;EACtE,MAAMC,QAAQ,GAAG,MAAMH,aAAa,CAAC;IACnCI,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE,KAAK;IAChBC,UAAU,EAAEJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,UAAU;IAC/BC,YAAY,EAAEL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK;EACzB,CAAC,CAAC;EAEF,OAAOJ,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI;AAC5B,CAAC;AAED,eAAeF,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getPreferredUnits","getPreferredUnit","type","unit"],"sources":["getPreferredUnit.ts"],"sourcesContent":["import getPreferredUnits from './getPreferredUnits'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitFn = (\n identifier: HKQuantityTypeIdentifier\n) => Promise<HKUnit | undefined>;\n\nconst getPreferredUnit: GetPreferredUnitFn = async (type) => {\n const [unit] = await getPreferredUnits([type])\n return unit\n}\n\nexport default getPreferredUnit\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["getPreferredUnits","getPreferredUnit","type","unit"],"sources":["getPreferredUnit.ts"],"sourcesContent":["import getPreferredUnits from './getPreferredUnits'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitFn = (\n identifier: HKQuantityTypeIdentifier\n) => Promise<HKUnit | undefined>;\n\nconst getPreferredUnit: GetPreferredUnitFn = async (type) => {\n const [unit] = await getPreferredUnits([type])\n return unit\n}\n\nexport default getPreferredUnit\n"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,qBAAqB;AAQnD,MAAMC,gBAAoC,GAAG,MAAOC,IAAI,IAAK;EAC3D,MAAM,CAACC,IAAI,CAAC,GAAG,MAAMH,iBAAiB,CAAC,CAACE,IAAI,CAAC,CAAC;EAC9C,OAAOC,IAAI;AACb,CAAC;AAED,eAAeF,gBAAgB"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import Native from '../native-types';
|
|
2
|
-
|
|
3
2
|
const getPreferredUnits = async identifiers => {
|
|
4
3
|
const units = await Native.getPreferredUnits(identifiers);
|
|
5
4
|
return identifiers.map(i => units[i]);
|
|
6
5
|
};
|
|
7
|
-
|
|
8
6
|
export default getPreferredUnits;
|
|
9
7
|
//# sourceMappingURL=getPreferredUnits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","getPreferredUnits","identifiers","units","map","i"],"sources":["getPreferredUnits.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitsFn = (\n identifiers: readonly HKQuantityTypeIdentifier[]\n) => Promise<readonly HKUnit[]>;\n\nconst getPreferredUnits: GetPreferredUnitsFn = async (identifiers) => {\n const units = await Native.getPreferredUnits(identifiers)\n return identifiers.map((i) => units[i])\n}\n\nexport default getPreferredUnits\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","getPreferredUnits","identifiers","units","map","i"],"sources":["getPreferredUnits.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitsFn = (\n identifiers: readonly HKQuantityTypeIdentifier[]\n) => Promise<readonly HKUnit[]>;\n\nconst getPreferredUnits: GetPreferredUnitsFn = async (identifiers) => {\n const units = await Native.getPreferredUnits(identifiers)\n return identifiers.map((i) => units[i])\n}\n\nexport default getPreferredUnits\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAQpC,MAAMC,iBAAsC,GAAG,MAAOC,WAAW,IAAK;EACpE,MAAMC,KAAK,GAAG,MAAMH,MAAM,CAACC,iBAAiB,CAACC,WAAW,CAAC;EACzD,OAAOA,WAAW,CAACE,GAAG,CAAEC,CAAC,IAAKF,KAAK,CAACE,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,eAAeJ,iBAAiB"}
|
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
import Native, { HKQuantityTypeIdentifier, UnitOfEnergy, UnitOfLength } from '../native-types';
|
|
2
|
-
|
|
3
2
|
async function getPreferredUnitsTyped(options) {
|
|
4
3
|
let energyUnit = options === null || options === void 0 ? void 0 : options.energyUnit;
|
|
5
4
|
let distanceUnit = options === null || options === void 0 ? void 0 : options.distanceUnit;
|
|
6
|
-
|
|
7
5
|
if (!energyUnit || !distanceUnit) {
|
|
8
6
|
const units = await Native.getPreferredUnits([HKQuantityTypeIdentifier.distanceWalkingRunning, HKQuantityTypeIdentifier.activeEnergyBurned]);
|
|
9
|
-
|
|
10
7
|
if (!energyUnit) {
|
|
11
8
|
energyUnit = units[HKQuantityTypeIdentifier.activeEnergyBurned];
|
|
12
9
|
}
|
|
13
|
-
|
|
14
10
|
if (!distanceUnit) {
|
|
15
11
|
distanceUnit = units[HKQuantityTypeIdentifier.distanceWalkingRunning];
|
|
16
12
|
}
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
if (!energyUnit) {
|
|
20
15
|
energyUnit = UnitOfEnergy.Kilocalories;
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
if (!distanceUnit) {
|
|
24
18
|
distanceUnit = UnitOfLength.Meter;
|
|
25
19
|
}
|
|
26
|
-
|
|
27
20
|
return {
|
|
28
21
|
energyUnit,
|
|
29
22
|
distanceUnit
|
|
30
23
|
};
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
export default getPreferredUnitsTyped;
|
|
34
26
|
//# sourceMappingURL=getPreferredUnitsTyped.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","HKQuantityTypeIdentifier","UnitOfEnergy","UnitOfLength","getPreferredUnitsTyped","options","energyUnit","distanceUnit","units","getPreferredUnits","distanceWalkingRunning","activeEnergyBurned","Kilocalories","Meter"],"sources":["getPreferredUnitsTyped.ts"],"sourcesContent":["import Native, { HKQuantityTypeIdentifier, UnitOfEnergy, UnitOfLength } from '../native-types'\n\nimport type { HKUnit } from '../native-types'\n\nasync function getPreferredUnitsTyped<\n TEnergy extends HKUnit,\n TDistance extends HKUnit\n>(options?: { readonly energyUnit?: TEnergy; readonly distanceUnit?: TDistance }) {\n let energyUnit = options?.energyUnit\n let distanceUnit = options?.distanceUnit\n\n if (!energyUnit || !distanceUnit) {\n const units = await Native.getPreferredUnits([\n HKQuantityTypeIdentifier.distanceWalkingRunning,\n HKQuantityTypeIdentifier.activeEnergyBurned,\n ])\n if (!energyUnit) {\n energyUnit = units[HKQuantityTypeIdentifier.activeEnergyBurned] as\n | TEnergy\n | undefined\n }\n if (!distanceUnit) {\n distanceUnit = units[HKQuantityTypeIdentifier.distanceWalkingRunning] as\n | TDistance\n | undefined\n }\n }\n\n if (!energyUnit) {\n energyUnit = UnitOfEnergy.Kilocalories as TEnergy\n }\n if (!distanceUnit) {\n distanceUnit = UnitOfLength.Meter as TDistance\n }\n return { energyUnit, distanceUnit }\n}\n\nexport default getPreferredUnitsTyped\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","HKQuantityTypeIdentifier","UnitOfEnergy","UnitOfLength","getPreferredUnitsTyped","options","energyUnit","distanceUnit","units","getPreferredUnits","distanceWalkingRunning","activeEnergyBurned","Kilocalories","Meter"],"sources":["getPreferredUnitsTyped.ts"],"sourcesContent":["import Native, { HKQuantityTypeIdentifier, UnitOfEnergy, UnitOfLength } from '../native-types'\n\nimport type { HKUnit } from '../native-types'\n\nasync function getPreferredUnitsTyped<\n TEnergy extends HKUnit,\n TDistance extends HKUnit\n>(options?: { readonly energyUnit?: TEnergy; readonly distanceUnit?: TDistance }) {\n let energyUnit = options?.energyUnit\n let distanceUnit = options?.distanceUnit\n\n if (!energyUnit || !distanceUnit) {\n const units = await Native.getPreferredUnits([\n HKQuantityTypeIdentifier.distanceWalkingRunning,\n HKQuantityTypeIdentifier.activeEnergyBurned,\n ])\n if (!energyUnit) {\n energyUnit = units[HKQuantityTypeIdentifier.activeEnergyBurned] as\n | TEnergy\n | undefined\n }\n if (!distanceUnit) {\n distanceUnit = units[HKQuantityTypeIdentifier.distanceWalkingRunning] as\n | TDistance\n | undefined\n }\n }\n\n if (!energyUnit) {\n energyUnit = UnitOfEnergy.Kilocalories as TEnergy\n }\n if (!distanceUnit) {\n distanceUnit = UnitOfLength.Meter as TDistance\n }\n return { energyUnit, distanceUnit }\n}\n\nexport default getPreferredUnitsTyped\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,wBAAwB,EAAEC,YAAY,EAAEC,YAAY,QAAQ,iBAAiB;AAI9F,eAAeC,sBAAsBA,CAGnCC,OAA8E,EAAE;EAChF,IAAIC,UAAU,GAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,UAAU;EACpC,IAAIC,YAAY,GAAGF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,YAAY;EAExC,IAAI,CAACD,UAAU,IAAI,CAACC,YAAY,EAAE;IAChC,MAAMC,KAAK,GAAG,MAAMR,MAAM,CAACS,iBAAiB,CAAC,CAC3CR,wBAAwB,CAACS,sBAAsB,EAC/CT,wBAAwB,CAACU,kBAAkB,CAC5C,CAAC;IACF,IAAI,CAACL,UAAU,EAAE;MACfA,UAAU,GAAGE,KAAK,CAACP,wBAAwB,CAACU,kBAAkB,CAEnD;IACb;IACA,IAAI,CAACJ,YAAY,EAAE;MACjBA,YAAY,GAAGC,KAAK,CAACP,wBAAwB,CAACS,sBAAsB,CAEzD;IACb;EACF;EAEA,IAAI,CAACJ,UAAU,EAAE;IACfA,UAAU,GAAGJ,YAAY,CAACU,YAAuB;EACnD;EACA,IAAI,CAACL,YAAY,EAAE;IACjBA,YAAY,GAAGJ,YAAY,CAACU,KAAkB;EAChD;EACA,OAAO;IAAEP,UAAU;IAAEC;EAAa,CAAC;AACrC;AAEA,eAAeH,sBAAsB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Native from '../native-types';
|
|
2
|
-
|
|
3
2
|
const getRequestStatusForAuthorization = async function (read) {
|
|
4
3
|
let write = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
5
|
-
const readPermissions = read.reduce((obj, cur) => ({
|
|
4
|
+
const readPermissions = read.reduce((obj, cur) => ({
|
|
5
|
+
...obj,
|
|
6
6
|
[cur]: true
|
|
7
7
|
}), {});
|
|
8
|
-
const writePermissions = write.reduce((obj, cur) => ({
|
|
8
|
+
const writePermissions = write.reduce((obj, cur) => ({
|
|
9
|
+
...obj,
|
|
9
10
|
[cur]: true
|
|
10
11
|
}), {});
|
|
11
12
|
return Native.getRequestStatusForAuthorization(writePermissions, readPermissions);
|
|
12
13
|
};
|
|
13
|
-
|
|
14
14
|
export default getRequestStatusForAuthorization;
|
|
15
15
|
//# sourceMappingURL=getRequestStatusForAuthorization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","getRequestStatusForAuthorization","read","write","readPermissions","reduce","obj","cur","writePermissions"],"sources":["getRequestStatusForAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\nconst getRequestStatusForAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n) => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.getRequestStatusForAuthorization(\n writePermissions,\n readPermissions,\n )\n}\n\nexport default getRequestStatusForAuthorization\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","getRequestStatusForAuthorization","read","write","arguments","length","undefined","readPermissions","reduce","obj","cur","writePermissions"],"sources":["getRequestStatusForAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\nconst getRequestStatusForAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n) => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.getRequestStatusForAuthorization(\n writePermissions,\n readPermissions,\n )\n}\n\nexport default getRequestStatusForAuthorization\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAMpC,MAAMC,gCAAgC,GAAG,eAAAA,CACvCC,IAA2C,EAExC;EAAA,IADHC,KAA6C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAElD,MAAMG,eAAe,GAAGL,IAAI,CAACM,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAoB,CAAC;EAEnG,MAAMC,gBAAgB,GAAGR,KAAK,CAACK,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAqB,CAAC;EAEtG,OAAOV,MAAM,CAACC,gCAAgC,CAC5CU,gBAAgB,EAChBJ,eACF,CAAC;AACH,CAAC;AAED,eAAeN,gCAAgC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import serializeDate from './serializeDate';
|
|
2
|
-
|
|
3
2
|
const prepareOptions = options => {
|
|
4
3
|
const limit = !options.limit || options.limit === Infinity ? 0 : options.limit;
|
|
5
4
|
const ascending = options.ascending ?? limit === 0;
|
|
@@ -14,6 +13,5 @@ const prepareOptions = options => {
|
|
|
14
13
|
anchor
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
export default prepareOptions;
|
|
19
17
|
//# sourceMappingURL=prepareOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["serializeDate","prepareOptions","options","limit","Infinity","ascending","from","Date","undefined","to","anchor"],"sources":["prepareOptions.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\nimport type { GenericQueryOptions } from '../types'\n\nconst prepareOptions = (options: GenericQueryOptions) => {\n const limit = !options.limit || options.limit === Infinity\n ? 0\n : options.limit\n const ascending = options.ascending ?? limit === 0\n const from = serializeDate(options.from ? options.from : (limit > 0 ? new Date(0) : undefined))\n const to = serializeDate(options.to)\n const anchor = options.anchor ?? ''\n return {\n limit, ascending, from, to, anchor,\n }\n}\n\nexport default prepareOptions\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["serializeDate","prepareOptions","options","limit","Infinity","ascending","from","Date","undefined","to","anchor"],"sources":["prepareOptions.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\nimport type { GenericQueryOptions } from '../types'\n\nconst prepareOptions = (options: GenericQueryOptions) => {\n const limit = !options.limit || options.limit === Infinity\n ? 0\n : options.limit\n const ascending = options.ascending ?? limit === 0\n const from = serializeDate(options.from ? options.from : (limit > 0 ? new Date(0) : undefined))\n const to = serializeDate(options.to)\n const anchor = options.anchor ?? ''\n return {\n limit, ascending, from, to, anchor,\n }\n}\n\nexport default prepareOptions\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAI3C,MAAMC,cAAc,GAAIC,OAA4B,IAAK;EACvD,MAAMC,KAAK,GAAG,CAACD,OAAO,CAACC,KAAK,IAAID,OAAO,CAACC,KAAK,KAAKC,QAAQ,GACtD,CAAC,GACDF,OAAO,CAACC,KAAK;EACjB,MAAME,SAAS,GAAGH,OAAO,CAACG,SAAS,IAAIF,KAAK,KAAK,CAAC;EAClD,MAAMG,IAAI,GAAGN,aAAa,CAACE,OAAO,CAACI,IAAI,GAAGJ,OAAO,CAACI,IAAI,GAAIH,KAAK,GAAG,CAAC,GAAG,IAAII,IAAI,CAAC,CAAC,CAAC,GAAGC,SAAU,CAAC;EAC/F,MAAMC,EAAE,GAAGT,aAAa,CAACE,OAAO,CAACO,EAAE,CAAC;EACpC,MAAMC,MAAM,GAAGR,OAAO,CAACQ,MAAM,IAAI,EAAE;EACnC,OAAO;IACLP,KAAK;IAAEE,SAAS;IAAEC,IAAI;IAAEG,EAAE;IAAEC;EAC9B,CAAC;AACH,CAAC;AAED,eAAeT,cAAc"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
|
-
import deserializCategorySample from './deserializeCategorySample';
|
|
3
1
|
import prepareOptions from './prepareOptions';
|
|
4
|
-
|
|
2
|
+
import Native from '../native-types';
|
|
5
3
|
const queryCategorySamples = async (identifier, options) => {
|
|
6
4
|
const opts = prepareOptions(options);
|
|
7
|
-
const raw = await Native.queryCategorySamples(identifier, opts.from, opts.to, opts.limit, opts.ascending
|
|
8
|
-
return
|
|
9
|
-
samples: raw.samples.map(deserializCategorySample),
|
|
10
|
-
deletedSamples: raw.deletedSamples,
|
|
11
|
-
newAnchor: raw.newAnchor
|
|
12
|
-
};
|
|
5
|
+
const raw = await Native.queryCategorySamples(identifier, opts.from, opts.to, opts.limit, opts.ascending);
|
|
6
|
+
return raw;
|
|
13
7
|
};
|
|
14
|
-
|
|
15
8
|
export default queryCategorySamples;
|
|
16
9
|
//# sourceMappingURL=queryCategorySamples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["prepareOptions","Native","queryCategorySamples","identifier","options","opts","raw","from","to","limit","ascending"],"sources":["queryCategorySamples.ts"],"sourcesContent":["import prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategorySampleRaw } from '../native-types'\nimport type { GenericQueryOptions } from '../types'\n\nexport type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(\n identifier: T,\n options: Omit<GenericQueryOptions, 'anchor'>\n) => Promise<readonly HKCategorySampleRaw<T>[]>;\n\nconst queryCategorySamples: QueryCategorySamplesFn = async (\n identifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const raw = await Native.queryCategorySamples(\n identifier,\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return raw\n}\n\nexport default queryCategorySamples\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAUpC,MAAMC,oBAA4C,GAAG,MAAAA,CACnDC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAGL,cAAc,CAACI,OAAO,CAAC;EACpC,MAAME,GAAG,GAAG,MAAML,MAAM,CAACC,oBAAoB,CAC3CC,UAAU,EACVE,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,SACP,CAAC;EAED,OAAOJ,GAAG;AACZ,CAAC;AAED,eAAeJ,oBAAoB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import deserializCategorySample from './deserializeCategorySample';
|
|
2
|
+
import prepareOptions from './prepareOptions';
|
|
3
|
+
import Native from '../native-types';
|
|
4
|
+
const queryCategorySamplesWithAnchor = async (identifier, options) => {
|
|
5
|
+
const opts = prepareOptions(options);
|
|
6
|
+
const raw = await Native.queryCategorySamplesWithAnchor(identifier, opts.from, opts.to, opts.limit, opts.anchor);
|
|
7
|
+
return {
|
|
8
|
+
samples: raw.samples.map(deserializCategorySample),
|
|
9
|
+
deletedSamples: raw.deletedSamples,
|
|
10
|
+
newAnchor: raw.newAnchor
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default queryCategorySamplesWithAnchor;
|
|
14
|
+
//# sourceMappingURL=queryCategorySamplesWithAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["deserializCategorySample","prepareOptions","Native","queryCategorySamplesWithAnchor","identifier","options","opts","raw","from","to","limit","anchor","samples","map","deletedSamples","newAnchor"],"sources":["queryCategorySamplesWithAnchor.ts"],"sourcesContent":["import deserializCategorySample from './deserializeCategorySample'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, DeletedCategorySampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKCategorySample } from '../types'\n\nexport type QueryCategorySamplesWithAnchorResponse<T extends HKCategoryTypeIdentifier> = {\n readonly samples: readonly HKCategorySample<T>[],\n readonly deletedSamples: readonly DeletedCategorySampleRaw<T>[],\n readonly newAnchor: string\n}\n\nexport type QueryCategorySamplesWithAnchorFn = <T extends HKCategoryTypeIdentifier>(\n identifier: T,\n options: Omit<GenericQueryOptions, 'ascending'>\n) => Promise<QueryCategorySamplesWithAnchorResponse<T>>;\n\nconst queryCategorySamplesWithAnchor: QueryCategorySamplesWithAnchorFn = async (\n identifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const raw = await Native.queryCategorySamplesWithAnchor(\n identifier,\n opts.from,\n opts.to,\n opts.limit,\n opts.anchor,\n )\n\n return {\n samples: raw.samples.map(deserializCategorySample),\n deletedSamples: raw.deletedSamples,\n newAnchor: raw.newAnchor,\n }\n}\n\nexport default queryCategorySamplesWithAnchor\n"],"mappings":"AAAA,OAAOA,wBAAwB,MAAM,6BAA6B;AAClE,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAgBpC,MAAMC,8BAAgE,GAAG,MAAAA,CACvEC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAGL,cAAc,CAACI,OAAO,CAAC;EACpC,MAAME,GAAG,GAAG,MAAML,MAAM,CAACC,8BAA8B,CACrDC,UAAU,EACVE,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,MACP,CAAC;EAED,OAAO;IACLC,OAAO,EAAEL,GAAG,CAACK,OAAO,CAACC,GAAG,CAACb,wBAAwB,CAAC;IAClDc,cAAc,EAAEP,GAAG,CAACO,cAAc;IAClCC,SAAS,EAAER,GAAG,CAACQ;EACjB,CAAC;AACH,CAAC;AAED,eAAeZ,8BAA8B"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
1
|
import deserializeCorrelation from './deserializeCorrelation';
|
|
3
2
|
import prepareOptions from './prepareOptions';
|
|
4
|
-
|
|
3
|
+
import Native from '../native-types';
|
|
5
4
|
const queryCorrelationSamples = async (typeIdentifier, options) => {
|
|
6
5
|
const opts = prepareOptions(options);
|
|
7
6
|
const correlations = await Native.queryCorrelationSamples(typeIdentifier, opts.from, opts.to);
|
|
8
7
|
return correlations.map(deserializeCorrelation);
|
|
9
8
|
};
|
|
10
|
-
|
|
11
9
|
export default queryCorrelationSamples;
|
|
12
10
|
//# sourceMappingURL=queryCorrelationSamples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["deserializeCorrelation","prepareOptions","Native","queryCorrelationSamples","typeIdentifier","options","opts","correlations","from","to","map"],"sources":["queryCorrelationSamples.ts"],"sourcesContent":["import deserializeCorrelation from './deserializeCorrelation'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCorrelationTypeIdentifier } from '../native-types'\nimport type { GenericQueryOptions, HKCorrelation } from '../types'\n\nexport type QueryCorrelationSamplesFn = <\n TIdentifier extends HKCorrelationTypeIdentifier\n>(\n typeIdentifier: TIdentifier,\n options: Omit<GenericQueryOptions, 'anchor' | 'ascending' | 'limit'>\n) => Promise<readonly HKCorrelation<TIdentifier>[]>;\n\nconst queryCorrelationSamples: QueryCorrelationSamplesFn = async (\n typeIdentifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const correlations = await Native.queryCorrelationSamples(\n typeIdentifier,\n opts.from,\n opts.to,\n )\n\n return correlations.map(deserializeCorrelation)\n}\n\nexport default queryCorrelationSamples\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAYpC,MAAMC,uBAAkD,GAAG,MAAAA,CACzDC,cAAc,EACdC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAGL,cAAc,CAACI,OAAO,CAAC;EACpC,MAAME,YAAY,GAAG,MAAML,MAAM,CAACC,uBAAuB,CACvDC,cAAc,EACdE,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EACP,CAAC;EAED,OAAOF,YAAY,CAACG,GAAG,CAACV,sBAAsB,CAAC;AACjD,CAAC;AAED,eAAeG,uBAAuB"}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
1
|
import deserializeHeartbeatSeriesSample from './deserializeHeartbeatSeriesSample';
|
|
3
2
|
import prepareOptions from './prepareOptions';
|
|
4
|
-
|
|
3
|
+
import Native from '../native-types';
|
|
5
4
|
const queryHeartbeatSeriesSamples = async options => {
|
|
6
5
|
const opts = prepareOptions(options);
|
|
7
|
-
const result = await Native.queryHeartbeatSeriesSamples(opts.from, opts.to, opts.limit, opts.ascending
|
|
8
|
-
return
|
|
9
|
-
deletedSamples: result.deletedSamples,
|
|
10
|
-
newAnchor: result.newAnchor,
|
|
11
|
-
samples: result.samples.map(deserializeHeartbeatSeriesSample)
|
|
12
|
-
};
|
|
6
|
+
const result = await Native.queryHeartbeatSeriesSamples(opts.from, opts.to, opts.limit, opts.ascending);
|
|
7
|
+
return result.map(deserializeHeartbeatSeriesSample);
|
|
13
8
|
};
|
|
14
|
-
|
|
15
9
|
export default queryHeartbeatSeriesSamples;
|
|
16
10
|
//# sourceMappingURL=queryHeartbeatSeriesSamples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["deserializeHeartbeatSeriesSample","prepareOptions","Native","queryHeartbeatSeriesSamples","options","opts","result","from","to","limit","ascending","map"],"sources":["queryHeartbeatSeriesSamples.ts"],"sourcesContent":["import deserializeHeartbeatSeriesSample from './deserializeHeartbeatSeriesSample'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { DeletedHeartbeatSeriesSampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKHeartbeatSeriesSample } from '../types'\n\nexport type QueryHeartbeatSeriesSamplesResponse = {\n readonly samples: readonly HKHeartbeatSeriesSample[],\n readonly deletedSamples: readonly DeletedHeartbeatSeriesSampleRaw[],\n readonly newAnchor: string\n}\n\nexport type QueryHeartbeatSeriesSamplesFn = (options: Omit<GenericQueryOptions, 'anchor'>) => Promise<readonly HKHeartbeatSeriesSample[]>;\n\nconst queryHeartbeatSeriesSamples: QueryHeartbeatSeriesSamplesFn = async (options) => {\n const opts = prepareOptions(options)\n\n const result = await Native.queryHeartbeatSeriesSamples(\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return result.map(deserializeHeartbeatSeriesSample)\n}\n\nexport default queryHeartbeatSeriesSamples\n"],"mappings":"AAAA,OAAOA,gCAAgC,MAAM,oCAAoC;AACjF,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAapC,MAAMC,2BAA0D,GAAG,MAAOC,OAAO,IAAK;EACpF,MAAMC,IAAI,GAAGJ,cAAc,CAACG,OAAO,CAAC;EAEpC,MAAME,MAAM,GAAG,MAAMJ,MAAM,CAACC,2BAA2B,CACrDE,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,SACP,CAAC;EAED,OAAOJ,MAAM,CAACK,GAAG,CAACX,gCAAgC,CAAC;AACrD,CAAC;AAED,eAAeG,2BAA2B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import deserializeHeartbeatSeriesSample from './deserializeHeartbeatSeriesSample';
|
|
2
|
+
import prepareOptions from './prepareOptions';
|
|
3
|
+
import Native from '../native-types';
|
|
4
|
+
const queryHeartbeatSeriesSamplesWithAnchor = async options => {
|
|
5
|
+
const opts = prepareOptions(options);
|
|
6
|
+
const result = await Native.queryHeartbeatSeriesSamplesWithAnchor(opts.from, opts.to, opts.limit, opts.anchor);
|
|
7
|
+
return {
|
|
8
|
+
deletedSamples: result.deletedSamples,
|
|
9
|
+
newAnchor: result.newAnchor,
|
|
10
|
+
samples: result.samples.map(deserializeHeartbeatSeriesSample)
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default queryHeartbeatSeriesSamplesWithAnchor;
|
|
14
|
+
//# sourceMappingURL=queryHeartbeatSeriesSamplesWithAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["deserializeHeartbeatSeriesSample","prepareOptions","Native","queryHeartbeatSeriesSamplesWithAnchor","options","opts","result","from","to","limit","anchor","deletedSamples","newAnchor","samples","map"],"sources":["queryHeartbeatSeriesSamplesWithAnchor.ts"],"sourcesContent":["import deserializeHeartbeatSeriesSample from './deserializeHeartbeatSeriesSample'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { DeletedHeartbeatSeriesSampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKHeartbeatSeriesSample } from '../types'\n\nexport type QueryHeartbeatSeriesSamplesResponse = {\n readonly samples: readonly HKHeartbeatSeriesSample[],\n readonly deletedSamples: readonly DeletedHeartbeatSeriesSampleRaw[],\n readonly newAnchor: string\n}\n\nexport type QueryHeartbeatSeriesSamplesFn = (options: Omit<GenericQueryOptions, 'ascending'>) => Promise<QueryHeartbeatSeriesSamplesResponse>;\n\nconst queryHeartbeatSeriesSamplesWithAnchor: QueryHeartbeatSeriesSamplesFn = async (options) => {\n const opts = prepareOptions(options)\n\n const result = await Native.queryHeartbeatSeriesSamplesWithAnchor(\n opts.from,\n opts.to,\n opts.limit,\n opts.anchor,\n )\n\n return {\n deletedSamples: result.deletedSamples,\n newAnchor: result.newAnchor,\n samples: result.samples.map(deserializeHeartbeatSeriesSample),\n }\n}\n\nexport default queryHeartbeatSeriesSamplesWithAnchor\n"],"mappings":"AAAA,OAAOA,gCAAgC,MAAM,oCAAoC;AACjF,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAapC,MAAMC,qCAAoE,GAAG,MAAOC,OAAO,IAAK;EAC9F,MAAMC,IAAI,GAAGJ,cAAc,CAACG,OAAO,CAAC;EAEpC,MAAME,MAAM,GAAG,MAAMJ,MAAM,CAACC,qCAAqC,CAC/DE,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,MACP,CAAC;EAED,OAAO;IACLC,cAAc,EAAEL,MAAM,CAACK,cAAc;IACrCC,SAAS,EAAEN,MAAM,CAACM,SAAS;IAC3BC,OAAO,EAAEP,MAAM,CAACO,OAAO,CAACC,GAAG,CAACd,gCAAgC;EAC9D,CAAC;AACH,CAAC;AAED,eAAeG,qCAAqC"}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
|
-
import deserializeQuantitySample from './deserializeSample';
|
|
3
1
|
import ensureUnit from './ensureUnit';
|
|
4
2
|
import prepareOptions from './prepareOptions';
|
|
5
|
-
|
|
3
|
+
import Native from '../native-types';
|
|
6
4
|
const queryQuantitySamples = async (identifier, options) => {
|
|
7
5
|
const unit = await ensureUnit(identifier, options.unit);
|
|
8
6
|
const opts = prepareOptions(options);
|
|
9
|
-
const result = await Native.queryQuantitySamples(identifier, unit, opts.from, opts.to, opts.limit, opts.ascending
|
|
10
|
-
return
|
|
11
|
-
deletedSamples: result.deletedSamples,
|
|
12
|
-
newAnchor: result.newAnchor,
|
|
13
|
-
samples: result.samples.map(deserializeQuantitySample)
|
|
14
|
-
};
|
|
7
|
+
const result = await Native.queryQuantitySamples(identifier, unit, opts.from, opts.to, opts.limit, opts.ascending);
|
|
8
|
+
return result;
|
|
15
9
|
};
|
|
16
|
-
|
|
17
10
|
export default queryQuantitySamples;
|
|
18
11
|
//# sourceMappingURL=queryQuantitySamples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ensureUnit","prepareOptions","Native","queryQuantitySamples","identifier","options","unit","opts","result","from","to","limit","ascending"],"sources":["queryQuantitySamples.ts"],"sourcesContent":["import ensureUnit from './ensureUnit'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type {\n HKQuantityTypeIdentifier, UnitForIdentifier, HKQuantitySampleRaw,\n} from '../native-types'\nimport type { GenericQueryOptions } from '../types'\n\nexport type QueryQuantitySamplesFn = <\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n options: Omit<GenericQueryOptions, 'anchor'> & { readonly unit?: TUnit }\n) => Promise<readonly HKQuantitySampleRaw<TIdentifier>[]>;\n\nconst queryQuantitySamples: QueryQuantitySamplesFn = async (\n identifier,\n options,\n) => {\n const unit = await ensureUnit(identifier, options.unit)\n const opts = prepareOptions(options)\n\n const result = await Native.queryQuantitySamples(\n identifier,\n unit,\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return result\n}\n\nexport default queryQuantitySamples\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,cAAc;AACrC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAepC,MAAMC,oBAA4C,GAAG,MAAAA,CACnDC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAG,MAAMN,UAAU,CAACI,UAAU,EAAEC,OAAO,CAACC,IAAI,CAAC;EACvD,MAAMC,IAAI,GAAGN,cAAc,CAACI,OAAO,CAAC;EAEpC,MAAMG,MAAM,GAAG,MAAMN,MAAM,CAACC,oBAAoB,CAC9CC,UAAU,EACVE,IAAI,EACJC,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,SACP,CAAC;EAED,OAAOJ,MAAM;AACf,CAAC;AAED,eAAeL,oBAAoB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import deserializeQuantitySample from './deserializeSample';
|
|
2
|
+
import ensureUnit from './ensureUnit';
|
|
3
|
+
import prepareOptions from './prepareOptions';
|
|
4
|
+
import Native from '../native-types';
|
|
5
|
+
const queryQuantitySamplesWithAnchor = async (identifier, options) => {
|
|
6
|
+
const unit = await ensureUnit(identifier, options.unit);
|
|
7
|
+
const opts = prepareOptions(options);
|
|
8
|
+
const result = await Native.queryQuantitySamplesWithAnchor(identifier, unit, opts.from, opts.to, opts.limit, opts.anchor);
|
|
9
|
+
return {
|
|
10
|
+
deletedSamples: result.deletedSamples,
|
|
11
|
+
newAnchor: result.newAnchor,
|
|
12
|
+
samples: result.samples.map(deserializeQuantitySample)
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default queryQuantitySamplesWithAnchor;
|
|
16
|
+
//# sourceMappingURL=queryQuantitySamplesWithAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["deserializeQuantitySample","ensureUnit","prepareOptions","Native","queryQuantitySamplesWithAnchor","identifier","options","unit","opts","result","from","to","limit","anchor","deletedSamples","newAnchor","samples","map"],"sources":["queryQuantitySamplesWithAnchor.ts"],"sourcesContent":["import deserializeQuantitySample from './deserializeSample'\nimport ensureUnit from './ensureUnit'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier, DeletedQuantitySampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKQuantitySample } from '../types'\n\nexport type QueryQuantitySamplesWithAnchorResponse<T extends HKQuantityTypeIdentifier> = {\n readonly samples: readonly HKQuantitySample<T>[],\n readonly deletedSamples: readonly DeletedQuantitySampleRaw<T>[],\n readonly newAnchor: string\n}\n\nexport type QueryQuantitySamplesWithAnchorFn = <\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n options: Omit<GenericQueryOptions, 'ascending'> & { readonly unit?: TUnit }\n) => Promise<QueryQuantitySamplesWithAnchorResponse<TIdentifier>>;\n\nconst queryQuantitySamplesWithAnchor: QueryQuantitySamplesWithAnchorFn = async (\n identifier,\n options,\n) => {\n const unit = await ensureUnit(identifier, options.unit)\n const opts = prepareOptions(options)\n\n const result = await Native.queryQuantitySamplesWithAnchor(\n identifier,\n unit,\n opts.from,\n opts.to,\n opts.limit,\n opts.anchor,\n )\n\n return {\n deletedSamples: result.deletedSamples,\n newAnchor: result.newAnchor,\n samples: result.samples.map(deserializeQuantitySample),\n }\n}\n\nexport default queryQuantitySamplesWithAnchor\n"],"mappings":"AAAA,OAAOA,yBAAyB,MAAM,qBAAqB;AAC3D,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAmBpC,MAAMC,8BAAgE,GAAG,MAAAA,CACvEC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAG,MAAMN,UAAU,CAACI,UAAU,EAAEC,OAAO,CAACC,IAAI,CAAC;EACvD,MAAMC,IAAI,GAAGN,cAAc,CAACI,OAAO,CAAC;EAEpC,MAAMG,MAAM,GAAG,MAAMN,MAAM,CAACC,8BAA8B,CACxDC,UAAU,EACVE,IAAI,EACJC,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,MACP,CAAC;EAED,OAAO;IACLC,cAAc,EAAEL,MAAM,CAACK,cAAc;IACrCC,SAAS,EAAEN,MAAM,CAACM,SAAS;IAC3BC,OAAO,EAAEP,MAAM,CAACO,OAAO,CAACC,GAAG,CAACjB,yBAAyB;EACvD,CAAC;AACH,CAAC;AAED,eAAeI,8BAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","querySources","identifier","quantitySamples"],"sources":["querySources.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HKQuantityTypeIdentifier,\n HKSource,\n HKCategoryTypeIdentifier,\n} from '../native-types'\n\nexport type QuerySourcesFn = <\n TIdentifier extends HKCategoryTypeIdentifier | HKQuantityTypeIdentifier\n>(\n identifier: TIdentifier\n) => Promise<readonly HKSource[]>;\n\nconst querySources: QuerySourcesFn = async (identifier) => {\n const quantitySamples = await Native.querySources(identifier)\n\n return quantitySamples\n}\n\nexport default querySources\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","querySources","identifier","quantitySamples"],"sources":["querySources.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HKQuantityTypeIdentifier,\n HKSource,\n HKCategoryTypeIdentifier,\n} from '../native-types'\n\nexport type QuerySourcesFn = <\n TIdentifier extends HKCategoryTypeIdentifier | HKQuantityTypeIdentifier\n>(\n identifier: TIdentifier\n) => Promise<readonly HKSource[]>;\n\nconst querySources: QuerySourcesFn = async (identifier) => {\n const quantitySamples = await Native.querySources(identifier)\n\n return quantitySamples\n}\n\nexport default querySources\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAcpC,MAAMC,YAA4B,GAAG,MAAOC,UAAU,IAAK;EACzD,MAAMC,eAAe,GAAG,MAAMH,MAAM,CAACC,YAAY,CAACC,UAAU,CAAC;EAE7D,OAAOC,eAAe;AACxB,CAAC;AAED,eAAeF,YAAY"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
1
|
import ensureUnit from './ensureUnit';
|
|
3
|
-
|
|
2
|
+
import Native from '../native-types';
|
|
4
3
|
async function queryStatisticsForQuantity(identifier, options, from, to, unit) {
|
|
5
4
|
const actualUnit = await ensureUnit(identifier, unit);
|
|
6
5
|
const toDate = to || new Date();
|
|
@@ -8,7 +7,8 @@ async function queryStatisticsForQuantity(identifier, options, from, to, unit) {
|
|
|
8
7
|
mostRecentQuantityDateInterval,
|
|
9
8
|
...rawResponse
|
|
10
9
|
} = await Native.queryStatisticsForQuantity(identifier, actualUnit, from.toISOString(), toDate.toISOString(), options);
|
|
11
|
-
const response = {
|
|
10
|
+
const response = {
|
|
11
|
+
...rawResponse,
|
|
12
12
|
...(mostRecentQuantityDateInterval ? {
|
|
13
13
|
mostRecentQuantityDateInterval: {
|
|
14
14
|
from: new Date(mostRecentQuantityDateInterval.from),
|
|
@@ -18,6 +18,5 @@ async function queryStatisticsForQuantity(identifier, options, from, to, unit) {
|
|
|
18
18
|
};
|
|
19
19
|
return response;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
export default queryStatisticsForQuantity;
|
|
23
22
|
//# sourceMappingURL=queryStatisticsForQuantity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ensureUnit","Native","queryStatisticsForQuantity","identifier","options","from","to","unit","actualUnit","toDate","Date","mostRecentQuantityDateInterval","rawResponse","toISOString","response"],"sources":["queryStatisticsForQuantity.ts"],"sourcesContent":["import ensureUnit from './ensureUnit'\nimport Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, HKStatisticsOptions, UnitForIdentifier } from '../native-types'\n\nasync function queryStatisticsForQuantity<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>>(\n identifier: TIdentifier,\n options: readonly HKStatisticsOptions[],\n from: Date,\n to?: Date,\n unit?: TUnit,\n) {\n const actualUnit = await ensureUnit(identifier, unit)\n const toDate = to || new Date()\n const { mostRecentQuantityDateInterval, ...rawResponse } = await Native.queryStatisticsForQuantity(\n identifier,\n actualUnit,\n from.toISOString(),\n toDate.toISOString(),\n options,\n )\n\n const response = {\n ...rawResponse,\n ...(mostRecentQuantityDateInterval\n ? {\n mostRecentQuantityDateInterval: {\n from: new Date(mostRecentQuantityDateInterval.from),\n to: new Date(mostRecentQuantityDateInterval.to),\n },\n }\n : {}),\n }\n\n return response\n}\n\nexport default queryStatisticsForQuantity\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,cAAc;AACrC,OAAOC,MAAM,MAAM,iBAAiB;AAIpC,eAAeC,0BAA0BA,CACvCC,UAAuB,EACvBC,OAAuC,EACvCC,IAAU,EACVC,EAAS,EACTC,IAAY,EACZ;EACA,MAAMC,UAAU,GAAG,MAAMR,UAAU,CAACG,UAAU,EAAEI,IAAI,CAAC;EACrD,MAAME,MAAM,GAAGH,EAAE,IAAI,IAAII,IAAI,CAAC,CAAC;EAC/B,MAAM;IAAEC,8BAA8B;IAAE,GAAGC;EAAY,CAAC,GAAG,MAAMX,MAAM,CAACC,0BAA0B,CAChGC,UAAU,EACVK,UAAU,EACVH,IAAI,CAACQ,WAAW,CAAC,CAAC,EAClBJ,MAAM,CAACI,WAAW,CAAC,CAAC,EACpBT,OACF,CAAC;EAED,MAAMU,QAAQ,GAAG;IACf,GAAGF,WAAW;IACd,IAAID,8BAA8B,GAC9B;MACAA,8BAA8B,EAAE;QAC9BN,IAAI,EAAE,IAAIK,IAAI,CAACC,8BAA8B,CAACN,IAAI,CAAC;QACnDC,EAAE,EAAE,IAAII,IAAI,CAACC,8BAA8B,CAACL,EAAE;MAChD;IACF,CAAC,GACC,CAAC,CAAC;EACR,CAAC;EAED,OAAOQ,QAAQ;AACjB;AAEA,eAAeZ,0BAA0B"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import Native from '../native-types';
|
|
2
1
|
import deserializeWorkout from './deserializeWorkout';
|
|
3
2
|
import getPreferredUnitsTyped from './getPreferredUnitsTyped';
|
|
4
3
|
import prepareOptions from './prepareOptions';
|
|
5
|
-
|
|
4
|
+
import Native from '../native-types';
|
|
6
5
|
async function queryWorkouts(options) {
|
|
7
6
|
const {
|
|
8
7
|
energyUnit,
|
|
@@ -12,6 +11,5 @@ async function queryWorkouts(options) {
|
|
|
12
11
|
const workouts = await Native.queryWorkoutSamples(energyUnit, distanceUnit, opts.from, opts.to, opts.limit, opts.ascending);
|
|
13
12
|
return workouts.map(deserializeWorkout);
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
export default queryWorkouts;
|
|
17
15
|
//# sourceMappingURL=queryWorkouts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["deserializeWorkout","getPreferredUnitsTyped","prepareOptions","Native","queryWorkouts","options","energyUnit","distanceUnit","opts","workouts","queryWorkoutSamples","from","to","limit","ascending","map"],"sources":["queryWorkouts.ts"],"sourcesContent":["import deserializeWorkout from './deserializeWorkout'\nimport getPreferredUnitsTyped from './getPreferredUnitsTyped'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { EnergyUnit, LengthUnit } from '../native-types'\nimport type { QueryWorkoutsOptions } from '../types'\n\nasync function queryWorkouts<\n TEnergy extends EnergyUnit,\n TDistance extends LengthUnit\n>(options: QueryWorkoutsOptions<TEnergy, TDistance>) {\n const { energyUnit, distanceUnit } = await getPreferredUnitsTyped(options)\n const opts = prepareOptions(options)\n\n const workouts = await Native.queryWorkoutSamples(\n energyUnit,\n distanceUnit,\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return workouts.map(deserializeWorkout)\n}\n\nexport default queryWorkouts\n"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAKpC,eAAeC,aAAaA,CAG1BC,OAAiD,EAAE;EACnD,MAAM;IAAEC,UAAU;IAAEC;EAAa,CAAC,GAAG,MAAMN,sBAAsB,CAACI,OAAO,CAAC;EAC1E,MAAMG,IAAI,GAAGN,cAAc,CAACG,OAAO,CAAC;EAEpC,MAAMI,QAAQ,GAAG,MAAMN,MAAM,CAACO,mBAAmB,CAC/CJ,UAAU,EACVC,YAAY,EACZC,IAAI,CAACG,IAAI,EACTH,IAAI,CAACI,EAAE,EACPJ,IAAI,CAACK,KAAK,EACVL,IAAI,CAACM,SACP,CAAC;EAED,OAAOL,QAAQ,CAACM,GAAG,CAACf,kBAAkB,CAAC;AACzC;AAEA,eAAeI,aAAa"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Native from '../native-types';
|
|
2
|
-
|
|
3
2
|
const requestAuthorization = async function (read) {
|
|
4
3
|
let write = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
5
|
-
const readPermissions = read.reduce((obj, cur) => ({
|
|
4
|
+
const readPermissions = read.reduce((obj, cur) => ({
|
|
5
|
+
...obj,
|
|
6
6
|
[cur]: true
|
|
7
7
|
}), {});
|
|
8
|
-
const writePermissions = write.reduce((obj, cur) => ({
|
|
8
|
+
const writePermissions = write.reduce((obj, cur) => ({
|
|
9
|
+
...obj,
|
|
9
10
|
[cur]: true
|
|
10
11
|
}), {});
|
|
11
12
|
return Native.requestAuthorization(writePermissions, readPermissions);
|
|
12
13
|
};
|
|
13
|
-
|
|
14
14
|
export default requestAuthorization;
|
|
15
15
|
//# sourceMappingURL=requestAuthorization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","requestAuthorization","read","write","readPermissions","reduce","obj","cur","writePermissions"],"sources":["requestAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\nconst requestAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n): Promise<boolean> => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.requestAuthorization(writePermissions, readPermissions)\n}\n\nexport default requestAuthorization\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["Native","requestAuthorization","read","write","arguments","length","undefined","readPermissions","reduce","obj","cur","writePermissions"],"sources":["requestAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\nconst requestAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n): Promise<boolean> => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.requestAuthorization(writePermissions, readPermissions)\n}\n\nexport default requestAuthorization\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAMpC,MAAMC,oBAAoB,GAAG,eAAAA,CAC3BC,IAA2C,EAEtB;EAAA,IADrBC,KAA6C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAElD,MAAMG,eAAe,GAAGL,IAAI,CAACM,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAoB,CAAC;EAEnG,MAAMC,gBAAgB,GAAGR,KAAK,CAACK,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAqB,CAAC;EAEtG,OAAOV,MAAM,CAACC,oBAAoB,CAACU,gBAAgB,EAAEJ,eAAe,CAAC;AACvE,CAAC;AAED,eAAeN,oBAAoB"}
|