@runware/sdk-js 1.1.17-beta.2 → 1.1.17-beta.3
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +27 -31
- package/dist/index.mjs +27 -31
- package/package.json +1 -1
- package/readme.md +26 -8
package/dist/index.d.mts
CHANGED
|
@@ -22,7 +22,7 @@ type RunwareBaseType = {
|
|
|
22
22
|
url?: string;
|
|
23
23
|
shouldReconnect?: boolean;
|
|
24
24
|
globalMaxRetries?: number;
|
|
25
|
-
|
|
25
|
+
timeoutDuration?: number;
|
|
26
26
|
};
|
|
27
27
|
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
28
28
|
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
@@ -263,8 +263,8 @@ declare class RunwareBase {
|
|
|
263
263
|
_sdkType: SdkType;
|
|
264
264
|
_shouldReconnect: boolean;
|
|
265
265
|
_globalMaxRetries: number;
|
|
266
|
-
|
|
267
|
-
constructor({ apiKey, url, shouldReconnect, globalMaxRetries,
|
|
266
|
+
_timeoutDuration: number;
|
|
267
|
+
constructor({ apiKey, url, shouldReconnect, globalMaxRetries, timeoutDuration, }: RunwareBaseType);
|
|
268
268
|
protected isWebsocketReadyState: () => boolean;
|
|
269
269
|
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
270
270
|
lis: (v: any) => any;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ type RunwareBaseType = {
|
|
|
22
22
|
url?: string;
|
|
23
23
|
shouldReconnect?: boolean;
|
|
24
24
|
globalMaxRetries?: number;
|
|
25
|
-
|
|
25
|
+
timeoutDuration?: number;
|
|
26
26
|
};
|
|
27
27
|
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
28
28
|
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
@@ -263,8 +263,8 @@ declare class RunwareBase {
|
|
|
263
263
|
_sdkType: SdkType;
|
|
264
264
|
_shouldReconnect: boolean;
|
|
265
265
|
_globalMaxRetries: number;
|
|
266
|
-
|
|
267
|
-
constructor({ apiKey, url, shouldReconnect, globalMaxRetries,
|
|
266
|
+
_timeoutDuration: number;
|
|
267
|
+
constructor({ apiKey, url, shouldReconnect, globalMaxRetries, timeoutDuration, }: RunwareBaseType);
|
|
268
268
|
protected isWebsocketReadyState: () => boolean;
|
|
269
269
|
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
270
270
|
lis: (v: any) => any;
|
package/dist/index.js
CHANGED
|
@@ -180,9 +180,9 @@ var require_reconnect = __commonJS({
|
|
|
180
180
|
};
|
|
181
181
|
log("init");
|
|
182
182
|
connect();
|
|
183
|
-
this.close = (code = 1e3, reason = "", { keepClosed = false, fastClose = true, delay:
|
|
184
|
-
if (
|
|
185
|
-
reconnectDelay =
|
|
183
|
+
this.close = (code = 1e3, reason = "", { keepClosed = false, fastClose = true, delay: delay3 = 0 } = {}) => {
|
|
184
|
+
if (delay3) {
|
|
185
|
+
reconnectDelay = delay3;
|
|
186
186
|
}
|
|
187
187
|
shouldRetry = !keepClosed;
|
|
188
188
|
ws.close(code, reason);
|
|
@@ -331,6 +331,7 @@ var EOpenPosePreProcessor = /* @__PURE__ */ ((EOpenPosePreProcessor2) => {
|
|
|
331
331
|
// Runware/utils.ts
|
|
332
332
|
var import_uuid = require("uuid");
|
|
333
333
|
var TIMEOUT_DURATION = 6e4;
|
|
334
|
+
var MINIMUM_TIMEOUT_DURATION = 1e3;
|
|
334
335
|
var POLLING_INTERVAL = 100;
|
|
335
336
|
var BASE_RUNWARE_URLS = {
|
|
336
337
|
["PRODUCTION" /* PRODUCTION */]: "wss://ws-api.runware.ai/v1",
|
|
@@ -348,9 +349,10 @@ var removeFromAray = (col, targetElem) => {
|
|
|
348
349
|
};
|
|
349
350
|
var getIntervalWithPromise = (callback, {
|
|
350
351
|
debugKey = "debugKey",
|
|
351
|
-
|
|
352
|
+
timeoutDuration = TIMEOUT_DURATION,
|
|
352
353
|
shouldThrowError = true
|
|
353
354
|
}) => {
|
|
355
|
+
timeoutDuration = timeoutDuration < MINIMUM_TIMEOUT_DURATION ? MINIMUM_TIMEOUT_DURATION : timeoutDuration;
|
|
354
356
|
return new Promise((resolve, reject) => {
|
|
355
357
|
const timeoutId = setTimeout(() => {
|
|
356
358
|
if (intervalId) {
|
|
@@ -360,7 +362,7 @@ var getIntervalWithPromise = (callback, {
|
|
|
360
362
|
}
|
|
361
363
|
}
|
|
362
364
|
clearTimeout(timeoutId);
|
|
363
|
-
},
|
|
365
|
+
}, timeoutDuration);
|
|
364
366
|
let intervalId = setInterval(async () => {
|
|
365
367
|
const shouldClear = callback({ resolve, reject, intervalId });
|
|
366
368
|
if (shouldClear) {
|
|
@@ -452,7 +454,7 @@ var RunwareBase = class {
|
|
|
452
454
|
url = BASE_RUNWARE_URLS.PRODUCTION,
|
|
453
455
|
shouldReconnect = true,
|
|
454
456
|
globalMaxRetries = 2,
|
|
455
|
-
|
|
457
|
+
timeoutDuration = TIMEOUT_DURATION
|
|
456
458
|
}) {
|
|
457
459
|
this._listeners = [];
|
|
458
460
|
// _globalMessages: any[] = [];
|
|
@@ -550,7 +552,7 @@ var RunwareBase = class {
|
|
|
550
552
|
},
|
|
551
553
|
{
|
|
552
554
|
debugKey: "unprocessed-image",
|
|
553
|
-
|
|
555
|
+
timeoutDuration: this._timeoutDuration
|
|
554
556
|
}
|
|
555
557
|
);
|
|
556
558
|
lis.destroy();
|
|
@@ -608,7 +610,7 @@ var RunwareBase = class {
|
|
|
608
610
|
},
|
|
609
611
|
{
|
|
610
612
|
debugKey: "remove-image-background",
|
|
611
|
-
|
|
613
|
+
timeoutDuration: this._timeoutDuration
|
|
612
614
|
}
|
|
613
615
|
);
|
|
614
616
|
lis.destroy();
|
|
@@ -688,7 +690,7 @@ var RunwareBase = class {
|
|
|
688
690
|
},
|
|
689
691
|
{
|
|
690
692
|
debugKey: "remove-image-background",
|
|
691
|
-
|
|
693
|
+
timeoutDuration: this._timeoutDuration
|
|
692
694
|
}
|
|
693
695
|
);
|
|
694
696
|
lis.destroy();
|
|
@@ -747,7 +749,7 @@ var RunwareBase = class {
|
|
|
747
749
|
return true;
|
|
748
750
|
}
|
|
749
751
|
},
|
|
750
|
-
{ debugKey: "upscale-gan",
|
|
752
|
+
{ debugKey: "upscale-gan", timeoutDuration: this._timeoutDuration }
|
|
751
753
|
);
|
|
752
754
|
lis.destroy();
|
|
753
755
|
return response;
|
|
@@ -804,7 +806,7 @@ var RunwareBase = class {
|
|
|
804
806
|
},
|
|
805
807
|
{
|
|
806
808
|
debugKey: "enhance-prompt",
|
|
807
|
-
|
|
809
|
+
timeoutDuration: this._timeoutDuration
|
|
808
810
|
}
|
|
809
811
|
);
|
|
810
812
|
lis.destroy();
|
|
@@ -840,7 +842,7 @@ var RunwareBase = class {
|
|
|
840
842
|
this._sdkType = "CLIENT" /* CLIENT */;
|
|
841
843
|
this._shouldReconnect = shouldReconnect;
|
|
842
844
|
this._globalMaxRetries = globalMaxRetries;
|
|
843
|
-
this.
|
|
845
|
+
this._timeoutDuration = timeoutDuration;
|
|
844
846
|
}
|
|
845
847
|
// protected addListener({
|
|
846
848
|
// lis,
|
|
@@ -912,7 +914,7 @@ var RunwareBase = class {
|
|
|
912
914
|
lis: (m) => {
|
|
913
915
|
var _a, _b;
|
|
914
916
|
if (m == null ? void 0 : m.error) {
|
|
915
|
-
this._invalidAPIkey =
|
|
917
|
+
this._invalidAPIkey = m;
|
|
916
918
|
return;
|
|
917
919
|
}
|
|
918
920
|
this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
|
|
@@ -1188,6 +1190,7 @@ var RunwareBase = class {
|
|
|
1188
1190
|
}
|
|
1189
1191
|
} catch (error) {
|
|
1190
1192
|
clearAllIntervals();
|
|
1193
|
+
console.log("afaf");
|
|
1191
1194
|
reject(error);
|
|
1192
1195
|
}
|
|
1193
1196
|
}, retryInterval);
|
|
@@ -1197,19 +1200,17 @@ var RunwareBase = class {
|
|
|
1197
1200
|
if (hasConnected) {
|
|
1198
1201
|
clearAllIntervals();
|
|
1199
1202
|
resolve(true);
|
|
1203
|
+
return;
|
|
1200
1204
|
}
|
|
1201
1205
|
if (!!this._invalidAPIkey) {
|
|
1202
1206
|
clearAllIntervals();
|
|
1203
|
-
reject(
|
|
1207
|
+
reject(this._invalidAPIkey);
|
|
1204
1208
|
return;
|
|
1205
1209
|
}
|
|
1206
1210
|
}, pollingInterval);
|
|
1207
1211
|
});
|
|
1208
|
-
if (!isConnected) {
|
|
1209
|
-
this.connect();
|
|
1210
|
-
await delay(2);
|
|
1211
|
-
}
|
|
1212
1212
|
} catch (e) {
|
|
1213
|
+
console.log("e", e);
|
|
1213
1214
|
throw (_a = this._invalidAPIkey) != null ? _a : "Could not connect to server. Ensure your API key is correct";
|
|
1214
1215
|
}
|
|
1215
1216
|
}
|
|
@@ -1243,7 +1244,7 @@ var RunwareBase = class {
|
|
|
1243
1244
|
{
|
|
1244
1245
|
debugKey: "getting images",
|
|
1245
1246
|
shouldThrowError,
|
|
1246
|
-
|
|
1247
|
+
timeoutDuration: this._timeoutDuration
|
|
1247
1248
|
}
|
|
1248
1249
|
);
|
|
1249
1250
|
}
|
|
@@ -1272,12 +1273,10 @@ var RunwareClient = class extends RunwareBase {
|
|
|
1272
1273
|
constructor(props) {
|
|
1273
1274
|
const _a = props, { shouldReconnect } = _a, rest = __objRest(_a, ["shouldReconnect"]);
|
|
1274
1275
|
super(rest);
|
|
1275
|
-
|
|
1276
|
-
this.
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
this.connect();
|
|
1280
|
-
}
|
|
1276
|
+
this._ws = new import_reconnect.default(
|
|
1277
|
+
this._url
|
|
1278
|
+
);
|
|
1279
|
+
this.connect();
|
|
1281
1280
|
}
|
|
1282
1281
|
};
|
|
1283
1282
|
|
|
@@ -1306,9 +1305,7 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1306
1305
|
}
|
|
1307
1306
|
};
|
|
1308
1307
|
this._sdkType = "SERVER" /* SERVER */;
|
|
1309
|
-
|
|
1310
|
-
this.connect();
|
|
1311
|
-
}
|
|
1308
|
+
this.connect();
|
|
1312
1309
|
}
|
|
1313
1310
|
// protected addListener({
|
|
1314
1311
|
// lis,
|
|
@@ -1370,7 +1367,7 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1370
1367
|
lis: (m) => {
|
|
1371
1368
|
var _a, _b;
|
|
1372
1369
|
if (m == null ? void 0 : m.error) {
|
|
1373
|
-
this._invalidAPIkey =
|
|
1370
|
+
this._invalidAPIkey = m;
|
|
1374
1371
|
return;
|
|
1375
1372
|
}
|
|
1376
1373
|
this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
|
|
@@ -1393,8 +1390,7 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1393
1390
|
}
|
|
1394
1391
|
handleClose() {
|
|
1395
1392
|
if (this._invalidAPIkey) {
|
|
1396
|
-
|
|
1397
|
-
return;
|
|
1393
|
+
throw this._invalidAPIkey;
|
|
1398
1394
|
}
|
|
1399
1395
|
if (this._reconnectingIntervalId) {
|
|
1400
1396
|
clearInterval(this._reconnectingIntervalId);
|
package/dist/index.mjs
CHANGED
|
@@ -174,9 +174,9 @@ var require_reconnect = __commonJS({
|
|
|
174
174
|
};
|
|
175
175
|
log("init");
|
|
176
176
|
connect();
|
|
177
|
-
this.close = (code = 1e3, reason = "", { keepClosed = false, fastClose = true, delay:
|
|
178
|
-
if (
|
|
179
|
-
reconnectDelay =
|
|
177
|
+
this.close = (code = 1e3, reason = "", { keepClosed = false, fastClose = true, delay: delay3 = 0 } = {}) => {
|
|
178
|
+
if (delay3) {
|
|
179
|
+
reconnectDelay = delay3;
|
|
180
180
|
}
|
|
181
181
|
shouldRetry = !keepClosed;
|
|
182
182
|
ws.close(code, reason);
|
|
@@ -309,6 +309,7 @@ var EOpenPosePreProcessor = /* @__PURE__ */ ((EOpenPosePreProcessor2) => {
|
|
|
309
309
|
// Runware/utils.ts
|
|
310
310
|
import { v4 as uuidv4, validate as validateUUID } from "uuid";
|
|
311
311
|
var TIMEOUT_DURATION = 6e4;
|
|
312
|
+
var MINIMUM_TIMEOUT_DURATION = 1e3;
|
|
312
313
|
var POLLING_INTERVAL = 100;
|
|
313
314
|
var BASE_RUNWARE_URLS = {
|
|
314
315
|
["PRODUCTION" /* PRODUCTION */]: "wss://ws-api.runware.ai/v1",
|
|
@@ -326,9 +327,10 @@ var removeFromAray = (col, targetElem) => {
|
|
|
326
327
|
};
|
|
327
328
|
var getIntervalWithPromise = (callback, {
|
|
328
329
|
debugKey = "debugKey",
|
|
329
|
-
|
|
330
|
+
timeoutDuration = TIMEOUT_DURATION,
|
|
330
331
|
shouldThrowError = true
|
|
331
332
|
}) => {
|
|
333
|
+
timeoutDuration = timeoutDuration < MINIMUM_TIMEOUT_DURATION ? MINIMUM_TIMEOUT_DURATION : timeoutDuration;
|
|
332
334
|
return new Promise((resolve, reject) => {
|
|
333
335
|
const timeoutId = setTimeout(() => {
|
|
334
336
|
if (intervalId) {
|
|
@@ -338,7 +340,7 @@ var getIntervalWithPromise = (callback, {
|
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
342
|
clearTimeout(timeoutId);
|
|
341
|
-
},
|
|
343
|
+
}, timeoutDuration);
|
|
342
344
|
let intervalId = setInterval(async () => {
|
|
343
345
|
const shouldClear = callback({ resolve, reject, intervalId });
|
|
344
346
|
if (shouldClear) {
|
|
@@ -430,7 +432,7 @@ var RunwareBase = class {
|
|
|
430
432
|
url = BASE_RUNWARE_URLS.PRODUCTION,
|
|
431
433
|
shouldReconnect = true,
|
|
432
434
|
globalMaxRetries = 2,
|
|
433
|
-
|
|
435
|
+
timeoutDuration = TIMEOUT_DURATION
|
|
434
436
|
}) {
|
|
435
437
|
this._listeners = [];
|
|
436
438
|
// _globalMessages: any[] = [];
|
|
@@ -528,7 +530,7 @@ var RunwareBase = class {
|
|
|
528
530
|
},
|
|
529
531
|
{
|
|
530
532
|
debugKey: "unprocessed-image",
|
|
531
|
-
|
|
533
|
+
timeoutDuration: this._timeoutDuration
|
|
532
534
|
}
|
|
533
535
|
);
|
|
534
536
|
lis.destroy();
|
|
@@ -586,7 +588,7 @@ var RunwareBase = class {
|
|
|
586
588
|
},
|
|
587
589
|
{
|
|
588
590
|
debugKey: "remove-image-background",
|
|
589
|
-
|
|
591
|
+
timeoutDuration: this._timeoutDuration
|
|
590
592
|
}
|
|
591
593
|
);
|
|
592
594
|
lis.destroy();
|
|
@@ -666,7 +668,7 @@ var RunwareBase = class {
|
|
|
666
668
|
},
|
|
667
669
|
{
|
|
668
670
|
debugKey: "remove-image-background",
|
|
669
|
-
|
|
671
|
+
timeoutDuration: this._timeoutDuration
|
|
670
672
|
}
|
|
671
673
|
);
|
|
672
674
|
lis.destroy();
|
|
@@ -725,7 +727,7 @@ var RunwareBase = class {
|
|
|
725
727
|
return true;
|
|
726
728
|
}
|
|
727
729
|
},
|
|
728
|
-
{ debugKey: "upscale-gan",
|
|
730
|
+
{ debugKey: "upscale-gan", timeoutDuration: this._timeoutDuration }
|
|
729
731
|
);
|
|
730
732
|
lis.destroy();
|
|
731
733
|
return response;
|
|
@@ -782,7 +784,7 @@ var RunwareBase = class {
|
|
|
782
784
|
},
|
|
783
785
|
{
|
|
784
786
|
debugKey: "enhance-prompt",
|
|
785
|
-
|
|
787
|
+
timeoutDuration: this._timeoutDuration
|
|
786
788
|
}
|
|
787
789
|
);
|
|
788
790
|
lis.destroy();
|
|
@@ -818,7 +820,7 @@ var RunwareBase = class {
|
|
|
818
820
|
this._sdkType = "CLIENT" /* CLIENT */;
|
|
819
821
|
this._shouldReconnect = shouldReconnect;
|
|
820
822
|
this._globalMaxRetries = globalMaxRetries;
|
|
821
|
-
this.
|
|
823
|
+
this._timeoutDuration = timeoutDuration;
|
|
822
824
|
}
|
|
823
825
|
// protected addListener({
|
|
824
826
|
// lis,
|
|
@@ -890,7 +892,7 @@ var RunwareBase = class {
|
|
|
890
892
|
lis: (m) => {
|
|
891
893
|
var _a, _b;
|
|
892
894
|
if (m == null ? void 0 : m.error) {
|
|
893
|
-
this._invalidAPIkey =
|
|
895
|
+
this._invalidAPIkey = m;
|
|
894
896
|
return;
|
|
895
897
|
}
|
|
896
898
|
this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
|
|
@@ -1166,6 +1168,7 @@ var RunwareBase = class {
|
|
|
1166
1168
|
}
|
|
1167
1169
|
} catch (error) {
|
|
1168
1170
|
clearAllIntervals();
|
|
1171
|
+
console.log("afaf");
|
|
1169
1172
|
reject(error);
|
|
1170
1173
|
}
|
|
1171
1174
|
}, retryInterval);
|
|
@@ -1175,19 +1178,17 @@ var RunwareBase = class {
|
|
|
1175
1178
|
if (hasConnected) {
|
|
1176
1179
|
clearAllIntervals();
|
|
1177
1180
|
resolve(true);
|
|
1181
|
+
return;
|
|
1178
1182
|
}
|
|
1179
1183
|
if (!!this._invalidAPIkey) {
|
|
1180
1184
|
clearAllIntervals();
|
|
1181
|
-
reject(
|
|
1185
|
+
reject(this._invalidAPIkey);
|
|
1182
1186
|
return;
|
|
1183
1187
|
}
|
|
1184
1188
|
}, pollingInterval);
|
|
1185
1189
|
});
|
|
1186
|
-
if (!isConnected) {
|
|
1187
|
-
this.connect();
|
|
1188
|
-
await delay(2);
|
|
1189
|
-
}
|
|
1190
1190
|
} catch (e) {
|
|
1191
|
+
console.log("e", e);
|
|
1191
1192
|
throw (_a = this._invalidAPIkey) != null ? _a : "Could not connect to server. Ensure your API key is correct";
|
|
1192
1193
|
}
|
|
1193
1194
|
}
|
|
@@ -1221,7 +1222,7 @@ var RunwareBase = class {
|
|
|
1221
1222
|
{
|
|
1222
1223
|
debugKey: "getting images",
|
|
1223
1224
|
shouldThrowError,
|
|
1224
|
-
|
|
1225
|
+
timeoutDuration: this._timeoutDuration
|
|
1225
1226
|
}
|
|
1226
1227
|
);
|
|
1227
1228
|
}
|
|
@@ -1250,12 +1251,10 @@ var RunwareClient = class extends RunwareBase {
|
|
|
1250
1251
|
constructor(props) {
|
|
1251
1252
|
const _a = props, { shouldReconnect } = _a, rest = __objRest(_a, ["shouldReconnect"]);
|
|
1252
1253
|
super(rest);
|
|
1253
|
-
|
|
1254
|
-
this.
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
this.connect();
|
|
1258
|
-
}
|
|
1254
|
+
this._ws = new import_reconnect.default(
|
|
1255
|
+
this._url
|
|
1256
|
+
);
|
|
1257
|
+
this.connect();
|
|
1259
1258
|
}
|
|
1260
1259
|
};
|
|
1261
1260
|
|
|
@@ -1284,9 +1283,7 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1284
1283
|
}
|
|
1285
1284
|
};
|
|
1286
1285
|
this._sdkType = "SERVER" /* SERVER */;
|
|
1287
|
-
|
|
1288
|
-
this.connect();
|
|
1289
|
-
}
|
|
1286
|
+
this.connect();
|
|
1290
1287
|
}
|
|
1291
1288
|
// protected addListener({
|
|
1292
1289
|
// lis,
|
|
@@ -1348,7 +1345,7 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1348
1345
|
lis: (m) => {
|
|
1349
1346
|
var _a, _b;
|
|
1350
1347
|
if (m == null ? void 0 : m.error) {
|
|
1351
|
-
this._invalidAPIkey =
|
|
1348
|
+
this._invalidAPIkey = m;
|
|
1352
1349
|
return;
|
|
1353
1350
|
}
|
|
1354
1351
|
this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
|
|
@@ -1371,8 +1368,7 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1371
1368
|
}
|
|
1372
1369
|
handleClose() {
|
|
1373
1370
|
if (this._invalidAPIkey) {
|
|
1374
|
-
|
|
1375
|
-
return;
|
|
1371
|
+
throw this._invalidAPIkey;
|
|
1376
1372
|
}
|
|
1377
1373
|
if (this._reconnectingIntervalId) {
|
|
1378
1374
|
clearInterval(this._reconnectingIntervalId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runware/sdk-js",
|
|
3
|
-
"version": "1.1.17-beta.
|
|
3
|
+
"version": "1.1.17-beta.3",
|
|
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
|
@@ -32,13 +32,31 @@ const runware = new Runware({ apiKey: "API_KEY" });
|
|
|
32
32
|
const runware = new RunwareServer({ apiKey: "API_KEY" });
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
| Parameter | Type
|
|
36
|
-
| ---------------- |
|
|
37
|
-
| url | string
|
|
38
|
-
| apiKey | string
|
|
39
|
-
| shouldReconnect | boolean `(default = true)`
|
|
40
|
-
| globalMaxRetries | number `(default = 2)`
|
|
41
|
-
|
|
|
35
|
+
| Parameter | Type | Use |
|
|
36
|
+
| ---------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| url | string | Url to get images from (optional) |
|
|
38
|
+
| apiKey | string | The environment api key |
|
|
39
|
+
| shouldReconnect | boolean `(default = true)` | This handles reconnection when there is websocket inactivity |
|
|
40
|
+
| globalMaxRetries | number `(default = 2)` | The number of retries it should make before throwing an error `(NB: you can specify a retry parameters for every request that overrides the global retry)` |
|
|
41
|
+
| timeoutDuration | number (in milliseconds) `(default = 60000)` | The timeout span per retry before timing out |
|
|
42
|
+
|
|
43
|
+
## Methods
|
|
44
|
+
|
|
45
|
+
### Ensure connection is established before making request
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const runware = new RunwareServer({ apiKey: "API_KEY" });
|
|
49
|
+
|
|
50
|
+
await runware.ensureConnection();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Manually disconnect
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
const runware = new RunwareServer({ apiKey: "API_KEY" });
|
|
57
|
+
|
|
58
|
+
await runware.disconnect();
|
|
59
|
+
```
|
|
42
60
|
|
|
43
61
|
## API
|
|
44
62
|
|
|
@@ -375,7 +393,7 @@ return interface IControlNetImage {
|
|
|
375
393
|
**Added or Changed**
|
|
376
394
|
|
|
377
395
|
- Add Global Max Retry and Retry count per request
|
|
378
|
-
- Add
|
|
396
|
+
- Add Global timeout duration
|
|
379
397
|
|
|
380
398
|
### - v1.1.16/v1.1.17
|
|
381
399
|
|