WorkoutBase — @gj-kit/expo-workouts
@gj-kit/expo-workouts/core에서 공개하는 interface입니다. package version 0.1.1의 release declaration을 그대로 표시합니다.
검증된 import 예제
섹션 제목: “검증된 import 예제”import { WorkoutBase } from '@gj-kit/expo-workouts/core';시그니처, 매개변수, 반환 타입
섹션 제목: “시그니처, 매개변수, 반환 타입”/** 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;}이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.
Release context
섹션 제목: “Release context”- 패키지:
@gj-kit/expo-workouts - 버전:
0.1.1 - 공개 entry:
./core - 소스: GitHub
구현 주석
섹션 제목: “구현 주석”The fields both platforms share. Never used directly — see Workout.