WorkoutBase — @gj-kit/expo-workouts
A public interface from @gj-kit/expo-workouts/core. The signature below is taken directly from the 0.1.1 release declaration.
Verified import example
Section titled “Verified import example”import { WorkoutBase } from '@gj-kit/expo-workouts/core';Signature, parameters, and return type
Section titled “Signature, parameters, and return type”/** The fields both platforms share. Never used directly — see `Workout`. */interface WorkoutBase { /** The PLATFORM id: HKWorkout.uuid / ExerciseSessionRecord.metadata.id. Pass this to `getRoute`. */ readonly id: string; /** * The id the WRITING app used (HKMetadataKeySyncIdentifier / clientRecordId), when present. * It is the STABLE upsert key for own writes: on iOS `id` changes when a workout is replaced while * `clientId` does not. It is visible cross-app, so never put anything sensitive in it. */ readonly clientId?: string | undefined; /** True when this app wrote it. Nothing is filtered on your behalf — the sync loop needs to see * its own echo to reconcile native ids. Filter on this yourself. */ readonly isOwn: boolean; readonly kind: WorkoutKind; /** * `undefined` when the platform cannot tell. iOS raw `locationType` 3 means "outdoor OR unknown", * so an absent HKIndoorWorkout metadata key leaves this undefined rather than `false`. * * ⚠ **Platform-asymmetric, by construction.** On iOS this is STORED, so it round-trips for every * `kind`. On Android it is DERIVED from `exerciseType` alone, so it survives only for the four * kinds with a constant pair (`running`, `cycling`, `swimming`, `rowing`) and reads back * `undefined` for the other five. On those four paired kinds the opposite rounding happens: * `indoor: undefined` normalizes to `false` after an Android round-trip. */ readonly indoor?: boolean | undefined; readonly startMs: number; readonly endMs: number; /** * Active seconds. iOS: the store's own `duration`, which honours the writer's explicit value and * can differ from `endMs - startMs`. Android: `(endMs - startMs)` minus every PAUSE segment. */ readonly activeDurationS: number; /** Minutes east of UTC at the workout's start. Use this for day bucketing. */ readonly utcOffsetMin?: number | undefined; readonly source: WorkoutSource; /** * Metres. `undefined` means UNKNOWN — never 0. * ⚠ Populated only when the `'distance'` read scope is granted. With `read: ['workouts']` alone * this field is `undefined` on EVERY workout. `unpopulatedWorkoutMetrics(state)` answers "which * fields can never be filled with the permissions I hold" without a device. */ readonly distanceM?: number | undefined; readonly distanceProvenance?: MetricProvenance | undefined; /** * Active kcal, never total/BMR-inclusive. `undefined` means UNKNOWN — never 0. * ⚠ Populated only when the `'activeEnergy'` read scope is granted. */ readonly activeEnergyKcal?: number | undefined; readonly activeEnergyProvenance?: MetricProvenance | undefined; /** * Metres of cumulative ascent. ⚠ Populated only when the `'elevation'` read scope is granted. * On iOS that scope maps to the EMPTY HealthKit set and therefore aliases `'workouts'`. */ readonly elevationGainM?: number | undefined; /** ⚠ Populated only when the `'heartRate'` read scope is granted. */ readonly heartRate?: WorkoutHeartRateSummary | undefined; /** ⚠ Populated only when the `'steps'` read scope is granted. */ readonly steps?: number | undefined; /** Explicit pause segments only. */ readonly pauses: readonly Pause[]; readonly laps: readonly Lap[]; readonly routeState: RouteState; readonly lastModifiedMs?: number | undefined;}This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.
Release context
Section titled “Release context”- Package:
@gj-kit/expo-workouts - Version:
0.1.1 - Public entry:
./core - Source: GitHub