@credithub/harlan-components 1.84.1 → 1.84.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/components/liminar/useLiminarProtestosDoPassado.js +25 -7
- package/lib/cjs/index.js +97 -2743
- package/lib/esm/index.js +97 -2743
- package/package.json +1 -1
|
@@ -34,7 +34,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
import { eachLimit } from 'async';
|
|
38
37
|
import XPathUtils from '../../utils/xpath';
|
|
39
38
|
import { Client } from '@credithub/webservice';
|
|
40
39
|
import { useCallback, useContext } from 'react';
|
|
@@ -90,7 +89,7 @@ var useLiminarProtestosDoPassado = function (_a) {
|
|
|
90
89
|
});
|
|
91
90
|
}); };
|
|
92
91
|
var fetch = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
-
var data, parsed, nodes, numerosChave, ocultos, launch;
|
|
92
|
+
var data, parsed, nodes, numerosChave, ocultos, running, idx, launch, _loop_1;
|
|
94
93
|
var _a;
|
|
95
94
|
return __generator(this, function (_b) {
|
|
96
95
|
switch (_b.label) {
|
|
@@ -105,6 +104,8 @@ var useLiminarProtestosDoPassado = function (_a) {
|
|
|
105
104
|
nodes = XPathUtils.selectArray('//protesto/nm_chave', parsed);
|
|
106
105
|
numerosChave = difference(uniq(nodes.map(function (n) { return n.textContent || ''; })), ((_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.nmChaves) || []);
|
|
107
106
|
ocultos = [];
|
|
107
|
+
running = [];
|
|
108
|
+
idx = 0;
|
|
108
109
|
launch = function (chave) { return __awaiter(void 0, void 0, void 0, function () {
|
|
109
110
|
return __generator(this, function (_a) {
|
|
110
111
|
switch (_a.label) {
|
|
@@ -116,13 +117,30 @@ var useLiminarProtestosDoPassado = function (_a) {
|
|
|
116
117
|
}
|
|
117
118
|
});
|
|
118
119
|
}); };
|
|
119
|
-
|
|
120
|
+
_b.label = 3;
|
|
120
121
|
case 3:
|
|
122
|
+
if (!(idx < numerosChave.length || running.length)) return [3 /*break*/, 6];
|
|
123
|
+
_loop_1 = function () {
|
|
124
|
+
var p = launch(numerosChave[idx++]).finally(function () {
|
|
125
|
+
var i = running.indexOf(p);
|
|
126
|
+
if (i >= 0)
|
|
127
|
+
running.splice(i, 1);
|
|
128
|
+
});
|
|
129
|
+
running.push(p);
|
|
130
|
+
};
|
|
131
|
+
while (idx < numerosChave.length && running.length < MAX_CONCURRENT) {
|
|
132
|
+
_loop_1();
|
|
133
|
+
}
|
|
134
|
+
if (!running.length) return [3 /*break*/, 5];
|
|
135
|
+
return [4 /*yield*/, Promise.all(running)];
|
|
136
|
+
case 4:
|
|
121
137
|
_b.sent();
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
_b.label = 5;
|
|
139
|
+
case 5: return [3 /*break*/, 3];
|
|
140
|
+
case 6: return [2 /*return*/, {
|
|
141
|
+
possuiIndiciosDeLiminarProtestosDoPassado: ocultos.length > 0,
|
|
142
|
+
protestosDoPassadoIds: ocultos
|
|
143
|
+
}];
|
|
126
144
|
}
|
|
127
145
|
});
|
|
128
146
|
}); }, [client, documento, (_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.nmChaves]);
|