@stack0/sdk 0.5.3 → 0.5.5
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/cdn/index.d.mts +201 -1
- package/dist/cdn/index.d.ts +201 -1
- package/dist/cdn/index.js +107 -0
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/index.mjs +107 -0
- package/dist/cdn/index.mjs.map +1 -1
- package/dist/extraction/index.d.mts +25 -1
- package/dist/extraction/index.d.ts +25 -1
- package/dist/extraction/index.js +22 -0
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/index.mjs +22 -0
- package/dist/extraction/index.mjs.map +1 -1
- package/dist/index.d.mts +697 -23
- package/dist/index.d.ts +697 -23
- package/dist/index.js +722 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +722 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cdn/index.d.mts
CHANGED
|
@@ -489,6 +489,135 @@ interface MovePrivateFilesResponse {
|
|
|
489
489
|
success: boolean;
|
|
490
490
|
movedCount: number;
|
|
491
491
|
}
|
|
492
|
+
type MergeStatus = TranscodingStatus;
|
|
493
|
+
type MergeQuality = VideoQuality;
|
|
494
|
+
type MergeOutputFormat = "mp4" | "webm";
|
|
495
|
+
/**
|
|
496
|
+
* A single input item for the merge operation.
|
|
497
|
+
* Can be a video, image, or audio file.
|
|
498
|
+
*/
|
|
499
|
+
interface MergeInputItem {
|
|
500
|
+
/** Asset ID of the file to include */
|
|
501
|
+
assetId: string;
|
|
502
|
+
/** Duration in seconds (required for images, optional for videos) */
|
|
503
|
+
duration?: number;
|
|
504
|
+
/** Start time in seconds for trimming (videos only) */
|
|
505
|
+
startTime?: number;
|
|
506
|
+
/** End time in seconds for trimming (videos only) */
|
|
507
|
+
endTime?: number;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Audio track overlay configuration for merge jobs.
|
|
511
|
+
* Allows adding background audio to the merged video.
|
|
512
|
+
*/
|
|
513
|
+
interface AudioTrackInput {
|
|
514
|
+
/** Asset ID of the audio file */
|
|
515
|
+
assetId: string;
|
|
516
|
+
/** Loop audio if shorter than video (default: false) */
|
|
517
|
+
loop?: boolean;
|
|
518
|
+
/** Fade in duration in seconds (0-10) */
|
|
519
|
+
fadeIn?: number;
|
|
520
|
+
/** Fade out duration in seconds (0-10) */
|
|
521
|
+
fadeOut?: number;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Output configuration for merge jobs
|
|
525
|
+
*/
|
|
526
|
+
interface MergeOutputConfig {
|
|
527
|
+
/** Output format (default: mp4) */
|
|
528
|
+
format?: MergeOutputFormat;
|
|
529
|
+
/** Output quality (default: 720p) */
|
|
530
|
+
quality?: MergeQuality;
|
|
531
|
+
/** Custom filename for the output */
|
|
532
|
+
filename?: string;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Request to create a merge job
|
|
536
|
+
*/
|
|
537
|
+
interface CreateMergeJobRequest {
|
|
538
|
+
/** Project slug to create the merge job in */
|
|
539
|
+
projectSlug: string;
|
|
540
|
+
/** Array of assets to merge (in order), 1-100 items */
|
|
541
|
+
inputs: MergeInputItem[];
|
|
542
|
+
/** Optional audio track to overlay */
|
|
543
|
+
audioTrack?: AudioTrackInput;
|
|
544
|
+
/** Output configuration */
|
|
545
|
+
output?: MergeOutputConfig;
|
|
546
|
+
/** Webhook URL for completion notification */
|
|
547
|
+
webhookUrl?: string;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Request to get a merge job by ID
|
|
551
|
+
*/
|
|
552
|
+
interface GetMergeJobRequest {
|
|
553
|
+
/** Merge job ID (UUID) */
|
|
554
|
+
jobId: string;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Request to list merge jobs
|
|
558
|
+
*/
|
|
559
|
+
interface ListMergeJobsRequest {
|
|
560
|
+
/** Project slug to list jobs for */
|
|
561
|
+
projectSlug: string;
|
|
562
|
+
/** Filter by status */
|
|
563
|
+
status?: MergeStatus;
|
|
564
|
+
/** Maximum number of results (default: 20, max: 100) */
|
|
565
|
+
limit?: number;
|
|
566
|
+
/** Offset for pagination */
|
|
567
|
+
offset?: number;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Request to cancel a merge job
|
|
571
|
+
*/
|
|
572
|
+
interface CancelMergeJobRequest {
|
|
573
|
+
/** Merge job ID (UUID) */
|
|
574
|
+
jobId: string;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Merge job response
|
|
578
|
+
*/
|
|
579
|
+
interface MergeJob {
|
|
580
|
+
id: string;
|
|
581
|
+
organizationId: string;
|
|
582
|
+
projectId: string;
|
|
583
|
+
environment: "sandbox" | "production";
|
|
584
|
+
inputs: MergeInputItem[];
|
|
585
|
+
audioTrackAssetId: string | null;
|
|
586
|
+
outputFormat: MergeOutputFormat;
|
|
587
|
+
outputQuality: MergeQuality;
|
|
588
|
+
outputFilename: string | null;
|
|
589
|
+
outputAssetId: string | null;
|
|
590
|
+
status: MergeStatus;
|
|
591
|
+
progress: number | null;
|
|
592
|
+
errorMessage: string | null;
|
|
593
|
+
startedAt: Date | null;
|
|
594
|
+
completedAt: Date | null;
|
|
595
|
+
totalDurationSeconds: number | null;
|
|
596
|
+
webhookUrl: string | null;
|
|
597
|
+
createdAt: Date;
|
|
598
|
+
updatedAt: Date | null;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Merge job with output asset details
|
|
602
|
+
*/
|
|
603
|
+
interface MergeJobWithOutput extends MergeJob {
|
|
604
|
+
outputAsset: {
|
|
605
|
+
id: string;
|
|
606
|
+
cdnUrl: string;
|
|
607
|
+
directUrl: string;
|
|
608
|
+
filename: string;
|
|
609
|
+
size: number;
|
|
610
|
+
duration: number | null;
|
|
611
|
+
} | null;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* List merge jobs response
|
|
615
|
+
*/
|
|
616
|
+
interface ListMergeJobsResponse {
|
|
617
|
+
jobs: MergeJob[];
|
|
618
|
+
total: number;
|
|
619
|
+
hasMore: boolean;
|
|
620
|
+
}
|
|
492
621
|
|
|
493
622
|
/**
|
|
494
623
|
* Stack0 CDN Client
|
|
@@ -1068,6 +1197,77 @@ declare class CDN {
|
|
|
1068
1197
|
* ```
|
|
1069
1198
|
*/
|
|
1070
1199
|
movePrivateFiles(request: MovePrivateFilesRequest): Promise<MovePrivateFilesResponse>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Create a merge job to combine multiple videos/images with optional audio overlay
|
|
1202
|
+
*
|
|
1203
|
+
* Merge jobs combine multiple assets (videos, images) in sequence and can
|
|
1204
|
+
* optionally overlay an audio track. Images require a duration to be specified.
|
|
1205
|
+
*
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```typescript
|
|
1208
|
+
* const job = await cdn.createMergeJob({
|
|
1209
|
+
* projectSlug: 'my-project',
|
|
1210
|
+
* inputs: [
|
|
1211
|
+
* { assetId: 'intro-video-id' },
|
|
1212
|
+
* { assetId: 'image-id', duration: 5 }, // Show image for 5 seconds
|
|
1213
|
+
* { assetId: 'main-video-id', startTime: 10, endTime: 60 }, // Trim to 50 seconds
|
|
1214
|
+
* ],
|
|
1215
|
+
* audioTrack: {
|
|
1216
|
+
* assetId: 'background-music-id',
|
|
1217
|
+
* loop: true,
|
|
1218
|
+
* fadeIn: 2,
|
|
1219
|
+
* fadeOut: 3,
|
|
1220
|
+
* },
|
|
1221
|
+
* output: {
|
|
1222
|
+
* format: 'mp4',
|
|
1223
|
+
* quality: '1080p',
|
|
1224
|
+
* filename: 'final-video.mp4',
|
|
1225
|
+
* },
|
|
1226
|
+
* webhookUrl: 'https://your-app.com/webhook',
|
|
1227
|
+
* });
|
|
1228
|
+
* console.log(`Merge job started: ${job.id}`);
|
|
1229
|
+
* ```
|
|
1230
|
+
*/
|
|
1231
|
+
createMergeJob(request: CreateMergeJobRequest): Promise<MergeJob>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Get a merge job by ID with output asset details
|
|
1234
|
+
*
|
|
1235
|
+
* @example
|
|
1236
|
+
* ```typescript
|
|
1237
|
+
* const job = await cdn.getMergeJob('job-id');
|
|
1238
|
+
* if (job.status === 'completed' && job.outputAsset) {
|
|
1239
|
+
* console.log(`Output video: ${job.outputAsset.cdnUrl}`);
|
|
1240
|
+
* }
|
|
1241
|
+
* ```
|
|
1242
|
+
*/
|
|
1243
|
+
getMergeJob(jobId: string): Promise<MergeJobWithOutput>;
|
|
1244
|
+
/**
|
|
1245
|
+
* List merge jobs with optional filters
|
|
1246
|
+
*
|
|
1247
|
+
* @example
|
|
1248
|
+
* ```typescript
|
|
1249
|
+
* const { jobs, total, hasMore } = await cdn.listMergeJobs({
|
|
1250
|
+
* projectSlug: 'my-project',
|
|
1251
|
+
* status: 'completed',
|
|
1252
|
+
* limit: 20,
|
|
1253
|
+
* });
|
|
1254
|
+
* ```
|
|
1255
|
+
*/
|
|
1256
|
+
listMergeJobs(request: ListMergeJobsRequest): Promise<ListMergeJobsResponse>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Cancel a pending or processing merge job
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```typescript
|
|
1262
|
+
* await cdn.cancelMergeJob('job-id');
|
|
1263
|
+
* console.log('Merge job cancelled');
|
|
1264
|
+
* ```
|
|
1265
|
+
*/
|
|
1266
|
+
cancelMergeJob(jobId: string): Promise<{
|
|
1267
|
+
success: boolean;
|
|
1268
|
+
}>;
|
|
1269
|
+
private convertMergeJobDates;
|
|
1270
|
+
private convertMergeJobWithOutputDates;
|
|
1071
1271
|
}
|
|
1072
1272
|
|
|
1073
|
-
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
|
|
1273
|
+
export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
|
package/dist/cdn/index.d.ts
CHANGED
|
@@ -489,6 +489,135 @@ interface MovePrivateFilesResponse {
|
|
|
489
489
|
success: boolean;
|
|
490
490
|
movedCount: number;
|
|
491
491
|
}
|
|
492
|
+
type MergeStatus = TranscodingStatus;
|
|
493
|
+
type MergeQuality = VideoQuality;
|
|
494
|
+
type MergeOutputFormat = "mp4" | "webm";
|
|
495
|
+
/**
|
|
496
|
+
* A single input item for the merge operation.
|
|
497
|
+
* Can be a video, image, or audio file.
|
|
498
|
+
*/
|
|
499
|
+
interface MergeInputItem {
|
|
500
|
+
/** Asset ID of the file to include */
|
|
501
|
+
assetId: string;
|
|
502
|
+
/** Duration in seconds (required for images, optional for videos) */
|
|
503
|
+
duration?: number;
|
|
504
|
+
/** Start time in seconds for trimming (videos only) */
|
|
505
|
+
startTime?: number;
|
|
506
|
+
/** End time in seconds for trimming (videos only) */
|
|
507
|
+
endTime?: number;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Audio track overlay configuration for merge jobs.
|
|
511
|
+
* Allows adding background audio to the merged video.
|
|
512
|
+
*/
|
|
513
|
+
interface AudioTrackInput {
|
|
514
|
+
/** Asset ID of the audio file */
|
|
515
|
+
assetId: string;
|
|
516
|
+
/** Loop audio if shorter than video (default: false) */
|
|
517
|
+
loop?: boolean;
|
|
518
|
+
/** Fade in duration in seconds (0-10) */
|
|
519
|
+
fadeIn?: number;
|
|
520
|
+
/** Fade out duration in seconds (0-10) */
|
|
521
|
+
fadeOut?: number;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Output configuration for merge jobs
|
|
525
|
+
*/
|
|
526
|
+
interface MergeOutputConfig {
|
|
527
|
+
/** Output format (default: mp4) */
|
|
528
|
+
format?: MergeOutputFormat;
|
|
529
|
+
/** Output quality (default: 720p) */
|
|
530
|
+
quality?: MergeQuality;
|
|
531
|
+
/** Custom filename for the output */
|
|
532
|
+
filename?: string;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Request to create a merge job
|
|
536
|
+
*/
|
|
537
|
+
interface CreateMergeJobRequest {
|
|
538
|
+
/** Project slug to create the merge job in */
|
|
539
|
+
projectSlug: string;
|
|
540
|
+
/** Array of assets to merge (in order), 1-100 items */
|
|
541
|
+
inputs: MergeInputItem[];
|
|
542
|
+
/** Optional audio track to overlay */
|
|
543
|
+
audioTrack?: AudioTrackInput;
|
|
544
|
+
/** Output configuration */
|
|
545
|
+
output?: MergeOutputConfig;
|
|
546
|
+
/** Webhook URL for completion notification */
|
|
547
|
+
webhookUrl?: string;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Request to get a merge job by ID
|
|
551
|
+
*/
|
|
552
|
+
interface GetMergeJobRequest {
|
|
553
|
+
/** Merge job ID (UUID) */
|
|
554
|
+
jobId: string;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Request to list merge jobs
|
|
558
|
+
*/
|
|
559
|
+
interface ListMergeJobsRequest {
|
|
560
|
+
/** Project slug to list jobs for */
|
|
561
|
+
projectSlug: string;
|
|
562
|
+
/** Filter by status */
|
|
563
|
+
status?: MergeStatus;
|
|
564
|
+
/** Maximum number of results (default: 20, max: 100) */
|
|
565
|
+
limit?: number;
|
|
566
|
+
/** Offset for pagination */
|
|
567
|
+
offset?: number;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Request to cancel a merge job
|
|
571
|
+
*/
|
|
572
|
+
interface CancelMergeJobRequest {
|
|
573
|
+
/** Merge job ID (UUID) */
|
|
574
|
+
jobId: string;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Merge job response
|
|
578
|
+
*/
|
|
579
|
+
interface MergeJob {
|
|
580
|
+
id: string;
|
|
581
|
+
organizationId: string;
|
|
582
|
+
projectId: string;
|
|
583
|
+
environment: "sandbox" | "production";
|
|
584
|
+
inputs: MergeInputItem[];
|
|
585
|
+
audioTrackAssetId: string | null;
|
|
586
|
+
outputFormat: MergeOutputFormat;
|
|
587
|
+
outputQuality: MergeQuality;
|
|
588
|
+
outputFilename: string | null;
|
|
589
|
+
outputAssetId: string | null;
|
|
590
|
+
status: MergeStatus;
|
|
591
|
+
progress: number | null;
|
|
592
|
+
errorMessage: string | null;
|
|
593
|
+
startedAt: Date | null;
|
|
594
|
+
completedAt: Date | null;
|
|
595
|
+
totalDurationSeconds: number | null;
|
|
596
|
+
webhookUrl: string | null;
|
|
597
|
+
createdAt: Date;
|
|
598
|
+
updatedAt: Date | null;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Merge job with output asset details
|
|
602
|
+
*/
|
|
603
|
+
interface MergeJobWithOutput extends MergeJob {
|
|
604
|
+
outputAsset: {
|
|
605
|
+
id: string;
|
|
606
|
+
cdnUrl: string;
|
|
607
|
+
directUrl: string;
|
|
608
|
+
filename: string;
|
|
609
|
+
size: number;
|
|
610
|
+
duration: number | null;
|
|
611
|
+
} | null;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* List merge jobs response
|
|
615
|
+
*/
|
|
616
|
+
interface ListMergeJobsResponse {
|
|
617
|
+
jobs: MergeJob[];
|
|
618
|
+
total: number;
|
|
619
|
+
hasMore: boolean;
|
|
620
|
+
}
|
|
492
621
|
|
|
493
622
|
/**
|
|
494
623
|
* Stack0 CDN Client
|
|
@@ -1068,6 +1197,77 @@ declare class CDN {
|
|
|
1068
1197
|
* ```
|
|
1069
1198
|
*/
|
|
1070
1199
|
movePrivateFiles(request: MovePrivateFilesRequest): Promise<MovePrivateFilesResponse>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Create a merge job to combine multiple videos/images with optional audio overlay
|
|
1202
|
+
*
|
|
1203
|
+
* Merge jobs combine multiple assets (videos, images) in sequence and can
|
|
1204
|
+
* optionally overlay an audio track. Images require a duration to be specified.
|
|
1205
|
+
*
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```typescript
|
|
1208
|
+
* const job = await cdn.createMergeJob({
|
|
1209
|
+
* projectSlug: 'my-project',
|
|
1210
|
+
* inputs: [
|
|
1211
|
+
* { assetId: 'intro-video-id' },
|
|
1212
|
+
* { assetId: 'image-id', duration: 5 }, // Show image for 5 seconds
|
|
1213
|
+
* { assetId: 'main-video-id', startTime: 10, endTime: 60 }, // Trim to 50 seconds
|
|
1214
|
+
* ],
|
|
1215
|
+
* audioTrack: {
|
|
1216
|
+
* assetId: 'background-music-id',
|
|
1217
|
+
* loop: true,
|
|
1218
|
+
* fadeIn: 2,
|
|
1219
|
+
* fadeOut: 3,
|
|
1220
|
+
* },
|
|
1221
|
+
* output: {
|
|
1222
|
+
* format: 'mp4',
|
|
1223
|
+
* quality: '1080p',
|
|
1224
|
+
* filename: 'final-video.mp4',
|
|
1225
|
+
* },
|
|
1226
|
+
* webhookUrl: 'https://your-app.com/webhook',
|
|
1227
|
+
* });
|
|
1228
|
+
* console.log(`Merge job started: ${job.id}`);
|
|
1229
|
+
* ```
|
|
1230
|
+
*/
|
|
1231
|
+
createMergeJob(request: CreateMergeJobRequest): Promise<MergeJob>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Get a merge job by ID with output asset details
|
|
1234
|
+
*
|
|
1235
|
+
* @example
|
|
1236
|
+
* ```typescript
|
|
1237
|
+
* const job = await cdn.getMergeJob('job-id');
|
|
1238
|
+
* if (job.status === 'completed' && job.outputAsset) {
|
|
1239
|
+
* console.log(`Output video: ${job.outputAsset.cdnUrl}`);
|
|
1240
|
+
* }
|
|
1241
|
+
* ```
|
|
1242
|
+
*/
|
|
1243
|
+
getMergeJob(jobId: string): Promise<MergeJobWithOutput>;
|
|
1244
|
+
/**
|
|
1245
|
+
* List merge jobs with optional filters
|
|
1246
|
+
*
|
|
1247
|
+
* @example
|
|
1248
|
+
* ```typescript
|
|
1249
|
+
* const { jobs, total, hasMore } = await cdn.listMergeJobs({
|
|
1250
|
+
* projectSlug: 'my-project',
|
|
1251
|
+
* status: 'completed',
|
|
1252
|
+
* limit: 20,
|
|
1253
|
+
* });
|
|
1254
|
+
* ```
|
|
1255
|
+
*/
|
|
1256
|
+
listMergeJobs(request: ListMergeJobsRequest): Promise<ListMergeJobsResponse>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Cancel a pending or processing merge job
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```typescript
|
|
1262
|
+
* await cdn.cancelMergeJob('job-id');
|
|
1263
|
+
* console.log('Merge job cancelled');
|
|
1264
|
+
* ```
|
|
1265
|
+
*/
|
|
1266
|
+
cancelMergeJob(jobId: string): Promise<{
|
|
1267
|
+
success: boolean;
|
|
1268
|
+
}>;
|
|
1269
|
+
private convertMergeJobDates;
|
|
1270
|
+
private convertMergeJobWithOutputDates;
|
|
1071
1271
|
}
|
|
1072
1272
|
|
|
1073
|
-
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
|
|
1273
|
+
export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
|
package/dist/cdn/index.js
CHANGED
|
@@ -1039,6 +1039,113 @@ var CDN = class {
|
|
|
1039
1039
|
async movePrivateFiles(request) {
|
|
1040
1040
|
return this.http.post("/cdn/private/move", request);
|
|
1041
1041
|
}
|
|
1042
|
+
// ============================================================================
|
|
1043
|
+
// Video Merge Methods
|
|
1044
|
+
// ============================================================================
|
|
1045
|
+
/**
|
|
1046
|
+
* Create a merge job to combine multiple videos/images with optional audio overlay
|
|
1047
|
+
*
|
|
1048
|
+
* Merge jobs combine multiple assets (videos, images) in sequence and can
|
|
1049
|
+
* optionally overlay an audio track. Images require a duration to be specified.
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```typescript
|
|
1053
|
+
* const job = await cdn.createMergeJob({
|
|
1054
|
+
* projectSlug: 'my-project',
|
|
1055
|
+
* inputs: [
|
|
1056
|
+
* { assetId: 'intro-video-id' },
|
|
1057
|
+
* { assetId: 'image-id', duration: 5 }, // Show image for 5 seconds
|
|
1058
|
+
* { assetId: 'main-video-id', startTime: 10, endTime: 60 }, // Trim to 50 seconds
|
|
1059
|
+
* ],
|
|
1060
|
+
* audioTrack: {
|
|
1061
|
+
* assetId: 'background-music-id',
|
|
1062
|
+
* loop: true,
|
|
1063
|
+
* fadeIn: 2,
|
|
1064
|
+
* fadeOut: 3,
|
|
1065
|
+
* },
|
|
1066
|
+
* output: {
|
|
1067
|
+
* format: 'mp4',
|
|
1068
|
+
* quality: '1080p',
|
|
1069
|
+
* filename: 'final-video.mp4',
|
|
1070
|
+
* },
|
|
1071
|
+
* webhookUrl: 'https://your-app.com/webhook',
|
|
1072
|
+
* });
|
|
1073
|
+
* console.log(`Merge job started: ${job.id}`);
|
|
1074
|
+
* ```
|
|
1075
|
+
*/
|
|
1076
|
+
async createMergeJob(request) {
|
|
1077
|
+
const response = await this.http.post("/cdn/video/merge", request);
|
|
1078
|
+
return this.convertMergeJobDates(response);
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Get a merge job by ID with output asset details
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* ```typescript
|
|
1085
|
+
* const job = await cdn.getMergeJob('job-id');
|
|
1086
|
+
* if (job.status === 'completed' && job.outputAsset) {
|
|
1087
|
+
* console.log(`Output video: ${job.outputAsset.cdnUrl}`);
|
|
1088
|
+
* }
|
|
1089
|
+
* ```
|
|
1090
|
+
*/
|
|
1091
|
+
async getMergeJob(jobId) {
|
|
1092
|
+
const response = await this.http.get(`/cdn/video/merge/${jobId}`);
|
|
1093
|
+
return this.convertMergeJobWithOutputDates(response);
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* List merge jobs with optional filters
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* const { jobs, total, hasMore } = await cdn.listMergeJobs({
|
|
1101
|
+
* projectSlug: 'my-project',
|
|
1102
|
+
* status: 'completed',
|
|
1103
|
+
* limit: 20,
|
|
1104
|
+
* });
|
|
1105
|
+
* ```
|
|
1106
|
+
*/
|
|
1107
|
+
async listMergeJobs(request) {
|
|
1108
|
+
const params = new URLSearchParams();
|
|
1109
|
+
params.set("projectSlug", request.projectSlug);
|
|
1110
|
+
if (request.status) params.set("status", request.status);
|
|
1111
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
1112
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
1113
|
+
const response = await this.http.get(`/cdn/video/merge?${params.toString()}`);
|
|
1114
|
+
return {
|
|
1115
|
+
...response,
|
|
1116
|
+
jobs: response.jobs.map((job) => this.convertMergeJobDates(job))
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Cancel a pending or processing merge job
|
|
1121
|
+
*
|
|
1122
|
+
* @example
|
|
1123
|
+
* ```typescript
|
|
1124
|
+
* await cdn.cancelMergeJob('job-id');
|
|
1125
|
+
* console.log('Merge job cancelled');
|
|
1126
|
+
* ```
|
|
1127
|
+
*/
|
|
1128
|
+
async cancelMergeJob(jobId) {
|
|
1129
|
+
return this.http.post(`/cdn/video/merge/${jobId}/cancel`, {});
|
|
1130
|
+
}
|
|
1131
|
+
convertMergeJobDates(job) {
|
|
1132
|
+
if (typeof job.createdAt === "string") {
|
|
1133
|
+
job.createdAt = new Date(job.createdAt);
|
|
1134
|
+
}
|
|
1135
|
+
if (job.updatedAt && typeof job.updatedAt === "string") {
|
|
1136
|
+
job.updatedAt = new Date(job.updatedAt);
|
|
1137
|
+
}
|
|
1138
|
+
if (job.startedAt && typeof job.startedAt === "string") {
|
|
1139
|
+
job.startedAt = new Date(job.startedAt);
|
|
1140
|
+
}
|
|
1141
|
+
if (job.completedAt && typeof job.completedAt === "string") {
|
|
1142
|
+
job.completedAt = new Date(job.completedAt);
|
|
1143
|
+
}
|
|
1144
|
+
return job;
|
|
1145
|
+
}
|
|
1146
|
+
convertMergeJobWithOutputDates(job) {
|
|
1147
|
+
return this.convertMergeJobDates(job);
|
|
1148
|
+
}
|
|
1042
1149
|
};
|
|
1043
1150
|
|
|
1044
1151
|
exports.CDN = CDN;
|