@fiado/api-invoker 5.116.0 → 5.117.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 +2 -0
- package/bin/datalake-reports-business/api/DatalakeReportsApi.d.ts +13 -0
- package/bin/datalake-reports-business/api/DatalakeReportsApi.js +39 -0
- package/bin/datalake-reports-business/api/interfaces/IDatalakeReportsApi.d.ts +58 -0
- package/bin/datalake-reports-business/api/interfaces/IDatalakeReportsApi.js +1 -0
- package/bin/datalake-reports-business/index.d.ts +2 -0
- package/bin/datalake-reports-business/index.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/package.json +1 -1
- package/src/container.config.ts +3 -0
- package/src/datalake-reports-business/api/DatalakeReportsApi.ts +30 -0
- package/src/datalake-reports-business/api/interfaces/IDatalakeReportsApi.ts +27 -0
- package/src/datalake-reports-business/index.ts +2 -0
- package/src/index.ts +1 -0
package/bin/container.config.js
CHANGED
|
@@ -74,6 +74,7 @@ import { EventHistoryApi } from "./event-history-business/index.js";
|
|
|
74
74
|
import ReportProcessorBusinessApi from "./report-processor-business/api/ReportProcessorBusinessApi.js";
|
|
75
75
|
import NotificationWSMessagePublisher from "./notificationWebsockets/queue/NotificationWSMessagePublisher.js";
|
|
76
76
|
import PeopleBusinessApi from "./people-business/api/PeopleBusinessApi.js";
|
|
77
|
+
import DatalakeReportsApi from "./datalake-reports-business/api/DatalakeReportsApi.js";
|
|
77
78
|
import PlacesBusinessApi from "./places-business/api/PlacesBusinessApi.js";
|
|
78
79
|
import STPBusinessApi from "./stp-business/api/STPBusinessApi.js";
|
|
79
80
|
import MulticommServicePaymentApi from "./multicommServicePayment/api/MulticommServicePaymentApi.js";
|
|
@@ -225,6 +226,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
225
226
|
bind("IEventHistoryApi").to(EventHistoryApi);
|
|
226
227
|
bind("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
|
|
227
228
|
bind("IPeopleBusinessApi").to(PeopleBusinessApi);
|
|
229
|
+
bind("IDatalakeReportsApi").to(DatalakeReportsApi);
|
|
228
230
|
bind("IPlacesBusinessApi").to(PlacesBusinessApi);
|
|
229
231
|
bind("ISTPBusinessApi").to(STPBusinessApi);
|
|
230
232
|
bind("IProductPaymentApi").to(ProductPaymentApi);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { DatalakeReportDefinition, DatalakeReportResult, IDatalakeReportsApi } from "./interfaces/IDatalakeReportsApi.js";
|
|
3
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
|
+
export default class DatalakeReportsApi implements IDatalakeReportsApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>>;
|
|
9
|
+
getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>>;
|
|
10
|
+
runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>>;
|
|
11
|
+
getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
let DatalakeReportsApi = class DatalakeReportsApi {
|
|
15
|
+
httpRequest;
|
|
16
|
+
baseUrl = process.env.DATALAKE_REPORTS_BUSINESS_LAMBDA_URL || "";
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
}
|
|
20
|
+
listReports() {
|
|
21
|
+
return this.httpRequest.get(`${this.baseUrl}private/reports`);
|
|
22
|
+
}
|
|
23
|
+
getReport(id) {
|
|
24
|
+
return this.httpRequest.get(`${this.baseUrl}private/reports/${encodeURIComponent(id)}`);
|
|
25
|
+
}
|
|
26
|
+
runReport(id, params) {
|
|
27
|
+
return this.httpRequest.post(`${this.baseUrl}private/reports/${encodeURIComponent(id)}/run`, { params });
|
|
28
|
+
}
|
|
29
|
+
getJob(jobId, nextToken) {
|
|
30
|
+
const qs = nextToken ? `?nextToken=${encodeURIComponent(nextToken)}` : "";
|
|
31
|
+
return this.httpRequest.get(`${this.baseUrl}private/reports/jobs/${encodeURIComponent(jobId)}${qs}`);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
DatalakeReportsApi = __decorate([
|
|
35
|
+
injectable(),
|
|
36
|
+
__param(0, inject("IHttpRequest")),
|
|
37
|
+
__metadata("design:paramtypes", [Object])
|
|
38
|
+
], DatalakeReportsApi);
|
|
39
|
+
export default DatalakeReportsApi;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
|
+
/** Contrato local hasta que @fiado/type-kit publique el dominio DatalakeReports (misma forma). */
|
|
3
|
+
export interface DatalakeReportDefinition {
|
|
4
|
+
id: string;
|
|
5
|
+
version: number;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
source: {
|
|
9
|
+
layer: "gold" | "silver";
|
|
10
|
+
databases: string[];
|
|
11
|
+
};
|
|
12
|
+
pii: boolean;
|
|
13
|
+
audiences: string[];
|
|
14
|
+
permission: string;
|
|
15
|
+
mode: "sync" | "async";
|
|
16
|
+
cacheSeconds: number;
|
|
17
|
+
params: Record<string, {
|
|
18
|
+
type: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
default?: unknown;
|
|
21
|
+
values?: string[];
|
|
22
|
+
max?: number;
|
|
23
|
+
min?: number;
|
|
24
|
+
}>;
|
|
25
|
+
principalParams: string[];
|
|
26
|
+
columns: Array<{
|
|
27
|
+
name: string;
|
|
28
|
+
type: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export interface DatalakeReportResult {
|
|
33
|
+
status: "RUNNING" | "DONE" | "FAILED";
|
|
34
|
+
reportId?: string;
|
|
35
|
+
version?: number;
|
|
36
|
+
jobId: string;
|
|
37
|
+
columns?: Array<{
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
label: string;
|
|
41
|
+
}>;
|
|
42
|
+
rows?: Array<Record<string, string | number | boolean | null>>;
|
|
43
|
+
rowCount?: number;
|
|
44
|
+
nextToken?: string;
|
|
45
|
+
computedAt?: string;
|
|
46
|
+
fromCache?: boolean;
|
|
47
|
+
bytesScanned?: number;
|
|
48
|
+
reason?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Canal privado de datalake-reports-business (reportes predefinidos sobre Gold y Silver). */
|
|
51
|
+
export interface IDatalakeReportsApi {
|
|
52
|
+
listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>>;
|
|
53
|
+
getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>>;
|
|
54
|
+
/** 200 con filas, o 200 con status RUNNING y jobId si la corrida cae a asíncrono. */
|
|
55
|
+
runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>>;
|
|
56
|
+
getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/index.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export * from "./event-history-business/index.js";
|
|
|
65
65
|
export * from "./report-processor-business/index.js";
|
|
66
66
|
export * from "./notificationWebsockets/index.js";
|
|
67
67
|
export * from "./people-business/index.js";
|
|
68
|
+
export * from "./datalake-reports-business/index.js";
|
|
68
69
|
export * from "./places-business/index.js";
|
|
69
70
|
export * from "./stp-business/index.js";
|
|
70
71
|
export * from "./multicommServicePayment/index.js";
|
package/bin/index.js
CHANGED
|
@@ -65,6 +65,7 @@ export * from "./event-history-business/index.js";
|
|
|
65
65
|
export * from "./report-processor-business/index.js";
|
|
66
66
|
export * from "./notificationWebsockets/index.js";
|
|
67
67
|
export * from "./people-business/index.js";
|
|
68
|
+
export * from "./datalake-reports-business/index.js";
|
|
68
69
|
export * from "./places-business/index.js";
|
|
69
70
|
export * from "./stp-business/index.js";
|
|
70
71
|
export * from "./multicommServicePayment/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.117.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",
|
package/src/container.config.ts
CHANGED
|
@@ -107,6 +107,8 @@ import { IReportProcessorBusinessApi } from "./report-processor-business/index.j
|
|
|
107
107
|
import { INotificationWSMessagesPublisher } from "./notificationWebsockets/index.js";
|
|
108
108
|
import NotificationWSMessagePublisher from "./notificationWebsockets/queue/NotificationWSMessagePublisher.js";
|
|
109
109
|
import PeopleBusinessApi from "./people-business/api/PeopleBusinessApi.js";
|
|
110
|
+
import DatalakeReportsApi from "./datalake-reports-business/api/DatalakeReportsApi.js";
|
|
111
|
+
import { IDatalakeReportsApi } from "./datalake-reports-business/index.js";
|
|
110
112
|
import { IPeopleBusinessApi } from "./people-business/index.js";
|
|
111
113
|
import PlacesBusinessApi from "./places-business/api/PlacesBusinessApi.js";
|
|
112
114
|
import { IPlacesBusinessApi } from "./places-business/index.js";
|
|
@@ -297,6 +299,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
297
299
|
bind<IEventHistoryApi>("IEventHistoryApi").to(EventHistoryApi);
|
|
298
300
|
bind<IReportProcessorBusinessApi>("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
|
|
299
301
|
bind<IPeopleBusinessApi>("IPeopleBusinessApi").to(PeopleBusinessApi);
|
|
302
|
+
bind<IDatalakeReportsApi>("IDatalakeReportsApi").to(DatalakeReportsApi);
|
|
300
303
|
bind<IPlacesBusinessApi>("IPlacesBusinessApi").to(PlacesBusinessApi);
|
|
301
304
|
bind<ISTPBusinessApi>("ISTPBusinessApi").to(STPBusinessApi);
|
|
302
305
|
bind<IProductPaymentApi>("IProductPaymentApi").to(ProductPaymentApi);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { DatalakeReportDefinition, DatalakeReportResult, IDatalakeReportsApi } from "./interfaces/IDatalakeReportsApi.js";
|
|
4
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export default class DatalakeReportsApi implements IDatalakeReportsApi {
|
|
8
|
+
|
|
9
|
+
private readonly baseUrl = process.env.DATALAKE_REPORTS_BUSINESS_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>> {
|
|
15
|
+
return this.httpRequest.get(`${this.baseUrl}private/reports`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>> {
|
|
19
|
+
return this.httpRequest.get(`${this.baseUrl}private/reports/${encodeURIComponent(id)}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>> {
|
|
23
|
+
return this.httpRequest.post(`${this.baseUrl}private/reports/${encodeURIComponent(id)}/run`, { params });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>> {
|
|
27
|
+
const qs = nextToken ? `?nextToken=${encodeURIComponent(nextToken)}` : "";
|
|
28
|
+
return this.httpRequest.get(`${this.baseUrl}private/reports/jobs/${encodeURIComponent(jobId)}${qs}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
|
+
|
|
3
|
+
/** Contrato local hasta que @fiado/type-kit publique el dominio DatalakeReports (misma forma). */
|
|
4
|
+
export interface DatalakeReportDefinition {
|
|
5
|
+
id: string; version: number; title: string; description: string;
|
|
6
|
+
source: { layer: "gold" | "silver"; databases: string[] };
|
|
7
|
+
pii: boolean; audiences: string[]; permission: string; mode: "sync" | "async"; cacheSeconds: number;
|
|
8
|
+
params: Record<string, { type: string; required?: boolean; default?: unknown; values?: string[]; max?: number; min?: number }>;
|
|
9
|
+
principalParams: string[];
|
|
10
|
+
columns: Array<{ name: string; type: string; label: string }>;
|
|
11
|
+
}
|
|
12
|
+
export interface DatalakeReportResult {
|
|
13
|
+
status: "RUNNING" | "DONE" | "FAILED";
|
|
14
|
+
reportId?: string; version?: number; jobId: string;
|
|
15
|
+
columns?: Array<{ name: string; type: string; label: string }>;
|
|
16
|
+
rows?: Array<Record<string, string | number | boolean | null>>;
|
|
17
|
+
rowCount?: number; nextToken?: string; computedAt?: string; fromCache?: boolean; bytesScanned?: number; reason?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Canal privado de datalake-reports-business (reportes predefinidos sobre Gold y Silver). */
|
|
21
|
+
export interface IDatalakeReportsApi {
|
|
22
|
+
listReports(): Promise<FiadoApiResponse<DatalakeReportDefinition[]>>;
|
|
23
|
+
getReport(id: string): Promise<FiadoApiResponse<DatalakeReportDefinition>>;
|
|
24
|
+
/** 200 con filas, o 200 con status RUNNING y jobId si la corrida cae a asíncrono. */
|
|
25
|
+
runReport(id: string, params: Record<string, unknown>): Promise<FiadoApiResponse<DatalakeReportResult>>;
|
|
26
|
+
getJob(jobId: string, nextToken?: string): Promise<FiadoApiResponse<DatalakeReportResult>>;
|
|
27
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -65,6 +65,7 @@ export * from "./event-history-business/index.js";
|
|
|
65
65
|
export * from "./report-processor-business/index.js";
|
|
66
66
|
export * from "./notificationWebsockets/index.js";
|
|
67
67
|
export * from "./people-business/index.js";
|
|
68
|
+
export * from "./datalake-reports-business/index.js";
|
|
68
69
|
export * from "./places-business/index.js";
|
|
69
70
|
export * from "./stp-business/index.js";
|
|
70
71
|
export * from "./multicommServicePayment/index.js";
|