@twin.org/entity-storage-models 0.0.3-next.22 → 0.0.3-next.23
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/es/helpers/entityStorageHelper.js +42 -1
- package/dist/es/helpers/entityStorageHelper.js.map +1 -1
- package/dist/types/helpers/entityStorageHelper.d.ts +20 -1
- package/docs/changelog.md +7 -0
- package/docs/reference/classes/EntityStorageHelper.md +74 -0
- package/locales/en.json +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2026 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { Is, ObjectHelper } from "@twin.org/core";
|
|
3
|
+
import { GeneralError, Is, ObjectHelper } from "@twin.org/core";
|
|
4
4
|
import { ComparisonOperator, EntitySchemaHelper } from "@twin.org/entity";
|
|
5
5
|
/**
|
|
6
6
|
* Helper class for performing schema migrations between two connectors.
|
|
@@ -60,6 +60,47 @@ export class EntityStorageHelper {
|
|
|
60
60
|
}
|
|
61
61
|
return nonNullEntity;
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Validate that every sort property in the list is indexed in the schema (isPrimary, isSecondary,
|
|
65
|
+
* or has a default sortDirection), throwing sortNotIndexed for the first violation found.
|
|
66
|
+
* @param schema The entity schema to validate against.
|
|
67
|
+
* @param sortProperties The sort properties to check.
|
|
68
|
+
* @throws GeneralError If a sort property is not indexed in the schema.
|
|
69
|
+
*/
|
|
70
|
+
static validateSortProperties(schema, sortProperties) {
|
|
71
|
+
if (Is.arrayValue(sortProperties)) {
|
|
72
|
+
for (const sortProperty of sortProperties) {
|
|
73
|
+
const propertySchema = schema.properties?.find(p => p.property === sortProperty.property);
|
|
74
|
+
if (Is.undefined(propertySchema) ||
|
|
75
|
+
(!propertySchema.isPrimary &&
|
|
76
|
+
!propertySchema.isSecondary &&
|
|
77
|
+
Is.empty(propertySchema.sortDirection))) {
|
|
78
|
+
throw new GeneralError(EntityStorageHelper.CLASS_NAME, "sortNotIndexed", {
|
|
79
|
+
property: sortProperty.property
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Validate that every property in the list exists in the schema, throwing propertyNotInSchema
|
|
87
|
+
* for the first property that is not found.
|
|
88
|
+
* @param schema The entity schema to validate against.
|
|
89
|
+
* @param properties The properties to check.
|
|
90
|
+
* @throws GeneralError If a property does not exist in the schema.
|
|
91
|
+
*/
|
|
92
|
+
static validateProperties(schema, properties) {
|
|
93
|
+
if (Is.arrayValue(properties)) {
|
|
94
|
+
for (const property of properties) {
|
|
95
|
+
const propertySchema = schema.properties?.find(p => p.property === property);
|
|
96
|
+
if (Is.undefined(propertySchema)) {
|
|
97
|
+
throw new GeneralError(EntityStorageHelper.CLASS_NAME, "propertyNotInSchema", {
|
|
98
|
+
property
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
63
104
|
/**
|
|
64
105
|
* Deep-clone condition tree and normalise null/undefined to undefined on Equals/NotEquals leaves
|
|
65
106
|
* so in-memory evaluation matches stored-absent semantics (optional absent props are omitted/undefined).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityStorageHelper.js","sourceRoot":"","sources":["../../../src/helpers/entityStorageHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"entityStorageHelper.js","sourceRoot":"","sources":["../../../src/helpers/entityStorageHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACN,kBAAkB,EAElB,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nimport {\n\tComparisonOperator,\n\ttype EntityCondition,\n\tEntitySchemaHelper,\n\ttype IEntitySchema,\n\ttype SortDirection\n} from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Helper class for performing schema migrations between two connectors.\n */\nexport class EntityStorageHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageHelper>();\n\n\t/**\n\t * Prepare the entity by handling undefined and null values and validating it against the schema.\n\t * @param entity The entity to handle undefined and null values for.\n\t * @param schema The schema to validate the entity against.\n\t * @param additionalProperties Optional list of additional properties to set on the entity.\n\t * @param options Options controlling how null/undefined optional properties are stored.\n\t * @param options.nullBehavior \"omit\" strips null/undefined optional properties before writing\n\t * (NoSQL — avoids index-key type errors). \"nullify\" converts undefined to null (SQL — the default).\n\t * @returns The entity with undefined and null values handled.\n\t */\n\tpublic static prepareEntity<T>(\n\t\tentity: T,\n\t\tschema: IEntitySchema<T>,\n\t\tadditionalProperties?: { property: string; value: unknown }[],\n\t\toptions?: { nullBehavior?: \"omit\" | \"nullify\" }\n\t): T {\n\t\tconst entityForValidation = ObjectHelper.clone(entity);\n\t\tEntitySchemaHelper.validateEntity(entityForValidation, schema);\n\n\t\tif (Is.arrayValue(schema.properties)) {\n\t\t\tfor (const property of schema.properties) {\n\t\t\t\tif (property.optional ?? false) {\n\t\t\t\t\tconst propValue = entityForValidation[property.property];\n\t\t\t\t\tif (options?.nullBehavior === \"omit\") {\n\t\t\t\t\t\tif (propValue === undefined || propValue === null) {\n\t\t\t\t\t\t\tObjectHelper.propertyDelete(entityForValidation, property.property as string);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (propValue === undefined) {\n\t\t\t\t\t\tObjectHelper.propertySet(entityForValidation, property.property as string, null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(additionalProperties)) {\n\t\t\tfor (const additionalProperty of additionalProperties) {\n\t\t\t\tObjectHelper.propertySet(\n\t\t\t\t\tentityForValidation,\n\t\t\t\t\tadditionalProperty.property,\n\t\t\t\t\tadditionalProperty.value\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn entityForValidation;\n\t}\n\n\t/**\n\t * Un-prepare the entity by removing null values.\n\t * @param entity The entity to handle undefined and null values for.\n\t * @param removeProperties Optional list of properties to remove from the entity.\n\t * @returns The entity with undefined and null values handled.\n\t */\n\tpublic static unPrepareEntity<T>(entity: Partial<T> | undefined, removeProperties?: string[]): T {\n\t\tconst nonNullEntity = ObjectHelper.removeEmptyProperties(entity, { removeNull: true });\n\n\t\tif (Is.arrayValue(removeProperties)) {\n\t\t\tfor (const property of removeProperties) {\n\t\t\t\tObjectHelper.propertyDelete(nonNullEntity, property);\n\t\t\t}\n\t\t}\n\n\t\treturn nonNullEntity as T;\n\t}\n\n\t/**\n\t * Validate that every sort property in the list is indexed in the schema (isPrimary, isSecondary,\n\t * or has a default sortDirection), throwing sortNotIndexed for the first violation found.\n\t * @param schema The entity schema to validate against.\n\t * @param sortProperties The sort properties to check.\n\t * @throws GeneralError If a sort property is not indexed in the schema.\n\t */\n\tpublic static validateSortProperties<T>(\n\t\tschema: IEntitySchema<T>,\n\t\tsortProperties?: { property: keyof T; sortDirection: SortDirection }[]\n\t): void {\n\t\tif (Is.arrayValue(sortProperties)) {\n\t\t\tfor (const sortProperty of sortProperties) {\n\t\t\t\tconst propertySchema = schema.properties?.find(p => p.property === sortProperty.property);\n\t\t\t\tif (\n\t\t\t\t\tIs.undefined(propertySchema) ||\n\t\t\t\t\t(!propertySchema.isPrimary &&\n\t\t\t\t\t\t!propertySchema.isSecondary &&\n\t\t\t\t\t\tIs.empty(propertySchema.sortDirection))\n\t\t\t\t) {\n\t\t\t\t\tthrow new GeneralError(EntityStorageHelper.CLASS_NAME, \"sortNotIndexed\", {\n\t\t\t\t\t\tproperty: sortProperty.property\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Validate that every property in the list exists in the schema, throwing propertyNotInSchema\n\t * for the first property that is not found.\n\t * @param schema The entity schema to validate against.\n\t * @param properties The properties to check.\n\t * @throws GeneralError If a property does not exist in the schema.\n\t */\n\tpublic static validateProperties<T>(schema: IEntitySchema<T>, properties?: (keyof T)[]): void {\n\t\tif (Is.arrayValue(properties)) {\n\t\t\tfor (const property of properties) {\n\t\t\t\tconst propertySchema = schema.properties?.find(p => p.property === property);\n\t\t\t\tif (Is.undefined(propertySchema)) {\n\t\t\t\t\tthrow new GeneralError(EntityStorageHelper.CLASS_NAME, \"propertyNotInSchema\", {\n\t\t\t\t\t\tproperty\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Deep-clone condition tree and normalise null/undefined to undefined on Equals/NotEquals leaves\n\t * so in-memory evaluation matches stored-absent semantics (optional absent props are omitted/undefined).\n\t * @param condition The user-supplied condition (not mutated).\n\t * @returns A clone safe to pass to check.\n\t */\n\tpublic static normalizeConditionValues<T>(condition: EntityCondition<T>): EntityCondition<T> {\n\t\tif (\"conditions\" in condition) {\n\t\t\treturn {\n\t\t\t\t...condition,\n\t\t\t\tconditions: condition.conditions.map(c => EntityStorageHelper.normalizeConditionValues(c))\n\t\t\t};\n\t\t}\n\n\t\tconst leaf = condition;\n\t\tif (\n\t\t\t(leaf.comparison === ComparisonOperator.Equals ||\n\t\t\t\tleaf.comparison === ComparisonOperator.NotEquals) &&\n\t\t\t(leaf.value === undefined || leaf.value === null)\n\t\t) {\n\t\t\treturn { ...leaf, value: undefined };\n\t\t}\n\t\treturn { ...leaf };\n\t}\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EntityCondition, type IEntitySchema } from "@twin.org/entity";
|
|
1
|
+
import { type EntityCondition, type IEntitySchema, type SortDirection } from "@twin.org/entity";
|
|
2
2
|
/**
|
|
3
3
|
* Helper class for performing schema migrations between two connectors.
|
|
4
4
|
*/
|
|
@@ -30,6 +30,25 @@ export declare class EntityStorageHelper {
|
|
|
30
30
|
* @returns The entity with undefined and null values handled.
|
|
31
31
|
*/
|
|
32
32
|
static unPrepareEntity<T>(entity: Partial<T> | undefined, removeProperties?: string[]): T;
|
|
33
|
+
/**
|
|
34
|
+
* Validate that every sort property in the list is indexed in the schema (isPrimary, isSecondary,
|
|
35
|
+
* or has a default sortDirection), throwing sortNotIndexed for the first violation found.
|
|
36
|
+
* @param schema The entity schema to validate against.
|
|
37
|
+
* @param sortProperties The sort properties to check.
|
|
38
|
+
* @throws GeneralError If a sort property is not indexed in the schema.
|
|
39
|
+
*/
|
|
40
|
+
static validateSortProperties<T>(schema: IEntitySchema<T>, sortProperties?: {
|
|
41
|
+
property: keyof T;
|
|
42
|
+
sortDirection: SortDirection;
|
|
43
|
+
}[]): void;
|
|
44
|
+
/**
|
|
45
|
+
* Validate that every property in the list exists in the schema, throwing propertyNotInSchema
|
|
46
|
+
* for the first property that is not found.
|
|
47
|
+
* @param schema The entity schema to validate against.
|
|
48
|
+
* @param properties The properties to check.
|
|
49
|
+
* @throws GeneralError If a property does not exist in the schema.
|
|
50
|
+
*/
|
|
51
|
+
static validateProperties<T>(schema: IEntitySchema<T>, properties?: (keyof T)[]): void;
|
|
33
52
|
/**
|
|
34
53
|
* Deep-clone condition tree and normalise null/undefined to undefined on Equals/NotEquals leaves
|
|
35
54
|
* so in-memory evaluation matches stored-absent semantics (optional absent props are omitted/undefined).
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.23](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-models-v0.0.3-next.22...entity-storage-models-v0.0.3-next.23) (2026-06-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* entity storage conditions ([#115](https://github.com/iotaledger/twin-entity-storage/issues/115)) ([7a53884](https://github.com/iotaledger/twin-entity-storage/commit/7a53884f6acb856d77733e4e0f23ec1c00b74cb4))
|
|
9
|
+
|
|
3
10
|
## [0.0.3-next.22](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-models-v0.0.3-next.21...entity-storage-models-v0.0.3-next.22) (2026-06-08)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -107,6 +107,80 @@ The entity with undefined and null values handled.
|
|
|
107
107
|
|
|
108
108
|
***
|
|
109
109
|
|
|
110
|
+
### validateSortProperties() {#validatesortproperties}
|
|
111
|
+
|
|
112
|
+
> `static` **validateSortProperties**\<`T`\>(`schema`, `sortProperties?`): `void`
|
|
113
|
+
|
|
114
|
+
Validate that every sort property in the list is indexed in the schema (isPrimary, isSecondary,
|
|
115
|
+
or has a default sortDirection), throwing sortNotIndexed for the first violation found.
|
|
116
|
+
|
|
117
|
+
#### Type Parameters
|
|
118
|
+
|
|
119
|
+
##### T
|
|
120
|
+
|
|
121
|
+
`T`
|
|
122
|
+
|
|
123
|
+
#### Parameters
|
|
124
|
+
|
|
125
|
+
##### schema
|
|
126
|
+
|
|
127
|
+
`IEntitySchema`\<`T`\>
|
|
128
|
+
|
|
129
|
+
The entity schema to validate against.
|
|
130
|
+
|
|
131
|
+
##### sortProperties?
|
|
132
|
+
|
|
133
|
+
`object`[]
|
|
134
|
+
|
|
135
|
+
The sort properties to check.
|
|
136
|
+
|
|
137
|
+
#### Returns
|
|
138
|
+
|
|
139
|
+
`void`
|
|
140
|
+
|
|
141
|
+
#### Throws
|
|
142
|
+
|
|
143
|
+
GeneralError If a sort property is not indexed in the schema.
|
|
144
|
+
|
|
145
|
+
***
|
|
146
|
+
|
|
147
|
+
### validateProperties() {#validateproperties}
|
|
148
|
+
|
|
149
|
+
> `static` **validateProperties**\<`T`\>(`schema`, `properties?`): `void`
|
|
150
|
+
|
|
151
|
+
Validate that every property in the list exists in the schema, throwing propertyNotInSchema
|
|
152
|
+
for the first property that is not found.
|
|
153
|
+
|
|
154
|
+
#### Type Parameters
|
|
155
|
+
|
|
156
|
+
##### T
|
|
157
|
+
|
|
158
|
+
`T`
|
|
159
|
+
|
|
160
|
+
#### Parameters
|
|
161
|
+
|
|
162
|
+
##### schema
|
|
163
|
+
|
|
164
|
+
`IEntitySchema`\<`T`\>
|
|
165
|
+
|
|
166
|
+
The entity schema to validate against.
|
|
167
|
+
|
|
168
|
+
##### properties?
|
|
169
|
+
|
|
170
|
+
keyof `T`[]
|
|
171
|
+
|
|
172
|
+
The properties to check.
|
|
173
|
+
|
|
174
|
+
#### Returns
|
|
175
|
+
|
|
176
|
+
`void`
|
|
177
|
+
|
|
178
|
+
#### Throws
|
|
179
|
+
|
|
180
|
+
GeneralError If a property does not exist in the schema.
|
|
181
|
+
|
|
182
|
+
***
|
|
183
|
+
|
|
110
184
|
### normalizeConditionValues() {#normalizeconditionvalues}
|
|
111
185
|
|
|
112
186
|
> `static` **normalizeConditionValues**\<`T`\>(`condition`): `EntityCondition`\<`T`\>
|
package/locales/en.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error": {
|
|
3
|
+
"entityStorageHelper": {
|
|
4
|
+
"sortNotIndexed": "The property \"{property}\" is not indexed and cannot be used for sorting",
|
|
5
|
+
"propertyNotInSchema": "The property \"{property}\" does not exist in the schema and cannot be used for projection"
|
|
6
|
+
},
|
|
3
7
|
"migrationHelper": {
|
|
4
8
|
"migrationFailed": "Migration failed.",
|
|
5
9
|
"transformRequiredForProperty": "A transformation function is required to migrate property \"{from}\" to \"{to}\" of type \"{type}\"",
|
package/package.json
CHANGED