@fiado/type-kit 3.529.0 → 3.531.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 +11 -1
- package/_test_/unit/rewardsEligibility/catalogDtos.test.ts +1 -7
- package/_test_/unit/rewardsEligibility/evaluationDtos.test.ts +7 -0
- package/_test_/unit/rewardsEligibility/runDtos.test.ts +2 -2
- package/_test_/unit/rewardsEligibility/segmentBackofficeDtos.test.ts +29 -0
- package/_test_/unit/rewardsEligibility/segmentDefinitionDto.test.ts +46 -0
- package/_test_/unit/rewardsEligibility/segmentEnums.test.ts +43 -0
- package/_test_/unit/rewardsEligibility/segmentMessagesAndRunDtos.test.ts +52 -0
- package/bin/rewardsEligibility/constants/BackofficeLimits.d.ts +2 -0
- package/bin/rewardsEligibility/constants/BackofficeLimits.js +3 -1
- package/bin/rewardsEligibility/constants/SegmentLimits.d.ts +5 -0
- package/bin/rewardsEligibility/constants/SegmentLimits.js +8 -0
- package/bin/rewardsEligibility/dtos/EvaluationTrigger.d.ts +0 -3
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunRequest.js +4 -2
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationRequest.d.ts +4 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationRequest.js +14 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationResponse.d.ts +2 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationRunRequest.d.ts +1 -3
- package/bin/rewardsEligibility/dtos/backoffice/PopulationRunRequest.js +1 -18
- package/bin/rewardsEligibility/dtos/backoffice/RunPopulationProgress.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunPopulationProgress.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResponse.d.ts +19 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/PopulationSegmentDefinition.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/PopulationSegmentDefinition.js +40 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/PrivateSegmentResponse.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/PrivateSegmentResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentAggregateCondition.d.ts +18 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentAggregateCondition.js +71 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentColumnCondition.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentColumnCondition.js +46 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionPageResponse.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionPageResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionRequest.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionRequest.js +31 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionResponse.d.ts +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentGroup.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentGroup.js +44 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentLastTest.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentLastTest.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentListResponse.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentListResponse.js +10 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentParam.d.ts +10 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentParam.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentSaveRequest.d.ts +13 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentSaveRequest.js +58 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentSchemaResponse.d.ts +10 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentSchemaResponse.js +10 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentStatusRequest.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentStatusRequest.js +31 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentTableSchemaResponse.d.ts +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentTableSchemaResponse.js +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentTestRequest.d.ts +4 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentTestRequest.js +25 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentTestResponse.d.ts +26 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentTestResponse.js +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentUsedByResponse.d.ts +21 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentUsedByResponse.js +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentUsedColumn.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentUsedColumn.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentVersionListResponse.d.ts +4 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentVersionListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentVersionResponse.d.ts +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentVersionResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentVersionSummaryResponse.d.ts +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentVersionSummaryResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentWindow.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/segments/SegmentWindow.js +31 -0
- package/bin/rewardsEligibility/dtos/messages/EvaluateBatchMessage.d.ts +14 -0
- package/bin/rewardsEligibility/dtos/messages/EvaluateBatchMessage.js +61 -0
- package/bin/rewardsEligibility/dtos/messages/GrantBatchMessage.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/messages/GrantBatchMessage.js +42 -0
- package/bin/rewardsEligibility/dtos/messages/PopulationPageMessage.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/messages/PopulationPageMessage.js +30 -0
- package/bin/rewardsEligibility/dtos/messages/ReleaseTrancheMessage.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/messages/ReleaseTrancheMessage.js +30 -0
- package/bin/rewardsEligibility/enums/EligibilityMessageTypeEnum.d.ts +6 -0
- package/bin/rewardsEligibility/enums/EligibilityMessageTypeEnum.js +11 -0
- package/bin/rewardsEligibility/enums/SegmentAggregateFnEnum.d.ts +5 -0
- package/bin/rewardsEligibility/enums/SegmentAggregateFnEnum.js +9 -0
- package/bin/rewardsEligibility/enums/SegmentConditionKindEnum.d.ts +4 -0
- package/bin/rewardsEligibility/enums/SegmentConditionKindEnum.js +8 -0
- package/bin/rewardsEligibility/enums/SegmentErrorCodeEnum.d.ts +16 -0
- package/bin/rewardsEligibility/enums/SegmentErrorCodeEnum.js +20 -0
- package/bin/rewardsEligibility/enums/SegmentMatchEnum.d.ts +4 -0
- package/bin/rewardsEligibility/enums/SegmentMatchEnum.js +8 -0
- package/bin/rewardsEligibility/enums/SegmentOperatorEnum.d.ts +16 -0
- package/bin/rewardsEligibility/enums/SegmentOperatorEnum.js +20 -0
- package/bin/rewardsEligibility/enums/SegmentParamSourceEnum.d.ts +5 -0
- package/bin/rewardsEligibility/enums/SegmentParamSourceEnum.js +9 -0
- package/bin/rewardsEligibility/enums/SegmentParamTypeEnum.d.ts +7 -0
- package/bin/rewardsEligibility/enums/SegmentParamTypeEnum.js +11 -0
- package/bin/rewardsEligibility/enums/SegmentStatusEnum.d.ts +5 -0
- package/bin/rewardsEligibility/enums/SegmentStatusEnum.js +9 -0
- package/bin/rewardsEligibility/enums/SegmentTestStatusEnum.d.ts +5 -0
- package/bin/rewardsEligibility/enums/SegmentTestStatusEnum.js +9 -0
- package/bin/rewardsEligibility/index.d.ts +39 -2
- package/bin/rewardsEligibility/index.js +43 -2
- package/package.json +1 -1
- package/src/rewardsEligibility/constants/BackofficeLimits.ts +2 -0
- package/src/rewardsEligibility/constants/SegmentLimits.ts +5 -0
- package/src/rewardsEligibility/dtos/EvaluationTrigger.ts +0 -3
- package/src/rewardsEligibility/dtos/backoffice/CreateRunRequest.ts +3 -2
- package/src/rewardsEligibility/dtos/backoffice/EvaluationRequest.ts +16 -2
- package/src/rewardsEligibility/dtos/backoffice/EvaluationResponse.ts +2 -0
- package/src/rewardsEligibility/dtos/backoffice/PopulationRunRequest.ts +2 -11
- package/src/rewardsEligibility/dtos/backoffice/RunPopulationProgress.ts +9 -0
- package/src/rewardsEligibility/dtos/backoffice/RunResponse.ts +12 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/PopulationSegmentDefinition.ts +12 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/PrivateSegmentResponse.ts +12 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentAggregateCondition.ts +22 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentColumnCondition.ts +15 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionPageResponse.ts +8 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionRequest.ts +17 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentExecutionResponse.ts +7 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentGroup.ts +27 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentLastTest.ts +8 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentListResponse.ts +11 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentParam.ts +11 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentSaveRequest.ts +16 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentSchemaResponse.ts +11 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentStatusRequest.ts +9 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentTableSchemaResponse.ts +14 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentTestRequest.ts +7 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentTestResponse.ts +29 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentUsedByResponse.ts +24 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentUsedColumn.ts +5 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentVersionListResponse.ts +5 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentVersionResponse.ts +25 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentVersionSummaryResponse.ts +13 -0
- package/src/rewardsEligibility/dtos/backoffice/segments/SegmentWindow.ts +9 -0
- package/src/rewardsEligibility/dtos/messages/EvaluateBatchMessage.ts +42 -0
- package/src/rewardsEligibility/dtos/messages/GrantBatchMessage.ts +25 -0
- package/src/rewardsEligibility/dtos/messages/PopulationPageMessage.ts +15 -0
- package/src/rewardsEligibility/dtos/messages/ReleaseTrancheMessage.ts +15 -0
- package/src/rewardsEligibility/enums/EligibilityMessageTypeEnum.ts +7 -0
- package/src/rewardsEligibility/enums/SegmentAggregateFnEnum.ts +5 -0
- package/src/rewardsEligibility/enums/SegmentConditionKindEnum.ts +4 -0
- package/src/rewardsEligibility/enums/SegmentErrorCodeEnum.ts +16 -0
- package/src/rewardsEligibility/enums/SegmentMatchEnum.ts +4 -0
- package/src/rewardsEligibility/enums/SegmentOperatorEnum.ts +16 -0
- package/src/rewardsEligibility/enums/SegmentParamSourceEnum.ts +5 -0
- package/src/rewardsEligibility/enums/SegmentParamTypeEnum.ts +7 -0
- package/src/rewardsEligibility/enums/SegmentStatusEnum.ts +5 -0
- package/src/rewardsEligibility/enums/SegmentTestStatusEnum.ts +5 -0
- package/src/rewardsEligibility/index.ts +47 -2
- package/bin/rewardsEligibility/dtos/PopulationRef.d.ts +0 -6
- package/bin/rewardsEligibility/dtos/PopulationRef.js +0 -7
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.d.ts +0 -11
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.js +0 -7
- package/src/rewardsEligibility/dtos/PopulationRef.ts +0 -7
- package/src/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.ts +0 -12
|
@@ -6,12 +6,22 @@ describe('barrel rewardsEligibility incluye el backoffice', () => {
|
|
|
6
6
|
'CampaignRequest', 'CampaignStatusRequest', 'CampaignResponse', 'CampaignListResponse', 'QuotaUsageResponse', 'CampaignSummaryResponse',
|
|
7
7
|
'EventTypeRequest', 'EventTypeResponse', 'EventTypeListResponse', 'EvaluationRequest', 'EvaluationStatusRequest', 'EvaluationResponse',
|
|
8
8
|
'EvaluationListResponse', 'ResultTraceResponse', 'TraceGroupResponse', 'TraceConditionResponse', 'SimulateRequest', 'SimulateResponse',
|
|
9
|
-
'RuleCatalogResponse', 'RuleCatalogSourceResponse', 'RuleCatalogFieldResponse', '
|
|
9
|
+
'RuleCatalogResponse', 'RuleCatalogSourceResponse', 'RuleCatalogFieldResponse', 'InputTypeResponse',
|
|
10
10
|
'CreateRunRequest', 'PopulationRunRequest', 'ApproveRunRequest', 'QuotaImpactResponse', 'RunResponse', 'RunListResponse',
|
|
11
11
|
'RunResultResponse', 'RunResultListResponse', 'CreateRunResponse', 'MetricsPointResponse', 'FailedConditionStatResponse', 'MetricsQuery',
|
|
12
12
|
'MetricsDimensionEnum', 'RuleValueTypeEnum', 'ELIGIBILITY_ID_PATTERN', 'EVENT_KEY_PATTERN', 'REQUEST_ID_PATTERN', 'MAX_QUOTAS_PER_CAMPAIGN',
|
|
13
13
|
'RulesChatRoleEnum', 'RulesChatTurn', 'GenerateRulesRequest', 'GenerateRulesResponse', 'RULES_CHAT_TURN_MAX_LENGTH', 'RULES_CHAT_MAX_TURNS_HARD',
|
|
14
|
+
'SegmentParam', 'SegmentUsedColumn', 'SegmentLastTest', 'SegmentTestRequest', 'SegmentTestResponse', 'SegmentTestResultResponse',
|
|
15
|
+
'SegmentTestErrorResponse', 'SegmentSaveRequest', 'SegmentStatusRequest', 'SegmentVersionResponse', 'SegmentVersionSummaryResponse',
|
|
16
|
+
'SegmentListItemResponse', 'SegmentListResponse', 'SegmentVersionListResponse', 'SegmentSchemaResponse', 'SegmentSchemaTableResponse',
|
|
17
|
+
'SegmentTableSchemaResponse', 'SegmentColumnSchemaResponse', 'SegmentUsedByResponse', 'SegmentUsedByEvaluation', 'SegmentUsedByRun',
|
|
18
|
+
'PopulationPageMessage', 'EvaluateBatchMessage', 'EvaluateBatchSubject', 'GrantBatchMessage', 'ReleaseTrancheMessage', 'PrivateSegmentResponse',
|
|
19
|
+
'SegmentExecutionRequest', 'SegmentExecutionResponse', 'SegmentExecutionPageResponse', 'RunPopulationProgress', 'INPUT_KEY_PATTERN',
|
|
14
20
|
])('exporta %s', (name) => {
|
|
15
21
|
expect((kit as Record<string, object | string | number | RegExp>)[name]).toBeDefined();
|
|
16
22
|
});
|
|
23
|
+
|
|
24
|
+
it.each(['PopulationSourceResponse', 'PopulationRef'])('ya no exporta %s (reemplazado por segmentos)', (name) => {
|
|
25
|
+
expect((kit as Record<string, object | string | number | RegExp>)[name]).toBeUndefined();
|
|
26
|
+
});
|
|
17
27
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RuleValueTypeEnum } from '../../../src/rewardsEligibility/enums/RuleValueTypeEnum';
|
|
2
2
|
import { InputFieldTypeEnum } from '../../../src/dynamicForm/enums/InputFieldTypeEnum';
|
|
3
3
|
import type { RuleCatalogResponse } from '../../../src/rewardsEligibility/dtos/backoffice/RuleCatalogResponse';
|
|
4
|
-
import type { PopulationSourceResponse } from '../../../src/rewardsEligibility/dtos/backoffice/PopulationSourceResponse';
|
|
5
4
|
import type { InputTypeResponse } from '../../../src/rewardsEligibility/dtos/backoffice/InputTypeResponse';
|
|
6
5
|
|
|
7
6
|
describe('DTOs de catálogos (forma)', () => {
|
|
@@ -15,13 +14,8 @@ describe('DTOs de catálogos (forma)', () => {
|
|
|
15
14
|
};
|
|
16
15
|
expect(catalog.sources[0]?.fields[0]?.valueType).toBe('NUMBER');
|
|
17
16
|
});
|
|
18
|
-
it('
|
|
19
|
-
const source: PopulationSourceResponse = {
|
|
20
|
-
source: 'TX_ACTIVE_IN_WINDOW', label: 'Con transacciones', description: 'd',
|
|
21
|
-
paramsSchema: [{ key: 'window', type: InputFieldTypeEnum.TEXT, label: 'Ventana', required: true }], provides: ['directoryId'],
|
|
22
|
-
};
|
|
17
|
+
it('un tipo de input', () => {
|
|
23
18
|
const type: InputTypeResponse = { type: InputFieldTypeEnum.DIRECTORY, label: 'Usuario' };
|
|
24
|
-
expect(source.provides).toEqual(['directoryId']);
|
|
25
19
|
expect(type.type).toBe('DIRECTORY');
|
|
26
20
|
});
|
|
27
21
|
});
|
|
@@ -3,6 +3,7 @@ import { plainToInstance } from 'class-transformer';
|
|
|
3
3
|
import { validate } from 'class-validator';
|
|
4
4
|
import { EvaluationRequest } from '../../../src/rewardsEligibility/dtos/backoffice/EvaluationRequest';
|
|
5
5
|
import { EvaluationStatusRequest } from '../../../src/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest';
|
|
6
|
+
import { EvaluationTrigger } from '../../../src/rewardsEligibility/dtos/EvaluationTrigger';
|
|
6
7
|
import { SimulateRequest } from '../../../src/rewardsEligibility/dtos/backoffice/SimulateRequest';
|
|
7
8
|
|
|
8
9
|
const parse = <T extends object>(cls: new () => T, value: object): T => plainToInstance(cls, value, { excludeExtraneousValues: true });
|
|
@@ -51,3 +52,9 @@ describe('EvaluationStatusRequest / SimulateRequest', () => {
|
|
|
51
52
|
expect((await validate(parse(SimulateRequest, { evaluationId: 'x' }))).length).toBeGreaterThan(0);
|
|
52
53
|
});
|
|
53
54
|
});
|
|
55
|
+
|
|
56
|
+
describe('EvaluationTrigger', () => {
|
|
57
|
+
it('ya no declara `population` (reemplazado por populationSegmentId de la evaluacion)', () => {
|
|
58
|
+
expect('population' in new EvaluationTrigger()).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -12,10 +12,10 @@ describe('CreateRunRequest', () => {
|
|
|
12
12
|
expect(await validate(request)).toEqual([]);
|
|
13
13
|
expect(request.inputs).toEqual({ buyerDirectoryId: 'd-1' });
|
|
14
14
|
});
|
|
15
|
-
it('población: params
|
|
15
|
+
it('población: sin params (usa el segmento de la evaluación); params enviados se descartan', async () => {
|
|
16
16
|
const request = parse(CreateRunRequest, { requestId: 'req-12345678', mode: 'SIMULATION', population: { params: { window: '7d' } } });
|
|
17
17
|
expect(await validate(request)).toEqual([]);
|
|
18
|
-
expect(request.population
|
|
18
|
+
expect(request.population && 'params' in request.population).toBe(false);
|
|
19
19
|
});
|
|
20
20
|
it.each([
|
|
21
21
|
['requestId corto', { requestId: 'a', mode: 'LIVE', inputs: {} }],
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { plainToInstance } from 'class-transformer';
|
|
3
|
+
import { validate } from 'class-validator';
|
|
4
|
+
import { SegmentSaveRequest, SegmentStatusRequest, SegmentTestRequest } from '../../../src/rewardsEligibility';
|
|
5
|
+
|
|
6
|
+
const def = { baseTable: 'remittanceusers', match: 'ALL', groups: [{ match: 'ALL', conditions: [{ kind: 'COLUMN', table: 'remittanceusers', column: 'status', op: 'EQUALS', value: 'ACTIVE' }] }] };
|
|
7
|
+
const ok = async <T extends object>(cls: new () => T, plain: object) => (await validate(plainToInstance(cls, plain, { excludeExtraneousValues: true }))).length === 0;
|
|
8
|
+
|
|
9
|
+
describe('DTOs de segmentos del backoffice', () => {
|
|
10
|
+
it('SegmentTestRequest exige definition valida', async () => {
|
|
11
|
+
expect(await ok(SegmentTestRequest, { definition: def })).toBe(true);
|
|
12
|
+
expect(await ok(SegmentTestRequest, {})).toBe(false);
|
|
13
|
+
expect(await ok(SegmentTestRequest, { definition: { ...def, baseTable: 'X' } })).toBe(false);
|
|
14
|
+
});
|
|
15
|
+
it('SegmentSaveRequest: name, owner, testId y status DRAFT|ACTIVE (nunca ARCHIVED al guardar)', async () => {
|
|
16
|
+
const base = { name: 'Promotores', description: '', owner: 'growth', definition: def, testId: 't-1', status: 'ACTIVE' };
|
|
17
|
+
expect(await ok(SegmentSaveRequest, base)).toBe(true);
|
|
18
|
+
expect(await ok(SegmentSaveRequest, { ...base, status: 'ARCHIVED' })).toBe(false);
|
|
19
|
+
expect(await ok(SegmentSaveRequest, { ...base, name: '' })).toBe(false);
|
|
20
|
+
expect(await ok(SegmentSaveRequest, { ...base, testId: undefined })).toBe(false);
|
|
21
|
+
expect(await ok(SegmentSaveRequest, { ...base, testId: '#TEST#x' })).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
it('SegmentStatusRequest: version opcional entera >= 1; status del enum', async () => {
|
|
24
|
+
expect(await ok(SegmentStatusRequest, { status: 'ARCHIVED' })).toBe(true);
|
|
25
|
+
expect(await ok(SegmentStatusRequest, { status: 'ACTIVE', version: 2 })).toBe(true);
|
|
26
|
+
expect(await ok(SegmentStatusRequest, { status: 'ACTIVE', version: 0 })).toBe(false);
|
|
27
|
+
expect(await ok(SegmentStatusRequest, { status: 'PAUSED' })).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { plainToInstance } from 'class-transformer';
|
|
3
|
+
import { validate } from 'class-validator';
|
|
4
|
+
import { PopulationSegmentDefinition, SegmentAggregateCondition, SegmentColumnCondition } from '../../../src/rewardsEligibility';
|
|
5
|
+
|
|
6
|
+
interface PlainCondition {
|
|
7
|
+
kind: string;
|
|
8
|
+
[key: string]: string | number | object;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const valid = {
|
|
12
|
+
baseTable: 'remittanceusers', match: 'ALL',
|
|
13
|
+
groups: [{ match: 'ALL', conditions: [
|
|
14
|
+
{ kind: 'COLUMN', table: 'remittanceusers', column: 'status', op: 'EQUALS', value: 'ACTIVE' },
|
|
15
|
+
{ kind: 'AGGREGATE', table: 'remittancetransactions', fn: 'SUM', column: 'amountusd', op: 'GT', value: 100,
|
|
16
|
+
window: { dateColumn: 'createdat', days: 30 }, filters: [{ kind: 'COLUMN', table: 'remittancetransactions', column: 'status', op: 'EQUALS', value: 'PAYABLE' }] },
|
|
17
|
+
] }],
|
|
18
|
+
};
|
|
19
|
+
const aggregate: PlainCondition = valid.groups[0].conditions[1];
|
|
20
|
+
const errorsOf = async (plain: object): Promise<number> =>
|
|
21
|
+
(await validate(plainToInstance(PopulationSegmentDefinition, plain, { excludeExtraneousValues: true }))).length;
|
|
22
|
+
|
|
23
|
+
describe('PopulationSegmentDefinition', () => {
|
|
24
|
+
it('acepta el ejemplo combinado de A§4.6 y deserializa cada condicion a su clase', async () => {
|
|
25
|
+
const def = plainToInstance(PopulationSegmentDefinition, valid, { excludeExtraneousValues: true });
|
|
26
|
+
expect(await validate(def)).toEqual([]);
|
|
27
|
+
expect(def.groups[0].conditions[0]).toBeInstanceOf(SegmentColumnCondition);
|
|
28
|
+
expect(def.groups[0].conditions[1]).toBeInstanceOf(SegmentAggregateCondition);
|
|
29
|
+
});
|
|
30
|
+
it.each([
|
|
31
|
+
['tabla con mayusculas', { ...valid, baseTable: 'Users' }],
|
|
32
|
+
['tabla con comilla', { ...valid, baseTable: 'a"b' }],
|
|
33
|
+
['sin grupos', { ...valid, groups: [] }],
|
|
34
|
+
['match invalido', { ...valid, match: 'XOR' }],
|
|
35
|
+
['days 0', { ...valid, groups: [{ match: 'ALL', conditions: [{ ...aggregate, window: { dateColumn: 'createdat', days: 0 } }] }] }],
|
|
36
|
+
['days 366', { ...valid, groups: [{ match: 'ALL', conditions: [{ ...aggregate, window: { dateColumn: 'createdat', days: 366 } }] }] }],
|
|
37
|
+
['operador desconocido', { ...valid, groups: [{ match: 'ALL', conditions: [{ kind: 'COLUMN', table: 't', column: 'c', op: 'LIKE', value: 'x' }] }] }],
|
|
38
|
+
['kind desconocido', { ...valid, groups: [{ match: 'ALL', conditions: [{ kind: 'RAW', sql: 'select 1' }] }] }],
|
|
39
|
+
])('rechaza: %s', async (_name, plain) => {
|
|
40
|
+
expect(await errorsOf(plain)).toBeGreaterThan(0);
|
|
41
|
+
});
|
|
42
|
+
it('descarta propiedades extra (nadie cuela un campo "sql")', () => {
|
|
43
|
+
const def = plainToInstance(PopulationSegmentDefinition, { ...valid, sql: 'DROP TABLE x' }, { excludeExtraneousValues: true });
|
|
44
|
+
expect(Object.keys(def)).not.toContain('sql');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import * as kit from '../../../src/rewardsEligibility';
|
|
3
|
+
|
|
4
|
+
const identity = (e: Record<string, string>) => Object.entries(e).every(([k, v]) => k === v);
|
|
5
|
+
|
|
6
|
+
describe('enums de segmentos', () => {
|
|
7
|
+
it('cada enum es identidad clave=valor (se persisten y viajan como string)', () => {
|
|
8
|
+
const enums: Record<string, Record<string, string>> = {
|
|
9
|
+
SegmentStatusEnum: kit.SegmentStatusEnum,
|
|
10
|
+
SegmentTestStatusEnum: kit.SegmentTestStatusEnum,
|
|
11
|
+
SegmentMatchEnum: kit.SegmentMatchEnum,
|
|
12
|
+
SegmentConditionKindEnum: kit.SegmentConditionKindEnum,
|
|
13
|
+
SegmentAggregateFnEnum: kit.SegmentAggregateFnEnum,
|
|
14
|
+
SegmentOperatorEnum: kit.SegmentOperatorEnum,
|
|
15
|
+
SegmentParamTypeEnum: kit.SegmentParamTypeEnum,
|
|
16
|
+
SegmentParamSourceEnum: kit.SegmentParamSourceEnum,
|
|
17
|
+
SegmentErrorCodeEnum: kit.SegmentErrorCodeEnum,
|
|
18
|
+
EligibilityMessageTypeEnum: kit.EligibilityMessageTypeEnum,
|
|
19
|
+
};
|
|
20
|
+
for (const e of Object.values(enums)) {
|
|
21
|
+
expect(e).toBeDefined();
|
|
22
|
+
expect(identity(e)).toBe(true);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
it('valores exactos de la adenda (A§3.1, A§4.1, A§4.4, A§7)', () => {
|
|
26
|
+
expect(Object.values(kit.SegmentStatusEnum)).toEqual(['DRAFT', 'ACTIVE', 'ARCHIVED']);
|
|
27
|
+
expect(Object.values(kit.SegmentTestStatusEnum)).toEqual(['RUNNING', 'PASSED', 'FAILED']);
|
|
28
|
+
expect(Object.values(kit.SegmentParamSourceEnum)).toEqual(['LITERAL', 'REFERENCE_AT', 'REFERENCE_AT_MINUS_DAYS']);
|
|
29
|
+
expect(Object.values(kit.EligibilityMessageTypeEnum)).toEqual(['POPULATION_PAGE', 'EVALUATE_BATCH', 'GRANT_BATCH', 'RELEASE_TRANCHE']);
|
|
30
|
+
expect(Object.values(kit.SegmentOperatorEnum)).toEqual(expect.arrayContaining(['EQUALS', 'NOT_EQUALS', 'IN', 'NOT_IN', 'IS_NULL', 'IS_NOT_NULL', 'GT', 'GTE', 'LT', 'LTE', 'CONTAINS', 'ANY_IN', 'WITHIN_LAST_DAYS', 'NOT_WITHIN_LAST_DAYS']));
|
|
31
|
+
});
|
|
32
|
+
it('GRANT_FAILED no se duplica: sigue siendo de RewardsMessageTypeEnum', () => {
|
|
33
|
+
expect(Object.values(kit.EligibilityMessageTypeEnum)).not.toContain('GRANT_FAILED');
|
|
34
|
+
});
|
|
35
|
+
it('limites', () => {
|
|
36
|
+
expect(kit.SEGMENT_MAX_DAYS).toBe(365);
|
|
37
|
+
expect(kit.SEGMENT_MAX_PARAMS).toBe(40);
|
|
38
|
+
expect(kit.SEGMENT_IDENTIFIER_PATTERN.test('remittance_users')).toBe(true);
|
|
39
|
+
expect(kit.SEGMENT_IDENTIFIER_PATTERN.test('Users')).toBe(false);
|
|
40
|
+
expect(kit.SEGMENT_IDENTIFIER_PATTERN.test('a b')).toBe(false);
|
|
41
|
+
expect(kit.SEGMENT_IDENTIFIER_PATTERN.test('a"b')).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { plainToInstance } from 'class-transformer';
|
|
3
|
+
import { validate } from 'class-validator';
|
|
4
|
+
import {
|
|
5
|
+
CreateRunRequest, EligibilityMessageTypeEnum as T, EvaluateBatchMessage, EvaluationRequest, GrantBatchMessage, INPUT_KEY_PATTERN,
|
|
6
|
+
PopulationPageMessage, PopulationRunRequest, ReleaseTrancheMessage, SegmentExecutionRequest,
|
|
7
|
+
} from '../../../src/rewardsEligibility';
|
|
8
|
+
|
|
9
|
+
const ok = async <C extends object>(cls: new () => C, plain: object) => (await validate(plainToInstance(cls, plain, { excludeExtraneousValues: true }))).length === 0;
|
|
10
|
+
|
|
11
|
+
describe('mensajes de la cola de elegibilidad', () => {
|
|
12
|
+
it('POPULATION_PAGE / GRANT_BATCH / RELEASE_TRANCHE exigen su messageType', async () => {
|
|
13
|
+
expect(await ok(PopulationPageMessage, { messageType: T.POPULATION_PAGE, runId: 'r-1' })).toBe(true);
|
|
14
|
+
expect(await ok(PopulationPageMessage, { messageType: T.EVALUATE_BATCH, runId: 'r-1' })).toBe(false);
|
|
15
|
+
expect(await ok(GrantBatchMessage, { messageType: T.GRANT_BATCH, runId: 'r-1', batchId: 'r-1#p0#b0', part: 0 })).toBe(true);
|
|
16
|
+
expect(await ok(GrantBatchMessage, { messageType: T.GRANT_BATCH, runId: 'r-1', batchId: 'r-1#p0#b0', part: -1 })).toBe(false);
|
|
17
|
+
expect(await ok(ReleaseTrancheMessage, { messageType: T.RELEASE_TRANCHE, seq: 3 })).toBe(true);
|
|
18
|
+
expect(await ok(ReleaseTrancheMessage, { messageType: T.RELEASE_TRANCHE, seq: -1 })).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
it('EVALUATE_BATCH: <= 100 sujetos, sin prefetchedFacts', async () => {
|
|
21
|
+
const subject = { subjectKey: 'd-1', inputs: { directoryId: 'd-1' } };
|
|
22
|
+
const base = { messageType: T.EVALUATE_BATCH, runId: 'r-1', batchId: 'r-1#p0#b0' };
|
|
23
|
+
expect(await ok(EvaluateBatchMessage, { ...base, subjects: [subject] })).toBe(true);
|
|
24
|
+
expect(await ok(EvaluateBatchMessage, { ...base, subjects: [] })).toBe(false);
|
|
25
|
+
expect(await ok(EvaluateBatchMessage, { ...base, subjects: Array.from({ length: 101 }, () => subject) })).toBe(false);
|
|
26
|
+
const parsed = plainToInstance(EvaluateBatchMessage, { ...base, subjects: [{ ...subject, prefetchedFacts: { a: 1 } }] }, { excludeExtraneousValues: true });
|
|
27
|
+
expect('prefetchedFacts' in parsed.subjects[0]).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('cambios a evaluacion y corrida manual', () => {
|
|
31
|
+
it('EvaluationRequest acepta populationSegmentId y populationInputKey opcionales', () => {
|
|
32
|
+
const parsed = plainToInstance(EvaluationRequest, { populationSegmentId: 'promotores', populationInputKey: 'directoryId' }, { excludeExtraneousValues: true });
|
|
33
|
+
expect(parsed.populationSegmentId).toBe('promotores');
|
|
34
|
+
expect(parsed.populationInputKey).toBe('directoryId');
|
|
35
|
+
expect(INPUT_KEY_PATTERN.test('directoryId')).toBe(true);
|
|
36
|
+
expect(INPUT_KEY_PATTERN.test('1abc')).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
it('PopulationRunRequest vacio es valido y descarta params', async () => {
|
|
39
|
+
expect(plainToInstance(PopulationRunRequest, {}, { excludeExtraneousValues: true })).toBeInstanceOf(PopulationRunRequest);
|
|
40
|
+
const p = plainToInstance(PopulationRunRequest, { params: { window: '7d' } }, { excludeExtraneousValues: true });
|
|
41
|
+
expect('params' in p).toBe(false);
|
|
42
|
+
expect(await ok(CreateRunRequest, { requestId: 'req-12345678', mode: 'LIVE', population: {} })).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('SegmentExecutionRequest', () => {
|
|
46
|
+
it('version y referenceAt opcionales y validados', async () => {
|
|
47
|
+
expect(await ok(SegmentExecutionRequest, {})).toBe(true);
|
|
48
|
+
expect(await ok(SegmentExecutionRequest, { version: 2, referenceAt: '2026-10-12T10:00:00Z' })).toBe(true);
|
|
49
|
+
expect(await ok(SegmentExecutionRequest, { version: 0 })).toBe(false);
|
|
50
|
+
expect(await ok(SegmentExecutionRequest, { referenceAt: 'ayer' })).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -14,3 +14,5 @@ export declare const LIST_PAGE_MAX = 100;
|
|
|
14
14
|
export declare const RULES_CHAT_TURN_MAX_LENGTH = 4000;
|
|
15
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
16
|
export declare const RULES_CHAT_MAX_TURNS_HARD = 50;
|
|
17
|
+
/** Llave de un input de una evaluacion (ej. `directoryId`). */
|
|
18
|
+
export declare const INPUT_KEY_PATTERN: RegExp;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RULES_CHAT_MAX_TURNS_HARD = exports.RULES_CHAT_TURN_MAX_LENGTH = exports.LIST_PAGE_MAX = exports.MAX_QUOTAS_PER_CAMPAIGN = exports.REQUEST_ID_PATTERN = exports.DATE_PATTERN = exports.EVENT_KEY_PATTERN = exports.ELIGIBILITY_ID_PATTERN = void 0;
|
|
3
|
+
exports.INPUT_KEY_PATTERN = exports.RULES_CHAT_MAX_TURNS_HARD = exports.RULES_CHAT_TURN_MAX_LENGTH = exports.LIST_PAGE_MAX = exports.MAX_QUOTAS_PER_CAMPAIGN = exports.REQUEST_ID_PATTERN = exports.DATE_PATTERN = exports.EVENT_KEY_PATTERN = exports.ELIGIBILITY_ID_PATTERN = void 0;
|
|
4
4
|
/** 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). */
|
|
5
5
|
exports.ELIGIBILITY_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/;
|
|
6
6
|
/** `eventKey` de un tipo de evento: MAYÚSCULAS con guion bajo (ej. `PHONE_SALES_CODE_REDEEMED`). */
|
|
@@ -17,3 +17,5 @@ exports.LIST_PAGE_MAX = 100;
|
|
|
17
17
|
exports.RULES_CHAT_TURN_MAX_LENGTH = 4000;
|
|
18
18
|
/** Tope de seguridad de turnos que acepta el DTO (el límite funcional, 10, lo aplica el lambda con `AI_CHAT_HISTORY_TOO_LONG`). */
|
|
19
19
|
exports.RULES_CHAT_MAX_TURNS_HARD = 50;
|
|
20
|
+
/** Llave de un input de una evaluacion (ej. `directoryId`). */
|
|
21
|
+
exports.INPUT_KEY_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]{0,63}$/;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Identificador SQL permitido para tabla/columna (A§4.3 paso 1): minusculas, digitos y guion bajo; nunca texto libre. */
|
|
2
|
+
export declare const SEGMENT_IDENTIFIER_PATTERN: RegExp;
|
|
3
|
+
export declare const SEGMENT_MAX_DAYS = 365;
|
|
4
|
+
export declare const SEGMENT_MAX_PARAMS = 40;
|
|
5
|
+
export declare const SEGMENT_MAX_AGGREGATES = 8;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEGMENT_MAX_AGGREGATES = exports.SEGMENT_MAX_PARAMS = exports.SEGMENT_MAX_DAYS = exports.SEGMENT_IDENTIFIER_PATTERN = void 0;
|
|
4
|
+
/** Identificador SQL permitido para tabla/columna (A§4.3 paso 1): minusculas, digitos y guion bajo; nunca texto libre. */
|
|
5
|
+
exports.SEGMENT_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_]*$/;
|
|
6
|
+
exports.SEGMENT_MAX_DAYS = 365;
|
|
7
|
+
exports.SEGMENT_MAX_PARAMS = 40;
|
|
8
|
+
exports.SEGMENT_MAX_AGGREGATES = 8;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ApprovalModeEnum } from '../enums/ApprovalModeEnum';
|
|
2
2
|
import { TriggerTypeEnum } from '../enums/TriggerTypeEnum';
|
|
3
|
-
import { PopulationRef } from './PopulationRef';
|
|
4
3
|
/** Disparador de una evaluacion (spec B 5.1). Una evaluacion tiene a lo sumo UN disparador `EVENT`. */
|
|
5
4
|
export declare class EvaluationTrigger {
|
|
6
5
|
type: TriggerTypeEnum;
|
|
@@ -9,6 +8,4 @@ export declare class EvaluationTrigger {
|
|
|
9
8
|
eventKey?: string;
|
|
10
9
|
/** Solo `CRON`: cron de 5 campos, granularidad de 15 minutos (fase 4). */
|
|
11
10
|
schedule?: string;
|
|
12
|
-
/** Solo `CRON` (fase 4). */
|
|
13
|
-
population?: PopulationRef;
|
|
14
11
|
}
|
|
@@ -38,8 +38,10 @@ __decorate([
|
|
|
38
38
|
], CreateRunRequest.prototype, "inputs", void 0);
|
|
39
39
|
__decorate([
|
|
40
40
|
(0, class_transformer_1.Expose)(),
|
|
41
|
-
(0, class_validator_1.IsOptional)()
|
|
42
|
-
|
|
41
|
+
(0, class_validator_1.IsOptional)()
|
|
42
|
+
// `PopulationRunRequest` no tiene campos: class-validator rechaza validar anidado una clase sin metadatos, por eso `@IsObject()`.
|
|
43
|
+
,
|
|
44
|
+
(0, class_validator_1.IsObject)(),
|
|
43
45
|
(0, class_transformer_1.Type)(() => PopulationRunRequest_1.PopulationRunRequest),
|
|
44
46
|
__metadata("design:type", PopulationRunRequest_1.PopulationRunRequest)
|
|
45
47
|
], CreateRunRequest.prototype, "population", void 0);
|
|
@@ -24,4 +24,8 @@ export declare class EvaluationRequest {
|
|
|
24
24
|
reward: EvaluationReward;
|
|
25
25
|
grantPolicy: GrantPolicy;
|
|
26
26
|
triggers: EvaluationTrigger[];
|
|
27
|
+
/** Segmento de poblacion (version ACTIVE) que usan las corridas masivas de esta evaluacion. */
|
|
28
|
+
populationSegmentId?: string;
|
|
29
|
+
/** Llave del input `DIRECTORY` que recibe el `directoryid` de cada persona del segmento. */
|
|
30
|
+
populationInputKey?: string;
|
|
27
31
|
}
|
|
@@ -84,3 +84,17 @@ __decorate([
|
|
|
84
84
|
(0, class_validator_1.IsObject)({ each: true }),
|
|
85
85
|
__metadata("design:type", Array)
|
|
86
86
|
], EvaluationRequest.prototype, "triggers", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, class_transformer_1.Expose)(),
|
|
89
|
+
(0, class_validator_1.IsOptional)(),
|
|
90
|
+
(0, class_validator_1.IsString)(),
|
|
91
|
+
(0, class_validator_1.Matches)(BackofficeLimits_1.ELIGIBILITY_ID_PATTERN),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], EvaluationRequest.prototype, "populationSegmentId", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, class_transformer_1.Expose)(),
|
|
96
|
+
(0, class_validator_1.IsOptional)(),
|
|
97
|
+
(0, class_validator_1.IsString)(),
|
|
98
|
+
(0, class_validator_1.Matches)(BackofficeLimits_1.INPUT_KEY_PATTERN),
|
|
99
|
+
__metadata("design:type", String)
|
|
100
|
+
], EvaluationRequest.prototype, "populationInputKey", void 0);
|
|
@@ -20,6 +20,8 @@ export declare class EvaluationResponse {
|
|
|
20
20
|
reward: EvaluationReward;
|
|
21
21
|
grantPolicy: GrantPolicy;
|
|
22
22
|
triggers: EvaluationTrigger[];
|
|
23
|
+
populationSegmentId?: string;
|
|
24
|
+
populationInputKey?: string;
|
|
23
25
|
createdAt: number;
|
|
24
26
|
updatedAt: number;
|
|
25
27
|
updatedBy: string;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
/** Corrida por población (fase 4): los `params` de la fuente para esta corrida. El lambda de la fase 3 la rechaza con `POPULATION_RUN_NOT_SUPPORTED`. */
|
|
1
|
+
/** Sin override de params (A§7.3): cambiar la poblacion = version nueva del segmento. `population: {}` = "usa el segmento de la evaluacion". */
|
|
3
2
|
export declare class PopulationRunRequest {
|
|
4
|
-
params: Record<string, DynamicFormValue>;
|
|
5
3
|
}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PopulationRunRequest = void 0;
|
|
13
|
-
|
|
14
|
-
const class_validator_1 = require("class-validator");
|
|
15
|
-
const IsDynamicFormValues_1 = require("../../../dynamicForm/validators/IsDynamicFormValues");
|
|
16
|
-
/** Corrida por población (fase 4): los `params` de la fuente para esta corrida. El lambda de la fase 3 la rechaza con `POPULATION_RUN_NOT_SUPPORTED`. */
|
|
4
|
+
/** Sin override de params (A§7.3): cambiar la poblacion = version nueva del segmento. `population: {}` = "usa el segmento de la evaluacion". */
|
|
17
5
|
class PopulationRunRequest {
|
|
18
6
|
}
|
|
19
7
|
exports.PopulationRunRequest = PopulationRunRequest;
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, class_transformer_1.Expose)(),
|
|
22
|
-
(0, class_validator_1.Validate)(IsDynamicFormValues_1.IsDynamicFormValues),
|
|
23
|
-
__metadata("design:type", Object)
|
|
24
|
-
], PopulationRunRequest.prototype, "params", void 0);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Avance de la corrida masiva: paginas, lotes y sujetos publicados. */
|
|
2
|
+
export declare class RunPopulationProgress {
|
|
3
|
+
pagesPublished: number;
|
|
4
|
+
batchesPublished: number;
|
|
5
|
+
subjectsPublished: number;
|
|
6
|
+
exhausted: boolean;
|
|
7
|
+
stoppedReason?: string;
|
|
8
|
+
lastAdvanceAt: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunPopulationProgress = void 0;
|
|
4
|
+
/** Avance de la corrida masiva: paginas, lotes y sujetos publicados. */
|
|
5
|
+
class RunPopulationProgress {
|
|
6
|
+
}
|
|
7
|
+
exports.RunPopulationProgress = RunPopulationProgress;
|
|
@@ -4,6 +4,7 @@ import { RunStatusEnum } from '../../enums/RunStatusEnum';
|
|
|
4
4
|
import { TriggerTypeEnum } from '../../enums/TriggerTypeEnum';
|
|
5
5
|
import { RunCounts } from '../RunCounts';
|
|
6
6
|
import { QuotaImpactResponse } from './QuotaImpactResponse';
|
|
7
|
+
import { RunPopulationProgress } from './RunPopulationProgress';
|
|
7
8
|
/** Corrida para el backoffice (spec 10). */
|
|
8
9
|
export declare class RunResponse {
|
|
9
10
|
id: string;
|
|
@@ -18,6 +19,24 @@ export declare class RunResponse {
|
|
|
18
19
|
counts: RunCounts;
|
|
19
20
|
/** Solo con `status: AWAITING_APPROVAL`: cuánto consumiría la corrida de cada cupo y cuánto queda. */
|
|
20
21
|
quotaImpact?: QuotaImpactResponse[];
|
|
22
|
+
/** Corrida masiva: instante fijo (epoch ms) contra el que se resuelven las ventanas relativas del segmento. */
|
|
23
|
+
referenceAt?: number;
|
|
24
|
+
/** Corrida masiva: version del segmento congelada. */
|
|
25
|
+
segment?: {
|
|
26
|
+
segmentId: string;
|
|
27
|
+
version: number;
|
|
28
|
+
};
|
|
29
|
+
population?: RunPopulationProgress;
|
|
30
|
+
/** Fallos de entrega (`GRANT_FAILED`) que llegaron tarde, con la corrida ya cerrada. */
|
|
31
|
+
requestFailedLate?: number;
|
|
32
|
+
/** Motivo de una corrida `FAILED` que nunca llego a tener `population`. */
|
|
33
|
+
failureReason?: string;
|
|
34
|
+
/** Avance del drenaje de una aprobacion masiva. */
|
|
35
|
+
approvalDrain?: {
|
|
36
|
+
action: 'GRANT' | 'RELEASE' | 'CANCEL';
|
|
37
|
+
enqueued: number;
|
|
38
|
+
done: boolean;
|
|
39
|
+
};
|
|
21
40
|
requestedBy: string;
|
|
22
41
|
createdAt: number;
|
|
23
42
|
updatedAt: number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SegmentMatchEnum } from '../../../enums/SegmentMatchEnum';
|
|
2
|
+
import { SegmentGroup } from './SegmentGroup';
|
|
3
|
+
/** El constructor tal cual (A§4.1): tabla ancla (una fila -> un directoryid), TODAS/ALGUNA global y grupos con su propio TODAS/ALGUNA. */
|
|
4
|
+
export declare class PopulationSegmentDefinition {
|
|
5
|
+
baseTable: string;
|
|
6
|
+
match: SegmentMatchEnum;
|
|
7
|
+
groups: SegmentGroup[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.PopulationSegmentDefinition = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const SegmentLimits_1 = require("../../../constants/SegmentLimits");
|
|
16
|
+
const SegmentMatchEnum_1 = require("../../../enums/SegmentMatchEnum");
|
|
17
|
+
const SegmentGroup_1 = require("./SegmentGroup");
|
|
18
|
+
/** El constructor tal cual (A§4.1): tabla ancla (una fila -> un directoryid), TODAS/ALGUNA global y grupos con su propio TODAS/ALGUNA. */
|
|
19
|
+
class PopulationSegmentDefinition {
|
|
20
|
+
}
|
|
21
|
+
exports.PopulationSegmentDefinition = PopulationSegmentDefinition;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_transformer_1.Expose)(),
|
|
24
|
+
(0, class_validator_1.Matches)(SegmentLimits_1.SEGMENT_IDENTIFIER_PATTERN),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], PopulationSegmentDefinition.prototype, "baseTable", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_transformer_1.Expose)(),
|
|
29
|
+
(0, class_validator_1.IsEnum)(SegmentMatchEnum_1.SegmentMatchEnum),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], PopulationSegmentDefinition.prototype, "match", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_transformer_1.Expose)(),
|
|
34
|
+
(0, class_validator_1.IsArray)(),
|
|
35
|
+
(0, class_validator_1.ArrayMinSize)(1),
|
|
36
|
+
(0, class_validator_1.ArrayMaxSize)(10),
|
|
37
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
38
|
+
(0, class_transformer_1.Type)(() => SegmentGroup_1.SegmentGroup),
|
|
39
|
+
__metadata("design:type", Array)
|
|
40
|
+
], PopulationSegmentDefinition.prototype, "groups", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PopulationSegmentDefinition } from './PopulationSegmentDefinition';
|
|
2
|
+
import { SegmentParam } from './SegmentParam';
|
|
3
|
+
/** Version de un segmento tal como la consumen otros servicios (con el SQL compilado). */
|
|
4
|
+
export declare class PrivateSegmentResponse {
|
|
5
|
+
segmentId: string;
|
|
6
|
+
version: number;
|
|
7
|
+
name: string;
|
|
8
|
+
definition: PopulationSegmentDefinition;
|
|
9
|
+
sql: string;
|
|
10
|
+
params: SegmentParam[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrivateSegmentResponse = void 0;
|
|
4
|
+
/** Version de un segmento tal como la consumen otros servicios (con el SQL compilado). */
|
|
5
|
+
class PrivateSegmentResponse {
|
|
6
|
+
}
|
|
7
|
+
exports.PrivateSegmentResponse = PrivateSegmentResponse;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SegmentAggregateFnEnum } from '../../../enums/SegmentAggregateFnEnum';
|
|
2
|
+
import { SegmentConditionKindEnum } from '../../../enums/SegmentConditionKindEnum';
|
|
3
|
+
import { SegmentOperatorEnum } from '../../../enums/SegmentOperatorEnum';
|
|
4
|
+
import { SegmentColumnCondition } from './SegmentColumnCondition';
|
|
5
|
+
import { SegmentWindow } from './SegmentWindow';
|
|
6
|
+
/** (b) Agregado con ventana relativa sobre una tabla relacionada (existe / cuenta / suma). `filters` elige QUE cuenta (estados, moneda...). */
|
|
7
|
+
export declare class SegmentAggregateCondition {
|
|
8
|
+
kind: SegmentConditionKindEnum.AGGREGATE;
|
|
9
|
+
table: string;
|
|
10
|
+
fn: SegmentAggregateFnEnum;
|
|
11
|
+
/** Solo SUM. */
|
|
12
|
+
column?: string;
|
|
13
|
+
/** COUNT y SUM; EXISTS no lleva. */
|
|
14
|
+
op?: SegmentOperatorEnum;
|
|
15
|
+
value?: number;
|
|
16
|
+
window: SegmentWindow;
|
|
17
|
+
filters: SegmentColumnCondition[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.SegmentAggregateCondition = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const SegmentLimits_1 = require("../../../constants/SegmentLimits");
|
|
16
|
+
const SegmentAggregateFnEnum_1 = require("../../../enums/SegmentAggregateFnEnum");
|
|
17
|
+
const SegmentConditionKindEnum_1 = require("../../../enums/SegmentConditionKindEnum");
|
|
18
|
+
const SegmentOperatorEnum_1 = require("../../../enums/SegmentOperatorEnum");
|
|
19
|
+
const SegmentColumnCondition_1 = require("./SegmentColumnCondition");
|
|
20
|
+
const SegmentWindow_1 = require("./SegmentWindow");
|
|
21
|
+
/** (b) Agregado con ventana relativa sobre una tabla relacionada (existe / cuenta / suma). `filters` elige QUE cuenta (estados, moneda...). */
|
|
22
|
+
class SegmentAggregateCondition {
|
|
23
|
+
}
|
|
24
|
+
exports.SegmentAggregateCondition = SegmentAggregateCondition;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_transformer_1.Expose)(),
|
|
27
|
+
(0, class_validator_1.Equals)(SegmentConditionKindEnum_1.SegmentConditionKindEnum.AGGREGATE),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], SegmentAggregateCondition.prototype, "kind", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_transformer_1.Expose)(),
|
|
32
|
+
(0, class_validator_1.Matches)(SegmentLimits_1.SEGMENT_IDENTIFIER_PATTERN),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], SegmentAggregateCondition.prototype, "table", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_transformer_1.Expose)(),
|
|
37
|
+
(0, class_validator_1.IsEnum)(SegmentAggregateFnEnum_1.SegmentAggregateFnEnum),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], SegmentAggregateCondition.prototype, "fn", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_transformer_1.Expose)(),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
(0, class_validator_1.Matches)(SegmentLimits_1.SEGMENT_IDENTIFIER_PATTERN),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], SegmentAggregateCondition.prototype, "column", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_transformer_1.Expose)(),
|
|
48
|
+
(0, class_validator_1.IsOptional)(),
|
|
49
|
+
(0, class_validator_1.IsEnum)(SegmentOperatorEnum_1.SegmentOperatorEnum),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], SegmentAggregateCondition.prototype, "op", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_transformer_1.Expose)(),
|
|
54
|
+
(0, class_validator_1.IsOptional)(),
|
|
55
|
+
(0, class_validator_1.IsNumber)(),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], SegmentAggregateCondition.prototype, "value", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, class_transformer_1.Expose)(),
|
|
60
|
+
(0, class_validator_1.ValidateNested)(),
|
|
61
|
+
(0, class_transformer_1.Type)(() => SegmentWindow_1.SegmentWindow),
|
|
62
|
+
__metadata("design:type", SegmentWindow_1.SegmentWindow)
|
|
63
|
+
], SegmentAggregateCondition.prototype, "window", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, class_transformer_1.Expose)(),
|
|
66
|
+
(0, class_validator_1.IsArray)(),
|
|
67
|
+
(0, class_validator_1.ArrayMaxSize)(10),
|
|
68
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
69
|
+
(0, class_transformer_1.Type)(() => SegmentColumnCondition_1.SegmentColumnCondition),
|
|
70
|
+
__metadata("design:type", Array)
|
|
71
|
+
], SegmentAggregateCondition.prototype, "filters", void 0);
|