@sayren/store-sdk 0.30.11 → 0.30.12

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.
@@ -29,6 +29,10 @@ export const appInstallationStatusSchema = z.enum(["ACTIVE", "UNINSTALLED", "SUS
29
29
  export type AppInstallationStatus = z.infer<typeof appInstallationStatusSchema>;
30
30
 
31
31
  /** 설치 앱의 앱 정보 — 상점이 보는 범위만(개발자 비밀 값·소스·빌드는 없다) */
32
+ /** 상점이 보는 앱 공개 범위 — 개발 중(개발자 조직) · 이 상점 전용 · 공개 */
33
+ export const appVisibilitySchema = z.enum(["DEVELOPMENT", "PRIVATE", "PUBLIC"]);
34
+ export type AppVisibility = z.infer<typeof appVisibilitySchema>;
35
+
32
36
  export const appInstallationAppSchema = z.object({
33
37
  appId: z.string(),
34
38
  handle: z.string().describe("앱 handle. 앱 화면 주소의 라벨"),
@@ -61,6 +65,22 @@ export const appInstallationSettingsUpdateSchema = z.object({
61
65
  });
62
66
  export type AppInstallationSettingsUpdate = z.infer<typeof appInstallationSettingsUpdateSchema>;
63
67
 
68
+ /** 예약 작업 한 줄 — 매니페스트 `schedules`의 이름과 간격 */
69
+ export const appScheduleSummarySchema = z.object({
70
+ name: z.string(),
71
+ every: z.enum(["15m", "30m", "1h", "3h", "6h", "12h", "1d"]),
72
+ });
73
+ export type AppScheduleSummary = z.infer<typeof appScheduleSummarySchema>;
74
+
75
+ const publicHttpField = z
76
+ .array(z.string())
77
+ .default([])
78
+ .describe("외부에서 부를 수 있는 HTTP 핸들러(`GET /track/:id`)");
79
+ const schedulesField = z
80
+ .array(appScheduleSummarySchema)
81
+ .default([])
82
+ .describe("주기적으로 실행되는 작업");
83
+
64
84
  export const appInstallationSchema = z.object({
65
85
  installationId: z.string(),
66
86
  storeId: z.string(),
@@ -78,6 +98,8 @@ export const appInstallationSchema = z.object({
78
98
  scopes: z.array(z.string()),
79
99
  networkHosts: z.array(z.string()),
80
100
  events: z.array(appEventTypeSchema),
101
+ publicHttp: publicHttpField,
102
+ schedules: schedulesField,
81
103
  })
82
104
  .nullable()
83
105
  .optional()
@@ -86,6 +108,8 @@ export const appInstallationSchema = z.object({
86
108
  grantedNetworkHosts: z.array(z.string()).describe("동의한 외부 호출 호스트"),
87
109
  events: z.array(appEventTypeSchema).describe("이 설치가 받는 이벤트"),
88
110
  adminPage: z.boolean().describe("상점 플랫폼 앱 화면이 있는가"),
111
+ publicHttp: publicHttpField,
112
+ schedules: schedulesField,
89
113
  /** 설치 결과의 캐시가 아니라 실행 버전 매니페스트의 요약 */
90
114
  settings: appInstallationSettingsSchema,
91
115
  installedBy: z.object({ userId: z.string(), name: z.string().nullable() }).nullable(),
@@ -158,6 +182,9 @@ export const storeAppSchema = z.object({
158
182
  developerName: z.string(),
159
183
  versionNumber: z.number().int().describe("현재 버전"),
160
184
  installationId: z.string().nullable().describe("이 상점에 설치돼 있으면 설치 id"),
185
+ visibility: appVisibilitySchema
186
+ .default("DEVELOPMENT")
187
+ .describe("공개 범위 — 개발 중(심사 전) · 이 상점 전용 · 공개(심사 통과)"),
161
188
  });
162
189
  export type StoreApp = z.infer<typeof storeAppSchema>;
163
190
 
@@ -168,6 +195,8 @@ export const storeAppDetailSchema = storeAppSchema.extend({
168
195
  scopes: z.array(z.string()).describe("설치 때 동의하는 스코프(Scope)"),
169
196
  events: z.array(appEventTypeSchema).describe("받는 이벤트(Hook)"),
170
197
  networkHosts: z.array(z.string()).describe("앱이 데이터를 보내는 외부 호스트"),
198
+ publicHttp: publicHttpField,
199
+ schedules: schedulesField,
171
200
  settings: z.record(z.string(), appSettingFieldSchema).describe("설치 때 채우는 설정 필드"),
172
201
  updatedAt: z.string().nullable().describe("현재 버전을 release한 시각"),
173
202
  });
@@ -193,6 +222,33 @@ export const appInstallationSelfSchema = z.object({
193
222
  });
194
223
  export type AppInstallationSelf = z.infer<typeof appInstallationSelfSchema>;
195
224
 
225
+ /** 설치 저장소(`ctx.storage`, 매뉴얼 「앱 코드 › 저장소」) — 설치 토큰 전용 */
226
+ export const APP_STORAGE_KEY_PATTERN = /^[A-Za-z0-9._:-]{1,200}$/;
227
+ export const APP_STORAGE_MAX_KEYS = 1_000;
228
+ /** 설치당 전체 크기(키 + JSON 값, UTF-8 바이트) */
229
+ export const APP_STORAGE_MAX_BYTES = 1024 * 1024;
230
+
231
+ export const appStorageEntrySchema = z.object({
232
+ key: z.string(),
233
+ value: z.unknown().describe("저장한 JSON 값"),
234
+ updatedAt: z.string(),
235
+ });
236
+ export type AppStorageEntry = z.infer<typeof appStorageEntrySchema>;
237
+
238
+ export const appStorageKeysSchema = z.object({
239
+ keys: z.array(z.string()).describe("키 목록(이름순)"),
240
+ });
241
+ export type AppStorageKeys = z.infer<typeof appStorageKeysSchema>;
242
+
243
+ export const appStoragePutSchema = z.object({
244
+ value: z.unknown().refine((value) => value !== undefined, { message: "value가 필요합니다" }),
245
+ });
246
+ export type AppStoragePut = z.infer<typeof appStoragePutSchema>;
247
+
248
+ export const appStorageListQuerySchema = z.object({
249
+ prefix: z.string().max(200).optional(),
250
+ });
251
+
196
252
  export type { AppCapabilities };
197
253
 
198
254
  // ─── 개발자 API (플랫폼 플레인 `/platform/v1/developer/**`, 공개 문서 제외 — CLI·상점 플랫폼 개발자 화면이 쓴다) ───
@@ -249,6 +305,8 @@ export const appVersionSchema = z.object({
249
305
  events: z.array(z.string()),
250
306
  networkHosts: z.array(z.string()),
251
307
  adminPage: z.boolean(),
308
+ publicHttp: z.array(z.string()).optional(),
309
+ schedules: z.record(z.string(), z.string()).optional(),
252
310
  requiredSettings: z.array(z.string()),
253
311
  secretSettings: z.array(z.string()),
254
312
  }),
@@ -264,6 +322,19 @@ export const appVersionSchema = z.object({
264
322
  });
265
323
  export type AppVersion = z.infer<typeof appVersionSchema>;
266
324
 
325
+ /** 앱 공개 심사(#22, 매뉴얼 「앱 공개 범위」) — 개발자가 신청하고 운영자가 승인·반려한다 */
326
+ export const appListingReviewStatusSchema = z.enum(["PENDING", "APPROVED", "REJECTED"]);
327
+ export type AppListingReviewStatus = z.infer<typeof appListingReviewStatusSchema>;
328
+ export const appListingReviewSchema = z.object({
329
+ reviewId: z.string(),
330
+ status: appListingReviewStatusSchema,
331
+ versionNumber: z.number().int().describe("신청 때 현재 버전"),
332
+ reason: z.string().nullable().describe("반려 사유"),
333
+ requestedAt: z.string(),
334
+ reviewedAt: z.string().nullable(),
335
+ });
336
+ export type AppListingReview = z.infer<typeof appListingReviewSchema>;
337
+
267
338
  export const developerAppSchema = z.object({
268
339
  appId: z.string(),
269
340
  orgId: z.string(),
@@ -277,6 +348,15 @@ export const developerAppSchema = z.object({
277
348
  status: appStatusSchema,
278
349
  suspendedReason: z.string().nullable(),
279
350
  currentVersionNumber: z.number().int().nullable(),
351
+ privateStoreId: z
352
+ .string()
353
+ .nullable()
354
+ .default(null)
355
+ .describe("비공개 앱이 묶인 상점. 개발 중·퍼블릭 앱은 null"),
356
+ listingReview: appListingReviewSchema
357
+ .nullable()
358
+ .default(null)
359
+ .describe("마지막 공개 신청. 없으면 null"),
280
360
  installations: z.object({
281
361
  active: z.number().int(),
282
362
  pendingReconsent: z.number().int(),
@@ -290,6 +370,8 @@ export const developerAppCreateSchema = z.object({
290
370
  handle: appHandleSchema,
291
371
  name: z.string().trim().min(1).max(60),
292
372
  description: z.string().trim().max(500).optional(),
373
+ /** 비공개 앱 — 이 상점 하나에만 설치된다. 만드는 사람이 그 상점의 OWNER·ADMIN이어야 한다 */
374
+ privateStoreId: z.string().min(1).optional(),
293
375
  });
294
376
  export type DeveloperAppCreate = z.infer<typeof developerAppCreateSchema>;
295
377
 
@@ -345,6 +427,15 @@ export const devStoreSchema = z.object({
345
427
  });
346
428
  export type DevStore = z.infer<typeof devStoreSchema>;
347
429
 
430
+ /** `GET /platform/v1/developer/stores` — 비공개 앱을 묶을 수 있는 상점(내가 소유자·관리자, 운영 중) */
431
+ export const developerStoreSchema = z.object({
432
+ storeId: z.string(),
433
+ name: z.string(),
434
+ role: z.enum(["OWNER", "ADMIN"]),
435
+ development: z.boolean().describe("개발 상점인가"),
436
+ });
437
+ export type DeveloperStore = z.infer<typeof developerStoreSchema>;
438
+
348
439
  /** 개발자가 보는 설치 한 줄 */
349
440
  export const developerInstallationSchema = z.object({
350
441
  installationId: z.string(),