@fiado/type-kit 3.509.0 → 3.510.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/dynamicForm/dynamicForm.test.ts +78 -0
- package/_test_/unit/rewards/enums.test.ts +87 -0
- package/_test_/unit/rewards/grantMessages.test.ts +123 -0
- package/_test_/unit/rewards/readResponses.test.ts +136 -0
- package/_test_/unit/rewardsEligibility/events.test.ts +130 -0
- package/bin/benefitCenter/dtos/InputField.d.ts +1 -13
- package/bin/benefitCenter/dtos/InputField.js +3 -3
- package/bin/benefitCenter/dtos/InputSchema.d.ts +1 -6
- package/bin/benefitCenter/dtos/InputSchema.js +3 -3
- package/bin/benefitCenter/dtos/InputValidation.d.ts +1 -8
- package/bin/benefitCenter/dtos/InputValidation.js +3 -3
- package/bin/benefitCenter/dtos/SelectOption.d.ts +1 -4
- package/bin/benefitCenter/dtos/SelectOption.js +3 -3
- package/bin/benefitCenter/enums/InputFieldTypeEnum.d.ts +1 -10
- package/bin/benefitCenter/enums/InputFieldTypeEnum.js +3 -11
- package/bin/common/index.d.ts +1 -0
- package/bin/common/index.js +2 -0
- package/bin/common/types/JsonValue.d.ts +7 -0
- package/bin/common/types/JsonValue.js +2 -0
- package/bin/dynamicForm/dtos/InputField.d.ts +15 -0
- package/bin/dynamicForm/dtos/InputField.js +6 -0
- package/bin/dynamicForm/dtos/InputSchema.d.ts +6 -0
- package/bin/dynamicForm/dtos/InputSchema.js +6 -0
- package/bin/dynamicForm/dtos/InputValidation.d.ts +8 -0
- package/bin/dynamicForm/dtos/InputValidation.js +6 -0
- package/bin/dynamicForm/dtos/SelectOption.d.ts +4 -0
- package/bin/dynamicForm/dtos/SelectOption.js +6 -0
- package/bin/dynamicForm/enums/InputFieldTypeEnum.d.ts +18 -0
- package/bin/dynamicForm/enums/InputFieldTypeEnum.js +22 -0
- package/bin/dynamicForm/helpers/isDynamicFormValue.d.ts +7 -0
- package/bin/dynamicForm/helpers/isDynamicFormValue.js +19 -0
- package/bin/dynamicForm/index.d.ts +8 -0
- package/bin/dynamicForm/index.js +29 -0
- package/bin/dynamicForm/types/DynamicFormValue.d.ts +10 -0
- package/bin/dynamicForm/types/DynamicFormValue.js +2 -0
- package/bin/dynamicForm/validators/IsDynamicFormValues.d.ts +7 -0
- package/bin/dynamicForm/validators/IsDynamicFormValues.js +26 -0
- package/bin/index.d.ts +3 -0
- package/bin/index.js +12 -1
- package/bin/rewards/constants/RewardsLimits.d.ts +2 -0
- package/bin/rewards/constants/RewardsLimits.js +5 -0
- package/bin/rewards/dtos/GrantFailedMessage.d.ts +13 -0
- package/bin/rewards/dtos/GrantFailedMessage.js +46 -0
- package/bin/rewards/dtos/GrantRequestedMessage.d.ts +21 -0
- package/bin/rewards/dtos/GrantRequestedMessage.js +61 -0
- package/bin/rewards/dtos/RewardChargeTo.d.ts +5 -0
- package/bin/rewards/dtos/RewardChargeTo.js +7 -0
- package/bin/rewards/dtos/RewardCost.d.ts +6 -0
- package/bin/rewards/dtos/RewardCost.js +7 -0
- package/bin/rewards/dtos/RewardDependency.d.ts +17 -0
- package/bin/rewards/dtos/RewardDependency.js +12 -0
- package/bin/rewards/dtos/RewardSource.d.ts +12 -0
- package/bin/rewards/dtos/RewardSource.js +40 -0
- package/bin/rewards/dtos/responses/GrantAttemptResponse.d.ts +15 -0
- package/bin/rewards/dtos/responses/GrantAttemptResponse.js +10 -0
- package/bin/rewards/dtos/responses/GrantItemResponse.d.ts +20 -0
- package/bin/rewards/dtos/responses/GrantItemResponse.js +6 -0
- package/bin/rewards/dtos/responses/GrantResponse.d.ts +23 -0
- package/bin/rewards/dtos/responses/GrantResponse.js +7 -0
- package/bin/rewards/dtos/responses/PackageContractItem.d.ts +12 -0
- package/bin/rewards/dtos/responses/PackageContractItem.js +7 -0
- package/bin/rewards/dtos/responses/PackageContractResponse.d.ts +13 -0
- package/bin/rewards/dtos/responses/PackageContractResponse.js +7 -0
- package/bin/rewards/enums/DependencyIfMissingEnum.d.ts +5 -0
- package/bin/rewards/enums/DependencyIfMissingEnum.js +9 -0
- package/bin/rewards/enums/GrantFailedReasonEnum.d.ts +11 -0
- package/bin/rewards/enums/GrantFailedReasonEnum.js +15 -0
- package/bin/rewards/enums/GrantItemStatusEnum.d.ts +6 -0
- package/bin/rewards/enums/GrantItemStatusEnum.js +10 -0
- package/bin/rewards/enums/GrantRejectReasonEnum.d.ts +6 -0
- package/bin/rewards/enums/GrantRejectReasonEnum.js +10 -0
- package/bin/rewards/enums/GrantStatusEnum.d.ts +8 -0
- package/bin/rewards/enums/GrantStatusEnum.js +12 -0
- package/bin/rewards/enums/ItemErrorCategoryEnum.d.ts +7 -0
- package/bin/rewards/enums/ItemErrorCategoryEnum.js +11 -0
- package/bin/rewards/enums/RewardStatusEnum.d.ts +4 -0
- package/bin/rewards/enums/RewardStatusEnum.js +8 -0
- package/bin/rewards/enums/RewardsErrorCodeEnum.d.ts +5 -0
- package/bin/rewards/enums/RewardsErrorCodeEnum.js +9 -0
- package/bin/rewards/enums/RewardsMessageTypeEnum.d.ts +4 -0
- package/bin/rewards/enums/RewardsMessageTypeEnum.js +8 -0
- package/bin/rewards/index.d.ts +24 -0
- package/bin/rewards/index.js +47 -0
- package/bin/rewards/types/RewardInputs.d.ts +3 -0
- package/bin/rewards/types/RewardInputs.js +2 -0
- package/bin/rewards/validators/IsRewardInputs.d.ts +7 -0
- package/bin/rewards/validators/IsRewardInputs.js +26 -0
- package/bin/rewards/validators/IsRewardTags.d.ts +7 -0
- package/bin/rewards/validators/IsRewardTags.js +28 -0
- package/bin/rewardsEligibility/dtos/EventRunResult.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/EventRunResult.js +7 -0
- package/bin/rewardsEligibility/dtos/EventSource.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/EventSource.js +30 -0
- package/bin/rewardsEligibility/dtos/GetRunResponse.d.ts +22 -0
- package/bin/rewardsEligibility/dtos/GetRunResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/PostEventRequest.d.ts +14 -0
- package/bin/rewardsEligibility/dtos/PostEventRequest.js +47 -0
- package/bin/rewardsEligibility/dtos/PostEventResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/PostEventResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/RunCounts.d.ts +12 -0
- package/bin/rewardsEligibility/dtos/RunCounts.js +7 -0
- package/bin/rewardsEligibility/dtos/RunResultItem.d.ts +16 -0
- package/bin/rewardsEligibility/dtos/RunResultItem.js +7 -0
- package/bin/rewardsEligibility/enums/EvaluationOutcomeEnum.d.ts +11 -0
- package/bin/rewardsEligibility/enums/EvaluationOutcomeEnum.js +15 -0
- package/bin/rewardsEligibility/enums/GrantRequestStatusEnum.d.ts +11 -0
- package/bin/rewardsEligibility/enums/GrantRequestStatusEnum.js +15 -0
- package/bin/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.d.ts +8 -0
- package/bin/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.js +12 -0
- package/bin/rewardsEligibility/enums/RunModeEnum.d.ts +4 -0
- package/bin/rewardsEligibility/enums/RunModeEnum.js +8 -0
- package/bin/rewardsEligibility/enums/RunStatusEnum.d.ts +9 -0
- package/bin/rewardsEligibility/enums/RunStatusEnum.js +13 -0
- package/bin/rewardsEligibility/enums/TriggerTypeEnum.d.ts +5 -0
- package/bin/rewardsEligibility/enums/TriggerTypeEnum.js +9 -0
- package/bin/rewardsEligibility/index.d.ts +13 -0
- package/bin/rewardsEligibility/index.js +31 -0
- package/package.json +1 -1
- package/src/benefitCenter/dtos/InputField.ts +2 -14
- package/src/benefitCenter/dtos/InputSchema.ts +2 -7
- package/src/benefitCenter/dtos/InputValidation.ts +2 -8
- package/src/benefitCenter/dtos/SelectOption.ts +2 -4
- package/src/benefitCenter/enums/InputFieldTypeEnum.ts +2 -10
- package/src/common/index.ts +4 -1
- package/src/common/types/JsonValue.ts +5 -0
- package/src/dynamicForm/dtos/InputField.ts +16 -0
- package/src/dynamicForm/dtos/InputSchema.ts +7 -0
- package/src/dynamicForm/dtos/InputValidation.ts +8 -0
- package/src/dynamicForm/dtos/SelectOption.ts +4 -0
- package/src/dynamicForm/enums/InputFieldTypeEnum.ts +18 -0
- package/src/dynamicForm/helpers/isDynamicFormValue.ts +16 -0
- package/src/dynamicForm/index.ts +17 -0
- package/src/dynamicForm/types/DynamicFormValue.ts +8 -0
- package/src/dynamicForm/validators/IsDynamicFormValues.ts +16 -0
- package/src/index.ts +14 -0
- package/src/rewards/constants/RewardsLimits.ts +2 -0
- package/src/rewards/dtos/GrantFailedMessage.ts +29 -0
- package/src/rewards/dtos/GrantRequestedMessage.ts +46 -0
- package/src/rewards/dtos/RewardChargeTo.ts +5 -0
- package/src/rewards/dtos/RewardCost.ts +7 -0
- package/src/rewards/dtos/RewardDependency.ts +18 -0
- package/src/rewards/dtos/RewardSource.ts +27 -0
- package/src/rewards/dtos/responses/GrantAttemptResponse.ts +16 -0
- package/src/rewards/dtos/responses/GrantItemResponse.ts +21 -0
- package/src/rewards/dtos/responses/GrantResponse.ts +24 -0
- package/src/rewards/dtos/responses/PackageContractItem.ts +13 -0
- package/src/rewards/dtos/responses/PackageContractResponse.ts +14 -0
- package/src/rewards/enums/DependencyIfMissingEnum.ts +5 -0
- package/src/rewards/enums/GrantFailedReasonEnum.ts +11 -0
- package/src/rewards/enums/GrantItemStatusEnum.ts +6 -0
- package/src/rewards/enums/GrantRejectReasonEnum.ts +6 -0
- package/src/rewards/enums/GrantStatusEnum.ts +8 -0
- package/src/rewards/enums/ItemErrorCategoryEnum.ts +7 -0
- package/src/rewards/enums/RewardStatusEnum.ts +4 -0
- package/src/rewards/enums/RewardsErrorCodeEnum.ts +5 -0
- package/src/rewards/enums/RewardsMessageTypeEnum.ts +4 -0
- package/src/rewards/index.ts +37 -0
- package/src/rewards/types/RewardInputs.ts +4 -0
- package/src/rewards/validators/IsRewardInputs.ts +18 -0
- package/src/rewards/validators/IsRewardTags.ts +18 -0
- package/src/rewardsEligibility/dtos/EventRunResult.ts +12 -0
- package/src/rewardsEligibility/dtos/EventSource.ts +15 -0
- package/src/rewardsEligibility/dtos/GetRunResponse.ts +23 -0
- package/src/rewardsEligibility/dtos/PostEventRequest.ts +32 -0
- package/src/rewardsEligibility/dtos/PostEventResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/RunCounts.ts +12 -0
- package/src/rewardsEligibility/dtos/RunResultItem.ts +17 -0
- package/src/rewardsEligibility/enums/EvaluationOutcomeEnum.ts +11 -0
- package/src/rewardsEligibility/enums/GrantRequestStatusEnum.ts +11 -0
- package/src/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.ts +8 -0
- package/src/rewardsEligibility/enums/RunModeEnum.ts +4 -0
- package/src/rewardsEligibility/enums/RunStatusEnum.ts +9 -0
- package/src/rewardsEligibility/enums/TriggerTypeEnum.ts +5 -0
- package/src/rewardsEligibility/index.ts +16 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Conteos de una corrida (mismos nombres que las métricas, spec B 5.7). */
|
|
2
|
+
export declare class RunCounts {
|
|
3
|
+
evaluated: number;
|
|
4
|
+
match: number;
|
|
5
|
+
noMatch: number;
|
|
6
|
+
error: number;
|
|
7
|
+
alreadyGranted: number;
|
|
8
|
+
quotaExhausted: number;
|
|
9
|
+
excluded: number;
|
|
10
|
+
requested: number;
|
|
11
|
+
requestFailed: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EvaluationOutcomeEnum } from '../enums/EvaluationOutcomeEnum';
|
|
2
|
+
import { GrantRequestStatusEnum } from '../enums/GrantRequestStatusEnum';
|
|
3
|
+
/** Un resultado por sujeto, SIN traza (la traza es del backoffice). Asumido hasta cerrar P-7. */
|
|
4
|
+
export declare class RunResultItem {
|
|
5
|
+
subjectKey: string;
|
|
6
|
+
beneficiaryDirectoryId: string;
|
|
7
|
+
campaignId: string;
|
|
8
|
+
evaluationId: string;
|
|
9
|
+
packageId: string;
|
|
10
|
+
outcome: EvaluationOutcomeEnum;
|
|
11
|
+
grantStatus: GrantRequestStatusEnum;
|
|
12
|
+
/** `grantIdFor("rewards-eligibility", idempotencyKey)`; cruza con `GET /grants/{id}` de rewards. */
|
|
13
|
+
grantId?: string;
|
|
14
|
+
/** Solo si `outcome` es ERROR. */
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunResultItem = void 0;
|
|
4
|
+
/** Un resultado por sujeto, SIN traza (la traza es del backoffice). Asumido hasta cerrar P-7. */
|
|
5
|
+
class RunResultItem {
|
|
6
|
+
}
|
|
7
|
+
exports.RunResultItem = RunResultItem;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum EvaluationOutcomeEnum {
|
|
2
|
+
MATCH = "MATCH",
|
|
3
|
+
NO_MATCH = "NO_MATCH",
|
|
4
|
+
ERROR = "ERROR",
|
|
5
|
+
/** La política de frecuencia lo bloqueó. */
|
|
6
|
+
ALREADY_GRANTED = "ALREADY_GRANTED",
|
|
7
|
+
/** Calificó, pero la campaña no tenía cupo. */
|
|
8
|
+
QUOTA_EXHAUSTED = "QUOTA_EXHAUSTED",
|
|
9
|
+
/** El operador lo sacó al aprobar. */
|
|
10
|
+
EXCLUDED = "EXCLUDED"
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EvaluationOutcomeEnum = void 0;
|
|
4
|
+
var EvaluationOutcomeEnum;
|
|
5
|
+
(function (EvaluationOutcomeEnum) {
|
|
6
|
+
EvaluationOutcomeEnum["MATCH"] = "MATCH";
|
|
7
|
+
EvaluationOutcomeEnum["NO_MATCH"] = "NO_MATCH";
|
|
8
|
+
EvaluationOutcomeEnum["ERROR"] = "ERROR";
|
|
9
|
+
/** La política de frecuencia lo bloqueó. */
|
|
10
|
+
EvaluationOutcomeEnum["ALREADY_GRANTED"] = "ALREADY_GRANTED";
|
|
11
|
+
/** Calificó, pero la campaña no tenía cupo. */
|
|
12
|
+
EvaluationOutcomeEnum["QUOTA_EXHAUSTED"] = "QUOTA_EXHAUSTED";
|
|
13
|
+
/** El operador lo sacó al aprobar. */
|
|
14
|
+
EvaluationOutcomeEnum["EXCLUDED"] = "EXCLUDED";
|
|
15
|
+
})(EvaluationOutcomeEnum || (exports.EvaluationOutcomeEnum = EvaluationOutcomeEnum = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum GrantRequestStatusEnum {
|
|
2
|
+
NOT_APPLICABLE = "NOT_APPLICABLE",
|
|
3
|
+
PENDING_APPROVAL = "PENDING_APPROVAL",
|
|
4
|
+
/** Reservado, esperando su tramo de publicación. */
|
|
5
|
+
QUEUED = "QUEUED",
|
|
6
|
+
/** Publicado en RewardsGrantQueue al instante (en línea). */
|
|
7
|
+
REQUESTED = "REQUESTED",
|
|
8
|
+
/** La publicación falló o llegó GRANT_FAILED. */
|
|
9
|
+
REQUEST_FAILED = "REQUEST_FAILED",
|
|
10
|
+
CANCELLED = "CANCELLED"
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GrantRequestStatusEnum = void 0;
|
|
4
|
+
var GrantRequestStatusEnum;
|
|
5
|
+
(function (GrantRequestStatusEnum) {
|
|
6
|
+
GrantRequestStatusEnum["NOT_APPLICABLE"] = "NOT_APPLICABLE";
|
|
7
|
+
GrantRequestStatusEnum["PENDING_APPROVAL"] = "PENDING_APPROVAL";
|
|
8
|
+
/** Reservado, esperando su tramo de publicación. */
|
|
9
|
+
GrantRequestStatusEnum["QUEUED"] = "QUEUED";
|
|
10
|
+
/** Publicado en RewardsGrantQueue al instante (en línea). */
|
|
11
|
+
GrantRequestStatusEnum["REQUESTED"] = "REQUESTED";
|
|
12
|
+
/** La publicación falló o llegó GRANT_FAILED. */
|
|
13
|
+
GrantRequestStatusEnum["REQUEST_FAILED"] = "REQUEST_FAILED";
|
|
14
|
+
GrantRequestStatusEnum["CANCELLED"] = "CANCELLED";
|
|
15
|
+
})(GrantRequestStatusEnum || (exports.GrantRequestStatusEnum = GrantRequestStatusEnum = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum RewardsEligibilityErrorCodeEnum {
|
|
2
|
+
/** 400: faltan campos obligatorios del evento o tienen tipo inválido. */
|
|
3
|
+
INPUT_INVALID = "INPUT_INVALID",
|
|
4
|
+
/** 404: el eventKey no existe o está inactivo. */
|
|
5
|
+
EVENT_TYPE_NOT_FOUND = "EVENT_TYPE_NOT_FOUND",
|
|
6
|
+
/** 404: GET /runs/{id} sin corrida. */
|
|
7
|
+
RUN_NOT_FOUND = "RUN_NOT_FOUND"
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RewardsEligibilityErrorCodeEnum = void 0;
|
|
4
|
+
var RewardsEligibilityErrorCodeEnum;
|
|
5
|
+
(function (RewardsEligibilityErrorCodeEnum) {
|
|
6
|
+
/** 400: faltan campos obligatorios del evento o tienen tipo inválido. */
|
|
7
|
+
RewardsEligibilityErrorCodeEnum["INPUT_INVALID"] = "INPUT_INVALID";
|
|
8
|
+
/** 404: el eventKey no existe o está inactivo. */
|
|
9
|
+
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_NOT_FOUND"] = "EVENT_TYPE_NOT_FOUND";
|
|
10
|
+
/** 404: GET /runs/{id} sin corrida. */
|
|
11
|
+
RewardsEligibilityErrorCodeEnum["RUN_NOT_FOUND"] = "RUN_NOT_FOUND";
|
|
12
|
+
})(RewardsEligibilityErrorCodeEnum || (exports.RewardsEligibilityErrorCodeEnum = RewardsEligibilityErrorCodeEnum = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunModeEnum = void 0;
|
|
4
|
+
var RunModeEnum;
|
|
5
|
+
(function (RunModeEnum) {
|
|
6
|
+
RunModeEnum["LIVE"] = "LIVE";
|
|
7
|
+
RunModeEnum["SIMULATION"] = "SIMULATION";
|
|
8
|
+
})(RunModeEnum || (exports.RunModeEnum = RunModeEnum = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunStatusEnum = void 0;
|
|
4
|
+
var RunStatusEnum;
|
|
5
|
+
(function (RunStatusEnum) {
|
|
6
|
+
RunStatusEnum["RUNNING"] = "RUNNING";
|
|
7
|
+
RunStatusEnum["AWAITING_APPROVAL"] = "AWAITING_APPROVAL";
|
|
8
|
+
RunStatusEnum["PUBLISHING"] = "PUBLISHING";
|
|
9
|
+
RunStatusEnum["COMPLETED"] = "COMPLETED";
|
|
10
|
+
RunStatusEnum["PARTIAL"] = "PARTIAL";
|
|
11
|
+
RunStatusEnum["FAILED"] = "FAILED";
|
|
12
|
+
RunStatusEnum["REJECTED"] = "REJECTED";
|
|
13
|
+
})(RunStatusEnum || (exports.RunStatusEnum = RunStatusEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TriggerTypeEnum = void 0;
|
|
4
|
+
var TriggerTypeEnum;
|
|
5
|
+
(function (TriggerTypeEnum) {
|
|
6
|
+
TriggerTypeEnum["EVENT"] = "EVENT";
|
|
7
|
+
TriggerTypeEnum["MANUAL"] = "MANUAL";
|
|
8
|
+
TriggerTypeEnum["CRON"] = "CRON";
|
|
9
|
+
})(TriggerTypeEnum || (exports.TriggerTypeEnum = TriggerTypeEnum = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './enums/EvaluationOutcomeEnum';
|
|
2
|
+
export * from './enums/GrantRequestStatusEnum';
|
|
3
|
+
export * from './enums/RunStatusEnum';
|
|
4
|
+
export * from './enums/RunModeEnum';
|
|
5
|
+
export * from './enums/TriggerTypeEnum';
|
|
6
|
+
export * from './enums/RewardsEligibilityErrorCodeEnum';
|
|
7
|
+
export * from './dtos/EventSource';
|
|
8
|
+
export * from './dtos/PostEventRequest';
|
|
9
|
+
export * from './dtos/EventRunResult';
|
|
10
|
+
export * from './dtos/PostEventResponse';
|
|
11
|
+
export * from './dtos/RunCounts';
|
|
12
|
+
export * from './dtos/RunResultItem';
|
|
13
|
+
export * from './dtos/GetRunResponse';
|
|
@@ -0,0 +1,31 @@
|
|
|
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/EvaluationOutcomeEnum"), exports);
|
|
19
|
+
__exportStar(require("./enums/GrantRequestStatusEnum"), exports);
|
|
20
|
+
__exportStar(require("./enums/RunStatusEnum"), exports);
|
|
21
|
+
__exportStar(require("./enums/RunModeEnum"), exports);
|
|
22
|
+
__exportStar(require("./enums/TriggerTypeEnum"), exports);
|
|
23
|
+
__exportStar(require("./enums/RewardsEligibilityErrorCodeEnum"), exports);
|
|
24
|
+
//DTOs
|
|
25
|
+
__exportStar(require("./dtos/EventSource"), exports);
|
|
26
|
+
__exportStar(require("./dtos/PostEventRequest"), exports);
|
|
27
|
+
__exportStar(require("./dtos/EventRunResult"), exports);
|
|
28
|
+
__exportStar(require("./dtos/PostEventResponse"), exports);
|
|
29
|
+
__exportStar(require("./dtos/RunCounts"), exports);
|
|
30
|
+
__exportStar(require("./dtos/RunResultItem"), exports);
|
|
31
|
+
__exportStar(require("./dtos/GetRunResponse"), exports);
|
package/package.json
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class InputField {
|
|
5
|
-
key: string;
|
|
6
|
-
type: InputFieldTypeEnum;
|
|
7
|
-
label: string;
|
|
8
|
-
required: boolean;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
helpImage?: string;
|
|
11
|
-
showHelp?: boolean;
|
|
12
|
-
options?: SelectOption[];
|
|
13
|
-
dependsOn?: string;
|
|
14
|
-
}
|
|
1
|
+
// Alias (D-E5): el origen vive en `dynamicForm`. No duplicar.
|
|
2
|
+
export { InputField } from '../../dynamicForm/dtos/InputField';
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class InputSchema {
|
|
5
|
-
fields: InputField[];
|
|
6
|
-
validations?: Record<string, InputValidation>;
|
|
7
|
-
}
|
|
1
|
+
// Alias (D-E5): el origen vive en `dynamicForm`. No duplicar.
|
|
2
|
+
export { InputSchema } from '../../dynamicForm/dtos/InputSchema';
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
maxLength?: number;
|
|
4
|
-
minLength?: number;
|
|
5
|
-
min?: number;
|
|
6
|
-
max?: number;
|
|
7
|
-
hasCheckDigit?: boolean;
|
|
8
|
-
}
|
|
1
|
+
// Alias (D-E5): el origen vive en `dynamicForm`. No duplicar.
|
|
2
|
+
export { InputValidation } from '../../dynamicForm/dtos/InputValidation';
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
BARCODE = "BARCODE",
|
|
4
|
-
ACCOUNT_NUMBER = "ACCOUNT_NUMBER",
|
|
5
|
-
TEXT = "TEXT",
|
|
6
|
-
NUMBER = "NUMBER",
|
|
7
|
-
MONEY = "MONEY",
|
|
8
|
-
SELECT = "SELECT",
|
|
9
|
-
DATE = "DATE",
|
|
10
|
-
}
|
|
1
|
+
// Alias (D-E5): el origen vive en el dominio compartido `dynamicForm`. No duplicar.
|
|
2
|
+
export { InputFieldTypeEnum } from '../../dynamicForm/enums/InputFieldTypeEnum';
|
package/src/common/index.ts
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Valor JSON arbitrario, sin `any` ni `unknown`. Tipo de entrada para los validadores de
|
|
3
|
+
* class-validator que reciben datos no confiables (mensajes de cola, cuerpos HTTP).
|
|
4
|
+
*/
|
|
5
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InputFieldTypeEnum } from "../enums/InputFieldTypeEnum";
|
|
2
|
+
import { SelectOption } from "./SelectOption";
|
|
3
|
+
|
|
4
|
+
export class InputField {
|
|
5
|
+
key: string;
|
|
6
|
+
type: InputFieldTypeEnum;
|
|
7
|
+
label: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
helpImage?: string;
|
|
11
|
+
showHelp?: boolean;
|
|
12
|
+
options?: SelectOption[];
|
|
13
|
+
dependsOn?: string;
|
|
14
|
+
/** Endpoint del que salen las opciones (SELECT ampliado y ENTITY_REF). */
|
|
15
|
+
optionsSource?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export enum InputFieldTypeEnum {
|
|
2
|
+
PHONE = "PHONE",
|
|
3
|
+
BARCODE = "BARCODE",
|
|
4
|
+
ACCOUNT_NUMBER = "ACCOUNT_NUMBER",
|
|
5
|
+
TEXT = "TEXT",
|
|
6
|
+
NUMBER = "NUMBER",
|
|
7
|
+
MONEY = "MONEY",
|
|
8
|
+
SELECT = "SELECT",
|
|
9
|
+
DATE = "DATE",
|
|
10
|
+
/** Buscador de usuario (nombre, teléfono, correo). Valor: `directoryId`. */
|
|
11
|
+
DIRECTORY = "DIRECTORY",
|
|
12
|
+
/** Buscador contra `optionsSource` (ej. ventas). Valor: id de la entidad. */
|
|
13
|
+
ENTITY_REF = "ENTITY_REF",
|
|
14
|
+
/** Rango de fechas. Valor: `{from, to}`; cada extremo es fecha ISO o ventana relativa (`7d`, `1M`; spec B §9). */
|
|
15
|
+
DATE_RANGE = "DATE_RANGE",
|
|
16
|
+
/** Interruptor. Valor: `true`/`false`. */
|
|
17
|
+
BOOLEAN = "BOOLEAN",
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JsonValue } from '../../common/types/JsonValue';
|
|
2
|
+
import { DateRangeValue, DynamicFormValue } from '../types/DynamicFormValue';
|
|
3
|
+
|
|
4
|
+
export const isPlainObject = (value: JsonValue): value is { [key: string]: JsonValue } =>
|
|
5
|
+
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6
|
+
|
|
7
|
+
export const isDateRangeValue = (value: JsonValue): value is DateRangeValue => {
|
|
8
|
+
if (!isPlainObject(value)) return false;
|
|
9
|
+
return Object.keys(value).length === 2 && typeof value.from === 'string' && typeof value.to === 'string';
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const isDynamicFormValue = (value: JsonValue): value is DynamicFormValue => {
|
|
13
|
+
if (typeof value === 'string' || typeof value === 'boolean') return true;
|
|
14
|
+
if (typeof value === 'number') return Number.isFinite(value);
|
|
15
|
+
return isDateRangeValue(value);
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//Enums
|
|
2
|
+
export * from './enums/InputFieldTypeEnum';
|
|
3
|
+
|
|
4
|
+
//DTOs
|
|
5
|
+
export * from './dtos/SelectOption';
|
|
6
|
+
export * from './dtos/InputValidation';
|
|
7
|
+
export * from './dtos/InputField';
|
|
8
|
+
export * from './dtos/InputSchema';
|
|
9
|
+
|
|
10
|
+
//Types
|
|
11
|
+
export * from './types/DynamicFormValue';
|
|
12
|
+
|
|
13
|
+
//Helpers
|
|
14
|
+
export * from './helpers/isDynamicFormValue';
|
|
15
|
+
|
|
16
|
+
//Validators
|
|
17
|
+
export * from './validators/IsDynamicFormValues';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Valor de un campo `DATE_RANGE`: `{from, to}`. `from`/`to` son fechas ISO o una ventana relativa
|
|
3
|
+
* (`7d`, `1M`; spec B §9) que el consumidor resuelve contra «ahora».
|
|
4
|
+
*/
|
|
5
|
+
export type DateRangeValue = { from: string; to: string };
|
|
6
|
+
|
|
7
|
+
/** Lo que puede valer una entrada de un formulario dinámico. */
|
|
8
|
+
export type DynamicFormValue = string | number | boolean | DateRangeValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValidationArguments, ValidatorConstraint, ValidatorConstraintInterface } from 'class-validator';
|
|
2
|
+
import { JsonValue } from '../../common/types/JsonValue';
|
|
3
|
+
import { isDynamicFormValue, isPlainObject } from '../helpers/isDynamicFormValue';
|
|
4
|
+
|
|
5
|
+
/** Valida un mapa `clave → DynamicFormValue` (string | number | boolean | {from, to}). */
|
|
6
|
+
@ValidatorConstraint({ name: 'IsDynamicFormValues', async: false })
|
|
7
|
+
export class IsDynamicFormValues implements ValidatorConstraintInterface {
|
|
8
|
+
validate(value: JsonValue, _args: ValidationArguments): boolean {
|
|
9
|
+
if (!isPlainObject(value)) return false;
|
|
10
|
+
return Object.values(value).every(isDynamicFormValue);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
defaultMessage(_args: ValidationArguments): string {
|
|
14
|
+
return 'inputs debe ser un mapa clave → string | number | boolean | {from, to}';
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -193,3 +193,17 @@ export * as RetailLoan from './retailLoan';
|
|
|
193
193
|
export * as MoneyTransfer from './moneyTransfer';
|
|
194
194
|
// FileStorage: contrato de fiado-s3-lambda (documentos de usuario en S3). Consumido por api-invoker (IFileStorageApi).
|
|
195
195
|
export * as FileStorage from './fileStorage';
|
|
196
|
+
|
|
197
|
+
// DynamicForm: formulario dinámico compartido (InputField, InputFieldTypeEnum, SelectOption,
|
|
198
|
+
// InputValidation, InputSchema). Antes vivía en `benefitCenter`, que lo reexporta como alias.
|
|
199
|
+
// Lo usan rewards (dependencies de las recompensas) y rewardsEligibility (inputs, fields, params).
|
|
200
|
+
export * as DynamicForm from './dynamicForm';
|
|
201
|
+
|
|
202
|
+
// Rewards: contrato entre rewards-business (entrega paquetes de recompensas) y sus llamadores
|
|
203
|
+
// (rewards-eligibility-business): mensajes GRANT_REQUESTED / GRANT_FAILED de las colas compartidas
|
|
204
|
+
// y respuestas de las lecturas privadas GET /packages/{id} y GET /grants/{id}.
|
|
205
|
+
export * as Rewards from './rewards';
|
|
206
|
+
|
|
207
|
+
// RewardsEligibility: contrato del validador de elegibilidad (rewards-eligibility-business) hacia los
|
|
208
|
+
// servicios emisores: POST /events (request/response) y GET /runs/{id}.
|
|
209
|
+
export * as RewardsEligibility from './rewardsEligibility';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { Equals, IsEnum, IsNotEmpty, IsString } from 'class-validator';
|
|
3
|
+
import { GrantFailedReasonEnum } from '../enums/GrantFailedReasonEnum';
|
|
4
|
+
import { RewardsMessageTypeEnum } from '../enums/RewardsMessageTypeEnum';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Aviso de que una entrega terminó SIN ningún ítem entregado (`FAILED` o `REJECTED`). Lo publica
|
|
8
|
+
* rewards-business en la cola registrada para `source.service` (spec A 6.5) para que el llamador
|
|
9
|
+
* libere lo que reservó. Una entrega `PARTIAL` no avisa. Es idempotente en el destino.
|
|
10
|
+
*/
|
|
11
|
+
export class GrantFailedMessage {
|
|
12
|
+
@Expose()
|
|
13
|
+
@Equals(RewardsMessageTypeEnum.GRANT_FAILED)
|
|
14
|
+
messageType!: RewardsMessageTypeEnum.GRANT_FAILED;
|
|
15
|
+
|
|
16
|
+
@Expose()
|
|
17
|
+
@IsString()
|
|
18
|
+
@IsNotEmpty()
|
|
19
|
+
idempotencyKey!: string;
|
|
20
|
+
|
|
21
|
+
@Expose()
|
|
22
|
+
@IsString()
|
|
23
|
+
@IsNotEmpty()
|
|
24
|
+
grantId!: string;
|
|
25
|
+
|
|
26
|
+
@Expose()
|
|
27
|
+
@IsEnum(GrantFailedReasonEnum)
|
|
28
|
+
reason!: GrantFailedReasonEnum;
|
|
29
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { Equals, IsNotEmpty, IsString, Validate, ValidateNested } from 'class-validator';
|
|
3
|
+
import { RewardsMessageTypeEnum } from '../enums/RewardsMessageTypeEnum';
|
|
4
|
+
import { RewardInputs } from '../types/RewardInputs';
|
|
5
|
+
import { IsRewardInputs } from '../validators/IsRewardInputs';
|
|
6
|
+
import { RewardSource } from './RewardSource';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Pedido de entrega de un paquete, publicado en `RewardsGrantQueue` (spec A 6.1). Que la
|
|
10
|
+
* publicación funcione es la aceptación del pedido. El `grantId` NO viaja: el llamador lo calcula
|
|
11
|
+
* con `grantIdFor(source.service, idempotencyKey)` de `@fiado/api-invoker`.
|
|
12
|
+
*
|
|
13
|
+
* Parseo en el consumidor: `plainToInstance(GrantRequestedMessage, raw, { excludeExtraneousValues: true })`.
|
|
14
|
+
*/
|
|
15
|
+
export class GrantRequestedMessage {
|
|
16
|
+
@Expose()
|
|
17
|
+
@Equals(RewardsMessageTypeEnum.GRANT_REQUESTED)
|
|
18
|
+
messageType!: RewardsMessageTypeEnum.GRANT_REQUESTED;
|
|
19
|
+
|
|
20
|
+
/** Beneficiario de la recompensa. */
|
|
21
|
+
@Expose()
|
|
22
|
+
@IsString()
|
|
23
|
+
@IsNotEmpty()
|
|
24
|
+
directoryId!: string;
|
|
25
|
+
|
|
26
|
+
@Expose()
|
|
27
|
+
@IsString()
|
|
28
|
+
@IsNotEmpty()
|
|
29
|
+
packageId!: string;
|
|
30
|
+
|
|
31
|
+
@Expose()
|
|
32
|
+
@ValidateNested()
|
|
33
|
+
@Type(() => RewardSource)
|
|
34
|
+
source!: RewardSource;
|
|
35
|
+
|
|
36
|
+
/** Ej. `elig:{evaluationId}:{beneficiaryDirectoryId}:{grantKey}:r{n}`. Con `source.service` da el `grantId`. */
|
|
37
|
+
@Expose()
|
|
38
|
+
@IsString()
|
|
39
|
+
@IsNotEmpty()
|
|
40
|
+
idempotencyKey!: string;
|
|
41
|
+
|
|
42
|
+
/** `itemKey → inputKey → valor`. */
|
|
43
|
+
@Expose()
|
|
44
|
+
@Validate(IsRewardInputs)
|
|
45
|
+
inputs!: RewardInputs;
|
|
46
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InputField } from '../../dynamicForm/dtos/InputField';
|
|
2
|
+
import { DependencyIfMissingEnum } from '../enums/DependencyIfMissingEnum';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Una dependencia de una recompensa: lo que quien consume debe enviar para poder entregarla.
|
|
6
|
+
* Adopta la forma de `InputField` (formulario dinámico compartido) y suma los campos propios
|
|
7
|
+
* de rewards (spec A 5.1).
|
|
8
|
+
*/
|
|
9
|
+
export class RewardDependency extends InputField {
|
|
10
|
+
/** Condición que la vuelve necesaria (sobre otras dependencias), si aplica. */
|
|
11
|
+
requiredWhen?: string;
|
|
12
|
+
/** Qué pasa si falta cuando se necesitaba. Por defecto, REJECT. */
|
|
13
|
+
ifMissing?: DependencyIfMissingEnum;
|
|
14
|
+
/** De dónde la saca el lambda solo cuando no se envía. */
|
|
15
|
+
resolvedFrom?: string;
|
|
16
|
+
/** Texto corto para quien consume. */
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsNotEmpty, IsOptional, IsString, Validate } from 'class-validator';
|
|
3
|
+
import { IsRewardTags } from '../validators/IsRewardTags';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Quién pide la entrega. El lambda no interpreta `reference` ni `tags`: los guarda y los usa como
|
|
7
|
+
* filtro/auditoría (spec A D1, D10).
|
|
8
|
+
*/
|
|
9
|
+
export class RewardSource {
|
|
10
|
+
/** Servicio llamador (ej. `rewards-eligibility`). Entra en el `grantId`. */
|
|
11
|
+
@Expose()
|
|
12
|
+
@IsString()
|
|
13
|
+
@IsNotEmpty()
|
|
14
|
+
service!: string;
|
|
15
|
+
|
|
16
|
+
/** Referencia opaca del llamador (ej. `runId`). */
|
|
17
|
+
@Expose()
|
|
18
|
+
@IsString()
|
|
19
|
+
@IsNotEmpty()
|
|
20
|
+
reference!: string;
|
|
21
|
+
|
|
22
|
+
/** Etiquetas opacas (ej. `campaignId`, `evaluationId`). Máx. 10 llaves. */
|
|
23
|
+
@Expose()
|
|
24
|
+
@IsOptional()
|
|
25
|
+
@Validate(IsRewardTags)
|
|
26
|
+
tags?: Record<string, string>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ItemErrorCategoryEnum } from '../../enums/ItemErrorCategoryEnum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Un intento de ejecutar un ítem. Sin `providerResponse`, `requestSnapshot` ni `correlationIds`:
|
|
5
|
+
* contienen PII y solo se leen en el backoffice (spec A R2).
|
|
6
|
+
*/
|
|
7
|
+
export class GrantAttemptResponse {
|
|
8
|
+
attempt: number;
|
|
9
|
+
/** Epoch en milisegundos. */
|
|
10
|
+
startedAt: number;
|
|
11
|
+
/** Epoch en milisegundos. */
|
|
12
|
+
finishedAt: number;
|
|
13
|
+
errorCategory?: ItemErrorCategoryEnum;
|
|
14
|
+
errorCode?: string;
|
|
15
|
+
httpStatus?: number;
|
|
16
|
+
}
|