@stack0/sdk 0.5.4 → 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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1816,6 +1816,113 @@ var CDN = class {
|
|
|
1816
1816
|
async movePrivateFiles(request) {
|
|
1817
1817
|
return this.http.post("/cdn/private/move", request);
|
|
1818
1818
|
}
|
|
1819
|
+
// ============================================================================
|
|
1820
|
+
// Video Merge Methods
|
|
1821
|
+
// ============================================================================
|
|
1822
|
+
/**
|
|
1823
|
+
* Create a merge job to combine multiple videos/images with optional audio overlay
|
|
1824
|
+
*
|
|
1825
|
+
* Merge jobs combine multiple assets (videos, images) in sequence and can
|
|
1826
|
+
* optionally overlay an audio track. Images require a duration to be specified.
|
|
1827
|
+
*
|
|
1828
|
+
* @example
|
|
1829
|
+
* ```typescript
|
|
1830
|
+
* const job = await cdn.createMergeJob({
|
|
1831
|
+
* projectSlug: 'my-project',
|
|
1832
|
+
* inputs: [
|
|
1833
|
+
* { assetId: 'intro-video-id' },
|
|
1834
|
+
* { assetId: 'image-id', duration: 5 }, // Show image for 5 seconds
|
|
1835
|
+
* { assetId: 'main-video-id', startTime: 10, endTime: 60 }, // Trim to 50 seconds
|
|
1836
|
+
* ],
|
|
1837
|
+
* audioTrack: {
|
|
1838
|
+
* assetId: 'background-music-id',
|
|
1839
|
+
* loop: true,
|
|
1840
|
+
* fadeIn: 2,
|
|
1841
|
+
* fadeOut: 3,
|
|
1842
|
+
* },
|
|
1843
|
+
* output: {
|
|
1844
|
+
* format: 'mp4',
|
|
1845
|
+
* quality: '1080p',
|
|
1846
|
+
* filename: 'final-video.mp4',
|
|
1847
|
+
* },
|
|
1848
|
+
* webhookUrl: 'https://your-app.com/webhook',
|
|
1849
|
+
* });
|
|
1850
|
+
* console.log(`Merge job started: ${job.id}`);
|
|
1851
|
+
* ```
|
|
1852
|
+
*/
|
|
1853
|
+
async createMergeJob(request) {
|
|
1854
|
+
const response = await this.http.post("/cdn/video/merge", request);
|
|
1855
|
+
return this.convertMergeJobDates(response);
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Get a merge job by ID with output asset details
|
|
1859
|
+
*
|
|
1860
|
+
* @example
|
|
1861
|
+
* ```typescript
|
|
1862
|
+
* const job = await cdn.getMergeJob('job-id');
|
|
1863
|
+
* if (job.status === 'completed' && job.outputAsset) {
|
|
1864
|
+
* console.log(`Output video: ${job.outputAsset.cdnUrl}`);
|
|
1865
|
+
* }
|
|
1866
|
+
* ```
|
|
1867
|
+
*/
|
|
1868
|
+
async getMergeJob(jobId) {
|
|
1869
|
+
const response = await this.http.get(`/cdn/video/merge/${jobId}`);
|
|
1870
|
+
return this.convertMergeJobWithOutputDates(response);
|
|
1871
|
+
}
|
|
1872
|
+
/**
|
|
1873
|
+
* List merge jobs with optional filters
|
|
1874
|
+
*
|
|
1875
|
+
* @example
|
|
1876
|
+
* ```typescript
|
|
1877
|
+
* const { jobs, total, hasMore } = await cdn.listMergeJobs({
|
|
1878
|
+
* projectSlug: 'my-project',
|
|
1879
|
+
* status: 'completed',
|
|
1880
|
+
* limit: 20,
|
|
1881
|
+
* });
|
|
1882
|
+
* ```
|
|
1883
|
+
*/
|
|
1884
|
+
async listMergeJobs(request) {
|
|
1885
|
+
const params = new URLSearchParams();
|
|
1886
|
+
params.set("projectSlug", request.projectSlug);
|
|
1887
|
+
if (request.status) params.set("status", request.status);
|
|
1888
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
1889
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
1890
|
+
const response = await this.http.get(`/cdn/video/merge?${params.toString()}`);
|
|
1891
|
+
return {
|
|
1892
|
+
...response,
|
|
1893
|
+
jobs: response.jobs.map((job) => this.convertMergeJobDates(job))
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Cancel a pending or processing merge job
|
|
1898
|
+
*
|
|
1899
|
+
* @example
|
|
1900
|
+
* ```typescript
|
|
1901
|
+
* await cdn.cancelMergeJob('job-id');
|
|
1902
|
+
* console.log('Merge job cancelled');
|
|
1903
|
+
* ```
|
|
1904
|
+
*/
|
|
1905
|
+
async cancelMergeJob(jobId) {
|
|
1906
|
+
return this.http.post(`/cdn/video/merge/${jobId}/cancel`, {});
|
|
1907
|
+
}
|
|
1908
|
+
convertMergeJobDates(job) {
|
|
1909
|
+
if (typeof job.createdAt === "string") {
|
|
1910
|
+
job.createdAt = new Date(job.createdAt);
|
|
1911
|
+
}
|
|
1912
|
+
if (job.updatedAt && typeof job.updatedAt === "string") {
|
|
1913
|
+
job.updatedAt = new Date(job.updatedAt);
|
|
1914
|
+
}
|
|
1915
|
+
if (job.startedAt && typeof job.startedAt === "string") {
|
|
1916
|
+
job.startedAt = new Date(job.startedAt);
|
|
1917
|
+
}
|
|
1918
|
+
if (job.completedAt && typeof job.completedAt === "string") {
|
|
1919
|
+
job.completedAt = new Date(job.completedAt);
|
|
1920
|
+
}
|
|
1921
|
+
return job;
|
|
1922
|
+
}
|
|
1923
|
+
convertMergeJobWithOutputDates(job) {
|
|
1924
|
+
return this.convertMergeJobDates(job);
|
|
1925
|
+
}
|
|
1819
1926
|
};
|
|
1820
1927
|
|
|
1821
1928
|
// src/screenshots/client.ts
|