@sayren/store-sdk 0.30.2 → 0.30.4
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 +277 -198
- package/dist/index.mjs +18 -4
- package/package.json +1 -1
- package/src/schemas/audit.ts +12 -0
- package/src/schemas/commerce-flow.ts +28 -3
- package/src/schemas/points.ts +3 -1
package/dist/index.mjs
CHANGED
|
@@ -92,6 +92,7 @@ const writePreviewSchema = z.object({
|
|
|
92
92
|
type: z.string(),
|
|
93
93
|
id: z.string().nullable()
|
|
94
94
|
}),
|
|
95
|
+
targetName: z.string().nullable().optional().describe("대상 이름(상품명·쿠폰명·흐름 이름·구매자 이름 등). 읽을 수 없으면 null"),
|
|
95
96
|
changes: z.array(z.object({
|
|
96
97
|
field: z.string().describe("바뀌는 필드"),
|
|
97
98
|
before: z.unknown().describe("현재 값. 새로 만드는 요청이거나 읽을 수 없으면 null"),
|
|
@@ -119,6 +120,7 @@ const approvalRequestSchema = z.object({
|
|
|
119
120
|
approvalId: z.string().describe("승인 요청 ID"),
|
|
120
121
|
status: approvalStatusSchema,
|
|
121
122
|
operationId: z.string().describe("보류된 오퍼레이션 ID"),
|
|
123
|
+
operationName: z.string().nullable().optional().describe("작업 이름(예: 흐름 게시, 구매자 적립금 지급·차감). API 문서의 요약과 같다. 모르면 null"),
|
|
122
124
|
method: z.string().describe("HTTP 메서드"),
|
|
123
125
|
path: z.string().describe("요청 경로와 쿼리"),
|
|
124
126
|
body: z.unknown().describe("요청 본문. 승인하면 이 본문 그대로 실행한다. 없으면 null"),
|
|
@@ -1441,7 +1443,7 @@ const POINT_ADJUSTMENT_MAX = 1e7;
|
|
|
1441
1443
|
const pointAdjustmentRequestSchema = z.object({
|
|
1442
1444
|
amount: z.number().int().min(-1e7).max(POINT_ADJUSTMENT_MAX).refine((value) => value !== 0, "0원은 조정할 수 없습니다").describe("지급은 양수, 차감은 음수(원)"),
|
|
1443
1445
|
reason: z.string().trim().min(1).max(200).describe("사유(필수). 구매자에게는 보이지 않는다"),
|
|
1444
|
-
expiresAt: z.iso.datetime({ offset: true }).optional().describe("지급분의 소멸 시각. 생략하면 정책 유효
|
|
1446
|
+
expiresAt: z.iso.datetime({ offset: true }).optional().describe("지급분의 소멸 시각. 생략하면 정책 유효 기간(`expiryDays`)으로 정한다. **정책 유효 기간이 없으면 지급에 필수다**(없으면 400 `POINT_EXPIRY_REQUIRED`). 차감에는 주지 않는다")
|
|
1445
1447
|
}).refine((value) => !(value.amount < 0 && value.expiresAt), {
|
|
1446
1448
|
message: "차감에는 소멸 시각을 줄 수 없습니다",
|
|
1447
1449
|
path: ["expiresAt"]
|
|
@@ -2598,7 +2600,18 @@ const flowInputFieldSchema = z.object({
|
|
|
2598
2600
|
placeholder: z.string().optional().describe("입력 안내"),
|
|
2599
2601
|
maxLength: z.number().int().optional(),
|
|
2600
2602
|
maxFiles: z.number().int().optional(),
|
|
2601
|
-
options: z.array(z.union([
|
|
2603
|
+
options: z.array(z.union([
|
|
2604
|
+
z.string(),
|
|
2605
|
+
z.number(),
|
|
2606
|
+
z.object({
|
|
2607
|
+
value: z.string(),
|
|
2608
|
+
label: z.string()
|
|
2609
|
+
}).describe("값과 보여 줄 이름")
|
|
2610
|
+
])).optional().describe("고르는 형식의 선택지. 값만 있거나 값·이름 쌍이다(보낼 때는 값)"),
|
|
2611
|
+
when: z.object({
|
|
2612
|
+
key: z.string(),
|
|
2613
|
+
in: z.array(z.string())
|
|
2614
|
+
}).optional().describe("다른 칸(`key`)의 값이 `in` 중 하나일 때만 보이고 받는 칸. 없으면 늘 받는다")
|
|
2602
2615
|
});
|
|
2603
2616
|
const flowActionSchema = z.object({
|
|
2604
2617
|
key: z.string().describe("행동 키. 플랫폼 키(예: CONFIRM_ORDER)와 상점·앱이 정한 키가 섞인다"),
|
|
@@ -2635,6 +2648,7 @@ const flowStateSchema = z.object({
|
|
|
2635
2648
|
enteredAt: z.string().describe("이 상태에 들어온 시각(ISO 8601)"),
|
|
2636
2649
|
deadlineAt: z.string().optional().describe("가장 가까운 기한(ISO 8601)"),
|
|
2637
2650
|
attachments: z.array(z.string()).optional().describe("가장 최근 행동이 붙인 첨부 주소(시안 등, #115). 없으면 생략"),
|
|
2651
|
+
earlierAttachments: z.array(z.string()).optional().describe("앞 상태에서 붙인 첨부(수정 요청 뒤의 이전 시안 등). 다음 첨부가 오면 바뀐다. 없으면 생략"),
|
|
2638
2652
|
inputs: z.object({
|
|
2639
2653
|
by: z.string().describe("적은 사람 — seller · buyer"),
|
|
2640
2654
|
values: z.array(z.object({
|
|
@@ -2730,8 +2744,8 @@ const commerceFlowSummarySchema = z.object({
|
|
|
2730
2744
|
flowId: z.string(),
|
|
2731
2745
|
key: z.string().describe("상점 안 유일한 키"),
|
|
2732
2746
|
name: z.string(),
|
|
2733
|
-
progression: z.enum(["ITEM", "ORDER_GROUP"]),
|
|
2734
|
-
fulfillmentMethods: z.array(z.string()),
|
|
2747
|
+
progression: z.enum(["ITEM", "ORDER_GROUP"]).describe("진행 단위 — 지금 게시 버전의 값(초안 `definition.requires.progression`을 게시 때 고정한다). 주문상품은 주문 시점 버전의 값을 따른다"),
|
|
2748
|
+
fulfillmentMethods: z.array(z.string()).describe("이행 방식 — 지금 게시 버전의 `definition.requires.fulfillmentMethods`"),
|
|
2735
2749
|
presetKey: z.string().nullable().describe("설치한 프리셋(설치 뒤 연결되지 않는다)"),
|
|
2736
2750
|
presetVersion: z.number().int().nullable(),
|
|
2737
2751
|
activeVersion: z.number().int().nullable().describe("게시된 버전. 새 주문이 따른다"),
|
package/package.json
CHANGED
package/src/schemas/audit.ts
CHANGED
|
@@ -155,6 +155,11 @@ export const writePreviewSchema = z.object({
|
|
|
155
155
|
method: z.string(),
|
|
156
156
|
path: z.string(),
|
|
157
157
|
target: z.object({ type: z.string(), id: z.string().nullable() }),
|
|
158
|
+
targetName: z
|
|
159
|
+
.string()
|
|
160
|
+
.nullable()
|
|
161
|
+
.optional()
|
|
162
|
+
.describe("대상 이름(상품명·쿠폰명·흐름 이름·구매자 이름 등). 읽을 수 없으면 null"),
|
|
158
163
|
changes: z
|
|
159
164
|
.array(
|
|
160
165
|
z.object({
|
|
@@ -195,6 +200,13 @@ export const approvalRequestSchema = z.object({
|
|
|
195
200
|
approvalId: z.string().describe("승인 요청 ID"),
|
|
196
201
|
status: approvalStatusSchema,
|
|
197
202
|
operationId: z.string().describe("보류된 오퍼레이션 ID"),
|
|
203
|
+
operationName: z
|
|
204
|
+
.string()
|
|
205
|
+
.nullable()
|
|
206
|
+
.optional()
|
|
207
|
+
.describe(
|
|
208
|
+
"작업 이름(예: 흐름 게시, 구매자 적립금 지급·차감). API 문서의 요약과 같다. 모르면 null",
|
|
209
|
+
),
|
|
198
210
|
method: z.string().describe("HTTP 메서드"),
|
|
199
211
|
path: z.string().describe("요청 경로와 쿼리"),
|
|
200
212
|
body: z.unknown().describe("요청 본문. 승인하면 이 본문 그대로 실행한다. 없으면 null"),
|
|
@@ -20,7 +20,20 @@ export const flowInputFieldSchema = z.object({
|
|
|
20
20
|
placeholder: z.string().optional().describe("입력 안내"),
|
|
21
21
|
maxLength: z.number().int().optional(),
|
|
22
22
|
maxFiles: z.number().int().optional(),
|
|
23
|
-
options: z
|
|
23
|
+
options: z
|
|
24
|
+
.array(
|
|
25
|
+
z.union([
|
|
26
|
+
z.string(),
|
|
27
|
+
z.number(),
|
|
28
|
+
z.object({ value: z.string(), label: z.string() }).describe("값과 보여 줄 이름"),
|
|
29
|
+
]),
|
|
30
|
+
)
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("고르는 형식의 선택지. 값만 있거나 값·이름 쌍이다(보낼 때는 값)"),
|
|
33
|
+
when: z
|
|
34
|
+
.object({ key: z.string(), in: z.array(z.string()) })
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("다른 칸(`key`)의 값이 `in` 중 하나일 때만 보이고 받는 칸. 없으면 늘 받는다"),
|
|
24
37
|
});
|
|
25
38
|
export type FlowInputField = z.infer<typeof flowInputFieldSchema>;
|
|
26
39
|
|
|
@@ -67,6 +80,12 @@ export const flowStateSchema = z.object({
|
|
|
67
80
|
.array(z.string())
|
|
68
81
|
.optional()
|
|
69
82
|
.describe("가장 최근 행동이 붙인 첨부 주소(시안 등, #115). 없으면 생략"),
|
|
83
|
+
earlierAttachments: z
|
|
84
|
+
.array(z.string())
|
|
85
|
+
.optional()
|
|
86
|
+
.describe(
|
|
87
|
+
"앞 상태에서 붙인 첨부(수정 요청 뒤의 이전 시안 등). 다음 첨부가 오면 바뀐다. 없으면 생략",
|
|
88
|
+
),
|
|
70
89
|
inputs: z
|
|
71
90
|
.object({
|
|
72
91
|
by: z.string().describe("적은 사람 — seller · buyer"),
|
|
@@ -195,8 +214,14 @@ export const commerceFlowSummarySchema = z.object({
|
|
|
195
214
|
flowId: z.string(),
|
|
196
215
|
key: z.string().describe("상점 안 유일한 키"),
|
|
197
216
|
name: z.string(),
|
|
198
|
-
progression: z
|
|
199
|
-
|
|
217
|
+
progression: z
|
|
218
|
+
.enum(["ITEM", "ORDER_GROUP"])
|
|
219
|
+
.describe(
|
|
220
|
+
"진행 단위 — 지금 게시 버전의 값(초안 `definition.requires.progression`을 게시 때 고정한다). 주문상품은 주문 시점 버전의 값을 따른다",
|
|
221
|
+
),
|
|
222
|
+
fulfillmentMethods: z
|
|
223
|
+
.array(z.string())
|
|
224
|
+
.describe("이행 방식 — 지금 게시 버전의 `definition.requires.fulfillmentMethods`"),
|
|
200
225
|
presetKey: z.string().nullable().describe("설치한 프리셋(설치 뒤 연결되지 않는다)"),
|
|
201
226
|
presetVersion: z.number().int().nullable(),
|
|
202
227
|
activeVersion: z.number().int().nullable().describe("게시된 버전. 새 주문이 따른다"),
|
package/src/schemas/points.ts
CHANGED
|
@@ -331,7 +331,9 @@ export const pointAdjustmentRequestSchema = z
|
|
|
331
331
|
expiresAt: z.iso
|
|
332
332
|
.datetime({ offset: true })
|
|
333
333
|
.optional()
|
|
334
|
-
.describe(
|
|
334
|
+
.describe(
|
|
335
|
+
"지급분의 소멸 시각. 생략하면 정책 유효 기간(`expiryDays`)으로 정한다. **정책 유효 기간이 없으면 지급에 필수다**(없으면 400 `POINT_EXPIRY_REQUIRED`). 차감에는 주지 않는다",
|
|
336
|
+
),
|
|
335
337
|
})
|
|
336
338
|
.refine((value) => !(value.amount < 0 && value.expiresAt), {
|
|
337
339
|
message: "차감에는 소멸 시각을 줄 수 없습니다",
|