@fiado/api-invoker 5.107.0 → 5.108.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,6 +1,6 @@
1
- import { IHttpRequest } from "@fiado/http-client";
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector/index.js";
3
- import { ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
3
+ import type { CognitoUpdatePhoneNumberRequest, ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
4
4
  import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
5
5
  export default class CognitoConnectorApi implements ICognitoConnectorApi {
6
6
  private httpRequest;
@@ -15,4 +15,10 @@ export default class CognitoConnectorApi implements ICognitoConnectorApi {
15
15
  changePassword(input: SetPasswordRequest): Promise<void>;
16
16
  respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
17
17
  resetPassword(username: string, typeOfDirectoryId: string): Promise<void>;
18
+ /**
19
+ * Cambia el phone_number de un usuario (PUT cognito/user del conector). Mismo contrato que
20
+ * CognitoAdapter.updateAttribute de fiado-directory-lambda: `username` es el identityId del usuario
21
+ * o, si no lo tiene, su teléfono actual.
22
+ */
23
+ updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void>;
18
24
  }
@@ -84,6 +84,14 @@ let CognitoConnectorApi = class CognitoConnectorApi {
84
84
  const url = `${this.baseUrl}cognito/resetPassword`;
85
85
  return await this.httpRequest.post(url, { username, typeOfDirectoryId }, { operationName: "postConnectorCognitoResetPassword" });
86
86
  }
87
+ /**
88
+ * Cambia el phone_number de un usuario (PUT cognito/user del conector). Mismo contrato que
89
+ * CognitoAdapter.updateAttribute de fiado-directory-lambda: `username` es el identityId del usuario
90
+ * o, si no lo tiene, su teléfono actual.
91
+ */
92
+ async updatePhoneNumber(input) {
93
+ await this.httpRequest.put(`${this.baseUrl}cognito/user`, input);
94
+ }
87
95
  };
88
96
  CognitoConnectorApi = __decorate([
89
97
  injectable(),
@@ -1,5 +1,11 @@
1
1
  import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector/index.js";
2
2
  import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
3
+ /** Body de PUT cognito/user: `username` es el identityId o, si no hay, el teléfono actual. */
4
+ export interface CognitoUpdatePhoneNumberRequest {
5
+ username: string;
6
+ phoneNumber: string;
7
+ typeOfDirectoryId: TypeOfDirectoryId;
8
+ }
3
9
  export interface ICognitoConnectorApi {
4
10
  signUp(input: SignUpRequest): Promise<SignUpResponse>;
5
11
  signIn(input: SignInRequest): Promise<SignInResponse>;
@@ -10,4 +16,5 @@ export interface ICognitoConnectorApi {
10
16
  respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
11
17
  resetPassword(username: string, typeOfDirectoryId: TypeOfDirectoryId): Promise<void>;
12
18
  deleteCognitoUser(identityId: string, typeOfDirectoryId?: TypeOfDirectoryId): Promise<void>;
19
+ updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void>;
13
20
  }
@@ -1,8 +1,10 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { IFiadoMessagesApi } from "./interfaces/IFiadoMessagesApi.js";
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
+ import type { IFiadoMessagesApi, SendMessageRequest } from "./interfaces/IFiadoMessagesApi.js";
3
3
  export declare class FiadoMessagesApi implements IFiadoMessagesApi {
4
4
  private httpRequest;
5
5
  private readonly baseUrl;
6
6
  constructor(httpRequest: IHttpRequest);
7
7
  getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
8
+ /** Envía un mensaje (SMS, etc.) por fiado-messages-lambda. Mismo contrato que MessageAdapter.sendSMS de fiado-directory-lambda. */
9
+ sendMessage(message: SendMessageRequest): Promise<any>;
8
10
  }
@@ -26,6 +26,10 @@ let FiadoMessagesApi = class FiadoMessagesApi {
26
26
  };
27
27
  return await this.httpRequest.post(`${url}`, request, { 'operationName': operationName });
28
28
  }
29
+ /** Envía un mensaje (SMS, etc.) por fiado-messages-lambda. Mismo contrato que MessageAdapter.sendSMS de fiado-directory-lambda. */
30
+ async sendMessage(message) {
31
+ return await this.httpRequest.post(this.baseUrl, message, { operationName: "postSendMessage", app: "USERS_APP" });
32
+ }
29
33
  };
30
34
  FiadoMessagesApi = __decorate([
31
35
  injectable(),
@@ -1,3 +1,24 @@
1
+ /** Body de postSendMessage en fiado-messages-lambda (NotificationPush de los lambdas legacy). */
2
+ export interface SendMessageRequest {
3
+ messageType: string;
4
+ channelType: string;
5
+ directoryId: string | null;
6
+ typeOfDirectory: string | null;
7
+ destination: string;
8
+ language: string;
9
+ referenceMessageId: string | null;
10
+ country: string;
11
+ beneficiaryDirectoryId: string | null;
12
+ beneficiaryTypeOfDirectoryId: string | null;
13
+ status: string;
14
+ transactionNumber: string;
15
+ var1: unknown;
16
+ var2: unknown;
17
+ var3: unknown;
18
+ var4: unknown;
19
+ options: unknown;
20
+ }
1
21
  export interface IFiadoMessagesApi {
2
22
  getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
23
+ sendMessage(message: SendMessageRequest): Promise<any>;
3
24
  }
@@ -1,6 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import type { UserDocumentItem } from "@fiado/type-kit/bin/fileStorage/index.js";
3
- import type { IFileStorageApi } from "./interfaces/IFileStorageApi.js";
3
+ import type { IFileStorageApi, SaveFilesRequest } from "./interfaces/IFileStorageApi.js";
4
4
  type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
5
5
  export declare class FileStorageApi implements IFileStorageApi {
6
6
  private readonly httpRequest;
@@ -11,5 +11,6 @@ export declare class FileStorageApi implements IFileStorageApi {
11
11
  getUserDocumentSignUrl(key: string): Promise<FiadoApiResponse<{
12
12
  url: string;
13
13
  }>>;
14
+ saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>>;
14
15
  }
15
16
  export {};
@@ -37,6 +37,12 @@ let FileStorageApi = class FileStorageApi {
37
37
  }
38
38
  return await this.httpRequest.post(this.baseUrl, { key }, { operationName: "getUserDocumentSignUrl" });
39
39
  }
40
+ async saveFiles(request) {
41
+ if (!request?.path || !request.files?.length) {
42
+ throw new Error("path and at least one file are required.");
43
+ }
44
+ return await this.httpRequest.post(this.baseUrl, request, { operationName: "postDocumentCheck" });
45
+ }
40
46
  };
41
47
  FileStorageApi = __decorate([
42
48
  injectable(),
@@ -4,6 +4,14 @@ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApi
4
4
  * Cliente de fiado-s3-lambda (documentos de usuario en S3). Una sola ruta POST; la operación viaja en el
5
5
  * header `operationName`. Mismo contrato que consumía el S3Adapter de fiado-identity-lambda.
6
6
  */
7
+ /** Archivos en base64 (sin el prefijo `data:...;base64,`) a guardar bajo `path`, p. ej. `USER/{directoryId}`. */
8
+ export interface SaveFilesRequest {
9
+ path: string;
10
+ files: Array<{
11
+ fileName: string;
12
+ content: string;
13
+ }>;
14
+ }
7
15
  export interface IFileStorageApi {
8
16
  /** Lista los objetos bajo un prefijo, p. ej. `USER/{directoryId}`. Devuelve key completa, lastModified, sizeKb y url firmada. */
9
17
  listDirectoryDocuments(directory: string): Promise<FiadoApiResponse<UserDocumentItem[]>>;
@@ -13,5 +21,7 @@ export interface IFileStorageApi {
13
21
  getUserDocumentSignUrl(key: string): Promise<FiadoApiResponse<{
14
22
  url: string;
15
23
  }>>;
24
+ /** Guarda archivos (operación postDocumentCheck). Mismo contrato que DocumentAdapter.saveFileToS3 de fiado-directory-lambda. */
25
+ saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>>;
16
26
  }
17
27
  export {};
@@ -9,4 +9,6 @@ export default class OnboardingApi implements IOnboardingApi {
9
9
  getOnboardingSteps(directoryId: string, countryId: string): Promise<OnboardingStepsEnvelope>;
10
10
  /** Onboardings por lote de fiado-onboarding-lambda (GET ids?directoryId=...). Lo usa la actividad diaria del backoffice. */
11
11
  getByIds(directoryIds: string[]): Promise<any>;
12
+ /** Cambia el teléfono del onboarding (PUT raíz de fiado-onboarding-lambda). Lo usa el cambio de teléfono del backoffice. */
13
+ updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any>;
12
14
  }
@@ -37,6 +37,10 @@ let OnboardingApi = class OnboardingApi {
37
37
  const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
38
38
  return await this.httpRequest.get(`${this.baseUrl}ids?${query}`);
39
39
  }
40
+ /** Cambia el teléfono del onboarding (PUT raíz de fiado-onboarding-lambda). Lo usa el cambio de teléfono del backoffice. */
41
+ async updatePhoneNumber(directoryId, phoneNumber) {
42
+ return await this.httpRequest.put(this.baseUrl, { directoryId, phoneNumber });
43
+ }
40
44
  };
41
45
  OnboardingApi = __decorate([
42
46
  injectable(),
@@ -12,4 +12,6 @@ export interface IOnboardingApi {
12
12
  getOnboardingSteps(directoryId: string, countryId: string): Promise<OnboardingStepsEnvelope>;
13
13
  /** Onboardings por lote (envelope con data: onboarding[] con id = directoryId y referralCode). */
14
14
  getByIds(directoryIds: string[]): Promise<any>;
15
+ /** PUT raíz de fiado-onboarding-lambda con {directoryId, phoneNumber}. */
16
+ updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any>;
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.107.0",
3
+ "version": "5.108.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,7 +1,7 @@
1
- import { IHttpRequest } from "@fiado/http-client";
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector/index.js";
3
3
  import { inject, injectable } from "inversify";
4
- import { ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
4
+ import type { CognitoUpdatePhoneNumberRequest, ICognitoConnectorApi } from "./interfaces/ICognitoConnectorApi.js";
5
5
  import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
6
6
 
7
7
  @injectable()
@@ -107,6 +107,13 @@ export default class CognitoConnectorApi implements ICognitoConnectorApi {
107
107
  const url = `${this.baseUrl}cognito/resetPassword`;
108
108
  return await this.httpRequest.post(url, { username, typeOfDirectoryId }, { operationName: "postConnectorCognitoResetPassword" });
109
109
  }
110
- }
111
-
112
110
 
111
+ /**
112
+ * Cambia el phone_number de un usuario (PUT cognito/user del conector). Mismo contrato que
113
+ * CognitoAdapter.updateAttribute de fiado-directory-lambda: `username` es el identityId del usuario
114
+ * o, si no lo tiene, su teléfono actual.
115
+ */
116
+ async updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void> {
117
+ await this.httpRequest.put(`${this.baseUrl}cognito/user`, input);
118
+ }
119
+ }
@@ -3,6 +3,13 @@ import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory/index.js";
3
3
 
4
4
 
5
5
 
6
+ /** Body de PUT cognito/user: `username` es el identityId o, si no hay, el teléfono actual. */
7
+ export interface CognitoUpdatePhoneNumberRequest {
8
+ username: string;
9
+ phoneNumber: string;
10
+ typeOfDirectoryId: TypeOfDirectoryId;
11
+ }
12
+
6
13
  export interface ICognitoConnectorApi {
7
14
 
8
15
  signUp(input: SignUpRequest): Promise<SignUpResponse>;
@@ -14,4 +21,5 @@ export interface ICognitoConnectorApi {
14
21
  respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
15
22
  resetPassword(username: string, typeOfDirectoryId: TypeOfDirectoryId): Promise<void>;
16
23
  deleteCognitoUser(identityId: string, typeOfDirectoryId?: TypeOfDirectoryId): Promise<void>;
24
+ updatePhoneNumber(input: CognitoUpdatePhoneNumberRequest): Promise<void>;
17
25
  }
@@ -1,6 +1,6 @@
1
1
  import {inject, injectable} from "inversify";
2
- import {IHttpRequest} from "@fiado/http-client";
3
- import {IFiadoMessagesApi} from "./interfaces/IFiadoMessagesApi.js";
2
+ import type {IHttpRequest} from "@fiado/http-client";
3
+ import type {IFiadoMessagesApi, SendMessageRequest} from "./interfaces/IFiadoMessagesApi.js";
4
4
 
5
5
  @injectable()
6
6
  export class FiadoMessagesApi implements IFiadoMessagesApi {
@@ -18,4 +18,9 @@ export class FiadoMessagesApi implements IFiadoMessagesApi {
18
18
  };
19
19
  return await this.httpRequest.post(`${url}`, request, {'operationName': operationName});
20
20
  }
21
- }
21
+
22
+ /** Envía un mensaje (SMS, etc.) por fiado-messages-lambda. Mismo contrato que MessageAdapter.sendSMS de fiado-directory-lambda. */
23
+ async sendMessage(message: SendMessageRequest): Promise<any> {
24
+ return await this.httpRequest.post(this.baseUrl, message, { operationName: "postSendMessage", app: "USERS_APP" });
25
+ }
26
+ }
@@ -1,3 +1,25 @@
1
+ /** Body de postSendMessage en fiado-messages-lambda (NotificationPush de los lambdas legacy). */
2
+ export interface SendMessageRequest {
3
+ messageType: string;
4
+ channelType: string;
5
+ directoryId: string | null;
6
+ typeOfDirectory: string | null;
7
+ destination: string;
8
+ language: string;
9
+ referenceMessageId: string | null;
10
+ country: string;
11
+ beneficiaryDirectoryId: string | null;
12
+ beneficiaryTypeOfDirectoryId: string | null;
13
+ status: string;
14
+ transactionNumber: string;
15
+ var1: unknown;
16
+ var2: unknown;
17
+ var3: unknown;
18
+ var4: unknown;
19
+ options: unknown;
20
+ }
21
+
1
22
  export interface IFiadoMessagesApi {
2
23
  getValidatedOtpByDirectoryIdAndOtpCode(directoryId: string, otpCode: string): Promise<any>;
3
- }
24
+ sendMessage(message: SendMessageRequest): Promise<any>;
25
+ }
@@ -2,7 +2,7 @@ import { inject, injectable } from "inversify";
2
2
  import type { IHttpRequest } from "@fiado/http-client";
3
3
  import dotenv from "dotenv";
4
4
  import type { UserDocumentItem } from "@fiado/type-kit/bin/fileStorage/index.js";
5
- import type { IFileStorageApi } from "./interfaces/IFileStorageApi.js";
5
+ import type { IFileStorageApi, SaveFilesRequest } from "./interfaces/IFileStorageApi.js";
6
6
  type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
7
7
 
8
8
  dotenv.config();
@@ -40,4 +40,13 @@ export class FileStorageApi implements IFileStorageApi {
40
40
  this.baseUrl, { key }, { operationName: "getUserDocumentSignUrl" },
41
41
  );
42
42
  }
43
+
44
+ async saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>> {
45
+ if (!request?.path || !request.files?.length) {
46
+ throw new Error("path and at least one file are required.");
47
+ }
48
+ return await this.httpRequest.post<FiadoApiResponse<unknown>>(
49
+ this.baseUrl, request, { operationName: "postDocumentCheck" },
50
+ );
51
+ }
43
52
  }
@@ -5,6 +5,12 @@ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApi
5
5
  * Cliente de fiado-s3-lambda (documentos de usuario en S3). Una sola ruta POST; la operación viaja en el
6
6
  * header `operationName`. Mismo contrato que consumía el S3Adapter de fiado-identity-lambda.
7
7
  */
8
+ /** Archivos en base64 (sin el prefijo `data:...;base64,`) a guardar bajo `path`, p. ej. `USER/{directoryId}`. */
9
+ export interface SaveFilesRequest {
10
+ path: string;
11
+ files: Array<{ fileName: string; content: string }>;
12
+ }
13
+
8
14
  export interface IFileStorageApi {
9
15
  /** Lista los objetos bajo un prefijo, p. ej. `USER/{directoryId}`. Devuelve key completa, lastModified, sizeKb y url firmada. */
10
16
  listDirectoryDocuments(directory: string): Promise<FiadoApiResponse<UserDocumentItem[]>>;
@@ -12,4 +18,6 @@ export interface IFileStorageApi {
12
18
  deleteUserDocument(fileName: string): Promise<FiadoApiResponse<void>>;
13
19
  /** URL firmada de lectura para una key completa. */
14
20
  getUserDocumentSignUrl(key: string): Promise<FiadoApiResponse<{ url: string }>>;
21
+ /** Guarda archivos (operación postDocumentCheck). Mismo contrato que DocumentAdapter.saveFileToS3 de fiado-directory-lambda. */
22
+ saveFiles(request: SaveFilesRequest): Promise<FiadoApiResponse<unknown>>;
15
23
  }
@@ -33,4 +33,9 @@ export default class OnboardingApi implements IOnboardingApi {
33
33
  const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
34
34
  return await this.httpRequest.get(`${this.baseUrl}ids?${query}`);
35
35
  }
36
+
37
+ /** Cambia el teléfono del onboarding (PUT raíz de fiado-onboarding-lambda). Lo usa el cambio de teléfono del backoffice. */
38
+ async updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any> {
39
+ return await this.httpRequest.put(this.baseUrl, { directoryId, phoneNumber });
40
+ }
36
41
  }
@@ -14,5 +14,7 @@ export interface IOnboardingApi {
14
14
 
15
15
  /** Onboardings por lote (envelope con data: onboarding[] con id = directoryId y referralCode). */
16
16
  getByIds(directoryIds: string[]): Promise<any>;
17
+ /** PUT raíz de fiado-onboarding-lambda con {directoryId, phoneNumber}. */
18
+ updatePhoneNumber(directoryId: string, phoneNumber: string): Promise<any>;
17
19
 
18
20
  }