@fiado/api-invoker 5.119.0 → 5.120.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/bin/referral-business/ReferralBusinessApi.d.ts +6 -1
- package/bin/referral-business/ReferralBusinessApi.js +9 -1
- package/bin/referral-business/interfaces/IReferralBusinessApi.d.ts +14 -1
- package/package.json +2 -2
- package/src/referral-business/ReferralBusinessApi.ts +14 -2
- package/src/referral-business/interfaces/IReferralBusinessApi.ts +13 -1
|
@@ -2,7 +2,7 @@ import type { IHttpRequest } from "@fiado/http-client";
|
|
|
2
2
|
import { IReferralBusinessApi } from "./interfaces/IReferralBusinessApi.js";
|
|
3
3
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
4
|
import { Scope } from "@fiado/type-kit/bin/directory/enums/Scope.js";
|
|
5
|
-
import type { AgentsByDirectoryIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
5
|
+
import type { AgentsByDirectoryIdsResponse, GroupOwnersByGroupIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
6
6
|
export declare class ReferralBusinessApi implements IReferralBusinessApi {
|
|
7
7
|
private httpRequest;
|
|
8
8
|
private readonly baseUrl;
|
|
@@ -24,5 +24,10 @@ export declare class ReferralBusinessApi implements IReferralBusinessApi {
|
|
|
24
24
|
accountOpeningsBySponsor(newDirectoryId: string, scope: Scope): Promise<FiadoApiResponse<any>>;
|
|
25
25
|
deleteAgent(directoryId: string): Promise<FiadoApiResponse<any>>;
|
|
26
26
|
getAgentsByDirectoryIds(directoryIds: string[]): Promise<AgentsByDirectoryIdsResponse>;
|
|
27
|
+
createGroupOwner(params: {
|
|
28
|
+
groupId: string;
|
|
29
|
+
directoryId: string;
|
|
30
|
+
}): Promise<FiadoApiResponse<unknown>>;
|
|
31
|
+
getGroupOwnersByGroupIds(groupIds: string[]): Promise<GroupOwnersByGroupIdsResponse>;
|
|
27
32
|
}
|
|
28
33
|
export {};
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
import { inject, injectable } from "inversify";
|
|
14
14
|
import dotenv from 'dotenv';
|
|
15
|
-
import { AGENTS_BY_DIRECTORY_IDS_MAX_BATCH } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
15
|
+
import { AGENTS_BY_DIRECTORY_IDS_MAX_BATCH, AgentRoleEnum, GROUP_OWNERS_BY_GROUP_IDS_MAX_BATCH } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
16
16
|
import { joinUrl } from "../utils/joinUrl.js";
|
|
17
17
|
import { postIdsInBatches } from "../utils/postIdsInBatches.js";
|
|
18
18
|
dotenv.config();
|
|
@@ -46,6 +46,14 @@ let ReferralBusinessApi = class ReferralBusinessApi {
|
|
|
46
46
|
const url = joinUrl(this.baseUrl, "private/agents/by-directory-ids");
|
|
47
47
|
return await postIdsInBatches(this.httpRequest, url, "directoryIds", directoryIds, AGENTS_BY_DIRECTORY_IDS_MAX_BATCH);
|
|
48
48
|
}
|
|
49
|
+
async createGroupOwner(params) {
|
|
50
|
+
const url = joinUrl(this.baseUrl, "private/agents");
|
|
51
|
+
return await this.httpRequest.post(url, { directoryId: params.directoryId, groupId: params.groupId, agentRole: AgentRoleEnum.OWNER });
|
|
52
|
+
}
|
|
53
|
+
async getGroupOwnersByGroupIds(groupIds) {
|
|
54
|
+
const url = joinUrl(this.baseUrl, "private/agents/owners/by-group-ids");
|
|
55
|
+
return await postIdsInBatches(this.httpRequest, url, "groupIds", groupIds, GROUP_OWNERS_BY_GROUP_IDS_MAX_BATCH);
|
|
56
|
+
}
|
|
49
57
|
};
|
|
50
58
|
ReferralBusinessApi = __decorate([
|
|
51
59
|
injectable(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
2
|
import { Scope } from "@fiado/type-kit/bin/directory/enums/Scope.js";
|
|
3
|
-
import type { AgentsByDirectoryIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
3
|
+
import type { AgentsByDirectoryIdsResponse, GroupOwnersByGroupIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Interfaz para el servicio Payroll que permite operaciones sobre payroll.
|
|
6
6
|
*/
|
|
@@ -52,5 +52,18 @@ export interface IReferralBusinessApi {
|
|
|
52
52
|
* Devuelve el mapa ya desempaquetado de `.data`; lanza el error del http sin fallback.
|
|
53
53
|
*/
|
|
54
54
|
getAgentsByDirectoryIds(directoryIds: string[]): Promise<AgentsByDirectoryIdsResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* POST private/agents con agentRole OWNER: crea el agente OWNER_<groupId> (y su membresía) en referral-business.
|
|
57
|
+
* El grupo ya debe existir en group-business. Lanza el error del http sin fallback (400 trae el code de referral).
|
|
58
|
+
*/
|
|
59
|
+
createGroupOwner(params: {
|
|
60
|
+
groupId: string;
|
|
61
|
+
directoryId: string;
|
|
62
|
+
}): Promise<FiadoApiResponse<unknown>>;
|
|
63
|
+
/**
|
|
64
|
+
* POST private/agents/owners/by-group-ids: owner de cada grupo, en lotes de 100.
|
|
65
|
+
* Devuelve el mapa ya desempaquetado de `.data`; un grupo sin owner no aparece. Lanza el error del http.
|
|
66
|
+
*/
|
|
67
|
+
getGroupOwnersByGroupIds(groupIds: string[]): Promise<GroupOwnersByGroupIdsResponse>;
|
|
55
68
|
}
|
|
56
69
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.120.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": "^3.14.0",
|
|
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.516.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -4,8 +4,8 @@ import dotenv from 'dotenv';
|
|
|
4
4
|
import { IReferralBusinessApi } from "./interfaces/IReferralBusinessApi.js";
|
|
5
5
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
6
6
|
import { Scope } from "@fiado/type-kit/bin/directory/enums/Scope.js";
|
|
7
|
-
import { AGENTS_BY_DIRECTORY_IDS_MAX_BATCH } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
8
|
-
import type { AgentByDirectoryIdItem, AgentsByDirectoryIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
7
|
+
import { AGENTS_BY_DIRECTORY_IDS_MAX_BATCH, AgentRoleEnum, GROUP_OWNERS_BY_GROUP_IDS_MAX_BATCH } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
8
|
+
import type { AgentByDirectoryIdItem, AgentsByDirectoryIdsResponse, GroupOwnerItem, GroupOwnersByGroupIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
9
9
|
import { joinUrl } from "../utils/joinUrl.js";
|
|
10
10
|
import { postIdsInBatches } from "../utils/postIdsInBatches.js";
|
|
11
11
|
|
|
@@ -51,4 +51,16 @@ export class ReferralBusinessApi implements IReferralBusinessApi {
|
|
|
51
51
|
this.httpRequest, url, "directoryIds", directoryIds, AGENTS_BY_DIRECTORY_IDS_MAX_BATCH,
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
async createGroupOwner(params: { groupId: string; directoryId: string }): Promise<FiadoApiResponse<unknown>> {
|
|
56
|
+
const url = joinUrl(this.baseUrl, "private/agents");
|
|
57
|
+
return await this.httpRequest.post(url, { directoryId: params.directoryId, groupId: params.groupId, agentRole: AgentRoleEnum.OWNER });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async getGroupOwnersByGroupIds(groupIds: string[]): Promise<GroupOwnersByGroupIdsResponse> {
|
|
61
|
+
const url = joinUrl(this.baseUrl, "private/agents/owners/by-group-ids");
|
|
62
|
+
return await postIdsInBatches<GroupOwnerItem>(
|
|
63
|
+
this.httpRequest, url, "groupIds", groupIds, GROUP_OWNERS_BY_GROUP_IDS_MAX_BATCH,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
54
66
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
2
|
import { Scope } from "@fiado/type-kit/bin/directory/enums/Scope.js";
|
|
3
|
-
import type { AgentsByDirectoryIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
3
|
+
import type { AgentsByDirectoryIdsResponse, GroupOwnersByGroupIdsResponse } from "@fiado/type-kit/bin/referral-business/index.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Interfaz para el servicio Payroll que permite operaciones sobre payroll.
|
|
@@ -49,4 +49,16 @@ export interface IReferralBusinessApi {
|
|
|
49
49
|
* Devuelve el mapa ya desempaquetado de `.data`; lanza el error del http sin fallback.
|
|
50
50
|
*/
|
|
51
51
|
getAgentsByDirectoryIds(directoryIds: string[]): Promise<AgentsByDirectoryIdsResponse>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* POST private/agents con agentRole OWNER: crea el agente OWNER_<groupId> (y su membresía) en referral-business.
|
|
55
|
+
* El grupo ya debe existir en group-business. Lanza el error del http sin fallback (400 trae el code de referral).
|
|
56
|
+
*/
|
|
57
|
+
createGroupOwner(params: { groupId: string; directoryId: string }): Promise<FiadoApiResponse<unknown>>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* POST private/agents/owners/by-group-ids: owner de cada grupo, en lotes de 100.
|
|
61
|
+
* Devuelve el mapa ya desempaquetado de `.data`; un grupo sin owner no aparece. Lanza el error del http.
|
|
62
|
+
*/
|
|
63
|
+
getGroupOwnersByGroupIds(groupIds: string[]): Promise<GroupOwnersByGroupIdsResponse>;
|
|
52
64
|
}
|