@kingstinct/react-native-healthkit 7.3.2 → 8.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 +1 -1
- package/ios/Constants.swift +1 -1
- package/ios/ReactNativeHealthkit.m +1 -1
- package/ios/ReactNativeHealthkit.swift +2 -2
- package/ios/Serializers.swift +12 -0
- package/lib/commonjs/hooks/useHealthkitAuthorization.js +2 -3
- package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +42 -19
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +1 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js +2 -3
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js.map +1 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +17 -8
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentCategorySample.js +2 -3
- package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js +4 -3
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentWorkout.js +2 -3
- package/lib/commonjs/hooks/useMostRecentWorkout.js.map +1 -1
- package/lib/commonjs/hooks/useSources.js +2 -3
- package/lib/commonjs/hooks/useSources.js.map +1 -1
- package/lib/commonjs/hooks/useStatisticsForQuantity.js +2 -3
- package/lib/commonjs/hooks/useStatisticsForQuantity.js.map +1 -1
- package/lib/commonjs/hooks/useSubscribeToChanges.js +2 -3
- package/lib/commonjs/hooks/useSubscribeToChanges.js.map +1 -1
- package/lib/commonjs/index.ios.js +18 -43
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +3 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.native.js +46 -95
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/index.web.js +3 -4
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/native-types.js +65 -90
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/test-setup.js +51 -0
- package/lib/commonjs/test-setup.js.map +1 -0
- package/lib/commonjs/test-utils.js +1 -2
- package/lib/commonjs/test-utils.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/deleteQuantitySample.js +2 -3
- package/lib/commonjs/utils/deleteQuantitySample.js.map +1 -1
- package/lib/commonjs/utils/deleteSamples.js +2 -3
- package/lib/commonjs/utils/deleteSamples.js.map +1 -1
- package/lib/commonjs/utils/deserializeCategorySample.js +1 -2
- package/lib/commonjs/utils/deserializeCategorySample.js.map +1 -1
- package/lib/commonjs/utils/deserializeCategorySample.test.js +8 -4
- package/lib/commonjs/utils/deserializeCategorySample.test.js.map +1 -1
- package/lib/commonjs/utils/deserializeCorrelation.js +2 -3
- package/lib/commonjs/utils/deserializeCorrelation.js.map +1 -1
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js +1 -2
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
- package/lib/commonjs/utils/deserializeSample.js +1 -2
- package/lib/commonjs/utils/deserializeSample.js.map +1 -1
- package/lib/commonjs/utils/deserializeWorkout.js +1 -2
- package/lib/commonjs/utils/deserializeWorkout.js.map +1 -1
- package/lib/commonjs/utils/ensureMetadata.js +1 -2
- package/lib/commonjs/utils/ensureMetadata.js.map +1 -1
- package/lib/commonjs/utils/ensureTotals.js +1 -2
- package/lib/commonjs/utils/ensureTotals.js.map +1 -1
- package/lib/commonjs/utils/ensureUnit.js +2 -3
- package/lib/commonjs/utils/ensureUnit.js.map +1 -1
- package/lib/commonjs/utils/getDateOfBirth.js +2 -3
- package/lib/commonjs/utils/getDateOfBirth.js.map +1 -1
- package/lib/commonjs/utils/getMostRecentCategorySample.js +2 -3
- package/lib/commonjs/utils/getMostRecentCategorySample.js.map +1 -1
- package/lib/commonjs/utils/getMostRecentQuantitySample.js +2 -3
- package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +1 -1
- package/lib/commonjs/utils/getMostRecentWorkout.js +2 -3
- package/lib/commonjs/utils/getMostRecentWorkout.js.map +1 -1
- package/lib/commonjs/utils/getPreferredUnit.js +2 -3
- package/lib/commonjs/utils/getPreferredUnit.js.map +1 -1
- package/lib/commonjs/utils/getPreferredUnits.js +2 -3
- package/lib/commonjs/utils/getPreferredUnits.js.map +1 -1
- package/lib/commonjs/utils/getPreferredUnitsTyped.js +3 -4
- package/lib/commonjs/utils/getPreferredUnitsTyped.js.map +1 -1
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js +3 -5
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js.map +1 -1
- package/lib/commonjs/utils/getWorkoutPlanById.js +2 -3
- package/lib/commonjs/utils/getWorkoutPlanById.js.map +1 -1
- package/lib/commonjs/utils/prepareOptions.js +3 -3
- package/lib/commonjs/utils/prepareOptions.js.map +1 -1
- package/lib/commonjs/utils/queryCategorySamples.js +2 -3
- package/lib/commonjs/utils/queryCategorySamples.js.map +1 -1
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js +2 -3
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js.map +1 -1
- package/lib/commonjs/utils/queryCorrelationSamples.js +2 -3
- package/lib/commonjs/utils/queryCorrelationSamples.js.map +1 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js +2 -3
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js.map +1 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js +2 -3
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -1
- package/lib/commonjs/utils/queryQuantitySamples.js +2 -3
- package/lib/commonjs/utils/queryQuantitySamples.js.map +1 -1
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js +2 -3
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js.map +1 -1
- package/lib/commonjs/utils/querySources.js +2 -3
- package/lib/commonjs/utils/querySources.js.map +1 -1
- package/lib/commonjs/utils/queryStatisticsForQuantity.js +2 -3
- package/lib/commonjs/utils/queryStatisticsForQuantity.js.map +1 -1
- package/lib/commonjs/utils/queryWorkouts.js +2 -3
- package/lib/commonjs/utils/queryWorkouts.js.map +1 -1
- package/lib/commonjs/utils/requestAuthorization.js +3 -5
- package/lib/commonjs/utils/requestAuthorization.js.map +1 -1
- package/lib/commonjs/utils/saveCategorySample.js +2 -3
- package/lib/commonjs/utils/saveCategorySample.js.map +1 -1
- package/lib/commonjs/utils/saveCorrelationSample.js +2 -3
- package/lib/commonjs/utils/saveCorrelationSample.js.map +1 -1
- package/lib/commonjs/utils/saveQuantitySample.js +2 -3
- package/lib/commonjs/utils/saveQuantitySample.js.map +1 -1
- package/lib/commonjs/utils/saveWorkoutRoute.js +2 -3
- package/lib/commonjs/utils/saveWorkoutRoute.js.map +1 -1
- package/lib/commonjs/utils/saveWorkoutSample.js +2 -3
- package/lib/commonjs/utils/saveWorkoutSample.js.map +1 -1
- package/lib/commonjs/utils/serializeDate.js +1 -2
- package/lib/commonjs/utils/serializeDate.js.map +1 -1
- package/lib/commonjs/utils/serializeDate.test.js +1 -1
- package/lib/commonjs/utils/serializeDate.test.js.map +1 -1
- package/lib/commonjs/utils/subscribeToChanges.js +6 -8
- package/lib/commonjs/utils/subscribeToChanges.js.map +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.test.js +26 -3
- package/lib/module/hooks/useHealthkitAuthorization.test.js.map +1 -1
- package/lib/module/hooks/useIsHealthDataAvailable.js.map +1 -1
- package/lib/module/hooks/useIsHealthDataAvailable.test.js +9 -2
- package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +1 -1
- package/lib/module/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/module/hooks/useMostRecentQuantitySample.js +2 -0
- package/lib/module/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/module/hooks/useMostRecentWorkout.js.map +1 -1
- package/lib/module/hooks/useSources.js.map +1 -1
- package/lib/module/hooks/useStatisticsForQuantity.js.map +1 -1
- package/lib/module/hooks/useSubscribeToChanges.js.map +1 -1
- package/lib/module/index.ios.js +4 -15
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +1 -3
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/native-types.js +21 -2
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/test-setup.js +48 -0
- package/lib/module/test-setup.js.map +1 -0
- package/lib/module/test-utils.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/deleteQuantitySample.js.map +1 -1
- package/lib/module/utils/deleteSamples.js.map +1 -1
- package/lib/module/utils/deserializeCategorySample.js.map +1 -1
- package/lib/module/utils/deserializeCategorySample.test.js +4 -2
- package/lib/module/utils/deserializeCategorySample.test.js.map +1 -1
- package/lib/module/utils/deserializeCorrelation.js.map +1 -1
- package/lib/module/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
- package/lib/module/utils/deserializeSample.js.map +1 -1
- package/lib/module/utils/deserializeWorkout.js.map +1 -1
- package/lib/module/utils/ensureMetadata.js.map +1 -1
- package/lib/module/utils/ensureTotals.js.map +1 -1
- package/lib/module/utils/ensureUnit.js.map +1 -1
- package/lib/module/utils/getDateOfBirth.js.map +1 -1
- package/lib/module/utils/getMostRecentCategorySample.js.map +1 -1
- package/lib/module/utils/getMostRecentQuantitySample.js.map +1 -1
- package/lib/module/utils/getMostRecentWorkout.js.map +1 -1
- package/lib/module/utils/getPreferredUnit.js.map +1 -1
- package/lib/module/utils/getPreferredUnits.js.map +1 -1
- package/lib/module/utils/getPreferredUnitsTyped.js.map +1 -1
- package/lib/module/utils/getRequestStatusForAuthorization.js +1 -2
- package/lib/module/utils/getRequestStatusForAuthorization.js.map +1 -1
- package/lib/module/utils/getWorkoutPlanById.js.map +1 -1
- package/lib/module/utils/prepareOptions.js +1 -0
- package/lib/module/utils/prepareOptions.js.map +1 -1
- package/lib/module/utils/queryCategorySamples.js.map +1 -1
- package/lib/module/utils/queryCategorySamplesWithAnchor.js.map +1 -1
- package/lib/module/utils/queryCorrelationSamples.js.map +1 -1
- package/lib/module/utils/queryHeartbeatSeriesSamples.js.map +1 -1
- package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -1
- package/lib/module/utils/queryQuantitySamples.js.map +1 -1
- package/lib/module/utils/queryQuantitySamplesWithAnchor.js.map +1 -1
- package/lib/module/utils/querySources.js.map +1 -1
- package/lib/module/utils/queryStatisticsForQuantity.js.map +1 -1
- package/lib/module/utils/queryWorkouts.js.map +1 -1
- package/lib/module/utils/requestAuthorization.js +1 -2
- package/lib/module/utils/requestAuthorization.js.map +1 -1
- package/lib/module/utils/saveCategorySample.js.map +1 -1
- package/lib/module/utils/saveCorrelationSample.js.map +1 -1
- package/lib/module/utils/saveQuantitySample.js.map +1 -1
- package/lib/module/utils/saveWorkoutRoute.js.map +1 -1
- package/lib/module/utils/saveWorkoutSample.js.map +1 -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 +3 -4
- package/lib/module/utils/subscribeToChanges.js.map +1 -1
- package/lib/typescript/src/index.ios.d.ts +2 -10
- package/lib/typescript/src/index.native.d.ts +2 -2
- package/lib/typescript/src/native-types.d.ts +86 -8
- package/package.json +16 -11
- package/src/hooks/useHealthkitAuthorization.test.ts +18 -4
- package/src/hooks/useIsHealthDataAvailable.test.ts +5 -2
- package/src/hooks/useIsHealthDataAvailable.ts +1 -1
- package/src/hooks/useMostRecentQuantitySample.ts +3 -0
- package/src/index.ios.tsx +2 -15
- package/src/index.native.tsx +0 -3
- package/src/native-types.ts +97 -9
- package/src/test-setup.ts +51 -0
- package/src/utils/deserializeCategorySample.test.ts +5 -2
- package/src/utils/prepareOptions.ts +1 -0
- package/lib/commonjs/jest.setup.js +0 -45
- package/lib/commonjs/jest.setup.js.map +0 -1
- package/lib/module/jest.setup.js +0 -43
- package/lib/module/jest.setup.js.map +0 -1
- package/src/jest.setup.ts +0 -46
- /package/lib/typescript/src/{jest.setup.d.ts → test-setup.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["types.ts"],"sourcesContent":["import type {\n CLLocationRawForSaving,\n EnergyUnit,\n HKCategorySampleRaw,\n HKCategoryTypeIdentifier,\n HKCorrelationRaw,\n HKCorrelationTypeIdentifier,\n HKDevice,\n HKHeartbeatSeriesSampleRaw,\n HKQuantityTypeIdentifier,\n HKSourceRevision,\n HKUnit,\n HKWorkoutRaw,\n LengthUnit,\n MetadataMapperForQuantityIdentifier,\n QueryStatisticsResponseRaw,\n UnitForIdentifier,\n} from './native-types'\n\nexport * from './native-types'\n\n/**\n * Options for querying workouts.\n * @template TEnergy The energy unit type.\n * @template TDistance The distance unit type.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkout Apple Docs HKWorkout}\n */\nexport interface QueryWorkoutsOptions<\n TEnergy extends HKUnit,\n TDistance extends HKUnit\n> extends GenericQueryOptions {\n readonly energyUnit?: TEnergy;\n readonly distanceUnit?: TDistance;\n}\n\n/**\n * Represents a category sample.\n * @template T The category type identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorysample Apple Docs HKCategorySample}\n */\nexport interface HKCategorySample<\n T extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier\n> extends Omit<HKCategorySampleRaw<T>, 'endDate' | 'startDate'> {\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Generic options for querying.\n */\nexport type GenericQueryOptions = {\n readonly from?: Date;\n readonly to?: Date;\n readonly limit?: number;\n readonly ascending?: boolean;\n readonly anchor?: string\n};\n\n/**\n * Represents a workout.\n * @template TEnergy The energy unit type.\n * @template TDistance The distance unit type.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkout Apple Docs HKWorkout}\n */\nexport interface HKWorkout<\n TEnergy extends EnergyUnit = EnergyUnit,\n TDistance extends LengthUnit = LengthUnit\n> extends Omit<HKWorkoutRaw<TEnergy, TDistance>, 'endDate' | 'startDate'> {\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a heartbeat series sample.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkheartbeatseriessample Apple Docs HKHeartbeatSeriesSample}\n */\nexport interface HKHeartbeatSeriesSample extends Omit<HKHeartbeatSeriesSampleRaw, 'endDate' | 'startDate'> {\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a quantity sample.\n * @template TIdentifier The quantity type identifier.\n * @template TUnit The unit for the identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitysample Apple Docs HKQuantitySample}\n */\nexport interface HKQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>\n> {\n readonly uuid: string;\n readonly device?: HKDevice;\n readonly quantityType: TIdentifier;\n readonly quantity: number;\n readonly unit: TUnit;\n readonly metadata?: MetadataMapperForQuantityIdentifier<TIdentifier>;\n readonly sourceRevision?: HKSourceRevision;\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a response from a statistics query.\n * @template TIdentifier The quantity type identifier.\n * @template TUnit The unit for the identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkstatisticsquery Apple Docs HKStatisticsQuery}\n */\nexport interface QueryStatisticsResponse<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>>\n extends Omit<\n QueryStatisticsResponseRaw<TIdentifier, TUnit>,\n 'mostRecentQuantityDateInterval'\n > {\n readonly mostRecentQuantityDateInterval?: { readonly from: Date; readonly to: Date };\n}\n\n/**\n * Represents a category sample for saving.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorysample Apple Docs HKCategorySample}\n */\nexport type HKCategorySampleForSaving = Omit<HKCategorySample, 'device' | 'endDate' | 'startDate' | 'uuid'> & {\n readonly startDate?: Date;\n readonly endDate?: Date;\n}\n\n/**\n * Represents a quantity sample for saving.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitysample Apple Docs HKQuantitySample}\n */\nexport type HKQuantitySampleForSaving = Omit<HKQuantitySample, 'device' | 'endDate' | 'startDate' | 'uuid'> & {\n readonly startDate?: Date;\n readonly endDate?: Date;\n};\n\n/**\n * Represents a correlation.\n * @template TIdentifier The correlation type identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkcorrelation Apple Docs HKCorrelation}\n */\nexport interface HKCorrelation<TIdentifier extends HKCorrelationTypeIdentifier>\n extends Omit<\n HKCorrelationRaw<TIdentifier>,\n 'endDate' | 'objects' | 'startDate'\n > {\n readonly objects: readonly (HKCategorySample | HKQuantitySample)[];\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a location sample for saving.\n * @see {@link https://developer.apple.com/documentation/corelocation/cllocation Apple Docs CLLocation}\n */\nexport type CLLocationForSaving = Omit<CLLocationRawForSaving, 'timestamp'> & {\n readonly timestamp: number;\n};\n"],"mappings":";;;;;AAmBA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["_nativeTypes","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["types.ts"],"sourcesContent":["import type {\n CLLocationRawForSaving,\n EnergyUnit,\n HKCategorySampleRaw,\n HKCategoryTypeIdentifier,\n HKCorrelationRaw,\n HKCorrelationTypeIdentifier,\n HKDevice,\n HKHeartbeatSeriesSampleRaw,\n HKQuantityTypeIdentifier,\n HKSourceRevision,\n HKUnit,\n HKWorkoutRaw,\n LengthUnit,\n MetadataMapperForQuantityIdentifier,\n QueryStatisticsResponseRaw,\n UnitForIdentifier,\n} from './native-types'\n\nexport * from './native-types'\n\n/**\n * Options for querying workouts.\n * @template TEnergy The energy unit type.\n * @template TDistance The distance unit type.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkout Apple Docs HKWorkout}\n */\nexport interface QueryWorkoutsOptions<\n TEnergy extends HKUnit,\n TDistance extends HKUnit\n> extends GenericQueryOptions {\n readonly energyUnit?: TEnergy;\n readonly distanceUnit?: TDistance;\n}\n\n/**\n * Represents a category sample.\n * @template T The category type identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorysample Apple Docs HKCategorySample}\n */\nexport interface HKCategorySample<\n T extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier\n> extends Omit<HKCategorySampleRaw<T>, 'endDate' | 'startDate'> {\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Generic options for querying.\n */\nexport type GenericQueryOptions = {\n readonly from?: Date;\n readonly to?: Date;\n readonly limit?: number;\n readonly ascending?: boolean;\n readonly anchor?: string\n};\n\n/**\n * Represents a workout.\n * @template TEnergy The energy unit type.\n * @template TDistance The distance unit type.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkout Apple Docs HKWorkout}\n */\nexport interface HKWorkout<\n TEnergy extends EnergyUnit = EnergyUnit,\n TDistance extends LengthUnit = LengthUnit\n> extends Omit<HKWorkoutRaw<TEnergy, TDistance>, 'endDate' | 'startDate'> {\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a heartbeat series sample.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkheartbeatseriessample Apple Docs HKHeartbeatSeriesSample}\n */\nexport interface HKHeartbeatSeriesSample extends Omit<HKHeartbeatSeriesSampleRaw, 'endDate' | 'startDate'> {\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a quantity sample.\n * @template TIdentifier The quantity type identifier.\n * @template TUnit The unit for the identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitysample Apple Docs HKQuantitySample}\n */\nexport interface HKQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>\n> {\n readonly uuid: string;\n readonly device?: HKDevice;\n readonly quantityType: TIdentifier;\n readonly quantity: number;\n readonly unit: TUnit;\n readonly metadata?: MetadataMapperForQuantityIdentifier<TIdentifier>;\n readonly sourceRevision?: HKSourceRevision;\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a response from a statistics query.\n * @template TIdentifier The quantity type identifier.\n * @template TUnit The unit for the identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkstatisticsquery Apple Docs HKStatisticsQuery}\n */\nexport interface QueryStatisticsResponse<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>>\n extends Omit<\n QueryStatisticsResponseRaw<TIdentifier, TUnit>,\n 'mostRecentQuantityDateInterval'\n > {\n readonly mostRecentQuantityDateInterval?: { readonly from: Date; readonly to: Date };\n}\n\n/**\n * Represents a category sample for saving.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorysample Apple Docs HKCategorySample}\n */\nexport type HKCategorySampleForSaving = Omit<HKCategorySample, 'device' | 'endDate' | 'startDate' | 'uuid'> & {\n readonly startDate?: Date;\n readonly endDate?: Date;\n}\n\n/**\n * Represents a quantity sample for saving.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitysample Apple Docs HKQuantitySample}\n */\nexport type HKQuantitySampleForSaving = Omit<HKQuantitySample, 'device' | 'endDate' | 'startDate' | 'uuid'> & {\n readonly startDate?: Date;\n readonly endDate?: Date;\n};\n\n/**\n * Represents a correlation.\n * @template TIdentifier The correlation type identifier.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkcorrelation Apple Docs HKCorrelation}\n */\nexport interface HKCorrelation<TIdentifier extends HKCorrelationTypeIdentifier>\n extends Omit<\n HKCorrelationRaw<TIdentifier>,\n 'endDate' | 'objects' | 'startDate'\n > {\n readonly objects: readonly (HKCategorySample | HKQuantitySample)[];\n readonly startDate: Date;\n readonly endDate: Date;\n}\n\n/**\n * Represents a location sample for saving.\n * @see {@link https://developer.apple.com/documentation/corelocation/cllocation Apple Docs CLLocation}\n */\nexport type CLLocationForSaving = Omit<CLLocationRawForSaving, 'timestamp'> & {\n readonly timestamp: number;\n};\n"],"mappings":";;;;;AAmBA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const deleteQuantitySample = async (identifier, uuid) => _nativeTypes.default.deleteQuantitySample(identifier, uuid);
|
|
10
|
-
var _default = deleteQuantitySample;
|
|
11
|
-
exports.default = _default;
|
|
10
|
+
var _default = exports.default = deleteQuantitySample;
|
|
12
11
|
//# sourceMappingURL=deleteQuantitySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","e","__esModule","default","deleteQuantitySample","identifier","uuid","Native","_default","exports"],"sources":["deleteQuantitySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier } from '../native-types'\n\nexport type DeleteQuantitySampleFn = <\n TIdentifier extends HKQuantityTypeIdentifier\n>(\n identifier: TIdentifier,\n uuid: string\n) => Promise<boolean>\n\nconst deleteQuantitySample: DeleteQuantitySampleFn = async (identifier, uuid) => Native.deleteQuantitySample(identifier, uuid)\n\nexport default deleteQuantitySample\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAWpC,MAAMG,oBAA4C,GAAG,MAAAA,CAAOC,UAAU,EAAEC,IAAI,KAAKC,oBAAM,CAACH,oBAAoB,CAACC,UAAU,EAAEC,IAAI,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAE/GC,oBAAoB","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const deleteSamples = async sample => {
|
|
10
10
|
const start = sample.startDate || new Date();
|
|
11
11
|
const end = sample.endDate || new Date();
|
|
@@ -14,6 +14,5 @@ const deleteSamples = async sample => {
|
|
|
14
14
|
} = sample;
|
|
15
15
|
return _nativeTypes.default.deleteSamples(identifier, start.toISOString(), end.toISOString());
|
|
16
16
|
};
|
|
17
|
-
var _default = deleteSamples;
|
|
18
|
-
exports.default = _default;
|
|
17
|
+
var _default = exports.default = deleteSamples;
|
|
19
18
|
//# sourceMappingURL=deleteSamples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","e","__esModule","default","deleteSamples","sample","start","startDate","Date","end","endDate","identifier","Native","toISOString","_default","exports"],"sources":["deleteSamples.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier } from '../native-types'\n\nexport type DeleteSamplesFn = <\n TIdentifier extends HKQuantityTypeIdentifier\n>(\n sample: {\n readonly identifier: TIdentifier,\n readonly startDate?: Date;\n readonly endDate?: Date;\n }\n) => Promise<boolean>\n\nconst deleteSamples: DeleteSamplesFn = async (sample) => {\n const start = sample.startDate || new Date()\n const end = sample.endDate || new Date()\n const { identifier } = sample\n\n return Native.deleteSamples(identifier, start.toISOString(), end.toISOString())\n}\n\nexport default deleteSamples\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAcpC,MAAMG,aAA8B,GAAG,MAAOC,MAAM,IAAK;EACvD,MAAMC,KAAK,GAAGD,MAAM,CAACE,SAAS,IAAI,IAAIC,IAAI,CAAC,CAAC;EAC5C,MAAMC,GAAG,GAAGJ,MAAM,CAACK,OAAO,IAAI,IAAIF,IAAI,CAAC,CAAC;EACxC,MAAM;IAAEG;EAAW,CAAC,GAAGN,MAAM;EAE7B,OAAOO,oBAAM,CAACR,aAAa,CAACO,UAAU,EAAEL,KAAK,CAACO,WAAW,CAAC,CAAC,EAAEJ,GAAG,CAACI,WAAW,CAAC,CAAC,CAAC;AACjF,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEcC,aAAa","ignoreList":[]}
|
|
@@ -9,6 +9,5 @@ const deserializeCategorySample = sample => ({
|
|
|
9
9
|
startDate: new Date(sample.startDate),
|
|
10
10
|
endDate: new Date(sample.endDate)
|
|
11
11
|
});
|
|
12
|
-
var _default = deserializeCategorySample;
|
|
13
|
-
exports.default = _default;
|
|
12
|
+
var _default = exports.default = deserializeCategorySample;
|
|
14
13
|
//# sourceMappingURL=deserializeCategorySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deserializeCategorySample","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeCategorySample.ts"],"sourcesContent":["import type { HKCategorySampleRaw, HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\nconst deserializeCategorySample = <T extends HKCategoryTypeIdentifier>(\n sample: HKCategorySampleRaw<T>,\n): HKCategorySample<T> => ({\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n})\n\nexport default deserializeCategorySample\n"],"mappings":";;;;;;AAGA,MAAMA,yBAAyB,GAC7BC,MAA8B,KACL;EACzB,GAAGA,MAAM;EACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;EACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;AAClC,CAAC,CAAC;AAAA,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"names":["deserializeCategorySample","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeCategorySample.ts"],"sourcesContent":["import type { HKCategorySampleRaw, HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\nconst deserializeCategorySample = <T extends HKCategoryTypeIdentifier>(\n sample: HKCategorySampleRaw<T>,\n): HKCategorySample<T> => ({\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n})\n\nexport default deserializeCategorySample\n"],"mappings":";;;;;;AAGA,MAAMA,yBAAyB,GAC7BC,MAA8B,KACL;EACzB,GAAGA,MAAM;EACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;EACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;AAClC,CAAC,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaP,yBAAyB","ignoreList":[]}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _deserializeCategorySample = _interopRequireDefault(require("./deserializeCategorySample"));
|
|
4
|
-
|
|
5
|
-
function
|
|
4
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
6
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
6
7
|
describe('deserializeCategorySample', () => {
|
|
7
|
-
it('should deserialize category sample', () => {
|
|
8
|
+
it('should deserialize category sample', async () => {
|
|
9
|
+
const {
|
|
10
|
+
HKCategoryTypeIdentifier
|
|
11
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require('../native-types')));
|
|
8
12
|
const sample = {
|
|
9
13
|
startDate: '2020-01-01T00:00:00.000Z',
|
|
10
14
|
endDate: '2020-01-01T00:00:00.000Z',
|
|
11
15
|
value: 1,
|
|
12
|
-
categoryType:
|
|
16
|
+
categoryType: HKCategoryTypeIdentifier.sexualActivity,
|
|
13
17
|
metadata: {},
|
|
14
18
|
uuid: 'uuid'
|
|
15
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deserializeCategorySample","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_deserializeCategorySample","_interopRequireDefault","require","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","_interopRequireWildcard","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","describe","it","HKCategoryTypeIdentifier","Promise","resolve","then","sample","startDate","endDate","value","categoryType","sexualActivity","metadata","uuid","expect","deserializeCategorySample","toEqual","Date"],"sources":["deserializeCategorySample.test.ts"],"sourcesContent":["import deserializeCategorySample from './deserializeCategorySample'\n\nimport type { HKCategorySampleRaw } from '../types'\n\ndescribe('deserializeCategorySample', () => {\n it('should deserialize category sample', async () => {\n const { HKCategoryTypeIdentifier } = await import('../native-types')\n\n const sample: HKCategorySampleRaw = {\n startDate: '2020-01-01T00:00:00.000Z',\n endDate: '2020-01-01T00:00:00.000Z',\n value: 1,\n categoryType: HKCategoryTypeIdentifier.sexualActivity,\n metadata: {},\n uuid: 'uuid',\n }\n\n expect(deserializeCategorySample(sample)).toEqual({\n ...sample,\n startDate: new Date('2020-01-01T00:00:00.000Z'),\n endDate: new Date('2020-01-01T00:00:00.000Z'),\n })\n })\n})\n"],"mappings":";;AAAA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAO,wBAAAP,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAE,GAAA,CAAAR,CAAA,UAAAM,CAAA,CAAAG,GAAA,CAAAT,CAAA,OAAAU,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAhB,CAAA,oBAAAgB,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAlB,CAAA,EAAAgB,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAf,CAAA,EAAAgB,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAhB,CAAA,CAAAgB,CAAA,YAAAN,CAAA,CAAAR,OAAA,GAAAF,CAAA,EAAAM,CAAA,IAAAA,CAAA,CAAAc,GAAA,CAAApB,CAAA,EAAAU,CAAA,GAAAA,CAAA;AAInEW,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EAC1CC,EAAE,CAAC,oCAAoC,EAAE,YAAY;IACnD,MAAM;MAAEC;IAAyB,CAAC,GAAG,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAAnB,uBAAA,CAAAR,OAAA,CAAa,iBAAiB,GAAC;IAEpE,MAAM4B,MAA2B,GAAG;MAClCC,SAAS,EAAE,0BAA0B;MACrCC,OAAO,EAAE,0BAA0B;MACnCC,KAAK,EAAE,CAAC;MACRC,YAAY,EAAER,wBAAwB,CAACS,cAAc;MACrDC,QAAQ,EAAE,CAAC,CAAC;MACZC,IAAI,EAAE;IACR,CAAC;IAEDC,MAAM,CAAC,IAAAC,kCAAyB,EAACT,MAAM,CAAC,CAAC,CAACU,OAAO,CAAC;MAChD,GAAGV,MAAM;MACTC,SAAS,EAAE,IAAIU,IAAI,CAAC,0BAA0B,CAAC;MAC/CT,OAAO,EAAE,IAAIS,IAAI,CAAC,0BAA0B;IAC9C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _deserializeCategorySample = _interopRequireDefault(require("./deserializeCategorySample"));
|
|
8
8
|
var _deserializeSample = _interopRequireDefault(require("./deserializeSample"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
function deserializeCorrelation(s) {
|
|
11
11
|
return {
|
|
12
12
|
...s,
|
|
@@ -22,6 +22,5 @@ function deserializeCorrelation(s) {
|
|
|
22
22
|
startDate: new Date(s.startDate)
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
var _default = deserializeCorrelation;
|
|
26
|
-
exports.default = _default;
|
|
25
|
+
var _default = exports.default = deserializeCorrelation;
|
|
27
26
|
//# sourceMappingURL=deserializeCorrelation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deserializeCategorySample","_interopRequireDefault","require","_deserializeSample","
|
|
1
|
+
{"version":3,"names":["_deserializeCategorySample","_interopRequireDefault","require","_deserializeSample","e","__esModule","default","deserializeCorrelation","s","objects","map","o","quantity","undefined","deserializeQuantitySample","deserializCategorySample","endDate","Date","startDate","_default","exports"],"sources":["deserializeCorrelation.ts"],"sourcesContent":["import deserializCategorySample from './deserializeCategorySample'\nimport deserializeQuantitySample from './deserializeSample'\n\nimport type {\n HKCategorySampleRaw, HKCorrelationRaw, HKCorrelationTypeIdentifier, HKQuantitySampleRaw, HKQuantityTypeIdentifier,\n} from '../native-types'\nimport type { HKCorrelation } from '../types'\n\nfunction deserializeCorrelation<\n TIdentifier extends HKCorrelationTypeIdentifier\n>(s: HKCorrelationRaw<TIdentifier>): HKCorrelation<TIdentifier> {\n return {\n ...s,\n objects: s.objects.map((o) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (o.quantity !== undefined) {\n return deserializeQuantitySample(o as HKQuantitySampleRaw<HKQuantityTypeIdentifier>)\n }\n\n return deserializCategorySample(o as HKCategorySampleRaw)\n }),\n endDate: new Date(s.endDate),\n startDate: new Date(s.startDate),\n }\n}\n\nexport default deserializeCorrelation\n"],"mappings":";;;;;;AAAA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2D,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAO3D,SAASG,sBAAsBA,CAE7BC,CAAgC,EAA8B;EAC9D,OAAO;IACL,GAAGA,CAAC;IACJC,OAAO,EAAED,CAAC,CAACC,OAAO,CAACC,GAAG,CAAEC,CAAC,IAAK;MAC9B;MACA;MACE,IAAIA,CAAC,CAACC,QAAQ,KAAKC,SAAS,EAAE;QAC5B,OAAO,IAAAC,0BAAyB,EAACH,CAAkD,CAAC;MACtF;MAEA,OAAO,IAAAI,kCAAwB,EAACJ,CAAwB,CAAC;IAC3D,CAAC,CAAC;IACFK,OAAO,EAAE,IAAIC,IAAI,CAACT,CAAC,CAACQ,OAAO,CAAC;IAC5BE,SAAS,EAAE,IAAID,IAAI,CAACT,CAAC,CAACU,SAAS;EACjC,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEcC,sBAAsB","ignoreList":[]}
|
|
@@ -11,6 +11,5 @@ function deserializeHeartbeatSeriesSample(sample) {
|
|
|
11
11
|
endDate: new Date(sample.endDate)
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
var _default = deserializeHeartbeatSeriesSample;
|
|
15
|
-
exports.default = _default;
|
|
14
|
+
var _default = exports.default = deserializeHeartbeatSeriesSample;
|
|
16
15
|
//# sourceMappingURL=deserializeHeartbeatSeriesSample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deserializeHeartbeatSeriesSample","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeHeartbeatSeriesSample.ts"],"sourcesContent":["import type { HKHeartbeatSeriesSampleRaw } from '../native-types'\nimport type { HKHeartbeatSeriesSample } from '../types'\n\nfunction deserializeHeartbeatSeriesSample(sample: HKHeartbeatSeriesSampleRaw): HKHeartbeatSeriesSample {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeHeartbeatSeriesSample\n"],"mappings":";;;;;;AAGA,SAASA,gCAAgCA,CAACC,MAAkC,EAA2B;EACrG,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"names":["deserializeHeartbeatSeriesSample","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeHeartbeatSeriesSample.ts"],"sourcesContent":["import type { HKHeartbeatSeriesSampleRaw } from '../native-types'\nimport type { HKHeartbeatSeriesSample } from '../types'\n\nfunction deserializeHeartbeatSeriesSample(sample: HKHeartbeatSeriesSampleRaw): HKHeartbeatSeriesSample {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeHeartbeatSeriesSample\n"],"mappings":";;;;;;AAGA,SAASA,gCAAgCA,CAACC,MAAkC,EAA2B;EACrG,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,gCAAgC","ignoreList":[]}
|
|
@@ -11,6 +11,5 @@ function deserializeQuantitySample(sample) {
|
|
|
11
11
|
endDate: new Date(sample.endDate)
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
var _default = deserializeQuantitySample;
|
|
15
|
-
exports.default = _default;
|
|
14
|
+
var _default = exports.default = deserializeQuantitySample;
|
|
16
15
|
//# sourceMappingURL=deserializeSample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deserializeQuantitySample","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeSample.ts"],"sourcesContent":["import type { HKQuantitySampleRaw, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nfunction deserializeQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n sample: HKQuantitySampleRaw<TIdentifier, TUnit>,\n): HKQuantitySample<TIdentifier, TUnit> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeQuantitySample\n"],"mappings":";;;;;;AAGA,SAASA,yBAAyBA,CAIhCC,MAA+C,EACT;EACtC,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"names":["deserializeQuantitySample","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeSample.ts"],"sourcesContent":["import type { HKQuantitySampleRaw, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nfunction deserializeQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n sample: HKQuantitySampleRaw<TIdentifier, TUnit>,\n): HKQuantitySample<TIdentifier, TUnit> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeQuantitySample\n"],"mappings":";;;;;;AAGA,SAASA,yBAAyBA,CAIhCC,MAA+C,EACT;EACtC,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,yBAAyB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deserializeWorkout","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeWorkout.ts"],"sourcesContent":["import type { EnergyUnit, HKWorkoutRaw, LengthUnit } from '../native-types'\nimport type { HKWorkout } from '../types'\n\nfunction deserializeWorkout<TEnergy extends EnergyUnit, TDistance extends LengthUnit>(\n sample: HKWorkoutRaw<TEnergy, TDistance>,\n): HKWorkout<TEnergy, TDistance> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeWorkout\n"],"mappings":";;;;;;AAGA,SAASA,kBAAkBA,CACzBC,MAAwC,EACT;EAC/B,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"names":["deserializeWorkout","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeWorkout.ts"],"sourcesContent":["import type { EnergyUnit, HKWorkoutRaw, LengthUnit } from '../native-types'\nimport type { HKWorkout } from '../types'\n\nfunction deserializeWorkout<TEnergy extends EnergyUnit, TDistance extends LengthUnit>(\n sample: HKWorkoutRaw<TEnergy, TDistance>,\n): HKWorkout<TEnergy, TDistance> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeWorkout\n"],"mappings":";;;;;;AAGA,SAASA,kBAAkBA,CACzBC,MAAwC,EACT;EAC/B,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,kBAAkB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ensureMetadata","metadata","_default","exports","default"],"sources":["ensureMetadata.ts"],"sourcesContent":["function ensureMetadata<TMetadata>(metadata?: TMetadata) {\n return metadata || ({} as TMetadata)\n}\n\nexport default ensureMetadata\n"],"mappings":";;;;;;AAAA,SAASA,cAAcA,CAAYC,QAAoB,EAAE;EACvD,OAAOA,QAAQ,IAAK,CAAC,CAAe;AACtC;AAAC,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"names":["ensureMetadata","metadata","_default","exports","default"],"sources":["ensureMetadata.ts"],"sourcesContent":["function ensureMetadata<TMetadata>(metadata?: TMetadata) {\n return metadata || ({} as TMetadata)\n}\n\nexport default ensureMetadata\n"],"mappings":";;;;;;AAAA,SAASA,cAAcA,CAAYC,QAAoB,EAAE;EACvD,OAAOA,QAAQ,IAAK,CAAC,CAAe;AACtC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcJ,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ensureTotals","totals","_default","exports","default"],"sources":["ensureTotals.ts"],"sourcesContent":["function ensureTotals<TTotals>(totals?: TTotals) {\n return totals || ({} as TTotals)\n}\n\nexport default ensureTotals\n"],"mappings":";;;;;;AAAA,SAASA,YAAYA,CAAUC,MAAgB,EAAE;EAC/C,OAAOA,MAAM,IAAK,CAAC,CAAa;AAClC;AAAC,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"names":["ensureTotals","totals","_default","exports","default"],"sources":["ensureTotals.ts"],"sourcesContent":["function ensureTotals<TTotals>(totals?: TTotals) {\n return totals || ({} as TTotals)\n}\n\nexport default ensureTotals\n"],"mappings":";;;;;;AAAA,SAASA,YAAYA,CAAUC,MAAgB,EAAE;EAC/C,OAAOA,MAAM,IAAK,CAAC,CAAa;AAClC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcJ,YAAY","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const ensureUnit = async (type, providedUnit) => {
|
|
10
10
|
if (providedUnit) {
|
|
11
11
|
return providedUnit;
|
|
@@ -13,6 +13,5 @@ const ensureUnit = async (type, providedUnit) => {
|
|
|
13
13
|
const unit = await _nativeTypes.default.getPreferredUnits([type]);
|
|
14
14
|
return unit[type];
|
|
15
15
|
};
|
|
16
|
-
var _default = ensureUnit;
|
|
17
|
-
exports.default = _default;
|
|
16
|
+
var _default = exports.default = ensureUnit;
|
|
18
17
|
//# sourceMappingURL=ensureUnit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","e","__esModule","default","ensureUnit","type","providedUnit","unit","Native","getPreferredUnits","_default","exports"],"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,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIpC,MAAMG,UAAU,GAAG,MAAAA,CAIjBC,IAAiB,EACjBC,YAAoB,KACjB;EACH,IAAIA,YAAY,EAAE;IAChB,OAAOA,YAAY;EACrB;EACA,MAAMC,IAAI,GAAG,MAAMC,oBAAM,CAACC,iBAAiB,CAAC,CAACJ,IAAI,CAAC,CAAC;EACnD,OAAOE,IAAI,CAACF,IAAI,CAAC;AACnB,CAAC;AAAA,IAAAK,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEcC,UAAU","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const getDateOfBirth = async () => {
|
|
10
10
|
const dateOfBirth = await _nativeTypes.default.getDateOfBirth();
|
|
11
11
|
return new Date(dateOfBirth);
|
|
12
12
|
};
|
|
13
|
-
var _default = getDateOfBirth;
|
|
14
|
-
exports.default = _default;
|
|
13
|
+
var _default = exports.default = getDateOfBirth;
|
|
15
14
|
//# sourceMappingURL=getDateOfBirth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","e","__esModule","default","getDateOfBirth","dateOfBirth","Native","Date","_default","exports"],"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,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,MAAMG,cAAc,GAAG,MAAAA,CAAA,KAAY;EACjC,MAAMC,WAAW,GAAG,MAAMC,oBAAM,CAACF,cAAc,CAAC,CAAC;EACjD,OAAO,IAAIG,IAAI,CAACF,WAAW,CAAC;AAC9B,CAAC;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEcC,cAAc","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _queryCategorySamples = _interopRequireDefault(require("./queryCategorySamples"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
async function getMostRecentCategorySample(identifier) {
|
|
10
10
|
const samples = await (0, _queryCategorySamples.default)(identifier, {
|
|
11
11
|
limit: 1,
|
|
@@ -13,6 +13,5 @@ async function getMostRecentCategorySample(identifier) {
|
|
|
13
13
|
});
|
|
14
14
|
return samples[0] ?? null;
|
|
15
15
|
}
|
|
16
|
-
var _default = getMostRecentCategorySample;
|
|
17
|
-
exports.default = _default;
|
|
16
|
+
var _default = exports.default = getMostRecentCategorySample;
|
|
18
17
|
//# sourceMappingURL=getMostRecentCategorySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_queryCategorySamples","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_queryCategorySamples","_interopRequireDefault","require","e","__esModule","default","getMostRecentCategorySample","identifier","samples","queryCategorySamples","limit","ascending","_default","exports"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n): Promise<HKCategorySample<T> | null> {\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,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKzD,eAAeG,2BAA2BA,CAGxCC,UAAa,EACwB;EACrC,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAoB,EAACF,UAAU,EAAE;IACrDG,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,OAAOH,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC3B;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEcC,2BAA2B","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _queryQuantitySamples = _interopRequireDefault(require("./queryQuantitySamples"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
async function getMostRecentQuantitySample(identifier, unit) {
|
|
10
10
|
const samples = await (0, _queryQuantitySamples.default)(identifier, {
|
|
11
11
|
limit: 1,
|
|
@@ -17,6 +17,5 @@ async function getMostRecentQuantitySample(identifier, unit) {
|
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
var _default = getMostRecentQuantitySample;
|
|
21
|
-
exports.default = _default;
|
|
20
|
+
var _default = exports.default = getMostRecentQuantitySample;
|
|
22
21
|
//# sourceMappingURL=getMostRecentQuantitySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_queryQuantitySamples","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_queryQuantitySamples","_interopRequireDefault","require","e","__esModule","default","getMostRecentQuantitySample","identifier","unit","samples","queryQuantitySamples","limit","lastSample","_default","exports"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n): Promise<HKQuantitySample<TIdentifier, TUnit> | null> {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n\n const lastSample = samples[0]\n\n if (lastSample) {\n return lastSample as HKQuantitySample<TIdentifier, TUnit>\n }\n return null\n}\n\nexport default getMostRecentQuantitySample\n"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKzD,eAAeG,2BAA2BA,CAIxCC,UAAuB,EACvBC,IAAW,EAC2C;EACtD,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAoB,EAACH,UAAU,EAAE;IACrDI,KAAK,EAAE,CAAC;IACRH;EACF,CAAC,CAAC;EAEF,MAAMI,UAAU,GAAGH,OAAO,CAAC,CAAC,CAAC;EAE7B,IAAIG,UAAU,EAAE;IACd,OAAOA,UAAU;EACnB;EACA,OAAO,IAAI;AACb;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAEcC,2BAA2B","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _queryWorkouts = _interopRequireDefault(require("./queryWorkouts"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const getMostRecentWorkout = async options => {
|
|
10
10
|
const workouts = await (0, _queryWorkouts.default)({
|
|
11
11
|
limit: 1,
|
|
@@ -15,6 +15,5 @@ const getMostRecentWorkout = async options => {
|
|
|
15
15
|
});
|
|
16
16
|
return workouts[0] || null;
|
|
17
17
|
};
|
|
18
|
-
var _default = getMostRecentWorkout;
|
|
19
|
-
exports.default = _default;
|
|
18
|
+
var _default = exports.default = getMostRecentWorkout;
|
|
20
19
|
//# sourceMappingURL=getMostRecentWorkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_queryWorkouts","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_queryWorkouts","_interopRequireDefault","require","e","__esModule","default","getMostRecentWorkout","options","workouts","queryWorkouts","limit","ascending","energyUnit","distanceUnit","_default","exports"],"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,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAe3C,MAAMG,oBAA4C,GAAG,MAAOC,OAAO,IAAK;EACtE,MAAMC,QAAQ,GAAG,MAAM,IAAAC,sBAAa,EAAC;IACnCC,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE,KAAK;IAChBC,UAAU,EAAEL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,UAAU;IAC/BC,YAAY,EAAEN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM;EACzB,CAAC,CAAC;EAEF,OAAOL,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI;AAC5B,CAAC;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAEcC,oBAAoB","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _getPreferredUnits = _interopRequireDefault(require("./getPreferredUnits"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const getPreferredUnit = async type => {
|
|
10
10
|
const [unit] = await (0, _getPreferredUnits.default)([type]);
|
|
11
11
|
return unit;
|
|
12
12
|
};
|
|
13
|
-
var _default = getPreferredUnit;
|
|
14
|
-
exports.default = _default;
|
|
13
|
+
var _default = exports.default = getPreferredUnit;
|
|
15
14
|
//# sourceMappingURL=getPreferredUnit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getPreferredUnits","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_getPreferredUnits","_interopRequireDefault","require","e","__esModule","default","getPreferredUnit","type","unit","getPreferredUnits","_default","exports"],"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,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQnD,MAAMG,gBAAoC,GAAG,MAAOC,IAAI,IAAK;EAC3D,MAAM,CAACC,IAAI,CAAC,GAAG,MAAM,IAAAC,0BAAiB,EAAC,CAACF,IAAI,CAAC,CAAC;EAC9C,OAAOC,IAAI;AACb,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEcC,gBAAgB","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const getPreferredUnits = async identifiers => {
|
|
10
10
|
const units = await _nativeTypes.default.getPreferredUnits(identifiers);
|
|
11
11
|
return identifiers.map(i => units[i]);
|
|
12
12
|
};
|
|
13
|
-
var _default = getPreferredUnits;
|
|
14
|
-
exports.default = _default;
|
|
13
|
+
var _default = exports.default = getPreferredUnits;
|
|
15
14
|
//# sourceMappingURL=getPreferredUnits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","e","__esModule","default","getPreferredUnits","identifiers","units","Native","map","i","_default","exports"],"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,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQpC,MAAMG,iBAAsC,GAAG,MAAOC,WAAW,IAAK;EACpE,MAAMC,KAAK,GAAG,MAAMC,oBAAM,CAACH,iBAAiB,CAACC,WAAW,CAAC;EACzD,OAAOA,WAAW,CAACG,GAAG,CAAEC,CAAC,IAAKH,KAAK,CAACG,CAAC,CAAC,CAAC;AACzC,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEcC,iBAAiB","ignoreList":[]}
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireWildcard(require("../native-types"));
|
|
8
|
-
function _getRequireWildcardCache(
|
|
9
|
-
function _interopRequireWildcard(
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
async function getPreferredUnitsTyped(options) {
|
|
11
11
|
let energyUnit = options === null || options === void 0 ? void 0 : options.energyUnit;
|
|
12
12
|
let distanceUnit = options === null || options === void 0 ? void 0 : options.distanceUnit;
|
|
@@ -30,6 +30,5 @@ async function getPreferredUnitsTyped(options) {
|
|
|
30
30
|
distanceUnit
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
var _default = getPreferredUnitsTyped;
|
|
34
|
-
exports.default = _default;
|
|
33
|
+
var _default = exports.default = getPreferredUnitsTyped;
|
|
35
34
|
//# sourceMappingURL=getPreferredUnitsTyped.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireWildcard","require","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getPreferredUnitsTyped","options","energyUnit","distanceUnit","units","Native","getPreferredUnits","HKQuantityTypeIdentifier","distanceWalkingRunning","activeEnergyBurned","UnitOfEnergy","Kilocalories","UnitOfLength","Meter","_default","exports"],"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,IAAAA,YAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8F,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAI9F,eAAeW,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,MAAMC,oBAAM,CAACC,iBAAiB,CAAC,CAC3CC,qCAAwB,CAACC,sBAAsB,EAC/CD,qCAAwB,CAACE,kBAAkB,CAC5C,CAAC;IACF,IAAI,CAACP,UAAU,EAAE;MACfA,UAAU,GAAGE,KAAK,CAACG,qCAAwB,CAACE,kBAAkB,CAEnD;IACb;IACA,IAAI,CAACN,YAAY,EAAE;MACjBA,YAAY,GAAGC,KAAK,CAACG,qCAAwB,CAACC,sBAAsB,CAEzD;IACb;EACF;EAEA,IAAI,CAACN,UAAU,EAAE;IACfA,UAAU,GAAGQ,yBAAY,CAACC,YAAuB;EACnD;EACA,IAAI,CAACR,YAAY,EAAE;IACjBA,YAAY,GAAGS,yBAAY,CAACC,KAAkB;EAChD;EACA,OAAO;IAAEX,UAAU;IAAEC;EAAa,CAAC;AACrC;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAA7B,OAAA,GAEcc,sBAAsB","ignoreList":[]}
|
|
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
9
|
-
const getRequestStatusForAuthorization = async
|
|
10
|
-
let write = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const getRequestStatusForAuthorization = async (read, write = []) => {
|
|
11
10
|
const readPermissions = read.reduce((obj, cur) => ({
|
|
12
11
|
...obj,
|
|
13
12
|
[cur]: true
|
|
@@ -18,6 +17,5 @@ const getRequestStatusForAuthorization = async function (read) {
|
|
|
18
17
|
}), {});
|
|
19
18
|
return _nativeTypes.default.getRequestStatusForAuthorization(writePermissions, readPermissions);
|
|
20
19
|
};
|
|
21
|
-
var _default = getRequestStatusForAuthorization;
|
|
22
|
-
exports.default = _default;
|
|
20
|
+
var _default = exports.default = getRequestStatusForAuthorization;
|
|
23
21
|
//# sourceMappingURL=getRequestStatusForAuthorization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","e","__esModule","default","getRequestStatusForAuthorization","read","write","readPermissions","reduce","obj","cur","writePermissions","Native","_default","exports"],"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,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMpC,MAAMG,gCAAgC,GAAG,MAAAA,CACvCC,IAA2C,EAC3CC,KAA6C,GAAG,EAAE,KAC/C;EACH,MAAMC,eAAe,GAAGF,IAAI,CAACG,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAoB,CAAC;EAEnG,MAAMC,gBAAgB,GAAGL,KAAK,CAACE,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAqB,CAAC;EAEtG,OAAOE,oBAAM,CAACR,gCAAgC,CAC5CO,gBAAgB,EAChBJ,eACF,CAAC;AACH,CAAC;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEcC,gCAAgC","ignoreList":[]}
|
|
@@ -5,10 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
async function getWorkoutPlanById(workoutUUID) {
|
|
10
10
|
return _nativeTypes.default.getWorkoutPlanById(workoutUUID);
|
|
11
11
|
}
|
|
12
|
-
var _default = getWorkoutPlanById;
|
|
13
|
-
exports.default = _default;
|
|
12
|
+
var _default = exports.default = getWorkoutPlanById;
|
|
14
13
|
//# sourceMappingURL=getWorkoutPlanById.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_nativeTypes","_interopRequireDefault","require","e","__esModule","default","getWorkoutPlanById","workoutUUID","Native","_default","exports"],"sources":["getWorkoutPlanById.ts"],"sourcesContent":["import Native from '../native-types'\n\nasync function getWorkoutPlanById(workoutUUID: string) {\n return Native.getWorkoutPlanById(workoutUUID)\n}\n\nexport default getWorkoutPlanById\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,eAAeG,kBAAkBA,CAACC,WAAmB,EAAE;EACrD,OAAOC,oBAAM,CAACF,kBAAkB,CAACC,WAAW,CAAC;AAC/C;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEcC,kBAAkB","ignoreList":[]}
|
|
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _serializeDate = _interopRequireDefault(require("./serializeDate"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const prepareOptions = options => {
|
|
10
10
|
const limit = !options.limit || options.limit === Infinity ? 0 : options.limit;
|
|
11
11
|
const ascending = options.ascending ?? limit === 0;
|
|
12
|
+
// eslint-disable-next-line no-nested-ternary
|
|
12
13
|
const from = (0, _serializeDate.default)(options.from ? options.from : limit > 0 ? new Date(0) : undefined);
|
|
13
14
|
const to = (0, _serializeDate.default)(options.to);
|
|
14
15
|
const anchor = options.anchor ?? '';
|
|
@@ -20,6 +21,5 @@ const prepareOptions = options => {
|
|
|
20
21
|
anchor
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
|
-
var _default = prepareOptions;
|
|
24
|
-
exports.default = _default;
|
|
24
|
+
var _default = exports.default = prepareOptions;
|
|
25
25
|
//# sourceMappingURL=prepareOptions.js.map
|