NativeWorkoutsModule — @gj-kit/expo-workouts
@gj-kit/expo-workouts에서 공개하는 interface입니다. package version 0.1.1의 release declaration을 그대로 표시합니다.
검증된 import 예제
섹션 제목: “검증된 import 예제”import { NativeWorkoutsModule } from '@gj-kit/expo-workouts';시그니처, 매개변수, 반환 타입
섹션 제목: “시그니처, 매개변수, 반환 타입”/** * 네이티브 모듈 계약. `./testing`의 `createFakeNativeWorkouts()`가 이것을 인메모리로 구현하고, * 실물은 `requireOptionalNativeModule('GjKitWorkouts')`가 돌려준다. */interface NativeWorkoutsModule { availability(): Promise<AvailabilityDto>; authorizationSnapshot(): Promise<AuthorizationSnapshotDto>; /** * No internal timeout (f120, f122). Returns the raw before/after granted sets. * * ⚠ **Phase 3 correction (design defect found by running the example app).** This member used to * take ONE flat `readonly string[]`. That is lossless on Android — the direction lives in the * permission string itself (`READ_EXERCISE` vs `WRITE_EXERCISE`) — but on iOS the SAME type * identifier serves both directions, so a flat array cannot express what * `HKHealthStore.requestAuthorization(toShare:read:)` requires: the iOS lane could only either * over-request share access or silently drop it. The two sets are now explicit. * `read`/`write` are Android permission strings on Android and HK type identifiers on iOS. * `history` is Android's `READ_HEALTH_DATA_HISTORY` and rides in `read`. */ requestPermissions(request: PermissionRequestDto): Promise<PermissionOutcomeDto>; /** 커서의 `g` 지문을 만드는 원시 연산. 정렬된 granted 권한 문자열 목록을 그대로 준다. */ grantedScopeFingerprint(): Promise<string>; /** Start instant in `[fromMs, toMs)`. iOS `.strictStartDate`, Android `TimeRangeFilter.between`. */ readWorkoutPage(query: WindowDto & { readonly pageSize: number; readonly pageToken?: string | undefined; }): Promise<WorkoutPageDto>; /** One call per metric type per PAGE WINDOW - never per session (§8.4). Never `aggregate()` (f109). */ readMetricRecords(query: WindowDto & { readonly type: MetricTypeDto; readonly origins: readonly string[]; }): Promise<readonly MetricRowDto[]>; readHeartRateSamples(query: WindowDto): Promise<readonly HeartRateDto[]>; /** iOS provenance discriminator required by RESULTS 206 / f71. */ hasAssociatedSamples(nativeId: string, quantity: QuantityKindDto): Promise<boolean>; takeCheckpoint(): Promise<string>; drainCheckpoint(checkpoint: string, limit: number): Promise<DrainBatchDto>; openRoute(nativeId: string, consent: 'skip' | 'prompt'): Promise<RouteHandleDto>; readRouteChunk(handle: string, maxPoints: number): Promise<readonly RoutePointDto[] | null>; closeRoute(handle: string): Promise<void>; /** iOS: look the workout up by sync identifier BEFORE writing (idx f26). Android: `null`. */ findBySyncIdentifier(clientId: string): Promise<ExistingWorkoutDto | null>; saveWorkout(spec: WorkoutWriteDto): Promise<SaveOutcomeDto>; /** Android only, ALWAYS called after a save (f93, f94). `null` when nothing was found. */ readBackVersion(clientId: string): Promise<number | null>; deleteWorkout(ref: DeleteRefDto): Promise<boolean>; openSettings(): Promise<void>; openStoreListing(): Promise<void>;}이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.
Release context
섹션 제목: “Release context”- 패키지:
@gj-kit/expo-workouts - 버전:
0.1.1 - 공개 entry:
. - 소스: GitHub
구현 주석
섹션 제목: “구현 주석”네이티브 모듈 계약. ./testing의 createFakeNativeWorkouts()가 이것을 인메모리로 구현하고,
실물은 requireOptionalNativeModule('GjKitWorkouts')가 돌려준다.