@fiado/type-kit 3.513.0 → 3.515.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.
Files changed (97) hide show
  1. package/_test_/unit/rewards/backoffice.test.ts +96 -0
  2. package/_test_/unit/rewardsEligibility/domainDtos.test.ts +40 -0
  3. package/_test_/unit/rewardsEligibility/domainEnums.test.ts +35 -0
  4. package/bin/rewards/constants/BackofficeLimits.d.ts +6 -0
  5. package/bin/rewards/constants/BackofficeLimits.js +9 -0
  6. package/bin/rewards/dtos/backoffice/CatalogItemListResponse.d.ts +6 -0
  7. package/bin/rewards/dtos/backoffice/CatalogItemListResponse.js +6 -0
  8. package/bin/rewards/dtos/backoffice/CatalogItemRequest.d.ts +19 -0
  9. package/bin/rewards/dtos/backoffice/CatalogItemRequest.js +70 -0
  10. package/bin/rewards/dtos/backoffice/CatalogItemResponse.d.ts +23 -0
  11. package/bin/rewards/dtos/backoffice/CatalogItemResponse.js +6 -0
  12. package/bin/rewards/dtos/backoffice/PackageItemRequest.d.ts +4 -0
  13. package/bin/rewards/dtos/backoffice/PackageItemRequest.js +30 -0
  14. package/bin/rewards/dtos/backoffice/PackageListResponse.d.ts +6 -0
  15. package/bin/rewards/dtos/backoffice/PackageListResponse.js +6 -0
  16. package/bin/rewards/dtos/backoffice/PackageRequest.d.ts +9 -0
  17. package/bin/rewards/dtos/backoffice/PackageRequest.js +47 -0
  18. package/bin/rewards/dtos/backoffice/PackageResponse.d.ts +18 -0
  19. package/bin/rewards/dtos/backoffice/PackageResponse.js +9 -0
  20. package/bin/rewards/dtos/backoffice/RewardChargeToInput.d.ts +4 -0
  21. package/bin/rewards/dtos/backoffice/RewardChargeToInput.js +31 -0
  22. package/bin/rewards/dtos/backoffice/RewardCostInput.d.ts +5 -0
  23. package/bin/rewards/dtos/backoffice/RewardCostInput.js +29 -0
  24. package/bin/rewards/dtos/backoffice/RewardTypeResponse.d.ts +6 -0
  25. package/bin/rewards/dtos/backoffice/RewardTypeResponse.js +7 -0
  26. package/bin/rewards/index.d.ts +11 -0
  27. package/bin/rewards/index.js +13 -0
  28. package/bin/rewardsEligibility/dtos/CampaignAlerts.d.ts +4 -0
  29. package/bin/rewardsEligibility/dtos/CampaignAlerts.js +7 -0
  30. package/bin/rewardsEligibility/dtos/CampaignQuota.d.ts +8 -0
  31. package/bin/rewardsEligibility/dtos/CampaignQuota.js +7 -0
  32. package/bin/rewardsEligibility/dtos/EvaluationReward.d.ts +6 -0
  33. package/bin/rewardsEligibility/dtos/EvaluationReward.js +7 -0
  34. package/bin/rewardsEligibility/dtos/EvaluationTrigger.d.ts +14 -0
  35. package/bin/rewardsEligibility/dtos/EvaluationTrigger.js +7 -0
  36. package/bin/rewardsEligibility/dtos/GrantPolicy.d.ts +12 -0
  37. package/bin/rewardsEligibility/dtos/GrantPolicy.js +7 -0
  38. package/bin/rewardsEligibility/dtos/PopulationRef.d.ts +6 -0
  39. package/bin/rewardsEligibility/dtos/PopulationRef.js +7 -0
  40. package/bin/rewardsEligibility/enums/ApprovalModeEnum.d.ts +4 -0
  41. package/bin/rewardsEligibility/enums/ApprovalModeEnum.js +8 -0
  42. package/bin/rewardsEligibility/enums/BatchPublishStateEnum.d.ts +7 -0
  43. package/bin/rewardsEligibility/enums/BatchPublishStateEnum.js +11 -0
  44. package/bin/rewardsEligibility/enums/CampaignPausedReasonEnum.d.ts +7 -0
  45. package/bin/rewardsEligibility/enums/CampaignPausedReasonEnum.js +11 -0
  46. package/bin/rewardsEligibility/enums/CampaignStatusEnum.d.ts +8 -0
  47. package/bin/rewardsEligibility/enums/CampaignStatusEnum.js +12 -0
  48. package/bin/rewardsEligibility/enums/EvaluationStatusEnum.d.ts +6 -0
  49. package/bin/rewardsEligibility/enums/EvaluationStatusEnum.js +10 -0
  50. package/bin/rewardsEligibility/enums/GrantPeriodEnum.d.ts +5 -0
  51. package/bin/rewardsEligibility/enums/GrantPeriodEnum.js +9 -0
  52. package/bin/rewardsEligibility/enums/GrantPolicyModeEnum.d.ts +11 -0
  53. package/bin/rewardsEligibility/enums/GrantPolicyModeEnum.js +15 -0
  54. package/bin/rewardsEligibility/enums/LedgerStatusEnum.d.ts +5 -0
  55. package/bin/rewardsEligibility/enums/LedgerStatusEnum.js +9 -0
  56. package/bin/rewardsEligibility/enums/QuotaExhaustedActionEnum.d.ts +7 -0
  57. package/bin/rewardsEligibility/enums/QuotaExhaustedActionEnum.js +11 -0
  58. package/bin/rewardsEligibility/enums/QuotaPeriodEnum.d.ts +7 -0
  59. package/bin/rewardsEligibility/enums/QuotaPeriodEnum.js +11 -0
  60. package/bin/rewardsEligibility/enums/TraceOriginEnum.d.ts +5 -0
  61. package/bin/rewardsEligibility/enums/TraceOriginEnum.js +9 -0
  62. package/bin/rewardsEligibility/index.d.ts +18 -0
  63. package/bin/rewardsEligibility/index.js +21 -0
  64. package/bin/rewardsEligibility/types/RewardInputRef.d.ts +7 -0
  65. package/bin/rewardsEligibility/types/RewardInputRef.js +2 -0
  66. package/package.json +1 -1
  67. package/src/rewards/constants/BackofficeLimits.ts +6 -0
  68. package/src/rewards/dtos/backoffice/CatalogItemListResponse.ts +7 -0
  69. package/src/rewards/dtos/backoffice/CatalogItemRequest.ts +52 -0
  70. package/src/rewards/dtos/backoffice/CatalogItemResponse.ts +22 -0
  71. package/src/rewards/dtos/backoffice/PackageItemRequest.ts +15 -0
  72. package/src/rewards/dtos/backoffice/PackageListResponse.ts +7 -0
  73. package/src/rewards/dtos/backoffice/PackageRequest.ts +31 -0
  74. package/src/rewards/dtos/backoffice/PackageResponse.ts +20 -0
  75. package/src/rewards/dtos/backoffice/RewardChargeToInput.ts +16 -0
  76. package/src/rewards/dtos/backoffice/RewardCostInput.ts +14 -0
  77. package/src/rewards/dtos/backoffice/RewardTypeResponse.ts +7 -0
  78. package/src/rewards/index.ts +15 -0
  79. package/src/rewardsEligibility/dtos/CampaignAlerts.ts +4 -0
  80. package/src/rewardsEligibility/dtos/CampaignQuota.ts +9 -0
  81. package/src/rewardsEligibility/dtos/EvaluationReward.ts +7 -0
  82. package/src/rewardsEligibility/dtos/EvaluationTrigger.ts +15 -0
  83. package/src/rewardsEligibility/dtos/GrantPolicy.ts +13 -0
  84. package/src/rewardsEligibility/dtos/PopulationRef.ts +7 -0
  85. package/src/rewardsEligibility/enums/ApprovalModeEnum.ts +4 -0
  86. package/src/rewardsEligibility/enums/BatchPublishStateEnum.ts +7 -0
  87. package/src/rewardsEligibility/enums/CampaignPausedReasonEnum.ts +7 -0
  88. package/src/rewardsEligibility/enums/CampaignStatusEnum.ts +8 -0
  89. package/src/rewardsEligibility/enums/EvaluationStatusEnum.ts +6 -0
  90. package/src/rewardsEligibility/enums/GrantPeriodEnum.ts +5 -0
  91. package/src/rewardsEligibility/enums/GrantPolicyModeEnum.ts +11 -0
  92. package/src/rewardsEligibility/enums/LedgerStatusEnum.ts +5 -0
  93. package/src/rewardsEligibility/enums/QuotaExhaustedActionEnum.ts +7 -0
  94. package/src/rewardsEligibility/enums/QuotaPeriodEnum.ts +7 -0
  95. package/src/rewardsEligibility/enums/TraceOriginEnum.ts +5 -0
  96. package/src/rewardsEligibility/index.ts +24 -0
  97. package/src/rewardsEligibility/types/RewardInputRef.ts +4 -0
@@ -0,0 +1,6 @@
1
+ import { RewardInputRef } from '../types/RewardInputRef';
2
+ /** Que se pide a rewards-business al calificar: el paquete y sus inputs `itemKey -> inputKey -> valor`. */
3
+ export declare class EvaluationReward {
4
+ packageId: string;
5
+ inputs: Record<string, Record<string, RewardInputRef>>;
6
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EvaluationReward = void 0;
4
+ /** Que se pide a rewards-business al calificar: el paquete y sus inputs `itemKey -> inputKey -> valor`. */
5
+ class EvaluationReward {
6
+ }
7
+ exports.EvaluationReward = EvaluationReward;
@@ -0,0 +1,14 @@
1
+ import { ApprovalModeEnum } from '../enums/ApprovalModeEnum';
2
+ import { TriggerTypeEnum } from '../enums/TriggerTypeEnum';
3
+ import { PopulationRef } from './PopulationRef';
4
+ /** Disparador de una evaluacion (spec B 5.1). Una evaluacion tiene a lo sumo UN disparador `EVENT`. */
5
+ export declare class EvaluationTrigger {
6
+ type: TriggerTypeEnum;
7
+ approval: ApprovalModeEnum;
8
+ /** Solo `EVENT`. */
9
+ eventKey?: string;
10
+ /** Solo `CRON`: cron de 5 campos, granularidad de 15 minutos (fase 4). */
11
+ schedule?: string;
12
+ /** Solo `CRON` (fase 4). */
13
+ population?: PopulationRef;
14
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EvaluationTrigger = void 0;
4
+ /** Disparador de una evaluacion (spec B 5.1). Una evaluacion tiene a lo sumo UN disparador `EVENT`. */
5
+ class EvaluationTrigger {
6
+ }
7
+ exports.EvaluationTrigger = EvaluationTrigger;
@@ -0,0 +1,12 @@
1
+ import { GrantPeriodEnum } from '../enums/GrantPeriodEnum';
2
+ import { GrantPolicyModeEnum } from '../enums/GrantPolicyModeEnum';
3
+ /** Politica de frecuencia de una evaluacion (spec B 5.1). Cada modo exige su campo (lo valida el backoffice). */
4
+ export declare class GrantPolicy {
5
+ mode: GrantPolicyModeEnum;
6
+ /** Solo `PER_PERIOD`. */
7
+ period?: GrantPeriodEnum;
8
+ /** Solo `PER_REFERENCE`: la `key` de un input del contrato (ej. `saleId`). */
9
+ referenceInput?: string;
10
+ /** Solo `MAX_N`: tope de premios en total (>= 1). */
11
+ max?: number;
12
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrantPolicy = void 0;
4
+ /** Politica de frecuencia de una evaluacion (spec B 5.1). Cada modo exige su campo (lo valida el backoffice). */
5
+ class GrantPolicy {
6
+ }
7
+ exports.GrantPolicy = GrantPolicy;
@@ -0,0 +1,6 @@
1
+ import { DynamicFormValue } from '../../dynamicForm/types/DynamicFormValue';
2
+ /** Fuente de poblacion de un disparador `CRON` (fase 4) con sus params. */
3
+ export declare class PopulationRef {
4
+ source: string;
5
+ params: Record<string, DynamicFormValue>;
6
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PopulationRef = void 0;
4
+ /** Fuente de poblacion de un disparador `CRON` (fase 4) con sus params. */
5
+ class PopulationRef {
6
+ }
7
+ exports.PopulationRef = PopulationRef;
@@ -0,0 +1,4 @@
1
+ export declare enum ApprovalModeEnum {
2
+ AUTO = "AUTO",
3
+ REQUIRED = "REQUIRED"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApprovalModeEnum = void 0;
4
+ var ApprovalModeEnum;
5
+ (function (ApprovalModeEnum) {
6
+ ApprovalModeEnum["AUTO"] = "AUTO";
7
+ ApprovalModeEnum["REQUIRED"] = "REQUIRED";
8
+ })(ApprovalModeEnum || (exports.ApprovalModeEnum = ApprovalModeEnum = {}));
@@ -0,0 +1,7 @@
1
+ /** Estado de publicacion del registro de reserva de un lote (spec B 5.8). */
2
+ export declare enum BatchPublishStateEnum {
3
+ PENDING_APPROVAL = "PENDING_APPROVAL",
4
+ PENDING = "PENDING",
5
+ PUBLISHED = "PUBLISHED",
6
+ CANCELLED = "CANCELLED"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BatchPublishStateEnum = void 0;
4
+ /** Estado de publicacion del registro de reserva de un lote (spec B 5.8). */
5
+ var BatchPublishStateEnum;
6
+ (function (BatchPublishStateEnum) {
7
+ BatchPublishStateEnum["PENDING_APPROVAL"] = "PENDING_APPROVAL";
8
+ BatchPublishStateEnum["PENDING"] = "PENDING";
9
+ BatchPublishStateEnum["PUBLISHED"] = "PUBLISHED";
10
+ BatchPublishStateEnum["CANCELLED"] = "CANCELLED";
11
+ })(BatchPublishStateEnum || (exports.BatchPublishStateEnum = BatchPublishStateEnum = {}));
@@ -0,0 +1,7 @@
1
+ /** Por que esta pausada una campania: decide si se siguen soltando sus lotes reservados (spec B 7.6). */
2
+ export declare enum CampaignPausedReasonEnum {
3
+ /** Lo pauso un operador: no se sueltan lotes. */
4
+ MANUAL = "MANUAL",
5
+ /** Se agoto un cupo con `PAUSE_CAMPAIGN`: lo reservado igual se suelta. */
6
+ QUOTA_EXHAUSTED = "QUOTA_EXHAUSTED"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CampaignPausedReasonEnum = void 0;
4
+ /** Por que esta pausada una campania: decide si se siguen soltando sus lotes reservados (spec B 7.6). */
5
+ var CampaignPausedReasonEnum;
6
+ (function (CampaignPausedReasonEnum) {
7
+ /** Lo pauso un operador: no se sueltan lotes. */
8
+ CampaignPausedReasonEnum["MANUAL"] = "MANUAL";
9
+ /** Se agoto un cupo con `PAUSE_CAMPAIGN`: lo reservado igual se suelta. */
10
+ CampaignPausedReasonEnum["QUOTA_EXHAUSTED"] = "QUOTA_EXHAUSTED";
11
+ })(CampaignPausedReasonEnum || (exports.CampaignPausedReasonEnum = CampaignPausedReasonEnum = {}));
@@ -0,0 +1,8 @@
1
+ export declare enum CampaignStatusEnum {
2
+ DRAFT = "DRAFT",
3
+ ACTIVE = "ACTIVE",
4
+ PAUSED = "PAUSED",
5
+ /** Llego a `endsAt` (lo marca el tick, spec B 5.6). */
6
+ ENDED = "ENDED",
7
+ ARCHIVED = "ARCHIVED"
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CampaignStatusEnum = void 0;
4
+ var CampaignStatusEnum;
5
+ (function (CampaignStatusEnum) {
6
+ CampaignStatusEnum["DRAFT"] = "DRAFT";
7
+ CampaignStatusEnum["ACTIVE"] = "ACTIVE";
8
+ CampaignStatusEnum["PAUSED"] = "PAUSED";
9
+ /** Llego a `endsAt` (lo marca el tick, spec B 5.6). */
10
+ CampaignStatusEnum["ENDED"] = "ENDED";
11
+ CampaignStatusEnum["ARCHIVED"] = "ARCHIVED";
12
+ })(CampaignStatusEnum || (exports.CampaignStatusEnum = CampaignStatusEnum = {}));
@@ -0,0 +1,6 @@
1
+ export declare enum EvaluationStatusEnum {
2
+ DRAFT = "DRAFT",
3
+ ACTIVE = "ACTIVE",
4
+ PAUSED = "PAUSED",
5
+ ARCHIVED = "ARCHIVED"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EvaluationStatusEnum = void 0;
4
+ var EvaluationStatusEnum;
5
+ (function (EvaluationStatusEnum) {
6
+ EvaluationStatusEnum["DRAFT"] = "DRAFT";
7
+ EvaluationStatusEnum["ACTIVE"] = "ACTIVE";
8
+ EvaluationStatusEnum["PAUSED"] = "PAUSED";
9
+ EvaluationStatusEnum["ARCHIVED"] = "ARCHIVED";
10
+ })(EvaluationStatusEnum || (exports.EvaluationStatusEnum = EvaluationStatusEnum = {}));
@@ -0,0 +1,5 @@
1
+ /** Periodos validos de `GrantPolicy.period` (modo `PER_PERIOD`). */
2
+ export declare enum GrantPeriodEnum {
3
+ WEEK = "WEEK",
4
+ MONTH = "MONTH"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrantPeriodEnum = void 0;
4
+ /** Periodos validos de `GrantPolicy.period` (modo `PER_PERIOD`). */
5
+ var GrantPeriodEnum;
6
+ (function (GrantPeriodEnum) {
7
+ GrantPeriodEnum["WEEK"] = "WEEK";
8
+ GrantPeriodEnum["MONTH"] = "MONTH";
9
+ })(GrantPeriodEnum || (exports.GrantPeriodEnum = GrantPeriodEnum = {}));
@@ -0,0 +1,11 @@
1
+ /** Politica de frecuencia de una evaluacion (spec B E5 y 5.5). */
2
+ export declare enum GrantPolicyModeEnum {
3
+ /** Una vez en la vida por evaluacion. */
4
+ ONCE = "ONCE",
5
+ /** Una por periodo (`GrantPeriodEnum`). */
6
+ PER_PERIOD = "PER_PERIOD",
7
+ /** Una por valor del `referenceInput` (ej. `saleId`). */
8
+ PER_REFERENCE = "PER_REFERENCE",
9
+ /** Hasta N en total (`max`), con un contador. */
10
+ MAX_N = "MAX_N"
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrantPolicyModeEnum = void 0;
4
+ /** Politica de frecuencia de una evaluacion (spec B E5 y 5.5). */
5
+ var GrantPolicyModeEnum;
6
+ (function (GrantPolicyModeEnum) {
7
+ /** Una vez en la vida por evaluacion. */
8
+ GrantPolicyModeEnum["ONCE"] = "ONCE";
9
+ /** Una por periodo (`GrantPeriodEnum`). */
10
+ GrantPolicyModeEnum["PER_PERIOD"] = "PER_PERIOD";
11
+ /** Una por valor del `referenceInput` (ej. `saleId`). */
12
+ GrantPolicyModeEnum["PER_REFERENCE"] = "PER_REFERENCE";
13
+ /** Hasta N en total (`max`), con un contador. */
14
+ GrantPolicyModeEnum["MAX_N"] = "MAX_N";
15
+ })(GrantPolicyModeEnum || (exports.GrantPolicyModeEnum = GrantPolicyModeEnum = {}));
@@ -0,0 +1,5 @@
1
+ /** Estado de una reserva del ledger de frecuencia (spec B 5.5). */
2
+ export declare enum LedgerStatusEnum {
3
+ RESERVED = "RESERVED",
4
+ RELEASED = "RELEASED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LedgerStatusEnum = void 0;
4
+ /** Estado de una reserva del ledger de frecuencia (spec B 5.5). */
5
+ var LedgerStatusEnum;
6
+ (function (LedgerStatusEnum) {
7
+ LedgerStatusEnum["RESERVED"] = "RESERVED";
8
+ LedgerStatusEnum["RELEASED"] = "RELEASED";
9
+ })(LedgerStatusEnum || (exports.LedgerStatusEnum = LedgerStatusEnum = {}));
@@ -0,0 +1,7 @@
1
+ /** Que pasa al agotarse un cupo (`onExhausted`, spec B 5.6). */
2
+ export declare enum QuotaExhaustedActionEnum {
3
+ /** Pausa la campania; sus evaluaciones dejan de correr. */
4
+ PAUSE_CAMPAIGN = "PAUSE_CAMPAIGN",
5
+ /** Siguen corriendo y registrando, sin entregar (`QUOTA_EXHAUSTED`). */
6
+ RECORD_ONLY = "RECORD_ONLY"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotaExhaustedActionEnum = void 0;
4
+ /** Que pasa al agotarse un cupo (`onExhausted`, spec B 5.6). */
5
+ var QuotaExhaustedActionEnum;
6
+ (function (QuotaExhaustedActionEnum) {
7
+ /** Pausa la campania; sus evaluaciones dejan de correr. */
8
+ QuotaExhaustedActionEnum["PAUSE_CAMPAIGN"] = "PAUSE_CAMPAIGN";
9
+ /** Siguen corriendo y registrando, sin entregar (`QUOTA_EXHAUSTED`). */
10
+ QuotaExhaustedActionEnum["RECORD_ONLY"] = "RECORD_ONLY";
11
+ })(QuotaExhaustedActionEnum || (exports.QuotaExhaustedActionEnum = QuotaExhaustedActionEnum = {}));
@@ -0,0 +1,7 @@
1
+ /** Periodo de un cupo de campania (spec B 5.6). `TOTAL` no se reinicia nunca. */
2
+ export declare enum QuotaPeriodEnum {
3
+ TOTAL = "TOTAL",
4
+ DAY = "DAY",
5
+ WEEK = "WEEK",
6
+ MONTH = "MONTH"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotaPeriodEnum = void 0;
4
+ /** Periodo de un cupo de campania (spec B 5.6). `TOTAL` no se reinicia nunca. */
5
+ var QuotaPeriodEnum;
6
+ (function (QuotaPeriodEnum) {
7
+ QuotaPeriodEnum["TOTAL"] = "TOTAL";
8
+ QuotaPeriodEnum["DAY"] = "DAY";
9
+ QuotaPeriodEnum["WEEK"] = "WEEK";
10
+ QuotaPeriodEnum["MONTH"] = "MONTH";
11
+ })(QuotaPeriodEnum || (exports.QuotaPeriodEnum = QuotaPeriodEnum = {}));
@@ -0,0 +1,5 @@
1
+ /** De donde salio el dato con el que se decidio una condicion (spec B 7.4.1). */
2
+ export declare enum TraceOriginEnum {
3
+ PREFETCHED = "PREFETCHED",
4
+ RESOLVED = "RESOLVED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TraceOriginEnum = void 0;
4
+ /** De donde salio el dato con el que se decidio una condicion (spec B 7.4.1). */
5
+ var TraceOriginEnum;
6
+ (function (TraceOriginEnum) {
7
+ TraceOriginEnum["PREFETCHED"] = "PREFETCHED";
8
+ TraceOriginEnum["RESOLVED"] = "RESOLVED";
9
+ })(TraceOriginEnum || (exports.TraceOriginEnum = TraceOriginEnum = {}));
@@ -11,3 +11,21 @@ export * from './dtos/PostEventResponse';
11
11
  export * from './dtos/RunCounts';
12
12
  export * from './dtos/RunResultItem';
13
13
  export * from './dtos/GetRunResponse';
14
+ export * from './enums/CampaignStatusEnum';
15
+ export * from './enums/CampaignPausedReasonEnum';
16
+ export * from './enums/EvaluationStatusEnum';
17
+ export * from './enums/GrantPolicyModeEnum';
18
+ export * from './enums/GrantPeriodEnum';
19
+ export * from './enums/QuotaPeriodEnum';
20
+ export * from './enums/QuotaExhaustedActionEnum';
21
+ export * from './enums/ApprovalModeEnum';
22
+ export * from './enums/LedgerStatusEnum';
23
+ export * from './enums/BatchPublishStateEnum';
24
+ export * from './enums/TraceOriginEnum';
25
+ export * from './types/RewardInputRef';
26
+ export * from './dtos/GrantPolicy';
27
+ export * from './dtos/CampaignQuota';
28
+ export * from './dtos/CampaignAlerts';
29
+ export * from './dtos/PopulationRef';
30
+ export * from './dtos/EvaluationReward';
31
+ export * from './dtos/EvaluationTrigger';
@@ -29,3 +29,24 @@ __exportStar(require("./dtos/PostEventResponse"), exports);
29
29
  __exportStar(require("./dtos/RunCounts"), exports);
30
30
  __exportStar(require("./dtos/RunResultItem"), exports);
31
31
  __exportStar(require("./dtos/GetRunResponse"), exports);
32
+ //Enums del dominio (campanias, evaluaciones, ledger)
33
+ __exportStar(require("./enums/CampaignStatusEnum"), exports);
34
+ __exportStar(require("./enums/CampaignPausedReasonEnum"), exports);
35
+ __exportStar(require("./enums/EvaluationStatusEnum"), exports);
36
+ __exportStar(require("./enums/GrantPolicyModeEnum"), exports);
37
+ __exportStar(require("./enums/GrantPeriodEnum"), exports);
38
+ __exportStar(require("./enums/QuotaPeriodEnum"), exports);
39
+ __exportStar(require("./enums/QuotaExhaustedActionEnum"), exports);
40
+ __exportStar(require("./enums/ApprovalModeEnum"), exports);
41
+ __exportStar(require("./enums/LedgerStatusEnum"), exports);
42
+ __exportStar(require("./enums/BatchPublishStateEnum"), exports);
43
+ __exportStar(require("./enums/TraceOriginEnum"), exports);
44
+ //Types
45
+ __exportStar(require("./types/RewardInputRef"), exports);
46
+ //DTOs de configuracion (forma guardada de campanias y evaluaciones)
47
+ __exportStar(require("./dtos/GrantPolicy"), exports);
48
+ __exportStar(require("./dtos/CampaignQuota"), exports);
49
+ __exportStar(require("./dtos/CampaignAlerts"), exports);
50
+ __exportStar(require("./dtos/PopulationRef"), exports);
51
+ __exportStar(require("./dtos/EvaluationReward"), exports);
52
+ __exportStar(require("./dtos/EvaluationTrigger"), exports);
@@ -0,0 +1,7 @@
1
+ import { DynamicFormValue } from '../../dynamicForm/types/DynamicFormValue';
2
+ /** Valor de un input de `reward.inputs`: constante o tomado de un input de la evaluacion (spec B 5.1). */
3
+ export type RewardInputRef = {
4
+ const: DynamicFormValue;
5
+ } | {
6
+ input: string;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.513.0",
3
+ "version": "3.515.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,6 @@
1
+ /** Máximo del `itemKey` de un paquete: `RW-{grantId(32)}-{itemKey}` ≤ 64 (igual que REWARDS_MAX_ITEM_KEY_LENGTH de api-invoker). */
2
+ export const REWARD_ITEM_KEY_MAX_LENGTH = 28;
3
+ export const REWARD_ITEM_KEY_PATTERN = new RegExp(`^[A-Za-z0-9_-]{1,${REWARD_ITEM_KEY_MAX_LENGTH}}$`);
4
+ export const REWARD_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
5
+ /** Máximo de ítems de un paquete (B-12 de rewards-business: presupuesto de tiempo del worker). Igual a `MAX_ITEMS_PER_PACKAGE` del lambda. */
6
+ export const REWARD_PACKAGE_MAX_ITEMS = 4;
@@ -0,0 +1,7 @@
1
+ import { CatalogItemResponse } from './CatalogItemResponse';
2
+
3
+ export class CatalogItemListResponse {
4
+ items: CatalogItemResponse[];
5
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
6
+ nextCursor?: string;
7
+ }
@@ -0,0 +1,52 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { IsEnum, IsNotEmpty, IsObject, IsString, Matches, MaxLength, ValidateNested } from 'class-validator';
3
+ import { JsonValue } from '../../../common';
4
+ import { REWARD_ID_PATTERN } from '../../constants/BackofficeLimits';
5
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
6
+ import { RewardChargeToInput } from './RewardChargeToInput';
7
+ import { RewardCostInput } from './RewardCostInput';
8
+
9
+ /** Crear (POST) o reemplazar (PUT) una recompensa del catálogo. `version`, `dependencies` y `updatedBy` los pone el servidor. */
10
+ export class CatalogItemRequest {
11
+ @Expose()
12
+ @IsString()
13
+ @Matches(REWARD_ID_PATTERN)
14
+ id: string;
15
+
16
+ @Expose()
17
+ @IsString()
18
+ @IsNotEmpty()
19
+ @MaxLength(120)
20
+ name: string;
21
+
22
+ @Expose()
23
+ @IsString()
24
+ @MaxLength(500)
25
+ description: string;
26
+
27
+ /** `type` del adaptador (IRewardType.type). Inmutable una vez creada la recompensa. */
28
+ @Expose()
29
+ @IsString()
30
+ @IsNotEmpty()
31
+ @MaxLength(60)
32
+ type: string;
33
+
34
+ /** Forma definida por cada tipo; el lambda la valida con `IRewardType.validateConfig`. */
35
+ @Expose()
36
+ @IsObject()
37
+ config: { [key: string]: JsonValue };
38
+
39
+ @Expose()
40
+ @ValidateNested()
41
+ @Type(() => RewardCostInput)
42
+ cost: RewardCostInput;
43
+
44
+ @Expose()
45
+ @ValidateNested()
46
+ @Type(() => RewardChargeToInput)
47
+ chargeTo: RewardChargeToInput;
48
+
49
+ @Expose()
50
+ @IsEnum(RewardStatusEnum)
51
+ status: RewardStatusEnum;
52
+ }
@@ -0,0 +1,22 @@
1
+ import { JsonValue } from '../../../common';
2
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
3
+ import { RewardChargeTo } from '../RewardChargeTo';
4
+ import { RewardCost } from '../RewardCost';
5
+ import { RewardDependency } from '../RewardDependency';
6
+
7
+ export class CatalogItemResponse {
8
+ id: string;
9
+ name: string;
10
+ description: string;
11
+ type: string;
12
+ config: { [key: string]: JsonValue };
13
+ cost: RewardCost;
14
+ chargeTo: RewardChargeTo;
15
+ /** Solo lectura: las calcula el tipo a partir de `config`. */
16
+ dependencies: RewardDependency[];
17
+ status: RewardStatusEnum;
18
+ version: number;
19
+ updatedBy: string;
20
+ createdAt: number;
21
+ updatedAt: number;
22
+ }
@@ -0,0 +1,15 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsString, Matches } from 'class-validator';
3
+ import { REWARD_ID_PATTERN, REWARD_ITEM_KEY_PATTERN } from '../../constants/BackofficeLimits';
4
+
5
+ export class PackageItemRequest {
6
+ @Expose()
7
+ @IsString()
8
+ @Matches(REWARD_ITEM_KEY_PATTERN)
9
+ itemKey: string;
10
+
11
+ @Expose()
12
+ @IsString()
13
+ @Matches(REWARD_ID_PATTERN)
14
+ catalogItemId: string;
15
+ }
@@ -0,0 +1,7 @@
1
+ import { PackageResponse } from './PackageResponse';
2
+
3
+ export class PackageListResponse {
4
+ items: PackageResponse[];
5
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
6
+ nextCursor?: string;
7
+ }
@@ -0,0 +1,31 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { ArrayMaxSize, ArrayMinSize, IsArray, IsEnum, IsNotEmpty, IsString, Matches, MaxLength, ValidateNested } from 'class-validator';
3
+ import { REWARD_ID_PATTERN, REWARD_PACKAGE_MAX_ITEMS } from '../../constants/BackofficeLimits';
4
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
5
+ import { PackageItemRequest } from './PackageItemRequest';
6
+
7
+ export class PackageRequest {
8
+ @Expose()
9
+ @IsString()
10
+ @Matches(REWARD_ID_PATTERN)
11
+ id: string;
12
+
13
+ @Expose()
14
+ @IsString()
15
+ @IsNotEmpty()
16
+ @MaxLength(120)
17
+ name: string;
18
+
19
+ @Expose()
20
+ @IsEnum(RewardStatusEnum)
21
+ status: RewardStatusEnum;
22
+
23
+ /** Ordenada: el orden es el de ejecución. De 1 a 4 ítems (el tope depende del presupuesto de tiempo del worker, B-12; el lambda lo valida otra vez). */
24
+ @Expose()
25
+ @IsArray()
26
+ @ArrayMinSize(1)
27
+ @ArrayMaxSize(REWARD_PACKAGE_MAX_ITEMS)
28
+ @ValidateNested({ each: true })
29
+ @Type(() => PackageItemRequest)
30
+ items: PackageItemRequest[];
31
+ }
@@ -0,0 +1,20 @@
1
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
2
+ import { RewardCost } from '../RewardCost';
3
+
4
+ export class PackageItemResponse {
5
+ itemKey: string;
6
+ catalogItemId: string;
7
+ }
8
+
9
+ export class PackageResponse {
10
+ id: string;
11
+ name: string;
12
+ status: RewardStatusEnum;
13
+ version: number;
14
+ items: PackageItemResponse[];
15
+ /** Costo total declarado por moneda (spec 5.2). */
16
+ totalCost: RewardCost[];
17
+ updatedBy: string;
18
+ createdAt: number;
19
+ updatedAt: number;
20
+ }
@@ -0,0 +1,16 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsString, MaxLength } from 'class-validator';
3
+
4
+ export class RewardChargeToInput {
5
+ @Expose()
6
+ @IsString()
7
+ @IsNotEmpty()
8
+ @MaxLength(64)
9
+ partnerId: string;
10
+
11
+ @Expose()
12
+ @IsString()
13
+ @IsNotEmpty()
14
+ @MaxLength(120)
15
+ partnerName: string;
16
+ }
@@ -0,0 +1,14 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum, IsNumber, Min } from 'class-validator';
3
+ import { CurrencyId } from '../../../currency';
4
+
5
+ export class RewardCostInput {
6
+ @Expose()
7
+ @IsNumber({ maxDecimalPlaces: 2 })
8
+ @Min(0)
9
+ amount: number;
10
+
11
+ @Expose()
12
+ @IsEnum(CurrencyId)
13
+ currency: CurrencyId;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { InputField } from '../../../dynamicForm/dtos/InputField';
2
+
3
+ /** `GET /reward-types`: un tipo registrado y el formulario dinámico de su `config`. */
4
+ export class RewardTypeResponse {
5
+ type: string;
6
+ configFields: InputField[];
7
+ }
@@ -35,3 +35,18 @@ export * from './dtos/responses/PackageContractResponse';
35
35
  export * from './dtos/responses/GrantAttemptResponse';
36
36
  export * from './dtos/responses/GrantItemResponse';
37
37
  export * from './dtos/responses/GrantResponse';
38
+
39
+ //Constants backoffice
40
+ export * from './constants/BackofficeLimits';
41
+
42
+ //DTOs backoffice
43
+ export * from './dtos/backoffice/RewardCostInput';
44
+ export * from './dtos/backoffice/RewardChargeToInput';
45
+ export * from './dtos/backoffice/CatalogItemRequest';
46
+ export * from './dtos/backoffice/CatalogItemResponse';
47
+ export * from './dtos/backoffice/PackageItemRequest';
48
+ export * from './dtos/backoffice/PackageRequest';
49
+ export * from './dtos/backoffice/PackageResponse';
50
+ export * from './dtos/backoffice/RewardTypeResponse';
51
+ export * from './dtos/backoffice/CatalogItemListResponse';
52
+ export * from './dtos/backoffice/PackageListResponse';
@@ -0,0 +1,4 @@
1
+ /** Umbrales de consumo (0 a 1) que avisan a los operadores (spec B 5.6). */
2
+ export class CampaignAlerts {
3
+ thresholds: number[];
4
+ }
@@ -0,0 +1,9 @@
1
+ import { QuotaPeriodEnum } from '../enums/QuotaPeriodEnum';
2
+
3
+ /** Un cupo de campania: cantidad maxima de premios (no dinero) en un periodo (spec B 5.6). */
4
+ export class CampaignQuota {
5
+ /** Unico dentro de la campania (ej. `primeros-500`). Entra en la llave del consumo (`{id}#{periodo}`). */
6
+ id: string;
7
+ limit: number;
8
+ period: QuotaPeriodEnum;
9
+ }