@aviaryhq/cloudglue-js 0.2.2 → 0.2.4
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/Files.d.ts +8 -0
- package/dist/generated/Files.js +5 -0
- package/dist/src/client.d.ts +25 -22
- package/dist/src/client.js +19 -3
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -3
- package/dist/src/types.d.ts +14 -0
- package/dist/src/types.js +16 -0
- package/package.json +1 -1
|
@@ -333,6 +333,10 @@ export declare const FilesApi: import("@zodios/core").ZodiosInstance<[{
|
|
|
333
333
|
name: "sort";
|
|
334
334
|
type: "Query";
|
|
335
335
|
schema: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
336
|
+
}, {
|
|
337
|
+
name: "filter";
|
|
338
|
+
type: "Query";
|
|
339
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
336
340
|
}];
|
|
337
341
|
response: z.ZodType<FileList, z.ZodTypeDef, FileList>;
|
|
338
342
|
errors: [{
|
|
@@ -1624,6 +1628,10 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
|
|
|
1624
1628
|
name: "sort";
|
|
1625
1629
|
type: "Query";
|
|
1626
1630
|
schema: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
1631
|
+
}, {
|
|
1632
|
+
name: "filter";
|
|
1633
|
+
type: "Query";
|
|
1634
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1627
1635
|
}];
|
|
1628
1636
|
response: z.ZodType<FileList, z.ZodTypeDef, FileList>;
|
|
1629
1637
|
errors: [{
|
package/dist/generated/Files.js
CHANGED
|
@@ -147,6 +147,11 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
147
147
|
type: "Query",
|
|
148
148
|
schema: zod_1.z.enum(["asc", "desc"]).optional().default("desc"),
|
|
149
149
|
},
|
|
150
|
+
{
|
|
151
|
+
name: "filter",
|
|
152
|
+
type: "Query",
|
|
153
|
+
schema: zod_1.z.string().optional(),
|
|
154
|
+
},
|
|
150
155
|
],
|
|
151
156
|
response: FileList,
|
|
152
157
|
errors: [
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FilesApi, CollectionsApi, ChatApi, TranscribeApi, ExtractApi, SearchApi, DescribeApi } from "../generated";
|
|
2
|
+
import { FilterOperator } from "./types";
|
|
2
3
|
import type { File, SegmentationConfig, UpdateFileParams } from "./types";
|
|
3
4
|
import { SegmentationsApi } from "../generated/Segmentations";
|
|
4
5
|
import { ThumbnailsConfig } from "../generated/common";
|
|
@@ -20,7 +21,27 @@ export interface CloudGlueConfig {
|
|
|
20
21
|
*/
|
|
21
22
|
timeout?: number;
|
|
22
23
|
}
|
|
23
|
-
interface
|
|
24
|
+
export interface Filter {
|
|
25
|
+
metadata?: Array<{
|
|
26
|
+
path: string;
|
|
27
|
+
operator: FilterOperator;
|
|
28
|
+
valueText?: string;
|
|
29
|
+
valueTextArray?: string[];
|
|
30
|
+
}>;
|
|
31
|
+
video_info?: Array<{
|
|
32
|
+
path: "duration_seconds" | "has_audio";
|
|
33
|
+
operator: FilterOperator;
|
|
34
|
+
valueText?: string;
|
|
35
|
+
valueTextArray?: string[];
|
|
36
|
+
}>;
|
|
37
|
+
file?: Array<{
|
|
38
|
+
path: "bytes" | "filename" | "uri" | "created_at" | "id";
|
|
39
|
+
operator: FilterOperator;
|
|
40
|
+
valueText?: string;
|
|
41
|
+
valueTextArray?: string[];
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
export interface ListFilesParams {
|
|
24
45
|
status?: "pending" | "processing" | "completed" | "failed" | "not_applicable";
|
|
25
46
|
limit?: number;
|
|
26
47
|
offset?: number;
|
|
@@ -28,6 +49,7 @@ interface ListFilesParams {
|
|
|
28
49
|
sort?: "asc" | "desc";
|
|
29
50
|
created_before?: string;
|
|
30
51
|
created_after?: string;
|
|
52
|
+
filter?: Filter;
|
|
31
53
|
}
|
|
32
54
|
interface UploadFileParams {
|
|
33
55
|
file: globalThis.File;
|
|
@@ -139,26 +161,7 @@ interface SearchParams {
|
|
|
139
161
|
collections: string[];
|
|
140
162
|
query: string;
|
|
141
163
|
limit?: number;
|
|
142
|
-
filter?:
|
|
143
|
-
metadata?: Array<{
|
|
144
|
-
path: string;
|
|
145
|
-
operator: "NotEqual" | "Equal" | "LessThan" | "GreaterThan" | "ContainsAny" | "ContainsAll" | "In";
|
|
146
|
-
valueText?: string;
|
|
147
|
-
valueTextArray?: string[];
|
|
148
|
-
}>;
|
|
149
|
-
video_info?: Array<{
|
|
150
|
-
path: "duration_seconds" | "has_audio";
|
|
151
|
-
operator: "NotEqual" | "Equal" | "LessThan" | "GreaterThan" | "ContainsAny" | "ContainsAll" | "In";
|
|
152
|
-
valueText?: string;
|
|
153
|
-
valueTextArray?: string[];
|
|
154
|
-
}>;
|
|
155
|
-
file?: Array<{
|
|
156
|
-
path: "bytes" | "filename" | "uri" | "created_at" | "id";
|
|
157
|
-
operator: "NotEqual" | "Equal" | "LessThan" | "GreaterThan" | "ContainsAny" | "ContainsAll" | "In";
|
|
158
|
-
valueText?: string;
|
|
159
|
-
valueTextArray?: string[];
|
|
160
|
-
}>;
|
|
161
|
-
};
|
|
164
|
+
filter?: Filter;
|
|
162
165
|
}
|
|
163
166
|
interface WaitForReadyOptions {
|
|
164
167
|
/** Interval in milliseconds between polling attempts. Defaults to 5000ms (5 seconds). */
|
|
@@ -176,7 +179,7 @@ declare class EnhancedFilesApi {
|
|
|
176
179
|
limit: number;
|
|
177
180
|
offset: number;
|
|
178
181
|
}>;
|
|
179
|
-
uploadFile(params: UploadFileParams): Promise<import("axios").AxiosResponse<any, any>>;
|
|
182
|
+
uploadFile(params: UploadFileParams): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
180
183
|
getFile(fileId: string): Promise<import("zod").objectOutputType<{
|
|
181
184
|
id: import("zod").ZodString;
|
|
182
185
|
status: import("zod").ZodEnum<["pending", "processing", "completed", "failed", "not_applicable"]>;
|
package/dist/src/client.js
CHANGED
|
@@ -25,7 +25,18 @@ class EnhancedFilesApi {
|
|
|
25
25
|
this.api = api;
|
|
26
26
|
}
|
|
27
27
|
async listFiles(params = {}) {
|
|
28
|
-
|
|
28
|
+
const { filter, ...otherParams } = params;
|
|
29
|
+
// Convert filter object to JSON string if provided
|
|
30
|
+
const queries = { ...otherParams };
|
|
31
|
+
if (filter) {
|
|
32
|
+
try {
|
|
33
|
+
queries.filter = JSON.stringify(filter);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw new CloudGlueError(`Failed to serialize filter object: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return this.api.listFiles({ queries });
|
|
29
40
|
}
|
|
30
41
|
async uploadFile(params) {
|
|
31
42
|
// File uploads require special handling for multipart/form-data that the generated Zodios client doesn't handle automatically.
|
|
@@ -38,7 +49,12 @@ class EnhancedFilesApi {
|
|
|
38
49
|
formData.append("file", params.file);
|
|
39
50
|
// Add metadata if provided
|
|
40
51
|
if (params.metadata) {
|
|
41
|
-
|
|
52
|
+
try {
|
|
53
|
+
formData.append("metadata", JSON.stringify(params.metadata));
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw new CloudGlueError(`Failed to serialize metadata object: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
57
|
+
}
|
|
42
58
|
}
|
|
43
59
|
if (params.enable_segment_thumbnails !== undefined) {
|
|
44
60
|
formData.append("enable_segment_thumbnails", params.enable_segment_thumbnails.toString());
|
|
@@ -426,7 +442,7 @@ class CloudGlue {
|
|
|
426
442
|
headers: {
|
|
427
443
|
Authorization: `Bearer ${this.apiKey}`,
|
|
428
444
|
'x-sdk-client': 'cloudglue-js',
|
|
429
|
-
'x-sdk-version': '0.2.
|
|
445
|
+
'x-sdk-version': '0.2.4',
|
|
430
446
|
},
|
|
431
447
|
baseURL: this.baseUrl,
|
|
432
448
|
timeout: this.timeout,
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Main CloudGlue client class and configuration types
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export * from './client';
|
|
5
5
|
/**
|
|
6
6
|
* Generated API clients for advanced usage
|
|
7
7
|
* These provide direct access to the underlying API endpoints
|
package/dist/src/index.js
CHANGED
|
@@ -14,12 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.CloudGlue = void 0;
|
|
18
17
|
/**
|
|
19
18
|
* Main CloudGlue client class and configuration types
|
|
20
19
|
*/
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(exports, "CloudGlue", { enumerable: true, get: function () { return client_1.CloudGlue; } });
|
|
20
|
+
__exportStar(require("./client"), exports);
|
|
23
21
|
/**
|
|
24
22
|
* Generated API clients for advanced usage
|
|
25
23
|
* These provide direct access to the underlying API endpoints
|
package/dist/src/types.d.ts
CHANGED
|
@@ -11,6 +11,20 @@ import { SegmentationUniformConfig as SegmentationUniformConfigType, Segmentatio
|
|
|
11
11
|
* Contains metadata about the file including its status, size, and video information
|
|
12
12
|
*/
|
|
13
13
|
export type { File } from '../generated/common';
|
|
14
|
+
/**
|
|
15
|
+
* Filter operators for metadata, video info, and file property filtering
|
|
16
|
+
* Used across different APIs for consistent filtering behavior
|
|
17
|
+
*/
|
|
18
|
+
export declare enum FilterOperator {
|
|
19
|
+
NotEqual = "NotEqual",
|
|
20
|
+
Equal = "Equal",
|
|
21
|
+
LessThan = "LessThan",
|
|
22
|
+
GreaterThan = "GreaterThan",
|
|
23
|
+
ContainsAny = "ContainsAny",
|
|
24
|
+
ContainsAll = "ContainsAll",
|
|
25
|
+
In = "In",
|
|
26
|
+
Like = "Like"
|
|
27
|
+
}
|
|
14
28
|
/**
|
|
15
29
|
* Represents the status of a job
|
|
16
30
|
* TODO: would be better to use a common type for all jobs
|
package/dist/src/types.js
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterOperator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Filter operators for metadata, video info, and file property filtering
|
|
6
|
+
* Used across different APIs for consistent filtering behavior
|
|
7
|
+
*/
|
|
8
|
+
var FilterOperator;
|
|
9
|
+
(function (FilterOperator) {
|
|
10
|
+
FilterOperator["NotEqual"] = "NotEqual";
|
|
11
|
+
FilterOperator["Equal"] = "Equal";
|
|
12
|
+
FilterOperator["LessThan"] = "LessThan";
|
|
13
|
+
FilterOperator["GreaterThan"] = "GreaterThan";
|
|
14
|
+
FilterOperator["ContainsAny"] = "ContainsAny";
|
|
15
|
+
FilterOperator["ContainsAll"] = "ContainsAll";
|
|
16
|
+
FilterOperator["In"] = "In";
|
|
17
|
+
FilterOperator["Like"] = "Like";
|
|
18
|
+
})(FilterOperator || (exports.FilterOperator = FilterOperator = {}));
|