@fiado/api-invoker 5.34.0 → 5.35.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.
Files changed (32) hide show
  1. package/bin/loanCredit/api/LoanCreditDeviceApi.d.ts +27 -0
  2. package/bin/loanCredit/api/LoanCreditDeviceApi.js +63 -0
  3. package/bin/loanCredit/api/interfaces/ILoanCreditDeviceApi.d.ts +57 -0
  4. package/bin/loanCredit/api/interfaces/ILoanCreditDeviceApi.js +1 -0
  5. package/bin/loanCredit/index.d.ts +2 -0
  6. package/bin/loanCredit/index.js +2 -0
  7. package/bin/membership/MembershipApi.d.ts +12 -0
  8. package/bin/membership/MembershipApi.js +32 -0
  9. package/bin/membership/index.d.ts +2 -0
  10. package/bin/membership/index.js +2 -0
  11. package/bin/membership/interfaces/IMembershipApi.d.ts +15 -0
  12. package/bin/membership/interfaces/IMembershipApi.js +1 -0
  13. package/bin/notificationWebsockets/NotificationWebsocketApi.d.ts +12 -0
  14. package/bin/notificationWebsockets/NotificationWebsocketApi.js +32 -0
  15. package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.d.ts +15 -0
  16. package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.js +1 -0
  17. package/bin/performance-profile/PerformanceProfileApi.d.ts +12 -0
  18. package/bin/performance-profile/PerformanceProfileApi.js +32 -0
  19. package/bin/performance-profile/index.d.ts +2 -0
  20. package/bin/performance-profile/index.js +2 -0
  21. package/bin/performance-profile/interfaces/IPerformanceProfileApi.d.ts +15 -0
  22. package/bin/performance-profile/interfaces/IPerformanceProfileApi.js +1 -0
  23. package/bin/presence-websocket/PresenceWebsocketApi.d.ts +12 -0
  24. package/bin/presence-websocket/PresenceWebsocketApi.js +32 -0
  25. package/bin/presence-websocket/index.d.ts +2 -0
  26. package/bin/presence-websocket/index.js +2 -0
  27. package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.d.ts +15 -0
  28. package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.js +1 -0
  29. package/package.json +2 -2
  30. package/src/loanCredit/api/LoanCreditDeviceApi.ts +86 -0
  31. package/src/loanCredit/api/interfaces/ILoanCreditDeviceApi.ts +94 -0
  32. package/src/loanCredit/index.ts +3 -0
@@ -0,0 +1,27 @@
1
+ import type { IHttpRequest } from "@fiado/http-client";
2
+ import { StandardResponse } from "@fiado/gateway-adapter";
3
+ import { LoanDeviceEnrollRequest, LoanDeviceEnrollResponse, LoanDeviceEnrollStatusRequest, LoanDeviceEnrollStatusResponse, LoanDeviceLastSeenRequest, LoanDeviceLastSeenResponse, LoanDeviceManualLockRequest, LoanDeviceManualLockResponse, LoanDeviceManualUnlockRequest, LoanDeviceManualUnlockResponse, LoanDeviceStatusRequest, LoanDeviceStatusResponse } from "@fiado/type-kit/bin/loanCredit/index.js";
4
+ import { ILoanCreditDeviceApi } from "./interfaces/ILoanCreditDeviceApi.js";
5
+ /**
6
+ * Publisher HTTP de los endpoints de dispositivo/MDM del lambda `loan-credit-business`
7
+ * (componente 09 SureKeep F2). Contrato y semántica completos → `ILoanCreditDeviceApi`
8
+ * (tenantId obligatorio, `StandardResponse` → leer `result.data`, granularidad por ítem).
9
+ *
10
+ * Env var requerida en el consumer: `LOAN_CREDIT_BUSINESS_URL`.
11
+ * El template.yml del consumer la setea con:
12
+ *
13
+ * LOAN_CREDIT_BUSINESS_URL: '{{resolve:ssm:loan-credit-business}}'
14
+ *
15
+ * Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
16
+ */
17
+ export default class LoanCreditDeviceApi implements ILoanCreditDeviceApi {
18
+ private httpRequest;
19
+ private readonly baseUrl;
20
+ constructor(httpRequest: IHttpRequest);
21
+ enroll(input: LoanDeviceEnrollRequest, tenantId: string): Promise<StandardResponse<LoanDeviceEnrollResponse>>;
22
+ getEnrollStatus(input: LoanDeviceEnrollStatusRequest, tenantId: string): Promise<StandardResponse<LoanDeviceEnrollStatusResponse>>;
23
+ getStatus(input: LoanDeviceStatusRequest, tenantId: string): Promise<StandardResponse<LoanDeviceStatusResponse>>;
24
+ getLastSeen(input: LoanDeviceLastSeenRequest, tenantId: string): Promise<StandardResponse<LoanDeviceLastSeenResponse>>;
25
+ manualLock(input: LoanDeviceManualLockRequest, tenantId: string): Promise<StandardResponse<LoanDeviceManualLockResponse>>;
26
+ manualUnlock(input: LoanDeviceManualUnlockRequest, tenantId: string): Promise<StandardResponse<LoanDeviceManualUnlockResponse>>;
27
+ }
@@ -0,0 +1,63 @@
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
+ /**
15
+ * Publisher HTTP de los endpoints de dispositivo/MDM del lambda `loan-credit-business`
16
+ * (componente 09 SureKeep F2). Contrato y semántica completos → `ILoanCreditDeviceApi`
17
+ * (tenantId obligatorio, `StandardResponse` → leer `result.data`, granularidad por ítem).
18
+ *
19
+ * Env var requerida en el consumer: `LOAN_CREDIT_BUSINESS_URL`.
20
+ * El template.yml del consumer la setea con:
21
+ *
22
+ * LOAN_CREDIT_BUSINESS_URL: '{{resolve:ssm:loan-credit-business}}'
23
+ *
24
+ * Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
25
+ */
26
+ let LoanCreditDeviceApi = class LoanCreditDeviceApi {
27
+ httpRequest;
28
+ // El buildspec publica la URL en SSM con "/" final — se normaliza para no armar "//private".
29
+ baseUrl = (process.env.LOAN_CREDIT_BUSINESS_URL || "").replace(/\/+$/, "");
30
+ constructor(httpRequest) {
31
+ this.httpRequest = httpRequest;
32
+ }
33
+ async enroll(input, tenantId) {
34
+ const url = `${this.baseUrl}/private/devices/enroll?tenantId=${encodeURIComponent(tenantId)}`;
35
+ return await this.httpRequest.post(url, input);
36
+ }
37
+ async getEnrollStatus(input, tenantId) {
38
+ const url = `${this.baseUrl}/private/devices/enroll-status?tenantId=${encodeURIComponent(tenantId)}`;
39
+ return await this.httpRequest.post(url, input);
40
+ }
41
+ async getStatus(input, tenantId) {
42
+ const url = `${this.baseUrl}/private/devices/status?tenantId=${encodeURIComponent(tenantId)}`;
43
+ return await this.httpRequest.post(url, input);
44
+ }
45
+ async getLastSeen(input, tenantId) {
46
+ const url = `${this.baseUrl}/private/devices/last-seen?tenantId=${encodeURIComponent(tenantId)}`;
47
+ return await this.httpRequest.post(url, input);
48
+ }
49
+ async manualLock(input, tenantId) {
50
+ const url = `${this.baseUrl}/private/devices/manual-lock?tenantId=${encodeURIComponent(tenantId)}`;
51
+ return await this.httpRequest.post(url, input);
52
+ }
53
+ async manualUnlock(input, tenantId) {
54
+ const url = `${this.baseUrl}/private/devices/manual-unlock?tenantId=${encodeURIComponent(tenantId)}`;
55
+ return await this.httpRequest.post(url, input);
56
+ }
57
+ };
58
+ LoanCreditDeviceApi = __decorate([
59
+ injectable(),
60
+ __param(0, inject("IHttpRequest")),
61
+ __metadata("design:paramtypes", [Object])
62
+ ], LoanCreditDeviceApi);
63
+ export default LoanCreditDeviceApi;
@@ -0,0 +1,57 @@
1
+ import { StandardResponse } from "@fiado/gateway-adapter";
2
+ import { LoanDeviceEnrollRequest, LoanDeviceEnrollResponse, LoanDeviceEnrollStatusRequest, LoanDeviceEnrollStatusResponse, LoanDeviceLastSeenRequest, LoanDeviceLastSeenResponse, LoanDeviceManualLockRequest, LoanDeviceManualLockResponse, LoanDeviceManualUnlockRequest, LoanDeviceManualUnlockResponse, LoanDeviceStatusRequest, LoanDeviceStatusResponse } from "@fiado/type-kit/bin/loanCredit/index.js";
3
+ /**
4
+ * Contrato del publisher de dispositivo/MDM de `loan-credit-business` (componente 09 SureKeep F2).
5
+ * Endpoints PRIVADOS (VPC) que envuelven al motor MDM: enrolamiento del equipo, consulta de estado
6
+ * y bloqueo/desbloqueo manual. El contrato de crédito vive en `ILoanCreditBusinessApi`.
7
+ *
8
+ * Convenciones (idénticas a `ILoanCreditBusinessApi`):
9
+ * - `tenantId` OBLIGATORIO en todos los métodos — viaja por query `?tenantId=` (convención de los
10
+ * privados Fiado). Sin él el lambda responde `400 UNKNOWN_TENANT` (fail-closed, nunca default).
11
+ * - Retorna `StandardResponse<T>` → leer `result.data` (NO `result.body`).
12
+ * - Errores de transporte (falla el lambda entero, no un ítem): el publisher RECHAZA con el
13
+ * `DomainError` tipado del motor — `400 UNKNOWN_TENANT` / `400` de validación del body /
14
+ * `5xx` del motor. Nunca fallback: el caller jamás recibe un batch vacío disfrazado de éxito.
15
+ * - Idempotencia: las 3 mutaciones (`enroll`, `manualLock`, `manualUnlock`) son idempotentes por
16
+ * `input.operationReference` — es el idempotencyKey del caller. Reintentar el mismo lote con la
17
+ * misma referencia no vuelve a enrolar ni a bloquear; sin ella un retry tras timeout duplica.
18
+ *
19
+ * Granularidad POR ÍTEM — el batch NUNCA falla entero:
20
+ * - Cada `results[i]` trae su propio `status` (`SUCCESS` | `PENDING` | `ERROR`) y un `error`
21
+ * opcional. Un `StandardResponse` 200 puede traer ítems en `ERROR`: el caller TIENE que recorrer
22
+ * `results` y decidir por ítem — nunca asumir éxito global por el status HTTP.
23
+ * - El `error.code` del ítem es un `MdmErrorCodeEnum` (`PROVIDER_NOT_SUPPORTED`, `DEVICE_NOT_FOUND`,
24
+ * `PROVIDER_TIMEOUT`, …). El `status` del ítem NO lleva el motivo: el motivo vive solo en `error`.
25
+ * - `status: PENDING` = operación asíncrona en vuelo (típico de `enroll`). La resuelve el polling
26
+ * interno del motor; el caller la consulta después con `getEnrollStatus`.
27
+ *
28
+ * Env var requerida en el consumer:
29
+ *
30
+ * LOAN_CREDIT_BUSINESS_URL: '{{resolve:ssm:loan-credit-business}}'
31
+ */
32
+ export interface ILoanCreditDeviceApi {
33
+ /**
34
+ * Enrola el equipo del crédito en el MDM (paso 09 del wizard). Típicamente devuelve el ítem en
35
+ * `PENDING`: el enrolamiento es asíncrono y se confirma después con `getEnrollStatus`.
36
+ */
37
+ enroll(input: LoanDeviceEnrollRequest, tenantId: string): Promise<StandardResponse<LoanDeviceEnrollResponse>>;
38
+ /**
39
+ * Consulta en qué punto va el enrolamiento de cada crédito.
40
+ * Es POST y no GET porque el lote de `creditIds` puede traer miles de ids y no caben en la URL.
41
+ */
42
+ getEnrollStatus(input: LoanDeviceEnrollStatusRequest, tenantId: string): Promise<StandardResponse<LoanDeviceEnrollStatusResponse>>;
43
+ /**
44
+ * Estado actual del dispositivo de cada crédito (bloqueado, libre, sin enrolar).
45
+ * Es POST y no GET porque el lote de `creditIds` puede traer miles de ids y no caben en la URL.
46
+ */
47
+ getStatus(input: LoanDeviceStatusRequest, tenantId: string): Promise<StandardResponse<LoanDeviceStatusResponse>>;
48
+ /**
49
+ * Último contacto reportado por el dispositivo de cada crédito (señal de vida para cobranza).
50
+ * Es POST y no GET porque el lote de `creditIds` puede traer miles de ids y no caben en la URL.
51
+ */
52
+ getLastSeen(input: LoanDeviceLastSeenRequest, tenantId: string): Promise<StandardResponse<LoanDeviceLastSeenResponse>>;
53
+ /** Bloqueo manual del dispositivo disparado desde el backoffice (acción de un operador). */
54
+ manualLock(input: LoanDeviceManualLockRequest, tenantId: string): Promise<StandardResponse<LoanDeviceManualLockResponse>>;
55
+ /** Desbloqueo manual del dispositivo disparado desde el backoffice (acción de un operador). */
56
+ manualUnlock(input: LoanDeviceManualUnlockRequest, tenantId: string): Promise<StandardResponse<LoanDeviceManualUnlockResponse>>;
57
+ }
@@ -1,2 +1,4 @@
1
1
  export * from "./api/interfaces/ILoanCreditBusinessApi.js";
2
2
  export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
3
+ export * from "./api/interfaces/ILoanCreditDeviceApi.js";
4
+ export { default as LoanCreditDeviceApi } from "./api/LoanCreditDeviceApi.js";
@@ -1,2 +1,4 @@
1
1
  export * from "./api/interfaces/ILoanCreditBusinessApi.js";
2
2
  export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
3
+ export * from "./api/interfaces/ILoanCreditDeviceApi.js";
4
+ export { default as LoanCreditDeviceApi } from "./api/LoanCreditDeviceApi.js";
@@ -0,0 +1,12 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IMembershipApi } from "./interfaces/IMembershipApi.js";
3
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
+ export declare class MembershipApi implements IMembershipApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
+ deletedCount: number;
10
+ }>>;
11
+ }
12
+ export {};
@@ -0,0 +1,32 @@
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
+ import dotenv from 'dotenv';
15
+ dotenv.config();
16
+ let MembershipApi = class MembershipApi {
17
+ httpRequest;
18
+ baseUrl = process.env.MEMBERSHIP_BUSINESS_LAMBDA_URL || "";
19
+ constructor(httpRequest) {
20
+ this.httpRequest = httpRequest;
21
+ }
22
+ async deleteByDirectoryId(directoryId) {
23
+ const url = `${this.baseUrl}private/directory/${directoryId}`;
24
+ return await this.httpRequest.delete(url);
25
+ }
26
+ };
27
+ MembershipApi = __decorate([
28
+ injectable(),
29
+ __param(0, inject("IHttpRequest")),
30
+ __metadata("design:paramtypes", [Object])
31
+ ], MembershipApi);
32
+ export { MembershipApi };
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IMembershipApi.js';
2
+ export * from './MembershipApi.js';
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IMembershipApi.js';
2
+ export * from './MembershipApi.js';
@@ -0,0 +1,15 @@
1
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
+ /**
3
+ * Interfaz para el servicio Membership (membership-business).
4
+ */
5
+ export interface IMembershipApi {
6
+ /**
7
+ * Borra en cascada las membresías asociadas a un directoryId.
8
+ * @param directoryId ID del directorio.
9
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
+ */
11
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
+ deletedCount: number;
13
+ }>>;
14
+ }
15
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { INotificationWebsocketApi } from "./interfaces/INotificationWebsocketApi.js";
3
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
+ export declare class NotificationWebsocketApi implements INotificationWebsocketApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
+ deletedCount: number;
10
+ }>>;
11
+ }
12
+ export {};
@@ -0,0 +1,32 @@
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
+ import dotenv from 'dotenv';
15
+ dotenv.config();
16
+ let NotificationWebsocketApi = class NotificationWebsocketApi {
17
+ httpRequest;
18
+ baseUrl = process.env.NOTIFICATIONS_WEBSOCKET_LAMBDA_URL || "";
19
+ constructor(httpRequest) {
20
+ this.httpRequest = httpRequest;
21
+ }
22
+ async deleteByDirectoryId(directoryId) {
23
+ const url = `${this.baseUrl}private/directory/${directoryId}`;
24
+ return await this.httpRequest.delete(url);
25
+ }
26
+ };
27
+ NotificationWebsocketApi = __decorate([
28
+ injectable(),
29
+ __param(0, inject("IHttpRequest")),
30
+ __metadata("design:paramtypes", [Object])
31
+ ], NotificationWebsocketApi);
32
+ export { NotificationWebsocketApi };
@@ -0,0 +1,15 @@
1
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
+ /**
3
+ * Interfaz para el servicio Notifications Websocket (notifications-websocket).
4
+ */
5
+ export interface INotificationWebsocketApi {
6
+ /**
7
+ * Borra en cascada las conexiones/notificaciones WS asociadas a un directoryId.
8
+ * @param directoryId ID del directorio.
9
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
+ */
11
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
+ deletedCount: number;
13
+ }>>;
14
+ }
15
+ export {};
@@ -0,0 +1,12 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IPerformanceProfileApi } from "./interfaces/IPerformanceProfileApi.js";
3
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
+ export declare class PerformanceProfileApi implements IPerformanceProfileApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
+ deletedCount: number;
10
+ }>>;
11
+ }
12
+ export {};
@@ -0,0 +1,32 @@
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
+ import dotenv from 'dotenv';
15
+ dotenv.config();
16
+ let PerformanceProfileApi = class PerformanceProfileApi {
17
+ httpRequest;
18
+ baseUrl = process.env.PERFORMANCE_PROFILE_BUSINESS_LAMBDA_URL || "";
19
+ constructor(httpRequest) {
20
+ this.httpRequest = httpRequest;
21
+ }
22
+ async deleteByDirectoryId(directoryId) {
23
+ const url = `${this.baseUrl}private/directory/${directoryId}`;
24
+ return await this.httpRequest.delete(url);
25
+ }
26
+ };
27
+ PerformanceProfileApi = __decorate([
28
+ injectable(),
29
+ __param(0, inject("IHttpRequest")),
30
+ __metadata("design:paramtypes", [Object])
31
+ ], PerformanceProfileApi);
32
+ export { PerformanceProfileApi };
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IPerformanceProfileApi.js';
2
+ export * from './PerformanceProfileApi.js';
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IPerformanceProfileApi.js';
2
+ export * from './PerformanceProfileApi.js';
@@ -0,0 +1,15 @@
1
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
+ /**
3
+ * Interfaz para el servicio Performance Profile (performance-profile-business).
4
+ */
5
+ export interface IPerformanceProfileApi {
6
+ /**
7
+ * Borra en cascada los perfiles de desempeño asociados a un directoryId.
8
+ * @param directoryId ID del directorio.
9
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
+ */
11
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
+ deletedCount: number;
13
+ }>>;
14
+ }
15
+ export {};
@@ -0,0 +1,12 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IPresenceWebsocketApi } from "./interfaces/IPresenceWebsocketApi.js";
3
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
4
+ export declare class PresenceWebsocketApi implements IPresenceWebsocketApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
9
+ deletedCount: number;
10
+ }>>;
11
+ }
12
+ export {};
@@ -0,0 +1,32 @@
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
+ import dotenv from 'dotenv';
15
+ dotenv.config();
16
+ let PresenceWebsocketApi = class PresenceWebsocketApi {
17
+ httpRequest;
18
+ baseUrl = process.env.PRESENCE_WEBSOCKET_LAMBDA_URL || "";
19
+ constructor(httpRequest) {
20
+ this.httpRequest = httpRequest;
21
+ }
22
+ async deleteByDirectoryId(directoryId) {
23
+ const url = `${this.baseUrl}private/directory/${directoryId}`;
24
+ return await this.httpRequest.delete(url);
25
+ }
26
+ };
27
+ PresenceWebsocketApi = __decorate([
28
+ injectable(),
29
+ __param(0, inject("IHttpRequest")),
30
+ __metadata("design:paramtypes", [Object])
31
+ ], PresenceWebsocketApi);
32
+ export { PresenceWebsocketApi };
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IPresenceWebsocketApi.js';
2
+ export * from './PresenceWebsocketApi.js';
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IPresenceWebsocketApi.js';
2
+ export * from './PresenceWebsocketApi.js';
@@ -0,0 +1,15 @@
1
+ type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
2
+ /**
3
+ * Interfaz para el servicio Presence Websocket (presence-websocket).
4
+ */
5
+ export interface IPresenceWebsocketApi {
6
+ /**
7
+ * Borra en cascada los registros de presencia asociados a un directoryId.
8
+ * @param directoryId ID del directorio.
9
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
10
+ */
11
+ deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
12
+ deletedCount: number;
13
+ }>>;
14
+ }
15
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.34.0",
3
+ "version": "5.35.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",
@@ -34,7 +34,7 @@
34
34
  "@fiado/gateway-adapter": "^3.9.0",
35
35
  "@fiado/http-client": "^2.0.1",
36
36
  "@fiado/logger": "^1.1.3",
37
- "@fiado/type-kit": "^3.327.0",
37
+ "@fiado/type-kit": "^3.329.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -0,0 +1,86 @@
1
+ import { inject, injectable } from "inversify";
2
+ import type { IHttpRequest } from "@fiado/http-client";
3
+ import { StandardResponse } from "@fiado/gateway-adapter";
4
+ import {
5
+ LoanDeviceEnrollRequest,
6
+ LoanDeviceEnrollResponse,
7
+ LoanDeviceEnrollStatusRequest,
8
+ LoanDeviceEnrollStatusResponse,
9
+ LoanDeviceLastSeenRequest,
10
+ LoanDeviceLastSeenResponse,
11
+ LoanDeviceManualLockRequest,
12
+ LoanDeviceManualLockResponse,
13
+ LoanDeviceManualUnlockRequest,
14
+ LoanDeviceManualUnlockResponse,
15
+ LoanDeviceStatusRequest,
16
+ LoanDeviceStatusResponse,
17
+ } from "@fiado/type-kit/bin/loanCredit/index.js";
18
+ import { ILoanCreditDeviceApi } from "./interfaces/ILoanCreditDeviceApi.js";
19
+
20
+ /**
21
+ * Publisher HTTP de los endpoints de dispositivo/MDM del lambda `loan-credit-business`
22
+ * (componente 09 SureKeep F2). Contrato y semántica completos → `ILoanCreditDeviceApi`
23
+ * (tenantId obligatorio, `StandardResponse` → leer `result.data`, granularidad por ítem).
24
+ *
25
+ * Env var requerida en el consumer: `LOAN_CREDIT_BUSINESS_URL`.
26
+ * El template.yml del consumer la setea con:
27
+ *
28
+ * LOAN_CREDIT_BUSINESS_URL: '{{resolve:ssm:loan-credit-business}}'
29
+ *
30
+ * Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
31
+ */
32
+ @injectable()
33
+ export default class LoanCreditDeviceApi implements ILoanCreditDeviceApi {
34
+ // El buildspec publica la URL en SSM con "/" final — se normaliza para no armar "//private".
35
+ private readonly baseUrl = (process.env.LOAN_CREDIT_BUSINESS_URL || "").replace(/\/+$/, "");
36
+
37
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
38
+
39
+ async enroll(
40
+ input: LoanDeviceEnrollRequest,
41
+ tenantId: string,
42
+ ): Promise<StandardResponse<LoanDeviceEnrollResponse>> {
43
+ const url = `${this.baseUrl}/private/devices/enroll?tenantId=${encodeURIComponent(tenantId)}`;
44
+ return await this.httpRequest.post(url, input);
45
+ }
46
+
47
+ async getEnrollStatus(
48
+ input: LoanDeviceEnrollStatusRequest,
49
+ tenantId: string,
50
+ ): Promise<StandardResponse<LoanDeviceEnrollStatusResponse>> {
51
+ const url = `${this.baseUrl}/private/devices/enroll-status?tenantId=${encodeURIComponent(tenantId)}`;
52
+ return await this.httpRequest.post(url, input);
53
+ }
54
+
55
+ async getStatus(
56
+ input: LoanDeviceStatusRequest,
57
+ tenantId: string,
58
+ ): Promise<StandardResponse<LoanDeviceStatusResponse>> {
59
+ const url = `${this.baseUrl}/private/devices/status?tenantId=${encodeURIComponent(tenantId)}`;
60
+ return await this.httpRequest.post(url, input);
61
+ }
62
+
63
+ async getLastSeen(
64
+ input: LoanDeviceLastSeenRequest,
65
+ tenantId: string,
66
+ ): Promise<StandardResponse<LoanDeviceLastSeenResponse>> {
67
+ const url = `${this.baseUrl}/private/devices/last-seen?tenantId=${encodeURIComponent(tenantId)}`;
68
+ return await this.httpRequest.post(url, input);
69
+ }
70
+
71
+ async manualLock(
72
+ input: LoanDeviceManualLockRequest,
73
+ tenantId: string,
74
+ ): Promise<StandardResponse<LoanDeviceManualLockResponse>> {
75
+ const url = `${this.baseUrl}/private/devices/manual-lock?tenantId=${encodeURIComponent(tenantId)}`;
76
+ return await this.httpRequest.post(url, input);
77
+ }
78
+
79
+ async manualUnlock(
80
+ input: LoanDeviceManualUnlockRequest,
81
+ tenantId: string,
82
+ ): Promise<StandardResponse<LoanDeviceManualUnlockResponse>> {
83
+ const url = `${this.baseUrl}/private/devices/manual-unlock?tenantId=${encodeURIComponent(tenantId)}`;
84
+ return await this.httpRequest.post(url, input);
85
+ }
86
+ }
@@ -0,0 +1,94 @@
1
+ import { StandardResponse } from "@fiado/gateway-adapter";
2
+ import {
3
+ LoanDeviceEnrollRequest,
4
+ LoanDeviceEnrollResponse,
5
+ LoanDeviceEnrollStatusRequest,
6
+ LoanDeviceEnrollStatusResponse,
7
+ LoanDeviceLastSeenRequest,
8
+ LoanDeviceLastSeenResponse,
9
+ LoanDeviceManualLockRequest,
10
+ LoanDeviceManualLockResponse,
11
+ LoanDeviceManualUnlockRequest,
12
+ LoanDeviceManualUnlockResponse,
13
+ LoanDeviceStatusRequest,
14
+ LoanDeviceStatusResponse,
15
+ } from "@fiado/type-kit/bin/loanCredit/index.js";
16
+
17
+ /**
18
+ * Contrato del publisher de dispositivo/MDM de `loan-credit-business` (componente 09 SureKeep F2).
19
+ * Endpoints PRIVADOS (VPC) que envuelven al motor MDM: enrolamiento del equipo, consulta de estado
20
+ * y bloqueo/desbloqueo manual. El contrato de crédito vive en `ILoanCreditBusinessApi`.
21
+ *
22
+ * Convenciones (idénticas a `ILoanCreditBusinessApi`):
23
+ * - `tenantId` OBLIGATORIO en todos los métodos — viaja por query `?tenantId=` (convención de los
24
+ * privados Fiado). Sin él el lambda responde `400 UNKNOWN_TENANT` (fail-closed, nunca default).
25
+ * - Retorna `StandardResponse<T>` → leer `result.data` (NO `result.body`).
26
+ * - Errores de transporte (falla el lambda entero, no un ítem): el publisher RECHAZA con el
27
+ * `DomainError` tipado del motor — `400 UNKNOWN_TENANT` / `400` de validación del body /
28
+ * `5xx` del motor. Nunca fallback: el caller jamás recibe un batch vacío disfrazado de éxito.
29
+ * - Idempotencia: las 3 mutaciones (`enroll`, `manualLock`, `manualUnlock`) son idempotentes por
30
+ * `input.operationReference` — es el idempotencyKey del caller. Reintentar el mismo lote con la
31
+ * misma referencia no vuelve a enrolar ni a bloquear; sin ella un retry tras timeout duplica.
32
+ *
33
+ * Granularidad POR ÍTEM — el batch NUNCA falla entero:
34
+ * - Cada `results[i]` trae su propio `status` (`SUCCESS` | `PENDING` | `ERROR`) y un `error`
35
+ * opcional. Un `StandardResponse` 200 puede traer ítems en `ERROR`: el caller TIENE que recorrer
36
+ * `results` y decidir por ítem — nunca asumir éxito global por el status HTTP.
37
+ * - El `error.code` del ítem es un `MdmErrorCodeEnum` (`PROVIDER_NOT_SUPPORTED`, `DEVICE_NOT_FOUND`,
38
+ * `PROVIDER_TIMEOUT`, …). El `status` del ítem NO lleva el motivo: el motivo vive solo en `error`.
39
+ * - `status: PENDING` = operación asíncrona en vuelo (típico de `enroll`). La resuelve el polling
40
+ * interno del motor; el caller la consulta después con `getEnrollStatus`.
41
+ *
42
+ * Env var requerida en el consumer:
43
+ *
44
+ * LOAN_CREDIT_BUSINESS_URL: '{{resolve:ssm:loan-credit-business}}'
45
+ */
46
+ export interface ILoanCreditDeviceApi {
47
+ /**
48
+ * Enrola el equipo del crédito en el MDM (paso 09 del wizard). Típicamente devuelve el ítem en
49
+ * `PENDING`: el enrolamiento es asíncrono y se confirma después con `getEnrollStatus`.
50
+ */
51
+ enroll(
52
+ input: LoanDeviceEnrollRequest,
53
+ tenantId: string,
54
+ ): Promise<StandardResponse<LoanDeviceEnrollResponse>>;
55
+
56
+ /**
57
+ * Consulta en qué punto va el enrolamiento de cada crédito.
58
+ * Es POST y no GET porque el lote de `creditIds` puede traer miles de ids y no caben en la URL.
59
+ */
60
+ getEnrollStatus(
61
+ input: LoanDeviceEnrollStatusRequest,
62
+ tenantId: string,
63
+ ): Promise<StandardResponse<LoanDeviceEnrollStatusResponse>>;
64
+
65
+ /**
66
+ * Estado actual del dispositivo de cada crédito (bloqueado, libre, sin enrolar).
67
+ * Es POST y no GET porque el lote de `creditIds` puede traer miles de ids y no caben en la URL.
68
+ */
69
+ getStatus(
70
+ input: LoanDeviceStatusRequest,
71
+ tenantId: string,
72
+ ): Promise<StandardResponse<LoanDeviceStatusResponse>>;
73
+
74
+ /**
75
+ * Último contacto reportado por el dispositivo de cada crédito (señal de vida para cobranza).
76
+ * Es POST y no GET porque el lote de `creditIds` puede traer miles de ids y no caben en la URL.
77
+ */
78
+ getLastSeen(
79
+ input: LoanDeviceLastSeenRequest,
80
+ tenantId: string,
81
+ ): Promise<StandardResponse<LoanDeviceLastSeenResponse>>;
82
+
83
+ /** Bloqueo manual del dispositivo disparado desde el backoffice (acción de un operador). */
84
+ manualLock(
85
+ input: LoanDeviceManualLockRequest,
86
+ tenantId: string,
87
+ ): Promise<StandardResponse<LoanDeviceManualLockResponse>>;
88
+
89
+ /** Desbloqueo manual del dispositivo disparado desde el backoffice (acción de un operador). */
90
+ manualUnlock(
91
+ input: LoanDeviceManualUnlockRequest,
92
+ tenantId: string,
93
+ ): Promise<StandardResponse<LoanDeviceManualUnlockResponse>>;
94
+ }
@@ -1,2 +1,5 @@
1
1
  export * from "./api/interfaces/ILoanCreditBusinessApi.js";
2
2
  export { default as LoanCreditBusinessApi } from "./api/LoanCreditBusinessApi.js";
3
+
4
+ export * from "./api/interfaces/ILoanCreditDeviceApi.js";
5
+ export { default as LoanCreditDeviceApi } from "./api/LoanCreditDeviceApi.js";