@fiado/api-invoker 4.49.0 → 4.51.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/identity/IdentityApi.d.ts +8 -5
- package/bin/identity/IdentityApi.js +17 -1
- package/bin/identity/index.d.ts +1 -0
- package/bin/identity/index.js +1 -0
- package/bin/identity/interfaces/IIdentityApi.d.ts +9 -4
- package/bin/identity/interfaces/LegacyApiResponse.d.ts +7 -0
- package/bin/identity/interfaces/LegacyApiResponse.js +1 -0
- package/package.json +1 -1
- package/src/identity/IdentityApi.ts +28 -9
- package/src/identity/index.ts +1 -0
- package/src/identity/interfaces/IIdentityApi.ts +11 -4
- package/src/identity/interfaces/LegacyApiResponse.ts +11 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IIdentityApi } from "./interfaces/IIdentityApi.js";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyApiResponse } from "./interfaces/LegacyApiResponse.js";
|
|
3
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
4
|
import { PeopleUpdateRequest, UploadDocumentRequest, PeopleResponse, PeopleSelfVerifiedRequest, AgentDocumentKeyResponse, DocumentUploadResponse } from "@fiado/type-kit/bin/identity/index.js";
|
|
4
5
|
export declare class IdentityApi implements IIdentityApi {
|
|
5
6
|
private httpRequest;
|
|
@@ -13,8 +14,10 @@ export declare class IdentityApi implements IIdentityApi {
|
|
|
13
14
|
getPeopleByFullName(fullName: string): Promise<any>;
|
|
14
15
|
privateGetDocumentsUrlSigned(directoryId: string, documentNames: string[]): Promise<any>;
|
|
15
16
|
getUserDocuments(directoryId: string): Promise<any>;
|
|
16
|
-
privateGetPeopleByDirectoryId(directoryId: string): Promise<PeopleResponse
|
|
17
|
-
privateGetLastAgentDocument(directoryId: string): Promise<AgentDocumentKeyResponse[]
|
|
18
|
-
privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<DocumentUploadResponse
|
|
19
|
-
privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<
|
|
17
|
+
privateGetPeopleByDirectoryId(directoryId: string): Promise<LegacyApiResponse<PeopleResponse>>;
|
|
18
|
+
privateGetLastAgentDocument(directoryId: string): Promise<LegacyApiResponse<AgentDocumentKeyResponse[]>>;
|
|
19
|
+
privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<LegacyApiResponse<DocumentUploadResponse>>;
|
|
20
|
+
privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<LegacyApiResponse<unknown>>;
|
|
21
|
+
privateSearchPeople(fullName: string): Promise<LegacyApiResponse<PeopleResponse[]>>;
|
|
22
|
+
privateUpdatePeople(directoryId: string, data: PeopleUpdateRequest): Promise<LegacyApiResponse<unknown>>;
|
|
20
23
|
}
|
|
@@ -76,6 +76,8 @@ let IdentityApi = class IdentityApi {
|
|
|
76
76
|
return await this.httpRequest.get(url);
|
|
77
77
|
}
|
|
78
78
|
// ── Gemelos PRIVATE de los endpoints de agentes (proxy RBAC v2, DEC-PROT-011) ──
|
|
79
|
+
// Retornan el ENVELOPE legacy completo (httpRequest devuelve response.data = el body de identity),
|
|
80
|
+
// para que el proxy /v2 de people-business lo re-emita campo por campo (drop-in, sin doble-wrap).
|
|
79
81
|
async privateGetPeopleByDirectoryId(directoryId) {
|
|
80
82
|
if (!directoryId) {
|
|
81
83
|
throw new Error("Directory ID is required.");
|
|
@@ -105,7 +107,21 @@ let IdentityApi = class IdentityApi {
|
|
|
105
107
|
throw new Error("Directory ID is required.");
|
|
106
108
|
}
|
|
107
109
|
const url = `${this.baseUrl}identities/private/agents/people/${directoryId}/selfverified`;
|
|
108
|
-
await this.httpRequest.put(url, data);
|
|
110
|
+
return await this.httpRequest.put(url, data);
|
|
111
|
+
}
|
|
112
|
+
async privateSearchPeople(fullName) {
|
|
113
|
+
if (!fullName || !fullName.trim()) {
|
|
114
|
+
throw new Error("fullName is required.");
|
|
115
|
+
}
|
|
116
|
+
const url = `${this.baseUrl}identities/people/search?fullName=${encodeURIComponent(fullName)}`;
|
|
117
|
+
return await this.httpRequest.get(url);
|
|
118
|
+
}
|
|
119
|
+
async privateUpdatePeople(directoryId, data) {
|
|
120
|
+
if (!directoryId) {
|
|
121
|
+
throw new Error("Directory ID is required.");
|
|
122
|
+
}
|
|
123
|
+
const url = `${this.baseUrl}identities/private/agents/people/${directoryId}`;
|
|
124
|
+
return await this.httpRequest.put(url, data);
|
|
109
125
|
}
|
|
110
126
|
};
|
|
111
127
|
IdentityApi = __decorate([
|
package/bin/identity/index.d.ts
CHANGED
package/bin/identity/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PeopleUpdateRequest, UploadDocumentRequest, PeopleResponse, PeopleSelfVerifiedRequest, AgentDocumentKeyResponse, DocumentUploadResponse } from "@fiado/type-kit/bin/identity/index.js";
|
|
2
|
+
import { LegacyApiResponse } from "./LegacyApiResponse.js";
|
|
2
3
|
/**
|
|
3
4
|
* Interfaz para el servicio Directory que permite operaciones sobre directorios.
|
|
4
5
|
*/
|
|
@@ -36,11 +37,15 @@ export interface IIdentityApi {
|
|
|
36
37
|
*/
|
|
37
38
|
getUserDocuments(directoryId: string): Promise<any>;
|
|
38
39
|
/** Gemelo private de agentGetPeopleByDirectoryId (con masking del manager). */
|
|
39
|
-
privateGetPeopleByDirectoryId(directoryId: string): Promise<PeopleResponse
|
|
40
|
+
privateGetPeopleByDirectoryId(directoryId: string): Promise<LegacyApiResponse<PeopleResponse>>;
|
|
40
41
|
/** Gemelo private de getUserDocumentsAgents (último documento). */
|
|
41
|
-
privateGetLastAgentDocument(directoryId: string): Promise<AgentDocumentKeyResponse[]
|
|
42
|
+
privateGetLastAgentDocument(directoryId: string): Promise<LegacyApiResponse<AgentDocumentKeyResponse[]>>;
|
|
42
43
|
/** Gemelo private de uploadDocumentAgent. actorDirectoryId = autor de la observación (DEC-PROT-012). */
|
|
43
|
-
privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<DocumentUploadResponse
|
|
44
|
+
privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<LegacyApiResponse<DocumentUploadResponse>>;
|
|
44
45
|
/** Gemelo private de agentPutPeoplePeopleIdSelfVerified. */
|
|
45
|
-
privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<
|
|
46
|
+
privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<LegacyApiResponse<unknown>>;
|
|
47
|
+
/** Gemelo private de agentGetPeopleSearch (búsqueda por nombre; devuelve lista). */
|
|
48
|
+
privateSearchPeople(fullName: string): Promise<LegacyApiResponse<PeopleResponse[]>>;
|
|
49
|
+
/** Gemelo private de editar persona (PUT sin /selfverified). */
|
|
50
|
+
privateUpdatePeople(directoryId: string, data: PeopleUpdateRequest): Promise<LegacyApiResponse<unknown>>;
|
|
46
51
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.51.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",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {inject, injectable} from "inversify";
|
|
2
2
|
import {IIdentityApi} from "./interfaces/IIdentityApi.js";
|
|
3
|
-
import {
|
|
3
|
+
import {LegacyApiResponse} from "./interfaces/LegacyApiResponse.js";
|
|
4
|
+
import type {IHttpRequest} from "@fiado/http-client";
|
|
4
5
|
import dotenv from 'dotenv';
|
|
5
6
|
import {
|
|
6
7
|
PeopleUpdateRequest, UploadDocumentRequest, PeopleResponse,
|
|
@@ -98,23 +99,25 @@ export class IdentityApi implements IIdentityApi {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
// ── Gemelos PRIVATE de los endpoints de agentes (proxy RBAC v2, DEC-PROT-011) ──
|
|
101
|
-
|
|
102
|
+
// Retornan el ENVELOPE legacy completo (httpRequest devuelve response.data = el body de identity),
|
|
103
|
+
// para que el proxy /v2 de people-business lo re-emita campo por campo (drop-in, sin doble-wrap).
|
|
104
|
+
async privateGetPeopleByDirectoryId(directoryId: string): Promise<LegacyApiResponse<PeopleResponse>> {
|
|
102
105
|
if (!directoryId) {
|
|
103
106
|
throw new Error("Directory ID is required.")
|
|
104
107
|
}
|
|
105
108
|
const url = `${this.baseUrl}identities/private/agents/people/${directoryId}`;
|
|
106
|
-
return await this.httpRequest.get<PeopleResponse
|
|
109
|
+
return await this.httpRequest.get<LegacyApiResponse<PeopleResponse>>(url);
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
async privateGetLastAgentDocument(directoryId: string): Promise<AgentDocumentKeyResponse[]
|
|
112
|
+
async privateGetLastAgentDocument(directoryId: string): Promise<LegacyApiResponse<AgentDocumentKeyResponse[]>> {
|
|
110
113
|
if (!directoryId) {
|
|
111
114
|
throw new Error("Directory ID is required.")
|
|
112
115
|
}
|
|
113
116
|
const url = `${this.baseUrl}identities/private/agents/documents/${directoryId}/last`;
|
|
114
|
-
return await this.httpRequest.get<AgentDocumentKeyResponse[]
|
|
117
|
+
return await this.httpRequest.get<LegacyApiResponse<AgentDocumentKeyResponse[]>>(url);
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
async privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<DocumentUploadResponse
|
|
120
|
+
async privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<LegacyApiResponse<DocumentUploadResponse>> {
|
|
118
121
|
if (!directoryId) {
|
|
119
122
|
throw new Error("Directory ID is required.")
|
|
120
123
|
}
|
|
@@ -122,14 +125,30 @@ export class IdentityApi implements IIdentityApi {
|
|
|
122
125
|
throw new Error("actorDirectoryId is required.")
|
|
123
126
|
}
|
|
124
127
|
const url = `${this.baseUrl}identities/private/agents/documents/${directoryId}/upload?actorDirectoryId=${encodeURIComponent(actorDirectoryId)}`;
|
|
125
|
-
return await this.httpRequest.put<DocumentUploadResponse
|
|
128
|
+
return await this.httpRequest.put<LegacyApiResponse<DocumentUploadResponse>>(url, document);
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
async privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<
|
|
131
|
+
async privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<LegacyApiResponse<unknown>> {
|
|
129
132
|
if (!directoryId) {
|
|
130
133
|
throw new Error("Directory ID is required.")
|
|
131
134
|
}
|
|
132
135
|
const url = `${this.baseUrl}identities/private/agents/people/${directoryId}/selfverified`;
|
|
133
|
-
await this.httpRequest.put<
|
|
136
|
+
return await this.httpRequest.put<LegacyApiResponse<unknown>>(url, data);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async privateSearchPeople(fullName: string): Promise<LegacyApiResponse<PeopleResponse[]>> {
|
|
140
|
+
if (!fullName || !fullName.trim()) {
|
|
141
|
+
throw new Error("fullName is required.")
|
|
142
|
+
}
|
|
143
|
+
const url = `${this.baseUrl}identities/people/search?fullName=${encodeURIComponent(fullName)}`;
|
|
144
|
+
return await this.httpRequest.get<LegacyApiResponse<PeopleResponse[]>>(url);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async privateUpdatePeople(directoryId: string, data: PeopleUpdateRequest): Promise<LegacyApiResponse<unknown>> {
|
|
148
|
+
if (!directoryId) {
|
|
149
|
+
throw new Error("Directory ID is required.")
|
|
150
|
+
}
|
|
151
|
+
const url = `${this.baseUrl}identities/private/agents/people/${directoryId}`;
|
|
152
|
+
return await this.httpRequest.put<LegacyApiResponse<unknown>>(url, data);
|
|
134
153
|
}
|
|
135
154
|
}
|
package/src/identity/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
PeopleUpdateRequest, UploadDocumentRequest, PeopleResponse,
|
|
3
3
|
PeopleSelfVerifiedRequest, AgentDocumentKeyResponse, DocumentUploadResponse,
|
|
4
4
|
} from "@fiado/type-kit/bin/identity/index.js";
|
|
5
|
+
import { LegacyApiResponse } from "./LegacyApiResponse.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Interfaz para el servicio Directory que permite operaciones sobre directorios.
|
|
@@ -48,12 +49,18 @@ export interface IIdentityApi {
|
|
|
48
49
|
getUserDocuments(directoryId: string): Promise<any>
|
|
49
50
|
|
|
50
51
|
// ── Gemelos PRIVATE de los endpoints de agentes (proxy RBAC v2, DEC-PROT-011) ──
|
|
52
|
+
// Devuelven el ENVELOPE legacy completo (LegacyApiResponse) tal como lo emite identity,
|
|
53
|
+
// para que el proxy /v2 de people-business lo re-emita campo por campo (drop-in exacto, sin doble-wrap).
|
|
51
54
|
/** Gemelo private de agentGetPeopleByDirectoryId (con masking del manager). */
|
|
52
|
-
privateGetPeopleByDirectoryId(directoryId: string): Promise<PeopleResponse
|
|
55
|
+
privateGetPeopleByDirectoryId(directoryId: string): Promise<LegacyApiResponse<PeopleResponse>>;
|
|
53
56
|
/** Gemelo private de getUserDocumentsAgents (último documento). */
|
|
54
|
-
privateGetLastAgentDocument(directoryId: string): Promise<AgentDocumentKeyResponse[]
|
|
57
|
+
privateGetLastAgentDocument(directoryId: string): Promise<LegacyApiResponse<AgentDocumentKeyResponse[]>>;
|
|
55
58
|
/** Gemelo private de uploadDocumentAgent. actorDirectoryId = autor de la observación (DEC-PROT-012). */
|
|
56
|
-
privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<DocumentUploadResponse
|
|
59
|
+
privateUploadAgentDocument(directoryId: string, actorDirectoryId: string, document: UploadDocumentRequest): Promise<LegacyApiResponse<DocumentUploadResponse>>;
|
|
57
60
|
/** Gemelo private de agentPutPeoplePeopleIdSelfVerified. */
|
|
58
|
-
privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<
|
|
61
|
+
privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<LegacyApiResponse<unknown>>;
|
|
62
|
+
/** Gemelo private de agentGetPeopleSearch (búsqueda por nombre; devuelve lista). */
|
|
63
|
+
privateSearchPeople(fullName: string): Promise<LegacyApiResponse<PeopleResponse[]>>;
|
|
64
|
+
/** Gemelo private de editar persona (PUT sin /selfverified). */
|
|
65
|
+
privateUpdatePeople(directoryId: string, data: PeopleUpdateRequest): Promise<LegacyApiResponse<unknown>>;
|
|
59
66
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Envelope de respuesta de los lambdas legacy Fiado (@fiado/request-handler + @fiado/backend-toolkit):
|
|
2
|
+
// el body HTTP es { code, description, msg, data, date }. Los métodos que pegan a endpoints legacy
|
|
3
|
+
// devuelven este envelope COMPLETO (httpRequest.get/put retorna response.data = el body), NO solo `data`.
|
|
4
|
+
// Tiparlo así evita el doble-wrap en el consumidor (que re-emite el envelope campo por campo para ser drop-in).
|
|
5
|
+
export interface LegacyApiResponse<T> {
|
|
6
|
+
code: string;
|
|
7
|
+
description?: string | null;
|
|
8
|
+
msg?: string | null;
|
|
9
|
+
data: T;
|
|
10
|
+
date?: string;
|
|
11
|
+
}
|