Skip to content

toPickedAsset — @gj-kit/expo-media

A public function from @gj-kit/expo-media/core. The signature below is taken directly from the 0.6.1 release declaration.

import { toPickedAsset } from '@gj-kit/expo-media/core';
/**
* `DeviceAsset`의 정체성(id·filename·치수)과 resolve 결과(바이트 위치·실측 크기·EXIF)를 합쳐
* 피커 업로드 경로가 받는 형태를 만든다.
*
* ⚠ **`exif: resolved.exif ?? undefined` — null → undefined 정규화가 필수다.**
* EOP(`exactOptionalPropertyTypes`) 하에서 `ResolvedDeviceAsset.exif`는
* `Readonly<Record<string, unknown>> | null`이고 `PickedAsset.exif`는
* `?: Readonly<Record<string, unknown>> | undefined`라 **null을 그대로 대입하면 TS2322**다
* (설계 문서 §5.4-④의 실측 확인). 전신은 `exif: null`을 그대로 흘렸다.
*
* ⚠ **`reportedSizeBytes`는 채우지 않는다.** 기기 경로에서 크기의 진실은 `verifiedSizeBytes`
* (= 실제로 스트리밍될 캐시 사본을 stat한 값)뿐이다. 자칭 크기를 여기서 끼워 넣으면
* §7 하드닝 3이 세운 신뢰도 서열(verified > file-system stat > reported)이 무너지고,
* Android 재인코딩 자산에서 서버가 업로드를 거절하던 그 사고가 그대로 재발한다.
*
* ⚠ **`assetId`를 반드시 채운다.** 소비자의 dedup 1차 키이기 때문이다(§3.3-⑥):
* `assetId`가 없으면 dedup이 스테이징 사본 uri로 폴백하는데, 그 uri는 resolve마다 재생성되므로
* 같은 사진을 두 번 선택해도 dedup이 통과해버린다.
*/
declare function toPickedAsset(asset: DeviceAsset, resolved: ResolvedDeviceAsset): ResolvedPickedAsset;

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.

  • Package: @gj-kit/expo-media
  • Version: 0.6.1
  • Public entry: ./core
  • Source: GitHub