glitch-javascript-sdk 2.5.8 → 2.6.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/cjs/index.js +27 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Education.d.ts +1 -0
- package/dist/esm/api/Media.d.ts +28 -0
- package/dist/esm/index.js +27 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +29 -0
- package/package.json +1 -1
- package/src/api/Education.ts +3 -0
- package/src/api/Media.ts +36 -0
- package/src/routes/EducationRoute.ts +1 -0
- package/src/routes/MediaRoute.ts +2 -0
|
@@ -21,6 +21,7 @@ declare class Education {
|
|
|
21
21
|
static deleteContent<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
22
22
|
static heartbeat<T>(uuid: string, data: object): AxiosPromise<Response<T>>;
|
|
23
23
|
static getSecureVideo<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
24
|
+
static getPreviewSecureVideo<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
24
25
|
static listTrackContent<T>(track_id: string): AxiosPromise<Response<T>>;
|
|
25
26
|
static addContentToTrack<T>(track_id: string, data: object): AxiosPromise<Response<T>>;
|
|
26
27
|
static removeContentFromTrack<T>(track_id: string, content_id: string): AxiosPromise<Response<T>>;
|
package/dist/esm/api/Media.d.ts
CHANGED
|
@@ -86,6 +86,17 @@ export interface ScreenshotValidationResponse {
|
|
|
86
86
|
issues: string[];
|
|
87
87
|
recommendations: string[];
|
|
88
88
|
}
|
|
89
|
+
export interface PresignedUrlResponse {
|
|
90
|
+
upload_url: string;
|
|
91
|
+
file_path: string;
|
|
92
|
+
}
|
|
93
|
+
export interface S3ConfirmRequest {
|
|
94
|
+
file_path: string;
|
|
95
|
+
size: number;
|
|
96
|
+
mime_type: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
filename?: string;
|
|
99
|
+
}
|
|
89
100
|
declare class Media {
|
|
90
101
|
/**
|
|
91
102
|
* Upload media content using a File object.
|
|
@@ -221,5 +232,22 @@ declare class Media {
|
|
|
221
232
|
* @param scheduler_id The ID of the scheduler to provide OAuth context.
|
|
222
233
|
*/
|
|
223
234
|
static uploadTikTokMusic<T>(file: File, scheduler_id: string): AxiosPromise<Response<T>>;
|
|
235
|
+
/**
|
|
236
|
+
* Generate an S3 Presigned URL for direct upload.
|
|
237
|
+
* Use this for large files (up to 2GB) to bypass the Laravel server.
|
|
238
|
+
*
|
|
239
|
+
* @param filename The original name of the file.
|
|
240
|
+
* @param extension The file extension (e.g., 'mp4').
|
|
241
|
+
* @returns AxiosPromise containing upload_url and file_path.
|
|
242
|
+
*/
|
|
243
|
+
static getPresignedUrl<T = PresignedUrlResponse>(filename: string, extension: string): AxiosPromise<Response<T>>;
|
|
244
|
+
/**
|
|
245
|
+
* Confirm a successful S3 upload and create the database record.
|
|
246
|
+
* Call this after the direct S3 upload is complete.
|
|
247
|
+
*
|
|
248
|
+
* @param data The file metadata (path, size, mime_type).
|
|
249
|
+
* @returns AxiosPromise containing the created Media resource.
|
|
250
|
+
*/
|
|
251
|
+
static confirmS3Upload<T>(data: S3ConfirmRequest): AxiosPromise<Response<T>>;
|
|
224
252
|
}
|
|
225
253
|
export default Media;
|
package/dist/esm/index.js
CHANGED
|
@@ -14038,6 +14038,8 @@ var MediaRoute = /** @class */ (function () {
|
|
|
14038
14038
|
createLibraryLogo: { url: '/media/create-library-logo', method: HTTP_METHODS.POST },
|
|
14039
14039
|
validateScreenshot: { url: '/media/validate-screenshot', method: HTTP_METHODS.POST },
|
|
14040
14040
|
uploadTikTokMusic: { url: '/media/tiktok/music', method: HTTP_METHODS.POST },
|
|
14041
|
+
getPresignedUrl: { url: '/media/presigned-url', method: HTTP_METHODS.POST },
|
|
14042
|
+
confirmS3Upload: { url: '/media/s3-confirm', method: HTTP_METHODS.POST },
|
|
14041
14043
|
};
|
|
14042
14044
|
return MediaRoute;
|
|
14043
14045
|
}());
|
|
@@ -14268,6 +14270,27 @@ var Media = /** @class */ (function () {
|
|
|
14268
14270
|
// We use the raw URL here as it's a specialized upload path
|
|
14269
14271
|
return Requests.uploadFile('/media/tiktok/music', 'audio', file, { scheduler_id: scheduler_id });
|
|
14270
14272
|
};
|
|
14273
|
+
/**
|
|
14274
|
+
* Generate an S3 Presigned URL for direct upload.
|
|
14275
|
+
* Use this for large files (up to 2GB) to bypass the Laravel server.
|
|
14276
|
+
*
|
|
14277
|
+
* @param filename The original name of the file.
|
|
14278
|
+
* @param extension The file extension (e.g., 'mp4').
|
|
14279
|
+
* @returns AxiosPromise containing upload_url and file_path.
|
|
14280
|
+
*/
|
|
14281
|
+
Media.getPresignedUrl = function (filename, extension) {
|
|
14282
|
+
return Requests.processRoute(MediaRoute.routes.getPresignedUrl, { filename: filename, extension: extension });
|
|
14283
|
+
};
|
|
14284
|
+
/**
|
|
14285
|
+
* Confirm a successful S3 upload and create the database record.
|
|
14286
|
+
* Call this after the direct S3 upload is complete.
|
|
14287
|
+
*
|
|
14288
|
+
* @param data The file metadata (path, size, mime_type).
|
|
14289
|
+
* @returns AxiosPromise containing the created Media resource.
|
|
14290
|
+
*/
|
|
14291
|
+
Media.confirmS3Upload = function (data) {
|
|
14292
|
+
return Requests.processRoute(MediaRoute.routes.confirmS3Upload, data);
|
|
14293
|
+
};
|
|
14271
14294
|
return Media;
|
|
14272
14295
|
}());
|
|
14273
14296
|
|
|
@@ -16493,6 +16516,7 @@ var EducationRoute = /** @class */ (function () {
|
|
|
16493
16516
|
saveContentModuleState: { url: '/education/content/{uuid}/module-state', method: HTTP_METHODS.POST },
|
|
16494
16517
|
getContentModuleState: { url: '/education/content/{uuid}/module-state', method: HTTP_METHODS.GET },
|
|
16495
16518
|
getSecureVideo: { url: '/education/content/{uuid}/secure-video', method: HTTP_METHODS.GET },
|
|
16519
|
+
getPreviewSecureVideo: { url: '/education/content/{uuid}/preview-secure-video', method: HTTP_METHODS.GET },
|
|
16496
16520
|
// 4. EducationContentTrackController (Pivot)
|
|
16497
16521
|
listTrackContent: { url: '/education/tracks/{track_id}/content', method: HTTP_METHODS.GET },
|
|
16498
16522
|
addContentToTrack: { url: '/education/tracks/{track_id}/content', method: HTTP_METHODS.POST },
|
|
@@ -16656,6 +16680,9 @@ var Education = /** @class */ (function () {
|
|
|
16656
16680
|
Education.getSecureVideo = function (uuid) {
|
|
16657
16681
|
return Requests.processRoute(EducationRoute.routes.getSecureVideo, undefined, { uuid: uuid });
|
|
16658
16682
|
};
|
|
16683
|
+
Education.getPreviewSecureVideo = function (uuid) {
|
|
16684
|
+
return Requests.processRoute(EducationRoute.routes.getPreviewSecureVideo, undefined, { uuid: uuid });
|
|
16685
|
+
};
|
|
16659
16686
|
// --- 4. TRACK CONTENT (PIVOT) ---
|
|
16660
16687
|
Education.listTrackContent = function (track_id) {
|
|
16661
16688
|
return Requests.processRoute(EducationRoute.routes.listTrackContent, undefined, { track_id: track_id });
|