@twin.org/entity-storage-connector-file 0.0.1-next.23 → 0.0.1-next.25
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
|
@@ -127,15 +127,16 @@ class FileEntityStorageConnector {
|
|
|
127
127
|
* @param conditions The optional conditions to match for the entities.
|
|
128
128
|
* @returns The id of the entity.
|
|
129
129
|
*/
|
|
130
|
-
async set(entity, conditions) {
|
|
131
|
-
core.Guards.object(this.CLASS_NAME, "entity", entity);
|
|
130
|
+
async set(entity$1, conditions) {
|
|
131
|
+
core.Guards.object(this.CLASS_NAME, "entity", entity$1);
|
|
132
|
+
entity.EntitySchemaHelper.validateEntity(entity$1, this.getSchema());
|
|
132
133
|
const store = await this.readStore();
|
|
133
|
-
const existingIndex = this.findItem(store, entity[this._primaryKey.property], undefined, conditions);
|
|
134
|
+
const existingIndex = this.findItem(store, entity$1[this._primaryKey.property], undefined, conditions);
|
|
134
135
|
if (existingIndex >= 0) {
|
|
135
|
-
store[existingIndex] = entity;
|
|
136
|
+
store[existingIndex] = entity$1;
|
|
136
137
|
}
|
|
137
138
|
else {
|
|
138
|
-
store.push(entity);
|
|
139
|
+
store.push(entity$1);
|
|
139
140
|
}
|
|
140
141
|
await this.writeStore(store);
|
|
141
142
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -127,6 +127,7 @@ class FileEntityStorageConnector {
|
|
|
127
127
|
*/
|
|
128
128
|
async set(entity, conditions) {
|
|
129
129
|
Guards.object(this.CLASS_NAME, "entity", entity);
|
|
130
|
+
EntitySchemaHelper.validateEntity(entity, this.getSchema());
|
|
130
131
|
const store = await this.readStore();
|
|
131
132
|
const existingIndex = this.findItem(store, entity[this._primaryKey.property], undefined, conditions);
|
|
132
133
|
if (existingIndex >= 0) {
|
package/docs/changelog.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-file",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.25",
|
|
4
4
|
"description": "Entity Storage connector implementation using file 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.25",
|
|
20
20
|
"@twin.org/logging-models": "next",
|
|
21
21
|
"@twin.org/nameof": "next"
|
|
22
22
|
},
|