@aviaryhq/cloudglue-js 0.0.9

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.
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FilesApi = exports.schemas = void 0;
4
+ exports.createApiClient = createApiClient;
5
+ const core_1 = require("@zodios/core");
6
+ const zod_1 = require("zod");
7
+ const common_1 = require("./common");
8
+ const FileList = zod_1.z
9
+ .object({
10
+ object: zod_1.z.literal("list"),
11
+ data: zod_1.z.array(common_1.File),
12
+ total: zod_1.z.number().int(),
13
+ limit: zod_1.z.number().int(),
14
+ offset: zod_1.z.number().int(),
15
+ })
16
+ .strict()
17
+ .passthrough();
18
+ const FileUpload = zod_1.z
19
+ .object({
20
+ file: zod_1.z.instanceof(globalThis.File),
21
+ metadata: zod_1.z.object({}).partial().strict().passthrough().optional(),
22
+ })
23
+ .strict()
24
+ .passthrough();
25
+ const FileDelete = zod_1.z
26
+ .object({ id: zod_1.z.string(), object: zod_1.z.literal("file") })
27
+ .strict()
28
+ .passthrough();
29
+ exports.schemas = {
30
+ FileList,
31
+ FileUpload,
32
+ FileDelete,
33
+ };
34
+ const endpoints = (0, core_1.makeApi)([
35
+ {
36
+ method: "post",
37
+ path: "/files",
38
+ alias: "uploadFile",
39
+ description: `Upload a video file that can be used with CloudGlue services`,
40
+ requestFormat: "form-data",
41
+ parameters: [
42
+ {
43
+ name: "body",
44
+ description: `Upload a video file`,
45
+ type: "Body",
46
+ schema: FileUpload,
47
+ },
48
+ ],
49
+ response: common_1.File,
50
+ errors: [
51
+ {
52
+ status: 400,
53
+ description: `Invalid request, missing file, invalid metadata, or video duration exceeds limits`,
54
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
55
+ },
56
+ {
57
+ status: 415,
58
+ description: `Unsupported file type`,
59
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
60
+ },
61
+ {
62
+ status: 429,
63
+ description: `Too many requests`,
64
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
65
+ },
66
+ {
67
+ status: 500,
68
+ description: `An unexpected error occurred on the server`,
69
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
70
+ },
71
+ {
72
+ status: 509,
73
+ description: `Resource limits exceeded (monthly upload limit, total duration, file size, or total files)`,
74
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
75
+ },
76
+ ],
77
+ },
78
+ {
79
+ method: "get",
80
+ path: "/files",
81
+ alias: "listFiles",
82
+ description: `List files that have been uploaded to CloudGlue`,
83
+ requestFormat: "json",
84
+ parameters: [
85
+ {
86
+ name: "status",
87
+ type: "Query",
88
+ schema: zod_1.z
89
+ .enum([
90
+ "pending",
91
+ "processing",
92
+ "ready",
93
+ "completed",
94
+ "failed",
95
+ "not_applicable",
96
+ ])
97
+ .optional(),
98
+ },
99
+ {
100
+ name: "limit",
101
+ type: "Query",
102
+ schema: zod_1.z.number().int().lte(100).optional().default(50),
103
+ },
104
+ {
105
+ name: "offset",
106
+ type: "Query",
107
+ schema: zod_1.z.number().int().optional().default(0),
108
+ },
109
+ {
110
+ name: "order",
111
+ type: "Query",
112
+ schema: zod_1.z
113
+ .enum(["created_at", "filename"])
114
+ .optional()
115
+ .default("created_at"),
116
+ },
117
+ {
118
+ name: "sort",
119
+ type: "Query",
120
+ schema: zod_1.z.enum(["asc", "desc"]).optional().default("desc"),
121
+ },
122
+ ],
123
+ response: FileList,
124
+ errors: [
125
+ {
126
+ status: 500,
127
+ description: `An unexpected error occurred on the server`,
128
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
129
+ },
130
+ ],
131
+ },
132
+ {
133
+ method: "get",
134
+ path: "/files/:file_id",
135
+ alias: "getFile",
136
+ description: `Retrieve details about a specific file`,
137
+ requestFormat: "json",
138
+ parameters: [
139
+ {
140
+ name: "file_id",
141
+ type: "Path",
142
+ schema: zod_1.z.string(),
143
+ },
144
+ ],
145
+ response: common_1.File,
146
+ errors: [
147
+ {
148
+ status: 404,
149
+ description: `File not found`,
150
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
151
+ },
152
+ {
153
+ status: 500,
154
+ description: `An unexpected error occurred on the server`,
155
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
156
+ },
157
+ ],
158
+ },
159
+ {
160
+ method: "delete",
161
+ path: "/files/:file_id",
162
+ alias: "deleteFile",
163
+ description: `Delete a file`,
164
+ requestFormat: "json",
165
+ parameters: [
166
+ {
167
+ name: "file_id",
168
+ type: "Path",
169
+ schema: zod_1.z.string(),
170
+ },
171
+ ],
172
+ response: FileDelete,
173
+ errors: [
174
+ {
175
+ status: 404,
176
+ description: `File not found`,
177
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
178
+ },
179
+ {
180
+ status: 500,
181
+ description: `An unexpected error occurred on the server`,
182
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
183
+ },
184
+ ],
185
+ },
186
+ ]);
187
+ exports.FilesApi = new core_1.Zodios("https://api.cloudglue.dev/v1", endpoints);
188
+ function createApiClient(baseUrl, options) {
189
+ return new core_1.Zodios(baseUrl, endpoints, options);
190
+ }
@@ -0,0 +1,99 @@
1
+ import { z } from "zod";
2
+ export type File = {
3
+ id: string;
4
+ status: "pending" | "processing" | "ready" | "completed" | "failed" | "not_applicable";
5
+ bytes?: (number | null) | undefined;
6
+ created_at?: number | undefined;
7
+ filename?: string | undefined;
8
+ uri: string;
9
+ metadata?: ({} | null) | undefined;
10
+ video_info?: Partial<{
11
+ duration_seconds: number | null;
12
+ height: number | null;
13
+ width: number | null;
14
+ format: string | null;
15
+ has_audio: boolean | null;
16
+ }> | undefined;
17
+ };
18
+ export declare const File: z.ZodObject<{
19
+ id: z.ZodString;
20
+ status: z.ZodEnum<["pending", "processing", "ready", "completed", "failed", "not_applicable"]>;
21
+ bytes: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
22
+ created_at: z.ZodOptional<z.ZodNumber>;
23
+ filename: z.ZodOptional<z.ZodString>;
24
+ uri: z.ZodString;
25
+ metadata: z.ZodOptional<z.ZodUnion<[z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, z.ZodNull]>>;
26
+ video_info: z.ZodOptional<z.ZodObject<{
27
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
28
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
29
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
30
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
31
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
32
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
33
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
34
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
35
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
36
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
37
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
38
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
39
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
40
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
41
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
42
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
43
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
44
+ }, z.ZodTypeAny, "passthrough">>>;
45
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
46
+ id: z.ZodString;
47
+ status: z.ZodEnum<["pending", "processing", "ready", "completed", "failed", "not_applicable"]>;
48
+ bytes: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
49
+ created_at: z.ZodOptional<z.ZodNumber>;
50
+ filename: z.ZodOptional<z.ZodString>;
51
+ uri: z.ZodString;
52
+ metadata: z.ZodOptional<z.ZodUnion<[z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, z.ZodNull]>>;
53
+ video_info: z.ZodOptional<z.ZodObject<{
54
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
55
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
56
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
57
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
58
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
59
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
60
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
61
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
62
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
63
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
64
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
65
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
66
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
67
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
68
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
69
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
70
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
71
+ }, z.ZodTypeAny, "passthrough">>>;
72
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
73
+ id: z.ZodString;
74
+ status: z.ZodEnum<["pending", "processing", "ready", "completed", "failed", "not_applicable"]>;
75
+ bytes: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
76
+ created_at: z.ZodOptional<z.ZodNumber>;
77
+ filename: z.ZodOptional<z.ZodString>;
78
+ uri: z.ZodString;
79
+ metadata: z.ZodOptional<z.ZodUnion<[z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, z.ZodNull]>>;
80
+ video_info: z.ZodOptional<z.ZodObject<{
81
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
82
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
83
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
84
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
85
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
86
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
87
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
88
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
89
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
90
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
91
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
92
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
93
+ duration_seconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
94
+ height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
95
+ width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
96
+ format: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
97
+ has_audio: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
98
+ }, z.ZodTypeAny, "passthrough">>>;
99
+ }, z.ZodTypeAny, "passthrough">>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.File = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.File = zod_1.z
6
+ .object({
7
+ id: zod_1.z.string(),
8
+ status: zod_1.z.enum([
9
+ "pending",
10
+ "processing",
11
+ "ready",
12
+ "completed",
13
+ "failed",
14
+ "not_applicable",
15
+ ]),
16
+ bytes: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]).optional(),
17
+ created_at: zod_1.z.number().int().optional(),
18
+ filename: zod_1.z.string().optional(),
19
+ uri: zod_1.z.string(),
20
+ metadata: zod_1.z
21
+ .union([zod_1.z.object({}).partial().strict().passthrough(), zod_1.z.null()])
22
+ .optional(),
23
+ video_info: zod_1.z
24
+ .object({
25
+ duration_seconds: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]),
26
+ height: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]),
27
+ width: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]),
28
+ format: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]),
29
+ has_audio: zod_1.z.union([zod_1.z.boolean(), zod_1.z.null()]),
30
+ })
31
+ .partial()
32
+ .strict()
33
+ .passthrough()
34
+ .optional(),
35
+ })
36
+ .strict()
37
+ .passthrough();
@@ -0,0 +1,5 @@
1
+ export { ExtractApi } from "./Extract";
2
+ export { DescribeApi } from "./Describe";
3
+ export { FilesApi } from "./Files";
4
+ export { CollectionsApi } from "./Collections";
5
+ export { ChatApi } from "./Chat";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatApi = exports.CollectionsApi = exports.FilesApi = exports.DescribeApi = exports.ExtractApi = void 0;
4
+ var Extract_1 = require("./Extract");
5
+ Object.defineProperty(exports, "ExtractApi", { enumerable: true, get: function () { return Extract_1.ExtractApi; } });
6
+ var Describe_1 = require("./Describe");
7
+ Object.defineProperty(exports, "DescribeApi", { enumerable: true, get: function () { return Describe_1.DescribeApi; } });
8
+ var Files_1 = require("./Files");
9
+ Object.defineProperty(exports, "FilesApi", { enumerable: true, get: function () { return Files_1.FilesApi; } });
10
+ var Collections_1 = require("./Collections");
11
+ Object.defineProperty(exports, "CollectionsApi", { enumerable: true, get: function () { return Collections_1.CollectionsApi; } });
12
+ var Chat_1 = require("./Chat");
13
+ Object.defineProperty(exports, "ChatApi", { enumerable: true, get: function () { return Chat_1.ChatApi; } });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Main CloudGlue client class and configuration types
3
+ */
4
+ export { CloudGlue, type CloudGlueConfig, type CloudGlueError } from './client';
5
+ /**
6
+ * Generated API clients for advanced usage
7
+ * These provide direct access to the underlying API endpoints
8
+ */
9
+ export { FilesApi, CollectionsApi, ChatApi, DescribeApi, ExtractApi } from '../generated';
10
+ /**
11
+ * Common type definitions used throughout the SDK
12
+ */
13
+ export type { File, Collection, CollectionFile, CollectionFileList, ChatMessage, ChatCompletionResponse, Describe, Extract, DescriptionSegment, CollectionVideoDescription, EntitySegment, CollectionVideoEntities, NewCollectionParams, } from './types';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtractApi = exports.DescribeApi = exports.ChatApi = exports.CollectionsApi = exports.FilesApi = exports.CloudGlue = void 0;
4
+ /**
5
+ * Main CloudGlue client class and configuration types
6
+ */
7
+ var client_1 = require("./client");
8
+ Object.defineProperty(exports, "CloudGlue", { enumerable: true, get: function () { return client_1.CloudGlue; } });
9
+ /**
10
+ * Generated API clients for advanced usage
11
+ * These provide direct access to the underlying API endpoints
12
+ */
13
+ var generated_1 = require("../generated");
14
+ Object.defineProperty(exports, "FilesApi", { enumerable: true, get: function () { return generated_1.FilesApi; } });
15
+ Object.defineProperty(exports, "CollectionsApi", { enumerable: true, get: function () { return generated_1.CollectionsApi; } });
16
+ Object.defineProperty(exports, "ChatApi", { enumerable: true, get: function () { return generated_1.ChatApi; } });
17
+ Object.defineProperty(exports, "DescribeApi", { enumerable: true, get: function () { return generated_1.DescribeApi; } });
18
+ Object.defineProperty(exports, "ExtractApi", { enumerable: true, get: function () { return generated_1.ExtractApi; } });