@sayren/store-sdk 0.30.10 → 0.30.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sayren/store-sdk",
3
- "version": "0.30.10",
3
+ "version": "0.30.11",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "exports": {
package/src/client.ts CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  import { type ApiLogListOptions, apiLogPageSchema, apiLogSummarySchema } from "./schemas/api-log";
24
24
  import {
25
25
  type AppInstallationSettingsUpdate,
26
+ appInstallationActivitySchema,
26
27
  appInstallationSchema,
27
28
  appInstallationSelfSchema,
28
29
  appInstallationSettingsUpdateSchema,
@@ -1469,6 +1470,20 @@ export function createStoreClient(options: StoreClientOptions) {
1469
1470
  ),
1470
1471
  remove: (installationId: string) =>
1471
1472
  storeHttp.requestVoid("DELETE", path`/apps/installations/${installationId}`),
1473
+ /** 실행 기록 — 최근 이벤트 전송 결과와 최근 7일 관리 API 호출 수 */
1474
+ activity: (installationId: string) =>
1475
+ storeHttp.request(
1476
+ "GET",
1477
+ path`/apps/installations/${installationId}/activity`,
1478
+ appInstallationActivitySchema,
1479
+ ),
1480
+ /** 권한 업데이트 동의 — 넓어진 새 버전(`pendingVersion`)으로 옮긴다(상점 플랫폼 전용) */
1481
+ consent: (installationId: string) =>
1482
+ storeHttp.request(
1483
+ "POST",
1484
+ path`/apps/installations/${installationId}/consent`,
1485
+ appInstallationSchema,
1486
+ ),
1472
1487
  /** 앱 화면 iframe에 넘길 세션 토큰(5분) */
1473
1488
  session: (installationId: string) =>
1474
1489
  storeHttp.request(
@@ -7,6 +7,7 @@ import {
7
7
  appHandleSchema,
8
8
  appSettingFieldSchema,
9
9
  } from "./app-manifest";
10
+ import { webhookDeliveryErrorCodeSchema, webhookDeliveryStatusSchema } from "./misc";
10
11
 
11
12
  /**
12
13
  * 설치 앱 관리 API 계약 (이슈 #22) — `/v1/apps/installations/**`(상점이 설치한 앱), `/v1/app/installation`(설치 토큰 자기 조회).
@@ -71,6 +72,16 @@ export const appInstallationSchema = z.object({
71
72
  .int()
72
73
  .nullable()
73
74
  .describe("재동의가 필요한 새 버전. 없으면 null"),
75
+ pendingVersion: z
76
+ .object({
77
+ number: z.number().int(),
78
+ scopes: z.array(z.string()),
79
+ networkHosts: z.array(z.string()),
80
+ events: z.array(appEventTypeSchema),
81
+ })
82
+ .nullable()
83
+ .optional()
84
+ .describe("재동의가 필요한 새 버전이 요청하는 권한·외부 호스트·이벤트(전체). 없으면 null"),
74
85
  grantedScopes: z.array(z.string()).describe("동의한 스코프"),
75
86
  grantedNetworkHosts: z.array(z.string()).describe("동의한 외부 호출 호스트"),
76
87
  events: z.array(appEventTypeSchema).describe("이 설치가 받는 이벤트"),
@@ -84,6 +95,26 @@ export const appInstallationSchema = z.object({
84
95
  });
85
96
  export type AppInstallation = z.infer<typeof appInstallationSchema>;
86
97
 
98
+ /** 실행 기록 한 줄 — 앱에 보낸 이벤트 하나의 전송 결과. 로그 본문은 개발자만 본다(매뉴얼 「앱 설치와 관리」) */
99
+ export const appInstallationRunSchema = z.object({
100
+ deliveryId: z.string(),
101
+ eventType: z.string().describe("이벤트 이름(`ORDER.PAID`·`APP.INSTALLED` 등)"),
102
+ status: webhookDeliveryStatusSchema,
103
+ errorCode: webhookDeliveryErrorCodeSchema.nullable(),
104
+ attemptCount: z.number().int(),
105
+ createdAt: z.string(),
106
+ attemptedAt: z.string().nullable(),
107
+ nextAttemptAt: z.string().nullable(),
108
+ });
109
+ export type AppInstallationRun = z.infer<typeof appInstallationRunSchema>;
110
+
111
+ /** `GET /v1/apps/installations/{id}/activity` — 최근 이벤트 전송 결과(50건)와 최근 7일 관리 API 호출 수 */
112
+ export const appInstallationActivitySchema = z.object({
113
+ runs: z.array(appInstallationRunSchema),
114
+ apiCalls7d: z.number().int().describe("최근 7일 이 설치가 부른 관리 API 수"),
115
+ });
116
+ export type AppInstallationActivity = z.infer<typeof appInstallationActivitySchema>;
117
+
87
118
  /**
88
119
  * `POST /v1/apps/installations`(상점 플랫폼 전용) — 둘 중 하나다.
89
120
  * - `{ result }`: accounts 설치 동의 결과(1회용 JWT). 개발자 포털 [내 상점에 설치]가 이 길로 온다