@sayren/store-sdk 0.23.0 → 0.28.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.mjs CHANGED
@@ -1,32 +1,5 @@
1
1
  import { a as WEBHOOK_HEADERS, i as WEBHOOK_EVENT_TYPE_HEADER, n as WEBHOOK_DELIVERY_ID_HEADER, o as WEBHOOK_SIGNATURE_HEADER, r as WEBHOOK_EVENT_ID_HEADER, s as WEBHOOK_USER_AGENT, t as WEBHOOK_DEFAULT_TOLERANCE_SEC } from "./webhook-headers-ap_exsb9.mjs";
2
2
  import { z } from "zod";
3
- //#region src/base64.ts
4
- /**
5
- * base64 인코딩 헬퍼 — 웹 표준(`btoa` + `TextEncoder`)만 사용한다.
6
- *
7
- * 이 패키지는 브라우저/서버 공용 entrypoint 하나로 배포되므로 Node 전용 `Buffer`에
8
- * 의존하지 않는다. `btoa`는 Latin-1 코드유닛만 받기 때문에 문자열은 반드시
9
- * UTF-8 바이트로 먼저 인코딩한 뒤 넘긴다 — 그래야 non-ASCII 입력에서도
10
- * `Buffer.from(text, "utf8").toString("base64")`와 동일한 결과가 나온다.
11
- */
12
- /** 바이트 배열 → 표준 base64 (패딩 포함) */
13
- function base64FromBytes(bytes) {
14
- let binary = "";
15
- for (const byte of bytes) binary += String.fromCharCode(byte);
16
- return btoa(binary);
17
- }
18
- /** 바이트 배열 → base64url (RFC 4648 §5, 패딩 없음) */
19
- function base64UrlFromBytes(bytes) {
20
- return base64FromBytes(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
21
- }
22
- /**
23
- * 문자열 → UTF-8 base64. `btoa(text)`를 직접 쓰면 Latin-1로 해석돼
24
- * non-ASCII에서 잘못된 바이트가 나오거나(예: "café") 예외가 난다(예: "🔑").
25
- */
26
- function base64Utf8(text) {
27
- return base64FromBytes(new TextEncoder().encode(text));
28
- }
29
- //#endregion
30
3
  //#region src/schemas/audit.ts
31
4
  /**
32
5
  * 감사 로그와 승인 요청 — `/v1/audit-logs`, `/v1/approval-requests` (이슈 #36).
@@ -577,62 +550,6 @@ const analyticsCheckoutSchema = z.object({
577
550
  })).describe("결과별 결제 세션 수. 결과마다 한 행")
578
551
  });
579
552
  //#endregion
580
- //#region src/schemas/api-client.ts
581
- /**
582
- * 앱(OAuth 클라이언트) 관리 — `/v1/store/api-clients` (auth-spec 부록 B-13).
583
- * 등록은 DCR(`POST /v1/oauth2/register`, RFC 7591)이 담당하고, 이 스키마는 등록 이후의
584
- * 목록·상세·시크릿 재발급·비활성화 응답 계약이다. 시크릿 해시는 어떤 응답에도 포함되지 않는다.
585
- */
586
- const apiClientTypeSchema = z.enum(["public", "confidential"]).describe("클라이언트 유형. `public`=시크릿 없음(PKCE 로그인용), `confidential`=시크릿 보유(서버 간 연동용)");
587
- const apiClientStatusSchema = z.enum(["ACTIVE", "REVOKED"]).describe("상태. `REVOKED`는 비활성화된 클라이언트이며 다시 활성화할 수 없다");
588
- const apiClientSchema = z.object({
589
- clientId: z.string().describe("클라이언트 ID (`client_id`)"),
590
- name: z.string().describe("클라이언트 이름 (`client_name`)"),
591
- type: apiClientTypeSchema,
592
- status: apiClientStatusSchema,
593
- redirectUris: z.array(z.string()).describe("authorization_code 리다이렉트 URI 허용 목록 (정확 일치)"),
594
- scopes: z.array(z.string()).describe("클라이언트가 요청할 수 있는 최대 스코프"),
595
- grantTypes: z.array(z.string()).describe("허용된 grant_type 목록"),
596
- secretPrefix: z.string().nullable().describe("시크릿 앞부분(식별용, 인증에 사용할 수 없음). public 클라이언트와 시크릿 앞부분이 기록되기 전에 등록된 클라이언트는 null"),
597
- createdBy: z.string().nullable().describe("등록자 userId. 등록자 기록이 도입되기 전에 등록된 클라이언트는 null"),
598
- createdByName: z.string().nullable().describe("등록자 이름 (표시용). 계정이 없으면 null"),
599
- createdByEmail: z.string().nullable().describe("등록자 이메일 (표시용). 계정이 없으면 null"),
600
- createdAt: z.string().describe("등록 일시 (ISO 8601)"),
601
- revokedAt: z.string().nullable().describe("비활성화 일시 (ISO 8601). 활성 상태면 null")
602
- });
603
- /** 시크릿 재발급 응답 — 평문 시크릿은 이 응답에서 단 한 번만 노출된다 */
604
- const apiClientSecretRotatedSchema = apiClientSchema.extend({ clientSecret: z.string().describe("새 클라이언트 시크릿 평문. 이 응답에서만 노출되며 다시 조회할 수 없다") });
605
- const apiClientListQuerySchema = z.object({ status: apiClientStatusSchema.optional().describe("상태 필터. 생략하면 전체") });
606
- /**
607
- * Dynamic Client Registration 요청 (RFC 7591 §2, auth-spec §12) — `POST /v1/oauth2/register`.
608
- * OAuth 프로토콜 표면이라 필드명이 snake_case이고 응답·등록 오류는 평면 JSON이다.
609
- * 생략한 필드는 서버 기본값을 따른다(SDK가 기본값을 채워 보내지 않는다).
610
- */
611
- const oauthClientRegistrationRequestSchema = z.object({
612
- client_name: z.string().min(1).max(80).describe("클라이언트 이름 (1~80자)"),
613
- token_endpoint_auth_method: z.enum(["none", "client_secret_basic"]).optional().describe("토큰 엔드포인트 인증 방식. `none`=public(시크릿 없음), `client_secret_basic`=confidential. 생략하면 `client_secret_basic`"),
614
- redirect_uris: z.array(z.string()).max(10).optional().describe("리다이렉트 URI 목록(최대 10개). authorization_code에는 필수이며 https(개발용 루프백 http 제외)만 허용"),
615
- grant_types: z.array(z.enum([
616
- "authorization_code",
617
- "refresh_token",
618
- "client_credentials",
619
- "urn:ietf:params:oauth:grant-type:token-exchange"
620
- ])).min(1).optional().describe("허용할 grant_type 목록. 생략하면 `client_credentials`"),
621
- scope: z.string().optional().describe("공백 구분 스코프. 등록자 보유 스코프 이내여야 한다. 생략하면 confidential은 등록자 스코프, public은 `stores:read`")
622
- });
623
- /** Dynamic Client Registration 응답 (RFC 7591 §3.2.1) — client_secret은 이 응답에서만 노출된다 */
624
- const oauthClientRegistrationResponseSchema = z.object({
625
- client_id: z.string().describe("발급된 클라이언트 ID"),
626
- client_secret: z.string().optional().describe("클라이언트 시크릿 평문. confidential만 있으며 이 응답에서만 노출된다"),
627
- client_secret_expires_at: z.number().int().optional().describe("시크릿 만료 시각(epoch 초). 0은 만료 없음. confidential만 있다"),
628
- client_id_issued_at: z.number().int().describe("발급 시각 (epoch 초)"),
629
- client_name: z.string(),
630
- token_endpoint_auth_method: z.enum(["none", "client_secret_basic"]),
631
- redirect_uris: z.array(z.string()),
632
- grant_types: z.array(z.string()),
633
- scope: z.string().describe("부여된 스코프 (공백 구분)")
634
- });
635
- //#endregion
636
553
  //#region src/schemas/api-log.ts
637
554
  /**
638
555
  * API 로그 — `/v1/api-logs`. 스토어가 해석된 관리 API(`/v1/**`) 요청을 7일간 보관한다.
@@ -705,27 +622,6 @@ const storeRoleSchema = z.enum([
705
622
  "ADMIN",
706
623
  "STAFF"
707
624
  ]);
708
- const userTokenResponseSchema = z.object({
709
- access_token: z.string(),
710
- token_type: z.literal("Bearer"),
711
- expires_in: z.number().int(),
712
- refresh_token: z.string().optional()
713
- });
714
- /** client_credentials 응답 (RFC 6749 §4.4.3) — storeToken 직발급, refresh 없음 */
715
- const clientCredentialsTokenResponseSchema = z.object({
716
- access_token: z.string(),
717
- token_type: z.literal("Bearer"),
718
- expires_in: z.number().int(),
719
- scope: z.string()
720
- });
721
- const storeTokenResponseSchema = z.object({
722
- access_token: z.string(),
723
- token_type: z.literal("Bearer"),
724
- expires_in: z.number().int(),
725
- storeId: z.string(),
726
- role: storeRoleSchema,
727
- scopes: z.array(z.string())
728
- });
729
625
  const myStoreSchema = z.object({
730
626
  storeId: z.string(),
731
627
  storeName: z.string(),
@@ -744,30 +640,6 @@ const myAccountSchema = z.object({
744
640
  storeCount: z.number().int(),
745
641
  createdAt: z.string()
746
642
  });
747
- /** API 토큰(PAT) — 목록/조회 뷰 (평문·해시 미포함) */
748
- const apiTokenSchema = z.object({
749
- tokenId: z.string(),
750
- name: z.string(),
751
- prefix: z.string(),
752
- scopes: z.array(z.string()),
753
- createdBy: z.string().describe("발급자 userId"),
754
- createdByName: z.string().nullable().describe("발급자 이름 (표시용). 계정이 없으면 null"),
755
- createdByEmail: z.string().nullable().describe("발급자 이메일 (표시용). 계정이 없으면 null"),
756
- createdAt: z.string(),
757
- expiresAt: z.string().nullable(),
758
- lastUsedAt: z.string().nullable(),
759
- agent: z.boolean().default(false).describe("AI 에이전트(MCP)용 토큰인가. true면 이 토큰의 쓰기는 행위자 `AGENT`로 기록되고 에이전트 쓰기 정책(승인 필요·거부)을 따른다")
760
- });
761
- /** 생성 응답 — 평문 토큰은 이 응답에서 단 한 번만 노출된다 */
762
- const apiTokenCreatedSchema = apiTokenSchema.extend({ token: z.string() });
763
- const apiTokenCreateRequestSchema = z.object({
764
- name: z.string().min(1).max(50),
765
- scopes: z.array(z.string()).min(1),
766
- /** 일 단위 만료. null = 무기한, 생략 = 90일 */
767
- expiresInDays: z.number().int().nullable().optional(),
768
- /** AI 에이전트(MCP)용 토큰. 생략 = false. 발급 뒤에는 바꿀 수 없다 */
769
- agent: z.boolean().optional()
770
- });
771
643
  //#endregion
772
644
  //#region src/schemas/category.ts
773
645
  const categoryProductSortSchema = z.enum([
@@ -2994,7 +2866,8 @@ const productSummarySchema = z.object({
2994
2866
  /** optionGroups.length > 0 */
2995
2867
  hasOptions: z.boolean(),
2996
2868
  fulfillment: z.object({ type: fulfillmentTypeResponseSchema }).describe("상품 이행의 유형. 유형별 속성은 단건 조회(`GET /v1/products/{productId}`)의 `fulfillment`에 있다"),
2997
- updatedAt: z.string()
2869
+ updatedAt: z.string(),
2870
+ sample: z.boolean().optional().default(false).describe("스토어를 만들 때 넣은 샘플 상품인가(이슈 #70). 콘솔이 「샘플」 배지를 단다. 스토어프론트에는 싣지 않는다. 서버는 항상 싣는다")
2998
2871
  });
2999
2872
  /** 옵션 축(그룹)이 가지는 값 하나 — 예: 축 "색상"의 값 "블랙" */
3000
2873
  const optionValueSchema = z.object({
@@ -4334,7 +4207,7 @@ const storeMemberSchema = z.object({
4334
4207
  });
4335
4208
  /**
4336
4209
  * 초대 메일 발송 결과 — `SENDING`은 발송 요청 중(결과를 아직 적지 못함), `NOT_CONFIGURED`는 메일 발송이 설정되지 않아
4337
- * 보내지 않은 것이다. 발송 실패는 초대를 무효로 만들지 않는다 — 재발송으로 다시 보낸다
4210
+ * 보내지 않은 것이다. 스토어의 월 메일 한도(요금제)를 다 써서 보내지 않았으면 `FAILED` + `deliveryErrorCode: MAIL_QUOTA_EXCEEDED`다. 발송 실패는 초대를 무효로 만들지 않는다 — 재발송으로 다시 보낸다
4338
4211
  */
4339
4212
  const invitationDeliveryStatusSchema = z.enum([
4340
4213
  "SENDING",
@@ -4433,6 +4306,7 @@ const sellerAddressRequestSchema = z.object({
4433
4306
  * - 409 `STORE_SUSPENDED` — 정지된 스토어에는 사이트를 만들 수 없다
4434
4307
  * - 409 `STOREFRONT_VERSION_NOT_READY` — 빌드가 끝나지 않았거나 실패한 버전은 발행할 수 없다
4435
4308
  * - 409 `STOREFRONT_NO_ROLLBACK_TARGET` — 되돌릴 이전 발행 버전이 없다
4309
+ * - 409 `STOREFRONT_NOT_READY` — 공개 전환: 판매 중인 상품(샘플 제외)이 없다(이슈 #70). 상품을 등록한 뒤 공개한다
4436
4310
  * - 409 `TEMPLATE_CHANGE_NOT_SUPPORTED` — 템플릿 변경(`POST /v1/storefront/site/template`, 폐기)은 항상 이 오류다
4437
4311
  * - 400 `STOREFRONT_SLUG_CONFIRM_MISMATCH` — 호스팅 끄기 확인 입력이 현재 슬러그와 다르다
4438
4312
  * - 503 `STOREFRONT_PREVIEW_NOT_CONFIGURED` — 미리보기 서명 키가 설정되지 않았다
@@ -4493,6 +4367,14 @@ const RESERVED_STOREFRONT_SLUGS = [
4493
4367
  * 1단계 이름이라 슬러그가 이 모양이면 남의 편집 미리보기 주소와 겹칠 수 있어 슬러그로 쓰지 못한다.
4494
4368
  */
4495
4369
  const STOREFRONT_EDIT_PREVIEW_SUFFIX = "-preview";
4370
+ /**
4371
+ * 공식 쇼케이스 슬러그 접두사(이슈 #72) — `demo-{템플릿 id}`는 템플릿 미리보기용 쇼케이스 사이트 주소다. 쇼케이스로 지정된
4372
+ * 스토어만 쓸 수 있다(서버가 스토어 용도로 판정한다). 공식 미리보기를 흉내 내는 주소를 막는다
4373
+ */
4374
+ const STOREFRONT_SHOWCASE_SLUG_PREFIX = "demo-";
4375
+ function isShowcaseStorefrontSlug(slug) {
4376
+ return slug.toLowerCase().startsWith(STOREFRONT_SHOWCASE_SLUG_PREFIX);
4377
+ }
4496
4378
  function isReservedStorefrontSlug(slug) {
4497
4379
  const lower = slug.toLowerCase();
4498
4380
  return RESERVED_STOREFRONT_SLUGS.includes(lower) || lower.endsWith("-preview");
@@ -4521,7 +4403,10 @@ const storefrontTemplateSchema = z.object({
4521
4403
  description: z.string().describe("템플릿 설명"),
4522
4404
  thumbnailUrl: z.string().nullable().describe("썸네일 이미지 주소. 없으면 null"),
4523
4405
  version: z.string().describe("현재 템플릿 버전. 새 사이트는 이 버전으로 만든다"),
4524
- isDefault: z.boolean().describe("기본 템플릿인가 (스토어 생성 시 자동 생성에 쓴다)")
4406
+ isDefault: z.boolean().describe("기본 템플릿인가 (스토어 생성 시 자동 생성에 쓴다)"),
4407
+ tags: z.array(z.string()).default([]).describe("템플릿 특징 태그 (예: `후기 강조`). 목록 카드에 보인다. 옛 서버 응답은 빈 배열로 읽는다"),
4408
+ supportsCheckout: z.boolean().default(true).describe("주문을 받는 템플릿인가. false는 가격·문의 중심의 카탈로그형이다. 옛 서버 응답은 true로 읽는다"),
4409
+ previewUrl: z.string().nullable().default(null).describe("공식 쇼케이스 사이트 주소. 연결된 쇼케이스가 공개 중일 때만 싣고 그 밖에는 null")
4525
4410
  });
4526
4411
  /**
4527
4412
  * 버전 상태 — 템플릿 버전(`source: TEMPLATE`)은 템플릿 산출물을 그대로 쓰므로 만들 때 곧바로 `READY`다. 편집 버전
@@ -5316,35 +5201,188 @@ const storefrontSourceReplacedSchema = z.object({
5316
5201
  dependencyWarnings: z.array(storefrontDependencyFindingSchema).describe("배포를 막지 않는 의존성 경고 (보안 권고 등)")
5317
5202
  });
5318
5203
  //#endregion
5204
+ //#region src/schemas/subscription.ts
5205
+ /**
5206
+ * 요금제·구독 — `GET /v1/store/subscription`(스코프 `store:r`). 구독 단위는 스토어다.
5207
+ * 결제 수단·청구 금액은 싣지 않는다. 요금제 변경은 셀러 콘솔에서만 한다.
5208
+ */
5209
+ /** 요금제 코드 — 이름(`plan.name`)이 바뀌어도 코드는 바뀌지 않는다. 값은 추가만 한다 */
5210
+ const planCodeSchema = z.enum([
5211
+ "BETA",
5212
+ "FREE",
5213
+ "BASIC",
5214
+ "PRO",
5215
+ "BUSINESS",
5216
+ "ENTERPRISE",
5217
+ "PREMIUM"
5218
+ ]).describe("요금제 코드. `FREE`=Free, `PRO`=Pro, `PREMIUM`=프리미엄, `ENTERPRISE`=엔터프라이즈, `BETA`=베타(운영 오픈 기간). `BASIC`·`BUSINESS`는 2026-09-30 이전 요금제(더 쓰지 않는다)");
5219
+ /**
5220
+ * 응답의 요금제 코드 — 아는 코드(`PlanCode`)거나 이 SDK가 모르는 새 코드(문자열)다. 요금제 코드는 추가될 수 있어 응답 파싱을 깨지 않게
5221
+ * 넓게 받는다(옛 SDK는 새 코드를 모르면 파싱에 실패했다, #44 리뷰 M3). 요청에는 `planCodeSchema`를 쓴다
5222
+ */
5223
+ const responsePlanCodeSchema = z.union([planCodeSchema, z.string()]).describe(planCodeSchema.description ?? "요금제 코드");
5224
+ const subscriptionStatusSchema = z.enum([
5225
+ "ACTIVE",
5226
+ "PAST_DUE",
5227
+ "CANCELED",
5228
+ "INCOMPLETE"
5229
+ ]).describe("구독 상태. `ACTIVE`=이용 중, `PAST_DUE`=결제 실패 후 유예 중, `CANCELED`=해지됨, `INCOMPLETE`=첫 결제 대기");
5230
+ const limit = (description) => z.number().int().nullable().describe(`${description}. null이면 한도 없음`);
5231
+ const subscriptionLimitsSchema = z.object({
5232
+ liveOrdersMonthly: limit("더 쓰지 않는다 — 라이브 주문 수로 요금제를 나누지 않아 항상 null"),
5233
+ seatsIncluded: limit("구성원 석 — 구성원은 모든 요금제에서 무료·무제한이라 null"),
5234
+ aiActionsMonthly: limit("MCP(에이전트) 쓰기(AI 작업) 월 한도"),
5235
+ aiReadsMonthly: limit("MCP(에이전트) 읽기 월 한도"),
5236
+ customDomains: limit("내 도메인 수"),
5237
+ webhooks: limit("웹훅 구독 수(0이면 쓸 수 없다)"),
5238
+ socialProviders: limit("더 쓰지 않는다 — 소셜 로그인 공급자 수로 요금제를 나누지 않아 항상 null"),
5239
+ emailsMonthly: limit("더 쓰지 않는다 — 메일 한도가 없어 항상 null"),
5240
+ storefrontRequestsMonthly: limit("스토어프론트 월 트래픽(요청 수, 넘어도 막지 않고 안내만)"),
5241
+ apiLogRetentionDays: limit("API 로그 보관 일수(0이면 API 로그 없음)"),
5242
+ auditLogRetentionDays: limit("감사 로그 보관 일수"),
5243
+ storefrontPreviewHoursMonthly: limit("스토어프론트 편집 미리보기 월 시간"),
5244
+ storefrontBuildMinutesMonthly: limit("스토어프론트 빌드 월 분"),
5245
+ adminApiRequestsMonthly: limit("관리 API 요청 월 포함량(넘으면 속도만 낮춘다, 주문 처리 제외)")
5246
+ });
5247
+ const subscriptionUsageSchema = z.object({
5248
+ liveOrders: z.number().int().describe("이번 기간 라이브 주문 수(테스트 결제 주문 제외)"),
5249
+ aiActions: z.number().int().describe("이번 기간 MCP(에이전트) 쓰기(AI 작업) 수"),
5250
+ aiReads: z.number().int().describe("이번 기간 MCP(에이전트) 읽기 수"),
5251
+ storefrontRequests: z.number().int().describe("이번 기간 스토어프론트 요청 수"),
5252
+ adminApiRequests: z.number().int().describe("이번 기간 관리 API 요청 수(API 토큰·앱·에이전트 호출, 셀러 콘솔 제외)"),
5253
+ emails: z.number().int().describe("이번 기간 초대·양도 알림 메일 수(한도 없음, 표시만)"),
5254
+ storefrontPreviewMinutes: z.number().int().describe("이번 기간 편집 미리보기 분(끝난 세션)"),
5255
+ storefrontBuildMinutes: z.number().int().describe("이번 기간 빌드 분(끝난 빌드)"),
5256
+ seats: z.number().int().describe("현재 석 수 — 구성원(OWNER 포함) + 대기 중 초대"),
5257
+ customDomains: z.number().int().describe("현재 내 도메인 수(해제한 도메인 제외)"),
5258
+ webhooks: z.number().int().describe("현재 웹훅 구독 수")
5259
+ });
5260
+ const storeSubscriptionSchema = z.object({
5261
+ plan: z.object({
5262
+ code: responsePlanCodeSchema,
5263
+ name: z.string().describe("요금제 표시 이름(예: 프로)")
5264
+ }),
5265
+ status: subscriptionStatusSchema,
5266
+ interval: z.enum(["MONTH"]).nullable().describe("결제 주기. `MONTH`=월간. 요금을 내지 않는 요금제(베타·무료)는 null"),
5267
+ cancelAtPeriodEnd: z.boolean().describe("기간 끝에 해지 예정인가"),
5268
+ period: z.object({
5269
+ start: z.string().describe("사용량 기간 시작(ISO 8601)"),
5270
+ end: z.string().describe("사용량 기간 끝(ISO 8601, 이 시각에 사용량이 초기화된다)")
5271
+ }).describe("사용량을 세는 기간. 요금을 내지 않는 요금제는 한국 시간 달력 월이다"),
5272
+ limits: subscriptionLimitsSchema,
5273
+ features: z.object({
5274
+ adminApi: z.boolean().describe("관리 API(개인 액세스 토큰·외부 앱 토큰 호출)를 쓸 수 있다"),
5275
+ analytics: z.boolean().describe("애널리틱스 조회를 쓸 수 있다"),
5276
+ storeClone: z.boolean().describe("더 쓰지 않는다 — 스토어 복제 기능을 없애 항상 false"),
5277
+ removeBadge: z.boolean().describe("더 쓰지 않는다 — 배지 키를 없애 항상 false")
5278
+ }),
5279
+ usage: subscriptionUsageSchema,
5280
+ aiActions: z.object({
5281
+ limit: z.number().int().nullable(),
5282
+ used: z.number().int(),
5283
+ resetsAt: z.string().describe("한도가 초기화되는 시각(ISO 8601)")
5284
+ }).describe("AI 작업(MCP 쓰기) 한도 요약 — 에이전트가 남은 작업 수를 판단할 때 쓴다"),
5285
+ aiReads: z.object({
5286
+ limit: z.number().int().nullable(),
5287
+ used: z.number().int(),
5288
+ resetsAt: z.string().describe("한도가 초기화되는 시각(ISO 8601)")
5289
+ }).describe("MCP 읽기 한도 요약"),
5290
+ salesFeePercent: z.literal(0).describe("판매 수수료(%). 모든 요금제 0이다")
5291
+ });
5292
+ /**
5293
+ * 요금제 한도 오류의 `error.details` — 기존 오류 코드(`STORE_LIMIT_EXCEEDED`·`STOREFRONT_DOMAIN_LIMIT`·`WEBHOOK_LIMIT_EXCEEDED` 등)와
5294
+ * 요금제 오류(`PLAN_LIMIT_EXCEEDED`·`PLAN_AI_ACTIONS_EXCEEDED`·`PLAN_AI_READS_EXCEEDED`·`PLAN_FEATURE_REQUIRED`·`PLAN_API_QUOTA_EXCEEDED`)가 같은 형식을 싣는다.
5295
+ * 모든 필드가 선택이다(기존 코드는 요금제 판정 전 필드만 실을 수 있다).
5296
+ */
5297
+ const planErrorDetailsSchema = z.object({
5298
+ feature: z.string().optional().describe("한도에 닿은 기능 키(예: `limits.ai_actions_monthly`)"),
5299
+ limit: z.number().nullable().optional(),
5300
+ used: z.number().optional(),
5301
+ plan: responsePlanCodeSchema.optional(),
5302
+ resetsAt: z.string().optional().describe("월 한도가 초기화되는 시각(ISO 8601)"),
5303
+ upgradeUrl: z.string().optional().describe("요금제 화면 주소(셀러 콘솔)"),
5304
+ reason: z.string().optional().describe("스토어 수 한도의 이유 — `OWNED_STORES`(소유 스토어 수). `FREE_STORES`는 더 쓰지 않는다")
5305
+ }).loose();
5306
+ const limitOrContract = (description) => z.number().int().nullable().describe(`${description}. null이면 계약(엔터프라이즈)·한도 없음`);
5307
+ /**
5308
+ * 요금제 기능 키 값 — 요금제 비교표·콘솔 요금제 화면이 쓴다. 키는 서버 판정의 기능 키와 같다(추가만 한다). 상위 요금제는 하위 요금제
5309
+ * 기능을 모두 포함한다
5310
+ */
5311
+ const planEntitlementsSchema = z.object({
5312
+ "features.admin_api": z.boolean().describe("관리 API(개인 액세스 토큰·외부 앱 토큰 호출). 셀러 콘솔·CLI·MCP는 모든 요금제에서 쓴다"),
5313
+ "features.analytics": z.boolean().describe("애널리틱스 화면·조회 API"),
5314
+ "limits.ai_reads_monthly": limitOrContract("MCP 읽기 월 한도"),
5315
+ "limits.ai_actions_monthly": limitOrContract("MCP 쓰기(AI 작업) 월 한도 — 주문 처리는 막지 않는다"),
5316
+ "limits.custom_domains": limitOrContract("내 도메인 수"),
5317
+ "limits.webhooks": limitOrContract("웹훅 구독 수(0이면 쓸 수 없다)"),
5318
+ "limits.storefront_preview_hours_monthly": limitOrContract("편집 환경 시간(월, 시간)"),
5319
+ "limits.storefront_build_minutes_monthly": limitOrContract("빌드 시간(월, 분)"),
5320
+ "limits.storefront_requests_monthly": limitOrContract("스토어프론트 월 트래픽(요청 수) — 넘어도 막지 않고 안내만 한다"),
5321
+ "limits.admin_api_requests_monthly": limitOrContract("관리 API 월 요청 — 넘으면 속도만 낮춘다(주문 처리 제외)"),
5322
+ "rate_limit.admin_api": z.number().nullable().describe("관리 API 분당 속도 배수(기본 분당 600 × 배수)"),
5323
+ "storefront.cpu_ms": z.number().int().describe("스토어프론트 사이트 요청당 CPU 상한(ms)"),
5324
+ "storefront.subrequests": z.number().int().describe("스토어프론트 사이트 요청당 하위 요청 상한"),
5325
+ "storefront.rate_limit_per_minute": z.number().int().describe("스토어프론트 남용 방지 요청 속도 상한(사이트당 분당)"),
5326
+ "seats.included": limitOrContract("포함 구성원 석 — 구성원은 모든 요금제에서 무료·무제한이라 null"),
5327
+ "retention.analytics_days": z.number().int().describe("애널리틱스 보관 일수"),
5328
+ "retention.api_logs_days": limitOrContract("API 로그 보관 일수(0이면 API 로그 없음)"),
5329
+ "retention.audit_days": limitOrContract("감사 로그 보관 일수"),
5330
+ "support.tier": z.union([z.enum([
5331
+ "COMMUNITY",
5332
+ "EMAIL",
5333
+ "EMAIL_PRIORITY",
5334
+ "DEDICATED",
5335
+ "SLA"
5336
+ ]), z.string()]).describe("지원 등급(`COMMUNITY`·`EMAIL`·`EMAIL_PRIORITY`·`DEDICATED`·`SLA`, 새 등급이 더해질 수 있다)")
5337
+ }).describe("요금제 기능 키 값");
5338
+ /** 공개 요금제 한 줄 — `GET /v1/public/plans` */
5339
+ const publicPlanSchema = z.object({
5340
+ code: responsePlanCodeSchema,
5341
+ name: z.string().describe("표시 이름(Free·Pro·프리미엄·엔터프라이즈)"),
5342
+ version: z.number().int().describe("요금제 버전 — 값이 바뀌면 새 버전이 게시된다"),
5343
+ sort: z.number().int(),
5344
+ purchasable: z.boolean().describe("셀프 결제로 고를 수 있는가(Free·엔터프라이즈는 아니다 — 엔터프라이즈는 계약)"),
5345
+ prices: z.object({
5346
+ currency: z.literal("KRW"),
5347
+ monthly: z.number().int().nullable().describe("월 가격(공급가, 부가세 별도)"),
5348
+ startingAt: z.boolean().describe("「부터」 가격(엔터프라이즈 계약)"),
5349
+ vatIncluded: z.object({ monthly: z.number().int().nullable() }).describe("표시 가격(부가세 포함) — 요금제 비교표는 이 값을 보인다")
5350
+ }),
5351
+ entitlements: planEntitlementsSchema
5352
+ });
5353
+ /** 요금제 비교표 — `GET /v1/public/plans`(인증 없음, 캐시 가능). 값은 서버가 관리하고 언제든 바뀔 수 있다 */
5354
+ const publicPlansSchema = z.object({
5355
+ vatPercent: z.number().int().describe("부가세율(%)"),
5356
+ plans: z.array(publicPlanSchema).describe("공개 요금제의 지금 버전 — 정렬 순")
5357
+ });
5358
+ //#endregion
5319
5359
  //#region src/client.ts
5320
- function formBody(fields) {
5321
- return new URLSearchParams(fields).toString();
5322
- }
5323
5360
  function createStoreClient(options) {
5324
5361
  const fetchFn = options.fetch ?? globalThis.fetch;
5325
5362
  const { session } = options;
5326
- const userTokenSource = options.userToken ?? (session ? () => session.getToken() : void 0);
5363
+ const tokenSource = options.accessToken ?? (session ? () => session.getToken() : void 0);
5327
5364
  const refresh = options.refresh ?? (session ? () => session.refresh() : void 0);
5328
5365
  const onUnauthorized = options.onUnauthorized ?? (session ? () => session.clear() : void 0);
5329
- const storeTokenSource = options.storeToken ?? options.auth?.apiToken;
5366
+ function bearer() {
5367
+ const token = resolveToken(tokenSource);
5368
+ return token ? { authorization: `Bearer ${token}` } : {};
5369
+ }
5370
+ /** 계정 API(`/me/*`) — 스토어를 고르지 않는다 */
5330
5371
  const userHttp = createHttp({
5331
5372
  baseUrl: options.baseUrl,
5332
5373
  fetch: fetchFn,
5333
- headers: () => {
5334
- const token = resolveToken(userTokenSource);
5335
- return token ? { authorization: `Bearer ${token}` } : {};
5336
- },
5374
+ headers: bearer,
5337
5375
  refresh,
5338
5376
  onUnauthorized
5339
5377
  });
5378
+ /** 스토어 API — 같은 계정 토큰 + `X-Store-Id` */
5340
5379
  const storeHttp = createHttp({
5341
5380
  baseUrl: options.baseUrl,
5342
5381
  fetch: fetchFn,
5343
5382
  headers: () => {
5344
- const token = resolveToken(storeTokenSource);
5345
5383
  const storeId = resolveToken(options.storeId);
5346
5384
  return {
5347
- ...token ? { authorization: `Bearer ${token}` } : {},
5385
+ ...bearer(),
5348
5386
  ...storeId ? { "x-store-id": storeId } : {}
5349
5387
  };
5350
5388
  },
@@ -5363,7 +5401,7 @@ function createStoreClient(options) {
5363
5401
  return session;
5364
5402
  }
5365
5403
  return {
5366
- /** session의 현재 userToken (session 미배선 시 null — 던지지 않음) */
5404
+ /** session의 현재 액세스 토큰 (session 미배선 시 null — 던지지 않음) */
5367
5405
  get accessToken() {
5368
5406
  return session ? session.accessToken : null;
5369
5407
  },
@@ -5376,69 +5414,10 @@ function createStoreClient(options) {
5376
5414
  /** session.userinfo 패스스루 — session 미배선 시 명확한 에러를 던진다 */
5377
5415
  userinfo: () => requireSession().userinfo(),
5378
5416
  auth: {
5379
- /**
5380
- * 서버 간 연동(M2M) — client_credentials grant (client_secret_basic).
5381
- * 클라이언트가 스토어에 바인딩되어 있어 **storeToken이 곧바로 발급**된다.
5382
- * ⚠ client_secret은 서버 환경에서만 사용할 것 (브라우저 반입 금지)
5383
- */
5384
- async issueStoreTokenByClientCredentials(clientId, clientSecret, scope) {
5385
- const credentials = base64Utf8(`${clientId}:${clientSecret}`);
5386
- const response = await fetchFn(`${options.baseUrl}/oauth2/token`, {
5387
- method: "POST",
5388
- headers: {
5389
- "content-type": "application/x-www-form-urlencoded",
5390
- authorization: `Basic ${credentials}`
5391
- },
5392
- body: formBody({
5393
- grant_type: "client_credentials",
5394
- ...scope ? { scope } : {}
5395
- })
5396
- });
5397
- if (!response.ok) {
5398
- const body = await response.json().catch(() => null);
5399
- throw new Error(body?.error_description ?? `토큰 발급 실패 (HTTP ${response.status})`);
5400
- }
5401
- return clientCredentialsTokenResponseSchema.parse(unwrapData(await response.json()));
5402
- },
5403
- /** 2단계 — 소속 스토어 목록 */
5417
+ /** 소속 스토어 목록 */
5404
5418
  listMyStores: () => userHttp.request("GET", "/me/stores", z.array(myStoreSchema)),
5405
- /** RFC 7009 — token을 폐기한다 (public client는 client_id만 동반) */
5406
- async revoke(token, clientId) {
5407
- await fetchFn(`${options.baseUrl}/oauth2/revoke`, {
5408
- method: "POST",
5409
- headers: { "content-type": "application/x-www-form-urlencoded" },
5410
- body: formBody({
5411
- token,
5412
- client_id: clientId
5413
- })
5414
- });
5415
- },
5416
5419
  me: () => userHttp.request("GET", "/me", myAccountSchema)
5417
5420
  },
5418
- /** API 토큰(PAT) 관리 — OWNER/ADMIN 전용. 발급된 토큰은 storeToken처럼 Bearer로 사용 */
5419
- apiTokens: {
5420
- create: (body) => storeHttp.request("POST", "/store/api-tokens", apiTokenCreatedSchema, { body: apiTokenCreateRequestSchema.parse(body) }),
5421
- list: () => storeHttp.request("GET", "/store/api-tokens", z.array(apiTokenSchema)),
5422
- revoke: (tokenId) => storeHttp.requestVoid("DELETE", path`/store/api-tokens/${tokenId}`)
5423
- },
5424
- /**
5425
- * 앱(OAuth 클라이언트) 관리 — OWNER/ADMIN storeToken 전용(PAT·M2M 거부). auth-spec §12, 부록 B-13.
5426
- * 시크릿 평문은 register·rotateSecret 응답에서만 한 번 노출된다(apiTokens.create와 같은 성격).
5427
- */
5428
- apiClients: {
5429
- /**
5430
- * DCR 등록 (RFC 7591) — `POST /v1/oauth2/register`. OAuth 프로토콜 표면이라 응답이 평면 JSON이다.
5431
- * 등록 오류(`invalid_client_metadata`·`invalid_redirect_uri`)는 ApiError(code=error,
5432
- * message=error_description)로, Bearer 인증 오류는 엔벨로프 그대로 ApiError로 던진다.
5433
- */
5434
- register: (body) => storeHttp.request("POST", "/oauth2/register", oauthClientRegistrationResponseSchema, { body: oauthClientRegistrationRequestSchema.parse(body) }),
5435
- list: (params) => storeHttp.request("GET", "/store/api-clients", z.array(apiClientSchema), { query: params }),
5436
- get: (clientId) => storeHttp.request("GET", path`/store/api-clients/${clientId}`, apiClientSchema),
5437
- /** confidential 전용. 기존 시크릿은 즉시 무효(유예 없음) */
5438
- rotateSecret: (clientId) => storeHttp.request("POST", path`/store/api-clients/${clientId}/rotate-secret`, apiClientSecretRotatedSchema),
5439
- /** REVOKED로 전환(되돌릴 수 없음). 이미 비활성이면 현재 상태를 그대로 돌려준다 */
5440
- deactivate: (clientId) => storeHttp.request("POST", path`/store/api-clients/${clientId}/deactivate`, apiClientSchema)
5441
- },
5442
5421
  /**
5443
5422
  * 미디어 업로드 — 자리를 받아(`POST /uploads`) 파일 바이트는 호출자가
5444
5423
  * `uploadUrl`로 직접 PUT한다. 업로드가 끝나면 `url`이 공개 주소가 된다.
@@ -5742,7 +5721,7 @@ get: (params) => storeHttp.request("GET", "/sales-report", salesReportSchema, {
5742
5721
  /**
5743
5722
  * 결제(PG) 설정 — **콘솔 OWNER 전용**. ADMIN·STAFF·PAT·M2M·3rd-party 앱 토큰은 스코프가 있어도
5744
5723
  * 403 `INSUFFICIENT_ROLE`이다(조회 포함). OWNER 여부는 요청 시점의 스토어 멤버십으로 다시 확인하므로
5745
- * 양도·강등 직후의 옛 storeToken도 403이다(토큰을 재발급받는다). 비밀 값(시크릿 키·API Secret·웹훅 시크릿)은 요청으로만 보내고
5724
+ * 양도·강등 직후에도 바로 403이다. 비밀 값(시크릿 키·API Secret·웹훅 시크릿)은 요청으로만 보내고
5746
5725
  * 응답에는 `secrets[].masked`(앞 4자리 마스킹)만 나온다.
5747
5726
  */
5748
5727
  paymentSettings: {
@@ -6012,6 +5991,18 @@ list: (params) => storeHttp.request("GET", "/audit-logs", auditLogPageSchema, {
6012
5991
  */
6013
5992
  replaceSource: (body) => storeHttp.request("PUT", "/storefront/site/source", storefrontSourceReplacedSchema, { body: replaceStorefrontSourceRequestSchema.parse(body) })
6014
5993
  },
5994
+ subscription: {
5995
+ /**
5996
+ * `GET /v1/store/subscription` — 스코프 `store:r`. 현재 요금제·상태·사용량 기간·한도·이번 기간 사용량.
5997
+ * 결제 수단·청구 금액은 싣지 않는다. 요금제 변경은 셀러 콘솔에서만 한다
5998
+ */
5999
+ get: () => storeHttp.request("GET", "/store/subscription", storeSubscriptionSchema) },
6000
+ plans: {
6001
+ /**
6002
+ * `GET /v1/public/plans` — 인증 없음. 공개 요금제의 지금 버전(가격·기능 키 값). 값은 서버가 관리하고 언제든 바뀔 수 있어
6003
+ * 코드에 요금제 수치를 두지 말고 이 값을 읽는다
6004
+ */
6005
+ listPublic: () => storeHttp.request("GET", "/public/plans", publicPlansSchema) },
6015
6006
  store: {
6016
6007
  get: () => storeHttp.request("GET", "/store", storeSchema),
6017
6008
  /**
@@ -6038,12 +6029,33 @@ list: (params) => storeHttp.request("GET", "/audit-logs", auditLogPageSchema, {
6038
6029
  };
6039
6030
  }
6040
6031
  //#endregion
6032
+ //#region src/base64.ts
6033
+ /**
6034
+ * base64 인코딩 헬퍼 — 웹 표준(`btoa` + `TextEncoder`)만 사용한다.
6035
+ *
6036
+ * 이 패키지는 브라우저/서버 공용 entrypoint 하나로 배포되므로 Node 전용 `Buffer`에
6037
+ * 의존하지 않는다. `btoa`는 Latin-1 코드유닛만 받기 때문에 문자열은 반드시
6038
+ * UTF-8 바이트로 먼저 인코딩한 뒤 넘긴다 — 그래야 non-ASCII 입력에서도
6039
+ * `Buffer.from(text, "utf8").toString("base64")`와 동일한 결과가 나온다.
6040
+ */
6041
+ /** 바이트 배열 → 표준 base64 (패딩 포함) */
6042
+ function base64FromBytes(bytes) {
6043
+ let binary = "";
6044
+ for (const byte of bytes) binary += String.fromCharCode(byte);
6045
+ return btoa(binary);
6046
+ }
6047
+ /** 바이트 배열 → base64url (RFC 4648 §5, 패딩 없음) */
6048
+ function base64UrlFromBytes(bytes) {
6049
+ return base64FromBytes(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
6050
+ }
6051
+ //#endregion
6041
6052
  //#region src/oauth.ts
6042
6053
  /**
6043
6054
  * OAuth 2.1 브라우저 플로우 헬퍼 (authorization_code + PKCE).
6055
+ * 발급자는 Sayren 계정(accounts)이다 — 엔드포인트 주소는 호출부가 준다.
6044
6056
  * Web Crypto만 사용 — 브라우저/Node 모두에서 동작하며 **시크릿을 다루지 않는다**.
6045
6057
  */
6046
- /** RFC 6749 §5.1 토큰 응답 (+ RFC 8693 확장 멤버 허용) */
6058
+ /** RFC 6749 §5.1 토큰 응답 */
6047
6059
  const oauthTokenResponseSchema = z.object({
6048
6060
  access_token: z.string(),
6049
6061
  token_type: z.literal("Bearer"),
@@ -6064,7 +6076,7 @@ async function createPkcePair() {
6064
6076
  }
6065
6077
  /** authorize 엔드포인트 URL 구성 — 브라우저는 이 URL로 이동(top-level navigation) */
6066
6078
  function buildAuthorizeUrl(options) {
6067
- const url = new URL(`${options.baseUrl}/oauth2/authorize`);
6079
+ const url = new URL(options.authorizeUrl);
6068
6080
  url.searchParams.set("response_type", "code");
6069
6081
  url.searchParams.set("client_id", options.clientId);
6070
6082
  url.searchParams.set("redirect_uri", options.redirectUri);
@@ -6072,10 +6084,12 @@ function buildAuthorizeUrl(options) {
6072
6084
  url.searchParams.set("code_challenge", options.codeChallenge);
6073
6085
  url.searchParams.set("code_challenge_method", "S256");
6074
6086
  if (options.scope) url.searchParams.set("scope", options.scope);
6087
+ if (options.resource) url.searchParams.set("resource", options.resource);
6088
+ if (options.prompt) url.searchParams.set("prompt", options.prompt);
6075
6089
  return url.toString();
6076
6090
  }
6077
- async function tokenRequest(baseUrl, form, fetchFn = globalThis.fetch) {
6078
- const response = await fetchFn(`${baseUrl}/oauth2/token`, {
6091
+ async function tokenRequest(endpoint, form, fetchFn = globalThis.fetch) {
6092
+ const response = await fetchFn(endpoint, {
6079
6093
  method: "POST",
6080
6094
  headers: { "content-type": "application/x-www-form-urlencoded" },
6081
6095
  body: new URLSearchParams(form).toString()
@@ -6087,34 +6101,41 @@ async function tokenRequest(baseUrl, form, fetchFn = globalThis.fetch) {
6087
6101
  }
6088
6102
  return oauthTokenResponseSchema.parse(unwrapData(json));
6089
6103
  }
6090
- /** 콜백에서 받은 code를 userToken으로 교환 (PKCE verifier 동반) */
6104
+ /** 콜백에서 받은 code를 액세스 토큰으로 교환 (PKCE verifier 동반) */
6091
6105
  async function exchangeAuthorizationCode(options) {
6092
- return tokenRequest(options.baseUrl, {
6106
+ return tokenRequest(options.tokenUrl, {
6093
6107
  grant_type: "authorization_code",
6094
6108
  code: options.code,
6095
6109
  redirect_uri: options.redirectUri,
6096
6110
  client_id: options.clientId,
6097
- code_verifier: options.codeVerifier
6111
+ code_verifier: options.codeVerifier,
6112
+ ...options.resource ? { resource: options.resource } : {}
6098
6113
  }, options.fetch);
6099
6114
  }
6100
6115
  /** refresh grant (rotation — 응답의 새 refresh_token으로 반드시 교체 저장할 것) */
6101
6116
  async function refreshUserToken(options) {
6102
- return tokenRequest(options.baseUrl, {
6117
+ return tokenRequest(options.tokenUrl, {
6103
6118
  grant_type: "refresh_token",
6104
6119
  refresh_token: options.refreshToken,
6105
- client_id: options.clientId
6106
- }, options.fetch);
6107
- }
6108
- /** userToken → storeToken 교환 (RFC 8693 token-exchange grant) */
6109
- async function exchangeStoreTokenViaOAuth(options) {
6110
- return tokenRequest(options.baseUrl, {
6111
- grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
6112
- subject_token: options.userToken,
6113
- subject_token_type: "urn:ietf:params:oauth:token-type:access_token",
6114
- audience: options.storeId,
6115
- client_id: options.clientId
6120
+ client_id: options.clientId,
6121
+ ...options.resource ? { resource: options.resource } : {}
6116
6122
  }, options.fetch);
6117
6123
  }
6124
+ const customerDelegationRequestSchema = z.object({
6125
+ uid: z.string().regex(/^[A-Za-z0-9._:@|-]{1,128}$/).optional().describe("셀러 자체 인증의 사용자 id(1~128자, 영문·숫자·`._:@|-`). 처음 보는 id면 구매자를 만든다"),
6126
+ email: z.email().max(254).optional().describe("uid가 없으면 이메일로 지목한다. uid와 함께 주면 처음 만들 때의 이메일이다"),
6127
+ name: z.string().max(50).optional().describe("처음 만들 때의 이름"),
6128
+ authenticatedAt: z.iso.datetime({ offset: true }).optional().describe("사용자가 셀러 서비스에서 실제로 로그인한 시각(uid 위임만). 주면 구매자 토큰의 인증 시각이 된다")
6129
+ }).refine((value) => Boolean(value.uid || value.email), {
6130
+ message: "uid 또는 email이 필요합니다",
6131
+ path: ["uid"]
6132
+ }).describe("구매자 위임 요청");
6133
+ const customerDelegationSchema = z.object({
6134
+ accessToken: z.string().describe("구매자 액세스 토큰(스토어프론트 API Bearer)"),
6135
+ tokenType: z.literal("Bearer"),
6136
+ expiresIn: z.number().int().describe("수명(초)"),
6137
+ memberId: z.string()
6138
+ }).describe("구매자 위임 결과");
6118
6139
  //#endregion
6119
6140
  //#region src/schemas/scope.ts
6120
6141
  /**
@@ -6152,8 +6173,7 @@ function isStoreScope(scope) {
6152
6173
  }
6153
6174
  /**
6154
6175
  * 역할별 자동 부여 스코프 (auth-spec §7).
6155
- * storeToken(사람)의 스코프는 이 표로 결정된다. PAT·M2M 클라이언트에는 역할이 없고
6156
- * 발급 시 지정한 스코프만 갖는다(발급자 보유 스코프 이내).
6176
+ * 계정 토큰으로 스토어를 호출할 때의 스코프는 그 스토어에서의 역할로 이 표에서 결정된다.
6157
6177
  */
6158
6178
  const STORE_ROLE_SCOPES = {
6159
6179
  OWNER: [
@@ -6394,7 +6414,8 @@ const REVOKE_TIMEOUT_MS = 5e3;
6394
6414
  /** Web Locks 이름 — 탭 간 refresh 회전 직렬화용 */
6395
6415
  const REFRESH_LOCK = STORE_SESSION_KEYS.refresh;
6396
6416
  function createStoreSession(options) {
6397
- const { baseUrl, clientId, storage } = options;
6417
+ const { baseUrl, clientId, storage, authServer } = options;
6418
+ const { revokeUrl, tokenUrl, resource } = authServer;
6398
6419
  const fetchFn = options.fetch ?? globalThis.fetch;
6399
6420
  const listeners = /* @__PURE__ */ new Set();
6400
6421
  function notify() {
@@ -6415,7 +6436,7 @@ function createStoreSession(options) {
6415
6436
  }
6416
6437
  /** RFC 7009 — 무효 토큰이어도 200이다. 실패는 호출부가 무시한다. 응답이 늦어도 로그아웃이 멈추지 않게 5초로 끊는다 */
6417
6438
  async function revokeToken(token) {
6418
- await fetchFn(`${baseUrl}/oauth2/revoke`, {
6439
+ await fetchFn(revokeUrl, {
6419
6440
  method: "POST",
6420
6441
  headers: { "content-type": "application/x-www-form-urlencoded" },
6421
6442
  body: new URLSearchParams({
@@ -6455,9 +6476,10 @@ function createStoreSession(options) {
6455
6476
  if (!refreshToken) return false;
6456
6477
  try {
6457
6478
  const tokens = await refreshUserToken({
6458
- baseUrl,
6459
6479
  clientId,
6460
6480
  refreshToken,
6481
+ tokenUrl,
6482
+ resource,
6461
6483
  fetch: fetchFn
6462
6484
  });
6463
6485
  setTokens({
@@ -6492,16 +6514,16 @@ function createStoreSession(options) {
6492
6514
  redirectUri: authorizeOptions.redirectUri
6493
6515
  };
6494
6516
  storage.set(STORE_SESSION_KEYS.pkce, JSON.stringify(blob));
6495
- const url = new URL(buildAuthorizeUrl({
6496
- baseUrl,
6517
+ const finalUrl = buildAuthorizeUrl({
6518
+ authorizeUrl: authServer.authorizeUrl,
6497
6519
  clientId,
6498
6520
  redirectUri: authorizeOptions.redirectUri,
6499
6521
  state,
6500
6522
  codeChallenge: challenge,
6501
- scope: authorizeOptions.scope
6502
- }));
6503
- if (authorizeOptions.screen === "signup") url.pathname = url.pathname.replace(/\/oauth2\/authorize$/, "/oauth2/signup");
6504
- const finalUrl = url.toString();
6523
+ scope: authorizeOptions.scope,
6524
+ resource,
6525
+ prompt: authorizeOptions.prompt
6526
+ });
6505
6527
  if (typeof window !== "undefined") {
6506
6528
  window.location.assign(finalUrl);
6507
6529
  return;
@@ -6515,11 +6537,12 @@ function createStoreSession(options) {
6515
6537
  const saved = JSON.parse(raw);
6516
6538
  if (saved.state !== state) throw new Error("state가 일치하지 않습니다. 다시 시도해주십시오");
6517
6539
  const tokens = await exchangeAuthorizationCode({
6518
- baseUrl,
6519
6540
  clientId,
6520
6541
  redirectUri: saved.redirectUri,
6521
6542
  code,
6522
6543
  codeVerifier: saved.verifier,
6544
+ tokenUrl,
6545
+ resource,
6523
6546
  fetch: fetchFn
6524
6547
  });
6525
6548
  setTokens({
@@ -6554,4 +6577,4 @@ function createStoreSession(options) {
6554
6577
  };
6555
6578
  }
6556
6579
  //#endregion
6557
- export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, CASH_RECEIPT_STATUS_VALUES, COUPON_CODE_PATTERN, COUPON_CONDITIONS_DEFAULTS, COUPON_TARGET_ALL, COUPON_TARGET_LIST_MAX, CUSTOM_INPUT_FORBIDDEN_WORDS, FULFILLMENT_RULES, MAX_ADDON_GROUPS, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_CUSTOM_INPUTS, MAX_CUSTOM_INPUT_LENGTH, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_SAVED_OPTION_SETS, MAX_SAVED_OPTION_SET_NAME, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, MIN_PAYMENT_AMOUNT, NO_COUPON_SETTLEMENT, NO_SHIPPING_BUNDLE_KEY, PAYMENT_ROUTING_EXCLUSION_CODES, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REFUND_POLICY_DELIVERY_FEE_KEYS, REMOTE_AREA_ZIP_RANGES, RESERVED_STOREFRONT_SLUGS, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, STOREFRONT_BLOCKED_PATH_SEGMENTS, STOREFRONT_BUILD_STAGES, STOREFRONT_BUILD_TERMINAL_STATUSES, STOREFRONT_CHECK_TERMINAL_STATUSES, STOREFRONT_CUSTOM_DOMAIN_LIMIT_DEFAULT, STOREFRONT_DOMAIN_DNS_GRACE_DAYS, STOREFRONT_DOMAIN_DNS_WAIT_DAYS, STOREFRONT_DOMAIN_TXT_LABEL, STOREFRONT_EDIT_ACTIVITY_TIMEOUT_MINUTES, STOREFRONT_EDIT_CAPACITY, STOREFRONT_EDIT_IDLE_MINUTES, STOREFRONT_EDIT_PREVIEW_SUFFIX, STOREFRONT_EDIT_START_STAGES, STOREFRONT_FILE_BATCH_MAX, STOREFRONT_FILE_MAX_BYTES, STOREFRONT_PATH_SEGMENT_PATTERN, STOREFRONT_PLATFORM_DOMAINS, STOREFRONT_PUBLIC_SUFFIXES, STOREFRONT_SEARCH_REGEX_MAX_LENGTH, STOREFRONT_SITE_CREATE_LIMIT, STOREFRONT_SLUG_CHANGE_LIMIT, STOREFRONT_SLUG_CHANGE_WINDOW_DAYS, STOREFRONT_SLUG_HOLD_DAYS, STOREFRONT_SLUG_PATTERN, STOREFRONT_SOURCE_BLOB_BATCH_MAX, STOREFRONT_SOURCE_PART_BYTES, STOREFRONT_WORKSPACE_MAX_BYTES, STOREFRONT_WORKSPACE_MAX_FILES, STORE_CODE_PATTERN, STORE_ROLE_SCOPES, STORE_SCOPE_RESOURCES, STORE_SESSION_KEYS, TOSS_WIDGET_CLIENT_KEY_PATTERN, TOSS_WIDGET_KEY_MESSAGE, TOSS_WIDGET_SECRET_KEY_PATTERN, UPLOAD_PURPOSE_LIMITS, VARIANT_COUNT_WARNING, VARIANT_STOCK_EXCLUSIVE_MESSAGE, WEBHOOK_DEFAULT_TOLERANCE_SEC, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_FAILURE_REASONS, WEBHOOK_HEADERS, WEBHOOK_PAYLOAD_EXCERPT_MAX_BYTES, WEBHOOK_RESOURCE_TYPES, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_USER_AGENT, addStorefrontDomainRequestSchema, addonGroupRequestSchema, addonGroupSchema, addonValueRequestSchema, addonValueSchema, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, allocateByWeight, analyticsChannelSchema, analyticsCheckoutOutcomeSchema, analyticsCheckoutSchema, analyticsDeviceRowSchema, analyticsDevicesSchema, analyticsFunnelStepSchema, analyticsOriginSchema, analyticsOverviewSchema, analyticsPagesQuerySchema, analyticsPagesSchema, analyticsProductRowSchema, analyticsProductSortSchema, analyticsProductsQuerySchema, analyticsProductsSchema, analyticsRangeQuerySchema, analyticsRealtimeSchema, analyticsSearchQuerySchema, analyticsSearchSchema, analyticsSourceGroupBySchema, analyticsSourceRowSchema, analyticsSourcesQuerySchema, analyticsSourcesSchema, analyticsTotalsSchema, apiClientListQuerySchema, apiClientSchema, apiClientSecretRotatedSchema, apiClientStatusSchema, apiClientTypeSchema, apiLogErrorSchema, apiLogListQuerySchema, apiLogPageSchema, apiLogPrincipalSchema, apiLogPrincipalTypeSchema, apiLogSchema, apiLogStatusFilterSchema, apiLogSummarySchema, apiTokenCreateRequestSchema, apiTokenCreatedSchema, apiTokenSchema, approvalDecisionRequestSchema, approvalListQuerySchema, approvalPageSchema, approvalRequestSchema, approvalStatusSchema, approveClaimResultSchema, auditActorSchema, auditActorTypeSchema, auditLogListQuerySchema, auditLogOutcomeSchema, auditLogPageSchema, auditLogSchema, auditLogSourceSchema, buildAuthorizeUrl, buildQuery, bulkResultSchema, cancelBySellerRequestSchema, cancelBySellerResultSchema, carrierSchema, cashReceiptSchema, categoryAttributeSchema, categoryCreateRequestSchema, categoryDeleteQuerySchema, categoryDeleteStrategySchema, categoryListQuerySchema, categoryPatchRequestSchema, categoryProductSortSchema, categorySchema, categorySearchResultSchema, categoryTreeNodeSchema, categoryWithPathSchema, changeStorefrontSlugRequestSchema, changeStorefrontTemplateRequestSchema, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, clientCredentialsTokenResponseSchema, consentActionSchema, consentKindSchema, consentSourceSchema, couponBenefitSchema, couponConditionsInputSchema, couponConditionsSchema, couponDiscountOf, couponIssueListQuerySchema, couponIssueMethodSchema, couponIssueSchema, couponIssueStatusSchema, couponKindSchema, couponListQuerySchema, couponRedemptionListQuerySchema, couponRedemptionSchema, couponRejectReasonSchema, couponRuleSchema, couponSchema, couponStatsSchema, couponStatusSchema, couponTargetInputSchema, couponTargetSchema, createCouponRequestSchema, createPkcePair, createStoreClient, createStoreSession, createStorefrontEditPreviewLinkRequestSchema, createStorefrontPreviewLinkRequestSchema, createStorefrontSiteRequestSchema, createStorefrontVersionRequestSchema, customInputLabelForbiddenWord, customInputRequestSchema, customInputSchema, customInputValueSchema, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerCouponSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deleteStorefrontFileRequestSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, disableStorefrontHostingRequestSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, exchangeStoreTokenViaOAuth, fulfillBulkRequestSchema, fulfillRequestSchema, fulfillmentRuleOf, fulfillmentTypeOf, fulfillmentTypeResponseSchema, fulfillmentTypeSchema, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationDeliveryStatusSchema, invitationListQuerySchema, invitationSchema, inviteMemberRequestSchema, isCouponTargetLine, isEditableStorefrontPath, isReservedStoreCode, isReservedStorefrontSlug, isStoreScope, isWebOrigin, issueCouponRequestSchema, issueCouponResultSchema, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, mcpRuleResultSchema, mcpToolEventSchema, moveStorefrontFileRequestSchema, myAccountSchema, myStoreSchema, normalizeCouponCode, normalizeStorefrontHostname, normalizeStorefrontPath, oauthClientRegistrationRequestSchema, oauthClientRegistrationResponseSchema, oauthTokenResponseSchema, openFulfillmentUnion, optionGroupKindSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionSelectionSchema, optionSortSchema, optionValueRequestSchema, optionValueSchema, orderCanceledWebhookEventDataSchema, orderCanceledWebhookEventSchema, orderDiscountSchema, orderFulfilledWebhookEventDataSchema, orderFulfilledWebhookEventSchema, orderItemFulfillmentSchema, orderItemFulfillmentSnapshotResponseSchema, orderItemFulfillmentSnapshotSchema, orderItemListQuerySchema, orderItemMemoResultSchema, orderItemPageSchema, orderItemSchema, orderItemStatusSchema, orderListQuerySchema, orderSchema, orderSummaryPageSchema, orderSummarySchema, orderWebhookEventDataSchema, orderWebhookEventSchema, pageInfoSchema, pageQueryShape, pageSchema, paymentAttemptRecordSchema, paymentAttemptStatusSchema, paymentCredentialSetSchema, paymentListQuerySchema, paymentProviderSchema, paymentProviderVerificationSchema, paymentRecordDetailSchema, paymentRecordPageSchema, paymentRecordSchema, paymentRecordStatusSchema, paymentRefundRecordSchema, paymentSettingsSchema, pgEnvironmentSchema, pgPaymentMethodSchema, pgProviderSchema, pgVerificationResultSchema, policyDocumentUrlSchema, policyVersionSchema, portOneChannelSchema, portOneCredentialsInputSchema, productCreateRequestSchema, productFulfillmentCreateSchema, productFulfillmentResponseSchema, productFulfillmentSchema, productFulfillmentUpdateSchema, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productRefundPolicyPatchSchema, productReplaceRequestSchema, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedPaidRefundBase, proratedRefundBase, publishStorefrontVersionRequestSchema, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, quoteDelivery, quotePricing, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, replaceStorefrontSourceRequestSchema, requiresCollection, requiresShipping, resolveRefundPolicy, resolveShippingPolicy, reviewListQuerySchema, reviewReportResultSchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, rollbackStorefrontRequestSchema, runStorefrontCheckRequestSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, savedCustomInputRequestSchema, savedCustomInputSchema, savedOptionGroupRequestSchema, savedOptionGroupSchema, savedOptionSetCompositionSchema, savedOptionSetFromProductRequestSchema, savedOptionSetFromProductResultSchema, savedOptionSetListQuerySchema, savedOptionSetRequestSchema, savedOptionSetSchema, savedOptionSetSortSchema, savedOptionValueRequestSchema, savedOptionValueSchema, scopeAccessSchema, searchStorefrontFilesRequestSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, setStorefrontVisibilityRequestSchema, settleCouponShortfall, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeTokenResponseSchema, storefrontBuildDependenciesSchema, storefrontBuildListQuerySchema, storefrontBuildSchema, storefrontBuildStatusSchema, storefrontCheckSchema, storefrontCheckStatusSchema, storefrontCustomDomainStatusSchema, storefrontCustomHostnameProblem, storefrontDependencyFindingSchema, storefrontDeploymentLogSchema, storefrontDeploymentSchema, storefrontDeploymentStepSchema, storefrontDnsRecordSchema, storefrontDomainSchema, storefrontDomainTxtNameOf, storefrontEditPreviewLabelOf, storefrontEditPreviewSchema, storefrontEditSessionSchema, storefrontEditSessionStatusSchema, storefrontEditingSchema, storefrontFileConflictDetailsSchema, storefrontFileContentQuerySchema, storefrontFileContentSchema, storefrontFileDeleteResultSchema, storefrontFileEncodingSchema, storefrontFileEntrySchema, storefrontFileHashSchema, storefrontFileListQuerySchema, storefrontFileListSchema, storefrontFileMoveResultSchema, storefrontFilePathSchema, storefrontFileSearchResultSchema, storefrontFileWriteResultSchema, storefrontHostingSchema, storefrontPreviewLinkSchema, storefrontProvisioningSchema, storefrontRuleResultSchema, storefrontRuleSeveritySchema, storefrontSiteDomainSchema, storefrontSiteDomainsSchema, storefrontSiteSchema, storefrontSiteStatusSchema, storefrontSlugAvailabilityQuerySchema, storefrontSlugAvailabilitySchema, storefrontSlugSchema, storefrontSourceArchivePartSchema, storefrontSourceArchiveQuerySchema, storefrontSourceBlobsResultSchema, storefrontSourceModeSchema, storefrontSourceRefSchema, storefrontSourceReplacedSchema, storefrontSourceSchema, storefrontSuspensionSchema, storefrontTemplateSchema, storefrontVerifyReportSchema, storefrontVersionCreatedSchema, storefrontVersionSchema, storefrontVersionStatusSchema, storefrontVisibilitySchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateCouponRequestSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updateMemberRoleRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, uploadStorefrontSourceBlobsRequestSchema, uploadTicketSchema, upsertPortOneProviderRequestSchema, upsertTossPaymentsProviderRequestSchema, userTokenResponseSchema, variantStockRequestSchema, variantStockSchema, verifyPaymentProviderRequestSchema, webhookCreatedSchema, webhookDeliveryDetailSchema, webhookDeliveryErrorCodeSchema, webhookDeliveryListQuerySchema, webhookDeliveryResourceSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEventSchema, webhookFailureReasonSchema, webhookRedeliverFailedResultSchema, webhookRequestHeaderSchema, webhookRequestSchema, webhookResourceTypeSchema, webhookSchema, webhookSecretRotatedSchema, webhookStatusSchema, webhookTestRequestSchema, webhookTestResultSchema, withdrawCustomerRequestSchema, writeDryRunResultSchema, writePreviewSchema, writeStorefrontFilesRequestSchema };
6580
+ export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, CASH_RECEIPT_STATUS_VALUES, COUPON_CODE_PATTERN, COUPON_CONDITIONS_DEFAULTS, COUPON_TARGET_ALL, COUPON_TARGET_LIST_MAX, CUSTOM_INPUT_FORBIDDEN_WORDS, FULFILLMENT_RULES, MAX_ADDON_GROUPS, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_CUSTOM_INPUTS, MAX_CUSTOM_INPUT_LENGTH, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_SAVED_OPTION_SETS, MAX_SAVED_OPTION_SET_NAME, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, MIN_PAYMENT_AMOUNT, NO_COUPON_SETTLEMENT, NO_SHIPPING_BUNDLE_KEY, PAYMENT_ROUTING_EXCLUSION_CODES, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REFUND_POLICY_DELIVERY_FEE_KEYS, REMOTE_AREA_ZIP_RANGES, RESERVED_STOREFRONT_SLUGS, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, STOREFRONT_BLOCKED_PATH_SEGMENTS, STOREFRONT_BUILD_STAGES, STOREFRONT_BUILD_TERMINAL_STATUSES, STOREFRONT_CHECK_TERMINAL_STATUSES, STOREFRONT_CUSTOM_DOMAIN_LIMIT_DEFAULT, STOREFRONT_DOMAIN_DNS_GRACE_DAYS, STOREFRONT_DOMAIN_DNS_WAIT_DAYS, STOREFRONT_DOMAIN_TXT_LABEL, STOREFRONT_EDIT_ACTIVITY_TIMEOUT_MINUTES, STOREFRONT_EDIT_CAPACITY, STOREFRONT_EDIT_IDLE_MINUTES, STOREFRONT_EDIT_PREVIEW_SUFFIX, STOREFRONT_EDIT_START_STAGES, STOREFRONT_FILE_BATCH_MAX, STOREFRONT_FILE_MAX_BYTES, STOREFRONT_PATH_SEGMENT_PATTERN, STOREFRONT_PLATFORM_DOMAINS, STOREFRONT_PUBLIC_SUFFIXES, STOREFRONT_SEARCH_REGEX_MAX_LENGTH, STOREFRONT_SHOWCASE_SLUG_PREFIX, STOREFRONT_SITE_CREATE_LIMIT, STOREFRONT_SLUG_CHANGE_LIMIT, STOREFRONT_SLUG_CHANGE_WINDOW_DAYS, STOREFRONT_SLUG_HOLD_DAYS, STOREFRONT_SLUG_PATTERN, STOREFRONT_SOURCE_BLOB_BATCH_MAX, STOREFRONT_SOURCE_PART_BYTES, STOREFRONT_WORKSPACE_MAX_BYTES, STOREFRONT_WORKSPACE_MAX_FILES, STORE_CODE_PATTERN, STORE_ROLE_SCOPES, STORE_SCOPE_RESOURCES, STORE_SESSION_KEYS, TOSS_WIDGET_CLIENT_KEY_PATTERN, TOSS_WIDGET_KEY_MESSAGE, TOSS_WIDGET_SECRET_KEY_PATTERN, UPLOAD_PURPOSE_LIMITS, VARIANT_COUNT_WARNING, VARIANT_STOCK_EXCLUSIVE_MESSAGE, WEBHOOK_DEFAULT_TOLERANCE_SEC, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_FAILURE_REASONS, WEBHOOK_HEADERS, WEBHOOK_PAYLOAD_EXCERPT_MAX_BYTES, WEBHOOK_RESOURCE_TYPES, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_USER_AGENT, addStorefrontDomainRequestSchema, addonGroupRequestSchema, addonGroupSchema, addonValueRequestSchema, addonValueSchema, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, allocateByWeight, analyticsChannelSchema, analyticsCheckoutOutcomeSchema, analyticsCheckoutSchema, analyticsDeviceRowSchema, analyticsDevicesSchema, analyticsFunnelStepSchema, analyticsOriginSchema, analyticsOverviewSchema, analyticsPagesQuerySchema, analyticsPagesSchema, analyticsProductRowSchema, analyticsProductSortSchema, analyticsProductsQuerySchema, analyticsProductsSchema, analyticsRangeQuerySchema, analyticsRealtimeSchema, analyticsSearchQuerySchema, analyticsSearchSchema, analyticsSourceGroupBySchema, analyticsSourceRowSchema, analyticsSourcesQuerySchema, analyticsSourcesSchema, analyticsTotalsSchema, apiLogErrorSchema, apiLogListQuerySchema, apiLogPageSchema, apiLogPrincipalSchema, apiLogPrincipalTypeSchema, apiLogSchema, apiLogStatusFilterSchema, apiLogSummarySchema, approvalDecisionRequestSchema, approvalListQuerySchema, approvalPageSchema, approvalRequestSchema, approvalStatusSchema, approveClaimResultSchema, auditActorSchema, auditActorTypeSchema, auditLogListQuerySchema, auditLogOutcomeSchema, auditLogPageSchema, auditLogSchema, auditLogSourceSchema, buildAuthorizeUrl, buildQuery, bulkResultSchema, cancelBySellerRequestSchema, cancelBySellerResultSchema, carrierSchema, cashReceiptSchema, categoryAttributeSchema, categoryCreateRequestSchema, categoryDeleteQuerySchema, categoryDeleteStrategySchema, categoryListQuerySchema, categoryPatchRequestSchema, categoryProductSortSchema, categorySchema, categorySearchResultSchema, categoryTreeNodeSchema, categoryWithPathSchema, changeStorefrontSlugRequestSchema, changeStorefrontTemplateRequestSchema, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, consentActionSchema, consentKindSchema, consentSourceSchema, couponBenefitSchema, couponConditionsInputSchema, couponConditionsSchema, couponDiscountOf, couponIssueListQuerySchema, couponIssueMethodSchema, couponIssueSchema, couponIssueStatusSchema, couponKindSchema, couponListQuerySchema, couponRedemptionListQuerySchema, couponRedemptionSchema, couponRejectReasonSchema, couponRuleSchema, couponSchema, couponStatsSchema, couponStatusSchema, couponTargetInputSchema, couponTargetSchema, createCouponRequestSchema, createPkcePair, createStoreClient, createStoreSession, createStorefrontEditPreviewLinkRequestSchema, createStorefrontPreviewLinkRequestSchema, createStorefrontSiteRequestSchema, createStorefrontVersionRequestSchema, customInputLabelForbiddenWord, customInputRequestSchema, customInputSchema, customInputValueSchema, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerCouponSchema, customerDelegationRequestSchema, customerDelegationSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deleteStorefrontFileRequestSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, disableStorefrontHostingRequestSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, fulfillBulkRequestSchema, fulfillRequestSchema, fulfillmentRuleOf, fulfillmentTypeOf, fulfillmentTypeResponseSchema, fulfillmentTypeSchema, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationDeliveryStatusSchema, invitationListQuerySchema, invitationSchema, inviteMemberRequestSchema, isCouponTargetLine, isEditableStorefrontPath, isReservedStoreCode, isReservedStorefrontSlug, isShowcaseStorefrontSlug, isStoreScope, isWebOrigin, issueCouponRequestSchema, issueCouponResultSchema, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, mcpRuleResultSchema, mcpToolEventSchema, moveStorefrontFileRequestSchema, myAccountSchema, myStoreSchema, normalizeCouponCode, normalizeStorefrontHostname, normalizeStorefrontPath, oauthTokenResponseSchema, openFulfillmentUnion, optionGroupKindSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionSelectionSchema, optionSortSchema, optionValueRequestSchema, optionValueSchema, orderCanceledWebhookEventDataSchema, orderCanceledWebhookEventSchema, orderDiscountSchema, orderFulfilledWebhookEventDataSchema, orderFulfilledWebhookEventSchema, orderItemFulfillmentSchema, orderItemFulfillmentSnapshotResponseSchema, orderItemFulfillmentSnapshotSchema, orderItemListQuerySchema, orderItemMemoResultSchema, orderItemPageSchema, orderItemSchema, orderItemStatusSchema, orderListQuerySchema, orderSchema, orderSummaryPageSchema, orderSummarySchema, orderWebhookEventDataSchema, orderWebhookEventSchema, pageInfoSchema, pageQueryShape, pageSchema, paymentAttemptRecordSchema, paymentAttemptStatusSchema, paymentCredentialSetSchema, paymentListQuerySchema, paymentProviderSchema, paymentProviderVerificationSchema, paymentRecordDetailSchema, paymentRecordPageSchema, paymentRecordSchema, paymentRecordStatusSchema, paymentRefundRecordSchema, paymentSettingsSchema, pgEnvironmentSchema, pgPaymentMethodSchema, pgProviderSchema, pgVerificationResultSchema, planCodeSchema, planEntitlementsSchema, planErrorDetailsSchema, policyDocumentUrlSchema, policyVersionSchema, portOneChannelSchema, portOneCredentialsInputSchema, productCreateRequestSchema, productFulfillmentCreateSchema, productFulfillmentResponseSchema, productFulfillmentSchema, productFulfillmentUpdateSchema, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productRefundPolicyPatchSchema, productReplaceRequestSchema, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedPaidRefundBase, proratedRefundBase, publicPlanSchema, publicPlansSchema, publishStorefrontVersionRequestSchema, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, quoteDelivery, quotePricing, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, replaceStorefrontSourceRequestSchema, requiresCollection, requiresShipping, resolveRefundPolicy, resolveShippingPolicy, responsePlanCodeSchema, reviewListQuerySchema, reviewReportResultSchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, rollbackStorefrontRequestSchema, runStorefrontCheckRequestSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, savedCustomInputRequestSchema, savedCustomInputSchema, savedOptionGroupRequestSchema, savedOptionGroupSchema, savedOptionSetCompositionSchema, savedOptionSetFromProductRequestSchema, savedOptionSetFromProductResultSchema, savedOptionSetListQuerySchema, savedOptionSetRequestSchema, savedOptionSetSchema, savedOptionSetSortSchema, savedOptionValueRequestSchema, savedOptionValueSchema, scopeAccessSchema, searchStorefrontFilesRequestSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, setStorefrontVisibilityRequestSchema, settleCouponShortfall, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeSubscriptionSchema, storefrontBuildDependenciesSchema, storefrontBuildListQuerySchema, storefrontBuildSchema, storefrontBuildStatusSchema, storefrontCheckSchema, storefrontCheckStatusSchema, storefrontCustomDomainStatusSchema, storefrontCustomHostnameProblem, storefrontDependencyFindingSchema, storefrontDeploymentLogSchema, storefrontDeploymentSchema, storefrontDeploymentStepSchema, storefrontDnsRecordSchema, storefrontDomainSchema, storefrontDomainTxtNameOf, storefrontEditPreviewLabelOf, storefrontEditPreviewSchema, storefrontEditSessionSchema, storefrontEditSessionStatusSchema, storefrontEditingSchema, storefrontFileConflictDetailsSchema, storefrontFileContentQuerySchema, storefrontFileContentSchema, storefrontFileDeleteResultSchema, storefrontFileEncodingSchema, storefrontFileEntrySchema, storefrontFileHashSchema, storefrontFileListQuerySchema, storefrontFileListSchema, storefrontFileMoveResultSchema, storefrontFilePathSchema, storefrontFileSearchResultSchema, storefrontFileWriteResultSchema, storefrontHostingSchema, storefrontPreviewLinkSchema, storefrontProvisioningSchema, storefrontRuleResultSchema, storefrontRuleSeveritySchema, storefrontSiteDomainSchema, storefrontSiteDomainsSchema, storefrontSiteSchema, storefrontSiteStatusSchema, storefrontSlugAvailabilityQuerySchema, storefrontSlugAvailabilitySchema, storefrontSlugSchema, storefrontSourceArchivePartSchema, storefrontSourceArchiveQuerySchema, storefrontSourceBlobsResultSchema, storefrontSourceModeSchema, storefrontSourceRefSchema, storefrontSourceReplacedSchema, storefrontSourceSchema, storefrontSuspensionSchema, storefrontTemplateSchema, storefrontVerifyReportSchema, storefrontVersionCreatedSchema, storefrontVersionSchema, storefrontVersionStatusSchema, storefrontVisibilitySchema, subscriptionLimitsSchema, subscriptionStatusSchema, subscriptionUsageSchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateCouponRequestSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updateMemberRoleRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, uploadStorefrontSourceBlobsRequestSchema, uploadTicketSchema, upsertPortOneProviderRequestSchema, upsertTossPaymentsProviderRequestSchema, variantStockRequestSchema, variantStockSchema, verifyPaymentProviderRequestSchema, webhookCreatedSchema, webhookDeliveryDetailSchema, webhookDeliveryErrorCodeSchema, webhookDeliveryListQuerySchema, webhookDeliveryResourceSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEventSchema, webhookFailureReasonSchema, webhookRedeliverFailedResultSchema, webhookRequestHeaderSchema, webhookRequestSchema, webhookResourceTypeSchema, webhookSchema, webhookSecretRotatedSchema, webhookStatusSchema, webhookTestRequestSchema, webhookTestResultSchema, withdrawCustomerRequestSchema, writeDryRunResultSchema, writePreviewSchema, writeStorefrontFilesRequestSchema };