@twin.org/entity-storage-connector-memory 0.0.1-next.23 → 0.0.1-next.24
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/cjs/index.cjs +6 -5
- package/dist/esm/index.mjs +1 -0
- package/docs/changelog.md +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
@@ -69,14 +69,15 @@ class MemoryEntityStorageConnector {
|
|
69
69
|
* @param conditions The optional conditions to match for the entities.
|
70
70
|
* @returns The id of the entity.
|
71
71
|
*/
|
72
|
-
async set(entity, conditions) {
|
73
|
-
core.Guards.object(this.CLASS_NAME, "entity", entity);
|
74
|
-
|
72
|
+
async set(entity$1, conditions) {
|
73
|
+
core.Guards.object(this.CLASS_NAME, "entity", entity$1);
|
74
|
+
entity.EntitySchemaHelper.validateEntity(entity$1, this.getSchema());
|
75
|
+
const existingIndex = this.findItem(entity$1[this._primaryKey.property], undefined, conditions);
|
75
76
|
if (existingIndex >= 0) {
|
76
|
-
this._store[existingIndex] = entity;
|
77
|
+
this._store[existingIndex] = entity$1;
|
77
78
|
}
|
78
79
|
else {
|
79
|
-
this._store.push(entity);
|
80
|
+
this._store.push(entity$1);
|
80
81
|
}
|
81
82
|
}
|
82
83
|
/**
|
package/dist/esm/index.mjs
CHANGED
@@ -69,6 +69,7 @@ class MemoryEntityStorageConnector {
|
|
69
69
|
*/
|
70
70
|
async set(entity, conditions) {
|
71
71
|
Guards.object(this.CLASS_NAME, "entity", entity);
|
72
|
+
EntitySchemaHelper.validateEntity(entity, this.getSchema());
|
72
73
|
const existingIndex = this.findItem(entity[this._primaryKey.property], undefined, conditions);
|
73
74
|
if (existingIndex >= 0) {
|
74
75
|
this._store[existingIndex] = entity;
|
package/docs/changelog.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@twin.org/entity-storage-connector-memory",
|
3
|
-
"version": "0.0.1-next.
|
3
|
+
"version": "0.0.1-next.24",
|
4
4
|
"description": "Entity Storage connector implementation using in-memory storage",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"dependencies": {
|
17
17
|
"@twin.org/core": "next",
|
18
18
|
"@twin.org/entity": "next",
|
19
|
-
"@twin.org/entity-storage-models": "0.0.1-next.
|
19
|
+
"@twin.org/entity-storage-models": "0.0.1-next.24",
|
20
20
|
"@twin.org/nameof": "next"
|
21
21
|
},
|
22
22
|
"main": "./dist/cjs/index.cjs",
|