glitch-javascript-sdk 2.9.9 → 3.0.1

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.
@@ -97,6 +97,37 @@ export interface S3ConfirmRequest {
97
97
  title?: string;
98
98
  filename?: string;
99
99
  }
100
+ /**
101
+ * Interfaces for the Video Editor Manifest
102
+ */
103
+ export interface VideoEdit {
104
+ type: 'trim' | 'crop' | 'text' | 'speed' | 'overlay' | 'thumbnail';
105
+ params: TrimParams | CropParams | TextParams | SpeedParams | any;
106
+ }
107
+ export interface TrimParams {
108
+ start: number;
109
+ duration: number;
110
+ }
111
+ export interface CropParams {
112
+ x: number;
113
+ y: number;
114
+ width: number;
115
+ height: number;
116
+ }
117
+ export interface TextParams {
118
+ text: string;
119
+ x: string | number;
120
+ y: string | number;
121
+ fontSize: number;
122
+ fontColor: string;
123
+ }
124
+ export interface SpeedParams {
125
+ multiplier: number;
126
+ }
127
+ export interface VideoProcessRequest {
128
+ edits: VideoEdit[];
129
+ output_format?: 'mp4' | 'webm';
130
+ }
100
131
  declare class Media {
101
132
  /**
102
133
  * Upload media content using a File object.
@@ -234,13 +265,12 @@ declare class Media {
234
265
  static uploadTikTokMusic<T>(file: File, scheduler_id: string): AxiosPromise<Response<T>>;
235
266
  /**
236
267
  * Generate an S3 Presigned URL for direct upload.
237
- * Use this for large files (up to 2GB) to bypass the Laravel server.
238
268
  *
239
269
  * @param filename The original name of the file.
240
270
  * @param extension The file extension (e.g., 'mp4').
241
- * @returns AxiosPromise containing upload_url and file_path.
271
+ * @param is_public Set to true if the file should be publicly accessible via URL.
242
272
  */
243
- static getPresignedUrl<T = PresignedUrlResponse>(filename: string, extension: string): AxiosPromise<Response<T>>;
273
+ static getPresignedUrl<T = PresignedUrlResponse>(filename: string, extension: string, is_public?: boolean): AxiosPromise<Response<T>>;
244
274
  /**
245
275
  * Confirm a successful S3 upload and create the database record.
246
276
  * Call this after the direct S3 upload is complete.
@@ -249,5 +279,14 @@ declare class Media {
249
279
  * @returns AxiosPromise containing the created Media resource.
250
280
  */
251
281
  static confirmS3Upload<T>(data: S3ConfirmRequest): AxiosPromise<Response<T>>;
282
+ /**
283
+ * Submit a video for processing (Trim, Crop, Text, etc.)
284
+ * This triggers a background job on the server.
285
+ *
286
+ * @param media_id The UUID of the source video.
287
+ * @param data The edit manifest containing the array of transformations.
288
+ * @returns Promise with the pending_media_id.
289
+ */
290
+ static process<T>(media_id: string, data: VideoProcessRequest): AxiosPromise<Response<T>>;
252
291
  }
253
292
  export default Media;
package/dist/esm/index.js CHANGED
@@ -14913,6 +14913,7 @@ var MediaRoute = /** @class */ (function () {
14913
14913
  uploadTikTokMusic: { url: '/media/tiktok/music', method: HTTP_METHODS.POST },
14914
14914
  getPresignedUrl: { url: '/media/presigned-url', method: HTTP_METHODS.POST },
14915
14915
  confirmS3Upload: { url: '/media/s3-confirm', method: HTTP_METHODS.POST },
14916
+ processVideo: { url: '/media/{media_id}/process', method: HTTP_METHODS.POST },
14916
14917
  };
14917
14918
  return MediaRoute;
14918
14919
  }());
@@ -15145,14 +15146,19 @@ var Media = /** @class */ (function () {
15145
15146
  };
15146
15147
  /**
15147
15148
  * Generate an S3 Presigned URL for direct upload.
15148
- * Use this for large files (up to 2GB) to bypass the Laravel server.
15149
15149
  *
15150
15150
  * @param filename The original name of the file.
15151
15151
  * @param extension The file extension (e.g., 'mp4').
15152
- * @returns AxiosPromise containing upload_url and file_path.
15152
+ * @param is_public Set to true if the file should be publicly accessible via URL.
15153
15153
  */
15154
- Media.getPresignedUrl = function (filename, extension) {
15155
- return Requests.processRoute(MediaRoute.routes.getPresignedUrl, { filename: filename, extension: extension });
15154
+ Media.getPresignedUrl = function (filename, extension, is_public // Added parameter
15155
+ ) {
15156
+ if (is_public === void 0) { is_public = false; }
15157
+ return Requests.processRoute(MediaRoute.routes.getPresignedUrl, {
15158
+ filename: filename,
15159
+ extension: extension,
15160
+ is_public: is_public // Pass to backend
15161
+ });
15156
15162
  };
15157
15163
  /**
15158
15164
  * Confirm a successful S3 upload and create the database record.
@@ -15164,6 +15170,17 @@ var Media = /** @class */ (function () {
15164
15170
  Media.confirmS3Upload = function (data) {
15165
15171
  return Requests.processRoute(MediaRoute.routes.confirmS3Upload, data);
15166
15172
  };
15173
+ /**
15174
+ * Submit a video for processing (Trim, Crop, Text, etc.)
15175
+ * This triggers a background job on the server.
15176
+ *
15177
+ * @param media_id The UUID of the source video.
15178
+ * @param data The edit manifest containing the array of transformations.
15179
+ * @returns Promise with the pending_media_id.
15180
+ */
15181
+ Media.process = function (media_id, data) {
15182
+ return Requests.processRoute(MediaRoute.routes.processVideo, data, { media_id: media_id });
15183
+ };
15167
15184
  return Media;
15168
15185
  }());
15169
15186