@runware/sdk-js 1.1.16 → 1.1.17-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.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";
@@ -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,9 @@ 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);
259
268
  protected isWebsocketReadyState: () => boolean;
260
269
  protected addListener({ lis, groupKey, taskUUID, }: {
261
270
  lis: (v: any) => any;
@@ -271,11 +280,11 @@ declare class RunwareBase {
271
280
  private listenToImages;
272
281
  private globalListener;
273
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>;
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[]>;
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[]>;
279
288
  ensureConnection(): Promise<unknown>;
280
289
  private getSimilarImages;
281
290
  private getSingleMessage;
@@ -285,7 +294,7 @@ declare class RunwareBase {
285
294
  }
286
295
 
287
296
  declare class RunwareClient extends RunwareBase {
288
- constructor({ apiKey, url }: RunwareBaseType);
297
+ constructor(props: RunwareBaseType);
289
298
  }
290
299
 
291
300
  declare class RunwareServer extends RunwareBase {
@@ -294,7 +303,7 @@ declare class RunwareServer extends RunwareBase {
294
303
  _reconnectingIntervalId: null | any;
295
304
  _pingTimeout: any;
296
305
  _pongListener: any;
297
- constructor({ apiKey, url, shouldReconnect }: RunwareBaseType);
306
+ constructor(props: RunwareBaseType);
298
307
  protected connect(): Promise<void>;
299
308
  protected send: (msg: Object) => void;
300
309
  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";
@@ -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,9 @@ 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);
259
268
  protected isWebsocketReadyState: () => boolean;
260
269
  protected addListener({ lis, groupKey, taskUUID, }: {
261
270
  lis: (v: any) => any;
@@ -271,11 +280,11 @@ declare class RunwareBase {
271
280
  private listenToImages;
272
281
  private globalListener;
273
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>;
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[]>;
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[]>;
279
288
  ensureConnection(): Promise<unknown>;
280
289
  private getSimilarImages;
281
290
  private getSingleMessage;
@@ -285,7 +294,7 @@ declare class RunwareBase {
285
294
  }
286
295
 
287
296
  declare class RunwareClient extends RunwareBase {
288
- constructor({ apiKey, url }: RunwareBaseType);
297
+ constructor(props: RunwareBaseType);
289
298
  }
290
299
 
291
300
  declare class RunwareServer extends RunwareBase {
@@ -294,7 +303,7 @@ declare class RunwareServer extends RunwareBase {
294
303
  _reconnectingIntervalId: null | any;
295
304
  _pingTimeout: any;
296
305
  _pongListener: any;
297
- constructor({ apiKey, url, shouldReconnect }: RunwareBaseType);
306
+ constructor(props: RunwareBaseType);
298
307
  protected connect(): Promise<void>;
299
308
  protected send: (msg: Object) => void;
300
309
  protected handleClose(): void;