@runware/sdk-js 1.1.17 → 1.1.19

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