ws-process 0.3.26 → 0.3.27
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/index.js +47 -42
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -547,31 +547,34 @@ function asyncSend(msg) {
|
|
|
547
547
|
getState,
|
|
548
548
|
processID,
|
|
549
549
|
);
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
550
|
+
|
|
551
|
+
if ([undefined, true].includes(cProcessItem.doValidateResponse)) {
|
|
552
|
+
const hasError = local.validateResponse
|
|
553
|
+
? local.store.dispatch(
|
|
554
|
+
local.validateResponse(newData, cProcessItem),
|
|
555
|
+
)
|
|
556
|
+
: false;
|
|
557
|
+
if (hasError) {
|
|
556
558
|
// reject the promise from reqHandler in runProcess
|
|
557
559
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
560
|
+
const { callback } = cProcessItem;
|
|
561
|
+
if (callback) {
|
|
562
|
+
if (callback.afterFailed) {
|
|
563
|
+
callback.afterFailed(newData);
|
|
564
|
+
}
|
|
565
|
+
if (callback.always) {
|
|
566
|
+
callback.always();
|
|
567
|
+
}
|
|
562
568
|
}
|
|
563
|
-
if (
|
|
564
|
-
|
|
569
|
+
if (cProcessItem.reject) {
|
|
570
|
+
cProcessItem.reject({
|
|
571
|
+
errorOccurred: true,
|
|
572
|
+
processID,
|
|
573
|
+
data: newData,
|
|
574
|
+
});
|
|
565
575
|
}
|
|
576
|
+
return;
|
|
566
577
|
}
|
|
567
|
-
if (cProcessItem.reject) {
|
|
568
|
-
cProcessItem.reject({
|
|
569
|
-
errorOccurred: true,
|
|
570
|
-
processID,
|
|
571
|
-
data: newData,
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
return;
|
|
575
578
|
}
|
|
576
579
|
|
|
577
580
|
const { terminate } = handleResponseHandler(
|
|
@@ -788,31 +791,33 @@ function asyncSend(msg) {
|
|
|
788
791
|
jsonResponse.processID,
|
|
789
792
|
);
|
|
790
793
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
local.
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
if (callback
|
|
802
|
-
callback.afterFailed
|
|
794
|
+
if ([undefined, true].includes(cProcessItem.doValidateResponse)) {
|
|
795
|
+
const hasError = local.validateResponse
|
|
796
|
+
? local.store.dispatch(
|
|
797
|
+
local.validateResponse(jsonResponse, cProcessItem),
|
|
798
|
+
)
|
|
799
|
+
: false;
|
|
800
|
+
if (hasError) {
|
|
801
|
+
// reject the promise from reqHandler in runProcess
|
|
802
|
+
|
|
803
|
+
const { callback } = cProcessItem;
|
|
804
|
+
if (callback) {
|
|
805
|
+
if (callback.afterFailed) {
|
|
806
|
+
callback.afterFailed(jsonResponse);
|
|
807
|
+
}
|
|
808
|
+
if (callback.always) {
|
|
809
|
+
callback.always();
|
|
810
|
+
}
|
|
803
811
|
}
|
|
804
|
-
if (
|
|
805
|
-
|
|
812
|
+
if (cProcessItem.reject) {
|
|
813
|
+
cProcessItem.reject({
|
|
814
|
+
errorOccurred: true,
|
|
815
|
+
processID: cProcessItem.processID,
|
|
816
|
+
data: jsonResponse,
|
|
817
|
+
});
|
|
806
818
|
}
|
|
819
|
+
return;
|
|
807
820
|
}
|
|
808
|
-
if (cProcessItem.reject) {
|
|
809
|
-
cProcessItem.reject({
|
|
810
|
-
errorOccurred: true,
|
|
811
|
-
processID: cProcessItem.processID,
|
|
812
|
-
data: jsonResponse,
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
return;
|
|
816
821
|
}
|
|
817
822
|
|
|
818
823
|
const thisCount = tryit(() => jsonResponse.body.d.results.length);
|