@runware/sdk-js 1.1.15 → 1.1.17-beta.1
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.d.mts +20 -8
- package/dist/index.d.ts +20 -8
- package/dist/index.js +356 -241
- package/dist/index.mjs +356 -241
- package/package.json +1 -1
- package/readme.md +105 -82
package/dist/index.d.mts
CHANGED
|
@@ -20,6 +20,9 @@ declare enum ETaskType {
|
|
|
20
20
|
type RunwareBaseType = {
|
|
21
21
|
apiKey: string;
|
|
22
22
|
url?: string;
|
|
23
|
+
shouldReconnect?: boolean;
|
|
24
|
+
globalMaxRetries?: number;
|
|
25
|
+
timeOutDuration?: number;
|
|
23
26
|
};
|
|
24
27
|
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
25
28
|
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
@@ -78,6 +81,7 @@ type IControlNetPreprocess = {
|
|
|
78
81
|
includeHandsAndFaceOpenPose?: boolean;
|
|
79
82
|
includeCost?: boolean;
|
|
80
83
|
customTaskUUID?: string;
|
|
84
|
+
retry?: number;
|
|
81
85
|
};
|
|
82
86
|
type IControlNet = IControlNetGeneral;
|
|
83
87
|
type IControlNetWithUUID = Omit<IControlNet, "guideImage"> & {
|
|
@@ -119,6 +123,7 @@ interface IRequestImageToText {
|
|
|
119
123
|
inputImage?: File | string;
|
|
120
124
|
includeCost?: boolean;
|
|
121
125
|
customTaskUUID?: string;
|
|
126
|
+
retry?: number;
|
|
122
127
|
}
|
|
123
128
|
interface IImageToText {
|
|
124
129
|
taskType: ETaskType;
|
|
@@ -137,6 +142,7 @@ interface IRemoveImageBackground extends IRequestImageToText {
|
|
|
137
142
|
alphaMattingBackgroundThreshold?: number;
|
|
138
143
|
alphaMattingErodeSize?: number;
|
|
139
144
|
includeCost?: boolean;
|
|
145
|
+
retry?: number;
|
|
140
146
|
}
|
|
141
147
|
interface IRemoveImage {
|
|
142
148
|
taskType: ETaskType;
|
|
@@ -154,6 +160,7 @@ interface IPromptEnhancer {
|
|
|
154
160
|
prompt: string;
|
|
155
161
|
includeCost?: boolean;
|
|
156
162
|
customTaskUUID?: string;
|
|
163
|
+
retry?: number;
|
|
157
164
|
}
|
|
158
165
|
interface IEnhancedPrompt extends IImageToText {
|
|
159
166
|
}
|
|
@@ -164,6 +171,7 @@ interface IUpscaleGan {
|
|
|
164
171
|
outputFormat?: IOutputFormat;
|
|
165
172
|
includeCost?: boolean;
|
|
166
173
|
customTaskUUID?: string;
|
|
174
|
+
retry?: number;
|
|
167
175
|
}
|
|
168
176
|
type ReconnectingWebsocketProps = {
|
|
169
177
|
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
@@ -253,7 +261,10 @@ declare class RunwareBase {
|
|
|
253
261
|
_connectionSessionUUID: string | undefined;
|
|
254
262
|
_invalidAPIkey: string | undefined;
|
|
255
263
|
_sdkType: SdkType;
|
|
256
|
-
|
|
264
|
+
_shouldReconnect: boolean;
|
|
265
|
+
_globalMaxRetries: number;
|
|
266
|
+
_timeOutDuration: number;
|
|
267
|
+
constructor({ apiKey, url, shouldReconnect, globalMaxRetries, timeOutDuration, }: RunwareBaseType);
|
|
257
268
|
protected isWebsocketReadyState: () => boolean;
|
|
258
269
|
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
259
270
|
lis: (v: any) => any;
|
|
@@ -269,11 +280,11 @@ declare class RunwareBase {
|
|
|
269
280
|
private listenToImages;
|
|
270
281
|
private globalListener;
|
|
271
282
|
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>;
|
|
272
|
-
controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
273
|
-
requestImageToText: ({ inputImage, includeCost, customTaskUUID, }: IRequestImageToText) => Promise<IImageToText>;
|
|
274
|
-
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
275
|
-
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, }: IUpscaleGan) => Promise<IImage>;
|
|
276
|
-
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
283
|
+
controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, retry, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
284
|
+
requestImageToText: ({ inputImage, includeCost, customTaskUUID, retry, }: IRequestImageToText) => Promise<IImageToText>;
|
|
285
|
+
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, retry, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
286
|
+
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, retry, }: IUpscaleGan) => Promise<IImage>;
|
|
287
|
+
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, retry, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
277
288
|
ensureConnection(): Promise<unknown>;
|
|
278
289
|
private getSimilarImages;
|
|
279
290
|
private getSingleMessage;
|
|
@@ -283,7 +294,7 @@ declare class RunwareBase {
|
|
|
283
294
|
}
|
|
284
295
|
|
|
285
296
|
declare class RunwareClient extends RunwareBase {
|
|
286
|
-
constructor(
|
|
297
|
+
constructor(props: RunwareBaseType);
|
|
287
298
|
}
|
|
288
299
|
|
|
289
300
|
declare class RunwareServer extends RunwareBase {
|
|
@@ -292,10 +303,11 @@ declare class RunwareServer extends RunwareBase {
|
|
|
292
303
|
_reconnectingIntervalId: null | any;
|
|
293
304
|
_pingTimeout: any;
|
|
294
305
|
_pongListener: any;
|
|
295
|
-
constructor(
|
|
306
|
+
constructor(props: RunwareBaseType);
|
|
296
307
|
protected connect(): Promise<void>;
|
|
297
308
|
protected send: (msg: Object) => void;
|
|
298
309
|
protected handleClose(): void;
|
|
310
|
+
protected resetConnection: () => void;
|
|
299
311
|
protected heartBeat(): void;
|
|
300
312
|
}
|
|
301
313
|
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ declare enum ETaskType {
|
|
|
20
20
|
type RunwareBaseType = {
|
|
21
21
|
apiKey: string;
|
|
22
22
|
url?: string;
|
|
23
|
+
shouldReconnect?: boolean;
|
|
24
|
+
globalMaxRetries?: number;
|
|
25
|
+
timeOutDuration?: number;
|
|
23
26
|
};
|
|
24
27
|
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
25
28
|
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
@@ -78,6 +81,7 @@ type IControlNetPreprocess = {
|
|
|
78
81
|
includeHandsAndFaceOpenPose?: boolean;
|
|
79
82
|
includeCost?: boolean;
|
|
80
83
|
customTaskUUID?: string;
|
|
84
|
+
retry?: number;
|
|
81
85
|
};
|
|
82
86
|
type IControlNet = IControlNetGeneral;
|
|
83
87
|
type IControlNetWithUUID = Omit<IControlNet, "guideImage"> & {
|
|
@@ -119,6 +123,7 @@ interface IRequestImageToText {
|
|
|
119
123
|
inputImage?: File | string;
|
|
120
124
|
includeCost?: boolean;
|
|
121
125
|
customTaskUUID?: string;
|
|
126
|
+
retry?: number;
|
|
122
127
|
}
|
|
123
128
|
interface IImageToText {
|
|
124
129
|
taskType: ETaskType;
|
|
@@ -137,6 +142,7 @@ interface IRemoveImageBackground extends IRequestImageToText {
|
|
|
137
142
|
alphaMattingBackgroundThreshold?: number;
|
|
138
143
|
alphaMattingErodeSize?: number;
|
|
139
144
|
includeCost?: boolean;
|
|
145
|
+
retry?: number;
|
|
140
146
|
}
|
|
141
147
|
interface IRemoveImage {
|
|
142
148
|
taskType: ETaskType;
|
|
@@ -154,6 +160,7 @@ interface IPromptEnhancer {
|
|
|
154
160
|
prompt: string;
|
|
155
161
|
includeCost?: boolean;
|
|
156
162
|
customTaskUUID?: string;
|
|
163
|
+
retry?: number;
|
|
157
164
|
}
|
|
158
165
|
interface IEnhancedPrompt extends IImageToText {
|
|
159
166
|
}
|
|
@@ -164,6 +171,7 @@ interface IUpscaleGan {
|
|
|
164
171
|
outputFormat?: IOutputFormat;
|
|
165
172
|
includeCost?: boolean;
|
|
166
173
|
customTaskUUID?: string;
|
|
174
|
+
retry?: number;
|
|
167
175
|
}
|
|
168
176
|
type ReconnectingWebsocketProps = {
|
|
169
177
|
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
@@ -253,7 +261,10 @@ declare class RunwareBase {
|
|
|
253
261
|
_connectionSessionUUID: string | undefined;
|
|
254
262
|
_invalidAPIkey: string | undefined;
|
|
255
263
|
_sdkType: SdkType;
|
|
256
|
-
|
|
264
|
+
_shouldReconnect: boolean;
|
|
265
|
+
_globalMaxRetries: number;
|
|
266
|
+
_timeOutDuration: number;
|
|
267
|
+
constructor({ apiKey, url, shouldReconnect, globalMaxRetries, timeOutDuration, }: RunwareBaseType);
|
|
257
268
|
protected isWebsocketReadyState: () => boolean;
|
|
258
269
|
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
259
270
|
lis: (v: any) => any;
|
|
@@ -269,11 +280,11 @@ declare class RunwareBase {
|
|
|
269
280
|
private listenToImages;
|
|
270
281
|
private globalListener;
|
|
271
282
|
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>;
|
|
272
|
-
controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
273
|
-
requestImageToText: ({ inputImage, includeCost, customTaskUUID, }: IRequestImageToText) => Promise<IImageToText>;
|
|
274
|
-
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
275
|
-
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, }: IUpscaleGan) => Promise<IImage>;
|
|
276
|
-
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
283
|
+
controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, retry, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
284
|
+
requestImageToText: ({ inputImage, includeCost, customTaskUUID, retry, }: IRequestImageToText) => Promise<IImageToText>;
|
|
285
|
+
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, retry, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
286
|
+
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, retry, }: IUpscaleGan) => Promise<IImage>;
|
|
287
|
+
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, retry, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
277
288
|
ensureConnection(): Promise<unknown>;
|
|
278
289
|
private getSimilarImages;
|
|
279
290
|
private getSingleMessage;
|
|
@@ -283,7 +294,7 @@ declare class RunwareBase {
|
|
|
283
294
|
}
|
|
284
295
|
|
|
285
296
|
declare class RunwareClient extends RunwareBase {
|
|
286
|
-
constructor(
|
|
297
|
+
constructor(props: RunwareBaseType);
|
|
287
298
|
}
|
|
288
299
|
|
|
289
300
|
declare class RunwareServer extends RunwareBase {
|
|
@@ -292,10 +303,11 @@ declare class RunwareServer extends RunwareBase {
|
|
|
292
303
|
_reconnectingIntervalId: null | any;
|
|
293
304
|
_pingTimeout: any;
|
|
294
305
|
_pongListener: any;
|
|
295
|
-
constructor(
|
|
306
|
+
constructor(props: RunwareBaseType);
|
|
296
307
|
protected connect(): Promise<void>;
|
|
297
308
|
protected send: (msg: Object) => void;
|
|
298
309
|
protected handleClose(): void;
|
|
310
|
+
protected resetConnection: () => void;
|
|
299
311
|
protected heartBeat(): void;
|
|
300
312
|
}
|
|
301
313
|
|