@sayren/store-sdk 0.14.1 → 0.15.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
@@ -1073,9 +1073,9 @@ export type ApiLogSummary = z.infer<typeof apiLogSummarySchema>;
1073
1073
  //#endregion
1074
1074
  //#region src/schemas/auth.d.ts
1075
1075
  export declare const storeRoleSchema: z.ZodEnum<{
1076
- OWNER: "OWNER";
1077
1076
  ADMIN: "ADMIN";
1078
1077
  STAFF: "STAFF";
1078
+ OWNER: "OWNER";
1079
1079
  }>;
1080
1080
  export type StoreRole = z.infer<typeof storeRoleSchema>;
1081
1081
  export declare const userTokenResponseSchema: z.ZodObject<{
@@ -1099,9 +1099,9 @@ export declare const storeTokenResponseSchema: z.ZodObject<{
1099
1099
  expires_in: z.ZodNumber;
1100
1100
  storeId: z.ZodString;
1101
1101
  role: z.ZodEnum<{
1102
- OWNER: "OWNER";
1103
1102
  ADMIN: "ADMIN";
1104
1103
  STAFF: "STAFF";
1104
+ OWNER: "OWNER";
1105
1105
  }>;
1106
1106
  scopes: z.ZodArray<z.ZodString>;
1107
1107
  }, z.core.$strip>;
@@ -1111,9 +1111,9 @@ export declare const myStoreSchema: z.ZodObject<{
1111
1111
  storeName: z.ZodString;
1112
1112
  storeCode: z.ZodString;
1113
1113
  role: z.ZodEnum<{
1114
- OWNER: "OWNER";
1115
1114
  ADMIN: "ADMIN";
1116
1115
  STAFF: "STAFF";
1116
+ OWNER: "OWNER";
1117
1117
  }>;
1118
1118
  status: z.ZodEnum<{
1119
1119
  ACTIVE: "ACTIVE";
@@ -1438,13 +1438,13 @@ export declare const bulkResultSchema: z.ZodObject<{
1438
1438
  export type BulkResult = z.infer<typeof bulkResultSchema>;
1439
1439
  export declare const orderItemStatusSchema: z.ZodEnum<{
1440
1440
  PAID: "PAID";
1441
+ CANCELED: "CANCELED";
1441
1442
  PAYMENT_WAITING: "PAYMENT_WAITING";
1442
1443
  CONFIRMED: "CONFIRMED";
1443
1444
  DISPATCHED: "DISPATCHED";
1444
1445
  DELIVERING: "DELIVERING";
1445
1446
  DELIVERED: "DELIVERED";
1446
1447
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
1447
- CANCELED: "CANCELED";
1448
1448
  }>;
1449
1449
  export type OrderItemStatus = z.infer<typeof orderItemStatusSchema>;
1450
1450
  export declare const changeTypeSchema: z.ZodEnum<{
@@ -1975,13 +1975,13 @@ export declare const customerOrderSchema: z.ZodObject<{
1975
1975
  quantity: z.ZodNumber;
1976
1976
  status: z.ZodEnum<{
1977
1977
  PAID: "PAID";
1978
+ CANCELED: "CANCELED";
1978
1979
  PAYMENT_WAITING: "PAYMENT_WAITING";
1979
1980
  CONFIRMED: "CONFIRMED";
1980
1981
  DISPATCHED: "DISPATCHED";
1981
1982
  DELIVERING: "DELIVERING";
1982
1983
  DELIVERED: "DELIVERED";
1983
1984
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
1984
- CANCELED: "CANCELED";
1985
1985
  }>;
1986
1986
  claimStatus: z.ZodNullable<z.ZodEnum<{
1987
1987
  CANCEL_REQUESTED: "CANCEL_REQUESTED";
@@ -2664,13 +2664,13 @@ export declare const orderSummarySchema: z.ZodObject<{
2664
2664
  totalAmount: z.ZodNumber;
2665
2665
  representativeStatus: z.ZodEnum<{
2666
2666
  PAID: "PAID";
2667
+ CANCELED: "CANCELED";
2667
2668
  PAYMENT_WAITING: "PAYMENT_WAITING";
2668
2669
  CONFIRMED: "CONFIRMED";
2669
2670
  DISPATCHED: "DISPATCHED";
2670
2671
  DELIVERING: "DELIVERING";
2671
2672
  DELIVERED: "DELIVERED";
2672
2673
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
2673
- CANCELED: "CANCELED";
2674
2674
  }>;
2675
2675
  orderedAt: z.ZodString;
2676
2676
  testPayment: z.ZodBoolean;
@@ -2691,13 +2691,13 @@ export declare const orderItemSchema: z.ZodObject<{
2691
2691
  orderId: z.ZodString;
2692
2692
  status: z.ZodEnum<{
2693
2693
  PAID: "PAID";
2694
+ CANCELED: "CANCELED";
2694
2695
  PAYMENT_WAITING: "PAYMENT_WAITING";
2695
2696
  CONFIRMED: "CONFIRMED";
2696
2697
  DISPATCHED: "DISPATCHED";
2697
2698
  DELIVERING: "DELIVERING";
2698
2699
  DELIVERED: "DELIVERED";
2699
2700
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
2700
- CANCELED: "CANCELED";
2701
2701
  }>;
2702
2702
  claimStatus: z.ZodNullable<z.ZodEnum<{
2703
2703
  CANCEL_REQUESTED: "CANCEL_REQUESTED";
@@ -2800,13 +2800,13 @@ export declare const orderSchema: z.ZodObject<{
2800
2800
  orderId: z.ZodString;
2801
2801
  status: z.ZodEnum<{
2802
2802
  PAID: "PAID";
2803
+ CANCELED: "CANCELED";
2803
2804
  PAYMENT_WAITING: "PAYMENT_WAITING";
2804
2805
  CONFIRMED: "CONFIRMED";
2805
2806
  DISPATCHED: "DISPATCHED";
2806
2807
  DELIVERING: "DELIVERING";
2807
2808
  DELIVERED: "DELIVERED";
2808
2809
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
2809
- CANCELED: "CANCELED";
2810
2810
  }>;
2811
2811
  claimStatus: z.ZodNullable<z.ZodEnum<{
2812
2812
  CANCEL_REQUESTED: "CANCEL_REQUESTED";
@@ -2861,13 +2861,13 @@ export declare const orderSummaryPageSchema: z.ZodObject<{
2861
2861
  totalAmount: z.ZodNumber;
2862
2862
  representativeStatus: z.ZodEnum<{
2863
2863
  PAID: "PAID";
2864
+ CANCELED: "CANCELED";
2864
2865
  PAYMENT_WAITING: "PAYMENT_WAITING";
2865
2866
  CONFIRMED: "CONFIRMED";
2866
2867
  DISPATCHED: "DISPATCHED";
2867
2868
  DELIVERING: "DELIVERING";
2868
2869
  DELIVERED: "DELIVERED";
2869
2870
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
2870
- CANCELED: "CANCELED";
2871
2871
  }>;
2872
2872
  orderedAt: z.ZodString;
2873
2873
  testPayment: z.ZodBoolean;
@@ -2885,13 +2885,13 @@ export declare const orderItemPageSchema: z.ZodObject<{
2885
2885
  orderId: z.ZodString;
2886
2886
  status: z.ZodEnum<{
2887
2887
  PAID: "PAID";
2888
+ CANCELED: "CANCELED";
2888
2889
  PAYMENT_WAITING: "PAYMENT_WAITING";
2889
2890
  CONFIRMED: "CONFIRMED";
2890
2891
  DISPATCHED: "DISPATCHED";
2891
2892
  DELIVERING: "DELIVERING";
2892
2893
  DELIVERED: "DELIVERED";
2893
2894
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
2894
- CANCELED: "CANCELED";
2895
2895
  }>;
2896
2896
  claimStatus: z.ZodNullable<z.ZodEnum<{
2897
2897
  CANCEL_REQUESTED: "CANCEL_REQUESTED";
@@ -2945,13 +2945,13 @@ export declare const orderListQuerySchema: z.ZodObject<{
2945
2945
  orderedTo: z.ZodOptional<z.ZodString>;
2946
2946
  status: z.ZodOptional<z.ZodEnum<{
2947
2947
  PAID: "PAID";
2948
+ CANCELED: "CANCELED";
2948
2949
  PAYMENT_WAITING: "PAYMENT_WAITING";
2949
2950
  CONFIRMED: "CONFIRMED";
2950
2951
  DISPATCHED: "DISPATCHED";
2951
2952
  DELIVERING: "DELIVERING";
2952
2953
  DELIVERED: "DELIVERED";
2953
2954
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
2954
- CANCELED: "CANCELED";
2955
2955
  }>>;
2956
2956
  keyword: z.ZodOptional<z.ZodString>;
2957
2957
  testPayment: z.ZodOptional<z.ZodEnum<{
@@ -4656,14 +4656,25 @@ export declare const storeMemberSchema: z.ZodObject<{
4656
4656
  name: z.ZodString;
4657
4657
  email: z.ZodEmail;
4658
4658
  role: z.ZodEnum<{
4659
- OWNER: "OWNER";
4660
4659
  ADMIN: "ADMIN";
4661
4660
  STAFF: "STAFF";
4661
+ OWNER: "OWNER";
4662
4662
  }>;
4663
4663
  joinedAt: z.ZodString;
4664
4664
  lastActiveAt: z.ZodNullable<z.ZodString>;
4665
4665
  }, z.core.$strip>;
4666
4666
  export type StoreMember = z.infer<typeof storeMemberSchema>;
4667
+ /**
4668
+ * 초대 메일 발송 결과 — `SENDING`은 발송 요청 중(결과를 아직 적지 못함), `NOT_CONFIGURED`는 메일 발송이 설정되지 않아
4669
+ * 보내지 않은 것이다. 발송 실패는 초대를 무효로 만들지 않는다 — 재발송으로 다시 보낸다
4670
+ */
4671
+ export declare const invitationDeliveryStatusSchema: z.ZodEnum<{
4672
+ FAILED: "FAILED";
4673
+ SENDING: "SENDING";
4674
+ SENT: "SENT";
4675
+ NOT_CONFIGURED: "NOT_CONFIGURED";
4676
+ }>;
4677
+ export type InvitationDeliveryStatus = z.infer<typeof invitationDeliveryStatusSchema>;
4667
4678
  export declare const invitationSchema: z.ZodObject<{
4668
4679
  invitationId: z.ZodString;
4669
4680
  email: z.ZodEmail;
@@ -4674,21 +4685,48 @@ export declare const invitationSchema: z.ZodObject<{
4674
4685
  status: z.ZodEnum<{
4675
4686
  PENDING: "PENDING";
4676
4687
  EXPIRED: "EXPIRED";
4677
- CANCELED: "CANCELED";
4678
4688
  ACCEPTED: "ACCEPTED";
4689
+ CANCELED: "CANCELED";
4679
4690
  }>;
4680
4691
  invitedBy: z.ZodString;
4681
4692
  expiresAt: z.ZodString;
4682
4693
  createdAt: z.ZodString;
4694
+ deliveryStatus: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
4695
+ FAILED: "FAILED";
4696
+ SENDING: "SENDING";
4697
+ SENT: "SENT";
4698
+ NOT_CONFIGURED: "NOT_CONFIGURED";
4699
+ }>>>;
4700
+ deliveryErrorCode: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4701
+ lastSentAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4702
+ sendCount: z.ZodDefault<z.ZodNumber>;
4703
+ acceptedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4683
4704
  }, z.core.$strip>;
4684
4705
  export type Invitation = z.infer<typeof invitationSchema>;
4706
+ /** `POST /v1/store/invitations` 요청 — ADMIN 초대는 OWNER만 할 수 있다 */
4707
+ export declare const inviteMemberRequestSchema: z.ZodObject<{
4708
+ email: z.ZodEmail;
4709
+ role: z.ZodEnum<{
4710
+ ADMIN: "ADMIN";
4711
+ STAFF: "STAFF";
4712
+ }>;
4713
+ }, z.core.$strip>;
4714
+ export type InviteMemberRequest = z.infer<typeof inviteMemberRequestSchema>;
4715
+ /** `PATCH /v1/store/members/{userId}` 요청 */
4716
+ export declare const updateMemberRoleRequestSchema: z.ZodObject<{
4717
+ role: z.ZodEnum<{
4718
+ ADMIN: "ADMIN";
4719
+ STAFF: "STAFF";
4720
+ }>;
4721
+ }, z.core.$strip>;
4722
+ export type UpdateMemberRoleRequest = z.infer<typeof updateMemberRoleRequestSchema>;
4685
4723
  /** `GET /v1/store/invitations` 쿼리 — OpenAPI 문서용 형태 */
4686
4724
  export declare const invitationListQuerySchema: z.ZodObject<{
4687
4725
  status: z.ZodOptional<z.ZodEnum<{
4688
4726
  PENDING: "PENDING";
4689
4727
  EXPIRED: "EXPIRED";
4690
- CANCELED: "CANCELED";
4691
4728
  ACCEPTED: "ACCEPTED";
4729
+ CANCELED: "CANCELED";
4692
4730
  }>>;
4693
4731
  }, z.core.$strip>;
4694
4732
  /** `PATCH /v1/store/members/{userId}` 응답 — 바뀐 역할 */
@@ -4942,7 +4980,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
4942
4980
  storeId: string;
4943
4981
  storeName: string;
4944
4982
  storeCode: string;
4945
- role: "OWNER" | "ADMIN" | "STAFF";
4983
+ role: "ADMIN" | "STAFF" | "OWNER";
4946
4984
  status: "ACTIVE" | "SUSPENDED" | "CLOSED";
4947
4985
  }[]>;
4948
4986
  /** RFC 7009 — token을 폐기한다 (public client는 client_id만 동반) */
@@ -5542,7 +5580,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5542
5580
  ordererName: string;
5543
5581
  itemCount: number;
5544
5582
  totalAmount: number;
5545
- representativeStatus: "PAID" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED" | "CANCELED";
5583
+ representativeStatus: "PAID" | "CANCELED" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED";
5546
5584
  orderedAt: string;
5547
5585
  testPayment: boolean;
5548
5586
  }[];
@@ -5597,7 +5635,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5597
5635
  items: {
5598
5636
  orderItemId: string;
5599
5637
  orderId: string;
5600
- status: "PAID" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED" | "CANCELED";
5638
+ status: "PAID" | "CANCELED" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED";
5601
5639
  claimStatus: "CANCEL_REQUESTED" | "RETURN_REQUESTED" | "EXCHANGE_REQUESTED" | null;
5602
5640
  productId: string;
5603
5641
  productName: string;
@@ -5656,7 +5694,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5656
5694
  contents: {
5657
5695
  orderItemId: string;
5658
5696
  orderId: string;
5659
- status: "PAID" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED" | "CANCELED";
5697
+ status: "PAID" | "CANCELED" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED";
5660
5698
  claimStatus: "CANCEL_REQUESTED" | "RETURN_REQUESTED" | "EXCHANGE_REQUESTED" | null;
5661
5699
  productId: string;
5662
5700
  productName: string;
@@ -5741,7 +5779,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5741
5779
  markDelivered: (orderItemId: string, idempotencyKey?: string) => Promise<{
5742
5780
  orderItemId: string;
5743
5781
  orderId: string;
5744
- status: "PAID" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED" | "CANCELED";
5782
+ status: "PAID" | "CANCELED" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED";
5745
5783
  claimStatus: "CANCEL_REQUESTED" | "RETURN_REQUESTED" | "EXCHANGE_REQUESTED" | null;
5746
5784
  productId: string;
5747
5785
  productName: string;
@@ -6191,7 +6229,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
6191
6229
  productName: string;
6192
6230
  optionName: string | null;
6193
6231
  quantity: number;
6194
- status: "PAID" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED" | "CANCELED";
6232
+ status: "PAID" | "CANCELED" | "PAYMENT_WAITING" | "CONFIRMED" | "DISPATCHED" | "DELIVERING" | "DELIVERED" | "PURCHASE_DECIDED";
6195
6233
  claimStatus: "CANCEL_REQUESTED" | "RETURN_REQUESTED" | "EXCHANGE_REQUESTED" | null;
6196
6234
  }[];
6197
6235
  }[];
@@ -7961,19 +7999,68 @@ export declare function createStoreClient(options: StoreClientOptions): {
7961
7999
  userId: string;
7962
8000
  name: string;
7963
8001
  email: string;
7964
- role: "OWNER" | "ADMIN" | "STAFF";
8002
+ role: "ADMIN" | "STAFF" | "OWNER";
7965
8003
  joinedAt: string;
7966
8004
  lastActiveAt: string | null;
7967
8005
  }[]>;
7968
- listInvitations: () => Promise<{
8006
+ /** `PATCH /v1/store/members/{userId}` — 스코프 `member:rw`. OWNER는 바꿀 수 없고 ADMIN 지정·ADMIN 변경은 OWNER만 한다 */
8007
+ updateMemberRole: (userId: string, body: UpdateMemberRoleRequest) => Promise<{
8008
+ userId: string;
8009
+ role: "ADMIN" | "STAFF";
8010
+ }>;
8011
+ /** `DELETE /v1/store/members/{userId}` (204) — OWNER는 내보낼 수 없고 ADMIN은 OWNER만 내보낸다 */
8012
+ removeMember: (userId: string) => Promise<void>;
8013
+ listInvitations: (params?: {
8014
+ status?: Invitation["status"];
8015
+ }) => Promise<{
7969
8016
  invitationId: string;
7970
8017
  email: string;
7971
8018
  role: "ADMIN" | "STAFF";
7972
- status: "PENDING" | "EXPIRED" | "CANCELED" | "ACCEPTED";
8019
+ status: "PENDING" | "EXPIRED" | "ACCEPTED" | "CANCELED";
7973
8020
  invitedBy: string;
7974
8021
  expiresAt: string;
7975
8022
  createdAt: string;
8023
+ deliveryStatus: "FAILED" | "SENDING" | "SENT" | "NOT_CONFIGURED" | null;
8024
+ deliveryErrorCode: string | null;
8025
+ lastSentAt: string | null;
8026
+ sendCount: number;
8027
+ acceptedAt: string | null;
7976
8028
  }[]>;
8029
+ /**
8030
+ * `POST /v1/store/invitations` (201) — 스코프 `member:rw`. 초대 메일을 보낸다. 발송 결과는 응답의
8031
+ * `deliveryStatus`다(발송이 실패해도 초대는 만들어진다). 스토어·초대한 사람·받는 주소별 발송 한도가 있다(429, `details.limit`).
8032
+ */
8033
+ invite: (body: InviteMemberRequest) => Promise<{
8034
+ invitationId: string;
8035
+ email: string;
8036
+ role: "ADMIN" | "STAFF";
8037
+ status: "PENDING" | "EXPIRED" | "ACCEPTED" | "CANCELED";
8038
+ invitedBy: string;
8039
+ expiresAt: string;
8040
+ createdAt: string;
8041
+ deliveryStatus: "FAILED" | "SENDING" | "SENT" | "NOT_CONFIGURED" | null;
8042
+ deliveryErrorCode: string | null;
8043
+ lastSentAt: string | null;
8044
+ sendCount: number;
8045
+ acceptedAt: string | null;
8046
+ }>;
8047
+ /** `POST /v1/store/invitations/{invitationId}/resend` — 새 수락 링크로 다시 보낸다. 이전 링크는 무효가 되고 만료가 다시 7일이 된다 */
8048
+ resendInvitation: (invitationId: string) => Promise<{
8049
+ invitationId: string;
8050
+ email: string;
8051
+ role: "ADMIN" | "STAFF";
8052
+ status: "PENDING" | "EXPIRED" | "ACCEPTED" | "CANCELED";
8053
+ invitedBy: string;
8054
+ expiresAt: string;
8055
+ createdAt: string;
8056
+ deliveryStatus: "FAILED" | "SENDING" | "SENT" | "NOT_CONFIGURED" | null;
8057
+ deliveryErrorCode: string | null;
8058
+ lastSentAt: string | null;
8059
+ sendCount: number;
8060
+ acceptedAt: string | null;
8061
+ }>;
8062
+ /** `DELETE /v1/store/invitations/{invitationId}` (204) — 대기 중 초대를 취소한다 */
8063
+ cancelInvitation: (invitationId: string) => Promise<void>;
7977
8064
  };
7978
8065
  };
7979
8066
  type StoreClient = ReturnType<typeof createStoreClient>;
@@ -8409,13 +8496,13 @@ export declare const orderWebhookEventDataSchema: z.ZodObject<{
8409
8496
  orderId: z.ZodString;
8410
8497
  status: z.ZodEnum<{
8411
8498
  PAID: "PAID";
8499
+ CANCELED: "CANCELED";
8412
8500
  PAYMENT_WAITING: "PAYMENT_WAITING";
8413
8501
  CONFIRMED: "CONFIRMED";
8414
8502
  DISPATCHED: "DISPATCHED";
8415
8503
  DELIVERING: "DELIVERING";
8416
8504
  DELIVERED: "DELIVERED";
8417
8505
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
8418
- CANCELED: "CANCELED";
8419
8506
  }>;
8420
8507
  testPayment: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8421
8508
  }, z.core.$strip>;
@@ -8477,13 +8564,13 @@ export declare const orderWebhookEventSchema: z.ZodObject<{
8477
8564
  orderId: z.ZodString;
8478
8565
  status: z.ZodEnum<{
8479
8566
  PAID: "PAID";
8567
+ CANCELED: "CANCELED";
8480
8568
  PAYMENT_WAITING: "PAYMENT_WAITING";
8481
8569
  CONFIRMED: "CONFIRMED";
8482
8570
  DISPATCHED: "DISPATCHED";
8483
8571
  DELIVERING: "DELIVERING";
8484
8572
  DELIVERED: "DELIVERED";
8485
8573
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
8486
- CANCELED: "CANCELED";
8487
8574
  }>;
8488
8575
  testPayment: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8489
8576
  }, z.core.$strip>;
@@ -8574,13 +8661,13 @@ export declare const webhookEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8574
8661
  orderId: z.ZodString;
8575
8662
  status: z.ZodEnum<{
8576
8663
  PAID: "PAID";
8664
+ CANCELED: "CANCELED";
8577
8665
  PAYMENT_WAITING: "PAYMENT_WAITING";
8578
8666
  CONFIRMED: "CONFIRMED";
8579
8667
  DISPATCHED: "DISPATCHED";
8580
8668
  DELIVERING: "DELIVERING";
8581
8669
  DELIVERED: "DELIVERED";
8582
8670
  PURCHASE_DECIDED: "PURCHASE_DECIDED";
8583
- CANCELED: "CANCELED";
8584
8671
  }>;
8585
8672
  testPayment: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8586
8673
  }, z.core.$strip>;
package/dist/index.mjs CHANGED
@@ -3163,10 +3163,21 @@ const storeMemberSchema = z.object({
3163
3163
  joinedAt: z.string(),
3164
3164
  lastActiveAt: z.string().nullable()
3165
3165
  });
3166
+ /**
3167
+ * 초대 메일 발송 결과 — `SENDING`은 발송 요청 중(결과를 아직 적지 못함), `NOT_CONFIGURED`는 메일 발송이 설정되지 않아
3168
+ * 보내지 않은 것이다. 발송 실패는 초대를 무효로 만들지 않는다 — 재발송으로 다시 보낸다
3169
+ */
3170
+ const invitationDeliveryStatusSchema = z.enum([
3171
+ "SENDING",
3172
+ "SENT",
3173
+ "FAILED",
3174
+ "NOT_CONFIGURED"
3175
+ ]);
3166
3176
  const invitationSchema = z.object({
3167
3177
  invitationId: z.string(),
3168
3178
  email: z.email(),
3169
3179
  role: z.enum(["ADMIN", "STAFF"]),
3180
+ /** 만료 시각이 지난 대기 초대는 `EXPIRED`로 보인다 */
3170
3181
  status: z.enum([
3171
3182
  "PENDING",
3172
3183
  "ACCEPTED",
@@ -3175,8 +3186,25 @@ const invitationSchema = z.object({
3175
3186
  ]),
3176
3187
  invitedBy: z.string(),
3177
3188
  expiresAt: z.string(),
3178
- createdAt: z.string()
3189
+ createdAt: z.string(),
3190
+ /** 마지막 발송 결과. 발송 기록이 없는 옛 초대는 null */
3191
+ deliveryStatus: invitationDeliveryStatusSchema.nullable().default(null),
3192
+ /**
3193
+ * 발송 실패 코드(`FAILED`일 때). `DELIVERY_UNKNOWN`은 발송 요청 뒤 결과를 적지 못한 경우다(받았는지 모른다 — 재발송한다)
3194
+ */
3195
+ deliveryErrorCode: z.string().nullable().default(null),
3196
+ lastSentAt: z.string().nullable().default(null),
3197
+ /** 발송 요청 횟수(첫 발송 포함) */
3198
+ sendCount: z.number().int().default(0),
3199
+ acceptedAt: z.string().nullable().default(null)
3200
+ });
3201
+ /** `POST /v1/store/invitations` 요청 — ADMIN 초대는 OWNER만 할 수 있다 */
3202
+ const inviteMemberRequestSchema = z.object({
3203
+ email: z.email(),
3204
+ role: z.enum(["ADMIN", "STAFF"])
3179
3205
  });
3206
+ /** `PATCH /v1/store/members/{userId}` 요청 */
3207
+ const updateMemberRoleRequestSchema = z.object({ role: z.enum(["ADMIN", "STAFF"]) });
3180
3208
  /** `GET /v1/store/invitations` 쿼리 — OpenAPI 문서용 형태 */
3181
3209
  const invitationListQuerySchema = z.object({ status: invitationSchema.shape.status.optional().describe("초대 상태 필터") });
3182
3210
  /** `PATCH /v1/store/members/{userId}` 응답 — 바뀐 역할 */
@@ -3741,7 +3769,20 @@ list: (params) => storeHttp.request("GET", "/audit-logs", auditLogPageSchema, {
3741
3769
  */
3742
3770
  update: (body) => storeHttp.request("PATCH", "/store", storeSchema, { body: updateStoreRequestSchema.parse(body) }),
3743
3771
  listMembers: () => storeHttp.request("GET", "/store/members", z.array(storeMemberSchema)),
3744
- listInvitations: () => storeHttp.request("GET", "/store/invitations", z.array(invitationSchema))
3772
+ /** `PATCH /v1/store/members/{userId}` — 스코프 `member:rw`. OWNER는 바꿀 수 없고 ADMIN 지정·ADMIN 변경은 OWNER만 한다 */
3773
+ updateMemberRole: (userId, body) => storeHttp.request("PATCH", path`/store/members/${userId}`, storeMemberRoleUpdatedSchema, { body: updateMemberRoleRequestSchema.parse(body) }),
3774
+ /** `DELETE /v1/store/members/{userId}` (204) — OWNER는 내보낼 수 없고 ADMIN은 OWNER만 내보낸다 */
3775
+ removeMember: (userId) => storeHttp.requestVoid("DELETE", path`/store/members/${userId}`),
3776
+ listInvitations: (params) => storeHttp.request("GET", "/store/invitations", z.array(invitationSchema), { query: params }),
3777
+ /**
3778
+ * `POST /v1/store/invitations` (201) — 스코프 `member:rw`. 초대 메일을 보낸다. 발송 결과는 응답의
3779
+ * `deliveryStatus`다(발송이 실패해도 초대는 만들어진다). 스토어·초대한 사람·받는 주소별 발송 한도가 있다(429, `details.limit`).
3780
+ */
3781
+ invite: (body) => storeHttp.request("POST", "/store/invitations", invitationSchema, { body: inviteMemberRequestSchema.parse(body) }),
3782
+ /** `POST /v1/store/invitations/{invitationId}/resend` — 새 수락 링크로 다시 보낸다. 이전 링크는 무효가 되고 만료가 다시 7일이 된다 */
3783
+ resendInvitation: (invitationId) => storeHttp.request("POST", path`/store/invitations/${invitationId}/resend`, invitationSchema),
3784
+ /** `DELETE /v1/store/invitations/{invitationId}` (204) — 대기 중 초대를 취소한다 */
3785
+ cancelInvitation: (invitationId) => storeHttp.requestVoid("DELETE", path`/store/invitations/${invitationId}`)
3745
3786
  }
3746
3787
  };
3747
3788
  }
@@ -4172,4 +4213,4 @@ function createStoreSession(options) {
4172
4213
  };
4173
4214
  }
4174
4215
  //#endregion
4175
- export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, CASH_RECEIPT_STATUS_VALUES, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, PAYMENT_ROUTING_EXCLUSION_CODES, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REMOTE_AREA_ZIP_RANGES, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, 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_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, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, 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, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, clientCredentialsTokenResponseSchema, consentActionSchema, consentKindSchema, consentSourceSchema, createPkcePair, createStoreClient, createStoreSession, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, exchangeStoreTokenViaOAuth, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationListQuerySchema, invitationSchema, isReservedStoreCode, isStoreScope, isWebOrigin, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, mcpRuleResultSchema, mcpToolEventSchema, myAccountSchema, myStoreSchema, oauthClientRegistrationRequestSchema, oauthClientRegistrationResponseSchema, oauthTokenResponseSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionValueRequestSchema, optionValueSchema, 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, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedRefundBase, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, quoteDelivery, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, resolveRefundPolicy, resolveShippingPolicy, reviewListQuerySchema, reviewReportResultSchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, scopeAccessSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeTokenResponseSchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, 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 };
4216
+ export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, CASH_RECEIPT_STATUS_VALUES, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, PAYMENT_ROUTING_EXCLUSION_CODES, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REMOTE_AREA_ZIP_RANGES, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, 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_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, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, 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, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, clientCredentialsTokenResponseSchema, consentActionSchema, consentKindSchema, consentSourceSchema, createPkcePair, createStoreClient, createStoreSession, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, exchangeStoreTokenViaOAuth, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationDeliveryStatusSchema, invitationListQuerySchema, invitationSchema, inviteMemberRequestSchema, isReservedStoreCode, isStoreScope, isWebOrigin, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, mcpRuleResultSchema, mcpToolEventSchema, myAccountSchema, myStoreSchema, oauthClientRegistrationRequestSchema, oauthClientRegistrationResponseSchema, oauthTokenResponseSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionValueRequestSchema, optionValueSchema, 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, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedRefundBase, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, quoteDelivery, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, resolveRefundPolicy, resolveShippingPolicy, reviewListQuerySchema, reviewReportResultSchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, scopeAccessSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeTokenResponseSchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updateMemberRoleRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sayren/store-sdk",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "exports": {
package/src/client.ts CHANGED
@@ -185,13 +185,19 @@ import {
185
185
  } from "./schemas/product";
186
186
  import {
187
187
  type AddressType,
188
+ type Invitation,
189
+ type InviteMemberRequest,
188
190
  invitationSchema,
191
+ inviteMemberRequestSchema,
189
192
  type SellerAddressRequest,
190
193
  sellerAddressRequestSchema,
191
194
  sellerAddressSchema,
195
+ storeMemberRoleUpdatedSchema,
192
196
  storeMemberSchema,
193
197
  storeSchema,
198
+ type UpdateMemberRoleRequest,
194
199
  type UpdateStoreRequest,
200
+ updateMemberRoleRequestSchema,
195
201
  updateStoreRequestSchema,
196
202
  } from "./schemas/store";
197
203
  import {
@@ -1145,8 +1151,36 @@ export function createStoreClient(options: StoreClientOptions) {
1145
1151
  body: updateStoreRequestSchema.parse(body),
1146
1152
  }),
1147
1153
  listMembers: () => storeHttp.request("GET", "/store/members", z.array(storeMemberSchema)),
1148
- listInvitations: () =>
1149
- storeHttp.request("GET", "/store/invitations", z.array(invitationSchema)),
1154
+ /** `PATCH /v1/store/members/{userId}` — 스코프 `member:rw`. OWNER는 바꿀 수 없고 ADMIN 지정·ADMIN 변경은 OWNER만 한다 */
1155
+ updateMemberRole: (userId: string, body: UpdateMemberRoleRequest) =>
1156
+ storeHttp.request("PATCH", path`/store/members/${userId}`, storeMemberRoleUpdatedSchema, {
1157
+ body: updateMemberRoleRequestSchema.parse(body),
1158
+ }),
1159
+ /** `DELETE /v1/store/members/{userId}` (204) — OWNER는 내보낼 수 없고 ADMIN은 OWNER만 내보낸다 */
1160
+ removeMember: (userId: string) =>
1161
+ storeHttp.requestVoid("DELETE", path`/store/members/${userId}`),
1162
+ listInvitations: (params?: { status?: Invitation["status"] }) =>
1163
+ storeHttp.request("GET", "/store/invitations", z.array(invitationSchema), {
1164
+ query: params as Query,
1165
+ }),
1166
+ /**
1167
+ * `POST /v1/store/invitations` (201) — 스코프 `member:rw`. 초대 메일을 보낸다. 발송 결과는 응답의
1168
+ * `deliveryStatus`다(발송이 실패해도 초대는 만들어진다). 스토어·초대한 사람·받는 주소별 발송 한도가 있다(429, `details.limit`).
1169
+ */
1170
+ invite: (body: InviteMemberRequest) =>
1171
+ storeHttp.request("POST", "/store/invitations", invitationSchema, {
1172
+ body: inviteMemberRequestSchema.parse(body),
1173
+ }),
1174
+ /** `POST /v1/store/invitations/{invitationId}/resend` — 새 수락 링크로 다시 보낸다. 이전 링크는 무효가 되고 만료가 다시 7일이 된다 */
1175
+ resendInvitation: (invitationId: string) =>
1176
+ storeHttp.request(
1177
+ "POST",
1178
+ path`/store/invitations/${invitationId}/resend`,
1179
+ invitationSchema,
1180
+ ),
1181
+ /** `DELETE /v1/store/invitations/{invitationId}` (204) — 대기 중 초대를 취소한다 */
1182
+ cancelInvitation: (invitationId: string) =>
1183
+ storeHttp.requestVoid("DELETE", path`/store/invitations/${invitationId}`),
1150
1184
  },
1151
1185
  };
1152
1186
  }
@@ -268,18 +268,58 @@ export const storeMemberSchema = z.object({
268
268
 
269
269
  export type StoreMember = z.infer<typeof storeMemberSchema>;
270
270
 
271
+ /**
272
+ * 초대 메일 발송 결과 — `SENDING`은 발송 요청 중(결과를 아직 적지 못함), `NOT_CONFIGURED`는 메일 발송이 설정되지 않아
273
+ * 보내지 않은 것이다. 발송 실패는 초대를 무효로 만들지 않는다 — 재발송으로 다시 보낸다
274
+ */
275
+ export const invitationDeliveryStatusSchema = z.enum([
276
+ "SENDING",
277
+ "SENT",
278
+ "FAILED",
279
+ "NOT_CONFIGURED",
280
+ ]);
281
+
282
+ export type InvitationDeliveryStatus = z.infer<typeof invitationDeliveryStatusSchema>;
283
+
271
284
  export const invitationSchema = z.object({
272
285
  invitationId: z.string(),
273
286
  email: z.email(),
274
287
  role: z.enum(["ADMIN", "STAFF"]),
288
+ /** 만료 시각이 지난 대기 초대는 `EXPIRED`로 보인다 */
275
289
  status: z.enum(["PENDING", "ACCEPTED", "EXPIRED", "CANCELED"]),
276
290
  invitedBy: z.string(),
277
291
  expiresAt: z.string(),
278
292
  createdAt: z.string(),
293
+ // 아래 필드는 이슈 #42에서 더했다. 옛 api 응답에는 없으므로 빠지면 기본값으로 읽는다(SDK가 api보다 먼저 올라가도 파싱된다)
294
+ /** 마지막 발송 결과. 발송 기록이 없는 옛 초대는 null */
295
+ deliveryStatus: invitationDeliveryStatusSchema.nullable().default(null),
296
+ /**
297
+ * 발송 실패 코드(`FAILED`일 때). `DELIVERY_UNKNOWN`은 발송 요청 뒤 결과를 적지 못한 경우다(받았는지 모른다 — 재발송한다)
298
+ */
299
+ deliveryErrorCode: z.string().nullable().default(null),
300
+ lastSentAt: z.string().nullable().default(null),
301
+ /** 발송 요청 횟수(첫 발송 포함) */
302
+ sendCount: z.number().int().default(0),
303
+ acceptedAt: z.string().nullable().default(null),
279
304
  });
280
305
 
281
306
  export type Invitation = z.infer<typeof invitationSchema>;
282
307
 
308
+ /** `POST /v1/store/invitations` 요청 — ADMIN 초대는 OWNER만 할 수 있다 */
309
+ export const inviteMemberRequestSchema = z.object({
310
+ email: z.email(),
311
+ role: z.enum(["ADMIN", "STAFF"]),
312
+ });
313
+
314
+ export type InviteMemberRequest = z.infer<typeof inviteMemberRequestSchema>;
315
+
316
+ /** `PATCH /v1/store/members/{userId}` 요청 */
317
+ export const updateMemberRoleRequestSchema = z.object({
318
+ role: z.enum(["ADMIN", "STAFF"]),
319
+ });
320
+
321
+ export type UpdateMemberRoleRequest = z.infer<typeof updateMemberRoleRequestSchema>;
322
+
283
323
  /** `GET /v1/store/invitations` 쿼리 — OpenAPI 문서용 형태 */
284
324
  export const invitationListQuerySchema = z.object({
285
325
  status: invitationSchema.shape.status.optional().describe("초대 상태 필터"),