콘텐츠로 이동

RefreshRequestResult — @gj-kit/expo-auth

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

import { RefreshRequestResult } from '@gj-kit/expo-auth';
/**
* The host calls its own HTTP stack against its refresh endpoint and translates the response
* into this three-way classification (design §3.3):
*
* - `'rotated'`: the server issued a new token pair. `tokens` is required — omitting it is a
* compile error (§4.1-②).
* - `'invalid'`: a definitive rejection (401/403 — token revoked or expired). The session ended.
* - `'transient'`: the server could not decide (network error, 5xx, CORS, timeout). The tokens
* may still be valid.
*
* ⚠ If the callback throws, the core treats it as `{ status: 'transient', cause: <thrown value> }`:
* a classifier bug must not fail toward signing the user out (fail-safe in the H1 direction),
* and the thrown value is preserved as `cause` so it is never silently swallowed — it flows to
* the caller's return value and to `onScheduledOutcome`, letting host telemetry distinguish a
* classifier bug from network flapping (§3.4). `cause` is a structured field; the library never
* stringifies it, so this does not conflict with §4.2.
*/
type RefreshRequestResult = {
readonly status: 'rotated';
readonly tokens: TokenPair;
/** Access-token lifetime in seconds, as stated by the server. When present it takes priority over JWT `exp` decoding (§3.6). */
readonly accessTtlSeconds?: number | undefined;
} | {
readonly status: 'invalid';
} | {
readonly status: 'transient';
};

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

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

The host calls its own HTTP stack against its refresh endpoint and translates the response into this three-way classification (design §3.3):

  • 'rotated': the server issued a new token pair. tokens is required — omitting it is a compile error (§4.1-②).
  • 'invalid': a definitive rejection (401/403 — token revoked or expired). The session ended.
  • 'transient': the server could not decide (network error, 5xx, CORS, timeout). The tokens may still be valid.

⚠ If the callback throws, the core treats it as { status: 'transient', cause: <thrown value> }: a classifier bug must not fail toward signing the user out (fail-safe in the H1 direction), and the thrown value is preserved as cause so it is never silently swallowed — it flows to the caller’s return value and to onScheduledOutcome, letting host telemetry distinguish a classifier bug from network flapping (§3.4). cause is a structured field; the library never stringifies it, so this does not conflict with §4.2.