@runware/sdk-js 1.0.29 → 1.1.0
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 +118 -61
- package/dist/index.d.ts +118 -61
- package/dist/index.js +278 -338
- package/dist/index.mjs +277 -338
- package/package.json +2 -2
- package/readme.md +193 -73
package/dist/index.mjs
CHANGED
|
@@ -223,6 +223,17 @@ var SdkType = /* @__PURE__ */ ((SdkType2) => {
|
|
|
223
223
|
SdkType2["SERVER"] = "SERVER";
|
|
224
224
|
return SdkType2;
|
|
225
225
|
})(SdkType || {});
|
|
226
|
+
var ETaskType = /* @__PURE__ */ ((ETaskType2) => {
|
|
227
|
+
ETaskType2["IMAGE_INFERENCE"] = "imageInference";
|
|
228
|
+
ETaskType2["IMAGE_UPLOAD"] = "imageUpload";
|
|
229
|
+
ETaskType2["IMAGE_UPSCALE"] = "imageUpscale";
|
|
230
|
+
ETaskType2["IMAGE_BACKGROUND_REMOVAL"] = "imageBackgroundRemoval";
|
|
231
|
+
ETaskType2["IMAGE_CAPTION"] = "imageCaption";
|
|
232
|
+
ETaskType2["IMAGE_CONTROL_NET_PRE_PROCESS"] = "imageControlNetPreProcess";
|
|
233
|
+
ETaskType2["PROMPT_ENHANCE"] = "promptEnhance";
|
|
234
|
+
ETaskType2["AUTHENTICATION"] = "authentication";
|
|
235
|
+
return ETaskType2;
|
|
236
|
+
})(ETaskType || {});
|
|
226
237
|
var EControlMode = /* @__PURE__ */ ((EControlMode2) => {
|
|
227
238
|
EControlMode2["BALANCED"] = "balanced";
|
|
228
239
|
EControlMode2["PROMPT"] = "prompt";
|
|
@@ -335,82 +346,6 @@ var fileToBase64 = (file) => new Promise((resolve) => {
|
|
|
335
346
|
});
|
|
336
347
|
var getUUID = () => uuidv4();
|
|
337
348
|
var isValidUUID = (uuid) => validateUUID(uuid);
|
|
338
|
-
var getTaskType = ({
|
|
339
|
-
prompt,
|
|
340
|
-
controlNet,
|
|
341
|
-
imageMaskInitiator,
|
|
342
|
-
imageInitiator
|
|
343
|
-
}) => {
|
|
344
|
-
if (evaluateToBoolean(prompt, !controlNet, !imageMaskInitiator, !imageInitiator)) {
|
|
345
|
-
return 1;
|
|
346
|
-
}
|
|
347
|
-
if (evaluateToBoolean(prompt, !controlNet, !imageMaskInitiator, imageInitiator)) {
|
|
348
|
-
return 2;
|
|
349
|
-
}
|
|
350
|
-
if (evaluateToBoolean(prompt, !controlNet, imageMaskInitiator, imageInitiator)) {
|
|
351
|
-
return 3;
|
|
352
|
-
}
|
|
353
|
-
if (evaluateToBoolean(prompt, controlNet, !imageMaskInitiator, !imageInitiator)) {
|
|
354
|
-
return 9;
|
|
355
|
-
}
|
|
356
|
-
if (evaluateToBoolean(prompt, controlNet, !imageMaskInitiator, imageInitiator)) {
|
|
357
|
-
return 10;
|
|
358
|
-
}
|
|
359
|
-
if (evaluateToBoolean(prompt, controlNet, imageMaskInitiator, imageInitiator)) {
|
|
360
|
-
return 10;
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
var evaluateToBoolean = (...args) => [...args].every((e) => !!e);
|
|
364
|
-
var compact = (value, data) => !!value ? data : {};
|
|
365
|
-
var getPreprocessorType = (processor) => {
|
|
366
|
-
const processorGroup = Object.keys(
|
|
367
|
-
EPreProcessorGroup
|
|
368
|
-
);
|
|
369
|
-
switch (processor) {
|
|
370
|
-
case "canny" /* canny */:
|
|
371
|
-
return "canny" /* canny */;
|
|
372
|
-
case "depth_leres" /* depth_leres */:
|
|
373
|
-
case "depth_midas" /* depth_midas */:
|
|
374
|
-
case "depth_zoe" /* depth_zoe */:
|
|
375
|
-
return "depth" /* depth */;
|
|
376
|
-
case "inpaint_global_harmonious" /* inpaint_global_harmonious */:
|
|
377
|
-
return "depth" /* depth */;
|
|
378
|
-
case "lineart_anime" /* lineart_anime */:
|
|
379
|
-
return "lineart_anime" /* lineart_anime */;
|
|
380
|
-
case "lineart_coarse" /* lineart_coarse */:
|
|
381
|
-
case "lineart_realistic" /* lineart_realistic */:
|
|
382
|
-
case "lineart_standard" /* lineart_standard */:
|
|
383
|
-
return "lineart" /* lineart */;
|
|
384
|
-
case "mlsd" /* mlsd */:
|
|
385
|
-
return "mlsd" /* mlsd */;
|
|
386
|
-
case "normal_bae" /* normal_bae */:
|
|
387
|
-
return "normalbae" /* normalbae */;
|
|
388
|
-
case "openpose_face" /* openpose_face */:
|
|
389
|
-
case "openpose_faceonly" /* openpose_faceonly */:
|
|
390
|
-
case "openpose_full" /* openpose_full */:
|
|
391
|
-
case "openpose_hand" /* openpose_hand */:
|
|
392
|
-
case "openpose" /* openpose */:
|
|
393
|
-
return "openpose" /* openpose */;
|
|
394
|
-
case "scribble_hed" /* scribble_hed */:
|
|
395
|
-
case "scribble_pidinet" /* scribble_pidinet */:
|
|
396
|
-
return "scribble" /* scribble */;
|
|
397
|
-
case "seg_ofade20k" /* seg_ofade20k */:
|
|
398
|
-
case "seg_ofcoco" /* seg_ofcoco */:
|
|
399
|
-
case "seg_ufade20k" /* seg_ufade20k */:
|
|
400
|
-
return "seg" /* seg */;
|
|
401
|
-
case "shuffle" /* shuffle */:
|
|
402
|
-
return "shuffle" /* shuffle */;
|
|
403
|
-
case "softedge_hed" /* softedge_hed */:
|
|
404
|
-
case "softedge_hedsafe" /* softedge_hedsafe */:
|
|
405
|
-
case "softedge_pidinet" /* softedge_pidinet */:
|
|
406
|
-
case "softedge_pidisafe" /* softedge_pidisafe */:
|
|
407
|
-
return "softedge" /* softedge */;
|
|
408
|
-
case "tile_gaussian" /* tile_gaussian */:
|
|
409
|
-
return "tile" /* tile */;
|
|
410
|
-
default:
|
|
411
|
-
return "canny" /* canny */;
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
349
|
var accessDeepObject = ({
|
|
415
350
|
key,
|
|
416
351
|
data,
|
|
@@ -488,34 +423,36 @@ var RunwareBase = class {
|
|
|
488
423
|
var _a;
|
|
489
424
|
return ((_a = this._ws) == null ? void 0 : _a.readyState) === 1;
|
|
490
425
|
};
|
|
491
|
-
|
|
426
|
+
// We moving to an array format, it make sense to consolidate all request to an array here
|
|
427
|
+
this.send = (msg) => this._ws.send(JSON.stringify([msg]));
|
|
492
428
|
this.uploadImage = async (file) => {
|
|
493
429
|
try {
|
|
494
430
|
return await asyncRetry(async () => {
|
|
495
431
|
const taskUUID = getUUID();
|
|
496
432
|
if (typeof file === "string" && isValidUUID(file)) {
|
|
497
433
|
return {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
taskUUID
|
|
434
|
+
imageURL: file,
|
|
435
|
+
imageUUID: file,
|
|
436
|
+
taskUUID,
|
|
437
|
+
taskType: "imageUpload" /* IMAGE_UPLOAD */
|
|
501
438
|
};
|
|
502
439
|
}
|
|
503
440
|
const imageBase64 = typeof file === "string" ? file : await fileToBase64(file);
|
|
504
441
|
this.send({
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
taskType: 7
|
|
509
|
-
}
|
|
442
|
+
taskType: "imageUpload" /* IMAGE_UPLOAD */,
|
|
443
|
+
image: imageBase64,
|
|
444
|
+
taskUUID
|
|
510
445
|
});
|
|
511
446
|
const lis = this.globalListener({
|
|
512
|
-
responseKey: "newUploadedImageUUID",
|
|
513
|
-
taskKey: "newUploadedImageUUID",
|
|
514
447
|
taskUUID
|
|
515
448
|
});
|
|
516
449
|
const image = await getIntervalWithPromise(
|
|
517
450
|
({ resolve, reject }) => {
|
|
518
|
-
const uploadedImage = this.
|
|
451
|
+
const uploadedImage = this.getSingleMessage({
|
|
452
|
+
taskUUID
|
|
453
|
+
});
|
|
454
|
+
if (!uploadedImage)
|
|
455
|
+
return;
|
|
519
456
|
if (uploadedImage == null ? void 0 : uploadedImage.error) {
|
|
520
457
|
reject(uploadedImage);
|
|
521
458
|
return true;
|
|
@@ -535,44 +472,54 @@ var RunwareBase = class {
|
|
|
535
472
|
throw e;
|
|
536
473
|
}
|
|
537
474
|
};
|
|
538
|
-
this.
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
width,
|
|
475
|
+
this.controlNetPreProcess = async ({
|
|
476
|
+
inputImage,
|
|
477
|
+
preProcessor,
|
|
542
478
|
height,
|
|
543
|
-
|
|
479
|
+
width,
|
|
480
|
+
outputType,
|
|
481
|
+
outputFormat,
|
|
544
482
|
highThresholdCanny,
|
|
545
|
-
|
|
546
|
-
|
|
483
|
+
lowThresholdCanny,
|
|
484
|
+
includeHandsAndFaceOpenPose,
|
|
485
|
+
includeCost
|
|
547
486
|
}) => {
|
|
548
487
|
try {
|
|
549
|
-
const image = await this.uploadImage(
|
|
550
|
-
if (!image)
|
|
488
|
+
const image = await this.uploadImage(inputImage);
|
|
489
|
+
if (!(image == null ? void 0 : image.imageUUID))
|
|
551
490
|
return null;
|
|
552
491
|
const taskUUID = getUUID();
|
|
553
|
-
this.send({
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
492
|
+
this.send(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
493
|
+
inputImage: image.imageUUID,
|
|
494
|
+
taskType: "imageControlNetPreProcess" /* IMAGE_CONTROL_NET_PRE_PROCESS */,
|
|
495
|
+
taskUUID,
|
|
496
|
+
preProcessor
|
|
497
|
+
}, evaluateNonTrue({ key: "height", value: height })), evaluateNonTrue({ key: "width", value: width })), evaluateNonTrue({ key: "outputType", value: outputType })), evaluateNonTrue({ key: "outputFormat", value: outputFormat })), evaluateNonTrue({ key: "includeCost", value: includeCost })), evaluateNonTrue({
|
|
498
|
+
key: "highThresholdCanny",
|
|
499
|
+
value: highThresholdCanny
|
|
500
|
+
})), evaluateNonTrue({
|
|
501
|
+
key: "lowThresholdCanny",
|
|
502
|
+
value: lowThresholdCanny
|
|
503
|
+
})), evaluateNonTrue({
|
|
504
|
+
key: "includeHandsAndFaceOpenPose",
|
|
505
|
+
value: includeHandsAndFaceOpenPose
|
|
506
|
+
})));
|
|
561
507
|
const lis = this.globalListener({
|
|
562
|
-
responseKey: "newPreProcessControlNet",
|
|
563
|
-
taskKey: "newPreProcessControlNet",
|
|
564
508
|
taskUUID
|
|
565
509
|
});
|
|
566
510
|
const guideImage = await getIntervalWithPromise(
|
|
567
511
|
({ resolve, reject }) => {
|
|
568
|
-
const uploadedImage = this.
|
|
512
|
+
const uploadedImage = this.getSingleMessage({
|
|
513
|
+
taskUUID
|
|
514
|
+
});
|
|
515
|
+
if (!uploadedImage)
|
|
516
|
+
return;
|
|
569
517
|
if (uploadedImage == null ? void 0 : uploadedImage.error) {
|
|
570
518
|
reject(uploadedImage);
|
|
571
519
|
return true;
|
|
572
520
|
}
|
|
573
521
|
if (uploadedImage) {
|
|
574
|
-
|
|
575
|
-
resolve(uploadedImage == null ? void 0 : uploadedImage.newPreProcessControlNet);
|
|
522
|
+
resolve(uploadedImage);
|
|
576
523
|
return true;
|
|
577
524
|
}
|
|
578
525
|
},
|
|
@@ -585,38 +532,40 @@ var RunwareBase = class {
|
|
|
585
532
|
}
|
|
586
533
|
};
|
|
587
534
|
this.requestImageToText = async ({
|
|
588
|
-
|
|
535
|
+
inputImage,
|
|
536
|
+
includeCost
|
|
589
537
|
}) => {
|
|
590
538
|
try {
|
|
591
539
|
await this.ensureConnection();
|
|
592
540
|
return await asyncRetry(async () => {
|
|
593
541
|
const imageUploaded = await this.uploadImage(
|
|
594
|
-
|
|
542
|
+
inputImage
|
|
595
543
|
);
|
|
596
|
-
if (!(imageUploaded == null ? void 0 : imageUploaded.
|
|
544
|
+
if (!(imageUploaded == null ? void 0 : imageUploaded.imageUUID))
|
|
597
545
|
return null;
|
|
598
546
|
const taskUUID = getUUID();
|
|
599
|
-
this.send({
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
});
|
|
547
|
+
this.send(__spreadValues({
|
|
548
|
+
taskUUID,
|
|
549
|
+
taskType: "imageCaption" /* IMAGE_CAPTION */,
|
|
550
|
+
inputImage: imageUploaded.imageUUID
|
|
551
|
+
}, evaluateNonTrue({ key: "includeCost", value: includeCost })));
|
|
605
552
|
const lis = this.globalListener({
|
|
606
|
-
responseKey: "newReverseClip",
|
|
607
|
-
taskKey: "newReverseClip.texts",
|
|
608
553
|
taskUUID
|
|
609
554
|
});
|
|
610
555
|
const response = await getIntervalWithPromise(
|
|
611
556
|
({ resolve, reject }) => {
|
|
612
|
-
const newReverseClip = this.
|
|
557
|
+
const newReverseClip = this.getSingleMessage({
|
|
558
|
+
taskUUID
|
|
559
|
+
});
|
|
560
|
+
if (!newReverseClip)
|
|
561
|
+
return;
|
|
613
562
|
if (newReverseClip == null ? void 0 : newReverseClip.error) {
|
|
614
563
|
reject(newReverseClip);
|
|
615
564
|
return true;
|
|
616
565
|
}
|
|
617
566
|
if (newReverseClip) {
|
|
618
567
|
delete this._globalMessages[taskUUID];
|
|
619
|
-
resolve(newReverseClip
|
|
568
|
+
resolve(newReverseClip);
|
|
620
569
|
return true;
|
|
621
570
|
}
|
|
622
571
|
},
|
|
@@ -630,39 +579,59 @@ var RunwareBase = class {
|
|
|
630
579
|
}
|
|
631
580
|
};
|
|
632
581
|
this.removeImageBackground = async ({
|
|
633
|
-
|
|
582
|
+
inputImage,
|
|
583
|
+
outputType,
|
|
584
|
+
outputFormat,
|
|
585
|
+
rgba,
|
|
586
|
+
postProcessMask,
|
|
587
|
+
returnOnlyMask,
|
|
588
|
+
alphaMatting,
|
|
589
|
+
alphaMattingForegroundThreshold,
|
|
590
|
+
alphaMattingBackgroundThreshold,
|
|
591
|
+
alphaMattingErodeSize,
|
|
592
|
+
includeCost
|
|
634
593
|
}) => {
|
|
635
594
|
try {
|
|
636
595
|
await this.ensureConnection();
|
|
637
596
|
return await asyncRetry(async () => {
|
|
638
597
|
const imageUploaded = await this.uploadImage(
|
|
639
|
-
|
|
598
|
+
inputImage
|
|
640
599
|
);
|
|
641
|
-
if (!(imageUploaded == null ? void 0 : imageUploaded.
|
|
600
|
+
if (!(imageUploaded == null ? void 0 : imageUploaded.imageUUID))
|
|
642
601
|
return null;
|
|
643
602
|
const taskUUID = getUUID();
|
|
644
|
-
this.send({
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
603
|
+
this.send(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
604
|
+
taskType: "imageBackgroundRemoval" /* IMAGE_BACKGROUND_REMOVAL */,
|
|
605
|
+
taskUUID,
|
|
606
|
+
inputImage: imageUploaded.imageUUID
|
|
607
|
+
}, evaluateNonTrue({ key: "rgba", value: rgba })), evaluateNonTrue({
|
|
608
|
+
key: "postProcessMask",
|
|
609
|
+
value: postProcessMask
|
|
610
|
+
})), evaluateNonTrue({ key: "returnOnlyMask", value: returnOnlyMask })), evaluateNonTrue({ key: "alphaMatting", value: alphaMatting })), evaluateNonTrue({ key: "includeCost", value: includeCost })), evaluateNonTrue({
|
|
611
|
+
key: "alphaMattingForegroundThreshold",
|
|
612
|
+
value: alphaMattingForegroundThreshold
|
|
613
|
+
})), evaluateNonTrue({
|
|
614
|
+
key: "alphaMattingBackgroundThreshold",
|
|
615
|
+
value: alphaMattingBackgroundThreshold
|
|
616
|
+
})), evaluateNonTrue({
|
|
617
|
+
key: "alphaMattingErodeSize",
|
|
618
|
+
value: alphaMattingErodeSize
|
|
619
|
+
})), evaluateNonTrue({ key: "outputType", value: outputType })), evaluateNonTrue({ key: "outputFormat", value: outputFormat })));
|
|
651
620
|
const lis = this.globalListener({
|
|
652
|
-
responseKey: "newRemoveBackground",
|
|
653
|
-
taskKey: "newRemoveBackground.images",
|
|
654
621
|
taskUUID
|
|
655
622
|
});
|
|
656
623
|
const response = await getIntervalWithPromise(
|
|
657
624
|
({ resolve, reject }) => {
|
|
658
|
-
const newRemoveBackground = this.
|
|
625
|
+
const newRemoveBackground = this.getSingleMessage({ taskUUID });
|
|
626
|
+
if (!newRemoveBackground)
|
|
627
|
+
return;
|
|
659
628
|
if (newRemoveBackground == null ? void 0 : newRemoveBackground.error) {
|
|
660
629
|
reject(newRemoveBackground);
|
|
661
630
|
return true;
|
|
662
631
|
}
|
|
663
632
|
if (newRemoveBackground) {
|
|
664
633
|
delete this._globalMessages[taskUUID];
|
|
665
|
-
resolve(newRemoveBackground);
|
|
634
|
+
resolve([newRemoveBackground]);
|
|
666
635
|
return true;
|
|
667
636
|
}
|
|
668
637
|
},
|
|
@@ -676,39 +645,41 @@ var RunwareBase = class {
|
|
|
676
645
|
}
|
|
677
646
|
};
|
|
678
647
|
this.upscaleGan = async ({
|
|
679
|
-
|
|
680
|
-
upscaleFactor
|
|
648
|
+
inputImage,
|
|
649
|
+
upscaleFactor,
|
|
650
|
+
outputType,
|
|
651
|
+
outputFormat,
|
|
652
|
+
includeCost
|
|
681
653
|
}) => {
|
|
682
654
|
try {
|
|
683
655
|
await this.ensureConnection();
|
|
684
656
|
return await asyncRetry(async () => {
|
|
685
657
|
let imageUploaded;
|
|
686
|
-
imageUploaded = await this.uploadImage(
|
|
687
|
-
if (!(imageUploaded == null ? void 0 : imageUploaded.
|
|
658
|
+
imageUploaded = await this.uploadImage(inputImage);
|
|
659
|
+
if (!(imageUploaded == null ? void 0 : imageUploaded.imageUUID))
|
|
688
660
|
return null;
|
|
689
661
|
const taskUUID = getUUID();
|
|
690
|
-
this.send({
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
});
|
|
662
|
+
this.send(__spreadValues(__spreadValues(__spreadValues({
|
|
663
|
+
taskUUID,
|
|
664
|
+
inputImage: imageUploaded == null ? void 0 : imageUploaded.imageUUID,
|
|
665
|
+
taskType: "imageUpscale" /* IMAGE_UPSCALE */,
|
|
666
|
+
upscaleFactor
|
|
667
|
+
}, evaluateNonTrue({ key: "includeCost", value: includeCost })), outputType ? { outputType } : {}), outputFormat ? { outputFormat } : {}));
|
|
697
668
|
const lis = this.globalListener({
|
|
698
|
-
responseKey: "newUpscaleGan",
|
|
699
|
-
taskKey: "newUpscaleGan.images",
|
|
700
669
|
taskUUID
|
|
701
670
|
});
|
|
702
671
|
const response = await getIntervalWithPromise(
|
|
703
672
|
({ resolve, reject }) => {
|
|
704
|
-
const newUpscaleGan = this.
|
|
673
|
+
const newUpscaleGan = this.getSingleMessage({ taskUUID });
|
|
674
|
+
if (!newUpscaleGan)
|
|
675
|
+
return;
|
|
705
676
|
if (newUpscaleGan == null ? void 0 : newUpscaleGan.error) {
|
|
706
677
|
reject(newUpscaleGan);
|
|
707
678
|
return true;
|
|
708
679
|
}
|
|
709
680
|
if (newUpscaleGan) {
|
|
710
681
|
delete this._globalMessages[taskUUID];
|
|
711
|
-
resolve(newUpscaleGan);
|
|
682
|
+
resolve([newUpscaleGan]);
|
|
712
683
|
return true;
|
|
713
684
|
}
|
|
714
685
|
},
|
|
@@ -724,25 +695,22 @@ var RunwareBase = class {
|
|
|
724
695
|
this.enhancePrompt = async ({
|
|
725
696
|
prompt,
|
|
726
697
|
promptMaxLength = 380,
|
|
727
|
-
|
|
728
|
-
|
|
698
|
+
promptVersions = 1,
|
|
699
|
+
includeCost
|
|
729
700
|
}) => {
|
|
730
701
|
try {
|
|
731
702
|
await this.ensureConnection();
|
|
732
703
|
return await asyncRetry(async () => {
|
|
733
704
|
const taskUUID = getUUID();
|
|
734
|
-
this.send({
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
});
|
|
705
|
+
this.send(__spreadProps(__spreadValues({
|
|
706
|
+
prompt,
|
|
707
|
+
taskUUID,
|
|
708
|
+
promptMaxLength,
|
|
709
|
+
promptVersions
|
|
710
|
+
}, evaluateNonTrue({ key: "includeCost", value: includeCost })), {
|
|
711
|
+
taskType: "promptEnhance" /* PROMPT_ENHANCE */
|
|
712
|
+
}));
|
|
743
713
|
const lis = this.globalListener({
|
|
744
|
-
responseKey: "newPromptEnhancer",
|
|
745
|
-
taskKey: "newPromptEnhancer.texts",
|
|
746
714
|
taskUUID
|
|
747
715
|
});
|
|
748
716
|
const response = await getIntervalWithPromise(
|
|
@@ -767,6 +735,12 @@ var RunwareBase = class {
|
|
|
767
735
|
throw e;
|
|
768
736
|
}
|
|
769
737
|
};
|
|
738
|
+
this.getSingleMessage = ({ taskUUID }) => {
|
|
739
|
+
var _a, _b;
|
|
740
|
+
if (!((_a = this._globalMessages[taskUUID]) == null ? void 0 : _a[0]))
|
|
741
|
+
return null;
|
|
742
|
+
return (_b = this._globalMessages[taskUUID]) == null ? void 0 : _b[0];
|
|
743
|
+
};
|
|
770
744
|
this.connected = () => this.isWebsocketReadyState() && !!this._connectionSessionUUID;
|
|
771
745
|
this._apiKey = apiKey;
|
|
772
746
|
this._url = url;
|
|
@@ -794,14 +768,27 @@ var RunwareBase = class {
|
|
|
794
768
|
// }
|
|
795
769
|
addListener({
|
|
796
770
|
lis,
|
|
797
|
-
check,
|
|
798
|
-
groupKey
|
|
771
|
+
// check,
|
|
772
|
+
groupKey,
|
|
773
|
+
taskUUID
|
|
799
774
|
}) {
|
|
800
775
|
const listener = (msg) => {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
776
|
+
var _a;
|
|
777
|
+
const arrayMessage = Array.isArray(msg == null ? void 0 : msg.data) ? msg.data : [msg.data];
|
|
778
|
+
const arrayErrors = Array.isArray(msg == null ? void 0 : msg.errors) ? msg.errors : [msg.errors];
|
|
779
|
+
const filteredMessage = arrayMessage.filter(
|
|
780
|
+
(v) => (v == null ? void 0 : v.taskUUID) === taskUUID
|
|
781
|
+
);
|
|
782
|
+
const filteredErrors = arrayErrors.filter(
|
|
783
|
+
(v) => (v == null ? void 0 : v.taskUUID) === taskUUID
|
|
784
|
+
);
|
|
785
|
+
if (filteredErrors.length) {
|
|
786
|
+
lis({ error: __spreadValues({}, (_a = arrayErrors[0]) != null ? _a : {}) });
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
if (filteredMessage.length) {
|
|
790
|
+
lis({ [taskUUID]: arrayMessage });
|
|
791
|
+
return;
|
|
805
792
|
}
|
|
806
793
|
};
|
|
807
794
|
const groupListener = { key: getUUID(), listener, groupKey };
|
|
@@ -817,28 +804,24 @@ var RunwareBase = class {
|
|
|
817
804
|
this._ws.onopen = (e) => {
|
|
818
805
|
if (this._connectionSessionUUID) {
|
|
819
806
|
this.send({
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
}
|
|
807
|
+
taskType: "authentication" /* AUTHENTICATION */,
|
|
808
|
+
apiKey: this._apiKey,
|
|
809
|
+
connectionSessionUUID: this._connectionSessionUUID
|
|
824
810
|
});
|
|
825
811
|
} else {
|
|
826
|
-
this.send({
|
|
812
|
+
this.send({ apiKey: this._apiKey, taskType: "authentication" /* AUTHENTICATION */ });
|
|
827
813
|
}
|
|
828
814
|
this.addListener({
|
|
829
|
-
|
|
830
|
-
var _a;
|
|
831
|
-
return (_a = m == null ? void 0 : m.newConnectionSessionUUID) == null ? void 0 : _a.connectionSessionUUID;
|
|
832
|
-
},
|
|
815
|
+
taskUUID: "authentication" /* AUTHENTICATION */,
|
|
833
816
|
lis: (m) => {
|
|
834
|
-
var _a;
|
|
817
|
+
var _a, _b;
|
|
835
818
|
if (m == null ? void 0 : m.error) {
|
|
836
819
|
if (m.errorId === 19) {
|
|
837
820
|
this._invalidAPIkey = "Invalid API key";
|
|
838
821
|
}
|
|
839
822
|
return;
|
|
840
823
|
}
|
|
841
|
-
this._connectionSessionUUID = (_a = m == null ? void 0 : m
|
|
824
|
+
this._connectionSessionUUID = (_b = (_a = m == null ? void 0 : m["authentication" /* AUTHENTICATION */]) == null ? void 0 : _a[0]) == null ? void 0 : _b.connectionSessionUUID;
|
|
842
825
|
this._invalidAPIkey = void 0;
|
|
843
826
|
}
|
|
844
827
|
});
|
|
@@ -868,13 +851,10 @@ var RunwareBase = class {
|
|
|
868
851
|
groupKey
|
|
869
852
|
}) {
|
|
870
853
|
return this.addListener({
|
|
871
|
-
|
|
872
|
-
var _a;
|
|
873
|
-
return (_a = m.newImages) == null ? void 0 : _a.images;
|
|
874
|
-
},
|
|
854
|
+
taskUUID,
|
|
875
855
|
lis: (m) => {
|
|
876
|
-
var _a, _b
|
|
877
|
-
const images = (
|
|
856
|
+
var _a, _b;
|
|
857
|
+
const images = (_a = m == null ? void 0 : m[taskUUID]) == null ? void 0 : _a.filter(
|
|
878
858
|
(img) => img.taskUUID === taskUUID
|
|
879
859
|
);
|
|
880
860
|
onPartialImages == null ? void 0 : onPartialImages(images, (m == null ? void 0 : m.error) && m);
|
|
@@ -884,7 +864,7 @@ var RunwareBase = class {
|
|
|
884
864
|
if (this._sdkType === "CLIENT" /* CLIENT */) {
|
|
885
865
|
this._globalImages = [
|
|
886
866
|
...this._globalImages,
|
|
887
|
-
...(
|
|
867
|
+
...(_b = m == null ? void 0 : m[taskUUID]) != null ? _b : []
|
|
888
868
|
];
|
|
889
869
|
} else {
|
|
890
870
|
this._globalImages = [...this._globalImages, ...images];
|
|
@@ -894,27 +874,25 @@ var RunwareBase = class {
|
|
|
894
874
|
groupKey
|
|
895
875
|
});
|
|
896
876
|
}
|
|
897
|
-
globalListener({
|
|
898
|
-
responseKey,
|
|
899
|
-
taskKey,
|
|
900
|
-
taskUUID
|
|
901
|
-
}) {
|
|
877
|
+
globalListener({ taskUUID }) {
|
|
902
878
|
return this.addListener({
|
|
903
|
-
check: (m) => {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
},
|
|
879
|
+
// check: (m) => {
|
|
880
|
+
// const value = accessDeepObject({
|
|
881
|
+
// key: responseKey,
|
|
882
|
+
// data: m,
|
|
883
|
+
// useZero: false,
|
|
884
|
+
// });
|
|
885
|
+
// return !!value;
|
|
886
|
+
// },
|
|
887
|
+
// check: responseKey,
|
|
888
|
+
taskUUID,
|
|
911
889
|
lis: (m) => {
|
|
912
890
|
if (m.error) {
|
|
913
891
|
this._globalMessages[taskUUID] = m;
|
|
914
892
|
return;
|
|
915
893
|
}
|
|
916
894
|
const value = accessDeepObject({
|
|
917
|
-
key:
|
|
895
|
+
key: taskUUID,
|
|
918
896
|
data: m,
|
|
919
897
|
useZero: false
|
|
920
898
|
});
|
|
@@ -933,23 +911,30 @@ var RunwareBase = class {
|
|
|
933
911
|
});
|
|
934
912
|
}
|
|
935
913
|
async requestImages({
|
|
936
|
-
|
|
914
|
+
outputType,
|
|
915
|
+
outputFormat,
|
|
916
|
+
uploadEndpoint,
|
|
917
|
+
checkNsfw,
|
|
937
918
|
positivePrompt,
|
|
938
|
-
imageSize,
|
|
939
919
|
negativePrompt,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
920
|
+
seedImage,
|
|
921
|
+
maskImage,
|
|
922
|
+
strength,
|
|
923
|
+
height,
|
|
924
|
+
width,
|
|
925
|
+
model,
|
|
945
926
|
steps,
|
|
946
|
-
|
|
947
|
-
lora,
|
|
927
|
+
scheduler,
|
|
948
928
|
seed,
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
929
|
+
CFGScale,
|
|
930
|
+
clipSkip,
|
|
931
|
+
usePromptWeighting,
|
|
932
|
+
numberResults = 1,
|
|
933
|
+
controlNet,
|
|
934
|
+
lora,
|
|
935
|
+
useCache,
|
|
936
|
+
onPartialImages,
|
|
937
|
+
includeCost
|
|
953
938
|
}) {
|
|
954
939
|
let lis = void 0;
|
|
955
940
|
let requestObject = void 0;
|
|
@@ -957,83 +942,68 @@ var RunwareBase = class {
|
|
|
957
942
|
let retryCount = 0;
|
|
958
943
|
try {
|
|
959
944
|
await this.ensureConnection();
|
|
960
|
-
let
|
|
961
|
-
let
|
|
945
|
+
let seedImageUUID = null;
|
|
946
|
+
let maskImageUUID = null;
|
|
962
947
|
let controlNetData = [];
|
|
963
|
-
if (
|
|
964
|
-
const uploadedImage = await this.uploadImage(
|
|
948
|
+
if (seedImage) {
|
|
949
|
+
const uploadedImage = await this.uploadImage(seedImage);
|
|
965
950
|
if (!uploadedImage)
|
|
966
951
|
return [];
|
|
967
|
-
|
|
952
|
+
seedImageUUID = uploadedImage.imageUUID;
|
|
968
953
|
}
|
|
969
|
-
if (
|
|
970
|
-
const uploadedMaskInitiator = await this.uploadImage(
|
|
971
|
-
imageMaskInitiator
|
|
972
|
-
);
|
|
954
|
+
if (maskImage) {
|
|
955
|
+
const uploadedMaskInitiator = await this.uploadImage(maskImage);
|
|
973
956
|
if (!uploadedMaskInitiator)
|
|
974
957
|
return [];
|
|
975
|
-
|
|
958
|
+
maskImageUUID = uploadedMaskInitiator.imageUUID;
|
|
976
959
|
}
|
|
977
960
|
if (controlNet == null ? void 0 : controlNet.length) {
|
|
978
961
|
for (let i = 0; i < controlNet.length; i++) {
|
|
979
962
|
const controlData = controlNet[i];
|
|
980
|
-
const anyControlData = controlData;
|
|
981
963
|
const {
|
|
982
964
|
endStep,
|
|
983
|
-
preprocessor,
|
|
984
965
|
startStep,
|
|
985
966
|
weight,
|
|
986
967
|
guideImage,
|
|
987
|
-
guideImageUnprocessed,
|
|
988
968
|
controlMode,
|
|
989
|
-
|
|
969
|
+
startStepPercentage,
|
|
970
|
+
endStepPercentage,
|
|
971
|
+
model: controlNetModel
|
|
990
972
|
} = controlData;
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
};
|
|
997
|
-
} else
|
|
998
|
-
return {};
|
|
999
|
-
};
|
|
1000
|
-
const imageUploaded = await (guideImageUnprocessed ? this.uploadUnprocessedImage(__spreadProps(__spreadValues({
|
|
1001
|
-
file: guideImageUnprocessed,
|
|
1002
|
-
preProcessorType: getPreprocessorType(
|
|
1003
|
-
preprocessor
|
|
1004
|
-
),
|
|
1005
|
-
includeHandsAndFaceOpenPose: anyControlData.includeHandsAndFaceOpenPose
|
|
1006
|
-
}, getCannyObject()), {
|
|
1007
|
-
returnBase64Image: returnBase64Image2
|
|
1008
|
-
})) : this.uploadImage(guideImage));
|
|
973
|
+
if (!guideImage)
|
|
974
|
+
return;
|
|
975
|
+
const imageUploaded = await this.uploadImage(
|
|
976
|
+
guideImage
|
|
977
|
+
);
|
|
1009
978
|
if (!imageUploaded)
|
|
1010
|
-
return
|
|
1011
|
-
controlNetData.push(__spreadValues({
|
|
1012
|
-
|
|
979
|
+
return;
|
|
980
|
+
controlNetData.push(__spreadProps(__spreadValues(__spreadValues({
|
|
981
|
+
guideImage: imageUploaded.imageUUID,
|
|
982
|
+
model: controlNetModel,
|
|
1013
983
|
endStep,
|
|
1014
|
-
preprocessor,
|
|
1015
984
|
startStep,
|
|
1016
|
-
weight
|
|
985
|
+
weight
|
|
986
|
+
}, evaluateNonTrue({
|
|
987
|
+
key: "startStepPercentage",
|
|
988
|
+
value: startStepPercentage
|
|
989
|
+
})), evaluateNonTrue({
|
|
990
|
+
key: "endStepPercentage",
|
|
991
|
+
value: endStepPercentage
|
|
992
|
+
})), {
|
|
1017
993
|
controlMode: controlMode || "controlnet" /* CONTROL_NET */
|
|
1018
|
-
}
|
|
994
|
+
}));
|
|
1019
995
|
}
|
|
1020
996
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
controlNet,
|
|
1032
|
-
imageInitiator,
|
|
1033
|
-
imageMaskInitiator
|
|
1034
|
-
}),
|
|
1035
|
-
useCache
|
|
1036
|
-
}, scheduler ? { scheduler } : {}), returnBase64Image ? { returnBase64Image } : {}), evaluateNonTrue({ key: "checkNsfw", value: checkNsfw })), evaluateNonTrue({ key: "gScale", value: gScale })), evaluateNonTrue({ key: "steps", value: steps })), imageInitiatorUUID ? { imageInitiatorUUID } : {}), imageMaskInitiatorUUID ? { imageMaskInitiatorUUID } : {}), controlNetData.length ? { controlNet: controlNetData } : {}), (lora == null ? void 0 : lora.length) ? { lora } : {}), seed ? { seed } : {});
|
|
997
|
+
requestObject = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
998
|
+
taskType: "imageInference" /* IMAGE_INFERENCE */,
|
|
999
|
+
model,
|
|
1000
|
+
positivePrompt
|
|
1001
|
+
}, negativePrompt ? { negativePrompt } : {}), height ? { height } : {}), width ? { width } : {}), {
|
|
1002
|
+
numberResults
|
|
1003
|
+
}), (lora == null ? void 0 : lora.length) ? { lora } : {}), outputType ? { outputType } : {}), outputFormat ? { outputFormat } : {}), uploadEndpoint ? { uploadEndpoint } : {}), evaluateNonTrue({ key: "checkNsfw", value: checkNsfw })), evaluateNonTrue({ key: "strength", value: strength })), evaluateNonTrue({ key: "CFGScale", value: CFGScale })), evaluateNonTrue({ key: "clipSkip", value: clipSkip })), evaluateNonTrue({
|
|
1004
|
+
key: "usePromptWeighting",
|
|
1005
|
+
value: usePromptWeighting
|
|
1006
|
+
})), evaluateNonTrue({ key: "steps", value: steps })), controlNetData.length ? { controlNet: controlNetData } : {}), seed ? { seed } : {}), scheduler ? { scheduler } : {}), evaluateNonTrue({ key: "includeCost", value: includeCost })), evaluateNonTrue({ key: "useCache", value: useCache })), seedImageUUID ? { seedImage: seedImageUUID } : {}), maskImageUUID ? { maskImage: maskImageUUID } : {});
|
|
1037
1007
|
return await asyncRetry(
|
|
1038
1008
|
async () => {
|
|
1039
1009
|
retryCount++;
|
|
@@ -1043,22 +1013,20 @@ var RunwareBase = class {
|
|
|
1043
1013
|
);
|
|
1044
1014
|
const taskUUID = getUUID();
|
|
1045
1015
|
taskUUIDs.push(taskUUID);
|
|
1046
|
-
const imageRemaining =
|
|
1047
|
-
const newRequestObject = {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
})
|
|
1052
|
-
};
|
|
1016
|
+
const imageRemaining = numberResults - imagesWithSimilarTask.length;
|
|
1017
|
+
const newRequestObject = __spreadProps(__spreadValues({}, requestObject), {
|
|
1018
|
+
taskUUID,
|
|
1019
|
+
numberResults: imageRemaining
|
|
1020
|
+
});
|
|
1053
1021
|
this.send(newRequestObject);
|
|
1054
1022
|
lis = this.listenToImages({
|
|
1055
1023
|
onPartialImages,
|
|
1056
1024
|
taskUUID,
|
|
1057
1025
|
groupKey: "REQUEST_IMAGES" /* REQUEST_IMAGES */
|
|
1058
1026
|
});
|
|
1059
|
-
const promise = await this.
|
|
1027
|
+
const promise = await this.getSimilarImages({
|
|
1060
1028
|
taskUUID: taskUUIDs,
|
|
1061
|
-
|
|
1029
|
+
numberResults,
|
|
1062
1030
|
lis
|
|
1063
1031
|
});
|
|
1064
1032
|
return promise;
|
|
@@ -1076,25 +1044,9 @@ var RunwareBase = class {
|
|
|
1076
1044
|
}
|
|
1077
1045
|
}
|
|
1078
1046
|
}
|
|
1079
|
-
handleIncompleteImages({
|
|
1080
|
-
taskUUIDs,
|
|
1081
|
-
error
|
|
1082
|
-
}) {
|
|
1083
|
-
const imagesWithSimilarTask = this._globalImages.filter(
|
|
1084
|
-
(img) => taskUUIDs.includes(img.taskUUID)
|
|
1085
|
-
);
|
|
1086
|
-
if (imagesWithSimilarTask.length > 1) {
|
|
1087
|
-
this._globalImages = this._globalImages.filter(
|
|
1088
|
-
(img) => !taskUUIDs.includes(img.taskUUID)
|
|
1089
|
-
);
|
|
1090
|
-
return imagesWithSimilarTask;
|
|
1091
|
-
} else {
|
|
1092
|
-
throw error;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
1047
|
async ensureConnection() {
|
|
1096
1048
|
var _a;
|
|
1097
|
-
let isConnected = this.connected()
|
|
1049
|
+
let isConnected = this.connected();
|
|
1098
1050
|
try {
|
|
1099
1051
|
if (this._invalidAPIkey)
|
|
1100
1052
|
throw this._invalidAPIkey;
|
|
@@ -1106,9 +1058,9 @@ var RunwareBase = class {
|
|
|
1106
1058
|
throw (_a = this._invalidAPIkey) != null ? _a : "Could not connect to server. Ensure your API key is correct";
|
|
1107
1059
|
}
|
|
1108
1060
|
}
|
|
1109
|
-
async
|
|
1061
|
+
async getSimilarImages({
|
|
1110
1062
|
taskUUID,
|
|
1111
|
-
|
|
1063
|
+
numberResults,
|
|
1112
1064
|
shouldThrowError,
|
|
1113
1065
|
lis
|
|
1114
1066
|
}) {
|
|
@@ -1124,20 +1076,34 @@ var RunwareBase = class {
|
|
|
1124
1076
|
clearInterval(intervalId);
|
|
1125
1077
|
reject == null ? void 0 : reject(newData);
|
|
1126
1078
|
return true;
|
|
1127
|
-
} else if (imagesWithSimilarTask.length >=
|
|
1079
|
+
} else if (imagesWithSimilarTask.length >= numberResults) {
|
|
1128
1080
|
clearInterval(intervalId);
|
|
1129
1081
|
this._globalImages = this._globalImages.filter(
|
|
1130
1082
|
(img) => !taskUUIDs.includes(img.taskUUID)
|
|
1131
1083
|
);
|
|
1132
|
-
resolve(
|
|
1133
|
-
[...imagesWithSimilarTask].slice(0, numberOfImages)
|
|
1134
|
-
);
|
|
1084
|
+
resolve([...imagesWithSimilarTask].slice(0, numberResults));
|
|
1135
1085
|
return true;
|
|
1136
1086
|
}
|
|
1137
1087
|
},
|
|
1138
1088
|
{ debugKey: "getting images", shouldThrowError }
|
|
1139
1089
|
);
|
|
1140
1090
|
}
|
|
1091
|
+
handleIncompleteImages({
|
|
1092
|
+
taskUUIDs,
|
|
1093
|
+
error
|
|
1094
|
+
}) {
|
|
1095
|
+
const imagesWithSimilarTask = this._globalImages.filter(
|
|
1096
|
+
(img) => taskUUIDs.includes(img.taskUUID)
|
|
1097
|
+
);
|
|
1098
|
+
if (imagesWithSimilarTask.length > 1) {
|
|
1099
|
+
this._globalImages = this._globalImages.filter(
|
|
1100
|
+
(img) => !taskUUIDs.includes(img.taskUUID)
|
|
1101
|
+
);
|
|
1102
|
+
return imagesWithSimilarTask;
|
|
1103
|
+
} else {
|
|
1104
|
+
throw error;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1141
1107
|
//end of data
|
|
1142
1108
|
};
|
|
1143
1109
|
|
|
@@ -1164,7 +1130,7 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1164
1130
|
this._listeners = [];
|
|
1165
1131
|
this._reconnectingIntervalId = null;
|
|
1166
1132
|
this.send = (msg) => {
|
|
1167
|
-
this._ws.send(JSON.stringify(msg));
|
|
1133
|
+
this._ws.send(JSON.stringify([msg]));
|
|
1168
1134
|
};
|
|
1169
1135
|
this._sdkType = "SERVER" /* SERVER */;
|
|
1170
1136
|
if (apiKey) {
|
|
@@ -1207,51 +1173,23 @@ var RunwareServer = class extends RunwareBase {
|
|
|
1207
1173
|
});
|
|
1208
1174
|
this._ws.on("close", () => this.handleClose());
|
|
1209
1175
|
this._ws.on("open", () => {
|
|
1210
|
-
var _a;
|
|
1211
1176
|
if (this._reconnectingIntervalId) {
|
|
1212
1177
|
clearInterval(this._reconnectingIntervalId);
|
|
1213
1178
|
}
|
|
1214
1179
|
if (this._connectionSessionUUID && this.isWebsocketReadyState()) {
|
|
1215
1180
|
this.send({
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1181
|
+
taskType: "authentication" /* AUTHENTICATION */,
|
|
1182
|
+
apiKey: this._apiKey,
|
|
1183
|
+
connectionSessionUUID: this._connectionSessionUUID
|
|
1220
1184
|
});
|
|
1221
1185
|
} else {
|
|
1222
1186
|
if (this.isWebsocketReadyState()) {
|
|
1223
|
-
this.send({
|
|
1187
|
+
this.send({
|
|
1188
|
+
apiKey: this._apiKey,
|
|
1189
|
+
taskType: "authentication" /* AUTHENTICATION */
|
|
1190
|
+
});
|
|
1224
1191
|
}
|
|
1225
1192
|
}
|
|
1226
|
-
this.addListener({
|
|
1227
|
-
check: (m) => {
|
|
1228
|
-
var _a2;
|
|
1229
|
-
return (_a2 = m == null ? void 0 : m.newConnectionSessionUUID) == null ? void 0 : _a2.connectionSessionUUID;
|
|
1230
|
-
},
|
|
1231
|
-
lis: (m) => {
|
|
1232
|
-
var _a2;
|
|
1233
|
-
if (m == null ? void 0 : m.error) {
|
|
1234
|
-
if (m.errorId === 19) {
|
|
1235
|
-
this._invalidAPIkey = "Invalid API key";
|
|
1236
|
-
} else {
|
|
1237
|
-
this._invalidAPIkey = "Error connection ";
|
|
1238
|
-
}
|
|
1239
|
-
return;
|
|
1240
|
-
}
|
|
1241
|
-
this._connectionSessionUUID = (_a2 = m == null ? void 0 : m.newConnectionSessionUUID) == null ? void 0 : _a2.connectionSessionUUID;
|
|
1242
|
-
this._invalidAPIkey = void 0;
|
|
1243
|
-
this.heartBeat();
|
|
1244
|
-
}
|
|
1245
|
-
});
|
|
1246
|
-
(_a = this._pongListener) == null ? void 0 : _a.destroy();
|
|
1247
|
-
this._pongListener = this.addListener({
|
|
1248
|
-
check: (m) => m == null ? void 0 : m.pong,
|
|
1249
|
-
lis: (m) => {
|
|
1250
|
-
if (m.pong) {
|
|
1251
|
-
this.heartBeat();
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
});
|
|
1255
1193
|
});
|
|
1256
1194
|
this._ws.on("message", (e, isBinary) => {
|
|
1257
1195
|
const data = isBinary ? e : e == null ? void 0 : e.toString();
|
|
@@ -1291,6 +1229,7 @@ export {
|
|
|
1291
1229
|
EOpenPosePreProcessor,
|
|
1292
1230
|
EPreProcessor,
|
|
1293
1231
|
EPreProcessorGroup,
|
|
1232
|
+
ETaskType,
|
|
1294
1233
|
Environment,
|
|
1295
1234
|
Runware,
|
|
1296
1235
|
RunwareServer,
|