connectbase-client 3.33.0 → 3.35.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/CHANGELOG.md +35 -0
- package/README.md +21 -10
- package/dist/connect-base.umd.js +4 -4
- package/dist/index.d.mts +57 -23
- package/dist/index.d.ts +57 -23
- package/dist/index.js +49 -34
- package/dist/index.mjs +49 -34
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -666,12 +666,15 @@ var HttpClient = class {
|
|
|
666
666
|
}
|
|
667
667
|
async put(url, data, config) {
|
|
668
668
|
const headers = await this.prepareHeaders(config);
|
|
669
|
+
if (data instanceof FormData) {
|
|
670
|
+
headers.delete("Content-Type");
|
|
671
|
+
}
|
|
669
672
|
return this.doFetch(
|
|
670
673
|
url,
|
|
671
674
|
{
|
|
672
675
|
method: "PUT",
|
|
673
676
|
headers,
|
|
674
|
-
body: JSON.stringify(data)
|
|
677
|
+
body: data instanceof FormData ? data : JSON.stringify(data)
|
|
675
678
|
},
|
|
676
679
|
config
|
|
677
680
|
);
|
|
@@ -5809,9 +5812,13 @@ var SubscriptionAPI = class {
|
|
|
5809
5812
|
* })
|
|
5810
5813
|
* ```
|
|
5811
5814
|
*/
|
|
5812
|
-
async cancel(subscriptionId, data) {
|
|
5815
|
+
async cancel(subscriptionId, data = {}) {
|
|
5813
5816
|
const prefix = this.getPublicPrefix();
|
|
5814
|
-
|
|
5817
|
+
const body = {
|
|
5818
|
+
reason: data.reason,
|
|
5819
|
+
cancel_at_end: !data.immediate
|
|
5820
|
+
};
|
|
5821
|
+
return this.http.post(`${prefix}/subscriptions/${subscriptionId}/cancel`, body);
|
|
5815
5822
|
}
|
|
5816
5823
|
// =====================
|
|
5817
5824
|
// Subscription Payment APIs
|
|
@@ -6211,12 +6218,8 @@ var VideoAPI = class {
|
|
|
6211
6218
|
`/v1/public/storages/videos/${storageId}/uploads/init`,
|
|
6212
6219
|
{
|
|
6213
6220
|
filename: file.name,
|
|
6214
|
-
|
|
6215
|
-
mime_type: file.type
|
|
6216
|
-
title: options.title,
|
|
6217
|
-
description: options.description,
|
|
6218
|
-
visibility: options.visibility || "private",
|
|
6219
|
-
tags: options.tags
|
|
6221
|
+
file_size: file.size,
|
|
6222
|
+
mime_type: file.type
|
|
6220
6223
|
}
|
|
6221
6224
|
);
|
|
6222
6225
|
const chunkSize = session.chunk_size || DEFAULT_CHUNK_SIZE;
|
|
@@ -6230,9 +6233,8 @@ var VideoAPI = class {
|
|
|
6230
6233
|
const chunk = file.slice(start, end);
|
|
6231
6234
|
const formData = new FormData();
|
|
6232
6235
|
formData.append("chunk", chunk);
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
`/v1/public/storages/videos/${storageId}/uploads/${session.session_id}/chunk`,
|
|
6236
|
+
await this.http.put(
|
|
6237
|
+
`/v1/public/storages/videos/${storageId}/uploads/${session.upload_id}/chunk?chunk_index=${i}`,
|
|
6236
6238
|
formData
|
|
6237
6239
|
);
|
|
6238
6240
|
uploadedChunks++;
|
|
@@ -6254,10 +6256,15 @@ var VideoAPI = class {
|
|
|
6254
6256
|
}
|
|
6255
6257
|
}
|
|
6256
6258
|
const result = await this.http.post(
|
|
6257
|
-
`/v1/public/storages/videos/${storageId}/uploads/${session.
|
|
6258
|
-
{
|
|
6259
|
+
`/v1/public/storages/videos/${storageId}/uploads/${session.upload_id}/complete`,
|
|
6260
|
+
{
|
|
6261
|
+
title: options.title,
|
|
6262
|
+
description: options.description,
|
|
6263
|
+
visibility: options.visibility || "private",
|
|
6264
|
+
tags: options.tags
|
|
6265
|
+
}
|
|
6259
6266
|
);
|
|
6260
|
-
return result.
|
|
6267
|
+
return this.storage.getVideo(storageId, result.video_id);
|
|
6261
6268
|
},
|
|
6262
6269
|
/**
|
|
6263
6270
|
* List videos in a specific storage
|
|
@@ -6374,15 +6381,10 @@ var VideoAPI = class {
|
|
|
6374
6381
|
*/
|
|
6375
6382
|
async upload(file, options) {
|
|
6376
6383
|
const prefix = this.getPublicPrefix();
|
|
6377
|
-
const session = await this.videoFetch("POST", `${prefix}/uploads`, {
|
|
6384
|
+
const session = await this.videoFetch("POST", `${prefix}/uploads/init`, {
|
|
6378
6385
|
filename: file.name,
|
|
6379
|
-
|
|
6380
|
-
mime_type: file.type
|
|
6381
|
-
title: options.title,
|
|
6382
|
-
description: options.description,
|
|
6383
|
-
visibility: options.visibility || "private",
|
|
6384
|
-
tags: options.tags,
|
|
6385
|
-
channel_id: options.channel_id
|
|
6386
|
+
file_size: file.size,
|
|
6387
|
+
mime_type: file.type
|
|
6386
6388
|
});
|
|
6387
6389
|
const chunkSize = session.chunk_size || DEFAULT_CHUNK_SIZE;
|
|
6388
6390
|
const totalChunks = Math.ceil(file.size / chunkSize);
|
|
@@ -6396,10 +6398,9 @@ var VideoAPI = class {
|
|
|
6396
6398
|
const chunk = file.slice(start, end);
|
|
6397
6399
|
const formData = new FormData();
|
|
6398
6400
|
formData.append("chunk", chunk);
|
|
6399
|
-
formData.append("chunk_index", String(i));
|
|
6400
6401
|
await this.videoFetch(
|
|
6401
|
-
"
|
|
6402
|
-
`${prefix}/uploads/${session.
|
|
6402
|
+
"PUT",
|
|
6403
|
+
`${prefix}/uploads/${session.upload_id}/chunk?chunk_index=${i}`,
|
|
6403
6404
|
formData
|
|
6404
6405
|
);
|
|
6405
6406
|
uploadedChunks++;
|
|
@@ -6422,10 +6423,15 @@ var VideoAPI = class {
|
|
|
6422
6423
|
}
|
|
6423
6424
|
const result = await this.videoFetch(
|
|
6424
6425
|
"POST",
|
|
6425
|
-
`${prefix}/uploads/${session.
|
|
6426
|
-
{
|
|
6426
|
+
`${prefix}/uploads/${session.upload_id}/complete`,
|
|
6427
|
+
{
|
|
6428
|
+
title: options.title,
|
|
6429
|
+
description: options.description,
|
|
6430
|
+
visibility: options.visibility || "private",
|
|
6431
|
+
tags: options.tags
|
|
6432
|
+
}
|
|
6427
6433
|
);
|
|
6428
|
-
return result.
|
|
6434
|
+
return this.get(result.video_id);
|
|
6429
6435
|
}
|
|
6430
6436
|
/**
|
|
6431
6437
|
* Wait for video processing to complete
|
|
@@ -6537,15 +6543,23 @@ var VideoAPI = class {
|
|
|
6537
6543
|
return this.videoFetch("GET", `${prefix}/videos/${videoId}/stream-url${params}`);
|
|
6538
6544
|
}
|
|
6539
6545
|
/**
|
|
6540
|
-
* Get available thumbnails for a video
|
|
6546
|
+
* Get available thumbnails for a video.
|
|
6547
|
+
*
|
|
6548
|
+
* 서버는 대표 썸네일 1개(`thumbnail_url`) + 선택적 추가 썸네일 목록(`thumbnail_urls`)을
|
|
6549
|
+
* 반환한다. 둘을 합쳐 중복 없는 URL 배열로 정규화해 돌려준다.
|
|
6541
6550
|
*/
|
|
6542
6551
|
async getThumbnails(videoId) {
|
|
6543
6552
|
const prefix = this.getPublicPrefix();
|
|
6544
6553
|
const response = await this.videoFetch(
|
|
6545
6554
|
"GET",
|
|
6546
|
-
`${prefix}/videos/${videoId}/
|
|
6555
|
+
`${prefix}/videos/${videoId}/thumbnail`
|
|
6547
6556
|
);
|
|
6548
|
-
|
|
6557
|
+
const urls = /* @__PURE__ */ new Set();
|
|
6558
|
+
if (response.thumbnail_url) urls.add(response.thumbnail_url);
|
|
6559
|
+
for (const u of response.thumbnail_urls ?? []) {
|
|
6560
|
+
if (u) urls.add(u);
|
|
6561
|
+
}
|
|
6562
|
+
return [...urls];
|
|
6549
6563
|
}
|
|
6550
6564
|
/**
|
|
6551
6565
|
* Get transcode status
|
|
@@ -7545,7 +7559,8 @@ var GameAPI = class {
|
|
|
7545
7559
|
"GAME_GET_ROOM_FAILED"
|
|
7546
7560
|
);
|
|
7547
7561
|
}
|
|
7548
|
-
|
|
7562
|
+
const data = await response.json();
|
|
7563
|
+
return data.room;
|
|
7549
7564
|
}
|
|
7550
7565
|
/**
|
|
7551
7566
|
* 룸 생성 (HTTP, gRPC 대안)
|
|
@@ -9727,7 +9742,7 @@ var AnalyticsAPI = class {
|
|
|
9727
9742
|
* @example
|
|
9728
9743
|
* ```ts
|
|
9729
9744
|
* // 결제 완료 직후 이탈에 대비해 즉시 flush
|
|
9730
|
-
* await cb.analytics.
|
|
9745
|
+
* await cb.analytics.trackEvent('purchase_completed', { order_id: '123' })
|
|
9731
9746
|
* await cb.analytics.flush()
|
|
9732
9747
|
* window.location.href = '/thank-you'
|
|
9733
9748
|
* ```
|