@fiado/type-kit 3.516.0 → 3.518.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/_test_/unit/rewardsEligibility/backofficeBarrel.test.ts +17 -0
- package/_test_/unit/rewardsEligibility/campaignAndEventTypeDtos.test.ts +52 -0
- package/_test_/unit/rewardsEligibility/campaignConfigDecorators.test.ts +49 -0
- package/_test_/unit/rewardsEligibility/catalogDtos.test.ts +27 -0
- package/_test_/unit/rewardsEligibility/evaluationDtos.test.ts +53 -0
- package/_test_/unit/rewardsEligibility/events.test.ts +3 -3
- package/_test_/unit/rewardsEligibility/generateRulesRequest.test.ts +50 -0
- package/_test_/unit/rewardsEligibility/generateRulesResponse.test.ts +12 -0
- package/_test_/unit/rewardsEligibility/metricsDtos.test.ts +17 -0
- package/_test_/unit/rewardsEligibility/ruleCatalogRich.test.ts +18 -0
- package/_test_/unit/rewardsEligibility/rulesAiEnums.test.ts +15 -0
- package/_test_/unit/rewardsEligibility/runDtos.test.ts +36 -0
- package/bin/rewardsEligibility/constants/BackofficeLimits.d.ts +16 -0
- package/bin/rewardsEligibility/constants/BackofficeLimits.js +19 -0
- package/bin/rewardsEligibility/dtos/CampaignAlerts.js +20 -0
- package/bin/rewardsEligibility/dtos/CampaignQuota.d.ts +1 -1
- package/bin/rewardsEligibility/dtos/CampaignQuota.js +29 -0
- package/bin/rewardsEligibility/dtos/backoffice/ApproveRunRequest.d.ts +4 -0
- package/bin/rewardsEligibility/dtos/backoffice/ApproveRunRequest.js +27 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignListResponse.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignRequest.d.ts +16 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignRequest.js +72 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignResponse.d.ts +23 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignStatusRequest.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignStatusRequest.js +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignSummaryResponse.d.ts +28 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignSummaryResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunRequest.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunRequest.js +45 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunResponse.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationRequest.d.ts +27 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationRequest.js +86 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationResponse.d.ts +26 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest.js +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeRequest.d.ts +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeRequest.js +58 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeResponse.d.ts +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/GenerateRulesRequest.d.ts +17 -0
- package/bin/rewardsEligibility/dtos/backoffice/GenerateRulesRequest.js +44 -0
- package/bin/rewardsEligibility/dtos/backoffice/GenerateRulesResponse.d.ts +18 -0
- package/bin/rewardsEligibility/dtos/backoffice/GenerateRulesResponse.js +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/InputTypeResponse.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/InputTypeResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsPointResponse.d.ts +14 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsPointResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsQuery.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsQuery.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationRunRequest.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationRunRequest.js +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaImpactResponse.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaImpactResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaUsageResponse.d.ts +10 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaUsageResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/ResultTraceResponse.d.ts +34 -0
- package/bin/rewardsEligibility/dtos/backoffice/ResultTraceResponse.js +14 -0
- package/bin/rewardsEligibility/dtos/backoffice/RuleCatalogResponse.d.ts +33 -0
- package/bin/rewardsEligibility/dtos/backoffice/RuleCatalogResponse.js +13 -0
- package/bin/rewardsEligibility/dtos/backoffice/RulesChatTurn.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/RulesChatTurn.js +32 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResponse.d.ts +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultResponse.d.ts +22 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateRequest.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateRequest.js +40 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateResponse.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateResponse.js +6 -0
- package/bin/rewardsEligibility/enums/MetricsDimensionEnum.d.ts +8 -0
- package/bin/rewardsEligibility/enums/MetricsDimensionEnum.js +12 -0
- package/bin/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.d.ts +56 -1
- package/bin/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.js +56 -0
- package/bin/rewardsEligibility/enums/RuleValueTypeEnum.d.ts +9 -0
- package/bin/rewardsEligibility/enums/RuleValueTypeEnum.js +13 -0
- package/bin/rewardsEligibility/enums/RulesChatRoleEnum.d.ts +5 -0
- package/bin/rewardsEligibility/enums/RulesChatRoleEnum.js +9 -0
- package/bin/rewardsEligibility/index.d.ts +38 -0
- package/bin/rewardsEligibility/index.js +39 -0
- package/package.json +1 -1
- package/src/rewardsEligibility/constants/BackofficeLimits.ts +16 -0
- package/src/rewardsEligibility/dtos/CampaignAlerts.ts +9 -0
- package/src/rewardsEligibility/dtos/CampaignQuota.ts +13 -1
- package/src/rewardsEligibility/dtos/backoffice/ApproveRunRequest.ts +13 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignListResponse.ts +7 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignRequest.ts +53 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignResponse.ts +24 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignStatusRequest.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignSummaryResponse.ts +26 -0
- package/src/rewardsEligibility/dtos/backoffice/CreateRunRequest.ts +30 -0
- package/src/rewardsEligibility/dtos/backoffice/CreateRunResponse.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationRequest.ts +69 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationResponse.ts +25 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/EventTypeListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/EventTypeRequest.ts +41 -0
- package/src/rewardsEligibility/dtos/backoffice/EventTypeResponse.ts +13 -0
- package/src/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.ts +8 -0
- package/src/rewardsEligibility/dtos/backoffice/GenerateRulesRequest.ts +33 -0
- package/src/rewardsEligibility/dtos/backoffice/GenerateRulesResponse.ts +17 -0
- package/src/rewardsEligibility/dtos/backoffice/InputTypeResponse.ts +7 -0
- package/src/rewardsEligibility/dtos/backoffice/MetricsPointResponse.ts +14 -0
- package/src/rewardsEligibility/dtos/backoffice/MetricsQuery.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/PopulationRunRequest.ts +11 -0
- package/src/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.ts +12 -0
- package/src/rewardsEligibility/dtos/backoffice/QuotaImpactResponse.ts +9 -0
- package/src/rewardsEligibility/dtos/backoffice/QuotaUsageResponse.ts +11 -0
- package/src/rewardsEligibility/dtos/backoffice/ResultTraceResponse.ts +34 -0
- package/src/rewardsEligibility/dtos/backoffice/RuleCatalogResponse.ts +32 -0
- package/src/rewardsEligibility/dtos/backoffice/RulesChatTurn.ts +17 -0
- package/src/rewardsEligibility/dtos/backoffice/RunListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/RunResponse.ts +25 -0
- package/src/rewardsEligibility/dtos/backoffice/RunResultListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/RunResultResponse.ts +23 -0
- package/src/rewardsEligibility/dtos/backoffice/SimulateRequest.ts +25 -0
- package/src/rewardsEligibility/dtos/backoffice/SimulateResponse.ts +12 -0
- package/src/rewardsEligibility/enums/MetricsDimensionEnum.ts +8 -0
- package/src/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.ts +57 -0
- package/src/rewardsEligibility/enums/RuleValueTypeEnum.ts +9 -0
- package/src/rewardsEligibility/enums/RulesChatRoleEnum.ts +5 -0
- package/src/rewardsEligibility/index.ts +40 -0
|
@@ -9,4 +9,60 @@ var RewardsEligibilityErrorCodeEnum;
|
|
|
9
9
|
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_NOT_FOUND"] = "EVENT_TYPE_NOT_FOUND";
|
|
10
10
|
/** 404: GET /runs/{id} sin corrida. */
|
|
11
11
|
RewardsEligibilityErrorCodeEnum["RUN_NOT_FOUND"] = "RUN_NOT_FOUND";
|
|
12
|
+
// ── Backoffice (fase 3) ──
|
|
13
|
+
/** 400: el cuerpo no cumple el DTO (solo nombres de propiedad, nunca valores). */
|
|
14
|
+
RewardsEligibilityErrorCodeEnum["VALIDATION_ERROR"] = "VALIDATION_ERROR";
|
|
15
|
+
/** 400: `limit` fuera de rango o `cursor` que no devolvió esta API. */
|
|
16
|
+
RewardsEligibilityErrorCodeEnum["INVALID_PAGE"] = "INVALID_PAGE";
|
|
17
|
+
/** 400: un filtro de query (`outcome`, `status`, `dimension`, fechas…) no es válido. */
|
|
18
|
+
RewardsEligibilityErrorCodeEnum["INVALID_FILTER"] = "INVALID_FILTER";
|
|
19
|
+
/** 503: el índice de listado aún no existe en la tabla (pendiente de infraestructura). */
|
|
20
|
+
RewardsEligibilityErrorCodeEnum["LIST_INDEX_NOT_AVAILABLE"] = "LIST_INDEX_NOT_AVAILABLE";
|
|
21
|
+
/** 409: otra persona editó la misma fila. */
|
|
22
|
+
RewardsEligibilityErrorCodeEnum["VERSION_CONFLICT"] = "VERSION_CONFLICT";
|
|
23
|
+
/** 400: el id de la ruta no coincide con el del cuerpo. */
|
|
24
|
+
RewardsEligibilityErrorCodeEnum["REQUEST_ID_MISMATCH"] = "REQUEST_ID_MISMATCH";
|
|
25
|
+
/** 409: la transición de estado no está permitida. */
|
|
26
|
+
RewardsEligibilityErrorCodeEnum["INVALID_STATUS_TRANSITION"] = "INVALID_STATUS_TRANSITION";
|
|
27
|
+
RewardsEligibilityErrorCodeEnum["CAMPAIGN_NOT_FOUND"] = "CAMPAIGN_NOT_FOUND";
|
|
28
|
+
RewardsEligibilityErrorCodeEnum["CAMPAIGN_ALREADY_EXISTS"] = "CAMPAIGN_ALREADY_EXISTS";
|
|
29
|
+
RewardsEligibilityErrorCodeEnum["CAMPAIGN_INVALID"] = "CAMPAIGN_INVALID";
|
|
30
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_NOT_FOUND"] = "EVALUATION_NOT_FOUND";
|
|
31
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_ALREADY_EXISTS"] = "EVALUATION_ALREADY_EXISTS";
|
|
32
|
+
/** 400: la evaluación no pasa las validaciones del spec 5.1 (lista TODOS los problemas). */
|
|
33
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_INVALID"] = "EVALUATION_INVALID";
|
|
34
|
+
/** 409: la evaluación o su campaña no están en condiciones de correr (estado o vigencia). */
|
|
35
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_NOT_RUNNABLE"] = "EVALUATION_NOT_RUNNABLE";
|
|
36
|
+
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_ALREADY_EXISTS"] = "EVENT_TYPE_ALREADY_EXISTS";
|
|
37
|
+
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_INVALID"] = "EVENT_TYPE_INVALID";
|
|
38
|
+
/** 409: el tipo de evento lo escuchan evaluaciones ACTIVAS. */
|
|
39
|
+
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_IN_USE"] = "EVENT_TYPE_IN_USE";
|
|
40
|
+
RewardsEligibilityErrorCodeEnum["PACKAGE_NOT_FOUND"] = "PACKAGE_NOT_FOUND";
|
|
41
|
+
/** 503: rewards-business no respondió al consultar un paquete. */
|
|
42
|
+
RewardsEligibilityErrorCodeEnum["PACKAGE_LOOKUP_UNAVAILABLE"] = "PACKAGE_LOOKUP_UNAVAILABLE";
|
|
43
|
+
/** 400: la evaluación no tiene disparador MANUAL. */
|
|
44
|
+
RewardsEligibilityErrorCodeEnum["MANUAL_TRIGGER_MISSING"] = "MANUAL_TRIGGER_MISSING";
|
|
45
|
+
/** 400: la corrida manual por población llega con la fase 4 (cron masivo). */
|
|
46
|
+
RewardsEligibilityErrorCodeEnum["POPULATION_RUN_NOT_SUPPORTED"] = "POPULATION_RUN_NOT_SUPPORTED";
|
|
47
|
+
/** 409: la corrida no está esperando aprobación. */
|
|
48
|
+
RewardsEligibilityErrorCodeEnum["RUN_NOT_AWAITING_APPROVAL"] = "RUN_NOT_AWAITING_APPROVAL";
|
|
49
|
+
/** 409: la corrida tiene más de un registro de reserva (aprobación masiva = fase 4). */
|
|
50
|
+
RewardsEligibilityErrorCodeEnum["APPROVAL_RUN_TOO_LARGE"] = "APPROVAL_RUN_TOO_LARGE";
|
|
51
|
+
RewardsEligibilityErrorCodeEnum["RESULT_NOT_FOUND"] = "RESULT_NOT_FOUND";
|
|
52
|
+
/** 409: solo se reintenta un sujeto en ERROR o REQUEST_FAILED de una corrida LIVE cerrada. */
|
|
53
|
+
RewardsEligibilityErrorCodeEnum["RESULT_NOT_RETRYABLE"] = "RESULT_NOT_RETRYABLE";
|
|
54
|
+
/** 400: el rango pedido excede el tope de filas de la exportación. */
|
|
55
|
+
RewardsEligibilityErrorCodeEnum["EXPORT_TOO_LARGE"] = "EXPORT_TOO_LARGE";
|
|
56
|
+
/** 503: la tabla de métricas no responde o no existe aún. */
|
|
57
|
+
RewardsEligibilityErrorCodeEnum["METRICS_UNAVAILABLE"] = "METRICS_UNAVAILABLE";
|
|
58
|
+
/** 400: `POST /rules/generate` sin ningún turno de chat. */
|
|
59
|
+
RewardsEligibilityErrorCodeEnum["AI_CHAT_HISTORY_EMPTY"] = "AI_CHAT_HISTORY_EMPTY";
|
|
60
|
+
/** 400: el chat tiene más de 10 turnos (se acota el prompt). */
|
|
61
|
+
RewardsEligibilityErrorCodeEnum["AI_CHAT_HISTORY_TOO_LONG"] = "AI_CHAT_HISTORY_TOO_LONG";
|
|
62
|
+
/** 503: el motor de IA no respondió o falló. Reintentar. */
|
|
63
|
+
RewardsEligibilityErrorCodeEnum["AI_GENERATION_FAILED"] = "AI_GENERATION_FAILED";
|
|
64
|
+
/** 503: la IA respondió algo que no se pudo leer como `{ explanation, rules }`. Reintentar. */
|
|
65
|
+
RewardsEligibilityErrorCodeEnum["AI_RESPONSE_UNPARSEABLE"] = "AI_RESPONSE_UNPARSEABLE";
|
|
66
|
+
/** 503: la IA no contestó dentro del presupuesto de tiempo (el gateway corta a los 29 s). Reintentar. */
|
|
67
|
+
RewardsEligibilityErrorCodeEnum["AI_GENERATION_TIMEOUT"] = "AI_GENERATION_TIMEOUT";
|
|
12
68
|
})(RewardsEligibilityErrorCodeEnum || (exports.RewardsEligibilityErrorCodeEnum = RewardsEligibilityErrorCodeEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Tipo de valor de un campo del catálogo de reglas (`GET /rule-catalog`). */
|
|
2
|
+
export declare enum RuleValueTypeEnum {
|
|
3
|
+
NUMBER = "NUMBER",
|
|
4
|
+
STRING = "STRING",
|
|
5
|
+
BOOLEAN = "BOOLEAN",
|
|
6
|
+
DATE = "DATE",
|
|
7
|
+
/** Lista de textos (ej. `directory.scope`). */
|
|
8
|
+
STRING_LIST = "STRING_LIST"
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleValueTypeEnum = void 0;
|
|
4
|
+
/** Tipo de valor de un campo del catálogo de reglas (`GET /rule-catalog`). */
|
|
5
|
+
var RuleValueTypeEnum;
|
|
6
|
+
(function (RuleValueTypeEnum) {
|
|
7
|
+
RuleValueTypeEnum["NUMBER"] = "NUMBER";
|
|
8
|
+
RuleValueTypeEnum["STRING"] = "STRING";
|
|
9
|
+
RuleValueTypeEnum["BOOLEAN"] = "BOOLEAN";
|
|
10
|
+
RuleValueTypeEnum["DATE"] = "DATE";
|
|
11
|
+
/** Lista de textos (ej. `directory.scope`). */
|
|
12
|
+
RuleValueTypeEnum["STRING_LIST"] = "STRING_LIST";
|
|
13
|
+
})(RuleValueTypeEnum || (exports.RuleValueTypeEnum = RuleValueTypeEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RulesChatRoleEnum = void 0;
|
|
4
|
+
/** Quién habló en un turno del chat que genera reglas con IA (`POST /rules/generate`). */
|
|
5
|
+
var RulesChatRoleEnum;
|
|
6
|
+
(function (RulesChatRoleEnum) {
|
|
7
|
+
RulesChatRoleEnum["USER"] = "user";
|
|
8
|
+
RulesChatRoleEnum["ASSISTANT"] = "assistant";
|
|
9
|
+
})(RulesChatRoleEnum || (exports.RulesChatRoleEnum = RulesChatRoleEnum = {}));
|
|
@@ -29,3 +29,41 @@ export * from './dtos/CampaignAlerts';
|
|
|
29
29
|
export * from './dtos/PopulationRef';
|
|
30
30
|
export * from './dtos/EvaluationReward';
|
|
31
31
|
export * from './dtos/EvaluationTrigger';
|
|
32
|
+
export * from './enums/MetricsDimensionEnum';
|
|
33
|
+
export * from './enums/RuleValueTypeEnum';
|
|
34
|
+
export * from './enums/RulesChatRoleEnum';
|
|
35
|
+
export * from './constants/BackofficeLimits';
|
|
36
|
+
export * from './dtos/backoffice/CampaignRequest';
|
|
37
|
+
export * from './dtos/backoffice/CampaignStatusRequest';
|
|
38
|
+
export * from './dtos/backoffice/CampaignResponse';
|
|
39
|
+
export * from './dtos/backoffice/CampaignListResponse';
|
|
40
|
+
export * from './dtos/backoffice/QuotaUsageResponse';
|
|
41
|
+
export * from './dtos/backoffice/CampaignSummaryResponse';
|
|
42
|
+
export * from './dtos/backoffice/EventTypeRequest';
|
|
43
|
+
export * from './dtos/backoffice/EventTypeResponse';
|
|
44
|
+
export * from './dtos/backoffice/EventTypeListResponse';
|
|
45
|
+
export * from './dtos/backoffice/EvaluationRequest';
|
|
46
|
+
export * from './dtos/backoffice/EvaluationStatusRequest';
|
|
47
|
+
export * from './dtos/backoffice/EvaluationResponse';
|
|
48
|
+
export * from './dtos/backoffice/EvaluationListResponse';
|
|
49
|
+
export * from './dtos/backoffice/ResultTraceResponse';
|
|
50
|
+
export * from './dtos/backoffice/SimulateRequest';
|
|
51
|
+
export * from './dtos/backoffice/SimulateResponse';
|
|
52
|
+
export * from './dtos/backoffice/RuleCatalogResponse';
|
|
53
|
+
export * from './dtos/backoffice/PopulationSourceResponse';
|
|
54
|
+
export * from './dtos/backoffice/InputTypeResponse';
|
|
55
|
+
export * from './dtos/backoffice/RulesChatTurn';
|
|
56
|
+
export * from './dtos/backoffice/GenerateRulesRequest';
|
|
57
|
+
export * from './dtos/backoffice/GenerateRulesResponse';
|
|
58
|
+
export * from './dtos/backoffice/CreateRunRequest';
|
|
59
|
+
export * from './dtos/backoffice/PopulationRunRequest';
|
|
60
|
+
export * from './dtos/backoffice/ApproveRunRequest';
|
|
61
|
+
export * from './dtos/backoffice/QuotaImpactResponse';
|
|
62
|
+
export * from './dtos/backoffice/RunResponse';
|
|
63
|
+
export * from './dtos/backoffice/RunListResponse';
|
|
64
|
+
export * from './dtos/backoffice/RunResultResponse';
|
|
65
|
+
export * from './dtos/backoffice/RunResultListResponse';
|
|
66
|
+
export * from './dtos/backoffice/CreateRunResponse';
|
|
67
|
+
export * from './dtos/backoffice/MetricsPointResponse';
|
|
68
|
+
export * from './dtos/backoffice/FailedConditionStatResponse';
|
|
69
|
+
export * from './dtos/backoffice/MetricsQuery';
|
|
@@ -50,3 +50,42 @@ __exportStar(require("./dtos/CampaignAlerts"), exports);
|
|
|
50
50
|
__exportStar(require("./dtos/PopulationRef"), exports);
|
|
51
51
|
__exportStar(require("./dtos/EvaluationReward"), exports);
|
|
52
52
|
__exportStar(require("./dtos/EvaluationTrigger"), exports);
|
|
53
|
+
//Backoffice (fase 3): enums, constantes y DTOs
|
|
54
|
+
__exportStar(require("./enums/MetricsDimensionEnum"), exports);
|
|
55
|
+
__exportStar(require("./enums/RuleValueTypeEnum"), exports);
|
|
56
|
+
__exportStar(require("./enums/RulesChatRoleEnum"), exports);
|
|
57
|
+
__exportStar(require("./constants/BackofficeLimits"), exports);
|
|
58
|
+
__exportStar(require("./dtos/backoffice/CampaignRequest"), exports);
|
|
59
|
+
__exportStar(require("./dtos/backoffice/CampaignStatusRequest"), exports);
|
|
60
|
+
__exportStar(require("./dtos/backoffice/CampaignResponse"), exports);
|
|
61
|
+
__exportStar(require("./dtos/backoffice/CampaignListResponse"), exports);
|
|
62
|
+
__exportStar(require("./dtos/backoffice/QuotaUsageResponse"), exports);
|
|
63
|
+
__exportStar(require("./dtos/backoffice/CampaignSummaryResponse"), exports);
|
|
64
|
+
__exportStar(require("./dtos/backoffice/EventTypeRequest"), exports);
|
|
65
|
+
__exportStar(require("./dtos/backoffice/EventTypeResponse"), exports);
|
|
66
|
+
__exportStar(require("./dtos/backoffice/EventTypeListResponse"), exports);
|
|
67
|
+
__exportStar(require("./dtos/backoffice/EvaluationRequest"), exports);
|
|
68
|
+
__exportStar(require("./dtos/backoffice/EvaluationStatusRequest"), exports);
|
|
69
|
+
__exportStar(require("./dtos/backoffice/EvaluationResponse"), exports);
|
|
70
|
+
__exportStar(require("./dtos/backoffice/EvaluationListResponse"), exports);
|
|
71
|
+
__exportStar(require("./dtos/backoffice/ResultTraceResponse"), exports);
|
|
72
|
+
__exportStar(require("./dtos/backoffice/SimulateRequest"), exports);
|
|
73
|
+
__exportStar(require("./dtos/backoffice/SimulateResponse"), exports);
|
|
74
|
+
__exportStar(require("./dtos/backoffice/RuleCatalogResponse"), exports);
|
|
75
|
+
__exportStar(require("./dtos/backoffice/PopulationSourceResponse"), exports);
|
|
76
|
+
__exportStar(require("./dtos/backoffice/InputTypeResponse"), exports);
|
|
77
|
+
__exportStar(require("./dtos/backoffice/RulesChatTurn"), exports);
|
|
78
|
+
__exportStar(require("./dtos/backoffice/GenerateRulesRequest"), exports);
|
|
79
|
+
__exportStar(require("./dtos/backoffice/GenerateRulesResponse"), exports);
|
|
80
|
+
__exportStar(require("./dtos/backoffice/CreateRunRequest"), exports);
|
|
81
|
+
__exportStar(require("./dtos/backoffice/PopulationRunRequest"), exports);
|
|
82
|
+
__exportStar(require("./dtos/backoffice/ApproveRunRequest"), exports);
|
|
83
|
+
__exportStar(require("./dtos/backoffice/QuotaImpactResponse"), exports);
|
|
84
|
+
__exportStar(require("./dtos/backoffice/RunResponse"), exports);
|
|
85
|
+
__exportStar(require("./dtos/backoffice/RunListResponse"), exports);
|
|
86
|
+
__exportStar(require("./dtos/backoffice/RunResultResponse"), exports);
|
|
87
|
+
__exportStar(require("./dtos/backoffice/RunResultListResponse"), exports);
|
|
88
|
+
__exportStar(require("./dtos/backoffice/CreateRunResponse"), exports);
|
|
89
|
+
__exportStar(require("./dtos/backoffice/MetricsPointResponse"), exports);
|
|
90
|
+
__exportStar(require("./dtos/backoffice/FailedConditionStatResponse"), exports);
|
|
91
|
+
__exportStar(require("./dtos/backoffice/MetricsQuery"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Id de campaña, evaluación (minúsculas, dígitos y guion; 2 a 64; sin `#` ni `:` porque entran en llaves compuestas y en la idempotencyKey). */
|
|
2
|
+
export const ELIGIBILITY_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/;
|
|
3
|
+
/** `eventKey` de un tipo de evento: MAYÚSCULAS con guion bajo (ej. `PHONE_SALES_CODE_REDEEMED`). */
|
|
4
|
+
export const EVENT_KEY_PATTERN = /^[A-Z][A-Z0-9_]{2,63}$/;
|
|
5
|
+
/** Fecha de vigencia de una campaña (UTC, inclusiva). */
|
|
6
|
+
export const DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
7
|
+
/** Id de solicitud que genera el backoffice al abrir el formulario de una corrida manual (llave de idempotencia). */
|
|
8
|
+
export const REQUEST_ID_PATTERN = /^[A-Za-z0-9_-]{8,64}$/;
|
|
9
|
+
/** Cupos por campaña que caben junto a las reservas de una transacción (100 − 90 − registro del lote). */
|
|
10
|
+
export const MAX_QUOTAS_PER_CAMPAIGN = 9;
|
|
11
|
+
/** Tope de `limit` de los listados paginados. */
|
|
12
|
+
export const LIST_PAGE_MAX = 100;
|
|
13
|
+
/** Largo máximo del texto de un turno del chat que genera reglas. */
|
|
14
|
+
export const RULES_CHAT_TURN_MAX_LENGTH = 4000;
|
|
15
|
+
/** Tope de seguridad de turnos que acepta el DTO (el límite funcional, 10, lo aplica el lambda con `AI_CHAT_HISTORY_TOO_LONG`). */
|
|
16
|
+
export const RULES_CHAT_MAX_TURNS_HARD = 50;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsNumber, Max, Min } from 'class-validator';
|
|
3
|
+
|
|
1
4
|
/** Umbrales de consumo (0 a 1) que avisan a los operadores (spec B 5.6). */
|
|
2
5
|
export class CampaignAlerts {
|
|
6
|
+
@Expose()
|
|
7
|
+
@IsArray()
|
|
8
|
+
@ArrayMaxSize(5)
|
|
9
|
+
@IsNumber({}, { each: true })
|
|
10
|
+
@Min(0.01, { each: true })
|
|
11
|
+
@Max(1, { each: true })
|
|
3
12
|
thresholds: number[];
|
|
4
13
|
}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum, IsInt, IsString, Matches, Min } from 'class-validator';
|
|
1
3
|
import { QuotaPeriodEnum } from '../enums/QuotaPeriodEnum';
|
|
2
4
|
|
|
3
5
|
/** Un cupo de campania: cantidad maxima de premios (no dinero) en un periodo (spec B 5.6). */
|
|
4
6
|
export class CampaignQuota {
|
|
5
|
-
/** Unico dentro de la campania (ej. `primeros-500`). Entra en la llave del consumo (`{id}#{periodo}`)
|
|
7
|
+
/** Unico dentro de la campania (ej. `primeros-500`). Entra en la llave del consumo (`{id}#{periodo}`): sin `#`. */
|
|
8
|
+
@Expose()
|
|
9
|
+
@IsString()
|
|
10
|
+
@Matches(/^[a-z0-9][a-z0-9-]{0,62}$/)
|
|
6
11
|
id: string;
|
|
12
|
+
|
|
13
|
+
@Expose()
|
|
14
|
+
@IsInt()
|
|
15
|
+
@Min(1)
|
|
7
16
|
limit: number;
|
|
17
|
+
|
|
18
|
+
@Expose()
|
|
19
|
+
@IsEnum(QuotaPeriodEnum)
|
|
8
20
|
period: QuotaPeriodEnum;
|
|
9
21
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsOptional, IsString, Matches } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
/** `POST /runs/{id}/approve`: aprueba todo salvo los sujetos excluidos (`subjectKey`). */
|
|
5
|
+
export class ApproveRunRequest {
|
|
6
|
+
@Expose()
|
|
7
|
+
@IsOptional()
|
|
8
|
+
@IsArray()
|
|
9
|
+
@ArrayMaxSize(1000)
|
|
10
|
+
@IsString({ each: true })
|
|
11
|
+
@Matches(/^[A-Za-z0-9_-]{8,128}$/, { each: true })
|
|
12
|
+
excludeSubjectKeys?: string[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsDefined, IsEnum, IsNotEmpty, IsString, Matches, MaxLength, ValidateNested } from 'class-validator';
|
|
3
|
+
import { DATE_PATTERN, ELIGIBILITY_ID_PATTERN, MAX_QUOTAS_PER_CAMPAIGN } from '../../constants/BackofficeLimits';
|
|
4
|
+
import { QuotaExhaustedActionEnum } from '../../enums/QuotaExhaustedActionEnum';
|
|
5
|
+
import { CampaignAlerts } from '../CampaignAlerts';
|
|
6
|
+
import { CampaignQuota } from '../CampaignQuota';
|
|
7
|
+
|
|
8
|
+
/** Crear (POST) o reemplazar (PUT) una campaña. `status`, `pausedReason` y las fechas de auditoría las pone el servidor (el estado cambia con `POST /campaigns/{id}/status`). */
|
|
9
|
+
export class CampaignRequest {
|
|
10
|
+
@Expose()
|
|
11
|
+
@IsString()
|
|
12
|
+
@Matches(ELIGIBILITY_ID_PATTERN)
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
@Expose()
|
|
16
|
+
@IsString()
|
|
17
|
+
@IsNotEmpty()
|
|
18
|
+
@MaxLength(120)
|
|
19
|
+
name: string;
|
|
20
|
+
|
|
21
|
+
/** Qué se quiere lograr (texto libre). */
|
|
22
|
+
@Expose()
|
|
23
|
+
@IsString()
|
|
24
|
+
@IsNotEmpty()
|
|
25
|
+
@MaxLength(500)
|
|
26
|
+
objective: string;
|
|
27
|
+
|
|
28
|
+
/** `AAAA-MM-DD` (UTC, inclusiva). */
|
|
29
|
+
@Expose()
|
|
30
|
+
@Matches(DATE_PATTERN)
|
|
31
|
+
startsAt: string;
|
|
32
|
+
|
|
33
|
+
@Expose()
|
|
34
|
+
@Matches(DATE_PATTERN)
|
|
35
|
+
endsAt: string;
|
|
36
|
+
|
|
37
|
+
@Expose()
|
|
38
|
+
@IsArray()
|
|
39
|
+
@ArrayMaxSize(MAX_QUOTAS_PER_CAMPAIGN)
|
|
40
|
+
@ValidateNested({ each: true })
|
|
41
|
+
@Type(() => CampaignQuota)
|
|
42
|
+
quotas: CampaignQuota[];
|
|
43
|
+
|
|
44
|
+
@Expose()
|
|
45
|
+
@IsEnum(QuotaExhaustedActionEnum)
|
|
46
|
+
onExhausted: QuotaExhaustedActionEnum;
|
|
47
|
+
|
|
48
|
+
@Expose()
|
|
49
|
+
@IsDefined()
|
|
50
|
+
@ValidateNested()
|
|
51
|
+
@Type(() => CampaignAlerts)
|
|
52
|
+
alerts: CampaignAlerts;
|
|
53
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CampaignPausedReasonEnum } from '../../enums/CampaignPausedReasonEnum';
|
|
2
|
+
import { CampaignStatusEnum } from '../../enums/CampaignStatusEnum';
|
|
3
|
+
import { QuotaExhaustedActionEnum } from '../../enums/QuotaExhaustedActionEnum';
|
|
4
|
+
import { CampaignAlerts } from '../CampaignAlerts';
|
|
5
|
+
import { CampaignQuota } from '../CampaignQuota';
|
|
6
|
+
|
|
7
|
+
/** Una campaña (spec B 5.6). */
|
|
8
|
+
export class CampaignResponse {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
objective: string;
|
|
12
|
+
status: CampaignStatusEnum;
|
|
13
|
+
/** Solo si `status` es `PAUSED`. */
|
|
14
|
+
pausedReason?: CampaignPausedReasonEnum;
|
|
15
|
+
startsAt: string;
|
|
16
|
+
endsAt: string;
|
|
17
|
+
quotas: CampaignQuota[];
|
|
18
|
+
onExhausted: QuotaExhaustedActionEnum;
|
|
19
|
+
alerts: CampaignAlerts;
|
|
20
|
+
/** Epoch en milisegundos. */
|
|
21
|
+
createdAt: number;
|
|
22
|
+
updatedAt: number;
|
|
23
|
+
updatedBy: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum } from 'class-validator';
|
|
3
|
+
import { CampaignStatusEnum } from '../../enums/CampaignStatusEnum';
|
|
4
|
+
|
|
5
|
+
/** Cuerpo de `POST /campaigns/{id}/status`: activar, pausar, terminar o archivar. */
|
|
6
|
+
export class CampaignStatusRequest {
|
|
7
|
+
@Expose()
|
|
8
|
+
@IsEnum(CampaignStatusEnum)
|
|
9
|
+
status: CampaignStatusEnum;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CampaignPausedReasonEnum } from '../../enums/CampaignPausedReasonEnum';
|
|
2
|
+
import { CampaignStatusEnum } from '../../enums/CampaignStatusEnum';
|
|
3
|
+
|
|
4
|
+
/** Fila de la tabla ejecutiva `GET /campaigns/summary` (spec 10.1). */
|
|
5
|
+
export class CampaignSummaryResponse {
|
|
6
|
+
campaignId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
status: CampaignStatusEnum;
|
|
9
|
+
pausedReason?: CampaignPausedReasonEnum;
|
|
10
|
+
startsAt: string;
|
|
11
|
+
endsAt: string;
|
|
12
|
+
evaluated: number;
|
|
13
|
+
matched: number;
|
|
14
|
+
requested: number;
|
|
15
|
+
quotaExhausted: number;
|
|
16
|
+
/** Cupo más restrictivo, de 0 a 1 (0 si la campaña no tiene cupos). */
|
|
17
|
+
quotaUsed: number;
|
|
18
|
+
/** Ritmo diario de pedidos de los últimos 7 días (para proyectar el agotamiento). */
|
|
19
|
+
dailyRate: number;
|
|
20
|
+
/** `AAAA-MM-DD` estimada en que se agota el cupo más restrictivo al ritmo actual; ausente si no aplica. */
|
|
21
|
+
projectedExhaustionDate?: string;
|
|
22
|
+
/** Valor entregado: lo calcula rewards por `campaignId`; este lambda no lo informa. */
|
|
23
|
+
value?: { amount: number; currency: string }[];
|
|
24
|
+
/** Entregados de verdad según rewards; este lambda no lo informa. */
|
|
25
|
+
granted?: number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { IsEnum, IsOptional, Matches, Validate, ValidateNested } from 'class-validator';
|
|
3
|
+
import { DynamicFormValue } from '../../../dynamicForm/types/DynamicFormValue';
|
|
4
|
+
import { IsDynamicFormValues } from '../../../dynamicForm/validators/IsDynamicFormValues';
|
|
5
|
+
import { REQUEST_ID_PATTERN } from '../../constants/BackofficeLimits';
|
|
6
|
+
import { RunModeEnum } from '../../enums/RunModeEnum';
|
|
7
|
+
import { PopulationRunRequest } from './PopulationRunRequest';
|
|
8
|
+
|
|
9
|
+
/** `POST /evaluations/{id}/runs` (spec 10): una corrida manual de UN sujeto (`inputs`) o de una población (`population`, fase 4). */
|
|
10
|
+
export class CreateRunRequest {
|
|
11
|
+
/** Id de solicitud que genera el backoffice al abrir el formulario: es la llave de idempotencia (doble clic = misma corrida). */
|
|
12
|
+
@Expose()
|
|
13
|
+
@Matches(REQUEST_ID_PATTERN)
|
|
14
|
+
requestId: string;
|
|
15
|
+
|
|
16
|
+
@Expose()
|
|
17
|
+
@IsEnum(RunModeEnum)
|
|
18
|
+
mode: RunModeEnum;
|
|
19
|
+
|
|
20
|
+
@Expose()
|
|
21
|
+
@IsOptional()
|
|
22
|
+
@Validate(IsDynamicFormValues)
|
|
23
|
+
inputs?: Record<string, DynamicFormValue>;
|
|
24
|
+
|
|
25
|
+
@Expose()
|
|
26
|
+
@IsOptional()
|
|
27
|
+
@ValidateNested()
|
|
28
|
+
@Type(() => PopulationRunRequest)
|
|
29
|
+
population?: PopulationRunRequest;
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RunResponse } from './RunResponse';
|
|
2
|
+
import { RunResultResponse } from './RunResultResponse';
|
|
3
|
+
|
|
4
|
+
/** Respuesta de `POST /evaluations/{id}/runs`: la corrida y, si es de un sujeto, su resultado con traza (spec 7.3). */
|
|
5
|
+
export class CreateRunResponse {
|
|
6
|
+
run: RunResponse;
|
|
7
|
+
result?: RunResultResponse;
|
|
8
|
+
/** `true` si el `requestId` ya existía: es la MISMA corrida de antes. */
|
|
9
|
+
idempotentReplay: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, ArrayMinSize, IsArray, IsNotEmpty, IsObject, IsString, Matches, MaxLength } from 'class-validator';
|
|
3
|
+
import { JsonValue } from '../../../common';
|
|
4
|
+
import { InputField } from '../../../dynamicForm/dtos/InputField';
|
|
5
|
+
import { ELIGIBILITY_ID_PATTERN } from '../../constants/BackofficeLimits';
|
|
6
|
+
import { EvaluationReward } from '../EvaluationReward';
|
|
7
|
+
import { EvaluationTrigger } from '../EvaluationTrigger';
|
|
8
|
+
import { GrantPolicy } from '../GrantPolicy';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Crear (POST) o reemplazar (PUT) una evaluación (spec 5.1). `status`, `version` y auditoría los pone el servidor.
|
|
12
|
+
* Aquí solo se valida la FORMA gruesa; las reglas del spec 5.1 (llaves únicas, `validateRule`, paquete ACTIVO, disparadores…)
|
|
13
|
+
* las valida el lambda, que devuelve TODOS los problemas juntos.
|
|
14
|
+
*/
|
|
15
|
+
export class EvaluationRequest {
|
|
16
|
+
@Expose()
|
|
17
|
+
@IsString()
|
|
18
|
+
@Matches(ELIGIBILITY_ID_PATTERN)
|
|
19
|
+
id: string;
|
|
20
|
+
|
|
21
|
+
@Expose()
|
|
22
|
+
@IsString()
|
|
23
|
+
@Matches(ELIGIBILITY_ID_PATTERN)
|
|
24
|
+
campaignId: string;
|
|
25
|
+
|
|
26
|
+
@Expose()
|
|
27
|
+
@IsString()
|
|
28
|
+
@IsNotEmpty()
|
|
29
|
+
@MaxLength(160)
|
|
30
|
+
name: string;
|
|
31
|
+
|
|
32
|
+
@Expose()
|
|
33
|
+
@IsString()
|
|
34
|
+
@MaxLength(500)
|
|
35
|
+
description: string;
|
|
36
|
+
|
|
37
|
+
/** Contrato de entrada (`InputField[]`, dominio `dynamicForm`). */
|
|
38
|
+
@Expose()
|
|
39
|
+
@IsArray()
|
|
40
|
+
@ArrayMaxSize(30)
|
|
41
|
+
@IsObject({ each: true })
|
|
42
|
+
inputs: InputField[];
|
|
43
|
+
|
|
44
|
+
/** Reglas de `@fiado/rules-engine` (`{ match, groups[] }`). */
|
|
45
|
+
@Expose()
|
|
46
|
+
@IsObject()
|
|
47
|
+
rules: { [key: string]: JsonValue };
|
|
48
|
+
|
|
49
|
+
/** Llave del input `DIRECTORY` al que se le entrega el premio. */
|
|
50
|
+
@Expose()
|
|
51
|
+
@IsString()
|
|
52
|
+
@IsNotEmpty()
|
|
53
|
+
beneficiaryInput: string;
|
|
54
|
+
|
|
55
|
+
@Expose()
|
|
56
|
+
@IsObject()
|
|
57
|
+
reward: EvaluationReward;
|
|
58
|
+
|
|
59
|
+
@Expose()
|
|
60
|
+
@IsObject()
|
|
61
|
+
grantPolicy: GrantPolicy;
|
|
62
|
+
|
|
63
|
+
@Expose()
|
|
64
|
+
@IsArray()
|
|
65
|
+
@ArrayMinSize(1)
|
|
66
|
+
@ArrayMaxSize(10)
|
|
67
|
+
@IsObject({ each: true })
|
|
68
|
+
triggers: EvaluationTrigger[];
|
|
69
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JsonValue } from '../../../common';
|
|
2
|
+
import { InputField } from '../../../dynamicForm/dtos/InputField';
|
|
3
|
+
import { EvaluationStatusEnum } from '../../enums/EvaluationStatusEnum';
|
|
4
|
+
import { EvaluationReward } from '../EvaluationReward';
|
|
5
|
+
import { EvaluationTrigger } from '../EvaluationTrigger';
|
|
6
|
+
import { GrantPolicy } from '../GrantPolicy';
|
|
7
|
+
|
|
8
|
+
export class EvaluationResponse {
|
|
9
|
+
id: string;
|
|
10
|
+
campaignId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
status: EvaluationStatusEnum;
|
|
14
|
+
/** Sube con cada edición de una evaluación `ACTIVE`. */
|
|
15
|
+
version: number;
|
|
16
|
+
inputs: InputField[];
|
|
17
|
+
rules: { [key: string]: JsonValue };
|
|
18
|
+
beneficiaryInput: string;
|
|
19
|
+
reward: EvaluationReward;
|
|
20
|
+
grantPolicy: GrantPolicy;
|
|
21
|
+
triggers: EvaluationTrigger[];
|
|
22
|
+
createdAt: number;
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
updatedBy: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum } from 'class-validator';
|
|
3
|
+
import { EvaluationStatusEnum } from '../../enums/EvaluationStatusEnum';
|
|
4
|
+
|
|
5
|
+
/** Cuerpo de `POST /evaluations/{id}/status`: activar, pausar o archivar. */
|
|
6
|
+
export class EvaluationStatusRequest {
|
|
7
|
+
@Expose()
|
|
8
|
+
@IsEnum(EvaluationStatusEnum)
|
|
9
|
+
status: EvaluationStatusEnum;
|
|
10
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsEnum, IsNotEmpty, IsObject, IsString, Matches, MaxLength } from 'class-validator';
|
|
3
|
+
import { InputField } from '../../../dynamicForm/dtos/InputField';
|
|
4
|
+
import { RewardStatusEnum } from '../../../rewards/enums/RewardStatusEnum';
|
|
5
|
+
import { EVENT_KEY_PATTERN } from '../../constants/BackofficeLimits';
|
|
6
|
+
|
|
7
|
+
/** Alta (POST) o reemplazo (PUT) de un tipo de evento (spec 5.2). Los `fields` se validan a fondo en el lambda (`InputFieldValidationService`). */
|
|
8
|
+
export class EventTypeRequest {
|
|
9
|
+
@Expose()
|
|
10
|
+
@IsString()
|
|
11
|
+
@Matches(EVENT_KEY_PATTERN)
|
|
12
|
+
eventKey: string;
|
|
13
|
+
|
|
14
|
+
@Expose()
|
|
15
|
+
@IsString()
|
|
16
|
+
@IsNotEmpty()
|
|
17
|
+
@MaxLength(120)
|
|
18
|
+
name: string;
|
|
19
|
+
|
|
20
|
+
@Expose()
|
|
21
|
+
@IsString()
|
|
22
|
+
@MaxLength(500)
|
|
23
|
+
description: string;
|
|
24
|
+
|
|
25
|
+
/** Servicio que lo emite (ej. `phone-sales`). */
|
|
26
|
+
@Expose()
|
|
27
|
+
@IsString()
|
|
28
|
+
@IsNotEmpty()
|
|
29
|
+
@MaxLength(60)
|
|
30
|
+
emitter: string;
|
|
31
|
+
|
|
32
|
+
@Expose()
|
|
33
|
+
@IsArray()
|
|
34
|
+
@ArrayMaxSize(30)
|
|
35
|
+
@IsObject({ each: true })
|
|
36
|
+
fields: InputField[];
|
|
37
|
+
|
|
38
|
+
@Expose()
|
|
39
|
+
@IsEnum(RewardStatusEnum)
|
|
40
|
+
status: RewardStatusEnum;
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InputField } from '../../../dynamicForm/dtos/InputField';
|
|
2
|
+
import { RewardStatusEnum } from '../../../rewards/enums/RewardStatusEnum';
|
|
3
|
+
|
|
4
|
+
export class EventTypeResponse {
|
|
5
|
+
eventKey: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
emitter: string;
|
|
9
|
+
fields: InputField[];
|
|
10
|
+
status: RewardStatusEnum;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Condición que más hace fallar la regla (`GET /metrics/failed-conditions`). */
|
|
2
|
+
export class FailedConditionStatResponse {
|
|
3
|
+
/** `{source}.{field}`. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** Etiqueta legible (del catálogo de reglas; si no está, la propia `key`). */
|
|
6
|
+
label: string;
|
|
7
|
+
count: number;
|
|
8
|
+
}
|