@ddd-ts/store-inmemory 0.0.0-eventviz.4 → 0.0.0-eventviz.6
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/in-memory.transaction.js +3 -4
- package/dist/in-memory.transaction.mjs +2 -3
- package/dist/index.js +5 -6
- package/dist/index.mjs +1 -2
- package/dist/store/in-memory.collection.js +2 -3
- package/dist/store/in-memory.collection.mjs +2 -2
- package/dist/store/in-memory.database.js +4 -6
- package/dist/store/in-memory.database.mjs +1 -3
- package/dist/store/in-memory.storage.js +3 -4
- package/dist/store/in-memory.storage.mjs +2 -3
- package/dist/store/in-memory.store.js +7 -5
- package/dist/store/in-memory.store.mjs +5 -3
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("./store/in-memory.database.js");
|
|
2
2
|
let _ddd_ts_core = require("@ddd-ts/core");
|
|
3
|
-
|
|
4
3
|
//#region src/in-memory.transaction.ts
|
|
5
4
|
var InMemoryTransaction = class {
|
|
5
|
+
transaction;
|
|
6
6
|
commitListeners = [];
|
|
7
7
|
constructor(transaction) {
|
|
8
8
|
this.transaction = transaction;
|
|
@@ -29,8 +29,7 @@ var FakeInMemoryTransactionPerformer = class extends _ddd_ts_core.TransactionPer
|
|
|
29
29
|
super((effect) => effect(new InMemoryTransaction(null)));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
33
32
|
//#endregion
|
|
34
33
|
exports.FakeInMemoryTransactionPerformer = FakeInMemoryTransactionPerformer;
|
|
35
34
|
exports.InMemoryTransaction = InMemoryTransaction;
|
|
36
|
-
exports.InMemoryTransactionPerformer = InMemoryTransactionPerformer;
|
|
35
|
+
exports.InMemoryTransactionPerformer = InMemoryTransactionPerformer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./store/in-memory.database.mjs";
|
|
2
2
|
import { TransactionPerformer } from "@ddd-ts/core";
|
|
3
|
-
|
|
4
3
|
//#region src/in-memory.transaction.ts
|
|
5
4
|
var InMemoryTransaction = class {
|
|
5
|
+
transaction;
|
|
6
6
|
commitListeners = [];
|
|
7
7
|
constructor(transaction) {
|
|
8
8
|
this.transaction = transaction;
|
|
@@ -29,6 +29,5 @@ var FakeInMemoryTransactionPerformer = class extends TransactionPerformer {
|
|
|
29
29
|
super((effect) => effect(new InMemoryTransaction(null)));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
33
32
|
//#endregion
|
|
34
|
-
export { FakeInMemoryTransactionPerformer, InMemoryTransaction, InMemoryTransactionPerformer };
|
|
33
|
+
export { FakeInMemoryTransactionPerformer, InMemoryTransaction, InMemoryTransactionPerformer };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
const require_in_memory_database = require(
|
|
3
|
-
const require_in_memory_transaction = require(
|
|
4
|
-
const require_in_memory_store = require(
|
|
5
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_in_memory_database = require("./store/in-memory.database.js");
|
|
3
|
+
const require_in_memory_transaction = require("./in-memory.transaction.js");
|
|
4
|
+
const require_in_memory_store = require("./store/in-memory.store.js");
|
|
6
5
|
exports.CannotReadAfterWrites = require_in_memory_database.CannotReadAfterWrites;
|
|
7
6
|
exports.FakeInMemoryTransactionPerformer = require_in_memory_transaction.FakeInMemoryTransactionPerformer;
|
|
8
7
|
exports.InMemoryDatabase = require_in_memory_database.InMemoryDatabase;
|
|
@@ -10,4 +9,4 @@ exports.InMemoryStore = require_in_memory_store.InMemoryStore;
|
|
|
10
9
|
exports.InMemoryTransaction = require_in_memory_transaction.InMemoryTransaction;
|
|
11
10
|
exports.InMemoryTransactionPerformer = require_in_memory_transaction.InMemoryTransactionPerformer;
|
|
12
11
|
exports.InMemoryUnderlyingTransaction = require_in_memory_database.InMemoryUnderlyingTransaction;
|
|
13
|
-
exports.TransactionCollidedTooManyTimes = require_in_memory_database.TransactionCollidedTooManyTimes;
|
|
12
|
+
exports.TransactionCollidedTooManyTimes = require_in_memory_database.TransactionCollidedTooManyTimes;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CannotReadAfterWrites, InMemoryDatabase, InMemoryUnderlyingTransaction, TransactionCollidedTooManyTimes } from "./store/in-memory.database.mjs";
|
|
2
2
|
import { FakeInMemoryTransactionPerformer, InMemoryTransaction, InMemoryTransactionPerformer } from "./in-memory.transaction.mjs";
|
|
3
3
|
import { InMemoryStore } from "./store/in-memory.store.mjs";
|
|
4
|
-
|
|
5
|
-
export { CannotReadAfterWrites, FakeInMemoryTransactionPerformer, InMemoryDatabase, InMemoryStore, InMemoryTransaction, InMemoryTransactionPerformer, InMemoryUnderlyingTransaction, TransactionCollidedTooManyTimes };
|
|
4
|
+
export { CannotReadAfterWrites, FakeInMemoryTransactionPerformer, InMemoryDatabase, InMemoryStore, InMemoryTransaction, InMemoryTransactionPerformer, InMemoryUnderlyingTransaction, TransactionCollidedTooManyTimes };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/store/in-memory.collection.ts
|
|
3
2
|
function now() {
|
|
4
3
|
if (typeof process === "object" && typeof process.hrtime === "function") return process.hrtime.bigint() / BigInt(1e3);
|
|
5
4
|
return BigInt(Date.now() * 1e3);
|
|
6
5
|
}
|
|
7
6
|
var Collection = class Collection {
|
|
7
|
+
data;
|
|
8
8
|
constructor(data = /* @__PURE__ */ new Map()) {
|
|
9
9
|
this.data = data;
|
|
10
10
|
}
|
|
@@ -60,6 +60,5 @@ function replaceBigInt(key, value) {
|
|
|
60
60
|
if (typeof value === "bigint") return value.toString();
|
|
61
61
|
return value;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
63
|
//#endregion
|
|
65
|
-
exports.Collection = Collection;
|
|
64
|
+
exports.Collection = Collection;
|
|
@@ -4,6 +4,7 @@ function now() {
|
|
|
4
4
|
return BigInt(Date.now() * 1e3);
|
|
5
5
|
}
|
|
6
6
|
var Collection = class Collection {
|
|
7
|
+
data;
|
|
7
8
|
constructor(data = /* @__PURE__ */ new Map()) {
|
|
8
9
|
this.data = data;
|
|
9
10
|
}
|
|
@@ -59,6 +60,5 @@ function replaceBigInt(key, value) {
|
|
|
59
60
|
if (typeof value === "bigint") return value.toString();
|
|
60
61
|
return value;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
63
|
//#endregion
|
|
64
|
-
export { Collection };
|
|
64
|
+
export { Collection };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
const require_in_memory_storage = require(
|
|
2
|
-
const require_in_memory_transaction = require(
|
|
3
|
-
require(
|
|
1
|
+
const require_in_memory_storage = require("./in-memory.storage.js");
|
|
2
|
+
const require_in_memory_transaction = require("../in-memory.transaction.js");
|
|
3
|
+
require("../index.js");
|
|
4
4
|
let _ddd_ts_core = require("@ddd-ts/core");
|
|
5
|
-
|
|
6
5
|
//#region src/store/in-memory.database.ts
|
|
7
6
|
var CannotReadAfterWrites = class extends Error {
|
|
8
7
|
constructor() {
|
|
@@ -147,9 +146,8 @@ var InMemoryDatabase = class InMemoryDatabase {
|
|
|
147
146
|
console.log(["Database:", this.storage.toPretty()].join("\n"));
|
|
148
147
|
}
|
|
149
148
|
};
|
|
150
|
-
|
|
151
149
|
//#endregion
|
|
152
150
|
exports.CannotReadAfterWrites = CannotReadAfterWrites;
|
|
153
151
|
exports.InMemoryDatabase = InMemoryDatabase;
|
|
154
152
|
exports.InMemoryUnderlyingTransaction = InMemoryUnderlyingTransaction;
|
|
155
|
-
exports.TransactionCollidedTooManyTimes = TransactionCollidedTooManyTimes;
|
|
153
|
+
exports.TransactionCollidedTooManyTimes = TransactionCollidedTooManyTimes;
|
|
@@ -2,7 +2,6 @@ import { Storage } from "./in-memory.storage.mjs";
|
|
|
2
2
|
import { InMemoryTransaction } from "../in-memory.transaction.mjs";
|
|
3
3
|
import "../index.mjs";
|
|
4
4
|
import { ConcurrencyError } from "@ddd-ts/core";
|
|
5
|
-
|
|
6
5
|
//#region src/store/in-memory.database.ts
|
|
7
6
|
var CannotReadAfterWrites = class extends Error {
|
|
8
7
|
constructor() {
|
|
@@ -147,6 +146,5 @@ var InMemoryDatabase = class InMemoryDatabase {
|
|
|
147
146
|
console.log(["Database:", this.storage.toPretty()].join("\n"));
|
|
148
147
|
}
|
|
149
148
|
};
|
|
150
|
-
|
|
151
149
|
//#endregion
|
|
152
|
-
export { CannotReadAfterWrites, InMemoryDatabase, InMemoryUnderlyingTransaction, TransactionCollidedTooManyTimes };
|
|
150
|
+
export { CannotReadAfterWrites, InMemoryDatabase, InMemoryUnderlyingTransaction, TransactionCollidedTooManyTimes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_in_memory_collection = require(
|
|
2
|
-
|
|
1
|
+
const require_in_memory_collection = require("./in-memory.collection.js");
|
|
3
2
|
//#region src/store/in-memory.storage.ts
|
|
4
3
|
var Storage = class Storage {
|
|
4
|
+
collections;
|
|
5
5
|
constructor(collections = /* @__PURE__ */ new Map()) {
|
|
6
6
|
this.collections = collections;
|
|
7
7
|
}
|
|
@@ -26,6 +26,5 @@ var Storage = class Storage {
|
|
|
26
26
|
}).join("\n");
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
|
|
30
29
|
//#endregion
|
|
31
|
-
exports.Storage = Storage;
|
|
30
|
+
exports.Storage = Storage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Collection } from "./in-memory.collection.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/store/in-memory.storage.ts
|
|
4
3
|
var Storage = class Storage {
|
|
4
|
+
collections;
|
|
5
5
|
constructor(collections = /* @__PURE__ */ new Map()) {
|
|
6
6
|
this.collections = collections;
|
|
7
7
|
}
|
|
@@ -26,6 +26,5 @@ var Storage = class Storage {
|
|
|
26
26
|
}).join("\n");
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
|
|
30
29
|
//#endregion
|
|
31
|
-
export { Storage };
|
|
30
|
+
export { Storage };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
require(
|
|
2
|
-
require(
|
|
3
|
-
|
|
1
|
+
require("./in-memory.database.js");
|
|
2
|
+
require("../in-memory.transaction.js");
|
|
4
3
|
//#region src/store/in-memory.store.ts
|
|
5
4
|
/**
|
|
6
5
|
* This in memory store is a copy store. It stores a copy of the actual model.
|
|
7
6
|
* It is the recommended inmemory store to use, as it reflects more closely the behaviour of a real store.
|
|
8
7
|
*/
|
|
9
8
|
var InMemoryStore = class {
|
|
9
|
+
collection;
|
|
10
|
+
database;
|
|
11
|
+
serializer;
|
|
12
|
+
$name;
|
|
10
13
|
constructor(collection, database, serializer, $name) {
|
|
11
14
|
this.collection = collection;
|
|
12
15
|
this.database = database;
|
|
@@ -75,6 +78,5 @@ var InMemoryStore = class {
|
|
|
75
78
|
for (const item of await this.filter(() => true)) yield item;
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
|
-
|
|
79
81
|
//#endregion
|
|
80
|
-
exports.InMemoryStore = InMemoryStore;
|
|
82
|
+
exports.InMemoryStore = InMemoryStore;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import "./in-memory.database.mjs";
|
|
2
2
|
import "../in-memory.transaction.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/store/in-memory.store.ts
|
|
5
4
|
/**
|
|
6
5
|
* This in memory store is a copy store. It stores a copy of the actual model.
|
|
7
6
|
* It is the recommended inmemory store to use, as it reflects more closely the behaviour of a real store.
|
|
8
7
|
*/
|
|
9
8
|
var InMemoryStore = class {
|
|
9
|
+
collection;
|
|
10
|
+
database;
|
|
11
|
+
serializer;
|
|
12
|
+
$name;
|
|
10
13
|
constructor(collection, database, serializer, $name) {
|
|
11
14
|
this.collection = collection;
|
|
12
15
|
this.database = database;
|
|
@@ -75,6 +78,5 @@ var InMemoryStore = class {
|
|
|
75
78
|
for (const item of await this.filter(() => true)) yield item;
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
|
-
|
|
79
81
|
//#endregion
|
|
80
|
-
export { InMemoryStore };
|
|
82
|
+
export { InMemoryStore };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts/store-inmemory",
|
|
3
|
-
"version": "0.0.0-eventviz.
|
|
3
|
+
"version": "0.0.0-eventviz.6",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@ddd-ts/core": "0.0.0-eventviz.
|
|
13
|
+
"@ddd-ts/core": "0.0.0-eventviz.6"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@ddd-ts/tools": "0.0.0-eventviz.
|
|
17
|
-
"@ddd-ts/types": "0.0.0-eventviz.
|
|
16
|
+
"@ddd-ts/tools": "0.0.0-eventviz.6",
|
|
17
|
+
"@ddd-ts/types": "0.0.0-eventviz.6",
|
|
18
18
|
"@types/jest": "^29.5.1",
|
|
19
19
|
"@types/node": "^20.12.4"
|
|
20
20
|
},
|