glitch-javascript-sdk 2.5.8 → 2.5.9
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 +23 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Media.d.ts +28 -0
- package/dist/esm/index.js +23 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +28 -0
- package/package.json +1 -1
- package/src/api/Media.ts +36 -0
- package/src/routes/MediaRoute.ts +2 -0
package/dist/cjs/index.js
CHANGED
|
@@ -27222,6 +27222,8 @@ var MediaRoute = /** @class */ (function () {
|
|
|
27222
27222
|
createLibraryLogo: { url: '/media/create-library-logo', method: HTTP_METHODS.POST },
|
|
27223
27223
|
validateScreenshot: { url: '/media/validate-screenshot', method: HTTP_METHODS.POST },
|
|
27224
27224
|
uploadTikTokMusic: { url: '/media/tiktok/music', method: HTTP_METHODS.POST },
|
|
27225
|
+
getPresignedUrl: { url: '/media/presigned-url', method: HTTP_METHODS.POST },
|
|
27226
|
+
confirmS3Upload: { url: '/media/s3-confirm', method: HTTP_METHODS.POST },
|
|
27225
27227
|
};
|
|
27226
27228
|
return MediaRoute;
|
|
27227
27229
|
}());
|
|
@@ -27452,6 +27454,27 @@ var Media = /** @class */ (function () {
|
|
|
27452
27454
|
// We use the raw URL here as it's a specialized upload path
|
|
27453
27455
|
return Requests.uploadFile('/media/tiktok/music', 'audio', file, { scheduler_id: scheduler_id });
|
|
27454
27456
|
};
|
|
27457
|
+
/**
|
|
27458
|
+
* Generate an S3 Presigned URL for direct upload.
|
|
27459
|
+
* Use this for large files (up to 2GB) to bypass the Laravel server.
|
|
27460
|
+
*
|
|
27461
|
+
* @param filename The original name of the file.
|
|
27462
|
+
* @param extension The file extension (e.g., 'mp4').
|
|
27463
|
+
* @returns AxiosPromise containing upload_url and file_path.
|
|
27464
|
+
*/
|
|
27465
|
+
Media.getPresignedUrl = function (filename, extension) {
|
|
27466
|
+
return Requests.processRoute(MediaRoute.routes.getPresignedUrl, { filename: filename, extension: extension });
|
|
27467
|
+
};
|
|
27468
|
+
/**
|
|
27469
|
+
* Confirm a successful S3 upload and create the database record.
|
|
27470
|
+
* Call this after the direct S3 upload is complete.
|
|
27471
|
+
*
|
|
27472
|
+
* @param data The file metadata (path, size, mime_type).
|
|
27473
|
+
* @returns AxiosPromise containing the created Media resource.
|
|
27474
|
+
*/
|
|
27475
|
+
Media.confirmS3Upload = function (data) {
|
|
27476
|
+
return Requests.processRoute(MediaRoute.routes.confirmS3Upload, data);
|
|
27477
|
+
};
|
|
27455
27478
|
return Media;
|
|
27456
27479
|
}());
|
|
27457
27480
|
|