@fiado/api-invoker 4.48.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.
@@ -110,6 +110,8 @@ import { EqualityConnectorApi } from "./equality-connector/index.js";
110
110
  import { ContactsBusinessApi } from "./contacts-business/index.js";
111
111
  // Wallet funding settlement — TransactWriteItems atómico del money path cash-in (spec 15)
112
112
  import { WalletFundingSettlementApi } from "./walletFundingSettlement/index.js";
113
+ // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
114
+ import { SnsSesConnectorApi } from "./sns-ses-connector/index.js";
113
115
  export const apiInvokerBindings = new ContainerModule(({ bind }) => {
114
116
  // UTILS bindings
115
117
  bind("InvokerUtils").to(InvokerUtils);
@@ -232,4 +234,6 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
232
234
  // Wallet funding settlement — TransactWriteItems atómico del money path cash-in
233
235
  // (consumido por equality-connector post processor.walletFundingValidate). Ver spec 15.
234
236
  bind("IWalletFundingSettlementApi").to(WalletFundingSettlementApi);
237
+ // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
238
+ bind("ISnsSesConnectorApi").to(SnsSesConnectorApi);
235
239
  });
@@ -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/bin/index.d.ts CHANGED
@@ -82,3 +82,4 @@ export * from "./equality-connector/index.js";
82
82
  export * from "./contacts-business/index.js";
83
83
  export * from "./uniteller-connector/index.js";
84
84
  export * from "./walletFundingSettlement/index.js";
85
+ export * from "./sns-ses-connector/index.js";
package/bin/index.js CHANGED
@@ -82,3 +82,4 @@ export * from "./equality-connector/index.js";
82
82
  export * from "./contacts-business/index.js";
83
83
  export * from "./uniteller-connector/index.js";
84
84
  export * from "./walletFundingSettlement/index.js";
85
+ export * from "./sns-ses-connector/index.js";
@@ -0,0 +1,11 @@
1
+ import type { IHttpRequest } from '@fiado/http-client';
2
+ import { MessageDeliveryRequest, MessageDeliveryResponse } from '@fiado/type-kit/bin/messaging/index.js';
3
+ import { ISnsSesConnectorApi } from './interfaces/ISnsSesConnectorApi.js';
4
+ type FiadoApiResponse<T> = import('@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js').default<T>;
5
+ export declare class SnsSesConnectorApi implements ISnsSesConnectorApi {
6
+ private readonly httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ send(request: MessageDeliveryRequest): Promise<FiadoApiResponse<MessageDeliveryResponse>>;
10
+ }
11
+ export {};
@@ -0,0 +1,30 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { inject, injectable } from 'inversify';
14
+ let SnsSesConnectorApi = class SnsSesConnectorApi {
15
+ httpRequest;
16
+ baseUrl = process.env.SNS_SES_CONNECTOR_LAMBDA_URL || '';
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ }
20
+ async send(request) {
21
+ const url = `${this.baseUrl}send`;
22
+ return await this.httpRequest.post(url, request, { 'operationName': 'privateSend' });
23
+ }
24
+ };
25
+ SnsSesConnectorApi = __decorate([
26
+ injectable(),
27
+ __param(0, inject('IHttpRequest')),
28
+ __metadata("design:paramtypes", [Object])
29
+ ], SnsSesConnectorApi);
30
+ export { SnsSesConnectorApi };
@@ -0,0 +1,6 @@
1
+ import { MessageDeliveryRequest, MessageDeliveryResponse } from '@fiado/type-kit/bin/messaging/index.js';
2
+ type FiadoApiResponse<T> = import('@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js').default<T>;
3
+ export interface ISnsSesConnectorApi {
4
+ send(request: MessageDeliveryRequest): Promise<FiadoApiResponse<MessageDeliveryResponse>>;
5
+ }
6
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './api/SnsSesConnectorApi.js';
2
+ export * from './api/interfaces/ISnsSesConnectorApi.js';
@@ -0,0 +1,2 @@
1
+ export * from './api/SnsSesConnectorApi.js';
2
+ export * from './api/interfaces/ISnsSesConnectorApi.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "4.48.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",
@@ -169,6 +169,8 @@ import { IEqualityConnectorApi, EqualityConnectorApi } from "./equality-connecto
169
169
  import { IContactsBusinessApi, ContactsBusinessApi } from "./contacts-business/index.js";
170
170
  // Wallet funding settlement — TransactWriteItems atómico del money path cash-in (spec 15)
171
171
  import { IWalletFundingSettlementApi, WalletFundingSettlementApi } from "./walletFundingSettlement/index.js";
172
+ // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
173
+ import { ISnsSesConnectorApi, SnsSesConnectorApi } from "./sns-ses-connector/index.js";
172
174
 
173
175
  export const apiInvokerBindings = new ContainerModule(({ bind }) => {
174
176
  // UTILS bindings
@@ -309,4 +311,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
309
311
  // Wallet funding settlement — TransactWriteItems atómico del money path cash-in
310
312
  // (consumido por equality-connector post processor.walletFundingValidate). Ver spec 15.
311
313
  bind<IWalletFundingSettlementApi>("IWalletFundingSettlementApi").to(WalletFundingSettlementApi);
314
+
315
+ // SNS/SES connector — envío SMS/MAIL síncrono (restaurado para RBAC — DEC-002 messages-business)
316
+ bind<ISnsSesConnectorApi>("ISnsSesConnectorApi").to(SnsSesConnectorApi);
312
317
  });
@@ -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
+ }
package/src/index.ts CHANGED
@@ -82,3 +82,4 @@ export * from "./equality-connector/index.js";
82
82
  export * from "./contacts-business/index.js";
83
83
  export * from "./uniteller-connector/index.js";
84
84
  export * from "./walletFundingSettlement/index.js";
85
+ export * from "./sns-ses-connector/index.js";
@@ -0,0 +1,18 @@
1
+ import { inject, injectable } from 'inversify';
2
+ import type { IHttpRequest } from '@fiado/http-client';
3
+ import { MessageDeliveryRequest, MessageDeliveryResponse } from '@fiado/type-kit/bin/messaging/index.js';
4
+ import { ISnsSesConnectorApi } from './interfaces/ISnsSesConnectorApi.js';
5
+
6
+ type FiadoApiResponse<T> = import('@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js').default<T>;
7
+
8
+ @injectable()
9
+ export class SnsSesConnectorApi implements ISnsSesConnectorApi {
10
+ private readonly baseUrl = process.env.SNS_SES_CONNECTOR_LAMBDA_URL || '';
11
+
12
+ constructor(@inject('IHttpRequest') private readonly httpRequest: IHttpRequest) {}
13
+
14
+ async send(request: MessageDeliveryRequest): Promise<FiadoApiResponse<MessageDeliveryResponse>> {
15
+ const url = `${this.baseUrl}send`;
16
+ return await this.httpRequest.post(url, request, { 'operationName': 'privateSend' });
17
+ }
18
+ }
@@ -0,0 +1,7 @@
1
+ import { MessageDeliveryRequest, MessageDeliveryResponse } from '@fiado/type-kit/bin/messaging/index.js';
2
+
3
+ type FiadoApiResponse<T> = import('@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js').default<T>;
4
+
5
+ export interface ISnsSesConnectorApi {
6
+ send(request: MessageDeliveryRequest): Promise<FiadoApiResponse<MessageDeliveryResponse>>;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api/SnsSesConnectorApi.js';
2
+ export * from './api/interfaces/ISnsSesConnectorApi.js';