@fiado/api-invoker 5.99.0 → 5.101.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/group/GroupApi.d.ts +9 -1
- package/bin/group/GroupApi.js +12 -0
- package/bin/group/interfaces/IGroupApi.d.ts +17 -0
- package/bin/onboarding-business/api/OnboardingBusinessApi.d.ts +1 -0
- package/bin/onboarding-business/api/OnboardingBusinessApi.js +8 -0
- package/bin/onboarding-business/api/interfaces/IOnboardingBusinessApi.d.ts +10 -0
- package/package.json +1 -1
- package/src/group/GroupApi.ts +24 -1
- package/src/group/interfaces/IGroupApi.ts +14 -0
- package/src/onboarding-business/api/OnboardingBusinessApi.ts +11 -0
- package/src/onboarding-business/api/interfaces/IOnboardingBusinessApi.ts +11 -0
package/bin/group/GroupApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { GroupAddDirectoryRequest, GroupResponse } from "@fiado/type-kit/bin/group/index.js";
|
|
3
3
|
import { IGroupApi } from "./interfaces/IGroupApi.js";
|
|
4
4
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
@@ -18,6 +18,14 @@ export declare class GroupApi implements IGroupApi {
|
|
|
18
18
|
members(params: GroupAddDirectoryRequest): Promise<any>;
|
|
19
19
|
findById(id: string): Promise<any>;
|
|
20
20
|
findAllWithCounts(): Promise<any>;
|
|
21
|
+
getMembersByGroupIds(groupIds: string[], pageSize?: number, lastKey?: string): Promise<FiadoApiResponse<{
|
|
22
|
+
data: {
|
|
23
|
+
directoryId: string;
|
|
24
|
+
groupId: string;
|
|
25
|
+
status?: string;
|
|
26
|
+
}[];
|
|
27
|
+
lastEvaluatedKey: string | null;
|
|
28
|
+
}>>;
|
|
21
29
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
22
30
|
deletedCount: number;
|
|
23
31
|
}>>;
|
package/bin/group/GroupApi.js
CHANGED
|
@@ -64,6 +64,18 @@ let GroupApi = class GroupApi {
|
|
|
64
64
|
const url = `${this.baseUrl}groups/counts`;
|
|
65
65
|
return await this.httpRequest.get(`${url}`);
|
|
66
66
|
}
|
|
67
|
+
async getMembersByGroupIds(groupIds, pageSize = 200, lastKey) {
|
|
68
|
+
const queryParams = [];
|
|
69
|
+
// El destino lee groupIds como multiValueQueryStringParameters: se repite la
|
|
70
|
+
// clave, no se manda separada por comas.
|
|
71
|
+
groupIds.forEach((groupId) => queryParams.push(`groupIds=${encodeURIComponent(groupId)}`));
|
|
72
|
+
queryParams.push(`pageSize=${pageSize}`);
|
|
73
|
+
if (lastKey) {
|
|
74
|
+
queryParams.push(`lastKey=${encodeURIComponent(lastKey)}`);
|
|
75
|
+
}
|
|
76
|
+
const url = `${this.baseUrl}members?${queryParams.join('&')}`;
|
|
77
|
+
return await this.httpRequest.get(url);
|
|
78
|
+
}
|
|
67
79
|
async deleteByDirectoryId(directoryId) {
|
|
68
80
|
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
69
81
|
return await this.httpRequest.delete(url);
|
|
@@ -25,6 +25,23 @@ export interface IGroupApi {
|
|
|
25
25
|
directory: string;
|
|
26
26
|
groups: GroupResponse[];
|
|
27
27
|
}[]>>;
|
|
28
|
+
/**
|
|
29
|
+
* Miembros de uno o varios grupos, paginado.
|
|
30
|
+
*
|
|
31
|
+
* `lastKey` es el cursor que devolvió la llamada anterior. Hay que encadenarlo hasta
|
|
32
|
+
* que venga vacío: DynamoDB corta cada página en 1 MB, así que un grupo grande NO
|
|
33
|
+
* entra en una sola respuesta.
|
|
34
|
+
*
|
|
35
|
+
* Consumido por `direct-deposit-export-business` para resolver a quién exportar.
|
|
36
|
+
*/
|
|
37
|
+
getMembersByGroupIds(groupIds: string[], pageSize?: number, lastKey?: string): Promise<FiadoApiResponse<{
|
|
38
|
+
data: {
|
|
39
|
+
directoryId: string;
|
|
40
|
+
groupId: string;
|
|
41
|
+
status?: string;
|
|
42
|
+
}[];
|
|
43
|
+
lastEvaluatedKey: string | null;
|
|
44
|
+
}>>;
|
|
28
45
|
/**
|
|
29
46
|
* Buscar grupo por id
|
|
30
47
|
* @param categoryId ID del grupo.
|
|
@@ -27,6 +27,7 @@ export default class OnboardingBusinessApi implements IOnboardingBusinessApi {
|
|
|
27
27
|
getBatchByIds(ids: string[]): Promise<any>;
|
|
28
28
|
tagsSummary(): Promise<any>;
|
|
29
29
|
tagsByDirectories(directoryIds: string[]): Promise<any>;
|
|
30
|
+
getUsersByTag(tag: string, pageSize?: number, index?: string): Promise<any>;
|
|
30
31
|
assignTag(params: {
|
|
31
32
|
directoryId: string;
|
|
32
33
|
tag: string;
|
|
@@ -101,6 +101,14 @@ let OnboardingBusinessApi = class OnboardingBusinessApi {
|
|
|
101
101
|
const url = `${this.baseUrl}private/tags/by-directories`;
|
|
102
102
|
return await this.httpRequest.post(`${url}`, { directoryIds });
|
|
103
103
|
}
|
|
104
|
+
async getUsersByTag(tag, pageSize = 200, index) {
|
|
105
|
+
const queryParams = [`pageSize=${pageSize}`];
|
|
106
|
+
if (index) {
|
|
107
|
+
queryParams.push(`index=${encodeURIComponent(index)}`);
|
|
108
|
+
}
|
|
109
|
+
const url = `${this.baseUrl}private/tags/${encodeURIComponent(tag)}/users?${queryParams.join('&')}`;
|
|
110
|
+
return await this.httpRequest.get(`${url}`);
|
|
111
|
+
}
|
|
104
112
|
async assignTag(params) {
|
|
105
113
|
const url = `${this.baseUrl}private/tags`;
|
|
106
114
|
return await this.httpRequest.post(`${url}`, { directoryId: params.directoryId, tag: params.tag });
|
|
@@ -23,6 +23,16 @@ export interface IOnboardingBusinessApi {
|
|
|
23
23
|
/** Dashboard Ops Segmentos — tags distintos + count c/u (TagsSummaryResponse en data). */
|
|
24
24
|
tagsSummary(): Promise<any>;
|
|
25
25
|
/** Dashboard Ops Segmentos — tags por usuario para un batch de directoryIds (TagsByDirectoriesResponse en data). */
|
|
26
|
+
/**
|
|
27
|
+
* Directorios que tienen un tag, paginado.
|
|
28
|
+
*
|
|
29
|
+
* `index` es el cursor que devolvió la llamada anterior. Hay que encadenarlo hasta
|
|
30
|
+
* que venga vacío: un tag con miles de usuarios NO entra en una sola respuesta.
|
|
31
|
+
*
|
|
32
|
+
* Es el inverso de `tagsByDirectories` (ese da los tags DE unos directorios; éste da
|
|
33
|
+
* los directorios CON un tag). Consumido por `direct-deposit-export-business`.
|
|
34
|
+
*/
|
|
35
|
+
getUsersByTag(tag: string, pageSize?: number, index?: string): Promise<any>;
|
|
26
36
|
tagsByDirectories(directoryIds: string[]): Promise<any>;
|
|
27
37
|
/** Asigna un tag a un directoryId. Idempotente: si ya estaba responde 200 con alreadyAssigned true. */
|
|
28
38
|
assignTag(params: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.101.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",
|
package/src/group/GroupApi.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { inject, injectable } from "inversify";
|
|
2
|
-
import
|
|
2
|
+
// `import type`: IHttpRequest solo se usa como tipo. Importarlo como valor arrastra
|
|
3
|
+
// @fiado/http-client al runtime, y jest no lo transforma (no esta en
|
|
4
|
+
// transformIgnorePatterns) — el test revienta con "Cannot use import statement outside
|
|
5
|
+
// a module". Mismo patron que OnboardingBusinessApi.
|
|
6
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
7
|
import dotenv from 'dotenv';
|
|
4
8
|
import { GroupAddDirectoryRequest, GroupResponse } from "@fiado/type-kit/bin/group/index.js";
|
|
5
9
|
import { IGroupApi } from "./interfaces/IGroupApi.js";
|
|
@@ -73,6 +77,25 @@ export class GroupApi implements IGroupApi {
|
|
|
73
77
|
return await this.httpRequest.get(`${url}`);
|
|
74
78
|
}
|
|
75
79
|
|
|
80
|
+
async getMembersByGroupIds(groupIds: string[], pageSize = 200, lastKey?: string): Promise<FiadoApiResponse<{
|
|
81
|
+
data: { directoryId: string; groupId: string; status?: string }[];
|
|
82
|
+
lastEvaluatedKey: string | null;
|
|
83
|
+
}>> {
|
|
84
|
+
const queryParams: string[] = [];
|
|
85
|
+
|
|
86
|
+
// El destino lee groupIds como multiValueQueryStringParameters: se repite la
|
|
87
|
+
// clave, no se manda separada por comas.
|
|
88
|
+
groupIds.forEach((groupId) => queryParams.push(`groupIds=${encodeURIComponent(groupId)}`));
|
|
89
|
+
queryParams.push(`pageSize=${pageSize}`);
|
|
90
|
+
|
|
91
|
+
if (lastKey) {
|
|
92
|
+
queryParams.push(`lastKey=${encodeURIComponent(lastKey)}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const url = `${this.baseUrl}members?${queryParams.join('&')}`;
|
|
96
|
+
return await this.httpRequest.get(url);
|
|
97
|
+
}
|
|
98
|
+
|
|
76
99
|
async deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>> {
|
|
77
100
|
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
78
101
|
return await this.httpRequest.delete<FiadoApiResponse<{ deletedCount: number }>>(url);
|
|
@@ -29,6 +29,20 @@ export interface IGroupApi {
|
|
|
29
29
|
*/
|
|
30
30
|
getMembershipDirectoryUserList(directories:string[], pageSize:number,index?:string): Promise<FiadoApiResponse<{directory:string,groups:GroupResponse[]}[]>>;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Miembros de uno o varios grupos, paginado.
|
|
34
|
+
*
|
|
35
|
+
* `lastKey` es el cursor que devolvió la llamada anterior. Hay que encadenarlo hasta
|
|
36
|
+
* que venga vacío: DynamoDB corta cada página en 1 MB, así que un grupo grande NO
|
|
37
|
+
* entra en una sola respuesta.
|
|
38
|
+
*
|
|
39
|
+
* Consumido por `direct-deposit-export-business` para resolver a quién exportar.
|
|
40
|
+
*/
|
|
41
|
+
getMembersByGroupIds(groupIds: string[], pageSize?: number, lastKey?: string): Promise<FiadoApiResponse<{
|
|
42
|
+
data: { directoryId: string; groupId: string; status?: string }[];
|
|
43
|
+
lastEvaluatedKey: string | null;
|
|
44
|
+
}>>;
|
|
45
|
+
|
|
32
46
|
|
|
33
47
|
|
|
34
48
|
/**
|
|
@@ -101,6 +101,17 @@ export default class OnboardingBusinessApi implements IOnboardingBusinessApi {
|
|
|
101
101
|
return await this.httpRequest.post(`${url}`, { directoryIds });
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
async getUsersByTag(tag: string, pageSize = 200, index?: string): Promise<any> {
|
|
105
|
+
const queryParams = [`pageSize=${pageSize}`];
|
|
106
|
+
|
|
107
|
+
if (index) {
|
|
108
|
+
queryParams.push(`index=${encodeURIComponent(index)}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const url = `${this.baseUrl}private/tags/${encodeURIComponent(tag)}/users?${queryParams.join('&')}`;
|
|
112
|
+
return await this.httpRequest.get(`${url}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
104
115
|
async assignTag(params: { directoryId: string; tag: string }): Promise<any> {
|
|
105
116
|
const url = `${this.baseUrl}private/tags`;
|
|
106
117
|
return await this.httpRequest.post(`${url}`, { directoryId: params.directoryId, tag: params.tag });
|
|
@@ -11,6 +11,17 @@ export interface IOnboardingBusinessApi {
|
|
|
11
11
|
/** Dashboard Ops Segmentos — tags distintos + count c/u (TagsSummaryResponse en data). */
|
|
12
12
|
tagsSummary(): Promise<any>
|
|
13
13
|
/** Dashboard Ops Segmentos — tags por usuario para un batch de directoryIds (TagsByDirectoriesResponse en data). */
|
|
14
|
+
/**
|
|
15
|
+
* Directorios que tienen un tag, paginado.
|
|
16
|
+
*
|
|
17
|
+
* `index` es el cursor que devolvió la llamada anterior. Hay que encadenarlo hasta
|
|
18
|
+
* que venga vacío: un tag con miles de usuarios NO entra en una sola respuesta.
|
|
19
|
+
*
|
|
20
|
+
* Es el inverso de `tagsByDirectories` (ese da los tags DE unos directorios; éste da
|
|
21
|
+
* los directorios CON un tag). Consumido por `direct-deposit-export-business`.
|
|
22
|
+
*/
|
|
23
|
+
getUsersByTag(tag: string, pageSize?: number, index?: string): Promise<any>;
|
|
24
|
+
|
|
14
25
|
tagsByDirectories(directoryIds: string[]): Promise<any>
|
|
15
26
|
/** Asigna un tag a un directoryId. Idempotente: si ya estaba responde 200 con alreadyAssigned true. */
|
|
16
27
|
assignTag(params: { directoryId: string; tag: string }): Promise<any>
|