@civitai/client 0.1.9-beta.9 → 0.2.0-beta.2
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 +0 -0
- package/dist/client/CivitaiClient.d.ts +2 -1
- package/dist/client/CivitaiClient.js +13 -13
- package/dist/generated/client/client.d.ts +2 -0
- package/dist/generated/client/client.js +145 -0
- package/dist/generated/client/index.d.ts +22 -0
- package/dist/generated/client/index.js +4 -0
- package/dist/generated/client/types.d.ts +185 -0
- package/dist/generated/client/utils.d.ts +72 -0
- package/dist/generated/client/utils.js +285 -0
- package/dist/generated/client.gen.d.ts +14 -0
- package/dist/generated/client.gen.js +3 -0
- package/dist/generated/core/auth.d.ts +21 -0
- package/dist/generated/core/auth.js +13 -0
- package/dist/generated/core/bodySerializer.d.ts +17 -0
- package/dist/generated/core/bodySerializer.js +53 -0
- package/dist/generated/core/params.d.ts +38 -0
- package/dist/generated/core/params.js +88 -0
- package/dist/generated/core/pathSerializer.d.ts +49 -0
- package/dist/generated/core/pathSerializer.js +105 -0
- package/dist/generated/core/types.d.ts +89 -0
- package/dist/generated/core/types.js +1 -0
- package/dist/generated/index.d.ts +1 -2
- package/dist/generated/index.js +2 -6
- package/dist/generated/schemas.gen.d.ts +2083 -2028
- package/dist/generated/schemas.gen.js +2093 -2031
- package/dist/generated/sdk.gen.d.ts +370 -0
- package/dist/generated/sdk.gen.js +472 -0
- package/dist/generated/services.gen.d.ts +88 -90
- package/dist/generated/services.gen.js +100 -147
- package/dist/generated/types.gen.d.ts +1545 -1982
- package/dist/generated/types.gen.js +70 -134
- package/dist/index.js +3 -6
- package/dist/utils/Air.js +2 -6
- package/dist/utils/TimeSpan.js +24 -28
- package/dist/utils/handleError.d.ts +2 -0
- package/dist/utils/handleError.js +9 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +4 -6
- package/dist/utils/patch-json.js +19 -8
- package/dist/utils/types.d.ts +3 -0
- package/dist/utils/types.js +1 -0
- package/package.json +5 -3
- package/dist/client/RequestsClient.d.ts +0 -0
- package/dist/client/RequestsClient.js +0 -58
- package/dist/generated/GeneratedClient.d.ts +0 -22
- package/dist/generated/GeneratedClient.js +0 -40
- package/dist/generated/core/ApiError.d.ts +0 -10
- package/dist/generated/core/ApiError.js +0 -15
- package/dist/generated/core/ApiRequestOptions.d.ts +0 -13
- package/dist/generated/core/ApiRequestOptions.js +0 -2
- package/dist/generated/core/ApiResult.d.ts +0 -7
- package/dist/generated/core/ApiResult.js +0 -2
- package/dist/generated/core/AxiosHttpRequest.d.ts +0 -14
- package/dist/generated/core/AxiosHttpRequest.js +0 -20
- package/dist/generated/core/BaseHttpRequest.d.ts +0 -8
- package/dist/generated/core/BaseHttpRequest.js +0 -9
- package/dist/generated/core/CancelablePromise.d.ts +0 -37
- package/dist/generated/core/CancelablePromise.js +0 -93
- package/dist/generated/core/FetchHttpRequest.d.ts +0 -14
- package/dist/generated/core/FetchHttpRequest.js +0 -20
- package/dist/generated/core/OpenAPI.d.ts +0 -27
- package/dist/generated/core/OpenAPI.js +0 -33
- package/dist/generated/core/request.d.ts +0 -49
- package/dist/generated/core/request.js +0 -325
- package/dist/generated/enums.gen.d.ts +0 -97
- package/dist/generated/enums.gen.js +0 -101
- package/dist/utils/CivitaiClientError.d.ts +0 -0
- package/dist/utils/CivitaiClientError.js +0 -4
- package/dist/utils/CivitaiError.d.ts +0 -5
- package/dist/utils/CivitaiError.js +0 -13
- package/dist/utils/createClient.js +0 -119
- /package/dist/{utils/createClient.d.ts → generated/client/types.js} +0 -0
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.request = exports.catchErrorCodes = exports.getResponseBody = exports.getResponseHeader = exports.sendRequest = exports.getRequestBody = exports.getHeaders = exports.resolve = exports.getFormData = exports.getQueryString = exports.base64 = exports.isFormData = exports.isBlob = exports.isStringWithValue = exports.isString = void 0;
|
|
4
|
-
const ApiError_1 = require("./ApiError");
|
|
5
|
-
const CancelablePromise_1 = require("./CancelablePromise");
|
|
6
|
-
const isString = (value) => {
|
|
7
|
-
return typeof value === 'string';
|
|
8
|
-
};
|
|
9
|
-
exports.isString = isString;
|
|
10
|
-
const isStringWithValue = (value) => {
|
|
11
|
-
return (0, exports.isString)(value) && value !== '';
|
|
12
|
-
};
|
|
13
|
-
exports.isStringWithValue = isStringWithValue;
|
|
14
|
-
const isBlob = (value) => {
|
|
15
|
-
return value instanceof Blob;
|
|
16
|
-
};
|
|
17
|
-
exports.isBlob = isBlob;
|
|
18
|
-
const isFormData = (value) => {
|
|
19
|
-
return value instanceof FormData;
|
|
20
|
-
};
|
|
21
|
-
exports.isFormData = isFormData;
|
|
22
|
-
const base64 = (str) => {
|
|
23
|
-
try {
|
|
24
|
-
return btoa(str);
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
return Buffer.from(str).toString('base64');
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
exports.base64 = base64;
|
|
32
|
-
const getQueryString = (params) => {
|
|
33
|
-
const qs = [];
|
|
34
|
-
const append = (key, value) => {
|
|
35
|
-
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
36
|
-
};
|
|
37
|
-
const encodePair = (key, value) => {
|
|
38
|
-
if (value === undefined || value === null) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (value instanceof Date) {
|
|
42
|
-
append(key, value.toISOString());
|
|
43
|
-
}
|
|
44
|
-
else if (Array.isArray(value)) {
|
|
45
|
-
value.forEach((v) => encodePair(key, v));
|
|
46
|
-
}
|
|
47
|
-
else if (typeof value === 'object') {
|
|
48
|
-
Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
append(key, value);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
Object.entries(params).forEach(([key, value]) => encodePair(key, value));
|
|
55
|
-
return qs.length ? `?${qs.join('&')}` : '';
|
|
56
|
-
};
|
|
57
|
-
exports.getQueryString = getQueryString;
|
|
58
|
-
const getUrl = (config, options) => {
|
|
59
|
-
const encoder = config.ENCODE_PATH || encodeURI;
|
|
60
|
-
const path = options.url
|
|
61
|
-
.replace('{api-version}', config.VERSION)
|
|
62
|
-
.replace(/{(.*?)}/g, (substring, group) => {
|
|
63
|
-
var _a;
|
|
64
|
-
if ((_a = options.path) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(group)) {
|
|
65
|
-
return encoder(String(options.path[group]));
|
|
66
|
-
}
|
|
67
|
-
return substring;
|
|
68
|
-
});
|
|
69
|
-
const url = config.BASE + path;
|
|
70
|
-
return options.query ? url + (0, exports.getQueryString)(options.query) : url;
|
|
71
|
-
};
|
|
72
|
-
const getFormData = (options) => {
|
|
73
|
-
if (options.formData) {
|
|
74
|
-
const formData = new FormData();
|
|
75
|
-
const process = (key, value) => {
|
|
76
|
-
if ((0, exports.isString)(value) || (0, exports.isBlob)(value)) {
|
|
77
|
-
formData.append(key, value);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
formData.append(key, JSON.stringify(value));
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
Object.entries(options.formData)
|
|
84
|
-
.filter(([, value]) => value !== undefined && value !== null)
|
|
85
|
-
.forEach(([key, value]) => {
|
|
86
|
-
if (Array.isArray(value)) {
|
|
87
|
-
value.forEach((v) => process(key, v));
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
process(key, value);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return formData;
|
|
94
|
-
}
|
|
95
|
-
return undefined;
|
|
96
|
-
};
|
|
97
|
-
exports.getFormData = getFormData;
|
|
98
|
-
const resolve = async (options, resolver) => {
|
|
99
|
-
if (typeof resolver === 'function') {
|
|
100
|
-
return resolver(options);
|
|
101
|
-
}
|
|
102
|
-
return resolver;
|
|
103
|
-
};
|
|
104
|
-
exports.resolve = resolve;
|
|
105
|
-
const getHeaders = async (config, options) => {
|
|
106
|
-
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
107
|
-
(0, exports.resolve)(options, config.TOKEN),
|
|
108
|
-
(0, exports.resolve)(options, config.USERNAME),
|
|
109
|
-
(0, exports.resolve)(options, config.PASSWORD),
|
|
110
|
-
(0, exports.resolve)(options, config.HEADERS),
|
|
111
|
-
]);
|
|
112
|
-
const headers = Object.entries({
|
|
113
|
-
Accept: 'application/json',
|
|
114
|
-
...additionalHeaders,
|
|
115
|
-
...options.headers,
|
|
116
|
-
})
|
|
117
|
-
.filter(([, value]) => value !== undefined && value !== null)
|
|
118
|
-
.reduce((headers, [key, value]) => ({
|
|
119
|
-
...headers,
|
|
120
|
-
[key]: String(value),
|
|
121
|
-
}), {});
|
|
122
|
-
if ((0, exports.isStringWithValue)(token)) {
|
|
123
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
124
|
-
}
|
|
125
|
-
if ((0, exports.isStringWithValue)(username) && (0, exports.isStringWithValue)(password)) {
|
|
126
|
-
const credentials = (0, exports.base64)(`${username}:${password}`);
|
|
127
|
-
headers['Authorization'] = `Basic ${credentials}`;
|
|
128
|
-
}
|
|
129
|
-
if (options.body !== undefined) {
|
|
130
|
-
if (options.mediaType) {
|
|
131
|
-
headers['Content-Type'] = options.mediaType;
|
|
132
|
-
}
|
|
133
|
-
else if ((0, exports.isBlob)(options.body)) {
|
|
134
|
-
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
135
|
-
}
|
|
136
|
-
else if ((0, exports.isString)(options.body)) {
|
|
137
|
-
headers['Content-Type'] = 'text/plain';
|
|
138
|
-
}
|
|
139
|
-
else if (!(0, exports.isFormData)(options.body)) {
|
|
140
|
-
headers['Content-Type'] = 'application/json';
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return new Headers(headers);
|
|
144
|
-
};
|
|
145
|
-
exports.getHeaders = getHeaders;
|
|
146
|
-
const getRequestBody = (options) => {
|
|
147
|
-
var _a, _b;
|
|
148
|
-
if (options.body !== undefined) {
|
|
149
|
-
if (((_a = options.mediaType) === null || _a === void 0 ? void 0 : _a.includes('application/json')) || ((_b = options.mediaType) === null || _b === void 0 ? void 0 : _b.includes('+json'))) {
|
|
150
|
-
return JSON.stringify(options.body);
|
|
151
|
-
}
|
|
152
|
-
else if ((0, exports.isString)(options.body) || (0, exports.isBlob)(options.body) || (0, exports.isFormData)(options.body)) {
|
|
153
|
-
return options.body;
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
return JSON.stringify(options.body);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return undefined;
|
|
160
|
-
};
|
|
161
|
-
exports.getRequestBody = getRequestBody;
|
|
162
|
-
const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
163
|
-
const controller = new AbortController();
|
|
164
|
-
let request = {
|
|
165
|
-
headers,
|
|
166
|
-
body: body !== null && body !== void 0 ? body : formData,
|
|
167
|
-
method: options.method,
|
|
168
|
-
signal: controller.signal,
|
|
169
|
-
};
|
|
170
|
-
if (config.WITH_CREDENTIALS) {
|
|
171
|
-
request.credentials = config.CREDENTIALS;
|
|
172
|
-
}
|
|
173
|
-
for (const fn of config.interceptors.request._fns) {
|
|
174
|
-
request = await fn(request);
|
|
175
|
-
}
|
|
176
|
-
onCancel(() => controller.abort());
|
|
177
|
-
return await fetch(url, request);
|
|
178
|
-
};
|
|
179
|
-
exports.sendRequest = sendRequest;
|
|
180
|
-
const getResponseHeader = (response, responseHeader) => {
|
|
181
|
-
if (responseHeader) {
|
|
182
|
-
const content = response.headers.get(responseHeader);
|
|
183
|
-
if ((0, exports.isString)(content)) {
|
|
184
|
-
return content;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return undefined;
|
|
188
|
-
};
|
|
189
|
-
exports.getResponseHeader = getResponseHeader;
|
|
190
|
-
const getResponseBody = async (response) => {
|
|
191
|
-
if (response.status !== 204) {
|
|
192
|
-
try {
|
|
193
|
-
const contentType = response.headers.get('Content-Type');
|
|
194
|
-
if (contentType) {
|
|
195
|
-
const binaryTypes = [
|
|
196
|
-
'application/octet-stream',
|
|
197
|
-
'application/pdf',
|
|
198
|
-
'application/zip',
|
|
199
|
-
'audio/',
|
|
200
|
-
'image/',
|
|
201
|
-
'video/',
|
|
202
|
-
];
|
|
203
|
-
if (contentType.includes('application/json') || contentType.includes('+json')) {
|
|
204
|
-
return await response.json();
|
|
205
|
-
}
|
|
206
|
-
else if (binaryTypes.some((type) => contentType.includes(type))) {
|
|
207
|
-
return await response.blob();
|
|
208
|
-
}
|
|
209
|
-
else if (contentType.includes('multipart/form-data')) {
|
|
210
|
-
return await response.formData();
|
|
211
|
-
}
|
|
212
|
-
else if (contentType.includes('text/')) {
|
|
213
|
-
return await response.text();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
catch (error) {
|
|
218
|
-
console.error(error);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return undefined;
|
|
222
|
-
};
|
|
223
|
-
exports.getResponseBody = getResponseBody;
|
|
224
|
-
const catchErrorCodes = (options, result) => {
|
|
225
|
-
var _a, _b;
|
|
226
|
-
const errors = {
|
|
227
|
-
400: 'Bad Request',
|
|
228
|
-
401: 'Unauthorized',
|
|
229
|
-
402: 'Payment Required',
|
|
230
|
-
403: 'Forbidden',
|
|
231
|
-
404: 'Not Found',
|
|
232
|
-
405: 'Method Not Allowed',
|
|
233
|
-
406: 'Not Acceptable',
|
|
234
|
-
407: 'Proxy Authentication Required',
|
|
235
|
-
408: 'Request Timeout',
|
|
236
|
-
409: 'Conflict',
|
|
237
|
-
410: 'Gone',
|
|
238
|
-
411: 'Length Required',
|
|
239
|
-
412: 'Precondition Failed',
|
|
240
|
-
413: 'Payload Too Large',
|
|
241
|
-
414: 'URI Too Long',
|
|
242
|
-
415: 'Unsupported Media Type',
|
|
243
|
-
416: 'Range Not Satisfiable',
|
|
244
|
-
417: 'Expectation Failed',
|
|
245
|
-
418: 'Im a teapot',
|
|
246
|
-
421: 'Misdirected Request',
|
|
247
|
-
422: 'Unprocessable Content',
|
|
248
|
-
423: 'Locked',
|
|
249
|
-
424: 'Failed Dependency',
|
|
250
|
-
425: 'Too Early',
|
|
251
|
-
426: 'Upgrade Required',
|
|
252
|
-
428: 'Precondition Required',
|
|
253
|
-
429: 'Too Many Requests',
|
|
254
|
-
431: 'Request Header Fields Too Large',
|
|
255
|
-
451: 'Unavailable For Legal Reasons',
|
|
256
|
-
500: 'Internal Server Error',
|
|
257
|
-
501: 'Not Implemented',
|
|
258
|
-
502: 'Bad Gateway',
|
|
259
|
-
503: 'Service Unavailable',
|
|
260
|
-
504: 'Gateway Timeout',
|
|
261
|
-
505: 'HTTP Version Not Supported',
|
|
262
|
-
506: 'Variant Also Negotiates',
|
|
263
|
-
507: 'Insufficient Storage',
|
|
264
|
-
508: 'Loop Detected',
|
|
265
|
-
510: 'Not Extended',
|
|
266
|
-
511: 'Network Authentication Required',
|
|
267
|
-
...options.errors,
|
|
268
|
-
};
|
|
269
|
-
const error = errors[result.status];
|
|
270
|
-
if (error) {
|
|
271
|
-
throw new ApiError_1.ApiError(options, result, error);
|
|
272
|
-
}
|
|
273
|
-
if (!result.ok) {
|
|
274
|
-
const errorStatus = (_a = result.status) !== null && _a !== void 0 ? _a : 'unknown';
|
|
275
|
-
const errorStatusText = (_b = result.statusText) !== null && _b !== void 0 ? _b : 'unknown';
|
|
276
|
-
const errorBody = (() => {
|
|
277
|
-
try {
|
|
278
|
-
return JSON.stringify(result.body, null, 2);
|
|
279
|
-
}
|
|
280
|
-
catch (e) {
|
|
281
|
-
return undefined;
|
|
282
|
-
}
|
|
283
|
-
})();
|
|
284
|
-
throw new ApiError_1.ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
exports.catchErrorCodes = catchErrorCodes;
|
|
288
|
-
/**
|
|
289
|
-
* Request method
|
|
290
|
-
* @param config The OpenAPI configuration object
|
|
291
|
-
* @param options The request options from the service
|
|
292
|
-
* @returns CancelablePromise<T>
|
|
293
|
-
* @throws ApiError
|
|
294
|
-
*/
|
|
295
|
-
const request = (config, options) => {
|
|
296
|
-
return new CancelablePromise_1.CancelablePromise(async (resolve, reject, onCancel) => {
|
|
297
|
-
try {
|
|
298
|
-
const url = getUrl(config, options);
|
|
299
|
-
const formData = (0, exports.getFormData)(options);
|
|
300
|
-
const body = (0, exports.getRequestBody)(options);
|
|
301
|
-
const headers = await (0, exports.getHeaders)(config, options);
|
|
302
|
-
if (!onCancel.isCancelled) {
|
|
303
|
-
let response = await (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel);
|
|
304
|
-
for (const fn of config.interceptors.response._fns) {
|
|
305
|
-
response = await fn(response);
|
|
306
|
-
}
|
|
307
|
-
const responseBody = await (0, exports.getResponseBody)(response);
|
|
308
|
-
const responseHeader = (0, exports.getResponseHeader)(response, options.responseHeader);
|
|
309
|
-
const result = {
|
|
310
|
-
url,
|
|
311
|
-
ok: response.ok,
|
|
312
|
-
status: response.status,
|
|
313
|
-
statusText: response.statusText,
|
|
314
|
-
body: responseHeader !== null && responseHeader !== void 0 ? responseHeader : responseBody,
|
|
315
|
-
};
|
|
316
|
-
(0, exports.catchErrorCodes)(options, result);
|
|
317
|
-
resolve(result.body);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
catch (error) {
|
|
321
|
-
reject(error);
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
};
|
|
325
|
-
exports.request = request;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export declare const ContainerFormatEnum: {
|
|
2
|
-
readonly MP4: 'mp4';
|
|
3
|
-
readonly WEB_M: 'webM';
|
|
4
|
-
};
|
|
5
|
-
export declare const $typeEnum: {
|
|
6
|
-
readonly ECHO: 'echo';
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Available image transformers.
|
|
10
|
-
*/
|
|
11
|
-
export declare const ImageTransformerEnum: {
|
|
12
|
-
readonly CANNY: 'canny';
|
|
13
|
-
readonly DEPTH_ZOE: 'depthZoe';
|
|
14
|
-
readonly SOFTEDGE_PIDINET: 'softedgePidinet';
|
|
15
|
-
readonly REMBG: 'rembg';
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Available levels of job support.
|
|
19
|
-
*/
|
|
20
|
-
export declare const JobSupportEnum: {
|
|
21
|
-
readonly UNSUPPORTED: 'unsupported';
|
|
22
|
-
readonly UNAVAILABLE: 'unavailable';
|
|
23
|
-
readonly AVAILABLE: 'available';
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Available options for priority.
|
|
27
|
-
*/
|
|
28
|
-
export declare const PriorityEnum: {
|
|
29
|
-
readonly HIGH: 'high';
|
|
30
|
-
readonly NORMAL: 'normal';
|
|
31
|
-
readonly LOW: 'low';
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The available options for schedulers used in image generation.
|
|
35
|
-
*/
|
|
36
|
-
export declare const SchedulerEnum: {
|
|
37
|
-
readonly EULER_A: 'eulerA';
|
|
38
|
-
readonly EULER: 'euler';
|
|
39
|
-
readonly LMS: 'lms';
|
|
40
|
-
readonly HEUN: 'heun';
|
|
41
|
-
readonly DP_M2: 'dpM2';
|
|
42
|
-
readonly DP_M2A: 'dpM2A';
|
|
43
|
-
readonly DP_M2SA: 'dpM2SA';
|
|
44
|
-
readonly DP_M2M: 'dpM2M';
|
|
45
|
-
readonly DPMSDE: 'dpmsde';
|
|
46
|
-
readonly DPM_FAST: 'dpmFast';
|
|
47
|
-
readonly DPM_ADAPTIVE: 'dpmAdaptive';
|
|
48
|
-
readonly LMS_KARRAS: 'lmsKarras';
|
|
49
|
-
readonly DP_M2KARRAS: 'dpM2Karras';
|
|
50
|
-
readonly DP_M2AKARRAS: 'dpM2AKarras';
|
|
51
|
-
readonly DP_M2SAKARRAS: 'dpM2SAKarras';
|
|
52
|
-
readonly DP_M2MKARRAS: 'dpM2MKarras';
|
|
53
|
-
readonly DPMSDE_KARRAS: 'dpmsdeKarras';
|
|
54
|
-
readonly DDIM: 'ddim';
|
|
55
|
-
readonly PLMS: 'plms';
|
|
56
|
-
readonly UNI_PC: 'uniPC';
|
|
57
|
-
readonly UNDEFINED: 'undefined';
|
|
58
|
-
readonly LCM: 'lcm';
|
|
59
|
-
readonly DDPM: 'ddpm';
|
|
60
|
-
readonly DEIS: 'deis';
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Available statuses for updating workflows.
|
|
64
|
-
*/
|
|
65
|
-
export declare const UpdateWorkflowStatusEnum: {
|
|
66
|
-
readonly CANCELED: 'canceled';
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Options for representing the status for a resource on a worker.
|
|
70
|
-
*/
|
|
71
|
-
export declare const WorkerResourceAvailabilityEnum: {
|
|
72
|
-
readonly UNKNOWN: 'unknown';
|
|
73
|
-
readonly UNSUPPORTED: 'unsupported';
|
|
74
|
-
readonly UNAVAILABLE: 'unavailable';
|
|
75
|
-
readonly AVAILABLE: 'available';
|
|
76
|
-
readonly PROVIDER_UNSUPPORTED: 'providerUnsupported';
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Available values for worker type.
|
|
80
|
-
*/
|
|
81
|
-
export declare const WorkerTypeEnum: {
|
|
82
|
-
readonly NORMAL: 'normal';
|
|
83
|
-
readonly DEFERRED: 'deferred';
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Values available to represent workflow status.
|
|
87
|
-
*/
|
|
88
|
-
export declare const WorkflowStatusEnum: {
|
|
89
|
-
readonly UNASSIGNED: 'unassigned';
|
|
90
|
-
readonly PREPARING: 'preparing';
|
|
91
|
-
readonly SCHEDULED: 'scheduled';
|
|
92
|
-
readonly PROCESSING: 'processing';
|
|
93
|
-
readonly SUCCEEDED: 'succeeded';
|
|
94
|
-
readonly FAILED: 'failed';
|
|
95
|
-
readonly EXPIRED: 'expired';
|
|
96
|
-
readonly CANCELED: 'canceled';
|
|
97
|
-
};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.WorkflowStatusEnum = exports.WorkerTypeEnum = exports.WorkerResourceAvailabilityEnum = exports.UpdateWorkflowStatusEnum = exports.SchedulerEnum = exports.PriorityEnum = exports.JobSupportEnum = exports.ImageTransformerEnum = exports.$typeEnum = exports.ContainerFormatEnum = void 0;
|
|
5
|
-
exports.ContainerFormatEnum = {
|
|
6
|
-
MP4: 'mp4',
|
|
7
|
-
WEB_M: 'webM',
|
|
8
|
-
};
|
|
9
|
-
exports.$typeEnum = {
|
|
10
|
-
ECHO: 'echo',
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Available image transformers.
|
|
14
|
-
*/
|
|
15
|
-
exports.ImageTransformerEnum = {
|
|
16
|
-
CANNY: 'canny',
|
|
17
|
-
DEPTH_ZOE: 'depthZoe',
|
|
18
|
-
SOFTEDGE_PIDINET: 'softedgePidinet',
|
|
19
|
-
REMBG: 'rembg',
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Available levels of job support.
|
|
23
|
-
*/
|
|
24
|
-
exports.JobSupportEnum = {
|
|
25
|
-
UNSUPPORTED: 'unsupported',
|
|
26
|
-
UNAVAILABLE: 'unavailable',
|
|
27
|
-
AVAILABLE: 'available',
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Available options for priority.
|
|
31
|
-
*/
|
|
32
|
-
exports.PriorityEnum = {
|
|
33
|
-
HIGH: 'high',
|
|
34
|
-
NORMAL: 'normal',
|
|
35
|
-
LOW: 'low',
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* The available options for schedulers used in image generation.
|
|
39
|
-
*/
|
|
40
|
-
exports.SchedulerEnum = {
|
|
41
|
-
EULER_A: 'eulerA',
|
|
42
|
-
EULER: 'euler',
|
|
43
|
-
LMS: 'lms',
|
|
44
|
-
HEUN: 'heun',
|
|
45
|
-
DP_M2: 'dpM2',
|
|
46
|
-
DP_M2A: 'dpM2A',
|
|
47
|
-
DP_M2SA: 'dpM2SA',
|
|
48
|
-
DP_M2M: 'dpM2M',
|
|
49
|
-
DPMSDE: 'dpmsde',
|
|
50
|
-
DPM_FAST: 'dpmFast',
|
|
51
|
-
DPM_ADAPTIVE: 'dpmAdaptive',
|
|
52
|
-
LMS_KARRAS: 'lmsKarras',
|
|
53
|
-
DP_M2KARRAS: 'dpM2Karras',
|
|
54
|
-
DP_M2AKARRAS: 'dpM2AKarras',
|
|
55
|
-
DP_M2SAKARRAS: 'dpM2SAKarras',
|
|
56
|
-
DP_M2MKARRAS: 'dpM2MKarras',
|
|
57
|
-
DPMSDE_KARRAS: 'dpmsdeKarras',
|
|
58
|
-
DDIM: 'ddim',
|
|
59
|
-
PLMS: 'plms',
|
|
60
|
-
UNI_PC: 'uniPC',
|
|
61
|
-
UNDEFINED: 'undefined',
|
|
62
|
-
LCM: 'lcm',
|
|
63
|
-
DDPM: 'ddpm',
|
|
64
|
-
DEIS: 'deis',
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Available statuses for updating workflows.
|
|
68
|
-
*/
|
|
69
|
-
exports.UpdateWorkflowStatusEnum = {
|
|
70
|
-
CANCELED: 'canceled',
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Options for representing the status for a resource on a worker.
|
|
74
|
-
*/
|
|
75
|
-
exports.WorkerResourceAvailabilityEnum = {
|
|
76
|
-
UNKNOWN: 'unknown',
|
|
77
|
-
UNSUPPORTED: 'unsupported',
|
|
78
|
-
UNAVAILABLE: 'unavailable',
|
|
79
|
-
AVAILABLE: 'available',
|
|
80
|
-
PROVIDER_UNSUPPORTED: 'providerUnsupported',
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Available values for worker type.
|
|
84
|
-
*/
|
|
85
|
-
exports.WorkerTypeEnum = {
|
|
86
|
-
NORMAL: 'normal',
|
|
87
|
-
DEFERRED: 'deferred',
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Values available to represent workflow status.
|
|
91
|
-
*/
|
|
92
|
-
exports.WorkflowStatusEnum = {
|
|
93
|
-
UNASSIGNED: 'unassigned',
|
|
94
|
-
PREPARING: 'preparing',
|
|
95
|
-
SCHEDULED: 'scheduled',
|
|
96
|
-
PROCESSING: 'processing',
|
|
97
|
-
SUCCEEDED: 'succeeded',
|
|
98
|
-
FAILED: 'failed',
|
|
99
|
-
EXPIRED: 'expired',
|
|
100
|
-
CANCELED: 'canceled',
|
|
101
|
-
};
|
|
File without changes
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// export class ApiClientError extends Error {
|
|
3
|
-
// constructor() {}
|
|
4
|
-
// }
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CivitaiError = void 0;
|
|
7
|
-
class CivitaiError {
|
|
8
|
-
constructor(response) {
|
|
9
|
-
this.status = response.status;
|
|
10
|
-
this.message = response.statusText;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.CivitaiError = CivitaiError;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// class CivitaiClient extends GeneratedClient implements ICivitaiClient {
|
|
4
|
-
// constructor(config: ClientConfig, HttpRequest?: HttpRequestConstructor) {
|
|
5
|
-
// super(
|
|
6
|
-
// {
|
|
7
|
-
// BASE:
|
|
8
|
-
// config.env === 'dev'
|
|
9
|
-
// ? 'https://orchestration-dev.civitai.com'
|
|
10
|
-
// : 'https://orchestration-stage.civitai.com', // TODO: Switch to orchestration.civitai.com once prod is back up and running
|
|
11
|
-
// HEADERS: { Authorization: `Bearer ${config.auth}` },
|
|
12
|
-
// interceptors: {
|
|
13
|
-
// request: config?.interceptors?.request ?? new Interceptors(),
|
|
14
|
-
// response: config?.interceptors?.response ?? new Interceptors(),
|
|
15
|
-
// },
|
|
16
|
-
// },
|
|
17
|
-
// HttpRequest
|
|
18
|
-
// );
|
|
19
|
-
// }
|
|
20
|
-
// public override requests = new CustomRequestsService(this.request);
|
|
21
|
-
// }
|
|
22
|
-
// export class CustomRequestsService extends RequestsService {
|
|
23
|
-
// constructor(public readonly httpRequest: BaseHttpRequest) {
|
|
24
|
-
// super(httpRequest);
|
|
25
|
-
// }
|
|
26
|
-
// public override submitRequest(
|
|
27
|
-
// props: Parameters<GeneratedClient['requests']['submitRequest']>[0],
|
|
28
|
-
// options?: { cleanupOnCancellation?: boolean }
|
|
29
|
-
// ): CancelablePromise<RequestInfo> {
|
|
30
|
-
// return new CancelablePromise<RequestInfo>(async (resolve, reject, oncancel) => {
|
|
31
|
-
// const { wait, include } = props ?? {};
|
|
32
|
-
// const { cleanupOnCancellation = true } = options ?? {};
|
|
33
|
-
// let result = await withCancellation(this.submitRequest({ ...props, wait: false }));
|
|
34
|
-
// if (!result) throw new Error('no result');
|
|
35
|
-
// try {
|
|
36
|
-
// while (wait && (result.status === 'Initialized' || result.status === 'Processing')) {
|
|
37
|
-
// result = await withCancellation(this.getRequest({ requestId: result.id, include, wait }));
|
|
38
|
-
// }
|
|
39
|
-
// resolve(result);
|
|
40
|
-
// } catch (error) {
|
|
41
|
-
// if (error instanceof CancelError && wait && cleanupOnCancellation) {
|
|
42
|
-
// console.log('cancelling request');
|
|
43
|
-
// await this.updateRequest({
|
|
44
|
-
// requestId: result.id,
|
|
45
|
-
// requestBody: {
|
|
46
|
-
// status: 'Canceled',
|
|
47
|
-
// },
|
|
48
|
-
// });
|
|
49
|
-
// }
|
|
50
|
-
// reject(error);
|
|
51
|
-
// }
|
|
52
|
-
// function withCancellation<T>(promise: CancelablePromise<T>) {
|
|
53
|
-
// oncancel(promise.cancel);
|
|
54
|
-
// return promise;
|
|
55
|
-
// }
|
|
56
|
-
// });
|
|
57
|
-
// }
|
|
58
|
-
// }
|
|
59
|
-
// export function createCivitaiClient(config: ClientConfig, HttpRequest?: HttpRequestConstructor) {
|
|
60
|
-
// const client = new GeneratedClient(
|
|
61
|
-
// {
|
|
62
|
-
// BASE:
|
|
63
|
-
// config.base ?? config.env === 'dev'
|
|
64
|
-
// ? 'https://orchestration-dev.civitai.com'
|
|
65
|
-
// : 'https://orchestration-stage.civitai.com', // TODO: Switch to orchestration.civitai.com once prod is back up and running
|
|
66
|
-
// HEADERS: { Authorization: `Bearer ${config.auth}` },
|
|
67
|
-
// interceptors: {
|
|
68
|
-
// request: config?.interceptors?.request ?? new Interceptors(),
|
|
69
|
-
// response: config?.interceptors?.response ?? new Interceptors(),
|
|
70
|
-
// },
|
|
71
|
-
// },
|
|
72
|
-
// HttpRequest
|
|
73
|
-
// ) as ICivitaiClient;
|
|
74
|
-
// function trySubmitRequest(
|
|
75
|
-
// props: Parameters<typeof client.requests.submitRequest>[0],
|
|
76
|
-
// options?: { cleanupOnCancellation?: boolean }
|
|
77
|
-
// ) {
|
|
78
|
-
// return new CancelablePromise<RequestInfo>(async (resolve, reject, oncancel) => {
|
|
79
|
-
// try {
|
|
80
|
-
// const { wait, include } = props ?? {};
|
|
81
|
-
// const { cleanupOnCancellation = true } = options ?? {};
|
|
82
|
-
// let result = await withCancellation(
|
|
83
|
-
// client.requests.submitRequest({ ...props, wait: false })
|
|
84
|
-
// );
|
|
85
|
-
// if (!result) throw new Error('no result');
|
|
86
|
-
// try {
|
|
87
|
-
// while (wait && (result.status === 'Initialized' || result.status === 'Processing')) {
|
|
88
|
-
// result = await withCancellation(
|
|
89
|
-
// client.requests.getRequest({ requestId: result.id, include, wait })
|
|
90
|
-
// );
|
|
91
|
-
// }
|
|
92
|
-
// resolve(result);
|
|
93
|
-
// } catch (error) {
|
|
94
|
-
// if (error instanceof CancelError && wait && cleanupOnCancellation) {
|
|
95
|
-
// console.log('cancelling request');
|
|
96
|
-
// await client.requests.updateRequest({
|
|
97
|
-
// requestId: result.id,
|
|
98
|
-
// requestBody: {
|
|
99
|
-
// status: 'Canceled',
|
|
100
|
-
// },
|
|
101
|
-
// });
|
|
102
|
-
// }
|
|
103
|
-
// throw error;
|
|
104
|
-
// }
|
|
105
|
-
// } catch (error) {
|
|
106
|
-
// reject(error);
|
|
107
|
-
// }
|
|
108
|
-
// function withCancellation<T>(promise: CancelablePromise<T>) {
|
|
109
|
-
// oncancel(promise.cancel);
|
|
110
|
-
// return promise;
|
|
111
|
-
// }
|
|
112
|
-
// });
|
|
113
|
-
// }
|
|
114
|
-
// const requests = { ...client.requests, submitRequest: trySubmitRequest };
|
|
115
|
-
// return {
|
|
116
|
-
// ...client,
|
|
117
|
-
// requests,
|
|
118
|
-
// };
|
|
119
|
-
// }
|
|
File without changes
|