connectbase-client 6.10.0 → 6.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -428,6 +428,11 @@ declare class HttpClient {
428
428
  getRecentCalls(): RecentApiCall[];
429
429
  /** 최근 호출 buffer clear (테스트/프라이버시 처리). */
430
430
  clearRecentCalls(): void;
431
+ /**
432
+ * Secret Key 는 계정 권한의 자격증명이다. 브라우저 번들에 넣으면 페이지를 여는 누구나 읽는다.
433
+ * 막지는 않는다(Electron 등 신뢰된 환경이 있다) — 대신 무엇이 위험한지 분명히 알린다.
434
+ */
435
+ private warnIfSecretKeyInBrowser;
431
436
  private warnIfUnsafePersistence;
432
437
  updateConfig(config: Partial<HttpClientConfig>): void;
433
438
  setTokens(accessToken: string, refreshToken: string): void;
@@ -451,6 +456,17 @@ declare class HttpClient {
451
456
  private markNoCookieSession;
452
457
  private clearNoCookieSessionMark;
453
458
  /** 쿠키 전용 refresh 를 지금 건너뛰어야 하는지 (최근에 401/403 을 받았는지). */
459
+ /**
460
+ * 이 브라우저에 세션이 없다는 것을 이미 아는가. 메모리에 access/refresh token 이 없고, 60초 안의 쿠키 복구가
461
+ * "세션 없음"(401 또는 quiet 204)으로 끝났으면 true 다. 회원 전용 API 는 물어도 401 뿐이라, 부르는 쪽이 요청을
462
+ * 건너뛰고 {@link rejectNoSession} 으로 같은 오류를 던질 때 쓴다.
463
+ */
464
+ knowsNoSession(): boolean;
465
+ /**
466
+ * 세션이 없을 때 서버가 돌려주는 것과 같은 401 ApiError 를 요청 없이 만든다. 서버 경로와 같은 변환(buildApiError)과
467
+ * 오류 알림(emitError)을 거치므로 앱이 받는 오류는 그대로이고, 브라우저 콘솔에 실패한 요청만 남지 않는다.
468
+ */
469
+ rejectNoSession(): Promise<ApiError>;
454
470
  private isNoCookieSessionMarkFresh;
455
471
  /**
456
472
  * OAuth redirect callback 직후 호출되어 HttpOnly cookie 를 부트스트랩한다.
@@ -553,6 +569,23 @@ declare class HttpClient {
553
569
  tryRestoreSessionFromCookie(): Promise<boolean>;
554
570
  private emitError;
555
571
  private isTokenExpired;
572
+ /**
573
+ * 실시간 연결(`cb.realtime`, `cb.database` 실시간)이 연결 위에서 token 을 갱신할 수 있는지 — token 이 이 클라이언트가 들고
574
+ * 있는 멤버 세션(같은 앱, 같은 멤버)의 것이고, 세션을 refresh 할 수단(메모리의 refresh token, 또는 브라우저의 HttpOnly
575
+ * 쿠키)이 있을 때만이다. 앱이 다른 곳에서 받은 토큰(다른 멤버, 함수의 위임 토큰, OAuth 토큰)이면 false.
576
+ */
577
+ canRefreshMemberToken(token: string | undefined): boolean;
578
+ /**
579
+ * token 과 같은 멤버 세션의 access token 을 minValiditySec 초 이상 남은 것으로 돌려준다. 지금 세션 토큰이 그만큼 남았으면
580
+ * 그대로, 아니면 HTTP 요청과 같은 refresh(같은 single-flight, 같은 실패 처리 — 세션이 끝났으면 onTokenExpired)를 한다.
581
+ * 세션이 다르거나 갱신에 실패하면 undefined.
582
+ *
583
+ * `replace` 는 token 이 곧 만료된다고 서버가 알렸을 때 쓴다 — 세션 토큰이 token 과 같으면 이쪽 시계로는 아직 남았어도
584
+ * 갱신한다(기기 시계가 늦으면 서버 기준 만료를 놓친다).
585
+ */
586
+ freshTokenForMember(token: string, minValiditySec: number, options?: {
587
+ replace?: boolean;
588
+ }): Promise<string | undefined>;
556
589
  private prepareHeaders;
557
590
  /**
558
591
  * 실패 응답(`!response.ok`)을 ApiError 로 변환한다. 던지지도, emitError 하지도 않는다.
@@ -1634,6 +1667,33 @@ interface AppMemberDetail {
1634
1667
  suspended_until?: string;
1635
1668
  suspend_reason?: string;
1636
1669
  }
1670
+ /** `cb.appMembers.suspend` 옵션. */
1671
+ interface SuspendAppMemberOptions {
1672
+ /**
1673
+ * 정지 사유(1~500자). 정지된 회원이 로그인하거나 실시간에 다시 붙으려 할 때 이 문구가 그대로 보인다 — 회원에게
1674
+ * 보여 줄 문장으로 쓴다.
1675
+ */
1676
+ reason: string;
1677
+ /**
1678
+ * 정지가 풀리는 시각. 생략하면 `unsuspend` 할 때까지 **영구** 정지다. 지금 이후, 2038-01-19T03:14:07Z 이전이어야
1679
+ * 한다(그보다 길게 막으려면 생략한다). `Date` 또는 ISO 8601 문자열.
1680
+ */
1681
+ until?: Date | string;
1682
+ }
1683
+ /** `cb.appMembers.suspend` 반환값. 백엔드 `SuspendMemberResponse` 매핑. */
1684
+ interface SuspendAppMemberResult {
1685
+ member_id: string;
1686
+ is_suspended: boolean;
1687
+ suspended_at: string;
1688
+ /** 없으면 영구 정지. */
1689
+ suspended_until?: string;
1690
+ suspend_reason: string;
1691
+ }
1692
+ /** `cb.appMembers.unsuspend` 반환값. 백엔드 `UnsuspendMemberResponse` 매핑. */
1693
+ interface UnsuspendAppMemberResult {
1694
+ member_id: string;
1695
+ is_suspended: boolean;
1696
+ }
1637
1697
  /**
1638
1698
  * 앱 멤버 **관리자 조회** API — 서버사이드 전용.
1639
1699
  *
@@ -1644,7 +1704,8 @@ interface AppMemberDetail {
1644
1704
  * service_role 함수에서 쓰려면 함수 `management_scopes` 에 `app_member:read` 를 opt-in 해야
1645
1705
  * 한다. 이 스코프는 **이메일(개인정보)** 을 함께 열어주므로 어드민/CS 흐름에만 부여할 것.
1646
1706
  *
1647
- * 쓰기(생성·삭제·정지·수정)와 활동 로그 조회는 콘솔 전용이다 — service_role 에 열려 있지 않다.
1707
+ * 쓰기 중 삭제(`remove`, `app_member:write`)와 정지(`suspend`/`unsuspend`, `app_member:suspend`)만 service_role 에
1708
+ * 열려 있다. 생성, 수정과 활동 로그 조회는 콘솔 전용이다.
1648
1709
  *
1649
1710
  * @example
1650
1711
  * ```typescript
@@ -1707,6 +1768,46 @@ declare class AppMembersAPI {
1707
1768
  remove(appId: string, memberId: string): Promise<{
1708
1769
  message: string;
1709
1770
  }>;
1771
+ /**
1772
+ * 앱 멤버를 정지한다. 되돌릴 수 있다(`unsuspend`). (management_scope: `app_member:suspend`)
1773
+ *
1774
+ * 콘솔의 정지와 같은 일을 한다.
1775
+ * - 정지 기간 동안 로그인(비밀번호, 소셜), 토큰 재발급, 실시간 접속이 거부된다. 거부 사유로 `reason` 이 보인다.
1776
+ * - 그 회원의 세션(refresh token)을 모두 끊고, 지금 붙어 있는 실시간 연결(`cb.realtime`, DB 실시간, 게임, WebRTC
1777
+ * 시그널링)을 닫는다(close 4403 `member_revoked`).
1778
+ * - 이미 발급된 access token 은 HTTP 요청에는 만료(최대 1시간)까지 유효하다. 데이터 접근을 즉시 막아야 하면 RLS 규칙에
1779
+ * 정지 여부를 반영한다.
1780
+ * - 활동 로그(invoked_by `service_role`)와 IAM 감사(`app_member.suspend`)에 남는다.
1781
+ *
1782
+ * 이미 정지된 회원이면 400 이다(기간을 바꾸려면 `unsuspend` 후 다시 정지한다). 기간이 지난 정지는 정지로 보지 않는다.
1783
+ *
1784
+ * @param appId 앱 ID (함수 안에서는 `ctx.appId`)
1785
+ * @param memberId 정지할 멤버 ID
1786
+ * @param options `reason`(필수), `until`(생략하면 영구)
1787
+ *
1788
+ * @example
1789
+ * ```typescript
1790
+ * // 함수(service_role, management_scopes: ["app_member:suspend"]) 안에서 — 신고 누적 7일 정지
1791
+ * await ctx.cbAdmin.appMembers.suspend(ctx.appId, memberId, {
1792
+ * reason: '신고가 누적되어 7일간 이용이 제한됩니다',
1793
+ * until: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
1794
+ * })
1795
+ *
1796
+ * // 결제 사기 — 영구 정지(until 생략)
1797
+ * await ctx.cbAdmin.appMembers.suspend(ctx.appId, memberId, { reason: '결제 이상으로 계정이 정지되었습니다' })
1798
+ * ```
1799
+ */
1800
+ suspend(appId: string, memberId: string, options: SuspendAppMemberOptions): Promise<SuspendAppMemberResult>;
1801
+ /**
1802
+ * 앱 멤버의 정지를 푼다. (management_scope: `app_member:suspend`)
1803
+ *
1804
+ * 정지로 끊긴 세션은 되살아나지 않는다 — 회원은 다시 로그인해야 한다(정지 전에 발급된 토큰으로는 실시간에 다시 붙을
1805
+ * 수 없다). 정지되지 않은 회원이면 400 이다.
1806
+ *
1807
+ * @param appId 앱 ID
1808
+ * @param memberId 정지를 풀 멤버 ID
1809
+ */
1810
+ unsuspend(appId: string, memberId: string): Promise<UnsuspendAppMemberResult>;
1710
1811
  }
1711
1812
 
1712
1813
  /**
@@ -3214,6 +3315,15 @@ declare class DatabaseAPI {
3214
3315
  private pingInterval;
3215
3316
  private realtimeOnStateChange;
3216
3317
  private realtimeOnError;
3318
+ /**
3319
+ * 이 연결이 `token_refresh=1` 로 협상했는지 — 연결 토큰이 SDK 세션의 멤버 토큰이라 연결 위에서 갱신할 수 있을 때만.
3320
+ * 협상하지 않은 연결(다른 곳에서 받은 토큰, cross-app OAuth 토큰)은 예전처럼 동작한다(서버가 만료 뒤 24시간에 닫는다).
3321
+ */
3322
+ private realtimeTokenRefresh;
3323
+ private realtimeAuthRefreshInFlight;
3324
+ private realtimeAuthRetryTimer;
3325
+ /** 서버가 닫기 직전에 보낸 안내(TOKEN_EXPIRED, MEMBER_REVOKED) — 이어지는 close 오류의 메시지가 된다. */
3326
+ private realtimeCloseNotice;
3217
3327
  private activeSubscriptions;
3218
3328
  constructor(http: HttpClient);
3219
3329
  /**
@@ -3342,6 +3452,8 @@ declare class DatabaseAPI {
3342
3452
  * `options.autoCreate: true` 시 테이블이 없으면 빈 schemaless 테이블을
3343
3453
  * 자동으로 생성한 뒤 insert. opt-in 이며 프로토타입/AI 자동화 워크플로에
3344
3454
  * 권장합니다. production 앱은 명시적 `createTable` 호출 권장.
3455
+ * 테이블 생성은 `secretKey` 나 service_role 함수에서만 됩니다. Public Key 만으로는
3456
+ * 옵션이 무시되어, 없는 테이블이면 404 입니다 (이미 있는 테이블에는 그대로 씁니다).
3345
3457
  */
3346
3458
  createData(tableIdOrName: string, data: CreateDataRequest, options?: {
3347
3459
  autoCreate?: boolean;
@@ -3533,13 +3645,13 @@ declare class DatabaseAPI {
3533
3645
  * // 자기 앱 테이블 구독 (AppMember JWT)
3534
3646
  * cb.database.connectRealtime({
3535
3647
  * accessToken: 'your-jwt-token',
3536
- * dataServerUrl: 'https://data.connectbase.world'
3648
+ * dataServerUrl: 'https://api.connectbase.world'
3537
3649
  * })
3538
3650
  *
3539
3651
  * // cross-app: Provider 앱의 테이블 구독 (OAuth access token)
3540
3652
  * cb.database.connectRealtime({
3541
3653
  * accessToken: oauthAccessToken,
3542
- * dataServerUrl: 'https://data.connectbase.world'
3654
+ * dataServerUrl: 'https://api.connectbase.world'
3543
3655
  * })
3544
3656
  *
3545
3657
  * // 테이블 구독
@@ -3593,6 +3705,11 @@ declare class DatabaseAPI {
3593
3705
  */
3594
3706
  onRealtimeError(handler: (error: Error) => void): () => void;
3595
3707
  private setRealtimeState;
3708
+ /**
3709
+ * 연결(재연결)을 연다 — 먼저 토큰을 준비한다. SDK 세션의 멤버 토큰인데 곧(1분 안) 만료되면 새로 받는다. 끊긴 사이 만료된
3710
+ * 토큰으로 붙으면 서버가 거부해 재연결이 멈춘다. 앱이 다른 곳에서 받은 토큰은 건드리지 않는다.
3711
+ */
3712
+ private connectRealtimeSocket;
3596
3713
  private doRealtimeConnect;
3597
3714
  /**
3598
3715
  * 서버에 subscribe 메시지를 보내고 서버 subscription_id를 반환하는 Promise
@@ -3608,6 +3725,16 @@ declare class DatabaseAPI {
3608
3725
  private stopRealtimePing;
3609
3726
  private sendRealtimeMessage;
3610
3727
  private generateRequestId;
3728
+ /**
3729
+ * 연결을 끊지 않고 멤버 토큰을 바꾼다(`auth_refresh`). 새 토큰은 HTTP 요청과 같은 refresh 로 받는다
3730
+ * (`HttpClient.freshTokenForMember`). 한 번에 하나만 보내고, 성공하면 재연결도 새 토큰을 쓴다. 실패하면 30초 뒤 다시 해
3731
+ * 본다(서버는 만료 뒤 유예가 지나야 닫는다). SDK 세션 자체가 끝났으면 더 시도하지 않는다.
3732
+ */
3733
+ private refreshRealtimeAuth;
3734
+ /** 요청 하나를 보내고 같은 request_id 의 응답(또는 error)을 기다린다. */
3735
+ private sendRealtimeRequest;
3736
+ private scheduleRealtimeAuthRetry;
3737
+ private clearRealtimeAuthRetry;
3611
3738
  private debugLog;
3612
3739
  }
3613
3740
 
@@ -5326,11 +5453,11 @@ type KnowledgeFileInput = File | Blob | {
5326
5453
  *
5327
5454
  * 접근 범위는 세 축으로 판정됩니다 (2026-09-06 fail-closed 전환).
5328
5455
  *
5329
- * 1. **익명 (퍼블릭 키만)** — `metadata.user_id` 가 **없는** 문서만 조회/검색/수정/삭제.
5330
- * FAQ 나 제품 문서 같은 공유 코퍼스는 종전과 동일하게 동작합니다.
5456
+ * 1. **익명 (퍼블릭 키만)** — `metadata.user_id` 가 **없는** 문서의 조회/검색만.
5457
+ * 문서 추가, 수정, 삭제는 401 `KB_WRITE_CREDENTIAL_REQUIRED` 입니다 (2026-11-08 부터).
5331
5458
  * 2. **회원 (`Authorization: Bearer <appmember-jwt>` 동봉)** — 본인 문서만. addDocument 시
5332
5459
  * `metadata.user_id` 가 자동 태깅되고, 클라이언트가 다른 값을 넣어도 서버가 덮어씁니다.
5333
- * 3. **관리자 (`secretKey: 'cb_sk_*'`)** — 전체 접근. 서버사이드 동기화/대리 색인용.
5460
+ * 3. **관리자 (`secretKey: 'cb_sk_*'`)** — 전체 접근. 공유 문서 관리, 서버사이드 동기화/대리 색인용.
5334
5461
  *
5335
5462
  * 퍼블릭 키만으로 `metadata.user_id` 를 직접 지정하면 403 `MEMBER_SCOPED_METADATA_DENIED`,
5336
5463
  * 회원 귀속 문서를 건드리면 403 `CROSS_USER_ACCESS_DENIED` 입니다. 퍼블릭 키는 브라우저 번들에
@@ -5340,7 +5467,7 @@ type KnowledgeFileInput = File | Blob | {
5340
5467
  * ```typescript
5341
5468
  * const cb = new ConnectBase({ publicKey: 'your-public-key' })
5342
5469
  *
5343
- * // 텍스트 문서 추가
5470
+ * // 텍스트 문서 추가 (로그인한 회원 토큰이나 secretKey 가 있어야 한다)
5344
5471
  * await cb.knowledge.addDocument('kb-id', {
5345
5472
  * name: '환불 정책',
5346
5473
  * source_type: 'text',
@@ -5376,6 +5503,7 @@ declare class KnowledgeAPI {
5376
5503
  * 문서 추가
5377
5504
  *
5378
5505
  * 지식 베이스에 새 문서를 추가합니다. 텍스트 소스인 경우 즉시 처리됩니다.
5506
+ * 로그인한 회원 토큰(본인 문서)이나 `secretKey` 가 필요합니다. Public Key 만으로는 401 입니다.
5379
5507
  *
5380
5508
  * @param kbID - 지식 베이스 ID
5381
5509
  * @param data - 문서 생성 요청
@@ -5505,6 +5633,7 @@ declare class KnowledgeAPI {
5505
5633
  * 문서 삭제
5506
5634
  *
5507
5635
  * 문서와 관련된 모든 청크도 함께 삭제됩니다.
5636
+ * 로그인한 회원 토큰(본인 문서)이나 `secretKey` 가 필요합니다. Public Key 만으로는 401 입니다.
5508
5637
  *
5509
5638
  * @param kbID - 지식 베이스 ID
5510
5639
  * @param docID - 문서 ID
@@ -6286,6 +6415,15 @@ interface OAuthCallbackResponse {
6286
6415
  email?: string;
6287
6416
  }
6288
6417
 
6418
+ /** `exchangeCodeFromCallback()` 의 결과. */
6419
+ interface ExchangedCallbackResult {
6420
+ access_token: string;
6421
+ refresh_token: string;
6422
+ member_id: string;
6423
+ is_new_member: boolean;
6424
+ email?: string;
6425
+ state?: string;
6426
+ }
6289
6427
  /**
6290
6428
  * 3rd-party 인앱 브라우저(카카오톡, 라인, 인스타그램, 페이스북 등) 감지
6291
6429
  * 구글은 이런 환경에서 OAuth를 차단(disallowed_useragent)하므로 별도 처리 필요
@@ -6313,6 +6451,10 @@ declare class OAuthAPI {
6313
6451
  * 발화하지 않도록 이 promise 를 공유한다 (이중 re-issue/rotation 방지).
6314
6452
  */
6315
6453
  private bootConsumePromise;
6454
+ /** 이 인스턴스가 `getCallbackResult()` 로 이미 적재한 콜백. 다시 불려도 토큰을 되돌리지 않는다. */
6455
+ private loadedCallback;
6456
+ /** 이 인스턴스가 이미 적재한 code 콜백. 다시 불려도 토큰을 되돌리지 않는다. */
6457
+ private loadedCodeCallback;
6316
6458
  constructor(http: HttpClient);
6317
6459
  /**
6318
6460
  * 활성화된 OAuth 프로바이더 목록 조회
@@ -6338,7 +6480,8 @@ declare class OAuthAPI {
6338
6480
  *
6339
6481
  * @param provider - OAuth 프로바이더 (google, naver, github, discord)
6340
6482
  * @param callbackUrl - OAuth 완료 후 리다이렉트될 앱의 URL
6341
- * @param state - 선택적 state 파라미터 (CSRF 방지 등)
6483
+ * @param state - 앱이 콜백까지 들고 가고 싶은 값(선택). `getCallbackResult()` 결과의 `state` 로 돌아온다.
6484
+ * 로그인 CSRF 방어는 SDK 가 별도의 일회용 값으로 항상 수행하므로 이 값이 없어도 안전하다.
6342
6485
  * @param options - `createIfNotExists: true` 면 미가입 사용자를 자동 가입시킨다([signUp] 과 동일 동작).
6343
6486
  *
6344
6487
  * @example
@@ -6371,6 +6514,28 @@ declare class OAuthAPI {
6371
6514
  */
6372
6515
  signUp(provider: OAuthProvider, callbackUrl: string, state?: string): Promise<void>;
6373
6516
  private startCentralOAuth;
6517
+ /**
6518
+ * 콜백에서 확인할 일회용 state 를 만들어 이 브라우저에 저장합니다.
6519
+ *
6520
+ * `signIn()` / `signUp()` 은 이미 내부에서 부르므로 호출할 필요가 없습니다. 인가 주소를 SDK 밖에서
6521
+ * 만드는 앱(`GET /v1/public/oauth/:provider/authorize/central` 직접 호출 등)만, 돌려받은 값을 `state`
6522
+ * 쿼리로 넘기세요. 이 값 없이 돌아온 콜백의 토큰은 남이 보낸 링크와 구분할 수 없어 거부됩니다.
6523
+ *
6524
+ * @param appState - 콜백까지 들고 갈 앱의 값(선택). 서버로 보내지 않고 `getCallbackResult()` 의 `state` 로 돌아옵니다.
6525
+ * @returns 인가 요청의 `state` 쿼리에 넣을 값
6526
+ * @throws 브라우저 저장소를 쓸 수 없을 때
6527
+ *
6528
+ * @example
6529
+ * ```typescript
6530
+ * const state = cb.oauth.createCallbackState()
6531
+ * const res = await fetch(`${API}/v1/public/oauth/google/authorize/central?app_callback=${callback}&state=${state}`, {
6532
+ * headers: { 'X-Public-Key': PUBLIC_KEY },
6533
+ * })
6534
+ * ```
6535
+ */
6536
+ createCallbackState(appState?: string): string;
6537
+ /** 콜백 주소가 다른 출처면 그쪽 저장소에는 state 가 없어 콜백에서 거부된다는 점을 시작할 때 알린다. */
6538
+ private createCallbackStateFor;
6374
6539
  /**
6375
6540
  * 소셜 로그인 (팝업 방식)
6376
6541
  * 팝업 창에서 소셜 로그인을 처리하고 결과를 Promise로 반환합니다.
@@ -6383,6 +6548,7 @@ declare class OAuthAPI {
6383
6548
  *
6384
6549
  * @param provider - OAuth 프로바이더
6385
6550
  * @param callbackUrl - (선택) OAuth 완료 후 리다이렉트될 팝업의 URL. 미지정 시 서버 제공 콜백 사용.
6551
+ * 지정한다면 이 메서드를 부르는 페이지와 같은 출처여야 합니다(콜백 페이지는 토큰을 같은 출처 창에만 넘깁니다).
6386
6552
  * @returns 로그인 결과
6387
6553
  *
6388
6554
  * @example
@@ -6398,6 +6564,23 @@ declare class OAuthAPI {
6398
6564
  signInWithPopup(provider: OAuthProvider, callbackUrl?: string, options?: {
6399
6565
  intent?: "signin" | "signup";
6400
6566
  }): Promise<OAuthCallbackResponse>;
6567
+ /**
6568
+ * 네이티브 브릿지가 돌려준 주소에서 로그인 결과를 만든다. code 면 교환하고, 토큰이면(response_type 을 모르는 옛 서버)
6569
+ * 그대로 쓴다.
6570
+ */
6571
+ private readBridgeResult;
6572
+ /**
6573
+ * 팝업 메시지를 보낼 수 있는 출처: 서버 제공 콜백 페이지(API 서버)와 앱이 지정한 콜백 페이지.
6574
+ *
6575
+ * 서버 제공 콜백의 출처는 `baseUrl` 과 다를 수 있어(`/cb-api` 패스스루) 서버가 정한 redirect_uri 도
6576
+ * 함께 본다. 인가 주소는 우리 API 응답이므로 믿을 수 있다.
6577
+ */
6578
+ private popupMessageOrigins;
6579
+ /**
6580
+ * 팝업 메시지에서 로그인 결과를 만든다. code 가 있으면 교환한다(opener_origin 을 보낸 요청의 기본 응답).
6581
+ * 토큰을 직접 싣는 메시지는 opener_origin 을 모르는 구버전 서버 호환이다.
6582
+ */
6583
+ private readPopupResult;
6401
6584
  /**
6402
6585
  * 콜백 URL에서 OAuth 결과 추출
6403
6586
  * 중앙 콜백 방식에서 리다이렉트 후 URL 파라미터에서 결과를 추출합니다.
@@ -6413,6 +6596,14 @@ declare class OAuthAPI {
6413
6596
  * 없는 상태로 `getMe()` 가 401 으로 떨어지는 회귀가 있었다 (platform-issue
6414
6597
  * 019e638d, 2026-05-26).
6415
6598
  *
6599
+ * 토큰은 이 브라우저에서 `signIn()` / `signUp()` 으로 시작한 로그인의 결과일 때만 받아들입니다. 확인되지
6600
+ * 않으면(남이 보낸 링크 등) 토큰을 적재하지 않고 `{ error: 'oauth_state_mismatch' }` 를 돌려줍니다.
6601
+ * 토큰은 SDK 가 생성될 때 주소에서 지우므로 `location.search` 로 직접 읽을 수 없습니다.
6602
+ *
6603
+ * `signIn()` 은 서버에 1회용 `code` 만 달라고 요청하므로(`response_type=code`) 콜백 주소에는 보통 `?code=&state=` 가 옵니다.
6604
+ * 이 메서드가 state 를 확인한 뒤 `POST /v1/auth/oauth/exchange` 로 교환하고 토큰을 저장합니다(결과 모양은 같다).
6605
+ * state 가 맞지 않는 code 는 교환하지 않고 `{ error: 'oauth_state_mismatch' }` 를 돌려줍니다.
6606
+ *
6416
6607
  * @returns OAuth 결과 (토큰, member_id 등) 또는 null
6417
6608
  *
6418
6609
  * @example
@@ -6437,37 +6628,51 @@ declare class OAuthAPI {
6437
6628
  state?: string;
6438
6629
  error?: string;
6439
6630
  } | null>;
6631
+ /**
6632
+ * 콜백 토큰을 이 인스턴스에 한 번만 적재한다. 앱이 `getCallbackResult()` 를 다시 불러도 그사이 회전된
6633
+ * 토큰을 콜백의 옛 토큰으로 되돌리지 않는다.
6634
+ */
6635
+ private loadCallbackOnce;
6636
+ /**
6637
+ * (SDK 내부용 — `ConnectBase` 생성자가 호출) 주소의 콜백을 회수해 지우고 그 종류를 알린다.
6638
+ *
6639
+ * 토큰 콜백은 state 와 opener 로 가른다. code 콜백은 이 브라우저에서 시작한 로그인(state 일치)일 때만 여기서
6640
+ * 회수한다 — 앱이 지정한 팝업 콜백 페이지의 code 와 앱 자체 OAuth 의 code 는 앱의 명시 호출에 맡긴다.
6641
+ *
6642
+ * @returns `redirect` 면 부팅 안전망 대상, `popup` 이면 팝업 콜백, `none` 이면 콜백이 아니거나 거부됨.
6643
+ */
6644
+ captureCallbackOnBoot(): "redirect" | "popup" | "none";
6440
6645
  /**
6441
6646
  * (SDK 내부용 — `ConnectBase` 생성자가 호출) 부팅 안전망.
6442
6647
  *
6443
6648
  * OAuth 리다이렉트 콜백 페이지에서 앱이 `getCallbackResult()` 를 호출하지 않아도,
6444
- * `new ConnectBase()` 만으로 URL 의 토큰(`?access_token=&refresh_token=&member_id=`)을
6445
- * 적재해 세션을 확립한다.
6649
+ * `new ConnectBase()` 만으로 이 브라우저에서 시작한 로그인의 결과(URL 의 토큰, 또는 state 가 맞는 1회용
6650
+ * `code` 의 교환 결과)를 적재해 세션을 확립한다.
6446
6651
  *
6447
6652
  * **왜 필요한가:** 정적 호스팅(웹 스토리지)은 SPA fallback 으로 `/auth/callback` 같은 콜백
6448
6653
  * 경로에 홈 `index.html` 을 서빙한다. 그 페이지가 콜백을 처리하지 않으면 URL 토큰이 영영
6449
6654
  * 소비되지 않아 "로그인 → 다시 로그인 페이지" 무한 루프가 발생한다 (여러 사용자 동시 보고).
6450
- * 이 안전망은 콜백 처리 코드를 빠뜨린 앱도 동작하게 한다.
6655
+ * 이 안전망은 콜백 처리 코드를 빠뜨린 앱도 동작하게 한다. `signIn()` 이 code 를 받으므로(`response_type=code`) code 도
6656
+ * 같은 이유로 여기서 교환한다.
6451
6657
  *
6452
6658
  * **token rotation race(2026-05-16) 가 없는 이유:** 사전 `re-issue`(cookie 복구) 없이 URL
6453
- * 토큰을 *직접* 소비한다 — `getCallbackResult()` 의 리다이렉트 경로와 동일한 동작이다. 팝업
6454
- * (`window.opener` 존재)은 `ConnectBase` 생성자에서 제외되어 호출되지 않는다 (팝업 콜백은
6455
- * `getCallbackResult()` 의 postMessage 경로 전담). code-only(`?code=`)·에러(`?error=`)
6456
- * 콜백도 생성자에서 제외된다 (네트워크 교환/에러 분기는 앱이 명시 호출).
6659
+ * 토큰을 *직접* 소비한다 — `getCallbackResult()` 의 리다이렉트 경로와 동일한 동작이다. 팝업 콜백과
6660
+ * 거부된 콜백(`captureCallbackOnBoot()` 참고)은 생성자에서 제외되어 호출되지 않는다. 에러(`?error=`) 콜백과
6661
+ * state 가 맞지 않는 code 도 생성자에서 제외된다 (에러 분기, 앱 자체 OAuth 는 앱이 명시 호출).
6457
6662
  *
6458
6663
  * @returns 토큰 적재 성공 시 true, no-op(토큰 없음 등)이면 false.
6459
6664
  */
6460
6665
  consumeRedirectCallbackOnBoot(): Promise<boolean>;
6461
6666
  private doConsumeRedirectOnBoot;
6462
6667
  /**
6463
- * 콜백 URL 에서 1회용 `code` 를 토큰으로 교환합니다 (`OAUTH_CODE_ONLY` 서버 모드용).
6668
+ * 콜백 URL 의 1회용 `code` 를 토큰으로 교환합니다.
6464
6669
  *
6465
- * 서버가 `OAUTH_CODE_ONLY=true` 모드면 리다이렉트 URL 에 토큰 대신 `code` 만 포함됩니다.
6466
- * 이 메서드는 code 를 `POST /v1/auth/oauth/exchange` 로 교환하고 토큰을 자동 저장합니다.
6670
+ * 이제 `getCallbackResult()` 와 부팅 안전망이 code 도 처리하므로 따로 부를 필요가 없습니다. 이미 이
6671
+ * 메서드를 부르는 앱(`exchangeCodeFromCallback() ?? getCallbackResult()`)은 그대로 동작하고, 같은 code 를 두 번
6672
+ * 교환하지 않습니다.
6467
6673
  *
6468
- * 권장 호출 순서:
6469
- * 1) `cb.oauth.exchangeCodeFromCallback()` 먼저 — code-only 모드면 성공
6470
- * 2) null 반환 시 `cb.oauth.getCallbackResult()` 폴백 (legacy 토큰-in-URL 모드)
6674
+ * `getCallbackResult()` 와 같은 이유로, 이 브라우저에서 시작한 로그인의 `code` 만 교환합니다. 확인되지
6675
+ * 않으면 `oauth_state_mismatch` 오류를 던지고 교환하지 않습니다.
6471
6676
  *
6472
6677
  * @example
6473
6678
  * ```typescript
@@ -6475,14 +6680,12 @@ declare class OAuthAPI {
6475
6680
  * ?? cb.oauth.getCallbackResult()
6476
6681
  * ```
6477
6682
  */
6478
- exchangeCodeFromCallback(): Promise<{
6479
- access_token: string;
6480
- refresh_token: string;
6481
- member_id: string;
6482
- is_new_member: boolean;
6483
- email?: string;
6484
- state?: string;
6485
- } | null>;
6683
+ exchangeCodeFromCallback(): Promise<ExchangedCallbackResult | null>;
6684
+ /**
6685
+ * 회수한 code 콜백을 마무리한다. code 는 한 번만 교환하고(한 페이지의 인스턴스가 여럿이어도), 리다이렉트면 이
6686
+ * 인스턴스에 토큰을 한 번만 적재하고 쿠키를 부트스트랩한다. 팝업이면 같은 출처 opener 에게 넘기고 창을 닫는다.
6687
+ */
6688
+ private completeCodeCallback;
6486
6689
  }
6487
6690
 
6488
6691
  /**
@@ -6785,7 +6988,17 @@ type PaymentProvider = "toss" | "stripe" | "payapp" | "paypal" | "paddle" | "dod
6785
6988
  */
6786
6989
  type PaymentMode = "test" | "live";
6787
6990
  type PaymentStatus = "pending" | "ready" | "in_progress" | "done" | "canceled" | "partial_canceled" | "aborted" | "expired" | "failed";
6788
- interface PreparePaymentRequest {
6991
+ /**
6992
+ * `prepare()` 의 두 형태에 공통인 옵션.
6993
+ *
6994
+ * 금액을 정하는 방법은 둘 중 하나다:
6995
+ * - {@link PreparePaymentWithProduct} — 가격표의 `product_id`(와 `quantity`)만 보낸다. 금액, 통화, 상품명은
6996
+ * **서버가 콘솔 가격표에서 정한다.** 브라우저에서 부르는 결제는 이 형태를 쓴다.
6997
+ * - {@link PreparePaymentWithAmount} — `amount` 와 `order_name` 을 직접 보낸다(레거시, KRW). 결제 설정의 금액
6998
+ * 출처가 `client` 인 앱이거나, 서버에서 시크릿 키(`cb_sk_`)나 service_role 함수로 부를 때만 받는다. 가격표
6999
+ * 전용 앱(`catalog`, 새 앱의 기본값)에서 브라우저가 금액을 보내면 403 `client_amount_not_allowed` 다.
7000
+ */
7001
+ interface PreparePaymentOptions {
6789
7002
  payment_provider?: PaymentProvider;
6790
7003
  /**
6791
7004
  * 사용할 자격증명 모드 오버라이드(선택).
@@ -6850,19 +7063,51 @@ interface PreparePaymentRequest {
6850
7063
  * (미지정 시 결제 설정의 fail_url).
6851
7064
  */
6852
7065
  fail_url?: string;
6853
- amount: number;
6854
- order_name: string;
6855
7066
  order_id?: string;
6856
7067
  customer_email?: string;
6857
7068
  customer_name?: string;
6858
7069
  customer_phone?: string;
7070
+ /**
7071
+ * 앱이 정하는 부가 데이터. **클라이언트가 보낸 값이라 권한 지급의 근거로 쓰지 않는다** — 무엇을 샀는지는 결제
7072
+ * 기록의 `product_id`/`quantity` 를 본다.
7073
+ */
6859
7074
  metadata?: Record<string, unknown>;
6860
7075
  }
7076
+ /** 가격표 결제 — 서버가 `단가 x 수량` 과 통화를 정한다. */
7077
+ interface PreparePaymentWithProduct extends PreparePaymentOptions {
7078
+ /** 콘솔 가격표의 상품 ID (예: `gem_100`). 없거나 판매를 멈춘 상품이면 404 / 409. */
7079
+ product_id: string;
7080
+ /** 수량 (1~1000, 기본 1). 결제 금액 = 단가 x 수량. */
7081
+ quantity?: number;
7082
+ /** 가격표 결제에는 보낼 수 없다(400 `product_with_amount_fields`). */
7083
+ amount?: never;
7084
+ /** 가격표 결제의 상품명은 가격표에서 정한다(400 `product_with_amount_fields`). */
7085
+ order_name?: never;
7086
+ }
7087
+ /**
7088
+ * 금액 직접 지정(레거시) — 금액은 KRW 원 단위, 최소 100.
7089
+ *
7090
+ * 브라우저 사용자가 금액을 고칠 수 있으므로, 금액 출처가 `client` 인 앱이거나 서버 호출(시크릿 키, service_role
7091
+ * 함수)에서만 쓴다.
7092
+ */
7093
+ interface PreparePaymentWithAmount extends PreparePaymentOptions {
7094
+ amount: number;
7095
+ order_name: string;
7096
+ product_id?: never;
7097
+ quantity?: never;
7098
+ }
7099
+ type PreparePaymentRequest = PreparePaymentWithProduct | PreparePaymentWithAmount;
6861
7100
  interface PreparePaymentResponse {
6862
7101
  payment_id: string;
6863
7102
  order_id: string;
7103
+ /** 서버가 정한 결제 금액(`currency` 의 최소 단위). 결제창에는 이 값을 그대로 넘긴다. */
6864
7104
  amount: number;
7105
+ /** `amount` 의 통화 (ISO 4217). 가격표 상품이면 상품의 통화다. */
7106
+ currency: string;
6865
7107
  order_name: string;
7108
+ /** 가격표 결제면 상품 ID 와 수량. */
7109
+ product_id?: string;
7110
+ quantity?: number;
6866
7111
  payment_provider: PaymentProvider;
6867
7112
  /** 이 결제가 사용한 자격증명 모드. */
6868
7113
  payment_mode: PaymentMode;
@@ -6882,15 +7127,12 @@ interface PreparePaymentResponse {
6882
7127
  checkout_url?: string;
6883
7128
  launch_mode?: "overlay" | "redirect";
6884
7129
  }
6885
- interface CreateCheckoutSessionRequest {
7130
+ interface CreateCheckoutSessionOptions {
6886
7131
  /**
6887
7132
  * 사용할 자격증명 모드 오버라이드(선택). `prepare()` 의 `payment_mode` 와 적용 조건이 같다 —
6888
7133
  * 서버 시크릿 키(`cb_sk_*`) 호출에서만 적용되고, 브라우저 공개 키 호출에서는 무시된다.
6889
7134
  */
6890
7135
  payment_mode?: PaymentMode;
6891
- amount: number;
6892
- currency: string;
6893
- product_name: string;
6894
7136
  success_url: string;
6895
7137
  cancel_url: string;
6896
7138
  order_id?: string;
@@ -6898,11 +7140,31 @@ interface CreateCheckoutSessionRequest {
6898
7140
  customer_name?: string;
6899
7141
  metadata?: Record<string, unknown>;
6900
7142
  }
7143
+ /** 가격표 결제 — 금액, 통화, 상품명은 서버가 가격표에서 정한다. */
7144
+ interface CreateCheckoutSessionWithProduct extends CreateCheckoutSessionOptions {
7145
+ product_id: string;
7146
+ /** 수량 (1~1000, 기본 1) */
7147
+ quantity?: number;
7148
+ amount?: never;
7149
+ currency?: never;
7150
+ product_name?: never;
7151
+ }
7152
+ /** 금액 직접 지정(레거시). 받는 조건은 `prepare()` 의 금액 형태와 같다. */
7153
+ interface CreateCheckoutSessionWithAmount extends CreateCheckoutSessionOptions {
7154
+ amount: number;
7155
+ currency: string;
7156
+ product_name: string;
7157
+ product_id?: never;
7158
+ quantity?: never;
7159
+ }
7160
+ type CreateCheckoutSessionRequest = CreateCheckoutSessionWithProduct | CreateCheckoutSessionWithAmount;
6901
7161
  interface CreateCheckoutSessionResponse {
6902
7162
  payment_id: string;
6903
7163
  order_id: string;
6904
7164
  amount: number;
6905
7165
  currency: string;
7166
+ product_id?: string;
7167
+ quantity?: number;
6906
7168
  session_id: string;
6907
7169
  session_url: string;
6908
7170
  }
@@ -6919,6 +7181,8 @@ interface ConfirmPaymentResponse {
6919
7181
  order_id: string;
6920
7182
  /** **실제 청구된** 금액. 할인이 적용되면 준비 금액보다 작다. */
6921
7183
  amount: number;
7184
+ /** `amount` 의 통화 (ISO 4217). 가격표 상품은 KRW 가 아닐 수 있다. */
7185
+ currency?: string;
6922
7186
  /** 할인으로 차감된 금액(준비 금액 − 실제 청구액). 할인이 없으면 생략된다. */
6923
7187
  discount_amount?: number;
6924
7188
  status: PaymentStatus;
@@ -6946,6 +7210,12 @@ interface PaymentDetail {
6946
7210
  amount: number;
6947
7211
  /** `amount` 의 통화 (ISO 4217) */
6948
7212
  currency: string;
7213
+ /**
7214
+ * 가격표로 준비한 결제의 상품 ID 와 수량. 서버가 정한 값이라 **권한 지급의 근거로 쓴다**
7215
+ * (`metadata` 는 클라이언트가 보낸 값이다). 금액을 직접 지정한 결제는 비어 있다.
7216
+ */
7217
+ product_id?: string;
7218
+ quantity?: number;
6949
7219
  /**
6950
7220
  * 정산통화 환산액 (MoR 프로바이더가 제공할 때만).
6951
7221
  *
@@ -7006,6 +7276,9 @@ interface PaymentListItem {
7006
7276
  amount: number;
7007
7277
  /** `amount` 의 통화 (ISO 4217). 다통화 결제에서 앱 기본 통화를 가정하면 거짓 금액이 된다 */
7008
7278
  currency: string;
7279
+ /** 가격표 결제의 상품 ID 와 수량 (금액을 직접 지정한 결제는 비어 있다). */
7280
+ product_id?: string;
7281
+ quantity?: number;
7009
7282
  status: PaymentStatus;
7010
7283
  method?: string;
7011
7284
  /** toss | stripe 등 */
@@ -7032,19 +7305,26 @@ declare class PaymentAPI {
7032
7305
  private getPublicPrefix;
7033
7306
  /**
7034
7307
  * 결제 준비
7035
- * 토스 결제 위젯에 필요한 정보를 반환합니다.
7308
+ * 결제창(토스 위젯, Stripe Elements, 호스티드 결제 페이지)에 필요한 정보를 반환합니다.
7309
+ *
7310
+ * **금액은 서버가 정합니다.** 브라우저에서는 콘솔 가격표의 `product_id`(와 `quantity`)만 보내고, 서버가
7311
+ * `단가 x 수량` 과 통화를 계산합니다. 사용자가 개발자 도구로 요청을 고쳐도 가격을 바꿀 수 없습니다.
7312
+ * `amount` 를 직접 보내는 형태(레거시)는 결제 설정의 금액 출처가 `client` 인 앱이거나, 서버에서
7313
+ * 시크릿 키(`cb_sk_`)나 service_role 함수로 부를 때만 받습니다.
7036
7314
  *
7037
- * @param data - 결제 준비 정보 (금액, 상품명, 고객 정보 등)
7038
- * @returns 토스 클라이언트 키, 고객 키, 성공/실패 URL 등
7315
+ * @param data - 가격표 상품(`product_id`, `quantity`) 또는 금액(`amount`, `order_name`), 고객 정보 등
7316
+ * @returns 서버가 정한 금액과 통화, 토스 클라이언트 키, 고객 키, 성공/실패 URL 등
7039
7317
  *
7040
7318
  * @example
7041
7319
  * ```typescript
7320
+ * // 가격표 결제 (권장) — 무엇을 몇 개 살지만 보낸다.
7042
7321
  * const result = await cb.payment.prepare({
7043
- * amount: 10000,
7044
- * order_name: '프리미엄 1개월',
7322
+ * product_id: 'gem_100',
7323
+ * quantity: 2,
7045
7324
  * customer_email: 'test@example.com',
7046
7325
  * customer_name: '홍길동'
7047
7326
  * })
7327
+ * // result.amount, result.currency 는 서버가 가격표로 계산한 값이다(단가 x 수량).
7048
7328
  *
7049
7329
  * // Toss V2 결제 플로우
7050
7330
  * if (result.payment_provider === 'toss') {
@@ -7052,7 +7332,7 @@ declare class PaymentAPI {
7052
7332
  * const payment = tossPayments.payment({ customerKey: result.customer_key })
7053
7333
  * await payment.requestPayment({
7054
7334
  * method: 'CARD',
7055
- * amount: { currency: 'KRW', value: result.amount },
7335
+ * amount: { currency: result.currency, value: result.amount },
7056
7336
  * orderId: result.order_id,
7057
7337
  * orderName: result.order_name,
7058
7338
  * successUrl: result.success_url,
@@ -7076,8 +7356,7 @@ declare class PaymentAPI {
7076
7356
  *
7077
7357
  * // 할인 코드 (MoR: dodo/paddle) — PG 대시보드에서 발행한 코드를 그대로 넘긴다.
7078
7358
  * const discounted = await cb.payment.prepare({
7079
- * amount: 10000,
7080
- * order_name: '프리미엄 1개월',
7359
+ * product_id: 'premium_month',
7081
7360
  * discount_code: 'LAUNCH50', // 미리 적용
7082
7361
  * allow_discount_code: true, // 결제창에서 고객이 직접 입력하는 것도 허용 (Dodo)
7083
7362
  * })
@@ -7086,14 +7365,26 @@ declare class PaymentAPI {
7086
7365
  *
7087
7366
  * // 복귀 주소 — 배포마다 자기 호스트로 돌아오게 한다 (QA 가 라이브로 튕기지 않도록)
7088
7367
  * const withReturn = await cb.payment.prepare({
7089
- * amount: 14900,
7090
- * order_name: '프리미엄 1개월',
7368
+ * product_id: 'premium_month',
7091
7369
  * return_url: `${window.location.origin}/app/premium?paid=1`,
7092
7370
  * fail_url: `${window.location.origin}/app/premium?failed=1`,
7093
7371
  * })
7372
+ *
7373
+ * // 금액 직접 지정 (레거시) — 금액 출처가 client 인 앱, 또는 서버(시크릿 키, service_role 함수) 호출에서만 받는다.
7374
+ * // 가격표 전용 앱에서 브라우저가 보내면 403 client_amount_not_allowed.
7375
+ * const legacy = await cb.payment.prepare({
7376
+ * amount: 10000,
7377
+ * order_name: '프리미엄 1개월',
7378
+ * })
7094
7379
  * ```
7095
7380
  *
7096
7381
  * @remarks
7382
+ * 권한(아이템, 기간권)은 결제가 끝난 뒤 결제 기록의 `product_id`/`quantity` 로 지급합니다. `metadata` 는
7383
+ * 클라이언트가 보낸 값이라 근거로 쓰지 않습니다. 가격표 오류는 사유별 코드로 옵니다: 없는 상품 404
7384
+ * `payment_product_not_found`, 판매 중지 409 `payment_product_inactive`, `product_id` 와 `amount`/`order_name`
7385
+ * 을 섞음 400 `product_with_amount_fields`, 프로바이더가 받지 못하는 통화 400 `currency_not_supported`
7386
+ * (toss, payapp 은 KRW 상품만).
7387
+ *
7097
7388
  * PayApp 은 `customer_phone` 이 필수입니다(결제요청 수신 번호). 미지정 시 서버가 거부합니다.
7098
7389
  *
7099
7390
  * 할인 코드는 MoR 프로바이더(dodo/paddle)에서만 지원됩니다. 그 외 프로바이더에 넘기면
@@ -7112,15 +7403,16 @@ declare class PaymentAPI {
7112
7403
  * 응답에 `session_url` 이 포함되며, 브라우저를 해당 URL 로 이동시키면 Stripe 가 카드 입력·결제를 처리한 뒤
7113
7404
  * `success_url` / `cancel_url` 로 복귀한다. `client_secret` 은 서버·클라이언트 어디에도 노출되지 않는다.
7114
7405
  *
7115
- * @param data - 결제 세션 정보 (금액, 통화, 상품명, success/cancel URL 등)
7406
+ * 금액을 정하는 규칙은 `prepare()` 와 같다 — 브라우저에서는 가격표의 `product_id` 를 보내고, 금액, 통화,
7407
+ * 상품명을 직접 보내는 형태는 금액 출처가 `client` 인 앱이나 서버 호출에서만 받는다.
7408
+ *
7409
+ * @param data - 가격표 상품(`product_id`, `quantity`) 또는 금액(`amount`, `currency`, `product_name`), success/cancel URL 등
7116
7410
  * @returns session_id, session_url (redirect 대상)
7117
7411
  *
7118
7412
  * @example
7119
7413
  * ```typescript
7120
7414
  * const sess = await client.payment.createCheckoutSession({
7121
- * amount: 1000,
7122
- * currency: 'USD',
7123
- * product_name: 'Premium Subscription',
7415
+ * product_id: 'premium_month',
7124
7416
  * success_url: 'https://app.example.com/success?session_id={CHECKOUT_SESSION_ID}',
7125
7417
  * cancel_url: 'https://app.example.com/cancel',
7126
7418
  * customer_email: 'user@example.com',
@@ -7155,6 +7447,9 @@ declare class PaymentAPI {
7155
7447
  * 결제 취소
7156
7448
  * 완료된 결제를 취소합니다. 부분 취소도 가능합니다.
7157
7449
  *
7450
+ * **서버 전용.** 환불은 돈이 나가는 동작이라 `secretKey`(`cb_sk_*`, `app:update` 권한)가 필요합니다.
7451
+ * 브라우저에서 Public Key 만으로 호출하면 401 `SECRET_KEY_REQUIRED` 입니다.
7452
+ *
7158
7453
  * @param paymentId - 결제 ID (Connect Base에서 발급한 ID)
7159
7454
  * @param data - 취소 정보 (사유, 부분 취소 금액)
7160
7455
  * @returns 취소된 결제 정보
@@ -7178,6 +7473,10 @@ declare class PaymentAPI {
7178
7473
  * 주문 ID로 결제 조회
7179
7474
  * 특정 주문의 결제 상태를 조회합니다.
7180
7475
  *
7476
+ * Public Key 만으로 호출하면 상태와 금액만 돌려줍니다. `customer_email`, `customer_name`, `customer_id`, `receipt_url`,
7477
+ * `metadata`, `country`, `settlement_*`, `cancel_reason` 은 그 결제의 회원 본인(로그인 상태), `secretKey`(`app:read` 권한),
7478
+ * 또는 `payment:read` 스코프의 service_role 함수에만 옵니다.
7479
+ *
7181
7480
  * @param orderId - 주문 ID
7182
7481
  * @returns 결제 상세 정보
7183
7482
  *
@@ -8105,7 +8404,13 @@ interface RealtimeConnectOptions {
8105
8404
  retryInterval?: number;
8106
8405
  /** 사용자 ID (인증된 사용자) */
8107
8406
  userId?: string;
8108
- /** JWT 액세스 토큰 (앱 멤버 인증용, API Key보다 우선) */
8407
+ /**
8408
+ * JWT 액세스 토큰 (앱 멤버 인증용, API Key보다 우선).
8409
+ *
8410
+ * 이 토큰이 SDK 가 로그인으로 들고 있는 멤버 세션(같은 앱, 같은 멤버)의 것이면, 연결은 만료 전에 SDK 세션으로 새 토큰을
8411
+ * 받아 연결 위에서 바꾼다(`auth_refresh`) — 한 시간마다 끊기지 않는다. 재연결도 새 토큰을 쓴다. 다른 곳에서 받은 토큰이면
8412
+ * 갱신하지 않고 예전처럼 동작한다(서버가 만료 뒤 24시간에 닫는다).
8413
+ */
8109
8414
  accessToken?: string;
8110
8415
  /** 연결 타임아웃 (밀리초, 기본: 30000) */
8111
8416
  timeout?: number;
@@ -8169,14 +8474,14 @@ interface Subscription {
8169
8474
  /** 클라이언트 -> 서버 메시지 */
8170
8475
  interface ClientMessage {
8171
8476
  category: string;
8172
- action: "subscribe" | "unsubscribe" | "send" | "invoke" | "ping" | "history" | "stream" | "stream_stop" | "mark_read" | "presence_set" | "presence_on_disconnect" | "presence_get" | "presence_get_many" | "presence_subscribe" | "presence_unsubscribe" | "typing_start" | "typing_stop" | "typing_subscribe" | "typing_unsubscribe";
8477
+ action: "subscribe" | "unsubscribe" | "send" | "invoke" | "ping" | "history" | "stream" | "stream_stop" | "mark_read" | "presence_set" | "presence_on_disconnect" | "presence_get" | "presence_get_many" | "presence_subscribe" | "presence_unsubscribe" | "typing_start" | "typing_stop" | "typing_subscribe" | "typing_unsubscribe" | "auth_refresh";
8173
8478
  data?: unknown;
8174
8479
  request_id: string;
8175
8480
  }
8176
8481
  /** 서버 -> 클라이언트 메시지 */
8177
8482
  interface ServerMessage<T = unknown> {
8178
8483
  category?: string;
8179
- event: "connected" | "subscribed" | "unsubscribed" | "message" | "sent" | "result" | "error" | "pong" | "history" | "stream_token" | "stream_done" | "stream_error" | "stream_tool_call" | "stream_tool_result" | "read_receipt" | "presence" | "presence_status" | "typing";
8484
+ event: "connected" | "subscribed" | "unsubscribed" | "message" | "sent" | "result" | "error" | "pong" | "history" | "stream_token" | "stream_done" | "stream_error" | "stream_tool_call" | "stream_tool_result" | "read_receipt" | "presence" | "presence_status" | "typing" | "token_expiring" | "token_expired" | "token_refreshed";
8180
8485
  data?: T;
8181
8486
  request_id?: string;
8182
8487
  error?: string;
@@ -8278,6 +8583,8 @@ interface ConnectedData {
8278
8583
  app_id: string;
8279
8584
  client_id: string;
8280
8585
  user_id?: string;
8586
+ /** 멤버 토큰의 만료 시각(Unix 초). accessToken 연결에만 있다. */
8587
+ token_expires_at?: number;
8281
8588
  }
8282
8589
  /** 구독 성공 데이터 */
8283
8590
  interface SubscribedData {
@@ -8393,6 +8700,17 @@ declare class RealtimeAPI {
8393
8700
  private readReceiptHandlers;
8394
8701
  constructor(http: HttpClient, socketUrl: string);
8395
8702
  private connectPromise;
8703
+ /**
8704
+ * 이 연결이 `token_refresh=1` 로 협상했는지 — 연결 토큰이 SDK 세션(HttpClient)의 멤버 토큰이라 연결 위에서 갱신할 수
8705
+ * 있을 때만 협상한다. 협상한 연결에만 서버가 만료 안내를 보내고, 협상하지 않은 연결은 예전처럼 만료 뒤 24시간에 닫힌다.
8706
+ */
8707
+ private tokenRefreshNegotiated;
8708
+ /** 진행 중인 auth_refresh — 같은 순간에 두 번 보내지 않는다. */
8709
+ private authRefreshInFlight;
8710
+ /** 갱신이 실패했을 때 다시 해 보는 타이머. */
8711
+ private authRefreshRetryTimer;
8712
+ /** 서버가 닫기 직전에 보낸 안내(TOKEN_EXPIRED, MEMBER_REVOKED) 문구 — 이어지는 4401/4403 close 오류의 메시지가 된다. */
8713
+ private closeNotice;
8396
8714
  /**
8397
8715
  * WebSocket 연결
8398
8716
  * @param options 연결 옵션
@@ -8710,6 +9028,20 @@ declare class RealtimeAPI {
8710
9028
  */
8711
9029
  private connectWithRetry;
8712
9030
  private doConnect;
9031
+ /**
9032
+ * 연결(재연결)에 쓸 토큰을 준비한다 — SDK 세션의 멤버 토큰인데 곧(1분 안) 만료되면 붙기 전에 새로 받는다. 만료된 토큰으로
9033
+ * 붙으면 서버가 거부해 재연결이 멈춘다. 앱이 다른 곳에서 받은 토큰은 건드리지 않는다(예전과 같다).
9034
+ */
9035
+ private prepareConnectToken;
9036
+ /**
9037
+ * 연결을 끊지 않고 멤버 토큰을 바꾼다(`auth_refresh`). 새 토큰은 HTTP 요청과 같은 refresh 로 받는다
9038
+ * (`HttpClient.freshTokenForMember` — 같은 single-flight, 같은 실패 처리). 한 번에 하나만 보내고, 성공하면 재연결도 새
9039
+ * 토큰을 쓴다. 실패하면(세션 일시 장애) 30초 뒤 다시 해 본다 — 서버는 만료 뒤 유예(기본 5분)가 지나야 4401 로 닫는다.
9040
+ * SDK 세션 자체가 끝났으면(로그아웃, refresh 거부) 더 시도하지 않는다.
9041
+ */
9042
+ private refreshConnectionAuth;
9043
+ private scheduleAuthRefreshRetry;
9044
+ private clearAuthRefreshRetry;
8713
9045
  private log;
8714
9046
  /**
8715
9047
  * 에러 로그. `options.debug` 가 true 일 때만 console 에 출력.
@@ -11288,9 +11620,14 @@ type WebRTCConnectionState = "disconnected" | "connecting" | "connected" | "reco
11288
11620
  interface WebRTCConnectOptions {
11289
11621
  /** 룸 ID (channel:room 형식 권장) */
11290
11622
  roomId: string;
11291
- /** 사용자 ID (선택) */
11623
+ /**
11624
+ * SDK 로컬 값이다. 서버는 쓰지 않는다 — 참가자의 `user_id` 는 로그인 멤버 ID, 익명 연결은 빈 문자열이다.
11625
+ */
11292
11626
  userId?: string;
11293
- /** 방송자 여부 (broadcast 모드에서 사용) */
11627
+ /**
11628
+ * broadcast 채널의 방송자 요청. 실제 역할은 서버가 정한다 — 로그인 멤버(accessToken) 연결만 방송자가 되고,
11629
+ * 익명(공개 키) 연결은 시청자로 참가한다. 미디어 송수신은 이 값과 무관하게 된다.
11630
+ */
11294
11631
  isBroadcaster?: boolean;
11295
11632
  /** 로컬 미디어 스트림 */
11296
11633
  localStream?: MediaStream;
@@ -11318,7 +11655,7 @@ interface RoomInfo {
11318
11655
  peers: PeerInfo[];
11319
11656
  }
11320
11657
  /** 시그널링 메시지 타입 */
11321
- type SignalingMessageType = "join" | "joined" | "leave" | "offer" | "answer" | "ice_candidate" | "peer_joined" | "peer_left" | "error";
11658
+ type SignalingMessageType = "join" | "joined" | "warning" | "leave" | "offer" | "answer" | "ice_candidate" | "peer_joined" | "peer_left" | "error";
11322
11659
  /** 시그널링 메시지 */
11323
11660
  interface SignalingMessage {
11324
11661
  type: SignalingMessageType;
@@ -11391,16 +11728,22 @@ interface ValidateResponse {
11391
11728
  /** 참가 요청 */
11392
11729
  interface JoinRoomRequest {
11393
11730
  room_id: string;
11394
- user_id?: string;
11731
+ /** 방송자 요청. 서버가 정한다(`JoinRoomResponse.is_broadcaster`). */
11395
11732
  is_broadcaster?: boolean;
11396
11733
  }
11397
- /** 참가 응답 */
11734
+ /** 참가 응답 (`POST /rooms/join`) */
11398
11735
  interface JoinRoomResponse {
11399
11736
  peer_id: string;
11400
- room_id: string;
11401
- channel_name: string;
11402
- channel_type: WebRTCMode;
11737
+ /** 이 피어의 소유 증명. offer / ice-candidate / leave 에 함께 보낸다. */
11738
+ peer_token: string;
11403
11739
  peers: PeerInfo[];
11740
+ /** 서버가 정한 역할 */
11741
+ is_broadcaster: boolean;
11742
+ /** 참가는 됐지만 요청대로 되지 않은 사항 (예: `broadcaster_requires_auth`) */
11743
+ warning?: {
11744
+ code: string;
11745
+ message: string;
11746
+ };
11404
11747
  }
11405
11748
 
11406
11749
  /**
@@ -12050,22 +12393,14 @@ declare class ConnectBase {
12050
12393
  readonly support: SupportAPI;
12051
12394
  constructor(config?: ConnectBaseConfig);
12052
12395
  /**
12053
- * 현재 페이지가 OAuth 리다이렉트 콜백 페이지인지 판별.
12396
+ * 현재 페이지가 앱이 직접 처리할 OAuth 콜백 페이지인지 판별.
12054
12397
  *
12055
- * `?access_token=...&refresh_token=...` (legacy 토큰-in-URL 흐름) 또는
12056
- * `?code=...` (OAUTH_CODE_ONLY 흐름) 또는 OAuth 에러 응답 (`?error=...&state=...`)
12057
- * 패턴이면 true. 콜백 페이지에서 일반 `autoRestoreSession` 을 건너뛰어 rotation race 를 피한다.
12398
+ * `?code=...&state=...` 또는 OAuth 에러 응답 (`?error=...&state=...`) 패턴이면 true.
12399
+ * 콜백 페이지에서 일반 `autoRestoreSession` 을 건너뛰어 rotation race 를 피한다. 토큰 콜백과 이
12400
+ * 브라우저의 state 가 돌아온 code 콜백은 이미 주소에서 회수됐으므로 여기 오지 않는다
12401
+ * (`oauth.captureCallbackOnBoot`).
12058
12402
  */
12059
12403
  private isOAuthCallbackUrl;
12060
- /**
12061
- * 현재 페이지가 토큰-in-URL OAuth 리다이렉트 콜백(팝업 아님)인지 판별.
12062
- *
12063
- * `?access_token=&refresh_token=` 이 있고 `window.opener` 가 없으면 true — 부팅 안전망
12064
- * (`oauth.consumeRedirectCallbackOnBoot`)으로 토큰을 자동 소비할 대상이다. 팝업 콜백
12065
- * (`window.opener` 존재)은 `getCallbackResult()` 의 postMessage 경로가 전담하므로 제외한다.
12066
- * code-only(`?code=`)·에러(`?error=`) 콜백도 제외(네트워크 교환/에러 분기는 앱이 명시 호출).
12067
- */
12068
- private isOAuthRedirectCallbackUrl;
12069
12404
  /**
12070
12405
  * 새로고침/탭 재개 후 cookie 만으로 세션을 복원한다 (브라우저 전용).
12071
12406
  *
@@ -12089,4 +12424,4 @@ declare class ConnectBase {
12089
12424
  updateConfig(config: Partial<ConnectBaseConfig>): void;
12090
12425
  }
12091
12426
 
12092
- export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AcceptInvitationResponse, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateLobbyRequest, type CreateOrganizationRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTopicOptions, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteBillingKeyResponse, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberChangePasswordRequest, type MemberCredentialMessageResponse, type MemberEmailVerificationConfirmRequest, type MemberEmailVerificationConfirmResponse, type MemberEmailVerificationRequest, type MemberInfoResponse, type MemberPasswordResetConfirmRequest, type MemberPasswordResetRequest, type MemberRedirectOption, type MemberSession, type MemberSessionList, type MemberSessionRevokeResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type Organization, type OrganizationContext, type OrganizationInvitation, type OrganizationMember, type OrganizationMemberList, type OrganizationRole, OrganizationsAPI, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type PushTopicInfo, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, RealtimeConnectionError, type RealtimeConnectionErrorCode, type RealtimeMessage, RealtimeRequestError, type RealtimeSendPolicy, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type RotatePublicKeyRequest, type RotatePublicKeyResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SyncLostMessage, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdateOrganizationRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageAccessLevel, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
12427
+ export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AcceptInvitationResponse, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionOptions, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateCheckoutSessionWithAmount, type CreateCheckoutSessionWithProduct, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateLobbyRequest, type CreateOrganizationRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTopicOptions, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteBillingKeyResponse, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberChangePasswordRequest, type MemberCredentialMessageResponse, type MemberEmailVerificationConfirmRequest, type MemberEmailVerificationConfirmResponse, type MemberEmailVerificationRequest, type MemberInfoResponse, type MemberPasswordResetConfirmRequest, type MemberPasswordResetRequest, type MemberRedirectOption, type MemberSession, type MemberSessionList, type MemberSessionRevokeResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type Organization, type OrganizationContext, type OrganizationInvitation, type OrganizationMember, type OrganizationMemberList, type OrganizationRole, OrganizationsAPI, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentOptions, type PreparePaymentRequest, type PreparePaymentResponse, type PreparePaymentWithAmount, type PreparePaymentWithProduct, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type PushTopicInfo, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, RealtimeConnectionError, type RealtimeConnectionErrorCode, type RealtimeMessage, RealtimeRequestError, type RealtimeSendPolicy, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type RotatePublicKeyRequest, type RotatePublicKeyResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SuspendAppMemberOptions, type SuspendAppMemberResult, type SyncLostMessage, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UnsuspendAppMemberResult, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdateOrganizationRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageAccessLevel, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };