@comfyorg/sdk 0.1.0
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/README.md +236 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +27 -0
- package/dist/low/errors.d.ts +73 -0
- package/dist/low/errors.js +104 -0
- package/dist/low/generated/index.d.ts +1 -0
- package/dist/low/generated/index.js +2 -0
- package/dist/low/generated/types.gen.d.ts +528 -0
- package/dist/low/generated/types.gen.js +2 -0
- package/dist/low/generated/zod.gen.d.ts +455 -0
- package/dist/low/generated/zod.gen.js +204 -0
- package/dist/low/index.d.ts +21 -0
- package/dist/low/index.js +21 -0
- package/dist/low/models.d.ts +47 -0
- package/dist/low/models.js +16 -0
- package/dist/low/sse.d.ts +24 -0
- package/dist/low/sse.js +44 -0
- package/dist/low/transport.d.ts +128 -0
- package/dist/low/transport.js +285 -0
- package/dist/sdk/abortable-sleep.d.ts +13 -0
- package/dist/sdk/abortable-sleep.js +31 -0
- package/dist/sdk/assets.d.ts +74 -0
- package/dist/sdk/assets.js +200 -0
- package/dist/sdk/client.d.ts +70 -0
- package/dist/sdk/client.js +120 -0
- package/dist/sdk/core.d.ts +33 -0
- package/dist/sdk/core.js +89 -0
- package/dist/sdk/events.d.ts +60 -0
- package/dist/sdk/events.js +84 -0
- package/dist/sdk/exceptions.d.ts +79 -0
- package/dist/sdk/exceptions.js +114 -0
- package/dist/sdk/hashing.d.ts +14 -0
- package/dist/sdk/hashing.js +28 -0
- package/dist/sdk/index.d.ts +13 -0
- package/dist/sdk/index.js +12 -0
- package/dist/sdk/jobs.d.ts +47 -0
- package/dist/sdk/jobs.js +145 -0
- package/dist/sdk/outputs.d.ts +26 -0
- package/dist/sdk/outputs.js +48 -0
- package/dist/sdk/workflows.d.ts +32 -0
- package/dist/sdk/workflows.js +45 -0
- package/package.json +52 -0
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A user-owned record identified by a server-assigned UUID, backing an immutable blob whose content carries a server-computed blake3 hash. `hash` may be computed lazily: an asset record (and its retrievable bytes) can exist before its hash is filled in.
|
|
4
|
+
*/
|
|
5
|
+
export declare const zAsset: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
8
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
9
|
+
content_type: z.ZodString;
|
|
10
|
+
file_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
created_new: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
created_at: z.ZodISODateTime;
|
|
13
|
+
url: z.ZodURL;
|
|
14
|
+
url_expires_at: z.ZodISODateTime;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/**
|
|
17
|
+
* Lifecycle: queued → running → succeeded | failed | expired;
|
|
18
|
+
* a cancel request moves running → canceling → canceled.
|
|
19
|
+
* Terminal states: succeeded, canceled, failed, expired.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export declare const zJobStatus: z.ZodEnum<{
|
|
23
|
+
queued: "queued";
|
|
24
|
+
running: "running";
|
|
25
|
+
succeeded: "succeeded";
|
|
26
|
+
canceling: "canceling";
|
|
27
|
+
canceled: "canceled";
|
|
28
|
+
failed: "failed";
|
|
29
|
+
expired: "expired";
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Embedded follow-up links — follow these, don't build URLs.
|
|
33
|
+
*/
|
|
34
|
+
export declare const zJobUrls: z.ZodObject<{
|
|
35
|
+
self: z.ZodString;
|
|
36
|
+
events: z.ZodString;
|
|
37
|
+
cancel: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Server-computed progress snapshot (node-count and sampler-step weighted). Complete per snapshot — one fully re-syncs a client.
|
|
41
|
+
*/
|
|
42
|
+
export declare const zProgress: z.ZodObject<{
|
|
43
|
+
value: z.ZodNumber;
|
|
44
|
+
nodes_done: z.ZodInt;
|
|
45
|
+
nodes_total: z.ZodInt;
|
|
46
|
+
current_node: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
current_node_class: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
49
|
+
steps: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
50
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
/**
|
|
53
|
+
* Normalized output kind — nothing silently dropped.
|
|
54
|
+
*/
|
|
55
|
+
export declare const zOutputType: z.ZodEnum<{
|
|
56
|
+
image: "image";
|
|
57
|
+
video: "video";
|
|
58
|
+
audio: "audio";
|
|
59
|
+
text: "text";
|
|
60
|
+
file: "file";
|
|
61
|
+
latent: "latent";
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* A committed job output. Outputs are assets: `id` is the asset UUID, retrievable via GET /api/v2/assets/{id} for as long as the job is retained. `hash` is lazily computed and may be null on the retrieval hot path.
|
|
65
|
+
*/
|
|
66
|
+
export declare const zOutput: z.ZodObject<{
|
|
67
|
+
node_id: z.ZodString;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
type: z.ZodEnum<{
|
|
70
|
+
image: "image";
|
|
71
|
+
video: "video";
|
|
72
|
+
audio: "audio";
|
|
73
|
+
text: "text";
|
|
74
|
+
file: "file";
|
|
75
|
+
latent: "latent";
|
|
76
|
+
}>;
|
|
77
|
+
content_type: z.ZodString;
|
|
78
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
81
|
+
url: z.ZodURL;
|
|
82
|
+
url_expires_at: z.ZodISODateTime;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
/**
|
|
85
|
+
* Execution failure detail, carried in `job.error` (not an HTTP error).
|
|
86
|
+
*/
|
|
87
|
+
export declare const zJobError: z.ZodObject<{
|
|
88
|
+
code: z.ZodString;
|
|
89
|
+
message: z.ZodString;
|
|
90
|
+
node_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
class_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
traceback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
/**
|
|
95
|
+
* One execution of a workflow. Durable from creation until `expires_at`; `outputs` populates incrementally during execution.
|
|
96
|
+
*/
|
|
97
|
+
export declare const zJob: z.ZodObject<{
|
|
98
|
+
id: z.ZodString;
|
|
99
|
+
status: z.ZodEnum<{
|
|
100
|
+
queued: "queued";
|
|
101
|
+
running: "running";
|
|
102
|
+
succeeded: "succeeded";
|
|
103
|
+
canceling: "canceling";
|
|
104
|
+
canceled: "canceled";
|
|
105
|
+
failed: "failed";
|
|
106
|
+
expired: "expired";
|
|
107
|
+
}>;
|
|
108
|
+
created_at: z.ZodISODateTime;
|
|
109
|
+
started_at: z.ZodNullable<z.ZodISODateTime>;
|
|
110
|
+
completed_at: z.ZodNullable<z.ZodISODateTime>;
|
|
111
|
+
expires_at: z.ZodISODateTime;
|
|
112
|
+
queue_position: z.ZodNullable<z.ZodInt>;
|
|
113
|
+
progress: z.ZodNullable<z.ZodObject<{
|
|
114
|
+
value: z.ZodNumber;
|
|
115
|
+
nodes_done: z.ZodInt;
|
|
116
|
+
nodes_total: z.ZodInt;
|
|
117
|
+
current_node: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
current_node_class: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
119
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
120
|
+
steps: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
121
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
124
|
+
node_id: z.ZodString;
|
|
125
|
+
name: z.ZodString;
|
|
126
|
+
type: z.ZodEnum<{
|
|
127
|
+
image: "image";
|
|
128
|
+
video: "video";
|
|
129
|
+
audio: "audio";
|
|
130
|
+
text: "text";
|
|
131
|
+
file: "file";
|
|
132
|
+
latent: "latent";
|
|
133
|
+
}>;
|
|
134
|
+
content_type: z.ZodString;
|
|
135
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
136
|
+
id: z.ZodString;
|
|
137
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
138
|
+
url: z.ZodURL;
|
|
139
|
+
url_expires_at: z.ZodISODateTime;
|
|
140
|
+
}, z.core.$strip>>;
|
|
141
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
142
|
+
code: z.ZodString;
|
|
143
|
+
message: z.ZodString;
|
|
144
|
+
node_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
class_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
traceback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
147
|
+
}, z.core.$strip>>;
|
|
148
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodInt>>>;
|
|
149
|
+
urls: z.ZodObject<{
|
|
150
|
+
self: z.ZodString;
|
|
151
|
+
events: z.ZodString;
|
|
152
|
+
cancel: z.ZodString;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
/**
|
|
156
|
+
* Shared error envelope with machine-readable codes. Core codes (v1):
|
|
157
|
+
* `invalid_workflow` (422), `workflow_format_ui` (422),
|
|
158
|
+
* `missing_asset` (422), `hash_mismatch` (409), `blob_not_found`
|
|
159
|
+
* (404), `idempotency_key_reuse` (422),
|
|
160
|
+
* `queue_full` (429 + Retry-After), `insufficient_credits` (402),
|
|
161
|
+
* `not_found` (404), `unauthorized` (401), `forbidden` (403).
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
export declare const zErrorEnvelope: z.ZodObject<{
|
|
165
|
+
error: z.ZodObject<{
|
|
166
|
+
code: z.ZodString;
|
|
167
|
+
message: z.ZodString;
|
|
168
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
/**
|
|
172
|
+
* Client-generated UUID (recommended). Single-use: the first request to present a key is processed; any later request with the same key is rejected `422` `idempotency_key_reuse` (reject-on-duplicate, no response replay). Keys expire after 24h.
|
|
173
|
+
*/
|
|
174
|
+
export declare const zIdempotencyKey: z.ZodString;
|
|
175
|
+
export declare const zJobId: z.ZodString;
|
|
176
|
+
export declare const zAssetId: z.ZodString;
|
|
177
|
+
/**
|
|
178
|
+
* Content hash, written `blake3:<hex>`.
|
|
179
|
+
*/
|
|
180
|
+
export declare const zBlakeHash: z.ZodString;
|
|
181
|
+
export declare const zPostAssetsBody: z.ZodObject<{
|
|
182
|
+
file: z.ZodString;
|
|
183
|
+
content_type: z.ZodString;
|
|
184
|
+
file_path: z.ZodString;
|
|
185
|
+
expected_hash: z.ZodOptional<z.ZodString>;
|
|
186
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
+
}, z.core.$strip>;
|
|
188
|
+
export declare const zPostAssetsHeaders: z.ZodObject<{
|
|
189
|
+
'Idempotency-Key': z.ZodOptional<z.ZodString>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
/**
|
|
192
|
+
* Bytes deduped to an existing blob; asset minted over it.
|
|
193
|
+
*/
|
|
194
|
+
export declare const zPostAssetsResponse: z.ZodObject<{
|
|
195
|
+
id: z.ZodString;
|
|
196
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
197
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
198
|
+
content_type: z.ZodString;
|
|
199
|
+
file_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
|
+
created_new: z.ZodOptional<z.ZodBoolean>;
|
|
201
|
+
created_at: z.ZodISODateTime;
|
|
202
|
+
url: z.ZodURL;
|
|
203
|
+
url_expires_at: z.ZodISODateTime;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
export declare const zAssetFromHashBody: z.ZodObject<{
|
|
206
|
+
hash: z.ZodString;
|
|
207
|
+
file_path: z.ZodOptional<z.ZodString>;
|
|
208
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
/**
|
|
211
|
+
* An identical reference already existed; returned as-is.
|
|
212
|
+
*/
|
|
213
|
+
export declare const zAssetFromHashResponse: z.ZodObject<{
|
|
214
|
+
id: z.ZodString;
|
|
215
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
216
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
217
|
+
content_type: z.ZodString;
|
|
218
|
+
file_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
219
|
+
created_new: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
created_at: z.ZodISODateTime;
|
|
221
|
+
url: z.ZodURL;
|
|
222
|
+
url_expires_at: z.ZodISODateTime;
|
|
223
|
+
}, z.core.$strip>;
|
|
224
|
+
export declare const zHeadAssetByHashPath: z.ZodObject<{
|
|
225
|
+
hash: z.ZodString;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
export declare const zGetAssetPath: z.ZodObject<{
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
}, z.core.$strip>;
|
|
230
|
+
/**
|
|
231
|
+
* The asset.
|
|
232
|
+
*/
|
|
233
|
+
export declare const zGetAssetResponse: z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
236
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
237
|
+
content_type: z.ZodString;
|
|
238
|
+
file_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
|
+
created_new: z.ZodOptional<z.ZodBoolean>;
|
|
240
|
+
created_at: z.ZodISODateTime;
|
|
241
|
+
url: z.ZodURL;
|
|
242
|
+
url_expires_at: z.ZodISODateTime;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
export declare const zGetAssetContentHeaders: z.ZodObject<{
|
|
245
|
+
Range: z.ZodOptional<z.ZodString>;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
export declare const zGetAssetContentPath: z.ZodObject<{
|
|
248
|
+
id: z.ZodString;
|
|
249
|
+
}, z.core.$strip>;
|
|
250
|
+
/**
|
|
251
|
+
* The full content.
|
|
252
|
+
*/
|
|
253
|
+
export declare const zGetAssetContentResponse: z.ZodString;
|
|
254
|
+
export declare const zPostJobsBody: z.ZodObject<{
|
|
255
|
+
workflow: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
|
+
export declare const zPostJobsHeaders: z.ZodObject<{
|
|
258
|
+
'Idempotency-Key': z.ZodOptional<z.ZodString>;
|
|
259
|
+
}, z.core.$strip>;
|
|
260
|
+
/**
|
|
261
|
+
* Job created and queued.
|
|
262
|
+
*/
|
|
263
|
+
export declare const zPostJobsResponse: z.ZodObject<{
|
|
264
|
+
id: z.ZodString;
|
|
265
|
+
status: z.ZodEnum<{
|
|
266
|
+
queued: "queued";
|
|
267
|
+
running: "running";
|
|
268
|
+
succeeded: "succeeded";
|
|
269
|
+
canceling: "canceling";
|
|
270
|
+
canceled: "canceled";
|
|
271
|
+
failed: "failed";
|
|
272
|
+
expired: "expired";
|
|
273
|
+
}>;
|
|
274
|
+
created_at: z.ZodISODateTime;
|
|
275
|
+
started_at: z.ZodNullable<z.ZodISODateTime>;
|
|
276
|
+
completed_at: z.ZodNullable<z.ZodISODateTime>;
|
|
277
|
+
expires_at: z.ZodISODateTime;
|
|
278
|
+
queue_position: z.ZodNullable<z.ZodInt>;
|
|
279
|
+
progress: z.ZodNullable<z.ZodObject<{
|
|
280
|
+
value: z.ZodNumber;
|
|
281
|
+
nodes_done: z.ZodInt;
|
|
282
|
+
nodes_total: z.ZodInt;
|
|
283
|
+
current_node: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
284
|
+
current_node_class: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
285
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
286
|
+
steps: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
287
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
288
|
+
}, z.core.$strip>>;
|
|
289
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
290
|
+
node_id: z.ZodString;
|
|
291
|
+
name: z.ZodString;
|
|
292
|
+
type: z.ZodEnum<{
|
|
293
|
+
image: "image";
|
|
294
|
+
video: "video";
|
|
295
|
+
audio: "audio";
|
|
296
|
+
text: "text";
|
|
297
|
+
file: "file";
|
|
298
|
+
latent: "latent";
|
|
299
|
+
}>;
|
|
300
|
+
content_type: z.ZodString;
|
|
301
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
302
|
+
id: z.ZodString;
|
|
303
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
304
|
+
url: z.ZodURL;
|
|
305
|
+
url_expires_at: z.ZodISODateTime;
|
|
306
|
+
}, z.core.$strip>>;
|
|
307
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
308
|
+
code: z.ZodString;
|
|
309
|
+
message: z.ZodString;
|
|
310
|
+
node_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
311
|
+
class_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
312
|
+
traceback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
313
|
+
}, z.core.$strip>>;
|
|
314
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodInt>>>;
|
|
315
|
+
urls: z.ZodObject<{
|
|
316
|
+
self: z.ZodString;
|
|
317
|
+
events: z.ZodString;
|
|
318
|
+
cancel: z.ZodString;
|
|
319
|
+
}, z.core.$strip>;
|
|
320
|
+
}, z.core.$strip>;
|
|
321
|
+
export declare const zGetJobPath: z.ZodObject<{
|
|
322
|
+
id: z.ZodString;
|
|
323
|
+
}, z.core.$strip>;
|
|
324
|
+
/**
|
|
325
|
+
* The job.
|
|
326
|
+
*/
|
|
327
|
+
export declare const zGetJobResponse: z.ZodObject<{
|
|
328
|
+
id: z.ZodString;
|
|
329
|
+
status: z.ZodEnum<{
|
|
330
|
+
queued: "queued";
|
|
331
|
+
running: "running";
|
|
332
|
+
succeeded: "succeeded";
|
|
333
|
+
canceling: "canceling";
|
|
334
|
+
canceled: "canceled";
|
|
335
|
+
failed: "failed";
|
|
336
|
+
expired: "expired";
|
|
337
|
+
}>;
|
|
338
|
+
created_at: z.ZodISODateTime;
|
|
339
|
+
started_at: z.ZodNullable<z.ZodISODateTime>;
|
|
340
|
+
completed_at: z.ZodNullable<z.ZodISODateTime>;
|
|
341
|
+
expires_at: z.ZodISODateTime;
|
|
342
|
+
queue_position: z.ZodNullable<z.ZodInt>;
|
|
343
|
+
progress: z.ZodNullable<z.ZodObject<{
|
|
344
|
+
value: z.ZodNumber;
|
|
345
|
+
nodes_done: z.ZodInt;
|
|
346
|
+
nodes_total: z.ZodInt;
|
|
347
|
+
current_node: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
348
|
+
current_node_class: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
349
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
350
|
+
steps: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
351
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
352
|
+
}, z.core.$strip>>;
|
|
353
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
354
|
+
node_id: z.ZodString;
|
|
355
|
+
name: z.ZodString;
|
|
356
|
+
type: z.ZodEnum<{
|
|
357
|
+
image: "image";
|
|
358
|
+
video: "video";
|
|
359
|
+
audio: "audio";
|
|
360
|
+
text: "text";
|
|
361
|
+
file: "file";
|
|
362
|
+
latent: "latent";
|
|
363
|
+
}>;
|
|
364
|
+
content_type: z.ZodString;
|
|
365
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
366
|
+
id: z.ZodString;
|
|
367
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
368
|
+
url: z.ZodURL;
|
|
369
|
+
url_expires_at: z.ZodISODateTime;
|
|
370
|
+
}, z.core.$strip>>;
|
|
371
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
372
|
+
code: z.ZodString;
|
|
373
|
+
message: z.ZodString;
|
|
374
|
+
node_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
375
|
+
class_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
376
|
+
traceback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
377
|
+
}, z.core.$strip>>;
|
|
378
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodInt>>>;
|
|
379
|
+
urls: z.ZodObject<{
|
|
380
|
+
self: z.ZodString;
|
|
381
|
+
events: z.ZodString;
|
|
382
|
+
cancel: z.ZodString;
|
|
383
|
+
}, z.core.$strip>;
|
|
384
|
+
}, z.core.$strip>;
|
|
385
|
+
export declare const zGetJobEventsPath: z.ZodObject<{
|
|
386
|
+
id: z.ZodString;
|
|
387
|
+
}, z.core.$strip>;
|
|
388
|
+
/**
|
|
389
|
+
* Stream of `event:`/`data:` frames. Data payloads are the JSON schemas listed in x-sse-events.
|
|
390
|
+
*/
|
|
391
|
+
export declare const zGetJobEventsResponse: z.ZodString;
|
|
392
|
+
export declare const zCancelJobPath: z.ZodObject<{
|
|
393
|
+
id: z.ZodString;
|
|
394
|
+
}, z.core.$strip>;
|
|
395
|
+
/**
|
|
396
|
+
* Current job state.
|
|
397
|
+
*/
|
|
398
|
+
export declare const zCancelJobResponse: z.ZodObject<{
|
|
399
|
+
id: z.ZodString;
|
|
400
|
+
status: z.ZodEnum<{
|
|
401
|
+
queued: "queued";
|
|
402
|
+
running: "running";
|
|
403
|
+
succeeded: "succeeded";
|
|
404
|
+
canceling: "canceling";
|
|
405
|
+
canceled: "canceled";
|
|
406
|
+
failed: "failed";
|
|
407
|
+
expired: "expired";
|
|
408
|
+
}>;
|
|
409
|
+
created_at: z.ZodISODateTime;
|
|
410
|
+
started_at: z.ZodNullable<z.ZodISODateTime>;
|
|
411
|
+
completed_at: z.ZodNullable<z.ZodISODateTime>;
|
|
412
|
+
expires_at: z.ZodISODateTime;
|
|
413
|
+
queue_position: z.ZodNullable<z.ZodInt>;
|
|
414
|
+
progress: z.ZodNullable<z.ZodObject<{
|
|
415
|
+
value: z.ZodNumber;
|
|
416
|
+
nodes_done: z.ZodInt;
|
|
417
|
+
nodes_total: z.ZodInt;
|
|
418
|
+
current_node: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
419
|
+
current_node_class: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
420
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
421
|
+
steps: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
422
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
423
|
+
}, z.core.$strip>>;
|
|
424
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
425
|
+
node_id: z.ZodString;
|
|
426
|
+
name: z.ZodString;
|
|
427
|
+
type: z.ZodEnum<{
|
|
428
|
+
image: "image";
|
|
429
|
+
video: "video";
|
|
430
|
+
audio: "audio";
|
|
431
|
+
text: "text";
|
|
432
|
+
file: "file";
|
|
433
|
+
latent: "latent";
|
|
434
|
+
}>;
|
|
435
|
+
content_type: z.ZodString;
|
|
436
|
+
size_bytes: z.ZodCoercedBigInt<unknown>;
|
|
437
|
+
id: z.ZodString;
|
|
438
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
439
|
+
url: z.ZodURL;
|
|
440
|
+
url_expires_at: z.ZodISODateTime;
|
|
441
|
+
}, z.core.$strip>>;
|
|
442
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
443
|
+
code: z.ZodString;
|
|
444
|
+
message: z.ZodString;
|
|
445
|
+
node_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
446
|
+
class_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
447
|
+
traceback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
448
|
+
}, z.core.$strip>>;
|
|
449
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodInt>>>;
|
|
450
|
+
urls: z.ZodObject<{
|
|
451
|
+
self: z.ZodString;
|
|
452
|
+
events: z.ZodString;
|
|
453
|
+
cancel: z.ZodString;
|
|
454
|
+
}, z.core.$strip>;
|
|
455
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* A user-owned record identified by a server-assigned UUID, backing an immutable blob whose content carries a server-computed blake3 hash. `hash` may be computed lazily: an asset record (and its retrievable bytes) can exist before its hash is filled in.
|
|
5
|
+
*/
|
|
6
|
+
export const zAsset = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
hash: z.string().nullable(),
|
|
9
|
+
size_bytes: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
10
|
+
content_type: z.string(),
|
|
11
|
+
file_path: z.string().nullish(),
|
|
12
|
+
created_new: z.boolean().optional(),
|
|
13
|
+
created_at: z.iso.datetime(),
|
|
14
|
+
url: z.url(),
|
|
15
|
+
url_expires_at: z.iso.datetime()
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Lifecycle: queued → running → succeeded | failed | expired;
|
|
19
|
+
* a cancel request moves running → canceling → canceled.
|
|
20
|
+
* Terminal states: succeeded, canceled, failed, expired.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export const zJobStatus = z.enum([
|
|
24
|
+
'queued',
|
|
25
|
+
'running',
|
|
26
|
+
'succeeded',
|
|
27
|
+
'canceling',
|
|
28
|
+
'canceled',
|
|
29
|
+
'failed',
|
|
30
|
+
'expired'
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* Embedded follow-up links — follow these, don't build URLs.
|
|
34
|
+
*/
|
|
35
|
+
export const zJobUrls = z.object({
|
|
36
|
+
self: z.string(),
|
|
37
|
+
events: z.string(),
|
|
38
|
+
cancel: z.string()
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Server-computed progress snapshot (node-count and sampler-step weighted). Complete per snapshot — one fully re-syncs a client.
|
|
42
|
+
*/
|
|
43
|
+
export const zProgress = z.object({
|
|
44
|
+
value: z.number().gte(0).lte(1),
|
|
45
|
+
nodes_done: z.int(),
|
|
46
|
+
nodes_total: z.int(),
|
|
47
|
+
current_node: z.string().nullish(),
|
|
48
|
+
current_node_class: z.string().nullish(),
|
|
49
|
+
step: z.int().nullish(),
|
|
50
|
+
steps: z.int().nullish(),
|
|
51
|
+
message: z.string().nullish()
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Normalized output kind — nothing silently dropped.
|
|
55
|
+
*/
|
|
56
|
+
export const zOutputType = z.enum([
|
|
57
|
+
'image',
|
|
58
|
+
'video',
|
|
59
|
+
'audio',
|
|
60
|
+
'text',
|
|
61
|
+
'file',
|
|
62
|
+
'latent'
|
|
63
|
+
]);
|
|
64
|
+
/**
|
|
65
|
+
* A committed job output. Outputs are assets: `id` is the asset UUID, retrievable via GET /api/v2/assets/{id} for as long as the job is retained. `hash` is lazily computed and may be null on the retrieval hot path.
|
|
66
|
+
*/
|
|
67
|
+
export const zOutput = z.object({
|
|
68
|
+
node_id: z.string(),
|
|
69
|
+
name: z.string(),
|
|
70
|
+
type: zOutputType,
|
|
71
|
+
content_type: z.string(),
|
|
72
|
+
size_bytes: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
73
|
+
id: z.string(),
|
|
74
|
+
hash: z.string().nullable(),
|
|
75
|
+
url: z.url(),
|
|
76
|
+
url_expires_at: z.iso.datetime()
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Execution failure detail, carried in `job.error` (not an HTTP error).
|
|
80
|
+
*/
|
|
81
|
+
export const zJobError = z.object({
|
|
82
|
+
code: z.string(),
|
|
83
|
+
message: z.string(),
|
|
84
|
+
node_id: z.string().nullish(),
|
|
85
|
+
class_type: z.string().nullish(),
|
|
86
|
+
traceback: z.string().nullish()
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* One execution of a workflow. Durable from creation until `expires_at`; `outputs` populates incrementally during execution.
|
|
90
|
+
*/
|
|
91
|
+
export const zJob = z.object({
|
|
92
|
+
id: z.string(),
|
|
93
|
+
status: zJobStatus,
|
|
94
|
+
created_at: z.iso.datetime(),
|
|
95
|
+
started_at: z.iso.datetime().nullable(),
|
|
96
|
+
completed_at: z.iso.datetime().nullable(),
|
|
97
|
+
expires_at: z.iso.datetime(),
|
|
98
|
+
queue_position: z.int().nullable(),
|
|
99
|
+
progress: zProgress.nullable(),
|
|
100
|
+
outputs: z.array(zOutput),
|
|
101
|
+
error: zJobError.nullable(),
|
|
102
|
+
metrics: z.record(z.string(), z.int().nullable()).optional(),
|
|
103
|
+
urls: zJobUrls
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Shared error envelope with machine-readable codes. Core codes (v1):
|
|
107
|
+
* `invalid_workflow` (422), `workflow_format_ui` (422),
|
|
108
|
+
* `missing_asset` (422), `hash_mismatch` (409), `blob_not_found`
|
|
109
|
+
* (404), `idempotency_key_reuse` (422),
|
|
110
|
+
* `queue_full` (429 + Retry-After), `insufficient_credits` (402),
|
|
111
|
+
* `not_found` (404), `unauthorized` (401), `forbidden` (403).
|
|
112
|
+
*
|
|
113
|
+
*/
|
|
114
|
+
export const zErrorEnvelope = z.object({
|
|
115
|
+
error: z.object({
|
|
116
|
+
code: z.string(),
|
|
117
|
+
message: z.string(),
|
|
118
|
+
details: z.record(z.string(), z.unknown()).nullish()
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* Client-generated UUID (recommended). Single-use: the first request to present a key is processed; any later request with the same key is rejected `422` `idempotency_key_reuse` (reject-on-duplicate, no response replay). Keys expire after 24h.
|
|
123
|
+
*/
|
|
124
|
+
export const zIdempotencyKey = z.string();
|
|
125
|
+
export const zJobId = z.string();
|
|
126
|
+
export const zAssetId = z.string();
|
|
127
|
+
/**
|
|
128
|
+
* Content hash, written `blake3:<hex>`.
|
|
129
|
+
*/
|
|
130
|
+
export const zBlakeHash = z.string();
|
|
131
|
+
export const zPostAssetsBody = z.object({
|
|
132
|
+
file: z.string(),
|
|
133
|
+
content_type: z.string(),
|
|
134
|
+
file_path: z.string(),
|
|
135
|
+
expected_hash: z.string().optional(),
|
|
136
|
+
tags: z.array(z.string()).optional()
|
|
137
|
+
});
|
|
138
|
+
export const zPostAssetsHeaders = z.object({
|
|
139
|
+
'Idempotency-Key': z.string().optional()
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* Bytes deduped to an existing blob; asset minted over it.
|
|
143
|
+
*/
|
|
144
|
+
export const zPostAssetsResponse = zAsset;
|
|
145
|
+
export const zAssetFromHashBody = z.object({
|
|
146
|
+
hash: z.string(),
|
|
147
|
+
file_path: z.string().optional(),
|
|
148
|
+
tags: z.array(z.string()).optional()
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* An identical reference already existed; returned as-is.
|
|
152
|
+
*/
|
|
153
|
+
export const zAssetFromHashResponse = zAsset;
|
|
154
|
+
export const zHeadAssetByHashPath = z.object({
|
|
155
|
+
hash: z.string()
|
|
156
|
+
});
|
|
157
|
+
export const zGetAssetPath = z.object({
|
|
158
|
+
id: z.string()
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* The asset.
|
|
162
|
+
*/
|
|
163
|
+
export const zGetAssetResponse = zAsset;
|
|
164
|
+
export const zGetAssetContentHeaders = z.object({
|
|
165
|
+
Range: z.string().optional()
|
|
166
|
+
});
|
|
167
|
+
export const zGetAssetContentPath = z.object({
|
|
168
|
+
id: z.string()
|
|
169
|
+
});
|
|
170
|
+
/**
|
|
171
|
+
* The full content.
|
|
172
|
+
*/
|
|
173
|
+
export const zGetAssetContentResponse = z.string();
|
|
174
|
+
export const zPostJobsBody = z.object({
|
|
175
|
+
workflow: z.record(z.string(), z.unknown())
|
|
176
|
+
});
|
|
177
|
+
export const zPostJobsHeaders = z.object({
|
|
178
|
+
'Idempotency-Key': z.string().optional()
|
|
179
|
+
});
|
|
180
|
+
/**
|
|
181
|
+
* Job created and queued.
|
|
182
|
+
*/
|
|
183
|
+
export const zPostJobsResponse = zJob;
|
|
184
|
+
export const zGetJobPath = z.object({
|
|
185
|
+
id: z.string()
|
|
186
|
+
});
|
|
187
|
+
/**
|
|
188
|
+
* The job.
|
|
189
|
+
*/
|
|
190
|
+
export const zGetJobResponse = zJob;
|
|
191
|
+
export const zGetJobEventsPath = z.object({
|
|
192
|
+
id: z.string()
|
|
193
|
+
});
|
|
194
|
+
/**
|
|
195
|
+
* Stream of `event:`/`data:` frames. Data payloads are the JSON schemas listed in x-sse-events.
|
|
196
|
+
*/
|
|
197
|
+
export const zGetJobEventsResponse = z.string();
|
|
198
|
+
export const zCancelJobPath = z.object({
|
|
199
|
+
id: z.string()
|
|
200
|
+
});
|
|
201
|
+
/**
|
|
202
|
+
* Current job state.
|
|
203
|
+
*/
|
|
204
|
+
export const zCancelJobResponse = zJob;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `low` — generated types/validators + thin hand-written transport for
|
|
3
|
+
* Comfy API v2. Mirrors the two-part split of `comfy_low` in the Python
|
|
4
|
+
* SDK:
|
|
5
|
+
*
|
|
6
|
+
* - generated (`./generated/types.gen.ts`, `./generated/zod.gen.ts`) —
|
|
7
|
+
* TypeScript types and Zod schemas produced by `@hey-api/openapi-ts` from
|
|
8
|
+
* `spec/openapi.yaml` (`pnpm generate`; do not hand-edit).
|
|
9
|
+
* - hand-written (`./transport.ts`, `./errors.ts`, `./sse.ts`, `./models.ts`)
|
|
10
|
+
* — the transport and the handful of schemas codegen can't reach (see
|
|
11
|
+
* `./models.ts`).
|
|
12
|
+
*
|
|
13
|
+
* This layer is deliberately boring: no orchestration, retries, hashing, or
|
|
14
|
+
* SSE reconnection. Those live in `../sdk`.
|
|
15
|
+
*/
|
|
16
|
+
export * from "./generated/types.gen.js";
|
|
17
|
+
export * as schemas from "./generated/zod.gen.js";
|
|
18
|
+
export * from "./models.js";
|
|
19
|
+
export * from "./errors.js";
|
|
20
|
+
export { type RawEvent, iterateSse } from "./sse.js";
|
|
21
|
+
export { ComfyLow, OPERATION_IDS, OPERATION_METHODS, type ComfyLowOptions, type RequestOptions, } from "./transport.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `low` — generated types/validators + thin hand-written transport for
|
|
3
|
+
* Comfy API v2. Mirrors the two-part split of `comfy_low` in the Python
|
|
4
|
+
* SDK:
|
|
5
|
+
*
|
|
6
|
+
* - generated (`./generated/types.gen.ts`, `./generated/zod.gen.ts`) —
|
|
7
|
+
* TypeScript types and Zod schemas produced by `@hey-api/openapi-ts` from
|
|
8
|
+
* `spec/openapi.yaml` (`pnpm generate`; do not hand-edit).
|
|
9
|
+
* - hand-written (`./transport.ts`, `./errors.ts`, `./sse.ts`, `./models.ts`)
|
|
10
|
+
* — the transport and the handful of schemas codegen can't reach (see
|
|
11
|
+
* `./models.ts`).
|
|
12
|
+
*
|
|
13
|
+
* This layer is deliberately boring: no orchestration, retries, hashing, or
|
|
14
|
+
* SSE reconnection. Those live in `../sdk`.
|
|
15
|
+
*/
|
|
16
|
+
export * from "./generated/types.gen.js";
|
|
17
|
+
export * as schemas from "./generated/zod.gen.js";
|
|
18
|
+
export * from "./models.js";
|
|
19
|
+
export * from "./errors.js";
|
|
20
|
+
export { iterateSse } from "./sse.js";
|
|
21
|
+
export { ComfyLow, OPERATION_IDS, OPERATION_METHODS, } from "./transport.js";
|