콘텐츠로 이동

PendingSelection — @gj-kit/expo-media

@gj-kit/expo-media/core에서 공개하는 interface입니다. package version 0.6.1의 release declaration을 그대로 표시합니다.

import { PendingSelection } from '@gj-kit/expo-media/core';
interface PendingSelection {
/** The configured cap. */
readonly max: number;
/**
* Stable identity of an item: `asset:<assetId>` (falling back to the URI when the picker gave
* no asset id) for picked items, `binary:<name>:<size>:<lastModified>` for binaries.
*/
keyOf(item: PendingMediaItem): string;
/**
* Stage items. Duplicates (by `keyOf`, including duplicates within `items`) are rejected before
* the cap is checked, so a re-selected photo reports `duplicate` even when the selection is full.
* Nothing is revoked here; pass the result's `releasable` to `release`. Neither `state` nor
* `items` is mutated, and the result object and its arrays are frozen.
*/
add(state: PendingSelectionState, items: readonly PendingMediaItem[]): PendingAddResult;
/**
* Drop every item whose `keyOf` equals `key`, calling `revoke` on removed binaries. Returns the
* same reference when no item matched.
*/
remove(state: PendingSelectionState, key: string): PendingSelectionState;
/** Drop every item, calling `revoke` on each binary that still holds a preview resource. */
clear(state: PendingSelectionState): PendingSelectionState;
/**
* Call `revoke` on binaries that are not staged — typically `PendingAddResult.releasable`.
* Idempotent per item object; picked items and binaries without `revoke` are ignored. Passing an
* item that is still staged kills its live preview, which is why `rejected` is not the input here.
*/
release(items: readonly PendingMediaItem[]): void;
/** Picked assets in selection order — the input of `uploadPickedAsset` / device resolve paths. */
toPickedAssets(state: PendingSelectionState): readonly PickedAsset[];
/** Binary sources in selection order — the input of `uploadBinary` / `uploadDropped`. */
toBinarySources(state: PendingSelectionState): readonly NamedBinarySource[];
/**
* URI the host can render, or `null`. Picked assets always preview through their own URI. A binary
* previews only when it has a `previewUri` **and** is not HEIC/HEIF — browsers cannot decode those,
* and an `<img>` that never loads looks like a broken upload.
*/
previewUriOf(item: PendingMediaItem): string | null;
/** `previewUriOf(item) !== null`. */
canPreview(item: PendingMediaItem): boolean;
/**
* Capture time as an ISO string, or `null`. Picked items read the picker EXIF dictionary; binaries
* parse the JPEG APP1 segment from bytes (the same parsers the upload path uses). Never throws.
*/
capturedAtOf(item: PendingMediaItem): Promise<string | null>;
}

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/expo-media
  • 버전: 0.6.1
  • 공개 entry: ./core
  • 소스: GitHub