@rentbase/common 1.0.26 → 1.0.28
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/build/events/consumer.js
CHANGED
|
@@ -91,7 +91,9 @@ const connectConsumer = (queue, rabbitUrl, onMessage) => __awaiter(void 0, void
|
|
|
91
91
|
headers["x-event-id"];
|
|
92
92
|
const Inbox = getInbox();
|
|
93
93
|
if (Inbox && eventId) {
|
|
94
|
-
const existing = yield Inbox.findById(eventId)
|
|
94
|
+
const existing = yield Inbox.findById(eventId)
|
|
95
|
+
.select({ _id: 1 })
|
|
96
|
+
.lean();
|
|
95
97
|
if (existing) {
|
|
96
98
|
channel.ack(msg);
|
|
97
99
|
return;
|
package/build/events/outbox.js
CHANGED
|
@@ -49,7 +49,9 @@ const enqueueOutboxEvent = (routingKey, payload, meta = {}) => __awaiter(void 0,
|
|
|
49
49
|
const exchange = meta.exchange || process.env.RABBITMQ_EXCHANGE || "rentbase.events";
|
|
50
50
|
const eventId = meta.eventId || (0, event_utils_1.generateEventId)();
|
|
51
51
|
const occurredAt = meta.occurredAt || now();
|
|
52
|
-
const sourceService = meta.sourceService ||
|
|
52
|
+
const sourceService = meta.sourceService ||
|
|
53
|
+
process.env.SERVICE_NAME ||
|
|
54
|
+
process.env.npm_package_name;
|
|
53
55
|
const headers = Object.assign(Object.assign(Object.assign({}, (meta.headers || {})), { "x-event-id": eventId, "x-occurred-at": occurredAt.toISOString() }), (sourceService ? { "x-source-service": sourceService } : {}));
|
|
54
56
|
const Model = (0, exports.getOutboxModel)(meta.modelName);
|
|
55
57
|
const doc = {
|
package/build/events/producer.js
CHANGED
|
@@ -103,7 +103,9 @@ const publishEventWithMeta = (queue, message, meta = {}) => __awaiter(void 0, vo
|
|
|
103
103
|
const routingKey = String(queue);
|
|
104
104
|
const eventId = meta.eventId || (0, event_utils_1.generateEventId)();
|
|
105
105
|
const occurredAt = meta.occurredAt || new Date();
|
|
106
|
-
const sourceService = meta.sourceService ||
|
|
106
|
+
const sourceService = meta.sourceService ||
|
|
107
|
+
process.env.SERVICE_NAME ||
|
|
108
|
+
process.env.npm_package_name;
|
|
107
109
|
const headers = Object.assign(Object.assign(Object.assign({}, (meta.headers || {})), { "x-event-id": eventId, "x-occurred-at": occurredAt.toISOString() }), (sourceService ? { "x-source-service": sourceService } : {}));
|
|
108
110
|
yield publishWithConfirm(DEFAULT_EXCHANGE, routingKey, payload, {
|
|
109
111
|
persistent: true,
|