@fiado/api-invoker 5.16.0 → 5.18.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/container.config.js +3 -0
- package/bin/datalakeQuery/api/DatalakeQueryBusinessApi.d.ts +22 -0
- package/bin/datalakeQuery/api/DatalakeQueryBusinessApi.js +50 -0
- package/bin/datalakeQuery/api/interfaces/IDatalakeQueryBusinessApi.d.ts +61 -0
- package/bin/datalakeQuery/api/interfaces/IDatalakeQueryBusinessApi.js +1 -0
- package/bin/datalakeQuery/index.d.ts +2 -0
- package/bin/datalakeQuery/index.js +2 -0
- package/bin/domain-callback/api/DomainCallbackApi.d.ts +15 -0
- package/bin/domain-callback/api/DomainCallbackApi.js +34 -0
- package/bin/domain-callback/api/interfaces/IDomainCallbackApi.d.ts +19 -0
- package/bin/domain-callback/api/interfaces/IDomainCallbackApi.js +1 -0
- package/bin/domain-callback/index.d.ts +2 -0
- package/bin/domain-callback/index.js +2 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +2 -0
- package/bin/membership/MembershipApi.d.ts +12 -0
- package/bin/membership/MembershipApi.js +32 -0
- package/bin/membership/index.d.ts +2 -0
- package/bin/membership/index.js +2 -0
- package/bin/membership/interfaces/IMembershipApi.d.ts +15 -0
- package/bin/membership/interfaces/IMembershipApi.js +1 -0
- package/bin/notificationWebsockets/NotificationWebsocketApi.d.ts +12 -0
- package/bin/notificationWebsockets/NotificationWebsocketApi.js +32 -0
- package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.d.ts +15 -0
- package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.js +1 -0
- package/bin/performance-profile/PerformanceProfileApi.d.ts +12 -0
- package/bin/performance-profile/PerformanceProfileApi.js +32 -0
- package/bin/performance-profile/index.d.ts +2 -0
- package/bin/performance-profile/index.js +2 -0
- package/bin/performance-profile/interfaces/IPerformanceProfileApi.d.ts +15 -0
- package/bin/performance-profile/interfaces/IPerformanceProfileApi.js +1 -0
- package/bin/presence-websocket/PresenceWebsocketApi.d.ts +12 -0
- package/bin/presence-websocket/PresenceWebsocketApi.js +32 -0
- package/bin/presence-websocket/index.d.ts +2 -0
- package/bin/presence-websocket/index.js +2 -0
- package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.d.ts +15 -0
- package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.js +1 -0
- package/package.json +2 -2
- package/src/container.config.ts +7 -0
- package/src/datalakeQuery/api/DatalakeQueryBusinessApi.ts +46 -0
- package/src/datalakeQuery/api/interfaces/IDatalakeQueryBusinessApi.ts +66 -0
- package/src/datalakeQuery/index.ts +2 -0
- package/src/domain-callback/api/DomainCallbackApi.ts +23 -0
- package/src/domain-callback/api/interfaces/IDomainCallbackApi.ts +21 -0
- package/src/domain-callback/index.ts +2 -0
- package/src/index.ts +2 -0
package/bin/container.config.js
CHANGED
|
@@ -129,6 +129,7 @@ import { AuthBusinessApi } from "./auth-business/index.js";
|
|
|
129
129
|
// KYC verifications business — lectura confirmatoria server-side del KYC por directoryId (SureKeep F2)
|
|
130
130
|
import { KycVerificationsBusinessApi } from "./kyc/index.js";
|
|
131
131
|
import CollectionEngineApi from "./collection-engine/api/CollectionEngineApi.js";
|
|
132
|
+
import DomainCallbackApi from "./domain-callback/api/DomainCallbackApi.js";
|
|
132
133
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
133
134
|
// UTILS bindings
|
|
134
135
|
bind("InvokerUtils").to(InvokerUtils);
|
|
@@ -274,4 +275,6 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
274
275
|
bind("IKycVerificationsBusinessApi").to(KycVerificationsBusinessApi);
|
|
275
276
|
// Collection engine — motor de cobro central multitenant (collect/registerCollectible/deregister)
|
|
276
277
|
bind("ICollectionEngineApi").to(CollectionEngineApi);
|
|
278
|
+
// Domain callback — el motor notifica al dominio dueño del cargo (applyCollectionResult)
|
|
279
|
+
bind("IDomainCallbackApi").to(DomainCallbackApi);
|
|
277
280
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import { AggregateRequestDto, ReportResultDto } from "@fiado/type-kit/bin/datalakeQuery/index.js";
|
|
4
|
+
import { IDatalakeQueryBusinessApi } from "./interfaces/IDatalakeQueryBusinessApi.js";
|
|
5
|
+
/**
|
|
6
|
+
* Publisher HTTP de `datalake-query-business` — el bibliotecario del data lake.
|
|
7
|
+
*
|
|
8
|
+
* Contrato y semántica completos → `IDatalakeQueryBusinessApi`.
|
|
9
|
+
*
|
|
10
|
+
* Env var requerida en el consumer: `DATALAKE_QUERY_BUSINESS_URL`, resuelta desde
|
|
11
|
+
* `{{resolve:ssm:datalake-query-business}}`.
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ Los paths **no** están verificados contra dev: el lambda todavía no se ha desplegado, porque
|
|
14
|
+
* el data lake no tiene aún las tablas en estado consultable. Matchean su `openapi/private.yaml`.
|
|
15
|
+
*/
|
|
16
|
+
export default class DatalakeQueryBusinessApi implements IDatalakeQueryBusinessApi {
|
|
17
|
+
private httpRequest;
|
|
18
|
+
private readonly baseUrl;
|
|
19
|
+
constructor(httpRequest: IHttpRequest);
|
|
20
|
+
aggregate(request: AggregateRequestDto): Promise<StandardResponse<ReportResultDto>>;
|
|
21
|
+
getJob(jobId: string, tenantId: string, nextToken?: string): Promise<StandardResponse<ReportResultDto>>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 `datalake-query-business` — el bibliotecario del data lake.
|
|
16
|
+
*
|
|
17
|
+
* Contrato y semántica completos → `IDatalakeQueryBusinessApi`.
|
|
18
|
+
*
|
|
19
|
+
* Env var requerida en el consumer: `DATALAKE_QUERY_BUSINESS_URL`, resuelta desde
|
|
20
|
+
* `{{resolve:ssm:datalake-query-business}}`.
|
|
21
|
+
*
|
|
22
|
+
* ⚠️ Los paths **no** están verificados contra dev: el lambda todavía no se ha desplegado, porque
|
|
23
|
+
* el data lake no tiene aún las tablas en estado consultable. Matchean su `openapi/private.yaml`.
|
|
24
|
+
*/
|
|
25
|
+
let DatalakeQueryBusinessApi = class DatalakeQueryBusinessApi {
|
|
26
|
+
httpRequest;
|
|
27
|
+
baseUrl = process.env.DATALAKE_QUERY_BUSINESS_URL || "";
|
|
28
|
+
constructor(httpRequest) {
|
|
29
|
+
this.httpRequest = httpRequest;
|
|
30
|
+
}
|
|
31
|
+
async aggregate(request) {
|
|
32
|
+
const url = `${this.baseUrl}/private/analytics/aggregate`;
|
|
33
|
+
// El tenant va en el CUERPO, en su propio campo — nunca mezclado con el reporte ni usado
|
|
34
|
+
// como valor dentro del SQL. El destino lo resuelve contra el registry.
|
|
35
|
+
return await this.httpRequest.post(url, request);
|
|
36
|
+
}
|
|
37
|
+
async getJob(jobId, tenantId, nextToken) {
|
|
38
|
+
const params = new URLSearchParams({ tenantId });
|
|
39
|
+
if (nextToken)
|
|
40
|
+
params.set("nextToken", nextToken);
|
|
41
|
+
const url = `${this.baseUrl}/private/analytics/jobs/${encodeURIComponent(jobId)}?${params.toString()}`;
|
|
42
|
+
return await this.httpRequest.get(url);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
DatalakeQueryBusinessApi = __decorate([
|
|
46
|
+
injectable(),
|
|
47
|
+
__param(0, inject("IHttpRequest")),
|
|
48
|
+
__metadata("design:paramtypes", [Object])
|
|
49
|
+
], DatalakeQueryBusinessApi);
|
|
50
|
+
export default DatalakeQueryBusinessApi;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import { AggregateRequestDto, ReportResultDto } from "@fiado/type-kit/bin/datalakeQuery/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Contrato del publisher HTTP de `datalake-query-business` — **el único lambda que consulta el
|
|
5
|
+
* data lake**.
|
|
6
|
+
*
|
|
7
|
+
* Los demás no hablan con Athena: le hablan a él. Así el rol cross-account, el compilador de SQL y
|
|
8
|
+
* los predicados de aislamiento viven en UN solo lugar, y el día que cambie el modelo (rol por
|
|
9
|
+
* tenant, Lake Formation) se toca un repo, no cuatro.
|
|
10
|
+
*
|
|
11
|
+
* Consumidores previstos:
|
|
12
|
+
* - `retail-org-business` → KPIs de tiendas y vendedores (piezas, vendido, vs 7d)
|
|
13
|
+
* - `retail-wizard-business` → agregados del portal y estadísticas de venta
|
|
14
|
+
*
|
|
15
|
+
* Env var requerida en el consumer: `DATALAKE_QUERY_BUSINESS_URL`.
|
|
16
|
+
* El template.yml del consumer la setea con:
|
|
17
|
+
*
|
|
18
|
+
* DATALAKE_QUERY_BUSINESS_URL: '{{resolve:ssm:datalake-query-business}}'
|
|
19
|
+
*
|
|
20
|
+
* Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
|
|
21
|
+
*
|
|
22
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
23
|
+
* `tenantId` y `callerService` son OBLIGATORIOS — no son detalle de firma
|
|
24
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
25
|
+
* Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así
|
|
26
|
+
* que el destino no tiene `issuer` y **no puede inferir el silo**. El caller lo declara y
|
|
27
|
+
* `@fiado/tenant-context` asume el rol de ESE silo. Sin `tenantId` → error; **nunca hay default**:
|
|
28
|
+
* caer a uno sería fail-OPEN y podría devolver datos de otra SOFOM.
|
|
29
|
+
*
|
|
30
|
+
* `callerService` queda registrado en el job. Con un privado M2M es lo único que después permite
|
|
31
|
+
* auditar quién pidió por cuál tenant.
|
|
32
|
+
*
|
|
33
|
+
* ⚠️ **Ser privado es aislamiento de red, no de identidad.** Cualquier lambda de la VPC puede decir
|
|
34
|
+
* de qué tenant es. Lo que acota el daño es que una mentira da **exactamente un** tenant — el que
|
|
35
|
+
* nombró — y que cada corrida queda registrada.
|
|
36
|
+
*
|
|
37
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
38
|
+
* ⚠️ Patrón de retorno: `StandardResponse<T>` — el consumer accede `result.data`, NO `result.body`.
|
|
39
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
40
|
+
*/
|
|
41
|
+
export interface IDatalakeQueryBusinessApi {
|
|
42
|
+
/**
|
|
43
|
+
* Corre un agregado sobre el data lake y devuelve el resultado.
|
|
44
|
+
*
|
|
45
|
+
* 🔴 **La respuesta es un `if`:** si `data.rows` viene, ya está. Si viene solo `data.jobId`, la
|
|
46
|
+
* consulta excedió la espera en línea (~20 s, por el corte duro de API Gateway a los 29) y hay
|
|
47
|
+
* que pollearla. El consumer tiene que manejar los dos casos — asumir que siempre habrá `rows`
|
|
48
|
+
* lo rompe justo con las consultas pesadas, que son las que más importan.
|
|
49
|
+
*
|
|
50
|
+
* El alcance de las filas NO lo decide este request: lo impone el destino a partir del `scope`
|
|
51
|
+
* y del `tenantId`, sobre **cada** tabla del `FROM` y de cada `JOIN`.
|
|
52
|
+
*/
|
|
53
|
+
aggregate(request: AggregateRequestDto): Promise<StandardResponse<ReportResultDto>>;
|
|
54
|
+
/**
|
|
55
|
+
* Estado y filas de un reporte que quedó en polling.
|
|
56
|
+
*
|
|
57
|
+
* El `jobId` es el ULID que devolvió `aggregate`, no el id de Athena — ese no sale nunca del
|
|
58
|
+
* destino. Pedir el job de otro tenant devuelve 404, igual que uno inexistente.
|
|
59
|
+
*/
|
|
60
|
+
getJob(jobId: string, tenantId: string, nextToken?: string): Promise<StandardResponse<ReportResultDto>>;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
3
|
+
import { IDomainCallbackApi } from "./interfaces/IDomainCallbackApi.js";
|
|
4
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
5
|
+
/**
|
|
6
|
+
* Cliente genérico del callback de cobro (motor → dominio). La baseUrl no viene de una env
|
|
7
|
+
* fija del constructor: el motor la resuelve por `domain` (registry `domain→API`) y la pasa
|
|
8
|
+
* en cada llamada, así este mismo cliente sirve para cualquier dominio consumidor.
|
|
9
|
+
*/
|
|
10
|
+
export default class DomainCallbackApi implements IDomainCallbackApi {
|
|
11
|
+
private httpRequest;
|
|
12
|
+
constructor(httpRequest: IHttpRequest);
|
|
13
|
+
applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
* Cliente genérico del callback de cobro (motor → dominio). La baseUrl no viene de una env
|
|
16
|
+
* fija del constructor: el motor la resuelve por `domain` (registry `domain→API`) y la pasa
|
|
17
|
+
* en cada llamada, así este mismo cliente sirve para cualquier dominio consumidor.
|
|
18
|
+
*/
|
|
19
|
+
let DomainCallbackApi = class DomainCallbackApi {
|
|
20
|
+
httpRequest;
|
|
21
|
+
constructor(httpRequest) {
|
|
22
|
+
this.httpRequest = httpRequest;
|
|
23
|
+
}
|
|
24
|
+
async applyCollectionResult(baseUrl, request) {
|
|
25
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/collection/apply-result`;
|
|
26
|
+
return await this.httpRequest.post(url, request);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
DomainCallbackApi = __decorate([
|
|
30
|
+
injectable(),
|
|
31
|
+
__param(0, inject("IHttpRequest")),
|
|
32
|
+
__metadata("design:paramtypes", [Object])
|
|
33
|
+
], DomainCallbackApi);
|
|
34
|
+
export default DomainCallbackApi;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
2
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
3
|
+
/**
|
|
4
|
+
* Cliente genérico que usa el motor de cobro central para notificar a cualquier dominio
|
|
5
|
+
* consumidor (une-credit, surekeep-retail, etc.) el resultado de un cobro (total o parcial).
|
|
6
|
+
*
|
|
7
|
+
* A diferencia del resto de los Api de la lib, la baseUrl NO sale de una env fija del
|
|
8
|
+
* constructor: el dispatcher del outbox la resuelve por `domain` (registry `domain→API`,
|
|
9
|
+
* SSM/env) y la pasa por llamada — cada dominio consumidor implementa este mismo endpoint.
|
|
10
|
+
*/
|
|
11
|
+
export interface IDomainCallbackApi {
|
|
12
|
+
/**
|
|
13
|
+
* Notifica el resultado de un intento de cobro (FULL/PARTIAL/NONE) al dominio dueño
|
|
14
|
+
* del cargo. El dominio lo aplica idempotente a su ledger (dedupe por `attemptId`).
|
|
15
|
+
* Backend: POST {baseUrl}/collection/apply-result (privado VPC, expuesto por el dominio).
|
|
16
|
+
*/
|
|
17
|
+
applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export * from "./milestone-business/index.js";
|
|
|
81
81
|
export * from "./cognitoBackofficeConnector/index.js";
|
|
82
82
|
export * from "./platformRbac/index.js";
|
|
83
83
|
export * from "./retailOrg/index.js";
|
|
84
|
+
export * from "./datalakeQuery/index.js";
|
|
84
85
|
export * from "./retailCustomer/index.js";
|
|
85
86
|
export * from "./retailCatalog/index.js";
|
|
86
87
|
export * from "./retailCards/index.js";
|
|
@@ -107,3 +108,4 @@ export * from "./research-sheets/index.js";
|
|
|
107
108
|
export * from "./auth-business/index.js";
|
|
108
109
|
export * from "./kyc/index.js";
|
|
109
110
|
export * from "./collection-engine/index.js";
|
|
111
|
+
export * from "./domain-callback/index.js";
|
package/bin/index.js
CHANGED
|
@@ -81,6 +81,7 @@ export * from "./milestone-business/index.js";
|
|
|
81
81
|
export * from "./cognitoBackofficeConnector/index.js";
|
|
82
82
|
export * from "./platformRbac/index.js";
|
|
83
83
|
export * from "./retailOrg/index.js";
|
|
84
|
+
export * from "./datalakeQuery/index.js";
|
|
84
85
|
export * from "./retailCustomer/index.js";
|
|
85
86
|
export * from "./retailCatalog/index.js";
|
|
86
87
|
export * from "./retailCards/index.js";
|
|
@@ -107,3 +108,4 @@ export * from "./research-sheets/index.js";
|
|
|
107
108
|
export * from "./auth-business/index.js";
|
|
108
109
|
export * from "./kyc/index.js";
|
|
109
110
|
export * from "./collection-engine/index.js";
|
|
111
|
+
export * from "./domain-callback/index.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,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 @@
|
|
|
1
|
+
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,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 @@
|
|
|
1
|
+
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,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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.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.
|
|
37
|
+
"@fiado/type-kit": "^3.273.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/container.config.ts
CHANGED
|
@@ -195,6 +195,10 @@ import { IKycVerificationsBusinessApi, KycVerificationsBusinessApi } from "./kyc
|
|
|
195
195
|
// Collection engine — cliente del motor de cobro central (collect/registerCollectible/deregister)
|
|
196
196
|
import { ICollectionEngineApi } from "./collection-engine/index.js";
|
|
197
197
|
import CollectionEngineApi from "./collection-engine/api/CollectionEngineApi.js";
|
|
198
|
+
// Domain callback — cliente genérico que usa el motor para notificar a cualquier dominio
|
|
199
|
+
// consumidor el resultado de un cobro (applyCollectionResult); baseUrl viaja por llamada
|
|
200
|
+
import { IDomainCallbackApi } from "./domain-callback/index.js";
|
|
201
|
+
import DomainCallbackApi from "./domain-callback/api/DomainCallbackApi.js";
|
|
198
202
|
|
|
199
203
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
200
204
|
// UTILS bindings
|
|
@@ -364,4 +368,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
364
368
|
|
|
365
369
|
// Collection engine — motor de cobro central multitenant (collect/registerCollectible/deregister)
|
|
366
370
|
bind<ICollectionEngineApi>("ICollectionEngineApi").to(CollectionEngineApi);
|
|
371
|
+
|
|
372
|
+
// Domain callback — el motor notifica al dominio dueño del cargo (applyCollectionResult)
|
|
373
|
+
bind<IDomainCallbackApi>("IDomainCallbackApi").to(DomainCallbackApi);
|
|
367
374
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
4
|
+
import {
|
|
5
|
+
AggregateRequestDto,
|
|
6
|
+
ReportResultDto,
|
|
7
|
+
} from "@fiado/type-kit/bin/datalakeQuery/index.js";
|
|
8
|
+
import { IDatalakeQueryBusinessApi } from "./interfaces/IDatalakeQueryBusinessApi.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Publisher HTTP de `datalake-query-business` — el bibliotecario del data lake.
|
|
12
|
+
*
|
|
13
|
+
* Contrato y semántica completos → `IDatalakeQueryBusinessApi`.
|
|
14
|
+
*
|
|
15
|
+
* Env var requerida en el consumer: `DATALAKE_QUERY_BUSINESS_URL`, resuelta desde
|
|
16
|
+
* `{{resolve:ssm:datalake-query-business}}`.
|
|
17
|
+
*
|
|
18
|
+
* ⚠️ Los paths **no** están verificados contra dev: el lambda todavía no se ha desplegado, porque
|
|
19
|
+
* el data lake no tiene aún las tablas en estado consultable. Matchean su `openapi/private.yaml`.
|
|
20
|
+
*/
|
|
21
|
+
@injectable()
|
|
22
|
+
export default class DatalakeQueryBusinessApi implements IDatalakeQueryBusinessApi {
|
|
23
|
+
private readonly baseUrl = process.env.DATALAKE_QUERY_BUSINESS_URL || "";
|
|
24
|
+
|
|
25
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
26
|
+
|
|
27
|
+
async aggregate(
|
|
28
|
+
request: AggregateRequestDto,
|
|
29
|
+
): Promise<StandardResponse<ReportResultDto>> {
|
|
30
|
+
const url = `${this.baseUrl}/private/analytics/aggregate`;
|
|
31
|
+
// El tenant va en el CUERPO, en su propio campo — nunca mezclado con el reporte ni usado
|
|
32
|
+
// como valor dentro del SQL. El destino lo resuelve contra el registry.
|
|
33
|
+
return await this.httpRequest.post(url, request);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async getJob(
|
|
37
|
+
jobId: string,
|
|
38
|
+
tenantId: string,
|
|
39
|
+
nextToken?: string,
|
|
40
|
+
): Promise<StandardResponse<ReportResultDto>> {
|
|
41
|
+
const params = new URLSearchParams({ tenantId });
|
|
42
|
+
if (nextToken) params.set("nextToken", nextToken);
|
|
43
|
+
const url = `${this.baseUrl}/private/analytics/jobs/${encodeURIComponent(jobId)}?${params.toString()}`;
|
|
44
|
+
return await this.httpRequest.get(url);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import {
|
|
3
|
+
AggregateRequestDto,
|
|
4
|
+
ReportResultDto,
|
|
5
|
+
} from "@fiado/type-kit/bin/datalakeQuery/index.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Contrato del publisher HTTP de `datalake-query-business` — **el único lambda que consulta el
|
|
9
|
+
* data lake**.
|
|
10
|
+
*
|
|
11
|
+
* Los demás no hablan con Athena: le hablan a él. Así el rol cross-account, el compilador de SQL y
|
|
12
|
+
* los predicados de aislamiento viven en UN solo lugar, y el día que cambie el modelo (rol por
|
|
13
|
+
* tenant, Lake Formation) se toca un repo, no cuatro.
|
|
14
|
+
*
|
|
15
|
+
* Consumidores previstos:
|
|
16
|
+
* - `retail-org-business` → KPIs de tiendas y vendedores (piezas, vendido, vs 7d)
|
|
17
|
+
* - `retail-wizard-business` → agregados del portal y estadísticas de venta
|
|
18
|
+
*
|
|
19
|
+
* Env var requerida en el consumer: `DATALAKE_QUERY_BUSINESS_URL`.
|
|
20
|
+
* El template.yml del consumer la setea con:
|
|
21
|
+
*
|
|
22
|
+
* DATALAKE_QUERY_BUSINESS_URL: '{{resolve:ssm:datalake-query-business}}'
|
|
23
|
+
*
|
|
24
|
+
* Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
|
|
25
|
+
*
|
|
26
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
27
|
+
* `tenantId` y `callerService` son OBLIGATORIOS — no son detalle de firma
|
|
28
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
29
|
+
* Los privados NO llevan token de usuario (`Feature.ANONIMUS`; la protección es la red VPC), así
|
|
30
|
+
* que el destino no tiene `issuer` y **no puede inferir el silo**. El caller lo declara y
|
|
31
|
+
* `@fiado/tenant-context` asume el rol de ESE silo. Sin `tenantId` → error; **nunca hay default**:
|
|
32
|
+
* caer a uno sería fail-OPEN y podría devolver datos de otra SOFOM.
|
|
33
|
+
*
|
|
34
|
+
* `callerService` queda registrado en el job. Con un privado M2M es lo único que después permite
|
|
35
|
+
* auditar quién pidió por cuál tenant.
|
|
36
|
+
*
|
|
37
|
+
* ⚠️ **Ser privado es aislamiento de red, no de identidad.** Cualquier lambda de la VPC puede decir
|
|
38
|
+
* de qué tenant es. Lo que acota el daño es que una mentira da **exactamente un** tenant — el que
|
|
39
|
+
* nombró — y que cada corrida queda registrada.
|
|
40
|
+
*
|
|
41
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
42
|
+
* ⚠️ Patrón de retorno: `StandardResponse<T>` — el consumer accede `result.data`, NO `result.body`.
|
|
43
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
44
|
+
*/
|
|
45
|
+
export interface IDatalakeQueryBusinessApi {
|
|
46
|
+
/**
|
|
47
|
+
* Corre un agregado sobre el data lake y devuelve el resultado.
|
|
48
|
+
*
|
|
49
|
+
* 🔴 **La respuesta es un `if`:** si `data.rows` viene, ya está. Si viene solo `data.jobId`, la
|
|
50
|
+
* consulta excedió la espera en línea (~20 s, por el corte duro de API Gateway a los 29) y hay
|
|
51
|
+
* que pollearla. El consumer tiene que manejar los dos casos — asumir que siempre habrá `rows`
|
|
52
|
+
* lo rompe justo con las consultas pesadas, que son las que más importan.
|
|
53
|
+
*
|
|
54
|
+
* El alcance de las filas NO lo decide este request: lo impone el destino a partir del `scope`
|
|
55
|
+
* y del `tenantId`, sobre **cada** tabla del `FROM` y de cada `JOIN`.
|
|
56
|
+
*/
|
|
57
|
+
aggregate(request: AggregateRequestDto): Promise<StandardResponse<ReportResultDto>>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Estado y filas de un reporte que quedó en polling.
|
|
61
|
+
*
|
|
62
|
+
* El `jobId` es el ULID que devolvió `aggregate`, no el id de Athena — ese no sale nunca del
|
|
63
|
+
* destino. Pedir el job de otro tenant devuelve 404, igual que uno inexistente.
|
|
64
|
+
*/
|
|
65
|
+
getJob(jobId: string, tenantId: string, nextToken?: string): Promise<StandardResponse<ReportResultDto>>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
4
|
+
import { IDomainCallbackApi } from "./interfaces/IDomainCallbackApi.js";
|
|
5
|
+
|
|
6
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Cliente genérico del callback de cobro (motor → dominio). La baseUrl no viene de una env
|
|
10
|
+
* fija del constructor: el motor la resuelve por `domain` (registry `domain→API`) y la pasa
|
|
11
|
+
* en cada llamada, así este mismo cliente sirve para cualquier dominio consumidor.
|
|
12
|
+
*/
|
|
13
|
+
@injectable()
|
|
14
|
+
export default class DomainCallbackApi implements IDomainCallbackApi {
|
|
15
|
+
|
|
16
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>> {
|
|
20
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/collection/apply-result`;
|
|
21
|
+
return await this.httpRequest.post(url, request);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ApplyCollectionResultRequest } from "@fiado/type-kit/bin/collection/index.js";
|
|
2
|
+
|
|
3
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cliente genérico que usa el motor de cobro central para notificar a cualquier dominio
|
|
7
|
+
* consumidor (une-credit, surekeep-retail, etc.) el resultado de un cobro (total o parcial).
|
|
8
|
+
*
|
|
9
|
+
* A diferencia del resto de los Api de la lib, la baseUrl NO sale de una env fija del
|
|
10
|
+
* constructor: el dispatcher del outbox la resuelve por `domain` (registry `domain→API`,
|
|
11
|
+
* SSM/env) y la pasa por llamada — cada dominio consumidor implementa este mismo endpoint.
|
|
12
|
+
*/
|
|
13
|
+
export interface IDomainCallbackApi {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Notifica el resultado de un intento de cobro (FULL/PARTIAL/NONE) al dominio dueño
|
|
17
|
+
* del cargo. El dominio lo aplica idempotente a su ledger (dedupe por `attemptId`).
|
|
18
|
+
* Backend: POST {baseUrl}/collection/apply-result (privado VPC, expuesto por el dominio).
|
|
19
|
+
*/
|
|
20
|
+
applyCollectionResult(baseUrl: string, request: ApplyCollectionResultRequest): Promise<FiadoApiResponse<boolean>>;
|
|
21
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -81,6 +81,7 @@ export * from "./milestone-business/index.js";
|
|
|
81
81
|
export * from "./cognitoBackofficeConnector/index.js";
|
|
82
82
|
export * from "./platformRbac/index.js";
|
|
83
83
|
export * from "./retailOrg/index.js";
|
|
84
|
+
export * from "./datalakeQuery/index.js";
|
|
84
85
|
export * from "./retailCustomer/index.js";
|
|
85
86
|
export * from "./retailCatalog/index.js";
|
|
86
87
|
export * from "./retailCards/index.js";
|
|
@@ -107,3 +108,4 @@ export * from "./research-sheets/index.js";
|
|
|
107
108
|
export * from "./auth-business/index.js";
|
|
108
109
|
export * from "./kyc/index.js";
|
|
109
110
|
export * from "./collection-engine/index.js";
|
|
111
|
+
export * from "./domain-callback/index.js";
|