@fiado/api-invoker 4.24.0 → 4.25.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.
|
@@ -42,8 +42,15 @@ let MilestoneBusinessApi = class MilestoneBusinessApi {
|
|
|
42
42
|
// Chunking en lotes de MILESTONES_BY_DIRECTORY_IDS_MAX_BATCH (cap del endpoint batch).
|
|
43
43
|
for (let i = 0; i < uniqueIds.length; i += MILESTONES_BY_DIRECTORY_IDS_MAX_BATCH) {
|
|
44
44
|
const batch = uniqueIds.slice(i, i + MILESTONES_BY_DIRECTORY_IDS_MAX_BATCH);
|
|
45
|
+
// La respuesta HTTP llega envuelta en el envelope Fiado ({ data: map }). Desempaquetamos
|
|
46
|
+
// .data ANTES del merge: si fusionáramos el envelope completo, Object.assign pisaría la
|
|
47
|
+
// clave `data` en cada lote y solo sobrevivirían los milestones del último chunk
|
|
48
|
+
// (bug: grupos con >MAX_BATCH directoryIds perdían los milestones de los lotes previos).
|
|
45
49
|
const partial = await this.httpRequest.post(url, { directoryIds: batch });
|
|
46
|
-
|
|
50
|
+
const map = (partial && typeof partial === "object" && "data" in partial && partial.data && typeof partial.data === "object" && !Array.isArray(partial.data))
|
|
51
|
+
? partial.data
|
|
52
|
+
: partial;
|
|
53
|
+
Object.assign(merged, map ?? {});
|
|
47
54
|
}
|
|
48
55
|
return merged;
|
|
49
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.25.0",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fiado/gateway-adapter": "^2.0.2",
|
|
35
35
|
"@fiado/http-client": "^2.0.1",
|
|
36
36
|
"@fiado/logger": "^1.1.3",
|
|
37
|
-
"@fiado/type-kit": "^3.
|
|
37
|
+
"@fiado/type-kit": "^3.86.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -40,8 +40,15 @@ export default class MilestoneBusinessApi implements IMilestoneBusinessApi {
|
|
|
40
40
|
// Chunking en lotes de MILESTONES_BY_DIRECTORY_IDS_MAX_BATCH (cap del endpoint batch).
|
|
41
41
|
for (let i = 0; i < uniqueIds.length; i += MILESTONES_BY_DIRECTORY_IDS_MAX_BATCH) {
|
|
42
42
|
const batch = uniqueIds.slice(i, i + MILESTONES_BY_DIRECTORY_IDS_MAX_BATCH);
|
|
43
|
-
|
|
44
|
-
Object.assign
|
|
43
|
+
// La respuesta HTTP llega envuelta en el envelope Fiado ({ data: map }). Desempaquetamos
|
|
44
|
+
// .data ANTES del merge: si fusionáramos el envelope completo, Object.assign pisaría la
|
|
45
|
+
// clave `data` en cada lote y solo sobrevivirían los milestones del último chunk
|
|
46
|
+
// (bug: grupos con >MAX_BATCH directoryIds perdían los milestones de los lotes previos).
|
|
47
|
+
const partial = await this.httpRequest.post<{ data?: MilestonesByDirectoryIdsResponse } | MilestonesByDirectoryIdsResponse>(url, { directoryIds: batch });
|
|
48
|
+
const map = (partial && typeof partial === "object" && "data" in partial && partial.data && typeof partial.data === "object" && !Array.isArray(partial.data))
|
|
49
|
+
? partial.data
|
|
50
|
+
: (partial as MilestonesByDirectoryIdsResponse);
|
|
51
|
+
Object.assign(merged, map ?? {});
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
return merged;
|