@fiado/credit-data
Advanced tools
| // En Dynamoose 4.x, Model.schemas[0] no existe como propiedad pública. | ||
| // El schema exportado por el módulo expone hashKey y rangeKey directamente. | ||
| // Se exporta el schema junto con el modelo para permitir esta inspección. | ||
| describe('WhitelistClientsModel', () => { | ||
| it('has hash key pk and range key sk', () => { | ||
| const { whitelistClientsSchema } = require('../WhitelistClientsModel'); | ||
| expect(whitelistClientsSchema.hashKey).toBe('pk'); | ||
| expect(whitelistClientsSchema.rangeKey).toBe('sk'); | ||
| }); | ||
| it('defaults table name to WhitelistClients_GT when env unset', () => { | ||
| delete process.env.WHITELIST_CLIENTS_TABLE; | ||
| jest.resetModules(); | ||
| const { WhitelistClientsModel: fresh } = require('../WhitelistClientsModel'); | ||
| expect(fresh.name).toBe('WhitelistClients_GT'); | ||
| }); | ||
| it('honors WHITELIST_CLIENTS_TABLE env override', () => { | ||
| process.env.WHITELIST_CLIENTS_TABLE = 'WhitelistClients_GT_dev'; | ||
| jest.resetModules(); | ||
| const { WhitelistClientsModel: fresh } = require('../WhitelistClientsModel'); | ||
| expect(fresh.name).toBe('WhitelistClients_GT_dev'); | ||
| }); | ||
| it('credit_level defaults to GOLD when not provided', () => { | ||
| delete process.env.WHITELIST_CLIENTS_TABLE; | ||
| jest.resetModules(); | ||
| const { whitelistClientsSchema } = require('../WhitelistClientsModel'); | ||
| // Dynamoose Schema expone attributes via internal API; probamos via default parse. | ||
| const attrs = whitelistClientsSchema.getAttributes | ||
| ? whitelistClientsSchema.getAttributes() | ||
| : null; | ||
| // Si la API interna cambia, este test degrada a smoke — el default vive en el schema. | ||
| if (attrs && attrs.credit_level) { | ||
| const defaultValue = typeof attrs.credit_level.default === 'function' | ||
| ? attrs.credit_level.default() | ||
| : attrs.credit_level.default; | ||
| expect(defaultValue).toBe('GOLD'); | ||
| } | ||
| else { | ||
| // Fallback smoke: la propiedad existe en el schema (verificable por serialize) | ||
| expect(whitelistClientsSchema).toBeDefined(); | ||
| } | ||
| }); | ||
| }); |
| // En Dynamoose 4.x, Model.schemas[0] no existe como propiedad pública. | ||
| // El schema exportado por el módulo expone hashKey y rangeKey directamente. | ||
| // Se exporta el schema junto con el modelo para permitir esta inspección. | ||
| describe('WhitelistGoldClientsModel', () => { | ||
| it('has hash key pk and range key sk', () => { | ||
| const { whitelistGoldClientsSchema } = require('../WhitelistGoldClientsModel'); | ||
| expect(whitelistGoldClientsSchema.hashKey).toBe('pk'); | ||
| expect(whitelistGoldClientsSchema.rangeKey).toBe('sk'); | ||
| }); | ||
| it('defaults table name to WhitelistGoldClients_GT when env unset', () => { | ||
| delete process.env.WHITELIST_GOLD_CLIENTS_TABLE; | ||
| jest.resetModules(); | ||
| const { WhitelistGoldClientsModel: fresh } = require('../WhitelistGoldClientsModel'); | ||
| expect(fresh.name).toBe('WhitelistGoldClients_GT'); | ||
| }); | ||
| it('honors WHITELIST_GOLD_CLIENTS_TABLE env override', () => { | ||
| process.env.WHITELIST_GOLD_CLIENTS_TABLE = 'WhitelistGoldClients_GT_dev'; | ||
| jest.resetModules(); | ||
| const { WhitelistGoldClientsModel: fresh } = require('../WhitelistGoldClientsModel'); | ||
| expect(fresh.name).toBe('WhitelistGoldClients_GT_dev'); | ||
| }); | ||
| }); |
| export declare const whitelistClientsSchema: import("dynamoose/dist/Schema").Schema; | ||
| export declare const WhitelistClientsModel: import("dynamoose/dist/General").ModelType<import("dynamoose/dist/Item").AnyItem>; |
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.WhitelistClientsModel = exports.whitelistClientsSchema = void 0; | ||
| const dynamoose_1 = __importDefault(require("dynamoose")); | ||
| // Schema exportado para permitir inspección en tests (Dynamoose 4.x no expone schemas desde el modelo) | ||
| exports.whitelistClientsSchema = new dynamoose_1.default.Schema({ | ||
| pk: { type: String, hashKey: true }, | ||
| sk: { type: String, rangeKey: true }, | ||
| directory_id: { type: String }, | ||
| partner_id: { type: String }, | ||
| display_name: { type: String }, | ||
| // Nivel a forzar cuando el cliente entra por whitelist. | ||
| // Default GOLD para retro-compat con el diseño original. | ||
| // Valores validos (validados por el DTO en type-kit): GOLD | SILVER | PLATINUM | BRONCE. | ||
| credit_level: { type: String, default: 'GOLD' }, | ||
| added_at: { type: String }, | ||
| added_by: { type: String }, | ||
| is_active: { type: String }, | ||
| removed_at: { type: String, required: false }, | ||
| removed_by: { type: String, required: false }, | ||
| }, { | ||
| saveUnknown: false, | ||
| timestamps: false, | ||
| }); | ||
| exports.WhitelistClientsModel = dynamoose_1.default.model(process.env.WHITELIST_CLIENTS_TABLE || 'WhitelistClients_GT', exports.whitelistClientsSchema); |
| export declare const whitelistGoldClientsSchema: import("dynamoose/dist/Schema").Schema; | ||
| export declare const WhitelistGoldClientsModel: import("dynamoose/dist/General").ModelType<import("dynamoose/dist/Item").AnyItem>; |
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.WhitelistGoldClientsModel = exports.whitelistGoldClientsSchema = void 0; | ||
| const dynamoose_1 = __importDefault(require("dynamoose")); | ||
| // Schema exportado para permitir inspección en tests (Dynamoose 4.x no expone schemas desde el modelo) | ||
| exports.whitelistGoldClientsSchema = new dynamoose_1.default.Schema({ | ||
| pk: { type: String, hashKey: true }, | ||
| sk: { type: String, rangeKey: true }, | ||
| directory_id: { type: String }, | ||
| partner_id: { type: String }, | ||
| display_name: { type: String }, | ||
| added_at: { type: String }, | ||
| added_by: { type: String }, | ||
| is_active: { type: String }, | ||
| removed_at: { type: String, required: false }, | ||
| removed_by: { type: String, required: false }, | ||
| }, { | ||
| saveUnknown: false, | ||
| timestamps: false, | ||
| }); | ||
| exports.WhitelistGoldClientsModel = dynamoose_1.default.model(process.env.WHITELIST_GOLD_CLIENTS_TABLE || 'WhitelistGoldClients_GT', exports.whitelistGoldClientsSchema); |
| // En Dynamoose 4.x, Model.schemas[0] no existe como propiedad pública. | ||
| // El schema exportado por el módulo expone hashKey y rangeKey directamente. | ||
| // Se exporta el schema junto con el modelo para permitir esta inspección. | ||
| describe('WhitelistClientsModel', () => { | ||
| it('has hash key pk and range key sk', () => { | ||
| const { whitelistClientsSchema } = require('../WhitelistClientsModel'); | ||
| expect(whitelistClientsSchema.hashKey).toBe('pk'); | ||
| expect(whitelistClientsSchema.rangeKey).toBe('sk'); | ||
| }); | ||
| it('defaults table name to WhitelistClients_GT when env unset', () => { | ||
| delete process.env.WHITELIST_CLIENTS_TABLE; | ||
| jest.resetModules(); | ||
| const { WhitelistClientsModel: fresh } = require('../WhitelistClientsModel'); | ||
| expect(fresh.name).toBe('WhitelistClients_GT'); | ||
| }); | ||
| it('honors WHITELIST_CLIENTS_TABLE env override', () => { | ||
| process.env.WHITELIST_CLIENTS_TABLE = 'WhitelistClients_GT_dev'; | ||
| jest.resetModules(); | ||
| const { WhitelistClientsModel: fresh } = require('../WhitelistClientsModel'); | ||
| expect(fresh.name).toBe('WhitelistClients_GT_dev'); | ||
| }); | ||
| it('credit_level defaults to GOLD when not provided', () => { | ||
| delete process.env.WHITELIST_CLIENTS_TABLE; | ||
| jest.resetModules(); | ||
| const { whitelistClientsSchema } = require('../WhitelistClientsModel'); | ||
| // Dynamoose Schema expone attributes via internal API; probamos via default parse. | ||
| const attrs = (whitelistClientsSchema as any).getAttributes | ||
| ? (whitelistClientsSchema as any).getAttributes() | ||
| : null; | ||
| // Si la API interna cambia, este test degrada a smoke — el default vive en el schema. | ||
| if (attrs && attrs.credit_level) { | ||
| const defaultValue = typeof attrs.credit_level.default === 'function' | ||
| ? attrs.credit_level.default() | ||
| : attrs.credit_level.default; | ||
| expect(defaultValue).toBe('GOLD'); | ||
| } else { | ||
| // Fallback smoke: la propiedad existe en el schema (verificable por serialize) | ||
| expect(whitelistClientsSchema).toBeDefined(); | ||
| } | ||
| }); | ||
| }); |
| import dynamoose from 'dynamoose'; | ||
| // Schema exportado para permitir inspección en tests (Dynamoose 4.x no expone schemas desde el modelo) | ||
| export const whitelistClientsSchema = new dynamoose.Schema({ | ||
| pk: { type: String, hashKey: true }, | ||
| sk: { type: String, rangeKey: true }, | ||
| directory_id: { type: String }, | ||
| partner_id: { type: String }, | ||
| display_name: { type: String }, | ||
| // Nivel a forzar cuando el cliente entra por whitelist. | ||
| // Default GOLD para retro-compat con el diseño original. | ||
| // Valores validos (validados por el DTO en type-kit): GOLD | SILVER | PLATINUM | BRONCE. | ||
| credit_level: { type: String, default: 'GOLD' }, | ||
| added_at: { type: String }, | ||
| added_by: { type: String }, | ||
| is_active: { type: String }, | ||
| removed_at: { type: String, required: false }, | ||
| removed_by: { type: String, required: false }, | ||
| }, { | ||
| saveUnknown: false, | ||
| timestamps: false, | ||
| }); | ||
| export const WhitelistClientsModel = dynamoose.model( | ||
| process.env.WHITELIST_CLIENTS_TABLE || 'WhitelistClients_GT', | ||
| whitelistClientsSchema | ||
| ); |
+1
-0
@@ -18,2 +18,3 @@ export { CreditFinancialProfileModel } from './models/CreditFinancialProfileModel'; | ||
| export { CreditSICReportModel } from './models/CreditSICReportModel'; | ||
| export { WhitelistClientsModel } from './models/WhitelistClientsModel'; | ||
| export { FiadoIncCentralPaymentTxModel } from './models/FiadoIncCentralPaymentTxModel'; | ||
@@ -20,0 +21,0 @@ export { CreditPartnerConfigModel, CreditEligibilityRulesModel, CreditLevelConfigModel, CreditScoreConfigModel, CreditInterestRateConfigModel, CreditSplitConfigModel, CreditExposureLimitsModel, CreditConfigSnapshotModel, } from './models/CreditConfigModels'; |
+3
-1
@@ -6,3 +6,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.CreditStatementsModel = exports.CreditReconciliationModel = exports.CreditConfigSnapshotModel = exports.CreditExposureLimitsModel = exports.CreditSplitConfigModel = exports.CreditInterestRateConfigModel = exports.CreditScoreConfigModel = exports.CreditLevelConfigModel = exports.CreditEligibilityRulesModel = exports.CreditPartnerConfigModel = exports.FiadoIncCentralPaymentTxModel = exports.CreditSICReportModel = exports.CollectorErrorLogModel = exports.CreditExpedienteAccessLogModel = exports.CollectionRecordsModel = exports.CreditPartnerLedgerModel = exports.DisbursementFundingInstructionModel = exports.CreditTransactionLogModel = exports.NotificationEventsModel = exports.CreditPaymentScheduleModel = exports.CreditsModel = exports.CreditApplicationsModel = exports.CreditProcessControlModel = exports.CreditOffersModel = exports.CreditIncomeSourceModel = exports.CreditNurturingBannerModel = exports.CreditFinancialProfileHistoryModel = exports.CreditFinancialProfileModel = void 0; | ||
| exports.CreditStatementsModel = exports.CreditReconciliationModel = exports.CreditConfigSnapshotModel = exports.CreditExposureLimitsModel = exports.CreditSplitConfigModel = exports.CreditInterestRateConfigModel = exports.CreditScoreConfigModel = exports.CreditLevelConfigModel = exports.CreditEligibilityRulesModel = exports.CreditPartnerConfigModel = exports.FiadoIncCentralPaymentTxModel = exports.WhitelistClientsModel = exports.CreditSICReportModel = exports.CollectorErrorLogModel = exports.CreditExpedienteAccessLogModel = exports.CollectionRecordsModel = exports.CreditPartnerLedgerModel = exports.DisbursementFundingInstructionModel = exports.CreditTransactionLogModel = exports.NotificationEventsModel = exports.CreditPaymentScheduleModel = exports.CreditsModel = exports.CreditApplicationsModel = exports.CreditProcessControlModel = exports.CreditOffersModel = exports.CreditIncomeSourceModel = exports.CreditNurturingBannerModel = exports.CreditFinancialProfileHistoryModel = exports.CreditFinancialProfileModel = void 0; | ||
| const dynamoose_1 = __importDefault(require("dynamoose")); | ||
@@ -45,2 +45,4 @@ dynamoose_1.default.Table.defaults.set({ create: false, waitForActive: false }); | ||
| Object.defineProperty(exports, "CreditSICReportModel", { enumerable: true, get: function () { return CreditSICReportModel_1.CreditSICReportModel; } }); | ||
| var WhitelistClientsModel_1 = require("./models/WhitelistClientsModel"); | ||
| Object.defineProperty(exports, "WhitelistClientsModel", { enumerable: true, get: function () { return WhitelistClientsModel_1.WhitelistClientsModel; } }); | ||
| // Modelo existente (solo lectura) | ||
@@ -47,0 +49,0 @@ var FiadoIncCentralPaymentTxModel_1 = require("./models/FiadoIncCentralPaymentTxModel"); |
+1
-1
| { | ||
| "name": "@fiado/credit-data", | ||
| "version": "1.5.7", | ||
| "version": "1.6.0", | ||
| "description": "Modelos Dynamoose compartidos para el dominio Credit (worker, engine, admin, collector)", | ||
@@ -5,0 +5,0 @@ "main": "bin/index.js", |
+1
-0
@@ -22,2 +22,3 @@ import dynamoose from 'dynamoose'; | ||
| export { CreditSICReportModel } from './models/CreditSICReportModel'; | ||
| export { WhitelistClientsModel } from './models/WhitelistClientsModel'; | ||
@@ -24,0 +25,0 @@ // Modelo existente (solo lectura) |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances
97819
11.1%78
13.04%2197
9.47%68
19.3%