@sayren/store-sdk 0.12.0 → 0.14.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
@@ -1,5 +1,378 @@
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-D6QmPdEJ.mjs";
2
2
  import { z } from "zod";
3
+ //#region src/schemas/audit.d.ts
4
+ /**
5
+ * 감사 로그와 승인 요청 — `/v1/audit-logs`, `/v1/approval-requests` (이슈 #36).
6
+ *
7
+ * 관리 API 쓰기(`/v1/**`의 GET 외 요청)는 모두 요청 단위 기록(`source: REQUEST`) 한 줄을 남긴다. 환불·직권취소 같은
8
+ * 도메인 동작은 그 안에서 변경 전후를 담은 기록(`source: DOMAIN`)을 따로 남기고 `requestId`로 요청 기록과 이어진다.
9
+ */
10
+ export declare const auditActorTypeSchema: z.ZodEnum<{
11
+ USER: "USER";
12
+ AGENT: "AGENT";
13
+ APP: "APP";
14
+ TOKEN: "TOKEN";
15
+ SYSTEM: "SYSTEM";
16
+ }>;
17
+ export type AuditActorType = z.infer<typeof auditActorTypeSchema>;
18
+ export declare const auditActorSchema: z.ZodObject<{
19
+ type: z.ZodEnum<{
20
+ USER: "USER";
21
+ AGENT: "AGENT";
22
+ APP: "APP";
23
+ TOKEN: "TOKEN";
24
+ SYSTEM: "SYSTEM";
25
+ }>;
26
+ id: z.ZodString;
27
+ name: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ export type AuditActor = z.infer<typeof auditActorSchema>;
30
+ export declare const auditLogSourceSchema: z.ZodEnum<{
31
+ REQUEST: "REQUEST";
32
+ DOMAIN: "DOMAIN";
33
+ }>;
34
+ export type AuditLogSource = z.infer<typeof auditLogSourceSchema>;
35
+ export declare const auditLogOutcomeSchema: z.ZodEnum<{
36
+ FAILED: "FAILED";
37
+ SUCCEEDED: "SUCCEEDED";
38
+ PENDING_APPROVAL: "PENDING_APPROVAL";
39
+ DENIED: "DENIED";
40
+ DRY_RUN: "DRY_RUN";
41
+ }>;
42
+ export type AuditLogOutcome = z.infer<typeof auditLogOutcomeSchema>;
43
+ export declare const auditLogSchema: z.ZodObject<{
44
+ auditId: z.ZodString;
45
+ occurredAt: z.ZodString;
46
+ source: z.ZodEnum<{
47
+ REQUEST: "REQUEST";
48
+ DOMAIN: "DOMAIN";
49
+ }>;
50
+ action: z.ZodString;
51
+ actor: z.ZodObject<{
52
+ type: z.ZodEnum<{
53
+ USER: "USER";
54
+ AGENT: "AGENT";
55
+ APP: "APP";
56
+ TOKEN: "TOKEN";
57
+ SYSTEM: "SYSTEM";
58
+ }>;
59
+ id: z.ZodString;
60
+ name: z.ZodNullable<z.ZodString>;
61
+ }, z.core.$strip>;
62
+ actorRole: z.ZodNullable<z.ZodString>;
63
+ target: z.ZodObject<{
64
+ type: z.ZodString;
65
+ id: z.ZodNullable<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ requestId: z.ZodNullable<z.ZodString>;
68
+ method: z.ZodNullable<z.ZodString>;
69
+ path: z.ZodNullable<z.ZodString>;
70
+ statusCode: z.ZodNullable<z.ZodNumber>;
71
+ outcome: z.ZodNullable<z.ZodEnum<{
72
+ FAILED: "FAILED";
73
+ SUCCEEDED: "SUCCEEDED";
74
+ PENDING_APPROVAL: "PENDING_APPROVAL";
75
+ DENIED: "DENIED";
76
+ DRY_RUN: "DRY_RUN";
77
+ }>>;
78
+ errorCode: z.ZodNullable<z.ZodString>;
79
+ traceId: z.ZodNullable<z.ZodString>;
80
+ idempotencyKey: z.ZodNullable<z.ZodString>;
81
+ approvalId: z.ZodNullable<z.ZodString>;
82
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
83
+ }, z.core.$strip>;
84
+ export type AuditLog = z.infer<typeof auditLogSchema>;
85
+ /** 감사 로그 조회 쿼리 — `GET /audit-logs` */
86
+ export declare const auditLogListQuerySchema: z.ZodObject<{
87
+ from: z.ZodOptional<z.ZodString>;
88
+ to: z.ZodOptional<z.ZodString>;
89
+ actorType: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodEnum<{
90
+ USER: "USER";
91
+ AGENT: "AGENT";
92
+ APP: "APP";
93
+ TOKEN: "TOKEN";
94
+ SYSTEM: "SYSTEM";
95
+ }>>>>;
96
+ actorId: z.ZodOptional<z.ZodString>;
97
+ action: z.ZodOptional<z.ZodString>;
98
+ targetType: z.ZodOptional<z.ZodString>;
99
+ targetId: z.ZodOptional<z.ZodString>;
100
+ source: z.ZodOptional<z.ZodEnum<{
101
+ REQUEST: "REQUEST";
102
+ DOMAIN: "DOMAIN";
103
+ }>>;
104
+ outcome: z.ZodOptional<z.ZodEnum<{
105
+ FAILED: "FAILED";
106
+ SUCCEEDED: "SUCCEEDED";
107
+ PENDING_APPROVAL: "PENDING_APPROVAL";
108
+ DENIED: "DENIED";
109
+ DRY_RUN: "DRY_RUN";
110
+ }>>;
111
+ requestId: z.ZodOptional<z.ZodString>;
112
+ approvalId: z.ZodOptional<z.ZodString>;
113
+ cursor: z.ZodOptional<z.ZodString>;
114
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
115
+ }, z.core.$strip>;
116
+ /** 파싱된 조회 쿼리 (서버 측). `actorType`은 항상 배열이다 */
117
+ export type AuditLogListParams = z.infer<typeof auditLogListQuerySchema>;
118
+ /** 클라이언트 `auditLogs.list` 인자. `actorType`은 단일 값·배열 모두 받고 쉼표로 직렬화한다 */
119
+ export type AuditLogListOptions = Omit<AuditLogListParams, "actorType"> & {
120
+ actorType?: AuditActorType | AuditActorType[];
121
+ };
122
+ export declare const auditLogPageSchema: z.ZodObject<{
123
+ items: z.ZodArray<z.ZodObject<{
124
+ auditId: z.ZodString;
125
+ occurredAt: z.ZodString;
126
+ source: z.ZodEnum<{
127
+ REQUEST: "REQUEST";
128
+ DOMAIN: "DOMAIN";
129
+ }>;
130
+ action: z.ZodString;
131
+ actor: z.ZodObject<{
132
+ type: z.ZodEnum<{
133
+ USER: "USER";
134
+ AGENT: "AGENT";
135
+ APP: "APP";
136
+ TOKEN: "TOKEN";
137
+ SYSTEM: "SYSTEM";
138
+ }>;
139
+ id: z.ZodString;
140
+ name: z.ZodNullable<z.ZodString>;
141
+ }, z.core.$strip>;
142
+ actorRole: z.ZodNullable<z.ZodString>;
143
+ target: z.ZodObject<{
144
+ type: z.ZodString;
145
+ id: z.ZodNullable<z.ZodString>;
146
+ }, z.core.$strip>;
147
+ requestId: z.ZodNullable<z.ZodString>;
148
+ method: z.ZodNullable<z.ZodString>;
149
+ path: z.ZodNullable<z.ZodString>;
150
+ statusCode: z.ZodNullable<z.ZodNumber>;
151
+ outcome: z.ZodNullable<z.ZodEnum<{
152
+ FAILED: "FAILED";
153
+ SUCCEEDED: "SUCCEEDED";
154
+ PENDING_APPROVAL: "PENDING_APPROVAL";
155
+ DENIED: "DENIED";
156
+ DRY_RUN: "DRY_RUN";
157
+ }>>;
158
+ errorCode: z.ZodNullable<z.ZodString>;
159
+ traceId: z.ZodNullable<z.ZodString>;
160
+ idempotencyKey: z.ZodNullable<z.ZodString>;
161
+ approvalId: z.ZodNullable<z.ZodString>;
162
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
163
+ }, z.core.$strip>>;
164
+ nextCursor: z.ZodNullable<z.ZodString>;
165
+ }, z.core.$strip>;
166
+ export type AuditLogPage = z.infer<typeof auditLogPageSchema>;
167
+ export declare const agentPolicyDecisionSchema: z.ZodEnum<{
168
+ APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
169
+ DENIED: "DENIED";
170
+ ALLOW: "ALLOW";
171
+ }>;
172
+ export type AgentPolicyDecision = z.infer<typeof agentPolicyDecisionSchema>;
173
+ export declare const writePreviewSchema: z.ZodObject<{
174
+ operationId: z.ZodString;
175
+ method: z.ZodString;
176
+ path: z.ZodString;
177
+ target: z.ZodObject<{
178
+ type: z.ZodString;
179
+ id: z.ZodNullable<z.ZodString>;
180
+ }, z.core.$strip>;
181
+ changes: z.ZodArray<z.ZodObject<{
182
+ field: z.ZodString;
183
+ before: z.ZodUnknown;
184
+ after: z.ZodUnknown;
185
+ }, z.core.$strip>>;
186
+ facts: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
187
+ }, z.core.$strip>;
188
+ export type WritePreview = z.infer<typeof writePreviewSchema>;
189
+ /** `x-sayren-dry-run: 1`을 실은 쓰기 요청의 응답(200) — 실행하지 않고 판정과 영향만 돌려준다 */
190
+ export declare const writeDryRunResultSchema: z.ZodObject<{
191
+ dryRun: z.ZodLiteral<true>;
192
+ decision: z.ZodEnum<{
193
+ APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
194
+ DENIED: "DENIED";
195
+ ALLOW: "ALLOW";
196
+ }>;
197
+ reason: z.ZodNullable<z.ZodString>;
198
+ preview: z.ZodObject<{
199
+ operationId: z.ZodString;
200
+ method: z.ZodString;
201
+ path: z.ZodString;
202
+ target: z.ZodObject<{
203
+ type: z.ZodString;
204
+ id: z.ZodNullable<z.ZodString>;
205
+ }, z.core.$strip>;
206
+ changes: z.ZodArray<z.ZodObject<{
207
+ field: z.ZodString;
208
+ before: z.ZodUnknown;
209
+ after: z.ZodUnknown;
210
+ }, z.core.$strip>>;
211
+ facts: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
212
+ }, z.core.$strip>;
213
+ }, z.core.$strip>;
214
+ export type WriteDryRunResult = z.infer<typeof writeDryRunResultSchema>;
215
+ export declare const approvalStatusSchema: z.ZodEnum<{
216
+ PENDING: "PENDING";
217
+ FAILED: "FAILED";
218
+ SUCCEEDED: "SUCCEEDED";
219
+ EXECUTING: "EXECUTING";
220
+ UNKNOWN: "UNKNOWN";
221
+ REJECTED: "REJECTED";
222
+ EXPIRED: "EXPIRED";
223
+ }>;
224
+ export type ApprovalStatus = z.infer<typeof approvalStatusSchema>;
225
+ export declare const approvalRequestSchema: z.ZodObject<{
226
+ approvalId: z.ZodString;
227
+ status: z.ZodEnum<{
228
+ PENDING: "PENDING";
229
+ FAILED: "FAILED";
230
+ SUCCEEDED: "SUCCEEDED";
231
+ EXECUTING: "EXECUTING";
232
+ UNKNOWN: "UNKNOWN";
233
+ REJECTED: "REJECTED";
234
+ EXPIRED: "EXPIRED";
235
+ }>;
236
+ operationId: z.ZodString;
237
+ method: z.ZodString;
238
+ path: z.ZodString;
239
+ body: z.ZodUnknown;
240
+ idempotencyKey: z.ZodNullable<z.ZodString>;
241
+ reason: z.ZodString;
242
+ actor: z.ZodObject<{
243
+ type: z.ZodEnum<{
244
+ USER: "USER";
245
+ AGENT: "AGENT";
246
+ APP: "APP";
247
+ TOKEN: "TOKEN";
248
+ SYSTEM: "SYSTEM";
249
+ }>;
250
+ id: z.ZodString;
251
+ name: z.ZodNullable<z.ZodString>;
252
+ }, z.core.$strip>;
253
+ preview: z.ZodNullable<z.ZodObject<{
254
+ operationId: z.ZodString;
255
+ method: z.ZodString;
256
+ path: z.ZodString;
257
+ target: z.ZodObject<{
258
+ type: z.ZodString;
259
+ id: z.ZodNullable<z.ZodString>;
260
+ }, z.core.$strip>;
261
+ changes: z.ZodArray<z.ZodObject<{
262
+ field: z.ZodString;
263
+ before: z.ZodUnknown;
264
+ after: z.ZodUnknown;
265
+ }, z.core.$strip>>;
266
+ facts: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
267
+ }, z.core.$strip>>;
268
+ createdAt: z.ZodString;
269
+ expiresAt: z.ZodString;
270
+ decidedAt: z.ZodNullable<z.ZodString>;
271
+ decidedBy: z.ZodNullable<z.ZodObject<{
272
+ id: z.ZodString;
273
+ name: z.ZodNullable<z.ZodString>;
274
+ }, z.core.$strip>>;
275
+ decisionNote: z.ZodNullable<z.ZodString>;
276
+ executedAt: z.ZodNullable<z.ZodString>;
277
+ result: z.ZodNullable<z.ZodObject<{
278
+ statusCode: z.ZodNumber;
279
+ data: z.ZodUnknown;
280
+ error: z.ZodNullable<z.ZodObject<{
281
+ code: z.ZodString;
282
+ message: z.ZodString;
283
+ }, z.core.$strip>>;
284
+ }, z.core.$strip>>;
285
+ approvalUrl: z.ZodNullable<z.ZodString>;
286
+ }, z.core.$strip>;
287
+ export type ApprovalRequest = z.infer<typeof approvalRequestSchema>;
288
+ export declare const approvalListQuerySchema: z.ZodObject<{
289
+ status: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodEnum<{
290
+ PENDING: "PENDING";
291
+ FAILED: "FAILED";
292
+ SUCCEEDED: "SUCCEEDED";
293
+ EXECUTING: "EXECUTING";
294
+ UNKNOWN: "UNKNOWN";
295
+ REJECTED: "REJECTED";
296
+ EXPIRED: "EXPIRED";
297
+ }>>>>;
298
+ cursor: z.ZodOptional<z.ZodString>;
299
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
300
+ }, z.core.$strip>;
301
+ export type ApprovalListParams = z.infer<typeof approvalListQuerySchema>;
302
+ export type ApprovalListOptions = Omit<ApprovalListParams, "status"> & {
303
+ status?: ApprovalStatus | ApprovalStatus[];
304
+ };
305
+ export declare const approvalPageSchema: z.ZodObject<{
306
+ items: z.ZodArray<z.ZodObject<{
307
+ approvalId: z.ZodString;
308
+ status: z.ZodEnum<{
309
+ PENDING: "PENDING";
310
+ FAILED: "FAILED";
311
+ SUCCEEDED: "SUCCEEDED";
312
+ EXECUTING: "EXECUTING";
313
+ UNKNOWN: "UNKNOWN";
314
+ REJECTED: "REJECTED";
315
+ EXPIRED: "EXPIRED";
316
+ }>;
317
+ operationId: z.ZodString;
318
+ method: z.ZodString;
319
+ path: z.ZodString;
320
+ body: z.ZodUnknown;
321
+ idempotencyKey: z.ZodNullable<z.ZodString>;
322
+ reason: z.ZodString;
323
+ actor: z.ZodObject<{
324
+ type: z.ZodEnum<{
325
+ USER: "USER";
326
+ AGENT: "AGENT";
327
+ APP: "APP";
328
+ TOKEN: "TOKEN";
329
+ SYSTEM: "SYSTEM";
330
+ }>;
331
+ id: z.ZodString;
332
+ name: z.ZodNullable<z.ZodString>;
333
+ }, z.core.$strip>;
334
+ preview: z.ZodNullable<z.ZodObject<{
335
+ operationId: z.ZodString;
336
+ method: z.ZodString;
337
+ path: z.ZodString;
338
+ target: z.ZodObject<{
339
+ type: z.ZodString;
340
+ id: z.ZodNullable<z.ZodString>;
341
+ }, z.core.$strip>;
342
+ changes: z.ZodArray<z.ZodObject<{
343
+ field: z.ZodString;
344
+ before: z.ZodUnknown;
345
+ after: z.ZodUnknown;
346
+ }, z.core.$strip>>;
347
+ facts: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
348
+ }, z.core.$strip>>;
349
+ createdAt: z.ZodString;
350
+ expiresAt: z.ZodString;
351
+ decidedAt: z.ZodNullable<z.ZodString>;
352
+ decidedBy: z.ZodNullable<z.ZodObject<{
353
+ id: z.ZodString;
354
+ name: z.ZodNullable<z.ZodString>;
355
+ }, z.core.$strip>>;
356
+ decisionNote: z.ZodNullable<z.ZodString>;
357
+ executedAt: z.ZodNullable<z.ZodString>;
358
+ result: z.ZodNullable<z.ZodObject<{
359
+ statusCode: z.ZodNumber;
360
+ data: z.ZodUnknown;
361
+ error: z.ZodNullable<z.ZodObject<{
362
+ code: z.ZodString;
363
+ message: z.ZodString;
364
+ }, z.core.$strip>>;
365
+ }, z.core.$strip>>;
366
+ approvalUrl: z.ZodNullable<z.ZodString>;
367
+ }, z.core.$strip>>;
368
+ nextCursor: z.ZodNullable<z.ZodString>;
369
+ }, z.core.$strip>;
370
+ export type ApprovalPage = z.infer<typeof approvalPageSchema>;
371
+ export declare const approvalDecisionRequestSchema: z.ZodObject<{
372
+ note: z.ZodOptional<z.ZodString>;
373
+ }, z.core.$strip>;
374
+ export type ApprovalDecisionRequest = z.infer<typeof approvalDecisionRequestSchema>;
375
+ //#endregion
3
376
  //#region src/http.d.ts
4
377
  export declare class ApiError extends Error {
5
378
  readonly status: number;
@@ -16,6 +389,32 @@ export declare class ApiError extends Error {
16
389
  /** 엔벨로프 `$.error.docs` — 이 에러 코드를 설명하는 문서 URL. 매핑이 없으면 undefined */
17
390
  docs?: string | undefined);
18
391
  }
392
+ /** 에이전트 쓰기가 승인 대기로 보류됐다(202) */
393
+ export declare const APPROVAL_REQUIRED_CODE = "APPROVAL_REQUIRED";
394
+ /** 같은 멱등키의 승인 요청이 이미 끝났다(200) — 결과는 승인 요청의 `status`·`result`다 */
395
+ export declare const APPROVAL_ALREADY_DECIDED_CODE = "APPROVAL_ALREADY_DECIDED";
396
+ /**
397
+ * 쓰기 요청이 실행되지 않고 승인 흐름에 걸렸다 (이슈 #36). 응답 `data`가 요청한 리소스가 아니라 승인 요청이라
398
+ * 성공 값으로 돌려주지 않는다 — 돌려주면 호출부가 승인 요청을 상품·주문으로 읽는다.
399
+ *
400
+ * - `code = APPROVAL_REQUIRED`(202): 에이전트의 고위험 쓰기가 보류됐다. 아직 아무것도 바뀌지 않았다.
401
+ * 셀러가 콘솔(`approval.approvalUrl`)에서 승인하면 서버가 원 요청을 실행한다. 같은 요청을 다시 보내지 말고
402
+ * `approvalRequests.get(approvalId)`로 결과를 확인한다.
403
+ * - `code = APPROVAL_ALREADY_DECIDED`(200): 같은 멱등키로 보낸 요청의 승인이 이미 끝났다. `status`가
404
+ * `SUCCEEDED`·`FAILED`·`UNKNOWN`이면 실행 결과(`approval.result`)를 보고, `REJECTED`·`EXPIRED`면 새 멱등키로 다시 요청한다.
405
+ */
406
+ export declare class ApprovalPendingError extends Error {
407
+ readonly code: typeof APPROVAL_REQUIRED_CODE | typeof APPROVAL_ALREADY_DECIDED_CODE;
408
+ /** HTTP 상태 코드 (202·200) */
409
+ readonly httpStatus: number;
410
+ readonly approval: ApprovalRequest;
411
+ readonly approvalId: string;
412
+ /** 승인 요청 상태 */
413
+ readonly status: ApprovalStatus;
414
+ constructor(code: typeof APPROVAL_REQUIRED_CODE | typeof APPROVAL_ALREADY_DECIDED_CODE,
415
+ /** HTTP 상태 코드 (202·200) */
416
+ httpStatus: number, approval: ApprovalRequest, message: string);
417
+ }
19
418
  type TokenSource = string | null | undefined | (() => string | null | undefined);
20
419
  type Query = Record<string, string | number | boolean | undefined>;
21
420
  export declare function buildQuery(query?: Query): string;
@@ -185,11 +584,11 @@ export declare const analyticsChannelSchema: z.ZodEnum<{
185
584
  PAID: "PAID";
186
585
  DIRECT: "DIRECT";
187
586
  CAMPAIGN: "CAMPAIGN";
587
+ UNKNOWN: "UNKNOWN";
188
588
  ORGANIC_SEARCH: "ORGANIC_SEARCH";
189
589
  SOCIAL: "SOCIAL";
190
590
  EMAIL: "EMAIL";
191
591
  REFERRAL: "REFERRAL";
192
- UNKNOWN: "UNKNOWN";
193
592
  }>;
194
593
  export type AnalyticsChannel = z.infer<typeof analyticsChannelSchema>;
195
594
  export declare const analyticsSourceGroupBySchema: z.ZodEnum<{
@@ -219,11 +618,11 @@ export declare const analyticsSourceRowSchema: z.ZodObject<{
219
618
  PAID: "PAID";
220
619
  DIRECT: "DIRECT";
221
620
  CAMPAIGN: "CAMPAIGN";
621
+ UNKNOWN: "UNKNOWN";
222
622
  ORGANIC_SEARCH: "ORGANIC_SEARCH";
223
623
  SOCIAL: "SOCIAL";
224
624
  EMAIL: "EMAIL";
225
625
  REFERRAL: "REFERRAL";
226
- UNKNOWN: "UNKNOWN";
227
626
  }>>;
228
627
  source: z.ZodNullable<z.ZodString>;
229
628
  medium: z.ZodNullable<z.ZodString>;
@@ -255,11 +654,11 @@ export declare const analyticsSourcesSchema: z.ZodObject<{
255
654
  PAID: "PAID";
256
655
  DIRECT: "DIRECT";
257
656
  CAMPAIGN: "CAMPAIGN";
657
+ UNKNOWN: "UNKNOWN";
258
658
  ORGANIC_SEARCH: "ORGANIC_SEARCH";
259
659
  SOCIAL: "SOCIAL";
260
660
  EMAIL: "EMAIL";
261
661
  REFERRAL: "REFERRAL";
262
- UNKNOWN: "UNKNOWN";
263
662
  }>>;
264
663
  source: z.ZodNullable<z.ZodString>;
265
664
  medium: z.ZodNullable<z.ZodString>;
@@ -743,6 +1142,7 @@ export declare const apiTokenSchema: z.ZodObject<{
743
1142
  createdAt: z.ZodString;
744
1143
  expiresAt: z.ZodNullable<z.ZodString>;
745
1144
  lastUsedAt: z.ZodNullable<z.ZodString>;
1145
+ agent: z.ZodDefault<z.ZodBoolean>;
746
1146
  }, z.core.$strip>;
747
1147
  export type ApiToken = z.infer<typeof apiTokenSchema>;
748
1148
  /** 생성 응답 — 평문 토큰은 이 응답에서 단 한 번만 노출된다 */
@@ -757,6 +1157,7 @@ export declare const apiTokenCreatedSchema: z.ZodObject<{
757
1157
  createdAt: z.ZodString;
758
1158
  expiresAt: z.ZodNullable<z.ZodString>;
759
1159
  lastUsedAt: z.ZodNullable<z.ZodString>;
1160
+ agent: z.ZodDefault<z.ZodBoolean>;
760
1161
  token: z.ZodString;
761
1162
  }, z.core.$strip>;
762
1163
  export type ApiTokenCreated = z.infer<typeof apiTokenCreatedSchema>;
@@ -764,6 +1165,7 @@ export declare const apiTokenCreateRequestSchema: z.ZodObject<{
764
1165
  name: z.ZodString;
765
1166
  scopes: z.ZodArray<z.ZodString>;
766
1167
  expiresInDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1168
+ agent: z.ZodOptional<z.ZodBoolean>;
767
1169
  }, z.core.$strip>;
768
1170
  export type ApiTokenCreateRequest = z.infer<typeof apiTokenCreateRequestSchema>;
769
1171
  //#endregion
@@ -1067,13 +1469,13 @@ export declare const claimTypeSchema: z.ZodEnum<{
1067
1469
  }>;
1068
1470
  export type ClaimType = z.infer<typeof claimTypeSchema>;
1069
1471
  export declare const claimStatusSchema: z.ZodEnum<{
1472
+ REJECTED: "REJECTED";
1070
1473
  REQUESTED: "REQUESTED";
1071
1474
  HELD: "HELD";
1072
1475
  COLLECTING: "COLLECTING";
1073
1476
  COLLECTED: "COLLECTED";
1074
1477
  REDELIVERING: "REDELIVERING";
1075
1478
  APPROVED: "APPROVED";
1076
- REJECTED: "REJECTED";
1077
1479
  COMPLETED: "COMPLETED";
1078
1480
  WITHDRAWN: "WITHDRAWN";
1079
1481
  }>;
@@ -1111,13 +1513,13 @@ export declare const claimSchema: z.ZodObject<{
1111
1513
  CANCEL: "CANCEL";
1112
1514
  }>;
1113
1515
  status: z.ZodEnum<{
1516
+ REJECTED: "REJECTED";
1114
1517
  REQUESTED: "REQUESTED";
1115
1518
  HELD: "HELD";
1116
1519
  COLLECTING: "COLLECTING";
1117
1520
  COLLECTED: "COLLECTED";
1118
1521
  REDELIVERING: "REDELIVERING";
1119
1522
  APPROVED: "APPROVED";
1120
- REJECTED: "REJECTED";
1121
1523
  COMPLETED: "COMPLETED";
1122
1524
  WITHDRAWN: "WITHDRAWN";
1123
1525
  }>;
@@ -1198,13 +1600,13 @@ export declare const claimDetailSchema: z.ZodObject<{
1198
1600
  CANCEL: "CANCEL";
1199
1601
  }>;
1200
1602
  status: z.ZodEnum<{
1603
+ REJECTED: "REJECTED";
1201
1604
  REQUESTED: "REQUESTED";
1202
1605
  HELD: "HELD";
1203
1606
  COLLECTING: "COLLECTING";
1204
1607
  COLLECTED: "COLLECTED";
1205
1608
  REDELIVERING: "REDELIVERING";
1206
1609
  APPROVED: "APPROVED";
1207
- REJECTED: "REJECTED";
1208
1610
  COMPLETED: "COMPLETED";
1209
1611
  WITHDRAWN: "WITHDRAWN";
1210
1612
  }>;
@@ -1254,20 +1656,20 @@ export declare const claimDetailSchema: z.ZodObject<{
1254
1656
  }, z.core.$strip>>;
1255
1657
  histories: z.ZodOptional<z.ZodArray<z.ZodObject<{
1256
1658
  status: z.ZodEnum<{
1659
+ REJECTED: "REJECTED";
1257
1660
  REQUESTED: "REQUESTED";
1258
1661
  HELD: "HELD";
1259
1662
  COLLECTING: "COLLECTING";
1260
1663
  COLLECTED: "COLLECTED";
1261
1664
  REDELIVERING: "REDELIVERING";
1262
1665
  APPROVED: "APPROVED";
1263
- REJECTED: "REJECTED";
1264
1666
  COMPLETED: "COMPLETED";
1265
1667
  WITHDRAWN: "WITHDRAWN";
1266
1668
  }>;
1267
1669
  actor: z.ZodEnum<{
1670
+ SYSTEM: "SYSTEM";
1268
1671
  BUYER: "BUYER";
1269
1672
  SELLER: "SELLER";
1270
- SYSTEM: "SYSTEM";
1271
1673
  }>;
1272
1674
  occurredAt: z.ZodString;
1273
1675
  }, z.core.$strip>>>;
@@ -4271,9 +4673,9 @@ export declare const invitationSchema: z.ZodObject<{
4271
4673
  }>;
4272
4674
  status: z.ZodEnum<{
4273
4675
  PENDING: "PENDING";
4676
+ EXPIRED: "EXPIRED";
4274
4677
  CANCELED: "CANCELED";
4275
4678
  ACCEPTED: "ACCEPTED";
4276
- EXPIRED: "EXPIRED";
4277
4679
  }>;
4278
4680
  invitedBy: z.ZodString;
4279
4681
  expiresAt: z.ZodString;
@@ -4284,9 +4686,9 @@ export type Invitation = z.infer<typeof invitationSchema>;
4284
4686
  export declare const invitationListQuerySchema: z.ZodObject<{
4285
4687
  status: z.ZodOptional<z.ZodEnum<{
4286
4688
  PENDING: "PENDING";
4689
+ EXPIRED: "EXPIRED";
4287
4690
  CANCELED: "CANCELED";
4288
4691
  ACCEPTED: "ACCEPTED";
4289
- EXPIRED: "EXPIRED";
4290
4692
  }>>;
4291
4693
  }, z.core.$strip>;
4292
4694
  /** `PATCH /v1/store/members/{userId}` 응답 — 바뀐 역할 */
@@ -4566,6 +4968,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
4566
4968
  createdAt: string;
4567
4969
  expiresAt: string | null;
4568
4970
  lastUsedAt: string | null;
4971
+ agent: boolean;
4569
4972
  token: string;
4570
4973
  }>;
4571
4974
  list: () => Promise<{
@@ -4579,6 +4982,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
4579
4982
  createdAt: string;
4580
4983
  expiresAt: string | null;
4581
4984
  lastUsedAt: string | null;
4985
+ agent: boolean;
4582
4986
  }[]>;
4583
4987
  revoke: (tokenId: string) => Promise<void>;
4584
4988
  };
@@ -5412,7 +5816,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5412
5816
  contents: {
5413
5817
  claimId: string;
5414
5818
  type: "RETURN" | "EXCHANGE" | "CANCEL";
5415
- status: "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "REJECTED" | "COMPLETED" | "WITHDRAWN";
5819
+ status: "REJECTED" | "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "COMPLETED" | "WITHDRAWN";
5416
5820
  orderId: string;
5417
5821
  orderItemId: string;
5418
5822
  productName: string;
@@ -5449,7 +5853,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5449
5853
  get: (claimId: string) => Promise<{
5450
5854
  claimId: string;
5451
5855
  type: "RETURN" | "EXCHANGE" | "CANCEL";
5452
- status: "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "REJECTED" | "COMPLETED" | "WITHDRAWN";
5856
+ status: "REJECTED" | "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "COMPLETED" | "WITHDRAWN";
5453
5857
  orderId: string;
5454
5858
  orderItemId: string;
5455
5859
  productName: string;
@@ -5482,8 +5886,8 @@ export declare function createStoreClient(options: StoreClientOptions): {
5482
5886
  address2: string | null;
5483
5887
  } | null;
5484
5888
  histories?: {
5485
- status: "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "REJECTED" | "COMPLETED" | "WITHDRAWN";
5486
- actor: "BUYER" | "SELLER" | "SYSTEM";
5889
+ status: "REJECTED" | "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "COMPLETED" | "WITHDRAWN";
5890
+ actor: "SYSTEM" | "BUYER" | "SELLER";
5487
5891
  occurredAt: string;
5488
5892
  }[] | undefined;
5489
5893
  }>;
@@ -5512,7 +5916,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5512
5916
  completeExchange: (claimId: string) => Promise<{
5513
5917
  claimId: string;
5514
5918
  type: "RETURN" | "EXCHANGE" | "CANCEL";
5515
- status: "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "REJECTED" | "COMPLETED" | "WITHDRAWN";
5919
+ status: "REJECTED" | "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "COMPLETED" | "WITHDRAWN";
5516
5920
  orderId: string;
5517
5921
  orderItemId: string;
5518
5922
  productName: string;
@@ -6027,7 +6431,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
6027
6431
  sources: (params: AnalyticsSourcesParams) => Promise<{
6028
6432
  groupBy: "CHANNEL" | "SOURCE" | "CAMPAIGN" | "DEVICE";
6029
6433
  rows: {
6030
- channel: "PAID" | "DIRECT" | "CAMPAIGN" | "ORGANIC_SEARCH" | "SOCIAL" | "EMAIL" | "REFERRAL" | "UNKNOWN" | null;
6434
+ channel: "PAID" | "DIRECT" | "CAMPAIGN" | "UNKNOWN" | "ORGANIC_SEARCH" | "SOCIAL" | "EMAIL" | "REFERRAL" | null;
6031
6435
  source: string | null;
6032
6436
  medium: string | null;
6033
6437
  campaign: string | null;
@@ -7173,6 +7577,244 @@ export declare function createStoreClient(options: StoreClientOptions): {
7173
7577
  serverErrors: number;
7174
7578
  }>;
7175
7579
  };
7580
+ /** 감사 로그 (관리 API 쓰기의 행위자·대상·결과, 콘솔 OWNER/ADMIN, `audit:r`) */
7581
+ auditLogs: {
7582
+ /** 최신순 커서 페이지네이션. 다음 페이지는 응답의 `nextCursor`를 `cursor`로 넘긴다 */
7583
+ list: (params?: AuditLogListOptions) => Promise<{
7584
+ items: {
7585
+ auditId: string;
7586
+ occurredAt: string;
7587
+ source: "REQUEST" | "DOMAIN";
7588
+ action: string;
7589
+ actor: {
7590
+ type: "USER" | "AGENT" | "APP" | "TOKEN" | "SYSTEM";
7591
+ id: string;
7592
+ name: string | null;
7593
+ };
7594
+ actorRole: string | null;
7595
+ target: {
7596
+ type: string;
7597
+ id: string | null;
7598
+ };
7599
+ requestId: string | null;
7600
+ method: string | null;
7601
+ path: string | null;
7602
+ statusCode: number | null;
7603
+ outcome: "FAILED" | "SUCCEEDED" | "PENDING_APPROVAL" | "DENIED" | "DRY_RUN" | null;
7604
+ errorCode: string | null;
7605
+ traceId: string | null;
7606
+ idempotencyKey: string | null;
7607
+ approvalId: string | null;
7608
+ metadata: Record<string, unknown>;
7609
+ }[];
7610
+ nextCursor: string | null;
7611
+ }>;
7612
+ };
7613
+ /**
7614
+ * 승인 요청 — 에이전트의 고위험 쓰기가 202로 보류된 건. 목록·승인·거절은 콘솔 OWNER/ADMIN,
7615
+ * 단건 조회는 요청한 토큰도 할 수 있다(상태 확인용).
7616
+ */
7617
+ approvalRequests: {
7618
+ list: (params?: ApprovalListOptions) => Promise<{
7619
+ items: {
7620
+ approvalId: string;
7621
+ status: "PENDING" | "FAILED" | "SUCCEEDED" | "EXECUTING" | "UNKNOWN" | "REJECTED" | "EXPIRED";
7622
+ operationId: string;
7623
+ method: string;
7624
+ path: string;
7625
+ body: unknown;
7626
+ idempotencyKey: string | null;
7627
+ reason: string;
7628
+ actor: {
7629
+ type: "USER" | "AGENT" | "APP" | "TOKEN" | "SYSTEM";
7630
+ id: string;
7631
+ name: string | null;
7632
+ };
7633
+ preview: {
7634
+ operationId: string;
7635
+ method: string;
7636
+ path: string;
7637
+ target: {
7638
+ type: string;
7639
+ id: string | null;
7640
+ };
7641
+ changes: {
7642
+ field: string;
7643
+ before: unknown;
7644
+ after: unknown;
7645
+ }[];
7646
+ facts: Record<string, string | number | boolean | null>;
7647
+ } | null;
7648
+ createdAt: string;
7649
+ expiresAt: string;
7650
+ decidedAt: string | null;
7651
+ decidedBy: {
7652
+ id: string;
7653
+ name: string | null;
7654
+ } | null;
7655
+ decisionNote: string | null;
7656
+ executedAt: string | null;
7657
+ result: {
7658
+ statusCode: number;
7659
+ data: unknown;
7660
+ error: {
7661
+ code: string;
7662
+ message: string;
7663
+ } | null;
7664
+ } | null;
7665
+ approvalUrl: string | null;
7666
+ }[];
7667
+ nextCursor: string | null;
7668
+ }>;
7669
+ get: (approvalId: string) => Promise<{
7670
+ approvalId: string;
7671
+ status: "PENDING" | "FAILED" | "SUCCEEDED" | "EXECUTING" | "UNKNOWN" | "REJECTED" | "EXPIRED";
7672
+ operationId: string;
7673
+ method: string;
7674
+ path: string;
7675
+ body: unknown;
7676
+ idempotencyKey: string | null;
7677
+ reason: string;
7678
+ actor: {
7679
+ type: "USER" | "AGENT" | "APP" | "TOKEN" | "SYSTEM";
7680
+ id: string;
7681
+ name: string | null;
7682
+ };
7683
+ preview: {
7684
+ operationId: string;
7685
+ method: string;
7686
+ path: string;
7687
+ target: {
7688
+ type: string;
7689
+ id: string | null;
7690
+ };
7691
+ changes: {
7692
+ field: string;
7693
+ before: unknown;
7694
+ after: unknown;
7695
+ }[];
7696
+ facts: Record<string, string | number | boolean | null>;
7697
+ } | null;
7698
+ createdAt: string;
7699
+ expiresAt: string;
7700
+ decidedAt: string | null;
7701
+ decidedBy: {
7702
+ id: string;
7703
+ name: string | null;
7704
+ } | null;
7705
+ decisionNote: string | null;
7706
+ executedAt: string | null;
7707
+ result: {
7708
+ statusCode: number;
7709
+ data: unknown;
7710
+ error: {
7711
+ code: string;
7712
+ message: string;
7713
+ } | null;
7714
+ } | null;
7715
+ approvalUrl: string | null;
7716
+ }>;
7717
+ /**
7718
+ * 승인하면 서버가 원 요청을 그대로 한 번 실행한다. 응답은 실행을 기다리지 않은 `EXECUTING` 상태이고,
7719
+ * 결과(`SUCCEEDED`·`FAILED`·`UNKNOWN`)는 `get`으로 확인한다. 두 번 눌러도 한 번만 실행한다
7720
+ */
7721
+ approve: (approvalId: string, body?: ApprovalDecisionRequest) => Promise<{
7722
+ approvalId: string;
7723
+ status: "PENDING" | "FAILED" | "SUCCEEDED" | "EXECUTING" | "UNKNOWN" | "REJECTED" | "EXPIRED";
7724
+ operationId: string;
7725
+ method: string;
7726
+ path: string;
7727
+ body: unknown;
7728
+ idempotencyKey: string | null;
7729
+ reason: string;
7730
+ actor: {
7731
+ type: "USER" | "AGENT" | "APP" | "TOKEN" | "SYSTEM";
7732
+ id: string;
7733
+ name: string | null;
7734
+ };
7735
+ preview: {
7736
+ operationId: string;
7737
+ method: string;
7738
+ path: string;
7739
+ target: {
7740
+ type: string;
7741
+ id: string | null;
7742
+ };
7743
+ changes: {
7744
+ field: string;
7745
+ before: unknown;
7746
+ after: unknown;
7747
+ }[];
7748
+ facts: Record<string, string | number | boolean | null>;
7749
+ } | null;
7750
+ createdAt: string;
7751
+ expiresAt: string;
7752
+ decidedAt: string | null;
7753
+ decidedBy: {
7754
+ id: string;
7755
+ name: string | null;
7756
+ } | null;
7757
+ decisionNote: string | null;
7758
+ executedAt: string | null;
7759
+ result: {
7760
+ statusCode: number;
7761
+ data: unknown;
7762
+ error: {
7763
+ code: string;
7764
+ message: string;
7765
+ } | null;
7766
+ } | null;
7767
+ approvalUrl: string | null;
7768
+ }>;
7769
+ reject: (approvalId: string, body?: ApprovalDecisionRequest) => Promise<{
7770
+ approvalId: string;
7771
+ status: "PENDING" | "FAILED" | "SUCCEEDED" | "EXECUTING" | "UNKNOWN" | "REJECTED" | "EXPIRED";
7772
+ operationId: string;
7773
+ method: string;
7774
+ path: string;
7775
+ body: unknown;
7776
+ idempotencyKey: string | null;
7777
+ reason: string;
7778
+ actor: {
7779
+ type: "USER" | "AGENT" | "APP" | "TOKEN" | "SYSTEM";
7780
+ id: string;
7781
+ name: string | null;
7782
+ };
7783
+ preview: {
7784
+ operationId: string;
7785
+ method: string;
7786
+ path: string;
7787
+ target: {
7788
+ type: string;
7789
+ id: string | null;
7790
+ };
7791
+ changes: {
7792
+ field: string;
7793
+ before: unknown;
7794
+ after: unknown;
7795
+ }[];
7796
+ facts: Record<string, string | number | boolean | null>;
7797
+ } | null;
7798
+ createdAt: string;
7799
+ expiresAt: string;
7800
+ decidedAt: string | null;
7801
+ decidedBy: {
7802
+ id: string;
7803
+ name: string | null;
7804
+ } | null;
7805
+ decisionNote: string | null;
7806
+ executedAt: string | null;
7807
+ result: {
7808
+ statusCode: number;
7809
+ data: unknown;
7810
+ error: {
7811
+ code: string;
7812
+ message: string;
7813
+ } | null;
7814
+ } | null;
7815
+ approvalUrl: string | null;
7816
+ }>;
7817
+ };
7176
7818
  reviews: {
7177
7819
  list: (params?: ReviewListParams) => Promise<{
7178
7820
  page: number;
@@ -7327,7 +7969,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
7327
7969
  invitationId: string;
7328
7970
  email: string;
7329
7971
  role: "ADMIN" | "STAFF";
7330
- status: "PENDING" | "CANCELED" | "ACCEPTED" | "EXPIRED";
7972
+ status: "PENDING" | "EXPIRED" | "CANCELED" | "ACCEPTED";
7331
7973
  invitedBy: string;
7332
7974
  expiresAt: string;
7333
7975
  createdAt: string;
@@ -7479,7 +8121,7 @@ export declare const scopeAccessSchema: z.ZodEnum<{
7479
8121
  rw: "rw";
7480
8122
  }>;
7481
8123
  export type ScopeAccess = z.infer<typeof scopeAccessSchema>;
7482
- /** 리소스별로 부여 가능한 접근 수준. settlement·analytics는 쓰기 API가 없어 `r`만 존재한다 */
8124
+ /** 리소스별로 부여 가능한 접근 수준. settlement·analytics·audit는 쓰기 API가 없어 `r`만 존재한다 */
7483
8125
  export declare const STORE_SCOPE_RESOURCES: {
7484
8126
  readonly product: readonly ["r", "rw"];
7485
8127
  readonly category: readonly ["r", "rw"];
@@ -7493,6 +8135,7 @@ export declare const STORE_SCOPE_RESOURCES: {
7493
8135
  readonly store: readonly ["r", "rw"];
7494
8136
  readonly member: readonly ["r", "rw"];
7495
8137
  readonly customer: readonly ["r", "rw"];
8138
+ readonly audit: readonly ["r"];
7496
8139
  };
7497
8140
  export type StoreScopeResource = keyof typeof STORE_SCOPE_RESOURCES;
7498
8141
  export declare const storeScopeResourceSchema: z.ZodEnum<{
@@ -7508,6 +8151,7 @@ export declare const storeScopeResourceSchema: z.ZodEnum<{
7508
8151
  store: "store";
7509
8152
  member: "member";
7510
8153
  customer: "customer";
8154
+ audit: "audit";
7511
8155
  }>;
7512
8156
  /** 카탈로그상 존재하는 스코프 문자열인가 (예: `settlement:rw`는 false) */
7513
8157
  export declare function isStoreScope(scope: string): boolean;
@@ -7517,8 +8161,8 @@ export declare function isStoreScope(scope: string): boolean;
7517
8161
  * 발급 시 지정한 스코프만 갖는다(발급자 보유 스코프 이내).
7518
8162
  */
7519
8163
  export declare const STORE_ROLE_SCOPES: {
7520
- readonly OWNER: readonly ["product:rw", "category:rw", "order:rw", "claim:rw", "inquiry:rw", "review:rw", "settlement:r", "analytics:r", "webhook:rw", "store:rw", "member:rw", "customer:rw"];
7521
- readonly ADMIN: readonly ["product:rw", "category:rw", "order:rw", "claim:rw", "inquiry:rw", "review:rw", "analytics:r", "webhook:rw", "store:rw", "member:rw", "customer:rw"];
8164
+ readonly OWNER: readonly ["product:rw", "category:rw", "order:rw", "claim:rw", "inquiry:rw", "review:rw", "settlement:r", "analytics:r", "webhook:rw", "store:rw", "member:rw", "customer:rw", "audit:r"];
8165
+ readonly ADMIN: readonly ["product:rw", "category:rw", "order:rw", "claim:rw", "inquiry:rw", "review:rw", "analytics:r", "webhook:rw", "store:rw", "member:rw", "customer:rw", "audit:r"];
7522
8166
  readonly STAFF: readonly ["product:rw", "category:rw", "order:rw", "claim:rw", "inquiry:rw", "review:rw", "customer:r"];
7523
8167
  };
7524
8168
  //#endregion
@@ -7710,6 +8354,56 @@ export interface DeliveryQuoteInput {
7710
8354
  */
7711
8355
  export declare function quoteDelivery(input: DeliveryQuoteInput): DeliveryQuote;
7712
8356
  //#endregion
8357
+ //#region src/schemas/telemetry.d.ts
8358
+ /**
8359
+ * MCP 도구 호출 계측 (`POST /v1/telemetry/mcp`, 이슈 #34).
8360
+ *
8361
+ * `@sayren/mcp`가 `verify_storefront` 같은 도구를 돌린 뒤 결과 요약을 보낸다. 목적은 하나다 —
8362
+ * AI가 만든 스토어프론트가 **처음에** 규칙을 통과하는지, 통과하지 못하면 어떤 규칙에서 막히는지를
8363
+ * 세는 것이다. 그 숫자가 규칙과 안내를 고치는 근거가 된다.
8364
+ *
8365
+ * **보내지 않는 것**: 파일 경로·소스 코드·위반 상세(`detail`)·토큰·사람 식별자. 규칙 id와 개수뿐이다.
8366
+ * 테넌트는 요청 토큰이 정한다(본문에 스토어 id가 없다). 옵트아웃은 클라이언트의 `SAYREN_TELEMETRY=0`이다.
8367
+ *
8368
+ * 알 수 없는 키는 저장하지 않고 버린다(`.strict()`를 쓰지 않는다) — 새 버전 클라이언트가 필드를
8369
+ * 하나 더 실었다고 계측 전체가 400으로 날아가면 그 버전의 숫자가 통째로 빈다.
8370
+ */
8371
+ /** 규칙 하나의 검사 결과. `ruleId`는 늘어나므로 enum이 아니라 형식만 좁힌다 */
8372
+ export declare const mcpRuleResultSchema: z.ZodObject<{
8373
+ ruleId: z.ZodString;
8374
+ status: z.ZodEnum<{
8375
+ pass: "pass";
8376
+ violation: "violation";
8377
+ }>;
8378
+ count: z.ZodNumber;
8379
+ }, z.core.$strip>;
8380
+ export type McpRuleResult = z.infer<typeof mcpRuleResultSchema>;
8381
+ /**
8382
+ * 한 번에 실을 수 있는 규칙 결과 수 — 규칙 수(현재 16개)의 두 배까지다.
8383
+ *
8384
+ * 규칙 수 수준으로 좁게 둔다. 이 배열이 그대로 `mcp_tool_events.results` jsonb가 되므로 상한이
8385
+ * 넉넉하면 한 행의 크기가 그만큼 커지고, 집계가 그 jsonb를 펼친다.
8386
+ */
8387
+ export declare const MCP_TELEMETRY_MAX_RESULTS = 32;
8388
+ export declare const mcpToolEventSchema: z.ZodObject<{
8389
+ tool: z.ZodString;
8390
+ clientVersion: z.ZodOptional<z.ZodString>;
8391
+ sessionId: z.ZodString;
8392
+ attempt: z.ZodNumber;
8393
+ durationMs: z.ZodOptional<z.ZodNumber>;
8394
+ ok: z.ZodBoolean;
8395
+ checkedFiles: z.ZodNumber;
8396
+ results: z.ZodArray<z.ZodObject<{
8397
+ ruleId: z.ZodString;
8398
+ status: z.ZodEnum<{
8399
+ pass: "pass";
8400
+ violation: "violation";
8401
+ }>;
8402
+ count: z.ZodNumber;
8403
+ }, z.core.$strip>>;
8404
+ }, z.core.$strip>;
8405
+ export type McpToolEvent = z.infer<typeof mcpToolEventSchema>;
8406
+ //#endregion
7713
8407
  //#region src/schemas/webhook-event.d.ts
7714
8408
  export declare const orderWebhookEventDataSchema: z.ZodObject<{
7715
8409
  orderId: z.ZodString;
@@ -7736,13 +8430,13 @@ export declare const claimWebhookEventDataSchema: z.ZodObject<{
7736
8430
  CANCEL: "CANCEL";
7737
8431
  }>;
7738
8432
  status: z.ZodEnum<{
8433
+ REJECTED: "REJECTED";
7739
8434
  REQUESTED: "REQUESTED";
7740
8435
  HELD: "HELD";
7741
8436
  COLLECTING: "COLLECTING";
7742
8437
  COLLECTED: "COLLECTED";
7743
8438
  REDELIVERING: "REDELIVERING";
7744
8439
  APPROVED: "APPROVED";
7745
- REJECTED: "REJECTED";
7746
8440
  COMPLETED: "COMPLETED";
7747
8441
  WITHDRAWN: "WITHDRAWN";
7748
8442
  }>;
@@ -7814,13 +8508,13 @@ export declare const claimWebhookEventSchema: z.ZodObject<{
7814
8508
  CANCEL: "CANCEL";
7815
8509
  }>;
7816
8510
  status: z.ZodEnum<{
8511
+ REJECTED: "REJECTED";
7817
8512
  REQUESTED: "REQUESTED";
7818
8513
  HELD: "HELD";
7819
8514
  COLLECTING: "COLLECTING";
7820
8515
  COLLECTED: "COLLECTED";
7821
8516
  REDELIVERING: "REDELIVERING";
7822
8517
  APPROVED: "APPROVED";
7823
- REJECTED: "REJECTED";
7824
8518
  COMPLETED: "COMPLETED";
7825
8519
  WITHDRAWN: "WITHDRAWN";
7826
8520
  }>;
@@ -7910,13 +8604,13 @@ export declare const webhookEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7910
8604
  CANCEL: "CANCEL";
7911
8605
  }>;
7912
8606
  status: z.ZodEnum<{
8607
+ REJECTED: "REJECTED";
7913
8608
  REQUESTED: "REQUESTED";
7914
8609
  HELD: "HELD";
7915
8610
  COLLECTING: "COLLECTING";
7916
8611
  COLLECTED: "COLLECTED";
7917
8612
  REDELIVERING: "REDELIVERING";
7918
8613
  APPROVED: "APPROVED";
7919
- REJECTED: "REJECTED";
7920
8614
  COMPLETED: "COMPLETED";
7921
8615
  WITHDRAWN: "WITHDRAWN";
7922
8616
  }>;