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.
@@ -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