@fiado/type-kit 3.271.0 → 3.273.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/collection/dtos/ApplyCollectionResultRequest.d.ts +14 -0
- package/bin/collection/dtos/ApplyCollectionResultRequest.js +59 -0
- package/bin/collection/index.d.ts +1 -0
- package/bin/collection/index.js +1 -0
- package/bin/datalakeQuery/dtos/AggregateRequestDto.d.ts +29 -0
- package/bin/datalakeQuery/dtos/AggregateRequestDto.js +2 -0
- package/bin/datalakeQuery/dtos/ReportRequestDto.d.ts +66 -0
- package/bin/datalakeQuery/dtos/ReportRequestDto.js +2 -0
- package/bin/datalakeQuery/dtos/ReportResultDto.d.ts +27 -0
- package/bin/datalakeQuery/dtos/ReportResultDto.js +2 -0
- package/bin/datalakeQuery/enums/FilterOpEnum.d.ts +18 -0
- package/bin/datalakeQuery/enums/FilterOpEnum.js +22 -0
- package/bin/datalakeQuery/enums/JoinTypeEnum.d.ts +4 -0
- package/bin/datalakeQuery/enums/JoinTypeEnum.js +8 -0
- package/bin/datalakeQuery/enums/MetricFnEnum.d.ts +8 -0
- package/bin/datalakeQuery/enums/MetricFnEnum.js +12 -0
- package/bin/datalakeQuery/enums/ReportJobStatusEnum.d.ts +6 -0
- package/bin/datalakeQuery/enums/ReportJobStatusEnum.js +10 -0
- package/bin/datalakeQuery/index.d.ts +7 -0
- package/bin/datalakeQuery/index.js +25 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +3 -2
- package/package.json +1 -1
- package/src/collection/dtos/ApplyCollectionResultRequest.ts +16 -0
- package/src/collection/index.ts +1 -0
- package/src/datalakeQuery/dtos/AggregateRequestDto.ts +30 -0
- package/src/datalakeQuery/dtos/ReportRequestDto.ts +73 -0
- package/src/datalakeQuery/dtos/ReportResultDto.ts +28 -0
- package/src/datalakeQuery/enums/FilterOpEnum.ts +18 -0
- package/src/datalakeQuery/enums/JoinTypeEnum.ts +4 -0
- package/src/datalakeQuery/enums/MetricFnEnum.ts +8 -0
- package/src/datalakeQuery/enums/ReportJobStatusEnum.ts +6 -0
- package/src/datalakeQuery/index.ts +10 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CollectionResultStatus } from '../enums/CollectionResultStatus';
|
|
2
|
+
import { MechanismType } from '../enums/MechanismType';
|
|
3
|
+
export declare class ApplyCollectionResultRequest {
|
|
4
|
+
attemptId: string;
|
|
5
|
+
intentId: string;
|
|
6
|
+
chargeId: string;
|
|
7
|
+
domain: string;
|
|
8
|
+
tenantId: string;
|
|
9
|
+
result: CollectionResultStatus;
|
|
10
|
+
amountCollected: number;
|
|
11
|
+
amountReserved: number;
|
|
12
|
+
mechanism: MechanismType;
|
|
13
|
+
holdTxId?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ApplyCollectionResultRequest = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const CollectionResultStatus_1 = require("../enums/CollectionResultStatus");
|
|
15
|
+
const MechanismType_1 = require("../enums/MechanismType");
|
|
16
|
+
class ApplyCollectionResultRequest {
|
|
17
|
+
}
|
|
18
|
+
exports.ApplyCollectionResultRequest = ApplyCollectionResultRequest;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], ApplyCollectionResultRequest.prototype, "attemptId", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], ApplyCollectionResultRequest.prototype, "intentId", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], ApplyCollectionResultRequest.prototype, "chargeId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], ApplyCollectionResultRequest.prototype, "domain", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsString)(),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ApplyCollectionResultRequest.prototype, "tenantId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, class_validator_1.IsEnum)(CollectionResultStatus_1.CollectionResultStatus),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], ApplyCollectionResultRequest.prototype, "result", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_validator_1.IsInt)(),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], ApplyCollectionResultRequest.prototype, "amountCollected", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, class_validator_1.IsInt)(),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], ApplyCollectionResultRequest.prototype, "amountReserved", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, class_validator_1.IsEnum)(MechanismType_1.MechanismType),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], ApplyCollectionResultRequest.prototype, "mechanism", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsOptional)(),
|
|
57
|
+
(0, class_validator_1.IsString)(),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], ApplyCollectionResultRequest.prototype, "holdTxId", void 0);
|
package/bin/collection/index.js
CHANGED
|
@@ -31,3 +31,4 @@ __exportStar(require("./dtos/RetryPolicyDto"), exports);
|
|
|
31
31
|
__exportStar(require("./dtos/CollectionSourceDto"), exports);
|
|
32
32
|
__exportStar(require("./dtos/CollectionProductConfigDto"), exports);
|
|
33
33
|
__exportStar(require("./dtos/UpsertProductConfigRequest"), exports);
|
|
34
|
+
__exportStar(require("./dtos/ApplyCollectionResultRequest"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReportRequestDto } from './ReportRequestDto';
|
|
2
|
+
import { PermissionScope } from '../../platformRbac/enums/PermissionScope';
|
|
3
|
+
/**
|
|
4
|
+
* El cuerpo del privado M2M `POST /private/analytics/aggregate` de `datalake-query-business`.
|
|
5
|
+
*
|
|
6
|
+
* ## El tenant y el alcance van en campos PROPIOS, separados del reporte
|
|
7
|
+
*
|
|
8
|
+
* Un privado no lleva token de usuario, así que el caller —que ya validó el suyo— declara el
|
|
9
|
+
* `tenantId`. Es el patrón de la casa: `@fiado/tenant-context` tiene `withContextByTenantId` hecho
|
|
10
|
+
* para esto, con las mismas garantías que el camino por issuer.
|
|
11
|
+
*
|
|
12
|
+
* Lo que se cuida es que **ese dato no se mezcle con la consulta**: viaja aparte, el destino lo
|
|
13
|
+
* resuelve contra el registry —un tenant desconocido es error, nunca un default— y **jamás se usa
|
|
14
|
+
* como valor dentro del SQL**. El predicado lo pone el compilador desde el contexto ya resuelto.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ **Si no mandas `scope`, el destino asume `LEVEL_1`, nunca `TENANT`.** Heredar el alcance más
|
|
17
|
+
* amplio por omisión lo ampliaría en silencio, que es exactamente el descuido que no queremos.
|
|
18
|
+
*/
|
|
19
|
+
export interface AggregateRequestDto {
|
|
20
|
+
/** Tenant del actor original. Obligatorio: sin él el destino no sabe qué silo consultar. */
|
|
21
|
+
tenantId: string;
|
|
22
|
+
/** Quién llama (`retail-org-business`, `retail-wizard-business`…). Queda auditado en el job. */
|
|
23
|
+
callerService: string;
|
|
24
|
+
/** Alcance del actor original. Omitirlo asume `LEVEL_1`. */
|
|
25
|
+
scope?: PermissionScope;
|
|
26
|
+
/** Obligatorio para `LEVEL_1`, `LEVEL_2` y `LEVEL_3`. */
|
|
27
|
+
scopeRef?: string;
|
|
28
|
+
report: ReportRequestDto;
|
|
29
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { FilterOpEnum } from '../enums/FilterOpEnum';
|
|
2
|
+
import { JoinTypeEnum } from '../enums/JoinTypeEnum';
|
|
3
|
+
import { MetricFnEnum } from '../enums/MetricFnEnum';
|
|
4
|
+
/**
|
|
5
|
+
* El contrato declarativo del motor de reportes sobre el data lake.
|
|
6
|
+
*
|
|
7
|
+
* 🔴 **El cliente NUNCA manda SQL.** Manda esta estructura y el backend la compila. Esa es la
|
|
8
|
+
* diferencia entre "escapamos bien las comillas" y "no hay superficie de inyección": la tabla y
|
|
9
|
+
* cada columna se validan contra el schema VIVO de Glue antes de tocar el compilador.
|
|
10
|
+
*
|
|
11
|
+
* ## Por qué el nombre va calificado y las columnas llevan alias
|
|
12
|
+
*
|
|
13
|
+
* Hay DOS bases en el lake — `fiado_analytics` (Iceberg) y `fiado-datalake-op` (Hive) — y el caso
|
|
14
|
+
* de negocio es cruzarlas: una venta retail con la persona del core, con su cuenta PagoConFiado.
|
|
15
|
+
* Un nombre a secas sería ambiguo, y un error de tipeo apuntaría a la base equivocada en silencio.
|
|
16
|
+
*
|
|
17
|
+
* Y **cada** tabla del `FROM` y de cada `JOIN` recibe su propio predicado de alcance. Aplicarlo
|
|
18
|
+
* solo a la tabla base dejaría la unida sin restringir: bastaría una columna en común para salir
|
|
19
|
+
* por ese lado.
|
|
20
|
+
*/
|
|
21
|
+
/** Referencia a una columna, calificada por el alias de su tabla. */
|
|
22
|
+
export interface ColumnRefDto {
|
|
23
|
+
/** Alias de la tabla. **Obligatorio en cuanto hay un join** — si no, la columna es ambigua. */
|
|
24
|
+
table?: string;
|
|
25
|
+
column: string;
|
|
26
|
+
}
|
|
27
|
+
export interface JoinSpecDto {
|
|
28
|
+
/** Nombre calificado `basedatos.tabla`. */
|
|
29
|
+
table: string;
|
|
30
|
+
/** Alias obligatorio: califica sus columnas y su predicado impuesto. */
|
|
31
|
+
alias: string;
|
|
32
|
+
type: JoinTypeEnum;
|
|
33
|
+
left: ColumnRefDto;
|
|
34
|
+
right: ColumnRefDto;
|
|
35
|
+
}
|
|
36
|
+
export interface MetricSpecDto {
|
|
37
|
+
/** Con `COUNT` se acepta `{ column: '*' }`. */
|
|
38
|
+
column: ColumnRefDto;
|
|
39
|
+
fn: MetricFnEnum;
|
|
40
|
+
/** Alias de salida. Si no viene, se deriva de la función y la columna. */
|
|
41
|
+
alias?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface FilterSpecDto {
|
|
44
|
+
column: ColumnRefDto;
|
|
45
|
+
op: FilterOpEnum;
|
|
46
|
+
/** Un arreglo solo es válido con `IN`. */
|
|
47
|
+
value: string | number | boolean | (string | number)[];
|
|
48
|
+
}
|
|
49
|
+
export interface OrderSpecDto {
|
|
50
|
+
/** Debe ser un alias YA presente en el SELECT, no una columna arbitraria. */
|
|
51
|
+
alias: string;
|
|
52
|
+
desc?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface ReportRequestDto {
|
|
55
|
+
/** Nombre calificado `basedatos.tabla`. */
|
|
56
|
+
table: string;
|
|
57
|
+
/** Alias de la tabla base. Si no viene, el backend usa `t0`. */
|
|
58
|
+
alias?: string;
|
|
59
|
+
joins?: JoinSpecDto[];
|
|
60
|
+
dimensions?: ColumnRefDto[];
|
|
61
|
+
metrics?: MetricSpecDto[];
|
|
62
|
+
filters?: FilterSpecDto[];
|
|
63
|
+
orderBy?: OrderSpecDto;
|
|
64
|
+
/** El backend lo castea a entero y lo recorta a su tope duro. */
|
|
65
|
+
limit?: number;
|
|
66
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReportJobStatusEnum } from '../enums/ReportJobStatusEnum';
|
|
2
|
+
/**
|
|
3
|
+
* La respuesta de arrancar un reporte.
|
|
4
|
+
*
|
|
5
|
+
* 🔴 **El contrato es un `if`:** si viene `rows`, ya está — pinta. Si viene solo `jobId`, la
|
|
6
|
+
* consulta sigue corriendo y hay que pollear.
|
|
7
|
+
*
|
|
8
|
+
* Es ejecución **híbrida**, no asíncrona pura: el backend espera ~20 s en línea (API Gateway corta
|
|
9
|
+
* a los 29) y solo degrada a polling la cola. La mayoría de las consultas se resuelven en una sola
|
|
10
|
+
* llamada.
|
|
11
|
+
*
|
|
12
|
+
* ⚠️ El `queryExecutionId` de Athena **nunca** viaja acá. El `jobId` es un ULID propio del destino,
|
|
13
|
+
* atado a su tenant: pedir el de otro no da 403, da 404 — sin diferencia observable no se pueden
|
|
14
|
+
* enumerar los ajenos.
|
|
15
|
+
*/
|
|
16
|
+
export interface ReportResultDto {
|
|
17
|
+
jobId: string;
|
|
18
|
+
status: ReportJobStatusEnum;
|
|
19
|
+
/** Presentes solo si terminó dentro de la espera en línea. Athena devuelve todo como texto. */
|
|
20
|
+
rows?: Record<string, string | null>[];
|
|
21
|
+
/** Para pedir la siguiente página del resultado. */
|
|
22
|
+
nextToken?: string;
|
|
23
|
+
/** `true` si Athena la tiene EN FILA, no procesando. Cambia lo que se le dice al usuario. */
|
|
24
|
+
queued?: boolean;
|
|
25
|
+
bytesScanned?: number;
|
|
26
|
+
failureReason?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operadores de filtro permitidos. Lista CERRADA, y **sin `OR`**.
|
|
3
|
+
*
|
|
4
|
+
* Los filtros se combinan siempre con `AND` y el bloque entero se envuelve en paréntesis antes de
|
|
5
|
+
* pegarle los predicados que impone el backend. Con `OR` disponible y sin parentizar, `AND` liga
|
|
6
|
+
* más fuerte y `a OR b AND scope` se evalúa como `a OR (b AND scope)`: el primer disyunto gana y
|
|
7
|
+
* el filtro de alcance queda decorativo.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum FilterOpEnum {
|
|
10
|
+
EQ = "=",
|
|
11
|
+
NEQ = "!=",
|
|
12
|
+
GT = ">",
|
|
13
|
+
GTE = ">=",
|
|
14
|
+
LT = "<",
|
|
15
|
+
LTE = "<=",
|
|
16
|
+
IN = "IN",
|
|
17
|
+
LIKE = "LIKE"
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterOpEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Operadores de filtro permitidos. Lista CERRADA, y **sin `OR`**.
|
|
6
|
+
*
|
|
7
|
+
* Los filtros se combinan siempre con `AND` y el bloque entero se envuelve en paréntesis antes de
|
|
8
|
+
* pegarle los predicados que impone el backend. Con `OR` disponible y sin parentizar, `AND` liga
|
|
9
|
+
* más fuerte y `a OR b AND scope` se evalúa como `a OR (b AND scope)`: el primer disyunto gana y
|
|
10
|
+
* el filtro de alcance queda decorativo.
|
|
11
|
+
*/
|
|
12
|
+
var FilterOpEnum;
|
|
13
|
+
(function (FilterOpEnum) {
|
|
14
|
+
FilterOpEnum["EQ"] = "=";
|
|
15
|
+
FilterOpEnum["NEQ"] = "!=";
|
|
16
|
+
FilterOpEnum["GT"] = ">";
|
|
17
|
+
FilterOpEnum["GTE"] = ">=";
|
|
18
|
+
FilterOpEnum["LT"] = "<";
|
|
19
|
+
FilterOpEnum["LTE"] = "<=";
|
|
20
|
+
FilterOpEnum["IN"] = "IN";
|
|
21
|
+
FilterOpEnum["LIKE"] = "LIKE";
|
|
22
|
+
})(FilterOpEnum || (exports.FilterOpEnum = FilterOpEnum = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JoinTypeEnum = void 0;
|
|
4
|
+
var JoinTypeEnum;
|
|
5
|
+
(function (JoinTypeEnum) {
|
|
6
|
+
JoinTypeEnum["INNER"] = "INNER";
|
|
7
|
+
JoinTypeEnum["LEFT"] = "LEFT";
|
|
8
|
+
})(JoinTypeEnum || (exports.JoinTypeEnum = JoinTypeEnum = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetricFnEnum = void 0;
|
|
4
|
+
/** Funciones de agregación permitidas. Lista CERRADA: el cliente no manda el nombre de la función. */
|
|
5
|
+
var MetricFnEnum;
|
|
6
|
+
(function (MetricFnEnum) {
|
|
7
|
+
MetricFnEnum["COUNT"] = "COUNT";
|
|
8
|
+
MetricFnEnum["SUM"] = "SUM";
|
|
9
|
+
MetricFnEnum["AVG"] = "AVG";
|
|
10
|
+
MetricFnEnum["MIN"] = "MIN";
|
|
11
|
+
MetricFnEnum["MAX"] = "MAX";
|
|
12
|
+
})(MetricFnEnum || (exports.MetricFnEnum = MetricFnEnum = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportJobStatusEnum = void 0;
|
|
4
|
+
/** Estado de un trabajo de reporte, tal como lo ve el consumidor. */
|
|
5
|
+
var ReportJobStatusEnum;
|
|
6
|
+
(function (ReportJobStatusEnum) {
|
|
7
|
+
ReportJobStatusEnum["RUNNING"] = "RUNNING";
|
|
8
|
+
ReportJobStatusEnum["DONE"] = "DONE";
|
|
9
|
+
ReportJobStatusEnum["FAILED"] = "FAILED";
|
|
10
|
+
})(ReportJobStatusEnum || (exports.ReportJobStatusEnum = ReportJobStatusEnum = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './enums/MetricFnEnum';
|
|
2
|
+
export * from './enums/FilterOpEnum';
|
|
3
|
+
export * from './enums/JoinTypeEnum';
|
|
4
|
+
export * from './enums/ReportJobStatusEnum';
|
|
5
|
+
export * from './dtos/ReportRequestDto';
|
|
6
|
+
export * from './dtos/AggregateRequestDto';
|
|
7
|
+
export * from './dtos/ReportResultDto';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Enums
|
|
18
|
+
__exportStar(require("./enums/MetricFnEnum"), exports);
|
|
19
|
+
__exportStar(require("./enums/FilterOpEnum"), exports);
|
|
20
|
+
__exportStar(require("./enums/JoinTypeEnum"), exports);
|
|
21
|
+
__exportStar(require("./enums/ReportJobStatusEnum"), exports);
|
|
22
|
+
// DTOs
|
|
23
|
+
__exportStar(require("./dtos/ReportRequestDto"), exports);
|
|
24
|
+
__exportStar(require("./dtos/AggregateRequestDto"), exports);
|
|
25
|
+
__exportStar(require("./dtos/ReportResultDto"), exports);
|
package/bin/index.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ export * as RetailCatalog from './retailCatalog';
|
|
|
95
95
|
export * as RetailCards from './retailCards';
|
|
96
96
|
export * as RetailCustomer from './retailCustomer';
|
|
97
97
|
export * as RetailWizard from './retailWizard';
|
|
98
|
+
export * as DatalakeQuery from './datalakeQuery';
|
|
98
99
|
export * as LoanConfig from './loanConfig';
|
|
99
100
|
export * as Shortlink from './shortlink';
|
|
100
101
|
export * as LoanOfferings from './loanOfferings';
|
package/bin/index.js
CHANGED
|
@@ -37,8 +37,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.IssuanceBusiness = exports.Blacklist = exports.CentralPayments = exports.Helpdesk = exports.FiadoApiResponse = exports.Auth = exports.LegalDocumentsBusiness = exports.Role = exports.STPAccount = exports.RiskProfile = exports.FraudPreventionEngine = exports.BBVARst = exports.Stp = exports.BenefitCenter = exports.BankAccount = exports.P2pContact = exports.CreditContract = exports.Contract = exports.ProductCatalog = exports.ContactInfo = exports.TransactionAnalytics = exports.Transaction = exports.TransactionProcessor = exports.GenericMessage = exports.EventBridgeMessage = exports.SessionActivity = exports.NotificationMessages = exports.ServicePayment = exports.Header = exports.Identity = exports.UserTags = exports.Group = exports.File = exports.ExchangeRate = exports.Directory = exports.Currency = exports.Country = exports.Card = exports.Authentication = exports.AppContent = exports.App = exports.Offices = exports.Places = exports.Address = exports.Beneficiary = exports.Activity = exports.Biometrics = exports.MetamapConnector = exports.Account = exports.Crypto = void 0;
|
|
40
|
-
exports.
|
|
41
|
-
exports.Collection = exports.Shipping = exports.PhoneSales = exports.Onboarding = exports.Kyc = exports.LoanScoring = exports.LoanCredit = exports.LoanCollectorAssignment = void 0;
|
|
40
|
+
exports.Shortlink = exports.LoanConfig = exports.DatalakeQuery = exports.RetailWizard = exports.RetailCustomer = exports.RetailCards = exports.RetailCatalog = exports.RetailOrg = exports.EmailVerification = exports.NetworkConnector = exports.Modelias = exports.TotpSecurity = exports.Passport = exports.WalletFunding = exports.Remittance = exports.PlatformRbac = exports.CognitoBackofficeConnector = exports.TwilioConnector = exports.MessagesConnector = exports.Mdm = exports.MilestoneBusiness = exports.CirculoCredito = exports.CreditStatements = exports.Sentry = exports.AiEngine = exports.Funnel = exports.TeamsConnector = exports.PlatformErrorEvents = exports.CustomerFile = exports.CreditBackoffice = exports.CreditDashboard = exports.CreditEngine = exports.Credit = exports.ComissionBusiness = exports.ReferralBusiness = exports.ZendeskMessaging = exports.NotificationWS = exports.Event = exports.PayrollBusiness = exports.Cnbv = exports.DirectorySetting = exports.InvoiceCollector = exports.Collector = exports.Pricelist = exports.Company = exports.Services = exports.AccountIssuanceBusiness = exports.AppSelectionData = exports.Device = exports.Observations = void 0;
|
|
41
|
+
exports.Collection = exports.Shipping = exports.PhoneSales = exports.Onboarding = exports.Kyc = exports.LoanScoring = exports.LoanCredit = exports.LoanCollectorAssignment = exports.LoanOfferings = void 0;
|
|
42
42
|
exports.Crypto = __importStar(require("./crypto"));
|
|
43
43
|
exports.Account = __importStar(require("./account"));
|
|
44
44
|
exports.MetamapConnector = __importStar(require("./metamapConnector"));
|
|
@@ -158,6 +158,7 @@ exports.RetailCustomer = __importStar(require("./retailCustomer"));
|
|
|
158
158
|
// RetailWizard: DTOs/enums del lambda retail-wizard-business (comp 04 — wizard de venta de contado:
|
|
159
159
|
// saga de sesión, OTP, KYC, venta y prospectos; SureKeep Fase 2 — pista Retail).
|
|
160
160
|
exports.RetailWizard = __importStar(require("./retailWizard"));
|
|
161
|
+
exports.DatalakeQuery = __importStar(require("./datalakeQuery"));
|
|
161
162
|
// LoanConfig: DTOs/enums del lambda loan-config-business (comp 09 — parámetros operativos del SOFOM).
|
|
162
163
|
exports.LoanConfig = __importStar(require("./loanConfig"));
|
|
163
164
|
// Shortlink: DTOs del lambda shortlink-business (acortador de URLs). Se consume M2M por su endpoint
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IsString, IsInt, IsEnum, IsOptional } from 'class-validator';
|
|
2
|
+
import { CollectionResultStatus } from '../enums/CollectionResultStatus';
|
|
3
|
+
import { MechanismType } from '../enums/MechanismType';
|
|
4
|
+
|
|
5
|
+
export class ApplyCollectionResultRequest {
|
|
6
|
+
@IsString() attemptId!: string; // dedupe idempotente en el dominio
|
|
7
|
+
@IsString() intentId!: string;
|
|
8
|
+
@IsString() chargeId!: string;
|
|
9
|
+
@IsString() domain!: string;
|
|
10
|
+
@IsString() tenantId!: string;
|
|
11
|
+
@IsEnum(CollectionResultStatus) result!: CollectionResultStatus;
|
|
12
|
+
@IsInt() amountCollected!: number;
|
|
13
|
+
@IsInt() amountReserved!: number;
|
|
14
|
+
@IsEnum(MechanismType) mechanism!: MechanismType;
|
|
15
|
+
@IsOptional() @IsString() holdTxId?: string;
|
|
16
|
+
}
|
package/src/collection/index.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReportRequestDto } from './ReportRequestDto';
|
|
2
|
+
import { PermissionScope } from '../../platformRbac/enums/PermissionScope';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* El cuerpo del privado M2M `POST /private/analytics/aggregate` de `datalake-query-business`.
|
|
6
|
+
*
|
|
7
|
+
* ## El tenant y el alcance van en campos PROPIOS, separados del reporte
|
|
8
|
+
*
|
|
9
|
+
* Un privado no lleva token de usuario, así que el caller —que ya validó el suyo— declara el
|
|
10
|
+
* `tenantId`. Es el patrón de la casa: `@fiado/tenant-context` tiene `withContextByTenantId` hecho
|
|
11
|
+
* para esto, con las mismas garantías que el camino por issuer.
|
|
12
|
+
*
|
|
13
|
+
* Lo que se cuida es que **ese dato no se mezcle con la consulta**: viaja aparte, el destino lo
|
|
14
|
+
* resuelve contra el registry —un tenant desconocido es error, nunca un default— y **jamás se usa
|
|
15
|
+
* como valor dentro del SQL**. El predicado lo pone el compilador desde el contexto ya resuelto.
|
|
16
|
+
*
|
|
17
|
+
* ⚠️ **Si no mandas `scope`, el destino asume `LEVEL_1`, nunca `TENANT`.** Heredar el alcance más
|
|
18
|
+
* amplio por omisión lo ampliaría en silencio, que es exactamente el descuido que no queremos.
|
|
19
|
+
*/
|
|
20
|
+
export interface AggregateRequestDto {
|
|
21
|
+
/** Tenant del actor original. Obligatorio: sin él el destino no sabe qué silo consultar. */
|
|
22
|
+
tenantId: string;
|
|
23
|
+
/** Quién llama (`retail-org-business`, `retail-wizard-business`…). Queda auditado en el job. */
|
|
24
|
+
callerService: string;
|
|
25
|
+
/** Alcance del actor original. Omitirlo asume `LEVEL_1`. */
|
|
26
|
+
scope?: PermissionScope;
|
|
27
|
+
/** Obligatorio para `LEVEL_1`, `LEVEL_2` y `LEVEL_3`. */
|
|
28
|
+
scopeRef?: string;
|
|
29
|
+
report: ReportRequestDto;
|
|
30
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { FilterOpEnum } from '../enums/FilterOpEnum';
|
|
2
|
+
import { JoinTypeEnum } from '../enums/JoinTypeEnum';
|
|
3
|
+
import { MetricFnEnum } from '../enums/MetricFnEnum';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* El contrato declarativo del motor de reportes sobre el data lake.
|
|
7
|
+
*
|
|
8
|
+
* 🔴 **El cliente NUNCA manda SQL.** Manda esta estructura y el backend la compila. Esa es la
|
|
9
|
+
* diferencia entre "escapamos bien las comillas" y "no hay superficie de inyección": la tabla y
|
|
10
|
+
* cada columna se validan contra el schema VIVO de Glue antes de tocar el compilador.
|
|
11
|
+
*
|
|
12
|
+
* ## Por qué el nombre va calificado y las columnas llevan alias
|
|
13
|
+
*
|
|
14
|
+
* Hay DOS bases en el lake — `fiado_analytics` (Iceberg) y `fiado-datalake-op` (Hive) — y el caso
|
|
15
|
+
* de negocio es cruzarlas: una venta retail con la persona del core, con su cuenta PagoConFiado.
|
|
16
|
+
* Un nombre a secas sería ambiguo, y un error de tipeo apuntaría a la base equivocada en silencio.
|
|
17
|
+
*
|
|
18
|
+
* Y **cada** tabla del `FROM` y de cada `JOIN` recibe su propio predicado de alcance. Aplicarlo
|
|
19
|
+
* solo a la tabla base dejaría la unida sin restringir: bastaría una columna en común para salir
|
|
20
|
+
* por ese lado.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** Referencia a una columna, calificada por el alias de su tabla. */
|
|
24
|
+
export interface ColumnRefDto {
|
|
25
|
+
/** Alias de la tabla. **Obligatorio en cuanto hay un join** — si no, la columna es ambigua. */
|
|
26
|
+
table?: string;
|
|
27
|
+
column: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface JoinSpecDto {
|
|
31
|
+
/** Nombre calificado `basedatos.tabla`. */
|
|
32
|
+
table: string;
|
|
33
|
+
/** Alias obligatorio: califica sus columnas y su predicado impuesto. */
|
|
34
|
+
alias: string;
|
|
35
|
+
type: JoinTypeEnum;
|
|
36
|
+
left: ColumnRefDto;
|
|
37
|
+
right: ColumnRefDto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface MetricSpecDto {
|
|
41
|
+
/** Con `COUNT` se acepta `{ column: '*' }`. */
|
|
42
|
+
column: ColumnRefDto;
|
|
43
|
+
fn: MetricFnEnum;
|
|
44
|
+
/** Alias de salida. Si no viene, se deriva de la función y la columna. */
|
|
45
|
+
alias?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface FilterSpecDto {
|
|
49
|
+
column: ColumnRefDto;
|
|
50
|
+
op: FilterOpEnum;
|
|
51
|
+
/** Un arreglo solo es válido con `IN`. */
|
|
52
|
+
value: string | number | boolean | (string | number)[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface OrderSpecDto {
|
|
56
|
+
/** Debe ser un alias YA presente en el SELECT, no una columna arbitraria. */
|
|
57
|
+
alias: string;
|
|
58
|
+
desc?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ReportRequestDto {
|
|
62
|
+
/** Nombre calificado `basedatos.tabla`. */
|
|
63
|
+
table: string;
|
|
64
|
+
/** Alias de la tabla base. Si no viene, el backend usa `t0`. */
|
|
65
|
+
alias?: string;
|
|
66
|
+
joins?: JoinSpecDto[];
|
|
67
|
+
dimensions?: ColumnRefDto[];
|
|
68
|
+
metrics?: MetricSpecDto[];
|
|
69
|
+
filters?: FilterSpecDto[];
|
|
70
|
+
orderBy?: OrderSpecDto;
|
|
71
|
+
/** El backend lo castea a entero y lo recorta a su tope duro. */
|
|
72
|
+
limit?: number;
|
|
73
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReportJobStatusEnum } from '../enums/ReportJobStatusEnum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* La respuesta de arrancar un reporte.
|
|
5
|
+
*
|
|
6
|
+
* 🔴 **El contrato es un `if`:** si viene `rows`, ya está — pinta. Si viene solo `jobId`, la
|
|
7
|
+
* consulta sigue corriendo y hay que pollear.
|
|
8
|
+
*
|
|
9
|
+
* Es ejecución **híbrida**, no asíncrona pura: el backend espera ~20 s en línea (API Gateway corta
|
|
10
|
+
* a los 29) y solo degrada a polling la cola. La mayoría de las consultas se resuelven en una sola
|
|
11
|
+
* llamada.
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ El `queryExecutionId` de Athena **nunca** viaja acá. El `jobId` es un ULID propio del destino,
|
|
14
|
+
* atado a su tenant: pedir el de otro no da 403, da 404 — sin diferencia observable no se pueden
|
|
15
|
+
* enumerar los ajenos.
|
|
16
|
+
*/
|
|
17
|
+
export interface ReportResultDto {
|
|
18
|
+
jobId: string;
|
|
19
|
+
status: ReportJobStatusEnum;
|
|
20
|
+
/** Presentes solo si terminó dentro de la espera en línea. Athena devuelve todo como texto. */
|
|
21
|
+
rows?: Record<string, string | null>[];
|
|
22
|
+
/** Para pedir la siguiente página del resultado. */
|
|
23
|
+
nextToken?: string;
|
|
24
|
+
/** `true` si Athena la tiene EN FILA, no procesando. Cambia lo que se le dice al usuario. */
|
|
25
|
+
queued?: boolean;
|
|
26
|
+
bytesScanned?: number;
|
|
27
|
+
failureReason?: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operadores de filtro permitidos. Lista CERRADA, y **sin `OR`**.
|
|
3
|
+
*
|
|
4
|
+
* Los filtros se combinan siempre con `AND` y el bloque entero se envuelve en paréntesis antes de
|
|
5
|
+
* pegarle los predicados que impone el backend. Con `OR` disponible y sin parentizar, `AND` liga
|
|
6
|
+
* más fuerte y `a OR b AND scope` se evalúa como `a OR (b AND scope)`: el primer disyunto gana y
|
|
7
|
+
* el filtro de alcance queda decorativo.
|
|
8
|
+
*/
|
|
9
|
+
export enum FilterOpEnum {
|
|
10
|
+
EQ = '=',
|
|
11
|
+
NEQ = '!=',
|
|
12
|
+
GT = '>',
|
|
13
|
+
GTE = '>=',
|
|
14
|
+
LT = '<',
|
|
15
|
+
LTE = '<=',
|
|
16
|
+
IN = 'IN',
|
|
17
|
+
LIKE = 'LIKE',
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Enums
|
|
2
|
+
export * from './enums/MetricFnEnum';
|
|
3
|
+
export * from './enums/FilterOpEnum';
|
|
4
|
+
export * from './enums/JoinTypeEnum';
|
|
5
|
+
export * from './enums/ReportJobStatusEnum';
|
|
6
|
+
|
|
7
|
+
// DTOs
|
|
8
|
+
export * from './dtos/ReportRequestDto';
|
|
9
|
+
export * from './dtos/AggregateRequestDto';
|
|
10
|
+
export * from './dtos/ReportResultDto';
|
package/src/index.ts
CHANGED
|
@@ -117,6 +117,7 @@ export * as RetailCustomer from './retailCustomer';
|
|
|
117
117
|
// RetailWizard: DTOs/enums del lambda retail-wizard-business (comp 04 — wizard de venta de contado:
|
|
118
118
|
// saga de sesión, OTP, KYC, venta y prospectos; SureKeep Fase 2 — pista Retail).
|
|
119
119
|
export * as RetailWizard from './retailWizard';
|
|
120
|
+
export * as DatalakeQuery from './datalakeQuery';
|
|
120
121
|
// LoanConfig: DTOs/enums del lambda loan-config-business (comp 09 — parámetros operativos del SOFOM).
|
|
121
122
|
export * as LoanConfig from './loanConfig';
|
|
122
123
|
// Shortlink: DTOs del lambda shortlink-business (acortador de URLs). Se consume M2M por su endpoint
|