@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,7 @@
1
+ import { RewardInputRef } from '../types/RewardInputRef';
2
+
3
+ /** Que se pide a rewards-business al calificar: el paquete y sus inputs `itemKey -> inputKey -> valor`. */
4
+ export class EvaluationReward {
5
+ packageId: string;
6
+ inputs: Record<string, Record<string, RewardInputRef>>;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { ApprovalModeEnum } from '../enums/ApprovalModeEnum';
2
+ import { TriggerTypeEnum } from '../enums/TriggerTypeEnum';
3
+ import { PopulationRef } from './PopulationRef';
4
+
5
+ /** Disparador de una evaluacion (spec B 5.1). Una evaluacion tiene a lo sumo UN disparador `EVENT`. */
6
+ export class EvaluationTrigger {
7
+ type: TriggerTypeEnum;
8
+ approval: ApprovalModeEnum;
9
+ /** Solo `EVENT`. */
10
+ eventKey?: string;
11
+ /** Solo `CRON`: cron de 5 campos, granularidad de 15 minutos (fase 4). */
12
+ schedule?: string;
13
+ /** Solo `CRON` (fase 4). */
14
+ population?: PopulationRef;
15
+ }
@@ -0,0 +1,13 @@
1
+ import { GrantPeriodEnum } from '../enums/GrantPeriodEnum';
2
+ import { GrantPolicyModeEnum } from '../enums/GrantPolicyModeEnum';
3
+
4
+ /** Politica de frecuencia de una evaluacion (spec B 5.1). Cada modo exige su campo (lo valida el backoffice). */
5
+ export class GrantPolicy {
6
+ mode: GrantPolicyModeEnum;
7
+ /** Solo `PER_PERIOD`. */
8
+ period?: GrantPeriodEnum;
9
+ /** Solo `PER_REFERENCE`: la `key` de un input del contrato (ej. `saleId`). */
10
+ referenceInput?: string;
11
+ /** Solo `MAX_N`: tope de premios en total (>= 1). */
12
+ max?: number;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { DynamicFormValue } from '../../dynamicForm/types/DynamicFormValue';
2
+
3
+ /** Fuente de poblacion de un disparador `CRON` (fase 4) con sus params. */
4
+ export class PopulationRef {
5
+ source: string;
6
+ params: Record<string, DynamicFormValue>;
7
+ }
@@ -0,0 +1,4 @@
1
+ export enum ApprovalModeEnum {
2
+ AUTO = 'AUTO',
3
+ REQUIRED = 'REQUIRED',
4
+ }
@@ -0,0 +1,7 @@
1
+ /** Estado de publicacion del registro de reserva de un lote (spec B 5.8). */
2
+ export enum BatchPublishStateEnum {
3
+ PENDING_APPROVAL = 'PENDING_APPROVAL',
4
+ PENDING = 'PENDING',
5
+ PUBLISHED = 'PUBLISHED',
6
+ CANCELLED = 'CANCELLED',
7
+ }
@@ -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 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,8 @@
1
+ export 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,6 @@
1
+ export enum EvaluationStatusEnum {
2
+ DRAFT = 'DRAFT',
3
+ ACTIVE = 'ACTIVE',
4
+ PAUSED = 'PAUSED',
5
+ ARCHIVED = 'ARCHIVED',
6
+ }
@@ -0,0 +1,5 @@
1
+ /** Periodos validos de `GrantPolicy.period` (modo `PER_PERIOD`). */
2
+ export enum GrantPeriodEnum {
3
+ WEEK = 'WEEK',
4
+ MONTH = 'MONTH',
5
+ }
@@ -0,0 +1,11 @@
1
+ /** Politica de frecuencia de una evaluacion (spec B E5 y 5.5). */
2
+ export 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,5 @@
1
+ /** Estado de una reserva del ledger de frecuencia (spec B 5.5). */
2
+ export enum LedgerStatusEnum {
3
+ RESERVED = 'RESERVED',
4
+ RELEASED = 'RELEASED',
5
+ }
@@ -0,0 +1,7 @@
1
+ /** Que pasa al agotarse un cupo (`onExhausted`, spec B 5.6). */
2
+ export 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,7 @@
1
+ /** Periodo de un cupo de campania (spec B 5.6). `TOTAL` no se reinicia nunca. */
2
+ export enum QuotaPeriodEnum {
3
+ TOTAL = 'TOTAL',
4
+ DAY = 'DAY',
5
+ WEEK = 'WEEK',
6
+ MONTH = 'MONTH',
7
+ }
@@ -0,0 +1,5 @@
1
+ /** De donde salio el dato con el que se decidio una condicion (spec B 7.4.1). */
2
+ export enum TraceOriginEnum {
3
+ PREFETCHED = 'PREFETCHED',
4
+ RESOLVED = 'RESOLVED',
5
+ }
@@ -14,3 +14,27 @@ export * from './dtos/PostEventResponse';
14
14
  export * from './dtos/RunCounts';
15
15
  export * from './dtos/RunResultItem';
16
16
  export * from './dtos/GetRunResponse';
17
+
18
+ //Enums del dominio (campanias, evaluaciones, ledger)
19
+ export * from './enums/CampaignStatusEnum';
20
+ export * from './enums/CampaignPausedReasonEnum';
21
+ export * from './enums/EvaluationStatusEnum';
22
+ export * from './enums/GrantPolicyModeEnum';
23
+ export * from './enums/GrantPeriodEnum';
24
+ export * from './enums/QuotaPeriodEnum';
25
+ export * from './enums/QuotaExhaustedActionEnum';
26
+ export * from './enums/ApprovalModeEnum';
27
+ export * from './enums/LedgerStatusEnum';
28
+ export * from './enums/BatchPublishStateEnum';
29
+ export * from './enums/TraceOriginEnum';
30
+
31
+ //Types
32
+ export * from './types/RewardInputRef';
33
+
34
+ //DTOs de configuracion (forma guardada de campanias y evaluaciones)
35
+ export * from './dtos/GrantPolicy';
36
+ export * from './dtos/CampaignQuota';
37
+ export * from './dtos/CampaignAlerts';
38
+ export * from './dtos/PopulationRef';
39
+ export * from './dtos/EvaluationReward';
40
+ export * from './dtos/EvaluationTrigger';
@@ -0,0 +1,4 @@
1
+ import { DynamicFormValue } from '../../dynamicForm/types/DynamicFormValue';
2
+
3
+ /** Valor de un input de `reward.inputs`: constante o tomado de un input de la evaluacion (spec B 5.1). */
4
+ export type RewardInputRef = { const: DynamicFormValue } | { input: string };