@fiado/api-invoker 5.131.0 → 5.132.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/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/loanRetailAudit/api/LoanRetailAuditBusinessApi.d.ts +12 -0
- package/bin/loanRetailAudit/api/LoanRetailAuditBusinessApi.js +44 -0
- package/bin/loanRetailAudit/api/interfaces/ILoanRetailAuditBusinessApi.d.ts +14 -0
- package/bin/loanRetailAudit/api/interfaces/ILoanRetailAuditBusinessApi.js +1 -0
- package/bin/loanRetailAudit/index.d.ts +2 -0
- package/bin/loanRetailAudit/index.js +2 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/loanRetailAudit/api/LoanRetailAuditBusinessApi.ts +40 -0
- package/src/loanRetailAudit/api/interfaces/ILoanRetailAuditBusinessApi.ts +29 -0
- package/src/loanRetailAudit/index.ts +2 -0
package/bin/index.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./retailCards/index.js";
|
|
|
93
93
|
export * from "./retailNotifications/index.js";
|
|
94
94
|
export * from "./retailWizard/index.js";
|
|
95
95
|
export * from "./retailPromotions/index.js";
|
|
96
|
+
export * from "./loanRetailAudit/index.js";
|
|
96
97
|
export * from "./retailCommission/index.js";
|
|
97
98
|
export * from "./retailIntegration/index.js";
|
|
98
99
|
export * from "./shortlink/index.js";
|
package/bin/index.js
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./retailCards/index.js";
|
|
|
93
93
|
export * from "./retailNotifications/index.js";
|
|
94
94
|
export * from "./retailWizard/index.js";
|
|
95
95
|
export * from "./retailPromotions/index.js";
|
|
96
|
+
export * from "./loanRetailAudit/index.js";
|
|
96
97
|
export * from "./retailCommission/index.js";
|
|
97
98
|
export * from "./retailIntegration/index.js";
|
|
98
99
|
export * from "./shortlink/index.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import type { CreatePiiAccessLogRequest, CreatePiiAccessLogResponse, ListAuditTrailQuery, ListAuditTrailResponse } from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
4
|
+
import { ILoanRetailAuditBusinessApi } from "./interfaces/ILoanRetailAuditBusinessApi.js";
|
|
5
|
+
/** Publisher HTTP de los privados de `loan-retail-audit-business`. Contrato -> `ILoanRetailAuditBusinessApi`. */
|
|
6
|
+
export default class LoanRetailAuditBusinessApi implements ILoanRetailAuditBusinessApi {
|
|
7
|
+
private httpRequest;
|
|
8
|
+
private readonly baseUrl;
|
|
9
|
+
constructor(httpRequest: IHttpRequest);
|
|
10
|
+
createPiiAccessLog(request: CreatePiiAccessLogRequest, tenantId: string): Promise<StandardResponse<CreatePiiAccessLogResponse>>;
|
|
11
|
+
listAuditTrail(query: ListAuditTrailQuery, tenantId: string): Promise<StandardResponse<ListAuditTrailResponse>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/** Publisher HTTP de los privados de `loan-retail-audit-business`. Contrato -> `ILoanRetailAuditBusinessApi`. */
|
|
15
|
+
let LoanRetailAuditBusinessApi = class LoanRetailAuditBusinessApi {
|
|
16
|
+
httpRequest;
|
|
17
|
+
// El buildspec publica la URL en SSM con "/" final; se normaliza para no armar "//private".
|
|
18
|
+
baseUrl = (process.env.LOAN_RETAIL_AUDIT_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
19
|
+
constructor(httpRequest) {
|
|
20
|
+
this.httpRequest = httpRequest;
|
|
21
|
+
}
|
|
22
|
+
async createPiiAccessLog(request, tenantId) {
|
|
23
|
+
const query = new URLSearchParams({ tenantId });
|
|
24
|
+
const url = `${this.baseUrl}/private/pii-access-logs?${query.toString()}`;
|
|
25
|
+
// Firma de http-client: post(url, data, headers, basicAuth, enableTimeout).
|
|
26
|
+
return await this.httpRequest.post(url, request, {}, undefined, true);
|
|
27
|
+
}
|
|
28
|
+
async listAuditTrail(query, tenantId) {
|
|
29
|
+
const params = new URLSearchParams({ tenantId, entityType: query.entityType, entityId: query.entityId });
|
|
30
|
+
if (query.order)
|
|
31
|
+
params.set("order", query.order);
|
|
32
|
+
if (query.limit !== undefined)
|
|
33
|
+
params.set("limit", String(query.limit));
|
|
34
|
+
if (query.nextToken)
|
|
35
|
+
params.set("nextToken", query.nextToken);
|
|
36
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/audit-trail?${params.toString()}`);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
LoanRetailAuditBusinessApi = __decorate([
|
|
40
|
+
injectable(),
|
|
41
|
+
__param(0, inject("IHttpRequest")),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
43
|
+
], LoanRetailAuditBusinessApi);
|
|
44
|
+
export default LoanRetailAuditBusinessApi;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import type { CreatePiiAccessLogRequest, CreatePiiAccessLogResponse, ListAuditTrailQuery, ListAuditTrailResponse } from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
3
|
+
export interface ILoanRetailAuditBusinessApi {
|
|
4
|
+
/**
|
|
5
|
+
* `POST /private/pii-access-logs`: registra un acceso a PII. Lleva timeout; si el central no
|
|
6
|
+
* responde, rechaza y el caller falla cerrado. El mismo `accessId` en un reintento no duplica.
|
|
7
|
+
*/
|
|
8
|
+
createPiiAccessLog(request: CreatePiiAccessLogRequest, tenantId: string): Promise<StandardResponse<CreatePiiAccessLogResponse>>;
|
|
9
|
+
/**
|
|
10
|
+
* `GET /private/audit-trail`: una página de la bitácora de una entidad (`order` default `desc`).
|
|
11
|
+
* `nextToken` es opaco y viaja tal cual; `null` en la respuesta = última página.
|
|
12
|
+
*/
|
|
13
|
+
listAuditTrail(query: ListAuditTrailQuery, tenantId: string): Promise<StandardResponse<ListAuditTrailResponse>>;
|
|
14
|
+
}
|
|
@@ -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.132.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.14.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.546.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./retailCards/index.js";
|
|
|
93
93
|
export * from "./retailNotifications/index.js";
|
|
94
94
|
export * from "./retailWizard/index.js";
|
|
95
95
|
export * from "./retailPromotions/index.js";
|
|
96
|
+
export * from "./loanRetailAudit/index.js";
|
|
96
97
|
export * from "./retailCommission/index.js";
|
|
97
98
|
export * from "./retailIntegration/index.js";
|
|
98
99
|
export * from "./shortlink/index.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
4
|
+
import type {
|
|
5
|
+
CreatePiiAccessLogRequest,
|
|
6
|
+
CreatePiiAccessLogResponse,
|
|
7
|
+
ListAuditTrailQuery,
|
|
8
|
+
ListAuditTrailResponse,
|
|
9
|
+
} from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
10
|
+
import { ILoanRetailAuditBusinessApi } from "./interfaces/ILoanRetailAuditBusinessApi.js";
|
|
11
|
+
|
|
12
|
+
/** Publisher HTTP de los privados de `loan-retail-audit-business`. Contrato -> `ILoanRetailAuditBusinessApi`. */
|
|
13
|
+
@injectable()
|
|
14
|
+
export default class LoanRetailAuditBusinessApi implements ILoanRetailAuditBusinessApi {
|
|
15
|
+
// El buildspec publica la URL en SSM con "/" final; se normaliza para no armar "//private".
|
|
16
|
+
private readonly baseUrl = (process.env.LOAN_RETAIL_AUDIT_BUSINESS_URL || "").replace(/\/+$/, "");
|
|
17
|
+
|
|
18
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
19
|
+
|
|
20
|
+
async createPiiAccessLog(
|
|
21
|
+
request: CreatePiiAccessLogRequest,
|
|
22
|
+
tenantId: string,
|
|
23
|
+
): Promise<StandardResponse<CreatePiiAccessLogResponse>> {
|
|
24
|
+
const query = new URLSearchParams({ tenantId });
|
|
25
|
+
const url = `${this.baseUrl}/private/pii-access-logs?${query.toString()}`;
|
|
26
|
+
// Firma de http-client: post(url, data, headers, basicAuth, enableTimeout).
|
|
27
|
+
return await this.httpRequest.post(url, request, {}, undefined, true);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async listAuditTrail(
|
|
31
|
+
query: ListAuditTrailQuery,
|
|
32
|
+
tenantId: string,
|
|
33
|
+
): Promise<StandardResponse<ListAuditTrailResponse>> {
|
|
34
|
+
const params = new URLSearchParams({ tenantId, entityType: query.entityType, entityId: query.entityId });
|
|
35
|
+
if (query.order) params.set("order", query.order);
|
|
36
|
+
if (query.limit !== undefined) params.set("limit", String(query.limit));
|
|
37
|
+
if (query.nextToken) params.set("nextToken", query.nextToken);
|
|
38
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/audit-trail?${params.toString()}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import type {
|
|
3
|
+
CreatePiiAccessLogRequest,
|
|
4
|
+
CreatePiiAccessLogResponse,
|
|
5
|
+
ListAuditTrailQuery,
|
|
6
|
+
ListAuditTrailResponse,
|
|
7
|
+
} from "@fiado/type-kit/bin/loanRetailAudit/index.js";
|
|
8
|
+
|
|
9
|
+
// Contrato de los privados de `loan-retail-audit-business`; el caller manda `tenantId` por query.
|
|
10
|
+
// El consumer necesita `LOAN_RETAIL_AUDIT_BUSINESS_URL` = `{{resolve:ssm:loan-retail-audit-business}}`.
|
|
11
|
+
export interface ILoanRetailAuditBusinessApi {
|
|
12
|
+
/**
|
|
13
|
+
* `POST /private/pii-access-logs`: registra un acceso a PII. Lleva timeout; si el central no
|
|
14
|
+
* responde, rechaza y el caller falla cerrado. El mismo `accessId` en un reintento no duplica.
|
|
15
|
+
*/
|
|
16
|
+
createPiiAccessLog(
|
|
17
|
+
request: CreatePiiAccessLogRequest,
|
|
18
|
+
tenantId: string,
|
|
19
|
+
): Promise<StandardResponse<CreatePiiAccessLogResponse>>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `GET /private/audit-trail`: una página de la bitácora de una entidad (`order` default `desc`).
|
|
23
|
+
* `nextToken` es opaco y viaja tal cual; `null` en la respuesta = última página.
|
|
24
|
+
*/
|
|
25
|
+
listAuditTrail(
|
|
26
|
+
query: ListAuditTrailQuery,
|
|
27
|
+
tenantId: string,
|
|
28
|
+
): Promise<StandardResponse<ListAuditTrailResponse>>;
|
|
29
|
+
}
|