wsp-ms-core 1.0.67 → 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +183 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +66 -2
- package/dist/index.d.ts +66 -2
- package/dist/index.js +181 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,11 +42,13 @@ __export(src_exports, {
|
|
|
42
42
|
ErrorManager: () => ErrorManager,
|
|
43
43
|
EventBus: () => EventBus,
|
|
44
44
|
EventBusMysqlRepository: () => EventBusMysqlRepository,
|
|
45
|
+
EventManager: () => EventManager,
|
|
45
46
|
ExchangeRates: () => ExchangeRates,
|
|
46
47
|
FatalError: () => FatalError,
|
|
47
48
|
HttpHealthCheckController: () => HttpHealthCheckController,
|
|
48
49
|
HttpNotFoundController: () => HttpNotFoundController,
|
|
49
50
|
InternalError: () => InternalError,
|
|
51
|
+
KafkaManager: () => KafkaManager,
|
|
50
52
|
Language: () => Language,
|
|
51
53
|
MysqlConnection: () => MysqlConnection,
|
|
52
54
|
MysqlConnector: () => MysqlConnector,
|
|
@@ -257,7 +259,7 @@ var _UUID = class _UUID extends ValueObject {
|
|
|
257
259
|
return { value: this.value };
|
|
258
260
|
}
|
|
259
261
|
static create(uuid) {
|
|
260
|
-
return new _UUID(uuid
|
|
262
|
+
return new _UUID(uuid ?? crypto.randomUUID());
|
|
261
263
|
}
|
|
262
264
|
static version(uuid) {
|
|
263
265
|
const m = /^[0-9a-f]{8}-[0-9a-f]{4}-([1-8])[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.exec(uuid);
|
|
@@ -270,9 +272,8 @@ var _UUID = class _UUID extends ValueObject {
|
|
|
270
272
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(uuid);
|
|
271
273
|
}
|
|
272
274
|
static isValid(uuid, opts = {}) {
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
const allowNil = (_b = opts.allowNil) != null ? _b : false;
|
|
275
|
+
const allowed = opts.allowedVersions ?? [1, 2, 3, 4, 5, 6, 7, 8];
|
|
276
|
+
const allowNil = opts.allowNil ?? false;
|
|
276
277
|
if (allowNil && _UUID.isNil(uuid))
|
|
277
278
|
return true;
|
|
278
279
|
if (!_UUID.isRFCStyle(uuid))
|
|
@@ -381,7 +382,6 @@ var DomainEvent = class _DomainEvent {
|
|
|
381
382
|
this._errorMessage = error;
|
|
382
383
|
}
|
|
383
384
|
toPrimitives() {
|
|
384
|
-
var _a, _b, _c, _d, _e;
|
|
385
385
|
return {
|
|
386
386
|
eventUuid: this.eventUuid.value,
|
|
387
387
|
eventType: this.eventType,
|
|
@@ -392,14 +392,13 @@ var DomainEvent = class _DomainEvent {
|
|
|
392
392
|
payload: this.payload,
|
|
393
393
|
status: this.status.value,
|
|
394
394
|
attempts: this.attempts,
|
|
395
|
-
errorMessage:
|
|
396
|
-
publishedAt:
|
|
397
|
-
lastAttempt:
|
|
395
|
+
errorMessage: this.errorMessage ?? void 0,
|
|
396
|
+
publishedAt: this.publishedAt?.value ?? void 0,
|
|
397
|
+
lastAttempt: this.lastAttempt?.value ?? void 0,
|
|
398
398
|
createdAt: this.createdAt.value
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
401
|
static reconstitute(data) {
|
|
402
|
-
var _a;
|
|
403
402
|
return new _DomainEvent(
|
|
404
403
|
UUID.create(data.event_uuid),
|
|
405
404
|
String(data.event_type),
|
|
@@ -410,7 +409,7 @@ var DomainEvent = class _DomainEvent {
|
|
|
410
409
|
String(data.payload),
|
|
411
410
|
DomainEventStatus.create(data.status),
|
|
412
411
|
Number(data.attempts),
|
|
413
|
-
|
|
412
|
+
data.error_message ?? void 0,
|
|
414
413
|
data.published_at ? DateTime.create(data.published_at) : void 0,
|
|
415
414
|
data.last_attempt ? DateTime.create(data.last_attempt) : void 0,
|
|
416
415
|
data.created_at ? DateTime.create(data.created_at) : void 0
|
|
@@ -649,38 +648,33 @@ var _ErrorManager = class _ErrorManager {
|
|
|
649
648
|
return _ErrorManager.DEFAULT_MESSAGES[lang.value] || _ErrorManager.DEFAULT_MESSAGES[lang.base()] || "error";
|
|
650
649
|
}
|
|
651
650
|
onFatal(err, lang) {
|
|
652
|
-
|
|
653
|
-
(_a = this.logger) == null ? void 0 : _a.fatal(err.type, err.message);
|
|
651
|
+
this.logger?.fatal(err.type, err.message);
|
|
654
652
|
return { status: "ERROR", message: this.getDefaultMessage(lang) };
|
|
655
653
|
}
|
|
656
654
|
onInternal(err, lang) {
|
|
657
|
-
|
|
658
|
-
(_a = this.logger) == null ? void 0 : _a.error(err.type, err.message);
|
|
655
|
+
this.logger?.error(err.type, err.message);
|
|
659
656
|
return { status: "ERROR", message: this.getDefaultMessage(lang) };
|
|
660
657
|
}
|
|
661
658
|
onUsage(err, lang) {
|
|
662
|
-
var _a, _b, _c;
|
|
663
659
|
const tmpl = _ErrorManager.TEMPLATES.get(err.type);
|
|
664
660
|
if (!tmpl) {
|
|
665
|
-
|
|
661
|
+
this.logger?.error("TEMPLATE_NOT_FOUND", `${err.type}`);
|
|
666
662
|
return { status: "ERROR", message: this.getDefaultMessage(lang) };
|
|
667
663
|
}
|
|
668
664
|
const code = lang.value;
|
|
669
665
|
const base = lang.base();
|
|
670
|
-
const rawMsg =
|
|
666
|
+
const rawMsg = tmpl.languages[code] ?? tmpl.languages[base] ?? this.getDefaultMessage(lang);
|
|
671
667
|
return {
|
|
672
668
|
status: 400,
|
|
673
669
|
message: StringVars.parse(rawMsg, err.vars)
|
|
674
670
|
};
|
|
675
671
|
}
|
|
676
672
|
onUnknown(err, lang) {
|
|
677
|
-
|
|
678
|
-
(_a = this.logger) == null ? void 0 : _a.error("UNKNOWN_ERROR", err.message);
|
|
673
|
+
this.logger?.error("UNKNOWN_ERROR", err.message);
|
|
679
674
|
return { status: "ERROR", message: this.getDefaultMessage(lang) };
|
|
680
675
|
}
|
|
681
676
|
handle(err, lang) {
|
|
682
|
-
|
|
683
|
-
if (["local", "dev"].includes((_a = process.env.ENVIRONMENT) != null ? _a : "")) {
|
|
677
|
+
if (["local", "dev"].includes(process.env.ENVIRONMENT ?? "")) {
|
|
684
678
|
console.log(err);
|
|
685
679
|
}
|
|
686
680
|
if (err instanceof FatalError) {
|
|
@@ -848,6 +842,9 @@ var _PaymentStatus = class _PaymentStatus extends ValueObject {
|
|
|
848
842
|
get isHold() {
|
|
849
843
|
return this.value === "HOLD";
|
|
850
844
|
}
|
|
845
|
+
get isPendingRefund() {
|
|
846
|
+
return this.value === "PENDING_REFUND";
|
|
847
|
+
}
|
|
851
848
|
get isRefunded() {
|
|
852
849
|
return this.value === "REFUNDED";
|
|
853
850
|
}
|
|
@@ -858,13 +855,14 @@ var _PaymentStatus = class _PaymentStatus extends ValueObject {
|
|
|
858
855
|
return new _PaymentStatus(gateway.trim().toUpperCase());
|
|
859
856
|
}
|
|
860
857
|
};
|
|
861
|
-
_PaymentStatus.SUPPORTED = ["DONE", "PENDING", "FAILED", "CANCELED", "HOLD", "REFUNDED", "IN_PROGRESS"];
|
|
858
|
+
_PaymentStatus.SUPPORTED = ["DONE", "PENDING", "FAILED", "CANCELED", "HOLD", "PENDING_REFUND", "REFUNDED", "IN_PROGRESS"];
|
|
862
859
|
_PaymentStatus.DONE = new _PaymentStatus("DONE");
|
|
863
860
|
_PaymentStatus.PENDING = new _PaymentStatus("PENDING");
|
|
864
861
|
_PaymentStatus.IN_PROGRESS = new _PaymentStatus("IN_PROGRESS");
|
|
865
862
|
_PaymentStatus.FAILED = new _PaymentStatus("FAILED");
|
|
866
863
|
_PaymentStatus.CANCELED = new _PaymentStatus("CANCELED");
|
|
867
864
|
_PaymentStatus.HOLD = new _PaymentStatus("HOLD");
|
|
865
|
+
_PaymentStatus.PENDING_REFUND = new _PaymentStatus("PENDING_REFUND");
|
|
868
866
|
_PaymentStatus.REFUNDED = new _PaymentStatus("REFUNDED");
|
|
869
867
|
var PaymentStatus = _PaymentStatus;
|
|
870
868
|
|
|
@@ -914,14 +912,70 @@ var BasicUnitOfWorkFactory = class {
|
|
|
914
912
|
}
|
|
915
913
|
};
|
|
916
914
|
|
|
915
|
+
// src/infrastructure/contracts/EventManager.ts
|
|
916
|
+
var EventManager = class {
|
|
917
|
+
constructor(connection) {
|
|
918
|
+
this._connection = connection;
|
|
919
|
+
this._topics = [];
|
|
920
|
+
this._callbackList = {};
|
|
921
|
+
this._onStart = null;
|
|
922
|
+
this._onConnected = null;
|
|
923
|
+
this._onSubscribe = null;
|
|
924
|
+
this._onMessage = null;
|
|
925
|
+
this._onError = null;
|
|
926
|
+
this._onCrash = null;
|
|
927
|
+
this._onReconnect = null;
|
|
928
|
+
}
|
|
929
|
+
async execRoute(topic, message) {
|
|
930
|
+
if (this._callbackList[topic]) {
|
|
931
|
+
await this._callbackList[topic](message);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
async execCallback(callback, data) {
|
|
935
|
+
if (callback) {
|
|
936
|
+
await callback(data);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
route(topic, callback) {
|
|
940
|
+
this._topics.push(topic);
|
|
941
|
+
this._callbackList[topic] = callback;
|
|
942
|
+
}
|
|
943
|
+
onStart(callback) {
|
|
944
|
+
this._onStart = callback;
|
|
945
|
+
}
|
|
946
|
+
onConnected(callback) {
|
|
947
|
+
this._onConnected = callback;
|
|
948
|
+
}
|
|
949
|
+
onSubscribe(callback) {
|
|
950
|
+
this._onSubscribe = callback;
|
|
951
|
+
}
|
|
952
|
+
onMessage(callback) {
|
|
953
|
+
this._onMessage = callback;
|
|
954
|
+
}
|
|
955
|
+
onError(callback) {
|
|
956
|
+
this._onError = callback;
|
|
957
|
+
}
|
|
958
|
+
onCrash(callback) {
|
|
959
|
+
this._onCrash = callback;
|
|
960
|
+
}
|
|
961
|
+
onReconnect(callback) {
|
|
962
|
+
this._onReconnect = callback;
|
|
963
|
+
}
|
|
964
|
+
get topics() {
|
|
965
|
+
return this._topics;
|
|
966
|
+
}
|
|
967
|
+
get callbackList() {
|
|
968
|
+
return this._callbackList;
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
|
|
917
972
|
// src/infrastructure/mysql/Mysql.ts
|
|
918
973
|
var import_promise = require("mysql2/promise");
|
|
919
974
|
var _MysqlConnector = class _MysqlConnector {
|
|
920
975
|
constructor(pool) {
|
|
921
|
-
|
|
922
|
-
this._pool = pool != null ? pool : (0, import_promise.createPool)({
|
|
976
|
+
this._pool = pool ?? (0, import_promise.createPool)({
|
|
923
977
|
host: process.env.DB_HOST,
|
|
924
|
-
port: Number(
|
|
978
|
+
port: Number(process.env.DB_PORT ?? 3306),
|
|
925
979
|
user: process.env.DB_USER,
|
|
926
980
|
password: process.env.DB_PASSWORD,
|
|
927
981
|
database: process.env.DB_DATABASE,
|
|
@@ -1034,7 +1088,6 @@ function toUtcDateTimeString(raw) {
|
|
|
1034
1088
|
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`;
|
|
1035
1089
|
}
|
|
1036
1090
|
function coerceScalar(key, v) {
|
|
1037
|
-
var _a;
|
|
1038
1091
|
if (v == null)
|
|
1039
1092
|
return void 0;
|
|
1040
1093
|
if (typeof v !== "string")
|
|
@@ -1055,7 +1108,7 @@ function coerceScalar(key, v) {
|
|
|
1055
1108
|
return n;
|
|
1056
1109
|
}
|
|
1057
1110
|
if (DATE_KEY_RE.test(key)) {
|
|
1058
|
-
return
|
|
1111
|
+
return toUtcDateTimeString(s) ?? s;
|
|
1059
1112
|
}
|
|
1060
1113
|
return s;
|
|
1061
1114
|
}
|
|
@@ -1082,8 +1135,7 @@ function hasHeader(headers, name) {
|
|
|
1082
1135
|
}
|
|
1083
1136
|
function adaptExpressRoute(Controller) {
|
|
1084
1137
|
return async (req, res, next) => {
|
|
1085
|
-
|
|
1086
|
-
const rawLangHeader = (_b = (_a = req.headers["accept-language"]) != null ? _a : req.headers["Accept-Language"]) != null ? _b : "es";
|
|
1138
|
+
const rawLangHeader = req.headers["accept-language"] ?? req.headers["Accept-Language"] ?? "es";
|
|
1087
1139
|
const rawLang = Array.isArray(rawLangHeader) ? rawLangHeader[0] : rawLangHeader || "";
|
|
1088
1140
|
const lang = rawLang.split(",")[0].split(";")[0].trim().toLowerCase();
|
|
1089
1141
|
const httpRequest = {
|
|
@@ -1131,7 +1183,7 @@ function adaptExpressRoute(Controller) {
|
|
|
1131
1183
|
res.status(statusCode).send(body);
|
|
1132
1184
|
return;
|
|
1133
1185
|
}
|
|
1134
|
-
res.status(statusCode).json(body
|
|
1186
|
+
res.status(statusCode).json(body ?? {});
|
|
1135
1187
|
} catch (err) {
|
|
1136
1188
|
next(err);
|
|
1137
1189
|
}
|
|
@@ -1139,9 +1191,8 @@ function adaptExpressRoute(Controller) {
|
|
|
1139
1191
|
}
|
|
1140
1192
|
function adaptExpressErrorHandler(errorManager) {
|
|
1141
1193
|
return (err, req, res, next) => {
|
|
1142
|
-
|
|
1143
|
-
const
|
|
1144
|
-
const rawLang = Array.isArray(raw) ? raw[0] : raw != null ? raw : "";
|
|
1194
|
+
const raw = req.headers["accept-language"] ?? req.headers["Accept-Language"] ?? "es";
|
|
1195
|
+
const rawLang = Array.isArray(raw) ? raw[0] : raw ?? "";
|
|
1145
1196
|
const langCode = rawLang.split(",")[0].split(";")[0].trim().toLowerCase();
|
|
1146
1197
|
const result = errorManager.handle(err, Language.create(langCode));
|
|
1147
1198
|
const statusCode = typeof result.status === "number" ? result.status : 500;
|
|
@@ -1155,7 +1206,6 @@ var EventBusMysqlRepository = class {
|
|
|
1155
1206
|
this.connection = connection;
|
|
1156
1207
|
}
|
|
1157
1208
|
eventToRowValues(e) {
|
|
1158
|
-
var _a, _b;
|
|
1159
1209
|
return [
|
|
1160
1210
|
e.eventUuid.value,
|
|
1161
1211
|
e.eventType,
|
|
@@ -1167,8 +1217,8 @@ var EventBusMysqlRepository = class {
|
|
|
1167
1217
|
e.status.value,
|
|
1168
1218
|
e.attempts,
|
|
1169
1219
|
e.errorMessage,
|
|
1170
|
-
|
|
1171
|
-
|
|
1220
|
+
e.publishedAt?.value,
|
|
1221
|
+
e.lastAttempt?.value,
|
|
1172
1222
|
e.createdAt.value
|
|
1173
1223
|
];
|
|
1174
1224
|
}
|
|
@@ -1182,8 +1232,7 @@ var EventBusMysqlRepository = class {
|
|
|
1182
1232
|
);
|
|
1183
1233
|
}
|
|
1184
1234
|
async update(event) {
|
|
1185
|
-
|
|
1186
|
-
const values = [event.status.value, event.attempts, event.errorMessage, (_a = event.publishedAt) == null ? void 0 : _a.value, (_b = event.lastAttempt) == null ? void 0 : _b.value, event.eventUuid.value];
|
|
1235
|
+
const values = [event.status.value, event.attempts, event.errorMessage, event.publishedAt?.value, event.lastAttempt?.value, event.eventUuid.value];
|
|
1187
1236
|
await this.connection.query(
|
|
1188
1237
|
`UPDATE events_outbox
|
|
1189
1238
|
SET status = ?,
|
|
@@ -1204,6 +1253,98 @@ var EventBusMysqlRepository = class {
|
|
|
1204
1253
|
}
|
|
1205
1254
|
};
|
|
1206
1255
|
|
|
1256
|
+
// src/infrastructure/kafka/KafkaManager.ts
|
|
1257
|
+
var import_kafkajs = require("kafkajs");
|
|
1258
|
+
var KafkaManager = class extends EventManager {
|
|
1259
|
+
constructor(connection) {
|
|
1260
|
+
super(connection);
|
|
1261
|
+
this.kafka = new import_kafkajs.Kafka({
|
|
1262
|
+
brokers: this._connection.brokers,
|
|
1263
|
+
ssl: true,
|
|
1264
|
+
sasl: {
|
|
1265
|
+
mechanism: "scram-sha-256",
|
|
1266
|
+
username: this._connection.userName,
|
|
1267
|
+
password: this._connection.password
|
|
1268
|
+
},
|
|
1269
|
+
logLevel: import_kafkajs.logLevel.ERROR
|
|
1270
|
+
});
|
|
1271
|
+
this.consumer = this.kafka.consumer({ groupId: process.env.KAFKA_GROUP || "default" });
|
|
1272
|
+
this.producer = this.kafka.producer();
|
|
1273
|
+
}
|
|
1274
|
+
async run(autocommit) {
|
|
1275
|
+
const __run = async () => {
|
|
1276
|
+
await this.execCallback(this._onStart, { message: `--- ${this.constructor.name} started ---` });
|
|
1277
|
+
await this.consumer.connect();
|
|
1278
|
+
await this.execCallback(this._onConnected, { message: `--- ${this.constructor.name} connected to ${this._connection.brokers} ---` });
|
|
1279
|
+
for (let topic of this._topics) {
|
|
1280
|
+
try {
|
|
1281
|
+
await this.consumer.subscribe({ topic, fromBeginning: true });
|
|
1282
|
+
await this.execCallback(this._onSubscribe, { message: `--- ${this.constructor.name} subscribed to ${topic} ---` });
|
|
1283
|
+
} catch (error) {
|
|
1284
|
+
await this.execCallback(this._onConnected, { message: `Error on subscribe to kafka topic: ${topic}` });
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
await this.consumer.run({
|
|
1288
|
+
autoCommit: autocommit,
|
|
1289
|
+
// @ts-ignore
|
|
1290
|
+
eachMessage: async ({ topic, partition, message, heartbeat }) => {
|
|
1291
|
+
try {
|
|
1292
|
+
await this.execCallback(this._onMessage, `[New message detected for ${topic}]: ${message.value?.toString()}`);
|
|
1293
|
+
const evt = JSON.parse(String(message.value?.toString()));
|
|
1294
|
+
await this.execRoute(topic, evt);
|
|
1295
|
+
const next = (BigInt(message.offset) + 1n).toString();
|
|
1296
|
+
await this.consumer.commitOffsets([{ topic, partition, offset: next }]);
|
|
1297
|
+
await heartbeat();
|
|
1298
|
+
} catch (error) {
|
|
1299
|
+
await this.execCallback(this._onError, error);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
};
|
|
1304
|
+
try {
|
|
1305
|
+
await __run();
|
|
1306
|
+
} catch (error) {
|
|
1307
|
+
await this.execCallback(this._onError, new InternalError(ErrorManager.APP_ERRORS.PROCESS, error.toString()));
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
async send(message) {
|
|
1311
|
+
if (!message.producer) {
|
|
1312
|
+
message.producer = process.env.NAME && process.env.ENVIRONMENT ? `${process.env.NAME}-${process.env.ENVIRONMENT}` : "unknown";
|
|
1313
|
+
}
|
|
1314
|
+
if (!message.date) {
|
|
1315
|
+
message.date = DateTime.now().value;
|
|
1316
|
+
}
|
|
1317
|
+
try {
|
|
1318
|
+
if (!this.producer) {
|
|
1319
|
+
throw new InternalError(ErrorManager.APP_ERRORS.PROCESS, "Producer not initialized");
|
|
1320
|
+
}
|
|
1321
|
+
await this.producer.connect();
|
|
1322
|
+
await this.producer.send({
|
|
1323
|
+
topic: message.topic,
|
|
1324
|
+
messages: [{ value: JSON.stringify({ producer: message.producer, data: message }) }]
|
|
1325
|
+
});
|
|
1326
|
+
await this.producer.disconnect();
|
|
1327
|
+
} catch (error) {
|
|
1328
|
+
await this.execCallback(this._onError, new InternalError(ErrorManager.APP_ERRORS.PROCESS, error.toString()));
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
async start(autocommit = false) {
|
|
1332
|
+
this.consumer.on(this.consumer.events.CRASH, async (error) => {
|
|
1333
|
+
await this.execCallback(this._onError, new InternalError(ErrorManager.APP_ERRORS.PROCESS, error.payload.error.stack));
|
|
1334
|
+
});
|
|
1335
|
+
await this.run(autocommit);
|
|
1336
|
+
}
|
|
1337
|
+
async pause() {
|
|
1338
|
+
}
|
|
1339
|
+
async restart() {
|
|
1340
|
+
await this.consumer.stop();
|
|
1341
|
+
await this.start();
|
|
1342
|
+
}
|
|
1343
|
+
async stop() {
|
|
1344
|
+
await this.consumer.stop();
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1207
1348
|
// src/utils/ExchangeRates.ts
|
|
1208
1349
|
var ExchangeRates = class _ExchangeRates extends BaseObject {
|
|
1209
1350
|
constructor(props) {
|
|
@@ -1248,11 +1389,10 @@ var ExchangeRates = class _ExchangeRates extends BaseObject {
|
|
|
1248
1389
|
return new _ExchangeRates(props);
|
|
1249
1390
|
}
|
|
1250
1391
|
static createFromPrimitives(data) {
|
|
1251
|
-
var _a, _b;
|
|
1252
1392
|
return _ExchangeRates.create({
|
|
1253
1393
|
base: Currency.create(data.base),
|
|
1254
|
-
rates:
|
|
1255
|
-
date: DateTime.create(
|
|
1394
|
+
rates: data.rates ?? [],
|
|
1395
|
+
date: DateTime.create(data.date ?? "")
|
|
1256
1396
|
});
|
|
1257
1397
|
}
|
|
1258
1398
|
};
|
|
@@ -1271,11 +1411,13 @@ var ExchangeRates = class _ExchangeRates extends BaseObject {
|
|
|
1271
1411
|
ErrorManager,
|
|
1272
1412
|
EventBus,
|
|
1273
1413
|
EventBusMysqlRepository,
|
|
1414
|
+
EventManager,
|
|
1274
1415
|
ExchangeRates,
|
|
1275
1416
|
FatalError,
|
|
1276
1417
|
HttpHealthCheckController,
|
|
1277
1418
|
HttpNotFoundController,
|
|
1278
1419
|
InternalError,
|
|
1420
|
+
KafkaManager,
|
|
1279
1421
|
Language,
|
|
1280
1422
|
MysqlConnection,
|
|
1281
1423
|
MysqlConnector,
|