@fraym/streams 0.10.1 → 0.10.3
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/client/allEvents.js
CHANGED
|
@@ -4,16 +4,22 @@ exports.getAllEventsAfterEvent = exports.getAllEvents = void 0;
|
|
|
4
4
|
const event_1 = require("./event");
|
|
5
5
|
const util_1 = require("./util");
|
|
6
6
|
const getAllEvents = async (tenantId, topic, types, perPage, handler, stopLoadingMore, serviceClient) => {
|
|
7
|
-
let
|
|
7
|
+
let lastEventId = null;
|
|
8
|
+
let events = [];
|
|
8
9
|
while (true) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
if (!lastEventId) {
|
|
11
|
+
events = await getEventPage(tenantId, topic, types, perPage, 0, serviceClient);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
events = await getEventPageAfterEvent(tenantId, topic, types, lastEventId, perPage, 0, serviceClient);
|
|
15
|
+
}
|
|
11
16
|
let lastEvent = null;
|
|
12
17
|
for (const eventData of events) {
|
|
13
18
|
const event = (0, event_1.getSubscriptionEvent)(eventData);
|
|
14
19
|
if (event) {
|
|
15
20
|
await handler(event);
|
|
16
21
|
lastEvent = event;
|
|
22
|
+
lastEventId = event.id;
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
if (stopLoadingMore(lastEvent)) {
|
package/dist/client/client.js
CHANGED
|
@@ -109,7 +109,6 @@ const newClient = async (config) => {
|
|
|
109
109
|
return await (0, invalidateGdpr_1.sendInvalidateGdpr)(tenantId, topic, gdprId, serviceClient);
|
|
110
110
|
},
|
|
111
111
|
createStreamSnapshot: async (tenantId, topic, stream, idOfLastEventThatGotSnapshotted, snapshotEvent) => {
|
|
112
|
-
console.log("aaa");
|
|
113
112
|
return await (0, stream_1.createStreamSnapshot)(tenantId, topic, stream, idOfLastEventThatGotSnapshotted, snapshotEvent, serviceClient);
|
|
114
113
|
},
|
|
115
114
|
close: () => {
|
package/dist/client/stream.js
CHANGED
|
@@ -5,16 +5,22 @@ const event_1 = require("./event");
|
|
|
5
5
|
const util_1 = require("./util");
|
|
6
6
|
const publish_1 = require("./publish");
|
|
7
7
|
const getStream = async (topic, tenantId, stream, perPage, handler, stopLoadingMore, serviceClient) => {
|
|
8
|
-
let
|
|
8
|
+
let lastEventId = null;
|
|
9
|
+
let events = [];
|
|
9
10
|
while (true) {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
if (!lastEventId) {
|
|
12
|
+
events = await getStreamPage(topic, tenantId, stream, perPage, 0, serviceClient);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
events = await getStreamPageAfterEvent(topic, tenantId, stream, lastEventId, perPage, 0, serviceClient);
|
|
16
|
+
}
|
|
12
17
|
let lastEvent = null;
|
|
13
18
|
for (const eventData of events) {
|
|
14
19
|
const event = (0, event_1.getSubscriptionEvent)(eventData);
|
|
15
20
|
if (event) {
|
|
16
21
|
await handler(event);
|
|
17
22
|
lastEvent = event;
|
|
23
|
+
lastEventId = event.id;
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
if (stopLoadingMore(lastEvent)) {
|