@aviaryhq/cloudglue-js 0.4.11 → 0.4.13
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/generated/Chat.d.ts +8 -8
- package/dist/generated/Chat.js +30 -30
- package/dist/generated/Collections.d.ts +25 -23
- package/dist/generated/Collections.js +266 -264
- package/dist/generated/Describe.d.ts +7 -7
- package/dist/generated/Describe.js +58 -58
- package/dist/generated/Extract.d.ts +6 -6
- package/dist/generated/Extract.js +52 -52
- package/dist/generated/Face_Detection.d.ts +6 -6
- package/dist/generated/Face_Detection.js +25 -25
- package/dist/generated/Face_Match.d.ts +6 -6
- package/dist/generated/Face_Match.js +26 -26
- package/dist/generated/Files.d.ts +1009 -10
- package/dist/generated/Files.js +247 -115
- package/dist/generated/Frames.d.ts +2 -2
- package/dist/generated/Frames.js +17 -17
- package/dist/generated/Search.d.ts +212 -19
- package/dist/generated/Search.js +143 -30
- package/dist/generated/Segmentations.d.ts +208 -2
- package/dist/generated/Segmentations.js +34 -29
- package/dist/generated/Segments.d.ts +13 -13
- package/dist/generated/Segments.js +49 -49
- package/dist/generated/Tags.d.ts +660 -0
- package/dist/generated/Tags.js +160 -0
- package/dist/generated/Transcribe.d.ts +7 -7
- package/dist/generated/Transcribe.js +46 -46
- package/dist/generated/Webhooks.d.ts +5 -5
- package/dist/generated/Webhooks.js +61 -61
- package/dist/generated/common.d.ts +391 -11
- package/dist/generated/common.js +63 -28
- package/dist/generated/index.d.ts +14 -13
- package/dist/generated/index.js +3 -1
- package/dist/src/api/chat-completion.api.d.ts +38 -0
- package/dist/src/api/chat-completion.api.js +15 -0
- package/dist/src/api/collections.api.d.ts +666 -0
- package/dist/src/api/collections.api.js +134 -0
- package/dist/src/api/describe.api.d.ts +153 -0
- package/dist/src/api/describe.api.js +57 -0
- package/dist/src/api/extract.api.d.ts +144 -0
- package/dist/src/api/extract.api.js +55 -0
- package/dist/src/api/face-detection.api.d.ts +77 -0
- package/dist/src/api/face-detection.api.js +41 -0
- package/dist/src/api/face-match.api.d.ts +94 -0
- package/dist/src/api/face-match.api.js +41 -0
- package/dist/src/api/files.api.d.ts +705 -0
- package/dist/src/api/files.api.js +146 -0
- package/dist/src/api/frame-extraction.api.d.ts +264 -0
- package/dist/src/api/frame-extraction.api.js +37 -0
- package/dist/src/api/search.api.d.ts +316 -0
- package/dist/src/api/search.api.js +22 -0
- package/dist/src/api/segmentations.api.d.ts +395 -0
- package/dist/src/api/segmentations.api.js +36 -0
- package/dist/src/api/segments.api.d.ts +141 -0
- package/dist/src/api/segments.api.js +40 -0
- package/dist/src/api/tags.api.d.ts +71 -0
- package/dist/src/api/tags.api.js +31 -0
- package/dist/src/api/transcribe.api.d.ts +150 -0
- package/dist/src/api/transcribe.api.js +65 -0
- package/dist/src/api/webhooks.api.d.ts +69 -0
- package/dist/src/api/webhooks.api.js +28 -0
- package/dist/src/client.d.ts +20 -2967
- package/dist/src/client.js +55 -643
- package/dist/src/error.d.ts +7 -0
- package/dist/src/error.js +14 -0
- package/dist/src/types.d.ts +20 -8
- package/package.json +2 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedFilesApi = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
class EnhancedFilesApi {
|
|
6
|
+
constructor(api) {
|
|
7
|
+
this.api = api;
|
|
8
|
+
}
|
|
9
|
+
async listFiles(params = {}) {
|
|
10
|
+
const { filter, ...otherParams } = params;
|
|
11
|
+
// Convert filter object to JSON string if provided
|
|
12
|
+
const queries = { ...otherParams };
|
|
13
|
+
if (filter) {
|
|
14
|
+
try {
|
|
15
|
+
queries.filter = JSON.stringify(filter);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
throw new error_1.CloudGlueError(`Failed to serialize filter object: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return this.api.listFiles({ queries });
|
|
22
|
+
}
|
|
23
|
+
async uploadFile(params) {
|
|
24
|
+
// File uploads require special handling for multipart/form-data that the generated Zodios client doesn't handle automatically.
|
|
25
|
+
// We need to:
|
|
26
|
+
// 1. Create a FormData object and append the file with the correct field name
|
|
27
|
+
// 2. JSON stringify the metadata if present
|
|
28
|
+
// 3. Set the correct Content-Type header
|
|
29
|
+
// This is why we use axios directly instead of the generated client method.
|
|
30
|
+
const formData = new FormData();
|
|
31
|
+
formData.append('file', params.file);
|
|
32
|
+
// Add metadata if provided
|
|
33
|
+
if (params.metadata) {
|
|
34
|
+
try {
|
|
35
|
+
formData.append('metadata', JSON.stringify(params.metadata));
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
throw new error_1.CloudGlueError(`Failed to serialize metadata object: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (params.enable_segment_thumbnails !== undefined) {
|
|
42
|
+
formData.append('enable_segment_thumbnails', params.enable_segment_thumbnails.toString());
|
|
43
|
+
}
|
|
44
|
+
// Use axios directly to bypass Zodios validation
|
|
45
|
+
return this.api.axios({
|
|
46
|
+
method: 'post',
|
|
47
|
+
url: '/files',
|
|
48
|
+
data: formData,
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'multipart/form-data',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async getFile(fileId) {
|
|
55
|
+
return this.api.getFile({ params: { file_id: fileId } });
|
|
56
|
+
}
|
|
57
|
+
async deleteFile(fileId) {
|
|
58
|
+
return this.api.deleteFile(undefined, {
|
|
59
|
+
params: { file_id: fileId },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async updateFile(fileId, params) {
|
|
63
|
+
return this.api.updateFile({ ...params, filename: params.filename ?? undefined }, { params: { file_id: fileId } });
|
|
64
|
+
}
|
|
65
|
+
async listFileSegmentations(fileId, params = {}) {
|
|
66
|
+
return this.api.listFileSegmentations({
|
|
67
|
+
params: { file_id: fileId },
|
|
68
|
+
queries: params,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get thumbnails for a file. If a segmentationId is provided, the thumbnails will be for a specific segmentation.
|
|
73
|
+
* @param fileId - The ID of the file
|
|
74
|
+
* @param params - Optional parameters
|
|
75
|
+
* @returns The thumbnails for the file
|
|
76
|
+
*/
|
|
77
|
+
async getFileThumbnails(fileId, params) {
|
|
78
|
+
return this.api.getThumbnails({
|
|
79
|
+
params: { file_id: fileId },
|
|
80
|
+
queries: {
|
|
81
|
+
...params,
|
|
82
|
+
is_default: params.isDefault ?? false,
|
|
83
|
+
type: params.type?.join(','),
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async createFileSegmentation(fileId, params) {
|
|
88
|
+
return this.api.createFileSegmentation(params, {
|
|
89
|
+
params: { file_id: fileId },
|
|
90
|
+
body: params,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async createFileFrameExtraction(fileId, params) {
|
|
94
|
+
return this.api.createFileFrameExtraction(params, {
|
|
95
|
+
params: { file_id: fileId },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
async getFileSegment(fileId, segmentId) {
|
|
99
|
+
return this.api.getFileSegment({
|
|
100
|
+
params: { file_id: fileId, segment_id: segmentId },
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async updateFileSegment(fileId, segmentId, body) {
|
|
104
|
+
return this.api.updateFileSegment(body, {
|
|
105
|
+
params: { file_id: fileId, segment_id: segmentId },
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async getFileTags(fileId) {
|
|
109
|
+
return this.api.listFileTags({
|
|
110
|
+
params: { file_id: fileId },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async getFileSegmentTags(fileId, segmentId) {
|
|
114
|
+
return this.api.listFileSegmentTags({
|
|
115
|
+
params: { file_id: fileId, segment_id: segmentId },
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Waits for a file to finish processing by polling the getFile endpoint until the file
|
|
120
|
+
* reaches a terminal state (completed, failed, or not_applicable) or until maxAttempts is reached.
|
|
121
|
+
*
|
|
122
|
+
* @param fileId - The ID of the file to wait for
|
|
123
|
+
* @param options - Optional configuration for polling behavior
|
|
124
|
+
* @returns The final file object
|
|
125
|
+
* @throws {CloudGlueError} If the file fails to process or maxAttempts is reached
|
|
126
|
+
*/
|
|
127
|
+
async waitForReady(fileId, options = {}) {
|
|
128
|
+
const { pollingInterval = 5000, maxAttempts = 36 } = options;
|
|
129
|
+
let attempts = 0;
|
|
130
|
+
while (attempts < maxAttempts) {
|
|
131
|
+
const file = await this.getFile(fileId);
|
|
132
|
+
// If we've reached a terminal state, return the file
|
|
133
|
+
if (['completed', 'failed', 'not_applicable'].includes(file.status)) {
|
|
134
|
+
if (file.status === 'failed') {
|
|
135
|
+
throw new error_1.CloudGlueError(`File processing failed: ${fileId}`);
|
|
136
|
+
}
|
|
137
|
+
return file;
|
|
138
|
+
}
|
|
139
|
+
// Wait for the polling interval before trying again
|
|
140
|
+
await new Promise((resolve) => setTimeout(resolve, pollingInterval));
|
|
141
|
+
attempts++;
|
|
142
|
+
}
|
|
143
|
+
throw new error_1.CloudGlueError(`Timeout waiting for file ${fileId} to process after ${maxAttempts} attempts`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.EnhancedFilesApi = EnhancedFilesApi;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { FramesApi } from '../../generated';
|
|
2
|
+
import { WaitForReadyOptions } from '../types';
|
|
3
|
+
export declare class EnhancedFramesApi {
|
|
4
|
+
private readonly api;
|
|
5
|
+
constructor(api: typeof FramesApi);
|
|
6
|
+
getFrameExtraction(frameExtractionId: string, params?: {
|
|
7
|
+
limit?: number;
|
|
8
|
+
offset?: number;
|
|
9
|
+
}): Promise<import("zod").objectOutputType<{
|
|
10
|
+
frame_extraction_id: import("zod").ZodString;
|
|
11
|
+
status: import("zod").ZodEnum<["pending", "processing", "completed", "failed"]>;
|
|
12
|
+
created_at: import("zod").ZodNumber;
|
|
13
|
+
file_id: import("zod").ZodString;
|
|
14
|
+
frame_extraction_config: import("zod").ZodObject<{
|
|
15
|
+
strategy: import("zod").ZodLiteral<"uniform">;
|
|
16
|
+
uniform_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
17
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
18
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
19
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
20
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
21
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
22
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
23
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
24
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
25
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
26
|
+
thumbnails_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
27
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
28
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
29
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
30
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
31
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
32
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
33
|
+
start_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
34
|
+
end_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
35
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
36
|
+
strategy: import("zod").ZodLiteral<"uniform">;
|
|
37
|
+
uniform_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
38
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
39
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
40
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
41
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
42
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
43
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
44
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
45
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
46
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
47
|
+
thumbnails_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
48
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
49
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
50
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
51
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
52
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
53
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
54
|
+
start_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
55
|
+
end_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
56
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
57
|
+
strategy: import("zod").ZodLiteral<"uniform">;
|
|
58
|
+
uniform_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
59
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
60
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
61
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
62
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
63
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
64
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
65
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
66
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
67
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
68
|
+
thumbnails_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
69
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
70
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
71
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
72
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
73
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
74
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
75
|
+
start_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
76
|
+
end_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
77
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
78
|
+
frame_count: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
79
|
+
data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
80
|
+
object: import("zod").ZodLiteral<"list">;
|
|
81
|
+
frames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
82
|
+
id: import("zod").ZodString;
|
|
83
|
+
timestamp: import("zod").ZodNumber;
|
|
84
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
85
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
86
|
+
id: import("zod").ZodString;
|
|
87
|
+
timestamp: import("zod").ZodNumber;
|
|
88
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
89
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
90
|
+
id: import("zod").ZodString;
|
|
91
|
+
timestamp: import("zod").ZodNumber;
|
|
92
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
93
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
94
|
+
total: import("zod").ZodNumber;
|
|
95
|
+
limit: import("zod").ZodNumber;
|
|
96
|
+
offset: import("zod").ZodNumber;
|
|
97
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
98
|
+
object: import("zod").ZodLiteral<"list">;
|
|
99
|
+
frames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
100
|
+
id: import("zod").ZodString;
|
|
101
|
+
timestamp: import("zod").ZodNumber;
|
|
102
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
103
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
104
|
+
id: import("zod").ZodString;
|
|
105
|
+
timestamp: import("zod").ZodNumber;
|
|
106
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
107
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
108
|
+
id: import("zod").ZodString;
|
|
109
|
+
timestamp: import("zod").ZodNumber;
|
|
110
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
111
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
112
|
+
total: import("zod").ZodNumber;
|
|
113
|
+
limit: import("zod").ZodNumber;
|
|
114
|
+
offset: import("zod").ZodNumber;
|
|
115
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
116
|
+
object: import("zod").ZodLiteral<"list">;
|
|
117
|
+
frames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
118
|
+
id: import("zod").ZodString;
|
|
119
|
+
timestamp: import("zod").ZodNumber;
|
|
120
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
121
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
122
|
+
id: import("zod").ZodString;
|
|
123
|
+
timestamp: import("zod").ZodNumber;
|
|
124
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
125
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
126
|
+
id: import("zod").ZodString;
|
|
127
|
+
timestamp: import("zod").ZodNumber;
|
|
128
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
129
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
130
|
+
total: import("zod").ZodNumber;
|
|
131
|
+
limit: import("zod").ZodNumber;
|
|
132
|
+
offset: import("zod").ZodNumber;
|
|
133
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
134
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
135
|
+
deleteFrameExtraction(frameExtractionId: string): Promise<import("zod").objectOutputType<{
|
|
136
|
+
id: import("zod").ZodString;
|
|
137
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
138
|
+
waitForReady(frameExtractionId: string, options?: WaitForReadyOptions): Promise<import("zod").objectOutputType<{
|
|
139
|
+
frame_extraction_id: import("zod").ZodString;
|
|
140
|
+
status: import("zod").ZodEnum<["pending", "processing", "completed", "failed"]>;
|
|
141
|
+
created_at: import("zod").ZodNumber;
|
|
142
|
+
file_id: import("zod").ZodString;
|
|
143
|
+
frame_extraction_config: import("zod").ZodObject<{
|
|
144
|
+
strategy: import("zod").ZodLiteral<"uniform">;
|
|
145
|
+
uniform_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
146
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
147
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
148
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
149
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
150
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
151
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
152
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
153
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
154
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
155
|
+
thumbnails_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
156
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
157
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
158
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
159
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
160
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
161
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
162
|
+
start_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
163
|
+
end_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
164
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
165
|
+
strategy: import("zod").ZodLiteral<"uniform">;
|
|
166
|
+
uniform_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
167
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
168
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
169
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
170
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
171
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
172
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
173
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
174
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
175
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
176
|
+
thumbnails_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
177
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
178
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
179
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
180
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
181
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
182
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
183
|
+
start_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
184
|
+
end_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
185
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
186
|
+
strategy: import("zod").ZodLiteral<"uniform">;
|
|
187
|
+
uniform_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
188
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
189
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
190
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
191
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
192
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
193
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
194
|
+
frames_per_second: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
195
|
+
max_width: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
196
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
197
|
+
thumbnails_config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
198
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
199
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
200
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
201
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
202
|
+
enable_frame_thumbnails: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
|
203
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
204
|
+
start_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
205
|
+
end_time_seconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
206
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
207
|
+
frame_count: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
208
|
+
data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
209
|
+
object: import("zod").ZodLiteral<"list">;
|
|
210
|
+
frames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
211
|
+
id: import("zod").ZodString;
|
|
212
|
+
timestamp: import("zod").ZodNumber;
|
|
213
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
214
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
215
|
+
id: import("zod").ZodString;
|
|
216
|
+
timestamp: import("zod").ZodNumber;
|
|
217
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
218
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
219
|
+
id: import("zod").ZodString;
|
|
220
|
+
timestamp: import("zod").ZodNumber;
|
|
221
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
222
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
223
|
+
total: import("zod").ZodNumber;
|
|
224
|
+
limit: import("zod").ZodNumber;
|
|
225
|
+
offset: import("zod").ZodNumber;
|
|
226
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
227
|
+
object: import("zod").ZodLiteral<"list">;
|
|
228
|
+
frames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
229
|
+
id: import("zod").ZodString;
|
|
230
|
+
timestamp: import("zod").ZodNumber;
|
|
231
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
232
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
233
|
+
id: import("zod").ZodString;
|
|
234
|
+
timestamp: import("zod").ZodNumber;
|
|
235
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
236
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
237
|
+
id: import("zod").ZodString;
|
|
238
|
+
timestamp: import("zod").ZodNumber;
|
|
239
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
240
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
241
|
+
total: import("zod").ZodNumber;
|
|
242
|
+
limit: import("zod").ZodNumber;
|
|
243
|
+
offset: import("zod").ZodNumber;
|
|
244
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
245
|
+
object: import("zod").ZodLiteral<"list">;
|
|
246
|
+
frames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
247
|
+
id: import("zod").ZodString;
|
|
248
|
+
timestamp: import("zod").ZodNumber;
|
|
249
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
250
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
251
|
+
id: import("zod").ZodString;
|
|
252
|
+
timestamp: import("zod").ZodNumber;
|
|
253
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
254
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
255
|
+
id: import("zod").ZodString;
|
|
256
|
+
timestamp: import("zod").ZodNumber;
|
|
257
|
+
thumbnail_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
258
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
259
|
+
total: import("zod").ZodNumber;
|
|
260
|
+
limit: import("zod").ZodNumber;
|
|
261
|
+
offset: import("zod").ZodNumber;
|
|
262
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
263
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
264
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedFramesApi = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
class EnhancedFramesApi {
|
|
6
|
+
constructor(api) {
|
|
7
|
+
this.api = api;
|
|
8
|
+
}
|
|
9
|
+
async getFrameExtraction(frameExtractionId, params = {}) {
|
|
10
|
+
return this.api.getFrameExtraction({
|
|
11
|
+
params: { frame_extraction_id: frameExtractionId },
|
|
12
|
+
queries: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async deleteFrameExtraction(frameExtractionId) {
|
|
16
|
+
return this.api.deleteFrameExtraction(undefined, {
|
|
17
|
+
params: { frame_extraction_id: frameExtractionId },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async waitForReady(frameExtractionId, options = {}) {
|
|
21
|
+
const { pollingInterval = 5000, maxAttempts = 36 } = options;
|
|
22
|
+
let attempts = 0;
|
|
23
|
+
while (attempts < maxAttempts) {
|
|
24
|
+
const job = await this.getFrameExtraction(frameExtractionId);
|
|
25
|
+
if (['completed', 'failed'].includes(job.status)) {
|
|
26
|
+
if (job.status === 'failed') {
|
|
27
|
+
throw new error_1.CloudGlueError(`Frame extraction job failed: ${frameExtractionId}`);
|
|
28
|
+
}
|
|
29
|
+
return job;
|
|
30
|
+
}
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, pollingInterval));
|
|
32
|
+
attempts++;
|
|
33
|
+
}
|
|
34
|
+
throw new error_1.CloudGlueError(`Frame extraction job did not complete within ${(maxAttempts * pollingInterval) / 1000} seconds: ${frameExtractionId}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.EnhancedFramesApi = EnhancedFramesApi;
|