@event-driven-io/emmett-mongodb 0.37.0 → 0.38.0-alpha.2
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 +28 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -31
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -28,13 +28,14 @@ var ConcurrencyError = class _ConcurrencyError extends EmmettError {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// ../emmett/dist/index.js
|
|
31
|
-
import { v4 as
|
|
31
|
+
import { v4 as uuid5 } from "uuid";
|
|
32
32
|
import { TransformStream } from "web-streams-polyfill";
|
|
33
33
|
import { v4 as uuid2 } from "uuid";
|
|
34
34
|
import { v4 as uuid } from "uuid";
|
|
35
35
|
import { TransformStream as TransformStream2 } from "web-streams-polyfill";
|
|
36
|
+
import { v7 as uuid3 } from "uuid";
|
|
36
37
|
import retry from "async-retry";
|
|
37
|
-
import {
|
|
38
|
+
import { v4 as uuid4 } from "uuid";
|
|
38
39
|
import { ReadableStream } from "web-streams-polyfill";
|
|
39
40
|
import "web-streams-polyfill";
|
|
40
41
|
import { TransformStream as TransformStream3 } from "web-streams-polyfill";
|
|
@@ -225,6 +226,33 @@ var asyncRetry = async (fn, opts) => {
|
|
|
225
226
|
opts ?? { retries: 0 }
|
|
226
227
|
);
|
|
227
228
|
};
|
|
229
|
+
var AssertionError = class extends Error {
|
|
230
|
+
constructor(message2) {
|
|
231
|
+
super(message2);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
var isSubset = (superObj, subObj) => {
|
|
235
|
+
const sup = superObj;
|
|
236
|
+
const sub = subObj;
|
|
237
|
+
assertOk(sup);
|
|
238
|
+
assertOk(sub);
|
|
239
|
+
return Object.keys(sub).every((ele) => {
|
|
240
|
+
if (typeof sub[ele] == "object") {
|
|
241
|
+
return isSubset(sup[ele], sub[ele]);
|
|
242
|
+
}
|
|
243
|
+
return sub[ele] === sup[ele];
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
var assertFails = (message2) => {
|
|
247
|
+
throw new AssertionError(message2 ?? "That should not ever happened, right?");
|
|
248
|
+
};
|
|
249
|
+
function assertTrue(condition, message2) {
|
|
250
|
+
if (condition !== true)
|
|
251
|
+
throw new AssertionError(message2 ?? `Condition is false`);
|
|
252
|
+
}
|
|
253
|
+
function assertOk(obj, message2) {
|
|
254
|
+
if (!obj) throw new AssertionError(message2 ?? `Condition is not truthy`);
|
|
255
|
+
}
|
|
228
256
|
var filterProjections = (type, projections2) => {
|
|
229
257
|
const inlineProjections2 = projections2.filter((projection2) => projection2.type === type).map(({ projection: projection2 }) => projection2);
|
|
230
258
|
const duplicateRegistrations = arrayUtils.getDuplicates(
|
|
@@ -392,39 +420,12 @@ var streamTransformations = {
|
|
|
392
420
|
waitAtMost
|
|
393
421
|
};
|
|
394
422
|
var { retry: retry2 } = streamTransformations;
|
|
395
|
-
var AssertionError = class extends Error {
|
|
396
|
-
constructor(message2) {
|
|
397
|
-
super(message2);
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
var isSubset = (superObj, subObj) => {
|
|
401
|
-
const sup = superObj;
|
|
402
|
-
const sub = subObj;
|
|
403
|
-
assertOk(sup);
|
|
404
|
-
assertOk(sub);
|
|
405
|
-
return Object.keys(sub).every((ele) => {
|
|
406
|
-
if (typeof sub[ele] == "object") {
|
|
407
|
-
return isSubset(sup[ele], sub[ele]);
|
|
408
|
-
}
|
|
409
|
-
return sub[ele] === sup[ele];
|
|
410
|
-
});
|
|
411
|
-
};
|
|
412
|
-
var assertFails = (message2) => {
|
|
413
|
-
throw new AssertionError(message2 ?? "That should not ever happened, right?");
|
|
414
|
-
};
|
|
415
|
-
function assertTrue(condition, message2) {
|
|
416
|
-
if (condition !== true)
|
|
417
|
-
throw new AssertionError(message2 ?? `Condition is false`);
|
|
418
|
-
}
|
|
419
|
-
function assertOk(obj, message2) {
|
|
420
|
-
if (!obj) throw new AssertionError(message2 ?? `Condition is not truthy`);
|
|
421
|
-
}
|
|
422
423
|
|
|
423
424
|
// src/eventStore/mongoDBEventStore.ts
|
|
424
425
|
import {
|
|
425
426
|
MongoClient as MongoClient2
|
|
426
427
|
} from "mongodb";
|
|
427
|
-
import { v4 as
|
|
428
|
+
import { v4 as uuid6 } from "uuid";
|
|
428
429
|
|
|
429
430
|
// src/eventStore/projections/mongoDBInlineProjection.ts
|
|
430
431
|
var MongoDBDefaultInlineProjectionName = "_default";
|
|
@@ -783,7 +784,7 @@ var MongoDBEventStoreImplementation = class {
|
|
|
783
784
|
let streamOffset = currentStreamVersion;
|
|
784
785
|
const eventsToAppend = events.map((event) => {
|
|
785
786
|
const metadata = {
|
|
786
|
-
messageId:
|
|
787
|
+
messageId: uuid6(),
|
|
787
788
|
streamName,
|
|
788
789
|
streamPosition: ++streamOffset
|
|
789
790
|
};
|