@sayren/store-sdk 0.21.0 → 0.23.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 +746 -17
- package/dist/index.mjs +421 -15
- package/package.json +1 -1
- package/src/client.ts +88 -2
- package/src/schemas/storefront-hosting.ts +525 -9
- package/src/session.ts +42 -1
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -230,6 +230,8 @@ import {
|
|
|
230
230
|
updateStoreRequestSchema,
|
|
231
231
|
} from "./schemas/store";
|
|
232
232
|
import {
|
|
233
|
+
type AddStorefrontDomainRequest,
|
|
234
|
+
addStorefrontDomainRequestSchema,
|
|
233
235
|
type ChangeStorefrontSlugRequest,
|
|
234
236
|
type ChangeStorefrontTemplateRequest,
|
|
235
237
|
type CreateStorefrontEditPreviewLinkRequest,
|
|
@@ -250,8 +252,10 @@ import {
|
|
|
250
252
|
moveStorefrontFileRequestSchema,
|
|
251
253
|
type PublishStorefrontVersionRequest,
|
|
252
254
|
publishStorefrontVersionRequestSchema,
|
|
255
|
+
type ReplaceStorefrontSourceRequest,
|
|
253
256
|
type RollbackStorefrontRequest,
|
|
254
257
|
type RunStorefrontCheckRequest,
|
|
258
|
+
replaceStorefrontSourceRequestSchema,
|
|
255
259
|
rollbackStorefrontRequestSchema,
|
|
256
260
|
runStorefrontCheckRequestSchema,
|
|
257
261
|
type SearchStorefrontFilesRequest,
|
|
@@ -260,6 +264,7 @@ import {
|
|
|
260
264
|
setStorefrontVisibilityRequestSchema,
|
|
261
265
|
storefrontBuildSchema,
|
|
262
266
|
storefrontCheckSchema,
|
|
267
|
+
storefrontDeploymentSchema,
|
|
263
268
|
storefrontEditingSchema,
|
|
264
269
|
storefrontFileContentSchema,
|
|
265
270
|
storefrontFileDeleteResultSchema,
|
|
@@ -269,12 +274,21 @@ import {
|
|
|
269
274
|
storefrontFileWriteResultSchema,
|
|
270
275
|
storefrontHostingSchema,
|
|
271
276
|
storefrontPreviewLinkSchema,
|
|
277
|
+
storefrontSiteDomainSchema,
|
|
278
|
+
storefrontSiteDomainsSchema,
|
|
272
279
|
storefrontSiteSchema,
|
|
273
280
|
storefrontSlugAvailabilitySchema,
|
|
281
|
+
storefrontSourceArchivePartSchema,
|
|
282
|
+
storefrontSourceArchiveQuerySchema,
|
|
283
|
+
storefrontSourceBlobsResultSchema,
|
|
284
|
+
storefrontSourceReplacedSchema,
|
|
285
|
+
storefrontSourceSchema,
|
|
274
286
|
storefrontTemplateSchema,
|
|
275
287
|
storefrontVerifyReportSchema,
|
|
276
288
|
storefrontVersionCreatedSchema,
|
|
277
289
|
storefrontVersionSchema,
|
|
290
|
+
type UploadStorefrontSourceBlobsRequest,
|
|
291
|
+
uploadStorefrontSourceBlobsRequestSchema,
|
|
278
292
|
type WriteStorefrontFilesRequest,
|
|
279
293
|
writeStorefrontFilesRequestSchema,
|
|
280
294
|
} from "./schemas/storefront-hosting";
|
|
@@ -1345,12 +1359,27 @@ export function createStoreClient(options: StoreClientOptions) {
|
|
|
1345
1359
|
query: { slug },
|
|
1346
1360
|
},
|
|
1347
1361
|
),
|
|
1348
|
-
/**
|
|
1362
|
+
/**
|
|
1363
|
+
* `POST /v1/storefront/site` (201) — 템플릿으로 사이트를 만들고 v1을 발행한다. 공개 상태는 오픈 준비 중이다.
|
|
1364
|
+
* 사이트를 만드는 유일한 경로다(스토어를 만들어도 사이트는 생기지 않는다). 템플릿은 여기서만 고른다
|
|
1365
|
+
*/
|
|
1349
1366
|
create: (body: CreateStorefrontSiteRequest) =>
|
|
1350
1367
|
storeHttp.request("POST", "/storefront/site", storefrontSiteSchema, {
|
|
1351
1368
|
body: createStorefrontSiteRequestSchema.parse(body),
|
|
1352
1369
|
}),
|
|
1353
|
-
/** `
|
|
1370
|
+
/** `GET /v1/storefront/site/deployment` — 배포 진행(단계·기록). 만든 뒤 반영이 끝날 때까지 폴링한다 */
|
|
1371
|
+
getDeployment: () =>
|
|
1372
|
+
storeHttp.request("GET", "/storefront/site/deployment", storefrontDeploymentSchema),
|
|
1373
|
+
/** `POST /v1/storefront/site/deployment/retry` (202) — 밀린 반영을 곧바로 다시 시도한다. 이미 반영됐으면 그대로다 */
|
|
1374
|
+
retryDeployment: () =>
|
|
1375
|
+
storeHttp.request("POST", "/storefront/site/deployment/retry", storefrontDeploymentSchema, {
|
|
1376
|
+
body: {},
|
|
1377
|
+
}),
|
|
1378
|
+
/**
|
|
1379
|
+
* `POST /v1/storefront/site/template`
|
|
1380
|
+
* @deprecated 템플릿 변경은 지원하지 않는다. 서버가 항상 409 `TEMPLATE_CHANGE_NOT_SUPPORTED`로 답한다 — 템플릿은
|
|
1381
|
+
* 사이트를 만들 때(`create`)만 고른다. 호환을 위해 메서드만 남겼다
|
|
1382
|
+
*/
|
|
1354
1383
|
changeTemplate: (body: ChangeStorefrontTemplateRequest) =>
|
|
1355
1384
|
storeHttp.request("POST", "/storefront/site/template", storefrontSiteSchema, {
|
|
1356
1385
|
body: changeStorefrontTemplateRequestSchema.parse(body),
|
|
@@ -1389,6 +1418,34 @@ export function createStoreClient(options: StoreClientOptions) {
|
|
|
1389
1418
|
storeHttp.request("POST", "/storefront/site/preview-link", storefrontPreviewLinkSchema, {
|
|
1390
1419
|
body: createStorefrontPreviewLinkRequestSchema.parse(body),
|
|
1391
1420
|
}),
|
|
1421
|
+
/** `GET /v1/storefront/site/domains` — 주소 목록(기본 주소 + 내 도메인)과 DNS 안내 */
|
|
1422
|
+
listDomains: () =>
|
|
1423
|
+
storeHttp.request("GET", "/storefront/site/domains", storefrontSiteDomainsSchema),
|
|
1424
|
+
/**
|
|
1425
|
+
* `POST /v1/storefront/site/domains` (201) — 내 도메인을 추가한다. 응답의 `dnsRecords`를 DNS에 넣으면 서버가 소유를 확인하고
|
|
1426
|
+
* 인증서를 발급한다
|
|
1427
|
+
*/
|
|
1428
|
+
addDomain: (body: AddStorefrontDomainRequest) =>
|
|
1429
|
+
storeHttp.request("POST", "/storefront/site/domains", storefrontSiteDomainSchema, {
|
|
1430
|
+
body: addStorefrontDomainRequestSchema.parse(body),
|
|
1431
|
+
}),
|
|
1432
|
+
/** `POST /v1/storefront/site/domains/{domainId}/verify` — DNS를 곧바로 다시 확인한다(실패한 도메인은 처음부터 다시) */
|
|
1433
|
+
verifyDomain: (domainId: string) =>
|
|
1434
|
+
storeHttp.request(
|
|
1435
|
+
"POST",
|
|
1436
|
+
path`/storefront/site/domains/${domainId}/verify`,
|
|
1437
|
+
storefrontSiteDomainSchema,
|
|
1438
|
+
),
|
|
1439
|
+
/** `POST /v1/storefront/site/domains/{domainId}/primary` — 대표 주소로 지정한다. 다른 주소는 대표 주소로 301한다 */
|
|
1440
|
+
setPrimaryDomain: (domainId: string) =>
|
|
1441
|
+
storeHttp.request(
|
|
1442
|
+
"POST",
|
|
1443
|
+
path`/storefront/site/domains/${domainId}/primary`,
|
|
1444
|
+
storefrontSiteDomainsSchema,
|
|
1445
|
+
),
|
|
1446
|
+
/** `DELETE /v1/storefront/site/domains/{domainId}` — 내 도메인 연결을 해제한다(곧바로 끊긴다) */
|
|
1447
|
+
removeDomain: (domainId: string) =>
|
|
1448
|
+
storeHttp.requestVoid("DELETE", path`/storefront/site/domains/${domainId}`),
|
|
1392
1449
|
/** `POST /v1/storefront/site/disable` — 호스팅을 끈다(사이트 `CLOSED`, 슬러그 90일 보류). 다시 만들 수 있다 */
|
|
1393
1450
|
disable: (body: DisableStorefrontHostingRequest) =>
|
|
1394
1451
|
storeHttp.request("POST", "/storefront/site/disable", storefrontSiteSchema, {
|
|
@@ -1495,6 +1552,35 @@ export function createStoreClient(options: StoreClientOptions) {
|
|
|
1495
1552
|
/** `GET /v1/storefront/site/builds/{buildId}` — 빌드 상태·실패 단계·로그 꼬리·규칙 결과 */
|
|
1496
1553
|
getBuild: (buildId: string) =>
|
|
1497
1554
|
storeHttp.request("GET", path`/storefront/site/builds/${buildId}`, storefrontBuildSchema),
|
|
1555
|
+
|
|
1556
|
+
// ─── 소스 내려받기·올리기 (#60, `sayren` CLI) ───
|
|
1557
|
+
|
|
1558
|
+
/** `GET /v1/storefront/site/source` — 지금 작업 트리를 고정하고 압축 파일(tar.gz) 크기·조각 수를 알린다 */
|
|
1559
|
+
getSource: () => storeHttp.request("GET", "/storefront/site/source", storefrontSourceSchema),
|
|
1560
|
+
/** `GET /v1/storefront/site/source/archive?sourceRef=&part=` — 압축 파일 조각(base64, 4MiB까지) */
|
|
1561
|
+
getSourceArchive: (params: { sourceRef: string; part?: number }) =>
|
|
1562
|
+
storeHttp.request(
|
|
1563
|
+
"GET",
|
|
1564
|
+
"/storefront/site/source/archive",
|
|
1565
|
+
storefrontSourceArchivePartSchema,
|
|
1566
|
+
{ query: storefrontSourceArchiveQuerySchema.parse(params) as Query },
|
|
1567
|
+
),
|
|
1568
|
+
/** `POST /v1/storefront/site/source/blobs` — 파일 내용 올리기(해시 키). 작업 트리는 바뀌지 않는다 */
|
|
1569
|
+
uploadSourceBlobs: (body: UploadStorefrontSourceBlobsRequest) =>
|
|
1570
|
+
storeHttp.request(
|
|
1571
|
+
"POST",
|
|
1572
|
+
"/storefront/site/source/blobs",
|
|
1573
|
+
storefrontSourceBlobsResultSchema,
|
|
1574
|
+
{ body: uploadStorefrontSourceBlobsRequestSchema.parse(body) },
|
|
1575
|
+
),
|
|
1576
|
+
/**
|
|
1577
|
+
* `PUT /v1/storefront/site/source` — 작업 트리 전체를 바꾼다. 409 `SOURCE_CHANGED`(내려받은 뒤 바뀜)·`EDIT_SESSION_OPEN`·
|
|
1578
|
+
* `SOURCE_BLOBS_MISSING`(`details.hashes`를 올리고 다시)
|
|
1579
|
+
*/
|
|
1580
|
+
replaceSource: (body: ReplaceStorefrontSourceRequest) =>
|
|
1581
|
+
storeHttp.request("PUT", "/storefront/site/source", storefrontSourceReplacedSchema, {
|
|
1582
|
+
body: replaceStorefrontSourceRequestSchema.parse(body),
|
|
1583
|
+
}),
|
|
1498
1584
|
},
|
|
1499
1585
|
|
|
1500
1586
|
store: {
|