@fiado/type-kit 3.511.0 → 3.513.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 (52) hide show
  1. package/_test_/unit/loanCredit/updateLoanBorrowerSciRequest.test.ts +46 -0
  2. package/_test_/unit/retailPromotions/activeSalePromotionsBySkus.test.ts +58 -0
  3. package/bin/datalakeReports/dtos/ReportDefinitionDto.d.ts +35 -0
  4. package/bin/datalakeReports/dtos/ReportDefinitionDto.js +12 -0
  5. package/bin/datalakeReports/dtos/ReportResultDto.d.ts +18 -0
  6. package/bin/datalakeReports/dtos/ReportResultDto.js +7 -0
  7. package/bin/datalakeReports/dtos/RunReportRequest.d.ts +4 -0
  8. package/bin/datalakeReports/dtos/RunReportRequest.js +21 -0
  9. package/bin/datalakeReports/enums/ReportStatusEnum.d.ts +5 -0
  10. package/bin/datalakeReports/enums/ReportStatusEnum.js +9 -0
  11. package/bin/datalakeReports/index.d.ts +4 -0
  12. package/bin/datalakeReports/index.js +22 -0
  13. package/bin/index.d.ts +1 -0
  14. package/bin/index.js +2 -1
  15. package/bin/loanCredit/dtos/requests/UpdateLoanBorrowerSciRequest.d.ts +13 -0
  16. package/bin/loanCredit/dtos/requests/UpdateLoanBorrowerSciRequest.js +46 -0
  17. package/bin/loanCredit/index.d.ts +1 -0
  18. package/bin/loanCredit/index.js +1 -0
  19. package/bin/retailCatalog/dtos/responses/GetInventorySkuResponse.d.ts +9 -0
  20. package/bin/retailCatalog/dtos/responses/InventoryLensResponse.d.ts +10 -0
  21. package/bin/retailCatalog/enums/CatalogSourceStatusEnum.d.ts +5 -0
  22. package/bin/retailCatalog/enums/CatalogSourceStatusEnum.js +9 -0
  23. package/bin/retailCatalog/index.d.ts +1 -0
  24. package/bin/retailCatalog/index.js +1 -0
  25. package/bin/retailPromotions/constants/activeSalePromotionsBySkus.d.ts +2 -0
  26. package/bin/retailPromotions/constants/activeSalePromotionsBySkus.js +5 -0
  27. package/bin/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.d.ts +17 -0
  28. package/bin/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.js +69 -0
  29. package/bin/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.d.ts +26 -0
  30. package/bin/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.js +2 -0
  31. package/bin/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.d.ts +9 -0
  32. package/bin/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.js +13 -0
  33. package/bin/retailPromotions/index.d.ts +4 -0
  34. package/bin/retailPromotions/index.js +4 -0
  35. package/package.json +1 -1
  36. package/src/datalakeReports/dtos/ReportDefinitionDto.ts +36 -0
  37. package/src/datalakeReports/dtos/ReportResultDto.ts +20 -0
  38. package/src/datalakeReports/dtos/RunReportRequest.ts +8 -0
  39. package/src/datalakeReports/enums/ReportStatusEnum.ts +5 -0
  40. package/src/datalakeReports/index.ts +7 -0
  41. package/src/index.ts +1 -0
  42. package/src/loanCredit/dtos/requests/UpdateLoanBorrowerSciRequest.ts +31 -0
  43. package/src/loanCredit/index.ts +1 -0
  44. package/src/retailCatalog/dtos/responses/GetInventorySkuResponse.ts +10 -0
  45. package/src/retailCatalog/dtos/responses/InventoryLensResponse.ts +12 -0
  46. package/src/retailCatalog/enums/CatalogSourceStatusEnum.ts +5 -0
  47. package/src/retailCatalog/index.ts +1 -0
  48. package/src/retailPromotions/constants/activeSalePromotionsBySkus.ts +2 -0
  49. package/src/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.ts +50 -0
  50. package/src/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.ts +29 -0
  51. package/src/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.ts +9 -0
  52. package/src/retailPromotions/index.ts +4 -0
@@ -0,0 +1,46 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { UpdateLoanBorrowerSciRequest } from '../../../src/loanCredit/index';
5
+ import { ClientLevelEnum } from '../../../src/loanScoring/enums/ClientLevelEnum';
6
+
7
+ const errorsOf = async (body: Record<string, unknown>): Promise<string[]> => {
8
+ const errors = await validate(plainToInstance(UpdateLoanBorrowerSciRequest, body));
9
+ return errors.map((error) => error.property);
10
+ };
11
+
12
+ const VALID = { evaluationId: '01M4C1RZ0000000000000000AA', sciScore: 64, clientLevel: ClientLevelEnum.SILVER };
13
+
14
+ describe('UpdateLoanBorrowerSciRequest', () => {
15
+ it('acepta el resultado de una evaluación', async () => {
16
+ expect(await errorsOf(VALID)).toEqual([]);
17
+ });
18
+
19
+ it('acepta NOT_ELIGIBLE: también es el nivel de la última evaluación', async () => {
20
+ expect(await errorsOf({ ...VALID, sciScore: 12, clientLevel: ClientLevelEnum.NOT_ELIGIBLE })).toEqual([]);
21
+ });
22
+
23
+ it('exige los tres campos', async () => {
24
+ expect((await errorsOf({})).sort()).toEqual(['clientLevel', 'evaluationId', 'sciScore']);
25
+ });
26
+
27
+ it('rechaza un score fuera de 0-100 o con decimales', async () => {
28
+ expect(await errorsOf({ ...VALID, sciScore: 101 })).toEqual(['sciScore']);
29
+ expect(await errorsOf({ ...VALID, sciScore: -1 })).toEqual(['sciScore']);
30
+ expect(await errorsOf({ ...VALID, sciScore: 64.5 })).toEqual(['sciScore']);
31
+ });
32
+
33
+ it('rechaza un nivel que no está en el catálogo', async () => {
34
+ expect(await errorsOf({ ...VALID, clientLevel: 'PLATINUM' })).toEqual(['clientLevel']);
35
+ });
36
+
37
+ it('rechaza un evaluationId vacío', async () => {
38
+ expect(await errorsOf({ ...VALID, evaluationId: '' })).toEqual(['evaluationId']);
39
+ });
40
+
41
+ it('exige un ULID en mayúsculas: el acreditado ordena las evaluaciones comparando ids', async () => {
42
+ expect(await errorsOf({ ...VALID, evaluationId: '01m4c1rz0000000000000000aa' })).toEqual(['evaluationId']);
43
+ expect(await errorsOf({ ...VALID, evaluationId: '3f2b8c1e-9d4a-4c1b-8e2f-1a2b3c4d5e6f' })).toEqual(['evaluationId']);
44
+ expect(await errorsOf({ ...VALID, evaluationId: '01M4C1RZ0000000000000000A' })).toEqual(['evaluationId']);
45
+ });
46
+ });
@@ -0,0 +1,58 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import {
5
+ ACTIVE_SALE_PROMOTIONS_MAX_SKUS,
6
+ ActiveSalePromotionsBySkusRequest,
7
+ SkuSalePromotionLookupStatusEnum,
8
+ } from '../../../src/retailPromotions/index';
9
+ import type { ActiveSalePromotionsBySkusResponse } from '../../../src/retailPromotions/index';
10
+ import { CatalogSourceStatusEnum } from '../../../src/retailCatalog/index';
11
+ import type { GetInventorySkuResponse, InventoryLensListItem, InventoryLensResponse } from '../../../src/retailCatalog/index';
12
+
13
+ const errorsOf = async (body: object) =>
14
+ (await validate(plainToInstance(ActiveSalePromotionsBySkusRequest, body, { excludeExtraneousValues: true }))).map((e) => e.property);
15
+
16
+ const valid = { tenantId: 'SUREKEEP', retailerId: 'ret-1', items: [{ sku: 'SKU-1', category: 'PHONE', tier: 'MID' }] };
17
+
18
+ describe('ActiveSalePromotionsBySkusRequest', () => {
19
+ it('acepta tenant, cadena, tienda opcional y SKUs con tipo y gama opcionales', async () => {
20
+ expect(await errorsOf(valid)).toEqual([]);
21
+ expect(await errorsOf({ ...valid, storeId: 'st-1', items: [{ sku: 'SKU-2' }] })).toEqual([]);
22
+ });
23
+
24
+ it('un SKU vacío no tumba el lote: se resuelve como INVALID_ID por entrada', async () => {
25
+ expect(await errorsOf({ ...valid, items: [{ sku: '' }] })).toEqual([]);
26
+ });
27
+
28
+ it.each([
29
+ ['sin tenantId', { ...valid, tenantId: undefined }, 'tenantId'],
30
+ ['sin retailerId', { ...valid, retailerId: '' }, 'retailerId'],
31
+ ['sin items', { ...valid, items: undefined }, 'items'],
32
+ ['tipo fuera del enum', { ...valid, items: [{ sku: 'A', category: 'CAR' }] }, 'items'],
33
+ ])('rechaza %s', async (_l, body, property) => {
34
+ expect(await errorsOf(body)).toContain(property);
35
+ });
36
+
37
+ it(`rechaza más de ${ACTIVE_SALE_PROMOTIONS_MAX_SKUS} SKUs`, async () => {
38
+ const items = Array.from({ length: ACTIVE_SALE_PROMOTIONS_MAX_SKUS + 1 }, (_v, i) => ({ sku: `S${i}` }));
39
+ expect(await errorsOf({ ...valid, items })).toContain('items');
40
+ });
41
+ });
42
+
43
+ describe('contratos de promos vigentes por SKU', () => {
44
+ it('una entrada por SKU con su estado y sus promos', () => {
45
+ const response: ActiveSalePromotionsBySkusResponse = {
46
+ items: [{ sku: 'SKU-1', status: SkuSalePromotionLookupStatusEnum.OK, promotions: [] }],
47
+ };
48
+ expect(Object.values(SkuSalePromotionLookupStatusEnum)).toEqual(['OK', 'UNAVAILABLE', 'INVALID_ID']);
49
+ expect(response.items[0]?.status).toBe('OK');
50
+ });
51
+
52
+ it('la ficha y el lente del catálogo llevan las promos y el estado de su fuente', () => {
53
+ const sku: Pick<GetInventorySkuResponse, 'promotions' | 'sources'> = { promotions: null, sources: { promotions: CatalogSourceStatusEnum.UNAVAILABLE } };
54
+ const row: Pick<InventoryLensListItem, 'hasPromotion' | 'promotionNames'> = { hasPromotion: true, promotionNames: ['Hot Sale'] };
55
+ const lens: Pick<InventoryLensResponse, 'sources'> = { sources: { promotions: CatalogSourceStatusEnum.OK } };
56
+ expect([sku.sources?.promotions, row.promotionNames, lens.sources?.promotions]).toEqual(['UNAVAILABLE', ['Hot Sale'], 'OK']);
57
+ });
58
+ });
@@ -0,0 +1,35 @@
1
+ export type ReportAudience = 'backoffice' | 'private' | 'public';
2
+ export type ReportParamType = 'date' | 'string' | 'int' | 'enum' | 'list' | 'boolean';
3
+ export declare class ReportParamSpecDto {
4
+ type: ReportParamType;
5
+ required?: boolean;
6
+ default?: string | number | boolean | string[];
7
+ values?: string[];
8
+ max?: number;
9
+ min?: number;
10
+ }
11
+ export declare class ReportColumnDto {
12
+ name: string;
13
+ type: 'string' | 'number' | 'date' | 'datetime' | 'boolean';
14
+ label: string;
15
+ }
16
+ export declare class ReportDefinitionDto {
17
+ /** dominio.nombre */
18
+ id: string;
19
+ version: number;
20
+ title: string;
21
+ description: string;
22
+ source: {
23
+ layer: 'gold' | 'silver';
24
+ databases: string[];
25
+ };
26
+ pii: boolean;
27
+ audiences: ReportAudience[];
28
+ permission: string;
29
+ mode: 'sync' | 'async';
30
+ cacheSeconds: number;
31
+ maxBytesScanned?: number;
32
+ params: Record<string, ReportParamSpecDto>;
33
+ principalParams: string[];
34
+ columns: ReportColumnDto[];
35
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportDefinitionDto = exports.ReportColumnDto = exports.ReportParamSpecDto = void 0;
4
+ class ReportParamSpecDto {
5
+ }
6
+ exports.ReportParamSpecDto = ReportParamSpecDto;
7
+ class ReportColumnDto {
8
+ }
9
+ exports.ReportColumnDto = ReportColumnDto;
10
+ class ReportDefinitionDto {
11
+ }
12
+ exports.ReportDefinitionDto = ReportDefinitionDto;
@@ -0,0 +1,18 @@
1
+ import { ReportStatusEnum } from "../enums/ReportStatusEnum";
2
+ import { ReportColumnDto } from "./ReportDefinitionDto";
3
+ export type ReportRow = Record<string, string | number | boolean | null>;
4
+ /** Respuesta de run y de jobs. Con status RUNNING solo vienen reportId y jobId; con FAILED, jobId y reason. */
5
+ export declare class ReportResultDto {
6
+ status: ReportStatusEnum;
7
+ reportId?: string;
8
+ version?: number;
9
+ jobId: string;
10
+ columns?: ReportColumnDto[];
11
+ rows?: ReportRow[];
12
+ rowCount?: number;
13
+ nextToken?: string;
14
+ computedAt?: string;
15
+ fromCache?: boolean;
16
+ bytesScanned?: number;
17
+ reason?: string;
18
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportResultDto = void 0;
4
+ /** Respuesta de run y de jobs. Con status RUNNING solo vienen reportId y jobId; con FAILED, jobId y reason. */
5
+ class ReportResultDto {
6
+ }
7
+ exports.ReportResultDto = ReportResultDto;
@@ -0,0 +1,4 @@
1
+ export declare class RunReportRequest {
2
+ /** Parámetros del reporte según su definición; los principalParams se ignoran (salen del token). */
3
+ params?: Record<string, unknown>;
4
+ }
@@ -0,0 +1,21 @@
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.RunReportRequest = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class RunReportRequest {
15
+ }
16
+ exports.RunReportRequest = RunReportRequest;
17
+ __decorate([
18
+ (0, class_validator_1.IsObject)(),
19
+ (0, class_validator_1.IsOptional)(),
20
+ __metadata("design:type", Object)
21
+ ], RunReportRequest.prototype, "params", void 0);
@@ -0,0 +1,5 @@
1
+ export declare enum ReportStatusEnum {
2
+ RUNNING = "RUNNING",
3
+ DONE = "DONE",
4
+ FAILED = "FAILED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportStatusEnum = void 0;
4
+ var ReportStatusEnum;
5
+ (function (ReportStatusEnum) {
6
+ ReportStatusEnum["RUNNING"] = "RUNNING";
7
+ ReportStatusEnum["DONE"] = "DONE";
8
+ ReportStatusEnum["FAILED"] = "FAILED";
9
+ })(ReportStatusEnum || (exports.ReportStatusEnum = ReportStatusEnum = {}));
@@ -0,0 +1,4 @@
1
+ export * from './enums/ReportStatusEnum';
2
+ export * from './dtos/ReportDefinitionDto';
3
+ export * from './dtos/RunReportRequest';
4
+ export * from './dtos/ReportResultDto';
@@ -0,0 +1,22 @@
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/ReportStatusEnum"), exports);
19
+ //dtos
20
+ __exportStar(require("./dtos/ReportDefinitionDto"), exports);
21
+ __exportStar(require("./dtos/RunReportRequest"), exports);
22
+ __exportStar(require("./dtos/ReportResultDto"), exports);
package/bin/index.d.ts CHANGED
@@ -123,3 +123,4 @@ export * as FileStorage from './fileStorage';
123
123
  export * as DynamicForm from './dynamicForm';
124
124
  export * as Rewards from './rewards';
125
125
  export * as RewardsEligibility from './rewardsEligibility';
126
+ export * as DatalakeReports from './datalakeReports';
package/bin/index.js CHANGED
@@ -38,7 +38,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.IssuanceBusiness = exports.Blacklist = exports.CentralPayments = exports.Helpdesk = exports.FiadoApiResponse = exports.Auth = exports.LegalDocumentsBusiness = exports.Role = exports.STPAccount = exports.RiskProfile = exports.FraudPreventionEngine = exports.BBVARst = exports.Stp = exports.BenefitCenter = exports.BankAccount = exports.P2pContact = exports.CreditContract = exports.Contract = exports.ProductCatalog = exports.ContactInfo = exports.TransactionAnalytics = exports.Transaction = exports.TransactionProcessor = exports.GenericMessage = exports.EventBridgeMessage = exports.SessionActivity = exports.NotificationMessages = exports.ServicePayment = exports.Header = exports.Identity = exports.UserTags = exports.Group = exports.File = exports.ExchangeRate = exports.Directory = exports.Currency = exports.Country = exports.Card = exports.Authentication = exports.AppContent = exports.App = exports.Offices = exports.Places = exports.Address = exports.Beneficiary = exports.Activity = exports.Biometrics = exports.MetamapConnector = exports.Account = exports.Crypto = void 0;
40
40
  exports.RetailPromotions = exports.RetailWizard = exports.RetailCustomer = exports.RetailCards = exports.RetailCatalog = exports.RetailCommission = exports.RetailOrg = exports.EmailVerification = exports.NetworkConnector = exports.Modelias = exports.TotpSecurity = exports.Passport = exports.WalletFunding = exports.Remittance = exports.PlatformRbac = exports.CognitoBackofficeConnector = exports.WhatsappConnector = exports.TwilioConnector = exports.MessagesConnector = exports.Mdm = exports.MilestoneBusiness = exports.CirculoCredito = exports.CreditStatements = exports.Sentry = exports.AiEngine = exports.Funnel = exports.TeamsConnector = exports.PlatformErrorEvents = exports.CustomerFile = exports.CreditBackoffice = exports.CreditDashboard = exports.CreditEngine = exports.Credit = exports.ComissionBusiness = exports.ReferralBusiness = exports.ZendeskMessaging = exports.NotificationWS = exports.Event = exports.PayrollBusiness = exports.Cnbv = exports.DirectorySetting = exports.InvoiceCollector = exports.Collector = exports.Pricelist = exports.Company = exports.Services = exports.AccountIssuanceBusiness = exports.AppSelectionData = exports.Device = exports.Observations = void 0;
41
- exports.RewardsEligibility = exports.Rewards = exports.DynamicForm = exports.FileStorage = exports.MoneyTransfer = exports.RetailLoan = exports.Membership = exports.WebhookBusiness = exports.PeopleBusiness = exports.UserConfirmations = exports.Collection = exports.Shipping = exports.PhoneSales = exports.Onboarding = exports.Kyc = exports.LoanScoring = exports.LoanCredit = exports.LoanCollectorAssignment = exports.LoanOfferings = exports.Shortlink = exports.LoanConfig = exports.DatalakeQuery = exports.RetailIntegration = void 0;
41
+ exports.DatalakeReports = exports.RewardsEligibility = exports.Rewards = exports.DynamicForm = exports.FileStorage = exports.MoneyTransfer = exports.RetailLoan = exports.Membership = exports.WebhookBusiness = exports.PeopleBusiness = exports.UserConfirmations = exports.Collection = exports.Shipping = exports.PhoneSales = exports.Onboarding = exports.Kyc = exports.LoanScoring = exports.LoanCredit = exports.LoanCollectorAssignment = exports.LoanOfferings = exports.Shortlink = exports.LoanConfig = exports.DatalakeQuery = exports.RetailIntegration = void 0;
42
42
  exports.Crypto = __importStar(require("./crypto"));
43
43
  exports.Account = __importStar(require("./account"));
44
44
  exports.MetamapConnector = __importStar(require("./metamapConnector"));
@@ -244,3 +244,4 @@ exports.Rewards = __importStar(require("./rewards"));
244
244
  // RewardsEligibility: contrato del validador de elegibilidad (rewards-eligibility-business) hacia los
245
245
  // servicios emisores: POST /events (request/response) y GET /runs/{id}.
246
246
  exports.RewardsEligibility = __importStar(require("./rewardsEligibility"));
247
+ exports.DatalakeReports = __importStar(require("./datalakeReports"));
@@ -0,0 +1,13 @@
1
+ import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
2
+ /**
3
+ * Body de `PUT /private/borrowers/:borrowerId/sci` (loan-credit-business): el resultado de una
4
+ * evaluación SCI que loan-scoring deja en el acreditado al terminarla.
5
+ *
6
+ * El acreditado guarda la evaluación más reciente: una que llegue después de otra más nueva no
7
+ * cambia nada. `evaluationId` es el ULID de la evaluación, así que su orden es el cronológico.
8
+ */
9
+ export declare class UpdateLoanBorrowerSciRequest {
10
+ evaluationId: string;
11
+ sciScore: number;
12
+ clientLevel: ClientLevelEnum;
13
+ }
@@ -0,0 +1,46 @@
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.UpdateLoanBorrowerSciRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const ClientLevelEnum_1 = require("../../../loanScoring/enums/ClientLevelEnum");
16
+ /** ULID canónico (Crockford base32 en mayúsculas): solo así la comparación de texto sigue al tiempo. */
17
+ const EVALUATION_ID_PATTERN = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
18
+ /**
19
+ * Body de `PUT /private/borrowers/:borrowerId/sci` (loan-credit-business): el resultado de una
20
+ * evaluación SCI que loan-scoring deja en el acreditado al terminarla.
21
+ *
22
+ * El acreditado guarda la evaluación más reciente: una que llegue después de otra más nueva no
23
+ * cambia nada. `evaluationId` es el ULID de la evaluación, así que su orden es el cronológico.
24
+ */
25
+ class UpdateLoanBorrowerSciRequest {
26
+ }
27
+ exports.UpdateLoanBorrowerSciRequest = UpdateLoanBorrowerSciRequest;
28
+ __decorate([
29
+ (0, class_transformer_1.Expose)(),
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsNotEmpty)(),
32
+ (0, class_validator_1.Matches)(EVALUATION_ID_PATTERN, { message: 'evaluationId debe ser un ULID de 26 caracteres' }),
33
+ __metadata("design:type", String)
34
+ ], UpdateLoanBorrowerSciRequest.prototype, "evaluationId", void 0);
35
+ __decorate([
36
+ (0, class_transformer_1.Expose)(),
37
+ (0, class_validator_1.IsInt)(),
38
+ (0, class_validator_1.Min)(0),
39
+ (0, class_validator_1.Max)(100),
40
+ __metadata("design:type", Number)
41
+ ], UpdateLoanBorrowerSciRequest.prototype, "sciScore", void 0);
42
+ __decorate([
43
+ (0, class_transformer_1.Expose)(),
44
+ (0, class_validator_1.IsEnum)(ClientLevelEnum_1.ClientLevelEnum),
45
+ __metadata("design:type", String)
46
+ ], UpdateLoanBorrowerSciRequest.prototype, "clientLevel", void 0);
@@ -14,6 +14,7 @@ export * from './dtos/AppliedStorePolicySnapshot';
14
14
  export * from './dtos/CandidatePlanSnapshot';
15
15
  export * from './dtos/EffectiveTermsSnapshot';
16
16
  export * from './dtos/requests/UpsertLoanBorrowerRequest';
17
+ export * from './dtos/requests/UpdateLoanBorrowerSciRequest';
17
18
  export * from './dtos/requests/OriginateLoanCreditRequest';
18
19
  export * from './dtos/requests/QuoteLoanCreditRequest';
19
20
  export * from './dtos/requests/SignLoanCreditRequest';
@@ -36,6 +36,7 @@ __exportStar(require("./dtos/CandidatePlanSnapshot"), exports);
36
36
  __exportStar(require("./dtos/EffectiveTermsSnapshot"), exports);
37
37
  // Request DTOs
38
38
  __exportStar(require("./dtos/requests/UpsertLoanBorrowerRequest"), exports);
39
+ __exportStar(require("./dtos/requests/UpdateLoanBorrowerSciRequest"), exports);
39
40
  __exportStar(require("./dtos/requests/OriginateLoanCreditRequest"), exports);
40
41
  __exportStar(require("./dtos/requests/QuoteLoanCreditRequest"), exports);
41
42
  __exportStar(require("./dtos/requests/SignLoanCreditRequest"), exports);
@@ -2,6 +2,8 @@ import type { InventoryItemStatusEnum } from '../../enums/InventoryItemStatusEnu
2
2
  import type { InventoryMovementTypeEnum } from '../../enums/InventoryMovementTypeEnum';
3
3
  import type { InventoryMovementReasonEnum } from '../../enums/InventoryMovementReasonEnum';
4
4
  import type { SkuPriceEntry } from './SkuPriceEntry';
5
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
6
+ import type { ActiveSalePromotionSummary } from '../../../retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse';
5
7
  /** Un movimiento del libro de inventario. */
6
8
  export interface InventoryMovementEntry {
7
9
  storeId: string;
@@ -36,4 +38,11 @@ export interface GetInventorySkuResponse {
36
38
  /** Vacío si el SKU se rastrea por cantidad. */
37
39
  piecesByStore: InventoryStorePieces[];
38
40
  currentPrice: SkuPriceEntry | null;
41
+ /** Promos de venta vigentes del SKU; `null` si retail-promotions no respondió. */
42
+ promotions?: ActiveSalePromotionSummary[] | null;
43
+ sources?: InventorySkuSources;
44
+ }
45
+ /** Estado de las fuentes externas de la ficha. */
46
+ export interface InventorySkuSources {
47
+ promotions: CatalogSourceStatusEnum;
39
48
  }
@@ -5,6 +5,7 @@ import type { ProductTierEnum } from '../../enums/ProductTierEnum';
5
5
  import type { InventoryLensUnavailableReasonEnum } from '../../enums/InventoryLensUnavailableReasonEnum';
6
6
  import type { InventoryTransferReasonEnum } from '../../enums/InventoryTransferReasonEnum';
7
7
  import type { ItemTypeEnum } from '../../enums/ItemTypeEnum';
8
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
8
9
  /**
9
10
  * Los contadores que la pantalla «Inventario» del Admin VL pinta arriba, siempre — los cuatro viajan
10
11
  * con cualquier `filter`, porque las tarjetas no cambian al cambiar de tab.
@@ -115,6 +116,10 @@ export interface InventoryLensListItem {
115
116
  sold30d: number;
116
117
  /** Producto físico o servicio. Ausente = PRODUCT. */
117
118
  itemType?: ItemTypeEnum;
119
+ /** Tiene al menos una promo de venta vigente; `null` si retail-promotions no respondió. */
120
+ hasPromotion?: boolean | null;
121
+ /** Nombres de sus promos de venta vigentes; `null` si retail-promotions no respondió. */
122
+ promotionNames?: string[] | null;
118
123
  }
119
124
  /** Fila del lente — el tipo depende del tab pedido. */
120
125
  export type InventoryLensItem = InventoryLensSkuItem | InventoryLensTransferSuggestion | InventoryLensListItem;
@@ -147,4 +152,9 @@ export interface InventoryLensResponse {
147
152
  unavailable?: boolean;
148
153
  /** Por qué no se pudo. Presente solo junto a `unavailable: true`. */
149
154
  reason?: InventoryLensUnavailableReasonEnum;
155
+ /** Estado de las fuentes externas; solo en el modo `list`. */
156
+ sources?: InventoryLensSources;
157
+ }
158
+ export interface InventoryLensSources {
159
+ promotions: CatalogSourceStatusEnum;
150
160
  }
@@ -0,0 +1,5 @@
1
+ /** Si una fuente externa de una respuesta del catálogo contestó (`OK`) o falló (`UNAVAILABLE`). */
2
+ export declare enum CatalogSourceStatusEnum {
3
+ OK = "OK",
4
+ UNAVAILABLE = "UNAVAILABLE"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CatalogSourceStatusEnum = void 0;
4
+ /** Si una fuente externa de una respuesta del catálogo contestó (`OK`) o falló (`UNAVAILABLE`). */
5
+ var CatalogSourceStatusEnum;
6
+ (function (CatalogSourceStatusEnum) {
7
+ CatalogSourceStatusEnum["OK"] = "OK";
8
+ CatalogSourceStatusEnum["UNAVAILABLE"] = "UNAVAILABLE";
9
+ })(CatalogSourceStatusEnum || (exports.CatalogSourceStatusEnum = CatalogSourceStatusEnum = {}));
@@ -36,6 +36,7 @@ export * from './enums/InventorySyncResultStatusEnum';
36
36
  export * from './enums/InventorySyncRejectionCodeEnum';
37
37
  export * from './enums/PriceSourceEnum';
38
38
  export * from './enums/InventoryLensPeriodEnum';
39
+ export * from './enums/CatalogSourceStatusEnum';
39
40
  export * from './dtos/ProductComponent';
40
41
  export * from './dtos/requests/ReservationLineRef';
41
42
  export * from './dtos/requests/StockLine';
@@ -60,6 +60,7 @@ __exportStar(require("./enums/InventorySyncResultStatusEnum"), exports);
60
60
  __exportStar(require("./enums/InventorySyncRejectionCodeEnum"), exports);
61
61
  __exportStar(require("./enums/PriceSourceEnum"), exports);
62
62
  __exportStar(require("./enums/InventoryLensPeriodEnum"), exports);
63
+ __exportStar(require("./enums/CatalogSourceStatusEnum"), exports);
63
64
  __exportStar(require("./dtos/ProductComponent"), exports);
64
65
  __exportStar(require("./dtos/requests/ReservationLineRef"), exports);
65
66
  __exportStar(require("./dtos/requests/StockLine"), exports);
@@ -0,0 +1,2 @@
1
+ /** Tope de SKUs por llamada a `POST /private/sale-promotions/active-by-skus`; el caller parte en bloques. */
2
+ export declare const ACTIVE_SALE_PROMOTIONS_MAX_SKUS = 100;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACTIVE_SALE_PROMOTIONS_MAX_SKUS = void 0;
4
+ /** Tope de SKUs por llamada a `POST /private/sale-promotions/active-by-skus`; el caller parte en bloques. */
5
+ exports.ACTIVE_SALE_PROMOTIONS_MAX_SKUS = 100;
@@ -0,0 +1,17 @@
1
+ import { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
2
+ import { ProductTierEnum } from '../../../retailCatalog/enums/ProductTierEnum';
3
+ /** Un SKU con su tipo y gama; sin ellos no cumple un alcance por tipo o por gama. */
4
+ export declare class ActiveSalePromotionsSkuInput {
5
+ /** Un SKU vacío no invalida el lote: sale como `INVALID_ID`. */
6
+ sku: string;
7
+ category?: ProductCategoryEnum | null;
8
+ tier?: ProductTierEnum | null;
9
+ }
10
+ /** Body de `POST /private/sale-promotions/active-by-skus` (M2M): hasta 100 SKUs; los repetidos se cuentan una vez. */
11
+ export declare class ActiveSalePromotionsBySkusRequest {
12
+ tenantId: string;
13
+ retailerId: string;
14
+ /** Con tienda, solo las promos cuyo alcance la incluye; sin ella, las de cualquier tienda. */
15
+ storeId?: string;
16
+ items: ActiveSalePromotionsSkuInput[];
17
+ }
@@ -0,0 +1,69 @@
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.ActiveSalePromotionsBySkusRequest = exports.ActiveSalePromotionsSkuInput = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const ProductCategoryEnum_1 = require("../../../retailCatalog/enums/ProductCategoryEnum");
16
+ const ProductTierEnum_1 = require("../../../retailCatalog/enums/ProductTierEnum");
17
+ const activeSalePromotionsBySkus_1 = require("../../constants/activeSalePromotionsBySkus");
18
+ /** Un SKU con su tipo y gama; sin ellos no cumple un alcance por tipo o por gama. */
19
+ class ActiveSalePromotionsSkuInput {
20
+ }
21
+ exports.ActiveSalePromotionsSkuInput = ActiveSalePromotionsSkuInput;
22
+ __decorate([
23
+ (0, class_transformer_1.Expose)(),
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], ActiveSalePromotionsSkuInput.prototype, "sku", void 0);
27
+ __decorate([
28
+ (0, class_transformer_1.Expose)(),
29
+ (0, class_validator_1.IsOptional)(),
30
+ (0, class_validator_1.IsEnum)(ProductCategoryEnum_1.ProductCategoryEnum),
31
+ __metadata("design:type", String)
32
+ ], ActiveSalePromotionsSkuInput.prototype, "category", void 0);
33
+ __decorate([
34
+ (0, class_transformer_1.Expose)(),
35
+ (0, class_validator_1.IsOptional)(),
36
+ (0, class_validator_1.IsEnum)(ProductTierEnum_1.ProductTierEnum),
37
+ __metadata("design:type", String)
38
+ ], ActiveSalePromotionsSkuInput.prototype, "tier", void 0);
39
+ /** Body de `POST /private/sale-promotions/active-by-skus` (M2M): hasta 100 SKUs; los repetidos se cuentan una vez. */
40
+ class ActiveSalePromotionsBySkusRequest {
41
+ }
42
+ exports.ActiveSalePromotionsBySkusRequest = ActiveSalePromotionsBySkusRequest;
43
+ __decorate([
44
+ (0, class_transformer_1.Expose)(),
45
+ (0, class_validator_1.IsString)(),
46
+ (0, class_validator_1.IsNotEmpty)(),
47
+ __metadata("design:type", String)
48
+ ], ActiveSalePromotionsBySkusRequest.prototype, "tenantId", void 0);
49
+ __decorate([
50
+ (0, class_transformer_1.Expose)(),
51
+ (0, class_validator_1.IsString)(),
52
+ (0, class_validator_1.IsNotEmpty)(),
53
+ __metadata("design:type", String)
54
+ ], ActiveSalePromotionsBySkusRequest.prototype, "retailerId", void 0);
55
+ __decorate([
56
+ (0, class_transformer_1.Expose)(),
57
+ (0, class_validator_1.IsOptional)(),
58
+ (0, class_validator_1.IsString)(),
59
+ (0, class_validator_1.IsNotEmpty)(),
60
+ __metadata("design:type", String)
61
+ ], ActiveSalePromotionsBySkusRequest.prototype, "storeId", void 0);
62
+ __decorate([
63
+ (0, class_transformer_1.Expose)(),
64
+ (0, class_validator_1.IsArray)(),
65
+ (0, class_validator_1.ArrayMaxSize)(activeSalePromotionsBySkus_1.ACTIVE_SALE_PROMOTIONS_MAX_SKUS),
66
+ (0, class_validator_1.ValidateNested)({ each: true }),
67
+ (0, class_transformer_1.Type)(() => ActiveSalePromotionsSkuInput),
68
+ __metadata("design:type", Array)
69
+ ], ActiveSalePromotionsBySkusRequest.prototype, "items", void 0);
@@ -0,0 +1,26 @@
1
+ import type { SalePromotionLevers, SalePromotionScope, SalePromotionSegmentation } from '../SalePromotionLevers';
2
+ import type { SkuSalePromotionLookupStatusEnum } from '../../enums/SkuSalePromotionLookupStatusEnum';
3
+ /** Promo de venta vigente hoy que alcanza al SKU, con su contenido de la versión actual. */
4
+ export interface ActiveSalePromotionSummary {
5
+ promotionId: string;
6
+ name: string;
7
+ /** Palancas en español: «$500 de descuento + 3× $50 de tiempo aire + $300 al Wallet Fiado». */
8
+ benefitSummary: string;
9
+ levers: SalePromotionLevers;
10
+ /** `null` = arrancó al publicarse. */
11
+ validFrom: string | null;
12
+ /** `null` = permanente. */
13
+ validUntil: string | null;
14
+ segmentation: SalePromotionSegmentation;
15
+ scope: SalePromotionScope;
16
+ }
17
+ export interface SkuActiveSalePromotions {
18
+ sku: string;
19
+ status: SkuSalePromotionLookupStatusEnum;
20
+ /** Vacío si no tiene ninguna o si el estado no es `OK`. */
21
+ promotions: ActiveSalePromotionSummary[];
22
+ }
23
+ /** Response de `POST /private/sale-promotions/active-by-skus`: una entrada por SKU, en el orden pedido. */
24
+ export interface ActiveSalePromotionsBySkusResponse {
25
+ items: SkuActiveSalePromotions[];
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /** Cómo se resolvió cada SKU del lote de promos vigentes; hay una entrada por SKU pedido. */
2
+ export declare enum SkuSalePromotionLookupStatusEnum {
3
+ /** Se leyeron las promos; `promotions` vacío es un dato: no tiene ninguna vigente. */
4
+ OK = "OK",
5
+ /** No se pudieron leer las promos; el caller lo pinta como fuente caída y reintenta. */
6
+ UNAVAILABLE = "UNAVAILABLE",
7
+ /** El SKU no tiene forma de SKU; reintentarlo igual nunca sirve. */
8
+ INVALID_ID = "INVALID_ID"
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SkuSalePromotionLookupStatusEnum = void 0;
4
+ /** Cómo se resolvió cada SKU del lote de promos vigentes; hay una entrada por SKU pedido. */
5
+ var SkuSalePromotionLookupStatusEnum;
6
+ (function (SkuSalePromotionLookupStatusEnum) {
7
+ /** Se leyeron las promos; `promotions` vacío es un dato: no tiene ninguna vigente. */
8
+ SkuSalePromotionLookupStatusEnum["OK"] = "OK";
9
+ /** No se pudieron leer las promos; el caller lo pinta como fuente caída y reintenta. */
10
+ SkuSalePromotionLookupStatusEnum["UNAVAILABLE"] = "UNAVAILABLE";
11
+ /** El SKU no tiene forma de SKU; reintentarlo igual nunca sirve. */
12
+ SkuSalePromotionLookupStatusEnum["INVALID_ID"] = "INVALID_ID";
13
+ })(SkuSalePromotionLookupStatusEnum || (exports.SkuSalePromotionLookupStatusEnum = SkuSalePromotionLookupStatusEnum = {}));
@@ -17,9 +17,11 @@ export * from './enums/EntitlementKindEnum';
17
17
  export * from './enums/SaleCouponAvailabilityEnum';
18
18
  export * from './enums/RetailPromotionsErrorCodeEnum';
19
19
  export * from './enums/SalePromotionKindEnum';
20
+ export * from './enums/SkuSalePromotionLookupStatusEnum';
20
21
  export * from './constants/retailPromotionsErrorHttpStatus';
21
22
  export * from './constants/salePromotionTransitions';
22
23
  export * from './constants/bonusPreMoney';
24
+ export * from './constants/activeSalePromotionsBySkus';
23
25
  export * from './helpers/resolveSalePromotionTransition';
24
26
  export * from './helpers/computeBudgetUsedBps';
25
27
  export * from './helpers/resolveSalePromotionKind';
@@ -50,8 +52,10 @@ export * from './dtos/requests/HoldPromotionInput';
50
52
  export * from './dtos/requests/HoldSalePromotionRequest';
51
53
  export * from './dtos/requests/GetSaleCouponQuery';
52
54
  export * from './dtos/requests/SkuSalePromotionsQuery';
55
+ export * from './dtos/requests/ActiveSalePromotionsBySkusRequest';
53
56
  export * from './dtos/responses/SalePromotionCrudResponses';
54
57
  export * from './dtos/responses/DiscountCodeResponses';
55
58
  export * from './dtos/responses/WizardSalePromotionResponses';
56
59
  export * from './dtos/responses/SkuSalePromotionsResponse';
57
60
  export * from './dtos/responses/SalePromotionSegmentsResponse';
61
+ export * from './dtos/responses/ActiveSalePromotionsBySkusResponse';
@@ -34,10 +34,12 @@ __exportStar(require("./enums/EntitlementKindEnum"), exports);
34
34
  __exportStar(require("./enums/SaleCouponAvailabilityEnum"), exports);
35
35
  __exportStar(require("./enums/RetailPromotionsErrorCodeEnum"), exports);
36
36
  __exportStar(require("./enums/SalePromotionKindEnum"), exports);
37
+ __exportStar(require("./enums/SkuSalePromotionLookupStatusEnum"), exports);
37
38
  // Constantes y helpers puros
38
39
  __exportStar(require("./constants/retailPromotionsErrorHttpStatus"), exports);
39
40
  __exportStar(require("./constants/salePromotionTransitions"), exports);
40
41
  __exportStar(require("./constants/bonusPreMoney"), exports);
42
+ __exportStar(require("./constants/activeSalePromotionsBySkus"), exports);
41
43
  __exportStar(require("./helpers/resolveSalePromotionTransition"), exports);
42
44
  __exportStar(require("./helpers/computeBudgetUsedBps"), exports);
43
45
  __exportStar(require("./helpers/resolveSalePromotionKind"), exports);
@@ -71,9 +73,11 @@ __exportStar(require("./dtos/requests/HoldPromotionInput"), exports);
71
73
  __exportStar(require("./dtos/requests/HoldSalePromotionRequest"), exports);
72
74
  __exportStar(require("./dtos/requests/GetSaleCouponQuery"), exports);
73
75
  __exportStar(require("./dtos/requests/SkuSalePromotionsQuery"), exports);
76
+ __exportStar(require("./dtos/requests/ActiveSalePromotionsBySkusRequest"), exports);
74
77
  // Response DTOs
75
78
  __exportStar(require("./dtos/responses/SalePromotionCrudResponses"), exports);
76
79
  __exportStar(require("./dtos/responses/DiscountCodeResponses"), exports);
77
80
  __exportStar(require("./dtos/responses/WizardSalePromotionResponses"), exports);
78
81
  __exportStar(require("./dtos/responses/SkuSalePromotionsResponse"), exports);
79
82
  __exportStar(require("./dtos/responses/SalePromotionSegmentsResponse"), exports);
83
+ __exportStar(require("./dtos/responses/ActiveSalePromotionsBySkusResponse"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.511.0",
3
+ "version": "3.513.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,36 @@
1
+ // Definición de un reporte del datalake (datalake-reports-business). Respuesta: sin validadores.
2
+ export type ReportAudience = 'backoffice' | 'private' | 'public';
3
+ export type ReportParamType = 'date' | 'string' | 'int' | 'enum' | 'list' | 'boolean';
4
+
5
+ export class ReportParamSpecDto {
6
+ type: ReportParamType;
7
+ required?: boolean;
8
+ default?: string | number | boolean | string[];
9
+ values?: string[];
10
+ max?: number;
11
+ min?: number;
12
+ }
13
+
14
+ export class ReportColumnDto {
15
+ name: string;
16
+ type: 'string' | 'number' | 'date' | 'datetime' | 'boolean';
17
+ label: string;
18
+ }
19
+
20
+ export class ReportDefinitionDto {
21
+ /** dominio.nombre */
22
+ id: string;
23
+ version: number;
24
+ title: string;
25
+ description: string;
26
+ source: { layer: 'gold' | 'silver'; databases: string[] };
27
+ pii: boolean;
28
+ audiences: ReportAudience[];
29
+ permission: string;
30
+ mode: 'sync' | 'async';
31
+ cacheSeconds: number;
32
+ maxBytesScanned?: number;
33
+ params: Record<string, ReportParamSpecDto>;
34
+ principalParams: string[];
35
+ columns: ReportColumnDto[];
36
+ }
@@ -0,0 +1,20 @@
1
+ import { ReportStatusEnum } from "../enums/ReportStatusEnum";
2
+ import { ReportColumnDto } from "./ReportDefinitionDto";
3
+
4
+ export type ReportRow = Record<string, string | number | boolean | null>;
5
+
6
+ /** Respuesta de run y de jobs. Con status RUNNING solo vienen reportId y jobId; con FAILED, jobId y reason. */
7
+ export class ReportResultDto {
8
+ status: ReportStatusEnum;
9
+ reportId?: string;
10
+ version?: number;
11
+ jobId: string;
12
+ columns?: ReportColumnDto[];
13
+ rows?: ReportRow[];
14
+ rowCount?: number;
15
+ nextToken?: string;
16
+ computedAt?: string;
17
+ fromCache?: boolean;
18
+ bytesScanned?: number;
19
+ reason?: string;
20
+ }
@@ -0,0 +1,8 @@
1
+ import { IsObject, IsOptional } from "class-validator";
2
+
3
+ export class RunReportRequest {
4
+ /** Parámetros del reporte según su definición; los principalParams se ignoran (salen del token). */
5
+ @IsObject()
6
+ @IsOptional()
7
+ params?: Record<string, unknown>;
8
+ }
@@ -0,0 +1,5 @@
1
+ export enum ReportStatusEnum {
2
+ RUNNING = 'RUNNING',
3
+ DONE = 'DONE',
4
+ FAILED = 'FAILED',
5
+ }
@@ -0,0 +1,7 @@
1
+ //enums
2
+ export * from './enums/ReportStatusEnum';
3
+
4
+ //dtos
5
+ export * from './dtos/ReportDefinitionDto';
6
+ export * from './dtos/RunReportRequest';
7
+ export * from './dtos/ReportResultDto';
package/src/index.ts CHANGED
@@ -207,3 +207,4 @@ export * as Rewards from './rewards';
207
207
  // RewardsEligibility: contrato del validador de elegibilidad (rewards-eligibility-business) hacia los
208
208
  // servicios emisores: POST /events (request/response) y GET /runs/{id}.
209
209
  export * as RewardsEligibility from './rewardsEligibility';
210
+ export * as DatalakeReports from './datalakeReports';
@@ -0,0 +1,31 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum, IsInt, IsNotEmpty, IsString, Matches, Max, Min } from 'class-validator';
3
+ import { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
4
+
5
+ /** ULID canónico (Crockford base32 en mayúsculas): solo así la comparación de texto sigue al tiempo. */
6
+ const EVALUATION_ID_PATTERN = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
7
+
8
+ /**
9
+ * Body de `PUT /private/borrowers/:borrowerId/sci` (loan-credit-business): el resultado de una
10
+ * evaluación SCI que loan-scoring deja en el acreditado al terminarla.
11
+ *
12
+ * El acreditado guarda la evaluación más reciente: una que llegue después de otra más nueva no
13
+ * cambia nada. `evaluationId` es el ULID de la evaluación, así que su orden es el cronológico.
14
+ */
15
+ export class UpdateLoanBorrowerSciRequest {
16
+ @Expose()
17
+ @IsString()
18
+ @IsNotEmpty()
19
+ @Matches(EVALUATION_ID_PATTERN, { message: 'evaluationId debe ser un ULID de 26 caracteres' })
20
+ evaluationId!: string;
21
+
22
+ @Expose()
23
+ @IsInt()
24
+ @Min(0)
25
+ @Max(100)
26
+ sciScore!: number;
27
+
28
+ @Expose()
29
+ @IsEnum(ClientLevelEnum)
30
+ clientLevel!: ClientLevelEnum;
31
+ }
@@ -20,6 +20,7 @@ export * from './dtos/EffectiveTermsSnapshot';
20
20
 
21
21
  // Request DTOs
22
22
  export * from './dtos/requests/UpsertLoanBorrowerRequest';
23
+ export * from './dtos/requests/UpdateLoanBorrowerSciRequest';
23
24
  export * from './dtos/requests/OriginateLoanCreditRequest';
24
25
  export * from './dtos/requests/QuoteLoanCreditRequest';
25
26
  export * from './dtos/requests/SignLoanCreditRequest';
@@ -2,6 +2,8 @@ import type { InventoryItemStatusEnum } from '../../enums/InventoryItemStatusEnu
2
2
  import type { InventoryMovementTypeEnum } from '../../enums/InventoryMovementTypeEnum';
3
3
  import type { InventoryMovementReasonEnum } from '../../enums/InventoryMovementReasonEnum';
4
4
  import type { SkuPriceEntry } from './SkuPriceEntry';
5
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
6
+ import type { ActiveSalePromotionSummary } from '../../../retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse';
5
7
 
6
8
  /** Un movimiento del libro de inventario. */
7
9
  export interface InventoryMovementEntry {
@@ -40,4 +42,12 @@ export interface GetInventorySkuResponse {
40
42
  /** Vacío si el SKU se rastrea por cantidad. */
41
43
  piecesByStore: InventoryStorePieces[];
42
44
  currentPrice: SkuPriceEntry | null;
45
+ /** Promos de venta vigentes del SKU; `null` si retail-promotions no respondió. */
46
+ promotions?: ActiveSalePromotionSummary[] | null;
47
+ sources?: InventorySkuSources;
48
+ }
49
+
50
+ /** Estado de las fuentes externas de la ficha. */
51
+ export interface InventorySkuSources {
52
+ promotions: CatalogSourceStatusEnum;
43
53
  }
@@ -5,6 +5,7 @@ import type { ProductTierEnum } from '../../enums/ProductTierEnum';
5
5
  import type { InventoryLensUnavailableReasonEnum } from '../../enums/InventoryLensUnavailableReasonEnum';
6
6
  import type { InventoryTransferReasonEnum } from '../../enums/InventoryTransferReasonEnum';
7
7
  import type { ItemTypeEnum } from '../../enums/ItemTypeEnum';
8
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
8
9
 
9
10
  /**
10
11
  * Los contadores que la pantalla «Inventario» del Admin VL pinta arriba, siempre — los cuatro viajan
@@ -130,6 +131,10 @@ export interface InventoryLensListItem {
130
131
  sold30d: number;
131
132
  /** Producto físico o servicio. Ausente = PRODUCT. */
132
133
  itemType?: ItemTypeEnum;
134
+ /** Tiene al menos una promo de venta vigente; `null` si retail-promotions no respondió. */
135
+ hasPromotion?: boolean | null;
136
+ /** Nombres de sus promos de venta vigentes; `null` si retail-promotions no respondió. */
137
+ promotionNames?: string[] | null;
133
138
  }
134
139
 
135
140
  /** Fila del lente — el tipo depende del tab pedido. */
@@ -169,4 +174,11 @@ export interface InventoryLensResponse {
169
174
 
170
175
  /** Por qué no se pudo. Presente solo junto a `unavailable: true`. */
171
176
  reason?: InventoryLensUnavailableReasonEnum;
177
+
178
+ /** Estado de las fuentes externas; solo en el modo `list`. */
179
+ sources?: InventoryLensSources;
180
+ }
181
+
182
+ export interface InventoryLensSources {
183
+ promotions: CatalogSourceStatusEnum;
172
184
  }
@@ -0,0 +1,5 @@
1
+ /** Si una fuente externa de una respuesta del catálogo contestó (`OK`) o falló (`UNAVAILABLE`). */
2
+ export enum CatalogSourceStatusEnum {
3
+ OK = 'OK',
4
+ UNAVAILABLE = 'UNAVAILABLE',
5
+ }
@@ -52,6 +52,7 @@ export * from './enums/InventorySyncResultStatusEnum';
52
52
  export * from './enums/InventorySyncRejectionCodeEnum';
53
53
  export * from './enums/PriceSourceEnum';
54
54
  export * from './enums/InventoryLensPeriodEnum';
55
+ export * from './enums/CatalogSourceStatusEnum';
55
56
  export * from './dtos/ProductComponent';
56
57
  export * from './dtos/requests/ReservationLineRef';
57
58
  export * from './dtos/requests/StockLine';
@@ -0,0 +1,2 @@
1
+ /** Tope de SKUs por llamada a `POST /private/sale-promotions/active-by-skus`; el caller parte en bloques. */
2
+ export const ACTIVE_SALE_PROMOTIONS_MAX_SKUS = 100;
@@ -0,0 +1,50 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { ArrayMaxSize, IsArray, IsEnum, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator';
3
+ import { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
4
+ import { ProductTierEnum } from '../../../retailCatalog/enums/ProductTierEnum';
5
+ import { ACTIVE_SALE_PROMOTIONS_MAX_SKUS } from '../../constants/activeSalePromotionsBySkus';
6
+
7
+ /** Un SKU con su tipo y gama; sin ellos no cumple un alcance por tipo o por gama. */
8
+ export class ActiveSalePromotionsSkuInput {
9
+ /** Un SKU vacío no invalida el lote: sale como `INVALID_ID`. */
10
+ @Expose()
11
+ @IsString()
12
+ sku!: string;
13
+
14
+ @Expose()
15
+ @IsOptional()
16
+ @IsEnum(ProductCategoryEnum)
17
+ category?: ProductCategoryEnum | null;
18
+
19
+ @Expose()
20
+ @IsOptional()
21
+ @IsEnum(ProductTierEnum)
22
+ tier?: ProductTierEnum | null;
23
+ }
24
+
25
+ /** Body de `POST /private/sale-promotions/active-by-skus` (M2M): hasta 100 SKUs; los repetidos se cuentan una vez. */
26
+ export class ActiveSalePromotionsBySkusRequest {
27
+ @Expose()
28
+ @IsString()
29
+ @IsNotEmpty()
30
+ tenantId!: string;
31
+
32
+ @Expose()
33
+ @IsString()
34
+ @IsNotEmpty()
35
+ retailerId!: string;
36
+
37
+ /** Con tienda, solo las promos cuyo alcance la incluye; sin ella, las de cualquier tienda. */
38
+ @Expose()
39
+ @IsOptional()
40
+ @IsString()
41
+ @IsNotEmpty()
42
+ storeId?: string;
43
+
44
+ @Expose()
45
+ @IsArray()
46
+ @ArrayMaxSize(ACTIVE_SALE_PROMOTIONS_MAX_SKUS)
47
+ @ValidateNested({ each: true })
48
+ @Type(() => ActiveSalePromotionsSkuInput)
49
+ items!: ActiveSalePromotionsSkuInput[];
50
+ }
@@ -0,0 +1,29 @@
1
+ import type { SalePromotionLevers, SalePromotionScope, SalePromotionSegmentation } from '../SalePromotionLevers';
2
+ import type { SkuSalePromotionLookupStatusEnum } from '../../enums/SkuSalePromotionLookupStatusEnum';
3
+
4
+ /** Promo de venta vigente hoy que alcanza al SKU, con su contenido de la versión actual. */
5
+ export interface ActiveSalePromotionSummary {
6
+ promotionId: string;
7
+ name: string;
8
+ /** Palancas en español: «$500 de descuento + 3× $50 de tiempo aire + $300 al Wallet Fiado». */
9
+ benefitSummary: string;
10
+ levers: SalePromotionLevers;
11
+ /** `null` = arrancó al publicarse. */
12
+ validFrom: string | null;
13
+ /** `null` = permanente. */
14
+ validUntil: string | null;
15
+ segmentation: SalePromotionSegmentation;
16
+ scope: SalePromotionScope;
17
+ }
18
+
19
+ export interface SkuActiveSalePromotions {
20
+ sku: string;
21
+ status: SkuSalePromotionLookupStatusEnum;
22
+ /** Vacío si no tiene ninguna o si el estado no es `OK`. */
23
+ promotions: ActiveSalePromotionSummary[];
24
+ }
25
+
26
+ /** Response de `POST /private/sale-promotions/active-by-skus`: una entrada por SKU, en el orden pedido. */
27
+ export interface ActiveSalePromotionsBySkusResponse {
28
+ items: SkuActiveSalePromotions[];
29
+ }
@@ -0,0 +1,9 @@
1
+ /** Cómo se resolvió cada SKU del lote de promos vigentes; hay una entrada por SKU pedido. */
2
+ export enum SkuSalePromotionLookupStatusEnum {
3
+ /** Se leyeron las promos; `promotions` vacío es un dato: no tiene ninguna vigente. */
4
+ OK = 'OK',
5
+ /** No se pudieron leer las promos; el caller lo pinta como fuente caída y reintenta. */
6
+ UNAVAILABLE = 'UNAVAILABLE',
7
+ /** El SKU no tiene forma de SKU; reintentarlo igual nunca sirve. */
8
+ INVALID_ID = 'INVALID_ID',
9
+ }
@@ -18,11 +18,13 @@ export * from './enums/EntitlementKindEnum';
18
18
  export * from './enums/SaleCouponAvailabilityEnum';
19
19
  export * from './enums/RetailPromotionsErrorCodeEnum';
20
20
  export * from './enums/SalePromotionKindEnum';
21
+ export * from './enums/SkuSalePromotionLookupStatusEnum';
21
22
 
22
23
  // Constantes y helpers puros
23
24
  export * from './constants/retailPromotionsErrorHttpStatus';
24
25
  export * from './constants/salePromotionTransitions';
25
26
  export * from './constants/bonusPreMoney';
27
+ export * from './constants/activeSalePromotionsBySkus';
26
28
  export * from './helpers/resolveSalePromotionTransition';
27
29
  export * from './helpers/computeBudgetUsedBps';
28
30
  export * from './helpers/resolveSalePromotionKind';
@@ -59,6 +61,7 @@ export * from './dtos/requests/HoldPromotionInput';
59
61
  export * from './dtos/requests/HoldSalePromotionRequest';
60
62
  export * from './dtos/requests/GetSaleCouponQuery';
61
63
  export * from './dtos/requests/SkuSalePromotionsQuery';
64
+ export * from './dtos/requests/ActiveSalePromotionsBySkusRequest';
62
65
 
63
66
  // Response DTOs
64
67
  export * from './dtos/responses/SalePromotionCrudResponses';
@@ -66,3 +69,4 @@ export * from './dtos/responses/DiscountCodeResponses';
66
69
  export * from './dtos/responses/WizardSalePromotionResponses';
67
70
  export * from './dtos/responses/SkuSalePromotionsResponse';
68
71
  export * from './dtos/responses/SalePromotionSegmentsResponse';
72
+ export * from './dtos/responses/ActiveSalePromotionsBySkusResponse';