@fiado/api-invoker 4.49.0 → 4.50.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.
@@ -1,4 +1,5 @@
1
1
  import { IIdentityApi } from "./interfaces/IIdentityApi.js";
2
+ import { LegacyApiResponse } from "./interfaces/LegacyApiResponse.js";
2
3
  import { 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 {
@@ -13,8 +14,8 @@ 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<void>;
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>>;
20
21
  }
@@ -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,7 @@ 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);
109
111
  }
110
112
  };
111
113
  IdentityApi = __decorate([
@@ -1,2 +1,3 @@
1
1
  export * from './interfaces/IIdentityApi.js';
2
+ export * from './interfaces/LegacyApiResponse.js';
2
3
  export * from './IdentityApi.js';
@@ -1,2 +1,3 @@
1
1
  export * from './interfaces/IIdentityApi.js';
2
+ export * from './interfaces/LegacyApiResponse.js';
2
3
  export * from './IdentityApi.js';
@@ -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,11 @@ 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<void>;
46
+ privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<LegacyApiResponse<unknown>>;
46
47
  }
@@ -0,0 +1,7 @@
1
+ export interface LegacyApiResponse<T> {
2
+ code: string;
3
+ description?: string | null;
4
+ msg?: string | null;
5
+ data: T;
6
+ date?: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "4.49.0",
3
+ "version": "4.50.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,5 +1,6 @@
1
1
  import {inject, injectable} from "inversify";
2
2
  import {IIdentityApi} from "./interfaces/IIdentityApi.js";
3
+ import {LegacyApiResponse} from "./interfaces/LegacyApiResponse.js";
3
4
  import {IHttpRequest} from "@fiado/http-client";
4
5
  import dotenv from 'dotenv';
5
6
  import {
@@ -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
- async privateGetPeopleByDirectoryId(directoryId: string): Promise<PeopleResponse> {
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>(url);
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[]>(url);
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,14 @@ 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>(url, document);
128
+ return await this.httpRequest.put<LegacyApiResponse<DocumentUploadResponse>>(url, document);
126
129
  }
127
130
 
128
- async privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<void> {
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<void>(url, data);
136
+ return await this.httpRequest.put<LegacyApiResponse<unknown>>(url, data);
134
137
  }
135
138
  }
@@ -1,4 +1,5 @@
1
1
 
2
2
 
3
3
  export * from './interfaces/IIdentityApi.js';
4
+ export * from './interfaces/LegacyApiResponse.js';
4
5
  export * from './IdentityApi.js';
@@ -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,14 @@ 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<void>;
61
+ privateUpdatePeopleSelfVerified(directoryId: string, data: PeopleSelfVerifiedRequest): Promise<LegacyApiResponse<unknown>>;
59
62
  }
@@ -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
+ }