@runware/sdk-js 1.1.5 → 1.1.7

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
@@ -34,6 +34,10 @@ interface IImage {
34
34
  NSFWContent?: boolean;
35
35
  cost?: number;
36
36
  }
37
+ interface ITextToImage extends IImage {
38
+ positivePrompt?: string;
39
+ negativePrompt?: string;
40
+ }
37
41
  interface IControlNetImage {
38
42
  taskUUID: string;
39
43
  inputImageUUID: string;
@@ -110,6 +114,7 @@ interface IRequestImage {
110
114
  customTaskUUID?: string;
111
115
  useCache?: boolean;
112
116
  onPartialImages?: (images: IImage[], error?: IError) => void;
117
+ retry?: number;
113
118
  }
114
119
  interface IRequestImageToText {
115
120
  inputImage?: File | string;
@@ -266,10 +271,12 @@ declare class RunwareBase {
266
271
  protected send: (msg: Object) => any;
267
272
  private destroy;
268
273
  private uploadImage;
269
- listenToImages({ onPartialImages, taskUUID, groupKey, }: {
274
+ listenToImages({ onPartialImages, taskUUID, groupKey, positivePrompt, negativePrompt, }: {
270
275
  taskUUID: string;
271
276
  onPartialImages?: (images: IImage[], error?: any) => void;
272
277
  groupKey: LISTEN_TO_IMAGES_KEY;
278
+ positivePrompt?: string;
279
+ negativePrompt?: string;
273
280
  }): {
274
281
  destroy: () => void;
275
282
  };
@@ -278,7 +285,7 @@ declare class RunwareBase {
278
285
  }): {
279
286
  destroy: () => void;
280
287
  };
281
- requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, useCache, onPartialImages, includeCost, customTaskUUID, }: IRequestImage): Promise<IImage[] | undefined>;
288
+ requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, useCache, onPartialImages, includeCost, customTaskUUID, retry, }: IRequestImage): Promise<ITextToImage[] | undefined>;
282
289
  controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
283
290
  requestImageToText: ({ inputImage, includeCost, customTaskUUID, }: IRequestImageToText) => Promise<IImageToText>;
284
291
  removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, }: IRemoveImageBackground) => Promise<IRemoveImage[]>;
@@ -318,4 +325,4 @@ declare class RunwareServer extends RunwareBase {
318
325
  protected heartBeat(): void;
319
326
  }
320
327
 
321
- export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareServer, SdkType, UploadImageType };
328
+ 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, RunwareServer, SdkType, UploadImageType };
package/dist/index.d.ts CHANGED
@@ -34,6 +34,10 @@ interface IImage {
34
34
  NSFWContent?: boolean;
35
35
  cost?: number;
36
36
  }
37
+ interface ITextToImage extends IImage {
38
+ positivePrompt?: string;
39
+ negativePrompt?: string;
40
+ }
37
41
  interface IControlNetImage {
38
42
  taskUUID: string;
39
43
  inputImageUUID: string;
@@ -110,6 +114,7 @@ interface IRequestImage {
110
114
  customTaskUUID?: string;
111
115
  useCache?: boolean;
112
116
  onPartialImages?: (images: IImage[], error?: IError) => void;
117
+ retry?: number;
113
118
  }
114
119
  interface IRequestImageToText {
115
120
  inputImage?: File | string;
@@ -266,10 +271,12 @@ declare class RunwareBase {
266
271
  protected send: (msg: Object) => any;
267
272
  private destroy;
268
273
  private uploadImage;
269
- listenToImages({ onPartialImages, taskUUID, groupKey, }: {
274
+ listenToImages({ onPartialImages, taskUUID, groupKey, positivePrompt, negativePrompt, }: {
270
275
  taskUUID: string;
271
276
  onPartialImages?: (images: IImage[], error?: any) => void;
272
277
  groupKey: LISTEN_TO_IMAGES_KEY;
278
+ positivePrompt?: string;
279
+ negativePrompt?: string;
273
280
  }): {
274
281
  destroy: () => void;
275
282
  };
@@ -278,7 +285,7 @@ declare class RunwareBase {
278
285
  }): {
279
286
  destroy: () => void;
280
287
  };
281
- requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, useCache, onPartialImages, includeCost, customTaskUUID, }: IRequestImage): Promise<IImage[] | undefined>;
288
+ requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, useCache, onPartialImages, includeCost, customTaskUUID, retry, }: IRequestImage): Promise<ITextToImage[] | undefined>;
282
289
  controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
283
290
  requestImageToText: ({ inputImage, includeCost, customTaskUUID, }: IRequestImageToText) => Promise<IImageToText>;
284
291
  removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, }: IRemoveImageBackground) => Promise<IRemoveImage[]>;
@@ -318,4 +325,4 @@ declare class RunwareServer extends RunwareBase {
318
325
  protected heartBeat(): void;
319
326
  }
320
327
 
321
- export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareServer, SdkType, UploadImageType };
328
+ 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, RunwareServer, SdkType, UploadImageType };
package/dist/index.js CHANGED
@@ -842,9 +842,7 @@ var RunwareBase = class {
842
842
  lis: (m) => {
843
843
  var _a, _b;
844
844
  if (m == null ? void 0 : m.error) {
845
- if (m.errorId === 19) {
846
- this._invalidAPIkey = "Invalid API key";
847
- }
845
+ this._invalidAPIkey = "Invalid API key";
848
846
  return;
849
847
  }
850
848
  this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
@@ -874,15 +872,21 @@ var RunwareBase = class {
874
872
  listenToImages({
875
873
  onPartialImages,
876
874
  taskUUID,
877
- groupKey
875
+ groupKey,
876
+ positivePrompt,
877
+ negativePrompt
878
878
  }) {
879
879
  return this.addListener({
880
880
  taskUUID,
881
881
  lis: (m) => {
882
882
  var _a, _b;
883
- const images = (_a = m == null ? void 0 : m[taskUUID]) == null ? void 0 : _a.filter(
883
+ let images = (_a = m == null ? void 0 : m[taskUUID]) == null ? void 0 : _a.filter(
884
884
  (img) => img.taskUUID === taskUUID
885
885
  );
886
+ images = images.map((image) => __spreadProps(__spreadValues({}, image), {
887
+ positivePrompt,
888
+ negativePrompt
889
+ }));
886
890
  onPartialImages == null ? void 0 : onPartialImages(images, (m == null ? void 0 : m.error) && m);
887
891
  if (m.error) {
888
892
  this._globalError = m;
@@ -890,7 +894,10 @@ var RunwareBase = class {
890
894
  if (this._sdkType === "CLIENT" /* CLIENT */) {
891
895
  this._globalImages = [
892
896
  ...this._globalImages,
893
- ...(_b = m == null ? void 0 : m[taskUUID]) != null ? _b : []
897
+ ...((_b = m == null ? void 0 : m[taskUUID]) != null ? _b : []).map((image) => __spreadProps(__spreadValues({}, image), {
898
+ positivePrompt,
899
+ negativePrompt
900
+ }))
894
901
  ];
895
902
  } else {
896
903
  this._globalImages = [...this._globalImages, ...images];
@@ -961,8 +968,10 @@ var RunwareBase = class {
961
968
  useCache,
962
969
  onPartialImages,
963
970
  includeCost,
964
- customTaskUUID
971
+ customTaskUUID,
972
+ retry = 2
965
973
  }) {
974
+ await this.ensureConnection();
966
975
  let lis = void 0;
967
976
  let requestObject = void 0;
968
977
  let taskUUIDs = [];
@@ -1049,7 +1058,9 @@ var RunwareBase = class {
1049
1058
  lis = this.listenToImages({
1050
1059
  onPartialImages,
1051
1060
  taskUUID,
1052
- groupKey: "REQUEST_IMAGES" /* REQUEST_IMAGES */
1061
+ groupKey: "REQUEST_IMAGES" /* REQUEST_IMAGES */,
1062
+ positivePrompt,
1063
+ negativePrompt
1053
1064
  });
1054
1065
  const promise = await this.getSimilarImages({
1055
1066
  taskUUID: taskUUIDs,
@@ -1059,14 +1070,14 @@ var RunwareBase = class {
1059
1070
  return promise;
1060
1071
  },
1061
1072
  {
1062
- maxRetries: 2,
1073
+ maxRetries: retry,
1063
1074
  callback: () => {
1064
1075
  lis == null ? void 0 : lis.destroy();
1065
1076
  }
1066
1077
  }
1067
1078
  );
1068
1079
  } catch (e) {
1069
- if (retryCount >= 2) {
1080
+ if (retryCount >= retry) {
1070
1081
  return this.handleIncompleteImages({ taskUUIDs, error: e });
1071
1082
  }
1072
1083
  }
@@ -1076,31 +1087,52 @@ var RunwareBase = class {
1076
1087
  let isConnected = this.connected();
1077
1088
  if (isConnected || this._url === BASE_RUNWARE_URLS.TEST)
1078
1089
  return;
1079
- const interval = 200;
1090
+ const retryInterval = 2e3;
1091
+ const pollingInterval = 200;
1080
1092
  try {
1081
1093
  if (this._invalidAPIkey)
1082
1094
  throw this._invalidAPIkey;
1083
1095
  return new Promise((resolve, reject) => {
1084
1096
  let retry = 0;
1085
- const MAX_RETRY = 2;
1086
- const intervalId = setInterval(async () => {
1087
- try {
1088
- const hasConnected = this.connected();
1089
- if (hasConnected) {
1090
- clearInterval(intervalId);
1091
- resolve(true);
1092
- } else if (retry >= MAX_RETRY) {
1093
- clearInterval(intervalId);
1094
- reject(new Error("Polling timed out"));
1095
- } else {
1096
- this.connect();
1097
- retry++;
1097
+ const MAX_RETRY = 10;
1098
+ let retryIntervalId;
1099
+ let pollingIntervalId;
1100
+ const clearAllIntervals = () => {
1101
+ clearInterval(retryIntervalId);
1102
+ clearInterval(pollingIntervalId);
1103
+ };
1104
+ if (this._sdkType === "SERVER" /* SERVER */) {
1105
+ retryIntervalId = setInterval(async () => {
1106
+ try {
1107
+ const hasConnected = this.connected();
1108
+ if (hasConnected) {
1109
+ clearAllIntervals();
1110
+ resolve(true);
1111
+ } else if (retry >= MAX_RETRY) {
1112
+ clearAllIntervals();
1113
+ reject(new Error("Retry timed out"));
1114
+ } else {
1115
+ this.connect();
1116
+ retry++;
1117
+ }
1118
+ } catch (error) {
1119
+ clearAllIntervals();
1120
+ reject(error);
1098
1121
  }
1099
- } catch (error) {
1100
- clearInterval(intervalId);
1101
- reject(error);
1122
+ }, retryInterval);
1123
+ }
1124
+ pollingIntervalId = setInterval(async () => {
1125
+ const hasConnected = this.connected();
1126
+ if (hasConnected) {
1127
+ clearAllIntervals();
1128
+ resolve(true);
1129
+ }
1130
+ if (!!this._invalidAPIkey) {
1131
+ clearAllIntervals();
1132
+ reject(new Error("Invalid API key"));
1133
+ return;
1102
1134
  }
1103
- }, interval);
1135
+ }, pollingInterval);
1104
1136
  });
1105
1137
  if (!isConnected) {
1106
1138
  this.connect();
@@ -1220,7 +1252,6 @@ var RunwareServer = class extends RunwareBase {
1220
1252
  this._ws = new import_ws.default(this._url, {
1221
1253
  perMessageDeflate: false
1222
1254
  });
1223
- delay(1);
1224
1255
  this._ws.on("error", () => {
1225
1256
  });
1226
1257
  this._ws.on("close", () => this.handleClose());
@@ -1247,9 +1278,7 @@ var RunwareServer = class extends RunwareBase {
1247
1278
  lis: (m) => {
1248
1279
  var _a, _b;
1249
1280
  if (m == null ? void 0 : m.error) {
1250
- if (m.errorId === 19) {
1251
- this._invalidAPIkey = "Invalid API key";
1252
- }
1281
+ this._invalidAPIkey = "Invalid API key";
1253
1282
  return;
1254
1283
  }
1255
1284
  this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
package/dist/index.mjs CHANGED
@@ -821,9 +821,7 @@ var RunwareBase = class {
821
821
  lis: (m) => {
822
822
  var _a, _b;
823
823
  if (m == null ? void 0 : m.error) {
824
- if (m.errorId === 19) {
825
- this._invalidAPIkey = "Invalid API key";
826
- }
824
+ this._invalidAPIkey = "Invalid API key";
827
825
  return;
828
826
  }
829
827
  this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
@@ -853,15 +851,21 @@ var RunwareBase = class {
853
851
  listenToImages({
854
852
  onPartialImages,
855
853
  taskUUID,
856
- groupKey
854
+ groupKey,
855
+ positivePrompt,
856
+ negativePrompt
857
857
  }) {
858
858
  return this.addListener({
859
859
  taskUUID,
860
860
  lis: (m) => {
861
861
  var _a, _b;
862
- const images = (_a = m == null ? void 0 : m[taskUUID]) == null ? void 0 : _a.filter(
862
+ let images = (_a = m == null ? void 0 : m[taskUUID]) == null ? void 0 : _a.filter(
863
863
  (img) => img.taskUUID === taskUUID
864
864
  );
865
+ images = images.map((image) => __spreadProps(__spreadValues({}, image), {
866
+ positivePrompt,
867
+ negativePrompt
868
+ }));
865
869
  onPartialImages == null ? void 0 : onPartialImages(images, (m == null ? void 0 : m.error) && m);
866
870
  if (m.error) {
867
871
  this._globalError = m;
@@ -869,7 +873,10 @@ var RunwareBase = class {
869
873
  if (this._sdkType === "CLIENT" /* CLIENT */) {
870
874
  this._globalImages = [
871
875
  ...this._globalImages,
872
- ...(_b = m == null ? void 0 : m[taskUUID]) != null ? _b : []
876
+ ...((_b = m == null ? void 0 : m[taskUUID]) != null ? _b : []).map((image) => __spreadProps(__spreadValues({}, image), {
877
+ positivePrompt,
878
+ negativePrompt
879
+ }))
873
880
  ];
874
881
  } else {
875
882
  this._globalImages = [...this._globalImages, ...images];
@@ -940,8 +947,10 @@ var RunwareBase = class {
940
947
  useCache,
941
948
  onPartialImages,
942
949
  includeCost,
943
- customTaskUUID
950
+ customTaskUUID,
951
+ retry = 2
944
952
  }) {
953
+ await this.ensureConnection();
945
954
  let lis = void 0;
946
955
  let requestObject = void 0;
947
956
  let taskUUIDs = [];
@@ -1028,7 +1037,9 @@ var RunwareBase = class {
1028
1037
  lis = this.listenToImages({
1029
1038
  onPartialImages,
1030
1039
  taskUUID,
1031
- groupKey: "REQUEST_IMAGES" /* REQUEST_IMAGES */
1040
+ groupKey: "REQUEST_IMAGES" /* REQUEST_IMAGES */,
1041
+ positivePrompt,
1042
+ negativePrompt
1032
1043
  });
1033
1044
  const promise = await this.getSimilarImages({
1034
1045
  taskUUID: taskUUIDs,
@@ -1038,14 +1049,14 @@ var RunwareBase = class {
1038
1049
  return promise;
1039
1050
  },
1040
1051
  {
1041
- maxRetries: 2,
1052
+ maxRetries: retry,
1042
1053
  callback: () => {
1043
1054
  lis == null ? void 0 : lis.destroy();
1044
1055
  }
1045
1056
  }
1046
1057
  );
1047
1058
  } catch (e) {
1048
- if (retryCount >= 2) {
1059
+ if (retryCount >= retry) {
1049
1060
  return this.handleIncompleteImages({ taskUUIDs, error: e });
1050
1061
  }
1051
1062
  }
@@ -1055,31 +1066,52 @@ var RunwareBase = class {
1055
1066
  let isConnected = this.connected();
1056
1067
  if (isConnected || this._url === BASE_RUNWARE_URLS.TEST)
1057
1068
  return;
1058
- const interval = 200;
1069
+ const retryInterval = 2e3;
1070
+ const pollingInterval = 200;
1059
1071
  try {
1060
1072
  if (this._invalidAPIkey)
1061
1073
  throw this._invalidAPIkey;
1062
1074
  return new Promise((resolve, reject) => {
1063
1075
  let retry = 0;
1064
- const MAX_RETRY = 2;
1065
- const intervalId = setInterval(async () => {
1066
- try {
1067
- const hasConnected = this.connected();
1068
- if (hasConnected) {
1069
- clearInterval(intervalId);
1070
- resolve(true);
1071
- } else if (retry >= MAX_RETRY) {
1072
- clearInterval(intervalId);
1073
- reject(new Error("Polling timed out"));
1074
- } else {
1075
- this.connect();
1076
- retry++;
1076
+ const MAX_RETRY = 10;
1077
+ let retryIntervalId;
1078
+ let pollingIntervalId;
1079
+ const clearAllIntervals = () => {
1080
+ clearInterval(retryIntervalId);
1081
+ clearInterval(pollingIntervalId);
1082
+ };
1083
+ if (this._sdkType === "SERVER" /* SERVER */) {
1084
+ retryIntervalId = setInterval(async () => {
1085
+ try {
1086
+ const hasConnected = this.connected();
1087
+ if (hasConnected) {
1088
+ clearAllIntervals();
1089
+ resolve(true);
1090
+ } else if (retry >= MAX_RETRY) {
1091
+ clearAllIntervals();
1092
+ reject(new Error("Retry timed out"));
1093
+ } else {
1094
+ this.connect();
1095
+ retry++;
1096
+ }
1097
+ } catch (error) {
1098
+ clearAllIntervals();
1099
+ reject(error);
1077
1100
  }
1078
- } catch (error) {
1079
- clearInterval(intervalId);
1080
- reject(error);
1101
+ }, retryInterval);
1102
+ }
1103
+ pollingIntervalId = setInterval(async () => {
1104
+ const hasConnected = this.connected();
1105
+ if (hasConnected) {
1106
+ clearAllIntervals();
1107
+ resolve(true);
1108
+ }
1109
+ if (!!this._invalidAPIkey) {
1110
+ clearAllIntervals();
1111
+ reject(new Error("Invalid API key"));
1112
+ return;
1081
1113
  }
1082
- }, interval);
1114
+ }, pollingInterval);
1083
1115
  });
1084
1116
  if (!isConnected) {
1085
1117
  this.connect();
@@ -1199,7 +1231,6 @@ var RunwareServer = class extends RunwareBase {
1199
1231
  this._ws = new WebSocket2(this._url, {
1200
1232
  perMessageDeflate: false
1201
1233
  });
1202
- delay(1);
1203
1234
  this._ws.on("error", () => {
1204
1235
  });
1205
1236
  this._ws.on("close", () => this.handleClose());
@@ -1226,9 +1257,7 @@ var RunwareServer = class extends RunwareBase {
1226
1257
  lis: (m) => {
1227
1258
  var _a, _b;
1228
1259
  if (m == null ? void 0 : m.error) {
1229
- if (m.errorId === 19) {
1230
- this._invalidAPIkey = "Invalid API key";
1231
- }
1260
+ this._invalidAPIkey = "Invalid API key";
1232
1261
  return;
1233
1262
  }
1234
1263
  this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runware/sdk-js",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "The SDK is used to run image inference with the Runware API, powered by the RunWare inference platform. It can be used to generate imaged with text-to-image and image-to-image. It also allows the use of an existing gallery of models or selecting any model or LoRA from the CivitAI gallery. The API also supports upscaling, background removal, inpainting and outpainting, and a series of other ControlNet models.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/readme.md CHANGED
@@ -13,13 +13,13 @@ For an API Key and free trial credits, [create a free account](https://my.runwar
13
13
  To install and set up the library, run:
14
14
 
15
15
  ```sh
16
- $ npm install runware-sdk
16
+ $ npm install @runware/sdk-js
17
17
  ```
18
18
 
19
19
  Or if you prefer using Yarn:
20
20
 
21
21
  ```sh
22
- $ yarn add runware-sdk
22
+ $ yarn add @runware/sdk-js
23
23
  ```
24
24
 
25
25
  ## Instantiating the SDK
@@ -44,6 +44,8 @@ const runware = new RunwareServer({ apiKey: "API_KEY" });
44
44
  NB: All errors can be caught in the catch block of each request
45
45
 
46
46
  ```js
47
+ import { Runware } from "@runware/sdk-js";
48
+
47
49
  const runware = new Runware({ apiKey: "API_KEY" });
48
50
  const images = await runware.requestImages({
49
51
  positivePrompt: string;
@@ -67,13 +69,15 @@ const images = await runware.requestImages({
67
69
  usePromptWeighting?: number;
68
70
  controlNet?: IControlNet[];
69
71
  lora?: ILora[];
72
+ retry?: number;
73
+
70
74
 
71
75
  useCache?: boolean;
72
76
  returnBase64Image?: boolean;
73
77
  onPartialImages?: (images: IImage[], error: IError) => void;
74
78
  })
75
79
 
76
- return interface IImage {
80
+ return interface ITextToImage {
77
81
  taskType: ETaskType;
78
82
  imageUUID: string;
79
83
  inputImageUUID?: string;
@@ -83,6 +87,8 @@ return interface IImage {
83
87
  imageDataURI?: string;
84
88
  NSFWContent?: boolean;
85
89
  cost: number;
90
+ positivePrompt?: string;
91
+ negativePrompt?: string;
86
92
  }[]
87
93
  ```
88
94
 
@@ -113,7 +119,7 @@ const [firstImagesRequest, secondImagesRequest] = await Promise.all([
113
119
 
114
120
  console.log({firstImagesRequest, secondImagesRequest})
115
121
 
116
- return interface IImage {
122
+ return interface ITextToImage {
117
123
  taskType: ETaskType;
118
124
  imageUUID: string;
119
125
  inputImageUUID?: string;
@@ -123,6 +129,8 @@ return interface IImage {
123
129
  imageDataURI?: string;
124
130
  NSFWContent?: boolean;
125
131
  cost: number;
132
+ positivePrompt?: string;
133
+ negativePrompt?: string;
126
134
  }[]
127
135
  ```
128
136
 
@@ -356,6 +364,20 @@ return interface IControlNetImage {
356
364
 
357
365
  ## Changelog
358
366
 
367
+ ### - v1.1.6
368
+
369
+ **Added or Changed**
370
+
371
+ - Fix slow connection time
372
+ - Fix invalid api key error message
373
+ - Return prompt for images generated
374
+
375
+ ### - v1.1.6
376
+
377
+ **Added or Changed**
378
+
379
+ - Add connection retry to runware server
380
+
359
381
  ### - v1.1.5
360
382
 
361
383
  **Added or Changed**