@runware/sdk-js 1.1.19 → 1.1.20-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/dist/index.cjs +1510 -0
- package/dist/index.d.cts +371 -0
- package/dist/index.d.mts +23 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +86 -37
- package/dist/index.mjs +51 -2
- package/package.json +5 -2
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
declare enum Environment {
|
|
2
|
+
PRODUCTION = "PRODUCTION",
|
|
3
|
+
DEVELOPMENT = "DEVELOPMENT",
|
|
4
|
+
TEST = "TEST"
|
|
5
|
+
}
|
|
6
|
+
declare enum SdkType {
|
|
7
|
+
CLIENT = "CLIENT",
|
|
8
|
+
SERVER = "SERVER"
|
|
9
|
+
}
|
|
10
|
+
declare enum ETaskType {
|
|
11
|
+
IMAGE_INFERENCE = "imageInference",
|
|
12
|
+
IMAGE_UPLOAD = "imageUpload",
|
|
13
|
+
IMAGE_UPSCALE = "imageUpscale",
|
|
14
|
+
IMAGE_BACKGROUND_REMOVAL = "imageBackgroundRemoval",
|
|
15
|
+
IMAGE_CAPTION = "imageCaption",
|
|
16
|
+
IMAGE_CONTROL_NET_PRE_PROCESS = "imageControlNetPreProcess",
|
|
17
|
+
PROMPT_ENHANCE = "promptEnhance",
|
|
18
|
+
AUTHENTICATION = "authentication",
|
|
19
|
+
MODEL_UPLOAD = "modelUpload"
|
|
20
|
+
}
|
|
21
|
+
type RunwareBaseType = {
|
|
22
|
+
apiKey: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
shouldReconnect?: boolean;
|
|
25
|
+
globalMaxRetries?: number;
|
|
26
|
+
timeoutDuration?: number;
|
|
27
|
+
};
|
|
28
|
+
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
29
|
+
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
30
|
+
interface IImage {
|
|
31
|
+
taskType: ETaskType;
|
|
32
|
+
imageUUID: string;
|
|
33
|
+
inputImageUUID?: string;
|
|
34
|
+
taskUUID: string;
|
|
35
|
+
imageURL?: string;
|
|
36
|
+
imageBase64Data?: string;
|
|
37
|
+
imageDataURI?: string;
|
|
38
|
+
NSFWContent?: boolean;
|
|
39
|
+
cost?: number;
|
|
40
|
+
}
|
|
41
|
+
interface ITextToImage extends IImage {
|
|
42
|
+
positivePrompt?: string;
|
|
43
|
+
negativePrompt?: string;
|
|
44
|
+
}
|
|
45
|
+
interface IControlNetImage {
|
|
46
|
+
taskUUID: string;
|
|
47
|
+
inputImageUUID: string;
|
|
48
|
+
guideImageUUID: string;
|
|
49
|
+
guideImageURL?: string;
|
|
50
|
+
guideImageBase64Data?: string;
|
|
51
|
+
guideImageDataURI?: string;
|
|
52
|
+
cost?: number;
|
|
53
|
+
}
|
|
54
|
+
interface ILora {
|
|
55
|
+
model: string | number;
|
|
56
|
+
weight: number;
|
|
57
|
+
}
|
|
58
|
+
declare enum EControlMode {
|
|
59
|
+
BALANCED = "balanced",
|
|
60
|
+
PROMPT = "prompt",
|
|
61
|
+
CONTROL_NET = "controlnet"
|
|
62
|
+
}
|
|
63
|
+
type IControlNetGeneral = {
|
|
64
|
+
model: string;
|
|
65
|
+
guideImage: string | File;
|
|
66
|
+
weight?: number;
|
|
67
|
+
startStep?: number;
|
|
68
|
+
startStepPercentage?: number;
|
|
69
|
+
endStep?: number;
|
|
70
|
+
endStepPercentage?: number;
|
|
71
|
+
controlMode: EControlMode;
|
|
72
|
+
};
|
|
73
|
+
type IControlNetPreprocess = {
|
|
74
|
+
inputImage: string | File;
|
|
75
|
+
preProcessorType: EPreProcessorGroup;
|
|
76
|
+
height?: number;
|
|
77
|
+
width?: number;
|
|
78
|
+
outputType?: IOutputType;
|
|
79
|
+
outputFormat?: IOutputFormat;
|
|
80
|
+
highThresholdCanny?: number;
|
|
81
|
+
lowThresholdCanny?: number;
|
|
82
|
+
includeHandsAndFaceOpenPose?: boolean;
|
|
83
|
+
includeCost?: boolean;
|
|
84
|
+
customTaskUUID?: string;
|
|
85
|
+
retry?: number;
|
|
86
|
+
};
|
|
87
|
+
type IControlNet = IControlNetGeneral;
|
|
88
|
+
type IControlNetWithUUID = Omit<IControlNet, "guideImage"> & {
|
|
89
|
+
guideImage?: string;
|
|
90
|
+
};
|
|
91
|
+
interface IError {
|
|
92
|
+
error: boolean;
|
|
93
|
+
errorMessage: string;
|
|
94
|
+
taskUUID: string;
|
|
95
|
+
}
|
|
96
|
+
interface IRequestImage {
|
|
97
|
+
outputType?: IOutputType;
|
|
98
|
+
outputFormat?: IOutputFormat;
|
|
99
|
+
uploadEndpoint?: string;
|
|
100
|
+
checkNsfw?: boolean;
|
|
101
|
+
positivePrompt: string;
|
|
102
|
+
negativePrompt?: string;
|
|
103
|
+
seedImage?: File | string;
|
|
104
|
+
maskImage?: File | string;
|
|
105
|
+
strength?: number;
|
|
106
|
+
height?: number;
|
|
107
|
+
width?: number;
|
|
108
|
+
model: number | string;
|
|
109
|
+
steps?: number;
|
|
110
|
+
scheduler?: string;
|
|
111
|
+
seed?: number;
|
|
112
|
+
CFGScale?: number;
|
|
113
|
+
clipSkip?: number;
|
|
114
|
+
usePromptWeighting?: boolean;
|
|
115
|
+
numberResults?: number;
|
|
116
|
+
controlNet?: IControlNet[];
|
|
117
|
+
lora?: ILora[];
|
|
118
|
+
includeCost?: boolean;
|
|
119
|
+
customTaskUUID?: string;
|
|
120
|
+
onPartialImages?: (images: IImage[], error?: IError) => void;
|
|
121
|
+
retry?: number;
|
|
122
|
+
}
|
|
123
|
+
interface IRequestImageToText {
|
|
124
|
+
inputImage?: File | string;
|
|
125
|
+
includeCost?: boolean;
|
|
126
|
+
customTaskUUID?: string;
|
|
127
|
+
retry?: number;
|
|
128
|
+
}
|
|
129
|
+
interface IImageToText {
|
|
130
|
+
taskType: ETaskType;
|
|
131
|
+
taskUUID: string;
|
|
132
|
+
text: string;
|
|
133
|
+
cost?: number;
|
|
134
|
+
}
|
|
135
|
+
interface IRemoveImageBackground extends IRequestImageToText {
|
|
136
|
+
outputType?: IOutputType;
|
|
137
|
+
outputFormat?: IOutputFormat;
|
|
138
|
+
rgba?: number[];
|
|
139
|
+
postProcessMask?: boolean;
|
|
140
|
+
returnOnlyMask?: boolean;
|
|
141
|
+
alphaMatting?: boolean;
|
|
142
|
+
alphaMattingForegroundThreshold?: number;
|
|
143
|
+
alphaMattingBackgroundThreshold?: number;
|
|
144
|
+
alphaMattingErodeSize?: number;
|
|
145
|
+
includeCost?: boolean;
|
|
146
|
+
retry?: number;
|
|
147
|
+
}
|
|
148
|
+
interface IRemoveImage {
|
|
149
|
+
taskType: ETaskType;
|
|
150
|
+
taskUUID: string;
|
|
151
|
+
imageUUID: string;
|
|
152
|
+
inputImageUUID: string;
|
|
153
|
+
imageURL?: string;
|
|
154
|
+
imageBase64Data?: string;
|
|
155
|
+
imageDataURI?: string;
|
|
156
|
+
cost?: number;
|
|
157
|
+
}
|
|
158
|
+
interface IPromptEnhancer {
|
|
159
|
+
promptMaxLength?: number;
|
|
160
|
+
promptVersions?: number;
|
|
161
|
+
prompt: string;
|
|
162
|
+
includeCost?: boolean;
|
|
163
|
+
customTaskUUID?: string;
|
|
164
|
+
retry?: number;
|
|
165
|
+
}
|
|
166
|
+
interface IEnhancedPrompt extends IImageToText {
|
|
167
|
+
}
|
|
168
|
+
interface IUpscaleGan {
|
|
169
|
+
inputImage: File | string;
|
|
170
|
+
upscaleFactor: number;
|
|
171
|
+
outputType?: IOutputType;
|
|
172
|
+
outputFormat?: IOutputFormat;
|
|
173
|
+
includeCost?: boolean;
|
|
174
|
+
customTaskUUID?: string;
|
|
175
|
+
retry?: number;
|
|
176
|
+
}
|
|
177
|
+
type ReconnectingWebsocketProps = {
|
|
178
|
+
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
179
|
+
send: (data: any) => void;
|
|
180
|
+
} & WebSocket;
|
|
181
|
+
type UploadImageType = {
|
|
182
|
+
imageURL: string;
|
|
183
|
+
imageUUID: string;
|
|
184
|
+
taskUUID: string;
|
|
185
|
+
taskType: ETaskType;
|
|
186
|
+
};
|
|
187
|
+
type GetWithPromiseCallBackType = ({ resolve, reject, intervalId, }: {
|
|
188
|
+
resolve: <T>(value: T) => void;
|
|
189
|
+
reject: <T>(value: T) => void;
|
|
190
|
+
intervalId: any;
|
|
191
|
+
}) => boolean | undefined;
|
|
192
|
+
declare enum EPreProcessorGroup {
|
|
193
|
+
"canny" = "canny",
|
|
194
|
+
"depth" = "depth",
|
|
195
|
+
"mlsd" = "mlsd",
|
|
196
|
+
"normalbae" = "normalbae",
|
|
197
|
+
"openpose" = "openpose",
|
|
198
|
+
"tile" = "tile",
|
|
199
|
+
"seg" = "seg",
|
|
200
|
+
"lineart" = "lineart",
|
|
201
|
+
"lineart_anime" = "lineart_anime",
|
|
202
|
+
"shuffle" = "shuffle",
|
|
203
|
+
"scribble" = "scribble",
|
|
204
|
+
"softedge" = "softedge"
|
|
205
|
+
}
|
|
206
|
+
declare enum EPreProcessor {
|
|
207
|
+
"canny" = "canny",
|
|
208
|
+
"depth_leres" = "depth_leres",
|
|
209
|
+
"depth_midas" = "depth_midas",
|
|
210
|
+
"depth_zoe" = "depth_zoe",
|
|
211
|
+
"inpaint_global_harmonious" = "inpaint_global_harmonious",
|
|
212
|
+
"lineart_anime" = "lineart_anime",
|
|
213
|
+
"lineart_coarse" = "lineart_coarse",
|
|
214
|
+
"lineart_realistic" = "lineart_realistic",
|
|
215
|
+
"lineart_standard" = "lineart_standard",
|
|
216
|
+
"mlsd" = "mlsd",
|
|
217
|
+
"normal_bae" = "normal_bae",
|
|
218
|
+
"scribble_hed" = "scribble_hed",
|
|
219
|
+
"scribble_pidinet" = "scribble_pidinet",
|
|
220
|
+
"seg_ofade20k" = "seg_ofade20k",
|
|
221
|
+
"seg_ofcoco" = "seg_ofcoco",
|
|
222
|
+
"seg_ufade20k" = "seg_ufade20k",
|
|
223
|
+
"shuffle" = "shuffle",
|
|
224
|
+
"softedge_hed" = "softedge_hed",
|
|
225
|
+
"softedge_hedsafe" = "softedge_hedsafe",
|
|
226
|
+
"softedge_pidinet" = "softedge_pidinet",
|
|
227
|
+
"softedge_pidisafe" = "softedge_pidisafe",
|
|
228
|
+
"tile_gaussian" = "tile_gaussian",
|
|
229
|
+
"openpose" = "openpose",
|
|
230
|
+
"openpose_face" = "openpose_face",
|
|
231
|
+
"openpose_faceonly" = "openpose_faceonly",
|
|
232
|
+
"openpose_full" = "openpose_full",
|
|
233
|
+
"openpose_hand" = "openpose_hand"
|
|
234
|
+
}
|
|
235
|
+
declare enum EOpenPosePreProcessor {
|
|
236
|
+
"openpose" = "openpose",
|
|
237
|
+
"openpose_face" = "openpose_face",
|
|
238
|
+
"openpose_faceonly" = "openpose_faceonly",
|
|
239
|
+
"openpose_full" = "openpose_full",
|
|
240
|
+
"openpose_hand" = "openpose_hand"
|
|
241
|
+
}
|
|
242
|
+
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
243
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
244
|
+
}[Keys];
|
|
245
|
+
type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
246
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
247
|
+
}[Keys];
|
|
248
|
+
type ListenerType = {
|
|
249
|
+
key: string;
|
|
250
|
+
listener: (msg: any) => void;
|
|
251
|
+
groupKey?: string;
|
|
252
|
+
};
|
|
253
|
+
interface IAddModelResponse {
|
|
254
|
+
statusId: number;
|
|
255
|
+
message: "Processing - validation. Next step: download from provider";
|
|
256
|
+
taskUUID: string;
|
|
257
|
+
modelAIR: string;
|
|
258
|
+
taskType: string;
|
|
259
|
+
}
|
|
260
|
+
interface IErrorResponse {
|
|
261
|
+
code: string;
|
|
262
|
+
message: string;
|
|
263
|
+
parameter: string;
|
|
264
|
+
type: string;
|
|
265
|
+
documentation: string;
|
|
266
|
+
taskUUID: string;
|
|
267
|
+
}
|
|
268
|
+
type TAddModelBaseType = {
|
|
269
|
+
modelAIR: string;
|
|
270
|
+
modelName: string;
|
|
271
|
+
modelDownloadUrl: string;
|
|
272
|
+
modelUniqueIdentifier: string;
|
|
273
|
+
modelVersion: string;
|
|
274
|
+
modelFormatId: number;
|
|
275
|
+
modelTypeId: number;
|
|
276
|
+
modelHeroImageUrl?: string;
|
|
277
|
+
modelTags?: string[];
|
|
278
|
+
modelShortDescription?: string;
|
|
279
|
+
modelComment?: string;
|
|
280
|
+
privateModel: boolean;
|
|
281
|
+
customTaskUUID?: string;
|
|
282
|
+
retry?: number;
|
|
283
|
+
onUploadStream?: (response?: IAddModelResponse, error?: IErrorResponse) => void;
|
|
284
|
+
};
|
|
285
|
+
type TAddModelControlNet = {
|
|
286
|
+
modelType: "controlnet";
|
|
287
|
+
} & TAddModelBaseType;
|
|
288
|
+
type TAddModelCheckPoint = {
|
|
289
|
+
modelType: "checkpoint";
|
|
290
|
+
modelPositiveTriggerWords?: string;
|
|
291
|
+
modelDefaultGuidanceScale?: number;
|
|
292
|
+
modelDefaultWeight: number;
|
|
293
|
+
modelDefaultNumberOfSteps?: number;
|
|
294
|
+
modelDefaultSchedulerId?: number;
|
|
295
|
+
modelNegativeTriggerWords?: string;
|
|
296
|
+
modelBaseTypeId?: number;
|
|
297
|
+
} & TAddModelBaseType;
|
|
298
|
+
type TAddModelLora = {
|
|
299
|
+
modelType: "lora";
|
|
300
|
+
modelDefaultWeight: number;
|
|
301
|
+
modelPositiveTriggerWords?: string;
|
|
302
|
+
} & TAddModelBaseType;
|
|
303
|
+
type TAddModel = TAddModelCheckPoint | TAddModelControlNet | TAddModelLora;
|
|
304
|
+
|
|
305
|
+
declare class RunwareBase {
|
|
306
|
+
_ws: ReconnectingWebsocketProps | any;
|
|
307
|
+
_listeners: ListenerType[];
|
|
308
|
+
_apiKey: string;
|
|
309
|
+
_url?: string;
|
|
310
|
+
_globalMessages: Record<string, any>;
|
|
311
|
+
_globalImages: IImage[];
|
|
312
|
+
_globalError: IError | undefined;
|
|
313
|
+
_connectionSessionUUID: string | undefined;
|
|
314
|
+
_invalidAPIkey: string | undefined;
|
|
315
|
+
_sdkType: SdkType;
|
|
316
|
+
_shouldReconnect: boolean;
|
|
317
|
+
_globalMaxRetries: number;
|
|
318
|
+
_timeoutDuration: number;
|
|
319
|
+
constructor({ apiKey, url, shouldReconnect, globalMaxRetries, timeoutDuration, }: RunwareBaseType);
|
|
320
|
+
static initialize(props: RunwareBaseType): Promise<RunwareBase>;
|
|
321
|
+
protected isWebsocketReadyState: () => boolean;
|
|
322
|
+
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
323
|
+
lis: (v: any) => any;
|
|
324
|
+
groupKey?: string;
|
|
325
|
+
taskUUID: string;
|
|
326
|
+
}): {
|
|
327
|
+
destroy: () => void;
|
|
328
|
+
};
|
|
329
|
+
protected connect(): void;
|
|
330
|
+
protected send: (msg: Object) => void;
|
|
331
|
+
private destroy;
|
|
332
|
+
private uploadImage;
|
|
333
|
+
private listenToImages;
|
|
334
|
+
private listenToUpload;
|
|
335
|
+
private globalListener;
|
|
336
|
+
requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, onPartialImages, includeCost, customTaskUUID, retry, }: IRequestImage): Promise<ITextToImage[] | undefined>;
|
|
337
|
+
controlNetPreProcess: ({ inputImage, preProcessorType, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, retry, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
338
|
+
requestImageToText: ({ inputImage, includeCost, customTaskUUID, retry, }: IRequestImageToText) => Promise<IImageToText>;
|
|
339
|
+
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, retry, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
340
|
+
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, retry, }: IUpscaleGan) => Promise<IImage>;
|
|
341
|
+
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, retry, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
342
|
+
modelUpload: (payload: TAddModel) => Promise<any>;
|
|
343
|
+
ensureConnection(): Promise<unknown>;
|
|
344
|
+
private getSimilarImages;
|
|
345
|
+
private getSingleMessage;
|
|
346
|
+
private handleIncompleteImages;
|
|
347
|
+
disconnect: () => Promise<void>;
|
|
348
|
+
private connected;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
declare class RunwareClient extends RunwareBase {
|
|
352
|
+
constructor(props: RunwareBaseType);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
declare class RunwareServer extends RunwareBase {
|
|
356
|
+
_instantiated: boolean;
|
|
357
|
+
_listeners: any[];
|
|
358
|
+
_reconnectingIntervalId: null | any;
|
|
359
|
+
_pingTimeout: any;
|
|
360
|
+
_pongListener: any;
|
|
361
|
+
constructor(props: RunwareBaseType);
|
|
362
|
+
protected connect(): Promise<void>;
|
|
363
|
+
protected send: (msg: Object) => void;
|
|
364
|
+
protected handleClose(): void;
|
|
365
|
+
protected resetConnection: () => void;
|
|
366
|
+
protected heartBeat(): void;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
declare let Runware: typeof RunwareClient | typeof RunwareServer;
|
|
370
|
+
|
|
371
|
+
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IAddModelResponse, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IErrorResponse, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, ITextToImage, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareClient, RunwareServer, SdkType, TAddModel, UploadImageType };
|
package/dist/index.d.mts
CHANGED
|
@@ -15,7 +15,8 @@ declare enum ETaskType {
|
|
|
15
15
|
IMAGE_CAPTION = "imageCaption",
|
|
16
16
|
IMAGE_CONTROL_NET_PRE_PROCESS = "imageControlNetPreProcess",
|
|
17
17
|
PROMPT_ENHANCE = "promptEnhance",
|
|
18
|
-
AUTHENTICATION = "authentication"
|
|
18
|
+
AUTHENTICATION = "authentication",
|
|
19
|
+
MODEL_UPLOAD = "modelUpload"
|
|
19
20
|
}
|
|
20
21
|
type RunwareBaseType = {
|
|
21
22
|
apiKey: string;
|
|
@@ -249,6 +250,25 @@ type ListenerType = {
|
|
|
249
250
|
listener: (msg: any) => void;
|
|
250
251
|
groupKey?: string;
|
|
251
252
|
};
|
|
253
|
+
type TAddModel = {
|
|
254
|
+
modelType: string;
|
|
255
|
+
modelAIR: string;
|
|
256
|
+
modelName: string;
|
|
257
|
+
modelHeroImageUrl: string;
|
|
258
|
+
modelDownloadUrl: string;
|
|
259
|
+
modelUniqueIdentifier: string;
|
|
260
|
+
modelVersion: string;
|
|
261
|
+
modelTags: string[];
|
|
262
|
+
modelTypeId: number;
|
|
263
|
+
modelDefaultWeight: number;
|
|
264
|
+
modelFormatId: number;
|
|
265
|
+
modelPositiveTriggerWords: string;
|
|
266
|
+
modelShortDescription: string;
|
|
267
|
+
privateModel: true;
|
|
268
|
+
modelComment: string;
|
|
269
|
+
retry?: number;
|
|
270
|
+
customTaskUUID?: string;
|
|
271
|
+
};
|
|
252
272
|
|
|
253
273
|
declare class RunwareBase {
|
|
254
274
|
_ws: ReconnectingWebsocketProps | any;
|
|
@@ -286,6 +306,7 @@ declare class RunwareBase {
|
|
|
286
306
|
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, retry, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
287
307
|
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, retry, }: IUpscaleGan) => Promise<IImage>;
|
|
288
308
|
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, retry, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
309
|
+
modelUpload: (payload: TAddModel) => Promise<any>;
|
|
289
310
|
ensureConnection(): Promise<unknown>;
|
|
290
311
|
private getSimilarImages;
|
|
291
312
|
private getSingleMessage;
|
|
@@ -314,4 +335,4 @@ declare class RunwareServer extends RunwareBase {
|
|
|
314
335
|
|
|
315
336
|
declare let Runware: typeof RunwareClient | typeof RunwareServer;
|
|
316
337
|
|
|
317
|
-
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, ITextToImage, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareClient, RunwareServer, SdkType, UploadImageType };
|
|
338
|
+
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, ITextToImage, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareClient, RunwareServer, SdkType, TAddModel, UploadImageType };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ declare enum ETaskType {
|
|
|
15
15
|
IMAGE_CAPTION = "imageCaption",
|
|
16
16
|
IMAGE_CONTROL_NET_PRE_PROCESS = "imageControlNetPreProcess",
|
|
17
17
|
PROMPT_ENHANCE = "promptEnhance",
|
|
18
|
-
AUTHENTICATION = "authentication"
|
|
18
|
+
AUTHENTICATION = "authentication",
|
|
19
|
+
MODEL_UPLOAD = "modelUpload"
|
|
19
20
|
}
|
|
20
21
|
type RunwareBaseType = {
|
|
21
22
|
apiKey: string;
|
|
@@ -249,6 +250,57 @@ type ListenerType = {
|
|
|
249
250
|
listener: (msg: any) => void;
|
|
250
251
|
groupKey?: string;
|
|
251
252
|
};
|
|
253
|
+
interface IAddModelResponse {
|
|
254
|
+
statusId: number;
|
|
255
|
+
message: "Processing - validation. Next step: download from provider";
|
|
256
|
+
taskUUID: string;
|
|
257
|
+
modelAIR: string;
|
|
258
|
+
taskType: string;
|
|
259
|
+
}
|
|
260
|
+
interface IErrorResponse {
|
|
261
|
+
code: string;
|
|
262
|
+
message: string;
|
|
263
|
+
parameter: string;
|
|
264
|
+
type: string;
|
|
265
|
+
documentation: string;
|
|
266
|
+
taskUUID: string;
|
|
267
|
+
}
|
|
268
|
+
type TAddModelBaseType = {
|
|
269
|
+
modelAIR: string;
|
|
270
|
+
modelName: string;
|
|
271
|
+
modelDownloadUrl: string;
|
|
272
|
+
modelUniqueIdentifier: string;
|
|
273
|
+
modelVersion: string;
|
|
274
|
+
modelFormatId: number;
|
|
275
|
+
modelTypeId: number;
|
|
276
|
+
modelHeroImageUrl?: string;
|
|
277
|
+
modelTags?: string[];
|
|
278
|
+
modelShortDescription?: string;
|
|
279
|
+
modelComment?: string;
|
|
280
|
+
privateModel: boolean;
|
|
281
|
+
customTaskUUID?: string;
|
|
282
|
+
retry?: number;
|
|
283
|
+
onUploadStream?: (response?: IAddModelResponse, error?: IErrorResponse) => void;
|
|
284
|
+
};
|
|
285
|
+
type TAddModelControlNet = {
|
|
286
|
+
modelType: "controlnet";
|
|
287
|
+
} & TAddModelBaseType;
|
|
288
|
+
type TAddModelCheckPoint = {
|
|
289
|
+
modelType: "checkpoint";
|
|
290
|
+
modelPositiveTriggerWords?: string;
|
|
291
|
+
modelDefaultGuidanceScale?: number;
|
|
292
|
+
modelDefaultWeight: number;
|
|
293
|
+
modelDefaultNumberOfSteps?: number;
|
|
294
|
+
modelDefaultSchedulerId?: number;
|
|
295
|
+
modelNegativeTriggerWords?: string;
|
|
296
|
+
modelBaseTypeId?: number;
|
|
297
|
+
} & TAddModelBaseType;
|
|
298
|
+
type TAddModelLora = {
|
|
299
|
+
modelType: "lora";
|
|
300
|
+
modelDefaultWeight: number;
|
|
301
|
+
modelPositiveTriggerWords?: string;
|
|
302
|
+
} & TAddModelBaseType;
|
|
303
|
+
type TAddModel = TAddModelCheckPoint | TAddModelControlNet | TAddModelLora;
|
|
252
304
|
|
|
253
305
|
declare class RunwareBase {
|
|
254
306
|
_ws: ReconnectingWebsocketProps | any;
|
|
@@ -279,6 +331,7 @@ declare class RunwareBase {
|
|
|
279
331
|
private destroy;
|
|
280
332
|
private uploadImage;
|
|
281
333
|
private listenToImages;
|
|
334
|
+
private listenToUpload;
|
|
282
335
|
private globalListener;
|
|
283
336
|
requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, onPartialImages, includeCost, customTaskUUID, retry, }: IRequestImage): Promise<ITextToImage[] | undefined>;
|
|
284
337
|
controlNetPreProcess: ({ inputImage, preProcessorType, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, retry, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
@@ -286,6 +339,7 @@ declare class RunwareBase {
|
|
|
286
339
|
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, retry, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
287
340
|
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, retry, }: IUpscaleGan) => Promise<IImage>;
|
|
288
341
|
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, retry, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
342
|
+
modelUpload: (payload: TAddModel) => Promise<any>;
|
|
289
343
|
ensureConnection(): Promise<unknown>;
|
|
290
344
|
private getSimilarImages;
|
|
291
345
|
private getSingleMessage;
|
|
@@ -314,4 +368,4 @@ declare class RunwareServer extends RunwareBase {
|
|
|
314
368
|
|
|
315
369
|
declare let Runware: typeof RunwareClient | typeof RunwareServer;
|
|
316
370
|
|
|
317
|
-
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, ITextToImage, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareClient, RunwareServer, SdkType, UploadImageType };
|
|
371
|
+
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IAddModelResponse, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IErrorResponse, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, ITextToImage, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareClient, RunwareServer, SdkType, TAddModel, UploadImageType };
|