@twin.org/entity 0.0.1-next.9 → 0.0.2-next.10

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.
Files changed (27) hide show
  1. package/dist/cjs/index.cjs +64 -2
  2. package/dist/esm/index.mjs +64 -2
  3. package/dist/types/utils/entitySchemaHelper.d.ts +7 -0
  4. package/docs/changelog.md +520 -1
  5. package/docs/reference/classes/DecoratorHelper.md +18 -8
  6. package/docs/reference/classes/EntityConditions.md +22 -10
  7. package/docs/reference/classes/EntitySchemaHelper.md +67 -13
  8. package/docs/reference/classes/EntitySorter.md +31 -13
  9. package/docs/reference/functions/entity.md +4 -2
  10. package/docs/reference/functions/property.md +3 -1
  11. package/docs/reference/interfaces/IComparatorGroup.md +3 -1
  12. package/docs/reference/interfaces/IEntitySchema.md +3 -1
  13. package/docs/reference/interfaces/IEntitySchemaProperty.md +3 -1
  14. package/docs/reference/interfaces/IEntitySort.md +3 -1
  15. package/docs/reference/type-aliases/ComparisonOperator.md +1 -1
  16. package/docs/reference/type-aliases/EntityCondition.md +4 -2
  17. package/docs/reference/type-aliases/EntitySchemaPropertyFormat.md +1 -1
  18. package/docs/reference/type-aliases/EntitySchemaPropertyType.md +1 -1
  19. package/docs/reference/type-aliases/LogicalOperator.md +1 -1
  20. package/docs/reference/type-aliases/SortDirection.md +1 -1
  21. package/docs/reference/variables/ComparisonOperator.md +1 -1
  22. package/docs/reference/variables/EntitySchemaPropertyFormat.md +1 -1
  23. package/docs/reference/variables/EntitySchemaPropertyType.md +1 -1
  24. package/docs/reference/variables/LogicalOperator.md +1 -1
  25. package/docs/reference/variables/SortDirection.md +1 -1
  26. package/locales/en.json +5 -1
  27. package/package.json +6 -6
@@ -61,7 +61,7 @@ function property(options) {
61
61
  const entitySchema = DecoratorHelper.getSchema(target);
62
62
  entitySchema.properties ??= [];
63
63
  const idx = entitySchema.properties.findIndex(p => p.property === propertyKey);
64
- if (idx >= 0) {
64
+ if (idx !== -1) {
65
65
  entitySchema.properties[idx] = {
66
66
  ...options,
67
67
  property: propertyKey
@@ -533,6 +533,60 @@ class EntitySchemaHelper {
533
533
  }
534
534
  return finalSortKeys;
535
535
  }
536
+ /**
537
+ * Validate the entity against the schema.
538
+ * @param entity The entity to validate.
539
+ * @param entitySchema The schema to validate against.
540
+ * @throws If the entity is invalid.
541
+ */
542
+ static validateEntity(entity, entitySchema) {
543
+ core.Guards.object(EntitySchemaHelper._CLASS_NAME, "entity", entity);
544
+ core.Guards.object(EntitySchemaHelper._CLASS_NAME, "entitySchema", entitySchema);
545
+ const properties = entitySchema.properties ?? [];
546
+ if (properties.length === 0 && core.Is.objectValue(entity)) {
547
+ throw new core.GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidEntityProperties");
548
+ }
549
+ const allKeys = Object.keys(entity);
550
+ for (const prop of properties) {
551
+ const idx = allKeys.indexOf(prop.property);
552
+ if (idx !== -1) {
553
+ allKeys.splice(idx, 1);
554
+ }
555
+ const value = entity[prop.property];
556
+ if (core.Is.empty(value)) {
557
+ // If the value is empty but the property is not optional, then it's invalid
558
+ if (!prop.optional) {
559
+ throw new core.GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidOptional", {
560
+ property: prop.property,
561
+ type: prop.type
562
+ });
563
+ }
564
+ }
565
+ else if (prop.type === "integer" && core.Is.integer(value)) ;
566
+ else if (prop.type === "object" &&
567
+ (core.Is.object(value) ||
568
+ core.Is.array(value) ||
569
+ core.Is.string(value) ||
570
+ core.Is.number(value) ||
571
+ core.Is.boolean(value) ||
572
+ core.Is.null(value))) ;
573
+ else if (prop.type === "array" && core.Is.array(value)) ;
574
+ else if (prop.type !== typeof value) {
575
+ // The schema type does not match the value type
576
+ throw new core.GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidEntityProperty", {
577
+ value,
578
+ property: prop.property,
579
+ type: prop.type
580
+ });
581
+ }
582
+ }
583
+ if (allKeys.length > 0) {
584
+ // There are keys in the entity that are not in the schema
585
+ throw new core.GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidEntityKeys", {
586
+ keys: allKeys.join(", ")
587
+ });
588
+ }
589
+ }
536
590
  }
537
591
 
538
592
  // Copyright 2024 IOTA Stiftung.
@@ -572,7 +626,9 @@ class EntitySorter {
572
626
  */
573
627
  static compare(entity1, entity2, prop, type, direction = SortDirection.Ascending) {
574
628
  let res = 0;
575
- if (!core.Is.empty(entity1[prop]) && !core.Is.empty(entity2[prop])) {
629
+ const hasProp1 = !core.Is.empty(entity1[prop]);
630
+ const hasProp2 = !core.Is.empty(entity2[prop]);
631
+ if (hasProp1 && hasProp2) {
576
632
  if (type === "number" || type === "integer") {
577
633
  res = entity1[prop] - entity2[prop];
578
634
  }
@@ -593,6 +649,12 @@ class EntitySorter {
593
649
  res = entity1[prop].localeCompare(entity2[prop]);
594
650
  }
595
651
  }
652
+ else if (hasProp1) {
653
+ res = -1;
654
+ }
655
+ else {
656
+ res = 1;
657
+ }
596
658
  return direction === SortDirection.Ascending ? res : res * -1;
597
659
  }
598
660
  }
@@ -59,7 +59,7 @@ function property(options) {
59
59
  const entitySchema = DecoratorHelper.getSchema(target);
60
60
  entitySchema.properties ??= [];
61
61
  const idx = entitySchema.properties.findIndex(p => p.property === propertyKey);
62
- if (idx >= 0) {
62
+ if (idx !== -1) {
63
63
  entitySchema.properties[idx] = {
64
64
  ...options,
65
65
  property: propertyKey
@@ -531,6 +531,60 @@ class EntitySchemaHelper {
531
531
  }
532
532
  return finalSortKeys;
533
533
  }
534
+ /**
535
+ * Validate the entity against the schema.
536
+ * @param entity The entity to validate.
537
+ * @param entitySchema The schema to validate against.
538
+ * @throws If the entity is invalid.
539
+ */
540
+ static validateEntity(entity, entitySchema) {
541
+ Guards.object(EntitySchemaHelper._CLASS_NAME, "entity", entity);
542
+ Guards.object(EntitySchemaHelper._CLASS_NAME, "entitySchema", entitySchema);
543
+ const properties = entitySchema.properties ?? [];
544
+ if (properties.length === 0 && Is.objectValue(entity)) {
545
+ throw new GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidEntityProperties");
546
+ }
547
+ const allKeys = Object.keys(entity);
548
+ for (const prop of properties) {
549
+ const idx = allKeys.indexOf(prop.property);
550
+ if (idx !== -1) {
551
+ allKeys.splice(idx, 1);
552
+ }
553
+ const value = entity[prop.property];
554
+ if (Is.empty(value)) {
555
+ // If the value is empty but the property is not optional, then it's invalid
556
+ if (!prop.optional) {
557
+ throw new GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidOptional", {
558
+ property: prop.property,
559
+ type: prop.type
560
+ });
561
+ }
562
+ }
563
+ else if (prop.type === "integer" && Is.integer(value)) ;
564
+ else if (prop.type === "object" &&
565
+ (Is.object(value) ||
566
+ Is.array(value) ||
567
+ Is.string(value) ||
568
+ Is.number(value) ||
569
+ Is.boolean(value) ||
570
+ Is.null(value))) ;
571
+ else if (prop.type === "array" && Is.array(value)) ;
572
+ else if (prop.type !== typeof value) {
573
+ // The schema type does not match the value type
574
+ throw new GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidEntityProperty", {
575
+ value,
576
+ property: prop.property,
577
+ type: prop.type
578
+ });
579
+ }
580
+ }
581
+ if (allKeys.length > 0) {
582
+ // There are keys in the entity that are not in the schema
583
+ throw new GeneralError(EntitySchemaHelper._CLASS_NAME, "invalidEntityKeys", {
584
+ keys: allKeys.join(", ")
585
+ });
586
+ }
587
+ }
534
588
  }
535
589
 
536
590
  // Copyright 2024 IOTA Stiftung.
@@ -570,7 +624,9 @@ class EntitySorter {
570
624
  */
571
625
  static compare(entity1, entity2, prop, type, direction = SortDirection.Ascending) {
572
626
  let res = 0;
573
- if (!Is.empty(entity1[prop]) && !Is.empty(entity2[prop])) {
627
+ const hasProp1 = !Is.empty(entity1[prop]);
628
+ const hasProp2 = !Is.empty(entity2[prop]);
629
+ if (hasProp1 && hasProp2) {
574
630
  if (type === "number" || type === "integer") {
575
631
  res = entity1[prop] - entity2[prop];
576
632
  }
@@ -591,6 +647,12 @@ class EntitySorter {
591
647
  res = entity1[prop].localeCompare(entity2[prop]);
592
648
  }
593
649
  }
650
+ else if (hasProp1) {
651
+ res = -1;
652
+ }
653
+ else {
654
+ res = 1;
655
+ }
594
656
  return direction === SortDirection.Ascending ? res : res * -1;
595
657
  }
596
658
  }
@@ -35,4 +35,11 @@ export declare class EntitySchemaHelper {
35
35
  property: keyof T;
36
36
  sortDirection: SortDirection;
37
37
  }[]): IEntitySort<T>[] | undefined;
38
+ /**
39
+ * Validate the entity against the schema.
40
+ * @param entity The entity to validate.
41
+ * @param entitySchema The schema to validate against.
42
+ * @throws If the entity is invalid.
43
+ */
44
+ static validateEntity<T>(entity: T, entitySchema: IEntitySchema<T>): void;
38
45
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,524 @@
1
1
  # @twin.org/entity - Changelog
2
2
 
3
- ## 0.0.1-next.9
3
+ ## [0.0.2-next.10](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.9...entity-v0.0.2-next.10) (2025-09-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **entity:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/nameof bumped from 0.0.2-next.9 to 0.0.2-next.10
16
+ * @twin.org/core bumped from 0.0.2-next.9 to 0.0.2-next.10
17
+ * devDependencies
18
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.9 to 0.0.2-next.10
19
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.9 to 0.0.2-next.10
20
+
21
+ ## [0.0.2-next.9](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.8...entity-v0.0.2-next.9) (2025-09-08)
22
+
23
+
24
+ ### Miscellaneous Chores
25
+
26
+ * **entity:** Synchronize repo versions
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * The following workspace dependencies were updated
32
+ * dependencies
33
+ * @twin.org/nameof bumped from 0.0.2-next.8 to 0.0.2-next.9
34
+ * @twin.org/core bumped from 0.0.2-next.8 to 0.0.2-next.9
35
+ * devDependencies
36
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.8 to 0.0.2-next.9
37
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.8 to 0.0.2-next.9
38
+
39
+ ## [0.0.2-next.8](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.7...entity-v0.0.2-next.8) (2025-09-05)
40
+
41
+
42
+ ### Miscellaneous Chores
43
+
44
+ * **entity:** Synchronize repo versions
45
+
46
+
47
+ ### Dependencies
48
+
49
+ * The following workspace dependencies were updated
50
+ * dependencies
51
+ * @twin.org/nameof bumped from 0.0.2-next.7 to 0.0.2-next.8
52
+ * @twin.org/core bumped from 0.0.2-next.7 to 0.0.2-next.8
53
+ * devDependencies
54
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.7 to 0.0.2-next.8
55
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.7 to 0.0.2-next.8
56
+
57
+ ## [0.0.2-next.7](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.6...entity-v0.0.2-next.7) (2025-08-29)
58
+
59
+
60
+ ### Features
61
+
62
+ * eslint migration to flat config ([74427d7](https://github.com/twinfoundation/framework/commit/74427d78d342167f7850e49ab87269326355befe))
63
+
64
+
65
+ ### Dependencies
66
+
67
+ * The following workspace dependencies were updated
68
+ * dependencies
69
+ * @twin.org/nameof bumped from 0.0.2-next.6 to 0.0.2-next.7
70
+ * @twin.org/core bumped from 0.0.2-next.6 to 0.0.2-next.7
71
+ * devDependencies
72
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.6 to 0.0.2-next.7
73
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.6 to 0.0.2-next.7
74
+
75
+ ## [0.0.2-next.6](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.5...entity-v0.0.2-next.6) (2025-08-27)
76
+
77
+
78
+ ### Miscellaneous Chores
79
+
80
+ * **entity:** Synchronize repo versions
81
+
82
+
83
+ ### Dependencies
84
+
85
+ * The following workspace dependencies were updated
86
+ * dependencies
87
+ * @twin.org/nameof bumped from 0.0.2-next.5 to 0.0.2-next.6
88
+ * @twin.org/core bumped from 0.0.2-next.5 to 0.0.2-next.6
89
+ * devDependencies
90
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.5 to 0.0.2-next.6
91
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.5 to 0.0.2-next.6
92
+
93
+ ## [0.0.2-next.5](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.4...entity-v0.0.2-next.5) (2025-08-19)
94
+
95
+
96
+ ### Features
97
+
98
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/twinfoundation/framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
99
+
100
+
101
+ ### Dependencies
102
+
103
+ * The following workspace dependencies were updated
104
+ * dependencies
105
+ * @twin.org/nameof bumped from 0.0.2-next.4 to 0.0.2-next.5
106
+ * @twin.org/core bumped from 0.0.2-next.4 to 0.0.2-next.5
107
+ * devDependencies
108
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.4 to 0.0.2-next.5
109
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.4 to 0.0.2-next.5
110
+
111
+ ## [0.0.2-next.4](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.3...entity-v0.0.2-next.4) (2025-08-15)
112
+
113
+
114
+ ### Miscellaneous Chores
115
+
116
+ * **entity:** Synchronize repo versions
117
+
118
+
119
+ ### Dependencies
120
+
121
+ * The following workspace dependencies were updated
122
+ * dependencies
123
+ * @twin.org/nameof bumped from 0.0.2-next.3 to 0.0.2-next.4
124
+ * @twin.org/core bumped from 0.0.2-next.3 to 0.0.2-next.4
125
+ * devDependencies
126
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.3 to 0.0.2-next.4
127
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.3 to 0.0.2-next.4
128
+
129
+ ## [0.0.2-next.3](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.2...entity-v0.0.2-next.3) (2025-08-06)
130
+
131
+
132
+ ### Features
133
+
134
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
135
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
136
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
137
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
138
+
139
+
140
+ ### Dependencies
141
+
142
+ * The following workspace dependencies were updated
143
+ * dependencies
144
+ * @twin.org/nameof bumped from 0.0.2-next.2 to 0.0.2-next.3
145
+ * @twin.org/core bumped from 0.0.2-next.2 to 0.0.2-next.3
146
+ * devDependencies
147
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.2 to 0.0.2-next.3
148
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.2 to 0.0.2-next.3
149
+
150
+ ## [0.0.2-next.2](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.1...entity-v0.0.2-next.2) (2025-08-06)
151
+
152
+
153
+ ### Features
154
+
155
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
156
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
157
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
158
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
159
+
160
+
161
+ ### Dependencies
162
+
163
+ * The following workspace dependencies were updated
164
+ * dependencies
165
+ * @twin.org/nameof bumped from 0.0.2-next.1 to 0.0.2-next.2
166
+ * @twin.org/core bumped from 0.0.2-next.1 to 0.0.2-next.2
167
+ * devDependencies
168
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.1 to 0.0.2-next.2
169
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.1 to 0.0.2-next.2
170
+
171
+ ## [0.0.2-next.1](https://github.com/twinfoundation/framework/compare/entity-v0.0.2-next.0...entity-v0.0.2-next.1) (2025-08-06)
172
+
173
+
174
+ ### Features
175
+
176
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
177
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
178
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
179
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
180
+
181
+
182
+ ### Dependencies
183
+
184
+ * The following workspace dependencies were updated
185
+ * dependencies
186
+ * @twin.org/nameof bumped from 0.0.2-next.0 to 0.0.2-next.1
187
+ * @twin.org/core bumped from 0.0.2-next.0 to 0.0.2-next.1
188
+ * devDependencies
189
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.0 to 0.0.2-next.1
190
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.0 to 0.0.2-next.1
191
+
192
+ ## 0.0.1 (2025-07-03)
193
+
194
+
195
+ ### Features
196
+
197
+ * release to production ([829d53d](https://github.com/twinfoundation/framework/commit/829d53d3953b1e1b40b0243c04cfdfd3842aac7b))
198
+ * release to production ([5cf3a76](https://github.com/twinfoundation/framework/commit/5cf3a76a09eff2e6414d0cba846c7c37400a11d6))
199
+
200
+
201
+ ### Dependencies
202
+
203
+ * The following workspace dependencies were updated
204
+ * dependencies
205
+ * @twin.org/nameof bumped from ^0.0.0 to ^0.0.1
206
+ * @twin.org/core bumped from ^0.0.0 to ^0.0.1
207
+ * devDependencies
208
+ * @twin.org/nameof-transformer bumped from ^0.0.0 to ^0.0.1
209
+ * @twin.org/nameof-vitest-plugin bumped from ^0.0.0 to ^0.0.1
210
+
211
+ ## [0.0.1-next.70](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.69...entity-v0.0.1-next.70) (2025-07-02)
212
+
213
+
214
+ ### Features
215
+
216
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
217
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
218
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
219
+
220
+
221
+ ### Dependencies
222
+
223
+ * The following workspace dependencies were updated
224
+ * dependencies
225
+ * @twin.org/nameof bumped from 0.0.1-next.69 to 0.0.1-next.70
226
+ * @twin.org/core bumped from 0.0.1-next.69 to 0.0.1-next.70
227
+ * devDependencies
228
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.69 to 0.0.1-next.70
229
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.69 to 0.0.1-next.70
230
+
231
+ ## [0.0.1-next.69](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.68...entity-v0.0.1-next.69) (2025-07-02)
232
+
233
+
234
+ ### Features
235
+
236
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
237
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
238
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
239
+
240
+
241
+ ### Dependencies
242
+
243
+ * The following workspace dependencies were updated
244
+ * dependencies
245
+ * @twin.org/nameof bumped from 0.0.1-next.68 to 0.0.1-next.69
246
+ * @twin.org/core bumped from 0.0.1-next.68 to 0.0.1-next.69
247
+ * devDependencies
248
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.68 to 0.0.1-next.69
249
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.68 to 0.0.1-next.69
250
+
251
+ ## [0.0.1-next.68](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.67...entity-v0.0.1-next.68) (2025-07-02)
252
+
253
+
254
+ ### Features
255
+
256
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
257
+
258
+
259
+ ### Dependencies
260
+
261
+ * The following workspace dependencies were updated
262
+ * dependencies
263
+ * @twin.org/nameof bumped from 0.0.1-next.67 to 0.0.1-next.68
264
+ * @twin.org/core bumped from 0.0.1-next.67 to 0.0.1-next.68
265
+ * devDependencies
266
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.67 to 0.0.1-next.68
267
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.67 to 0.0.1-next.68
268
+
269
+ ## [0.0.1-next.67](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.66...entity-v0.0.1-next.67) (2025-06-26)
270
+
271
+
272
+ ### Miscellaneous Chores
273
+
274
+ * **entity:** Synchronize repo versions
275
+
276
+
277
+ ### Dependencies
278
+
279
+ * The following workspace dependencies were updated
280
+ * dependencies
281
+ * @twin.org/core bumped from 0.0.1-next.66 to 0.0.1-next.67
282
+
283
+ ## [0.0.1-next.66](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.65...entity-v0.0.1-next.66) (2025-06-26)
284
+
285
+
286
+ ### Miscellaneous Chores
287
+
288
+ * **entity:** Synchronize repo versions
289
+
290
+
291
+ ### Dependencies
292
+
293
+ * The following workspace dependencies were updated
294
+ * dependencies
295
+ * @twin.org/core bumped from 0.0.1-next.65 to 0.0.1-next.66
296
+
297
+ ## [0.0.1-next.65](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.64...entity-v0.0.1-next.65) (2025-06-19)
298
+
299
+
300
+ ### Miscellaneous Chores
301
+
302
+ * **entity:** Synchronize repo versions
303
+
304
+
305
+ ### Dependencies
306
+
307
+ * The following workspace dependencies were updated
308
+ * dependencies
309
+ * @twin.org/core bumped from 0.0.1-next.64 to 0.0.1-next.65
310
+
311
+ ## [0.0.1-next.64](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.63...entity-v0.0.1-next.64) (2025-06-19)
312
+
313
+
314
+ ### Miscellaneous Chores
315
+
316
+ * **entity:** Synchronize repo versions
317
+
318
+
319
+ ### Dependencies
320
+
321
+ * The following workspace dependencies were updated
322
+ * dependencies
323
+ * @twin.org/core bumped from 0.0.1-next.63 to 0.0.1-next.64
324
+
325
+ ## [0.0.1-next.63](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.62...entity-v0.0.1-next.63) (2025-06-18)
326
+
327
+
328
+ ### Miscellaneous Chores
329
+
330
+ * **entity:** Synchronize repo versions
331
+
332
+
333
+ ### Dependencies
334
+
335
+ * The following workspace dependencies were updated
336
+ * dependencies
337
+ * @twin.org/core bumped from 0.0.1-next.62 to 0.0.1-next.63
338
+
339
+ ## [0.0.1-next.62](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.61...entity-v0.0.1-next.62) (2025-06-17)
340
+
341
+
342
+ ### Features
343
+
344
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
345
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
346
+
347
+
348
+ ### Dependencies
349
+
350
+ * The following workspace dependencies were updated
351
+ * dependencies
352
+ * @twin.org/core bumped from 0.0.1-next.61 to 0.0.1-next.62
353
+
354
+ ## [0.0.1-next.61](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.60...entity-v0.0.1-next.61) (2025-06-17)
355
+
356
+
357
+ ### Miscellaneous Chores
358
+
359
+ * **entity:** Synchronize repo versions
360
+
361
+
362
+ ### Dependencies
363
+
364
+ * The following workspace dependencies were updated
365
+ * dependencies
366
+ * @twin.org/core bumped from 0.0.1-next.60 to 0.0.1-next.61
367
+
368
+ ## [0.0.1-next.60](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.59...entity-v0.0.1-next.60) (2025-06-17)
369
+
370
+
371
+ ### Miscellaneous Chores
372
+
373
+ * **entity:** Synchronize repo versions
374
+
375
+
376
+ ### Dependencies
377
+
378
+ * The following workspace dependencies were updated
379
+ * dependencies
380
+ * @twin.org/core bumped from 0.0.1-next.59 to 0.0.1-next.60
381
+
382
+ ## [0.0.1-next.59](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.58...entity-v0.0.1-next.59) (2025-06-17)
383
+
384
+
385
+ ### Miscellaneous Chores
386
+
387
+ * **entity:** Synchronize repo versions
388
+
389
+
390
+ ### Dependencies
391
+
392
+ * The following workspace dependencies were updated
393
+ * dependencies
394
+ * @twin.org/core bumped from 0.0.1-next.58 to 0.0.1-next.59
395
+
396
+ ## [0.0.1-next.58](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.57...entity-v0.0.1-next.58) (2025-06-13)
397
+
398
+
399
+ ### Miscellaneous Chores
400
+
401
+ * **entity:** Synchronize repo versions
402
+
403
+
404
+ ### Dependencies
405
+
406
+ * The following workspace dependencies were updated
407
+ * dependencies
408
+ * @twin.org/core bumped from 0.0.1-next.57 to 0.0.1-next.58
409
+
410
+ ## [0.0.1-next.57](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.56...entity-v0.0.1-next.57) (2025-06-10)
411
+
412
+
413
+ ### Features
414
+
415
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
416
+
417
+
418
+ ### Dependencies
419
+
420
+ * The following workspace dependencies were updated
421
+ * dependencies
422
+ * @twin.org/core bumped from 0.0.1-next.56 to 0.0.1-next.57
423
+
424
+ ## [0.0.1-next.56](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.55...entity-v0.0.1-next.56) (2025-05-08)
425
+
426
+
427
+ ### Miscellaneous Chores
428
+
429
+ * **entity:** Synchronize repo versions
430
+
431
+
432
+ ### Dependencies
433
+
434
+ * The following workspace dependencies were updated
435
+ * dependencies
436
+ * @twin.org/core bumped from 0.0.1-next.55 to 0.0.1-next.56
437
+
438
+ ## [0.0.1-next.55](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.54...entity-v0.0.1-next.55) (2025-05-07)
439
+
440
+
441
+ ### Miscellaneous Chores
442
+
443
+ * **entity:** Synchronize repo versions
444
+
445
+
446
+ ### Dependencies
447
+
448
+ * The following workspace dependencies were updated
449
+ * dependencies
450
+ * @twin.org/core bumped from 0.0.1-next.54 to 0.0.1-next.55
451
+
452
+ ## [0.0.1-next.54](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.53...entity-v0.0.1-next.54) (2025-05-06)
453
+
454
+
455
+ ### Miscellaneous Chores
456
+
457
+ * **entity:** Synchronize repo versions
458
+
459
+
460
+ ### Dependencies
461
+
462
+ * The following workspace dependencies were updated
463
+ * dependencies
464
+ * @twin.org/core bumped from 0.0.1-next.53 to 0.0.1-next.54
465
+
466
+ ## [0.0.1-next.53](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.52...entity-v0.0.1-next.53) (2025-05-01)
467
+
468
+
469
+ ### Miscellaneous Chores
470
+
471
+ * **entity:** Synchronize repo versions
472
+
473
+
474
+ ### Dependencies
475
+
476
+ * The following workspace dependencies were updated
477
+ * dependencies
478
+ * @twin.org/core bumped from 0.0.1-next.52 to 0.0.1-next.53
479
+
480
+ ## [0.0.1-next.52](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.51...entity-v0.0.1-next.52) (2025-04-17)
481
+
482
+
483
+ ### Features
484
+
485
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
486
+
487
+
488
+ ### Dependencies
489
+
490
+ * The following workspace dependencies were updated
491
+ * dependencies
492
+ * @twin.org/core bumped from 0.0.1-next.51 to 0.0.1-next.52
493
+
494
+ ## [0.0.1-next.51](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.50...entity-v0.0.1-next.51) (2025-03-27)
495
+
496
+
497
+ ### Miscellaneous Chores
498
+
499
+ * **entity:** Synchronize repo versions
500
+
501
+
502
+ ### Dependencies
503
+
504
+ * The following workspace dependencies were updated
505
+ * dependencies
506
+ * @twin.org/core bumped from 0.0.1-next.50 to 0.0.1-next.51
507
+
508
+ ## [0.0.1-next.50](https://github.com/twinfoundation/framework/compare/entity-v0.0.1-next.49...entity-v0.0.1-next.50) (2025-03-26)
509
+
510
+
511
+ ### Miscellaneous Chores
512
+
513
+ * **entity:** Synchronize repo versions
514
+
515
+
516
+ ### Dependencies
517
+
518
+ * The following workspace dependencies were updated
519
+ * dependencies
520
+ * @twin.org/core bumped from 0.0.1-next.49 to 0.0.1-next.50
521
+
522
+ ## 0.0.1-next.49
4
523
 
5
524
  - Initial Release
@@ -4,13 +4,13 @@ Class to help with decorators.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new DecoratorHelper()
7
+ ### Constructor
8
8
 
9
- > **new DecoratorHelper**(): [`DecoratorHelper`](DecoratorHelper.md)
9
+ > **new DecoratorHelper**(): `DecoratorHelper`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`DecoratorHelper`](DecoratorHelper.md)
13
+ `DecoratorHelper`
14
14
 
15
15
  ## Methods
16
16
 
@@ -22,11 +22,15 @@ Get the schema from the reflection metadata.
22
22
 
23
23
  #### Type Parameters
24
24
 
25
- **T** = `unknown`
25
+ ##### T
26
+
27
+ `T` = `unknown`
26
28
 
27
29
  #### Parameters
28
30
 
29
- **target**: `any`
31
+ ##### target
32
+
33
+ `any`
30
34
 
31
35
  The object to get the schema data from.
32
36
 
@@ -46,15 +50,21 @@ Set the schema from the reflection metadata.
46
50
 
47
51
  #### Type Parameters
48
52
 
49
- **T** = `unknown`
53
+ ##### T
54
+
55
+ `T` = `unknown`
50
56
 
51
57
  #### Parameters
52
58
 
53
- **target**: `any`
59
+ ##### target
60
+
61
+ `any`
54
62
 
55
63
  The object to get the schema data from.
56
64
 
57
- **entitySchema**: [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
65
+ ##### entitySchema
66
+
67
+ [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
58
68
 
59
69
  The schema to set.
60
70
 
@@ -4,33 +4,39 @@ Class to perform condition checks.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new EntityConditions()
7
+ ### Constructor
8
8
 
9
- > **new EntityConditions**(): [`EntityConditions`](EntityConditions.md)
9
+ > **new EntityConditions**(): `EntityConditions`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`EntityConditions`](EntityConditions.md)
13
+ `EntityConditions`
14
14
 
15
15
  ## Methods
16
16
 
17
17
  ### check()
18
18
 
19
- > `static` **check**\<`T`\>(`entity`, `condition`?): `boolean`
19
+ > `static` **check**\<`T`\>(`entity`, `condition?`): `boolean`
20
20
 
21
21
  See if the entity matches the conditions.
22
22
 
23
23
  #### Type Parameters
24
24
 
25
- **T**
25
+ ##### T
26
+
27
+ `T`
26
28
 
27
29
  #### Parameters
28
30
 
29
- **entity**: `T`
31
+ ##### entity
32
+
33
+ `T`
30
34
 
31
35
  The entity to test.
32
36
 
33
- **condition?**: [`EntityCondition`](../type-aliases/EntityCondition.md)\<`T`\>
37
+ ##### condition?
38
+
39
+ [`EntityCondition`](../type-aliases/EntityCondition.md)\<`T`\>
34
40
 
35
41
  The conditions to test.
36
42
 
@@ -50,15 +56,21 @@ See if the entity matches the conditions.
50
56
 
51
57
  #### Type Parameters
52
58
 
53
- **T**
59
+ ##### T
60
+
61
+ `T`
54
62
 
55
63
  #### Parameters
56
64
 
57
- **entity**: `T`
65
+ ##### entity
66
+
67
+ `T`
58
68
 
59
69
  The entity to test.
60
70
 
61
- **comparator**: [`IComparator`](../interfaces/IComparator.md)
71
+ ##### comparator
72
+
73
+ [`IComparator`](../interfaces/IComparator.md)
62
74
 
63
75
  The condition to test.
64
76
 
@@ -4,13 +4,13 @@ Class to help with entity schema operations.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new EntitySchemaHelper()
7
+ ### Constructor
8
8
 
9
- > **new EntitySchemaHelper**(): [`EntitySchemaHelper`](EntitySchemaHelper.md)
9
+ > **new EntitySchemaHelper**(): `EntitySchemaHelper`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`EntitySchemaHelper`](EntitySchemaHelper.md)
13
+ `EntitySchemaHelper`
14
14
 
15
15
  ## Methods
16
16
 
@@ -22,11 +22,15 @@ Get the schema for the specified object.
22
22
 
23
23
  #### Type Parameters
24
24
 
25
- **T** = `unknown`
25
+ ##### T
26
+
27
+ `T` = `unknown`
26
28
 
27
29
  #### Parameters
28
30
 
29
- **target**: `any`
31
+ ##### target
32
+
33
+ `any`
30
34
 
31
35
  The object to get the schema data for.
32
36
 
@@ -46,11 +50,15 @@ Get the primary key from the entity schema.
46
50
 
47
51
  #### Type Parameters
48
52
 
49
- **T**
53
+ ##### T
54
+
55
+ `T`
50
56
 
51
57
  #### Parameters
52
58
 
53
- **entitySchema**: [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
59
+ ##### entitySchema
60
+
61
+ [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
54
62
 
55
63
  The entity schema to find the primary key from.
56
64
 
@@ -74,11 +82,15 @@ Get the sort properties from the schema.
74
82
 
75
83
  #### Type Parameters
76
84
 
77
- **T**
85
+ ##### T
86
+
87
+ `T`
78
88
 
79
89
  #### Parameters
80
90
 
81
- **entitySchema**: [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
91
+ ##### entitySchema
92
+
93
+ [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
82
94
 
83
95
  The entity schema to find the primary key from.
84
96
 
@@ -92,21 +104,27 @@ The sort keys from the schema or undefined if there are none.
92
104
 
93
105
  ### buildSortProperties()
94
106
 
95
- > `static` **buildSortProperties**\<`T`\>(`entitySchema`, `overrideSortKeys`?): `undefined` \| [`IEntitySort`](../interfaces/IEntitySort.md)\<`T`\>[]
107
+ > `static` **buildSortProperties**\<`T`\>(`entitySchema`, `overrideSortKeys?`): `undefined` \| [`IEntitySort`](../interfaces/IEntitySort.md)\<`T`\>[]
96
108
 
97
109
  Build sort properties from the schema and override if necessary.
98
110
 
99
111
  #### Type Parameters
100
112
 
101
- **T**
113
+ ##### T
114
+
115
+ `T`
102
116
 
103
117
  #### Parameters
104
118
 
105
- **entitySchema**: [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
119
+ ##### entitySchema
120
+
121
+ [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
106
122
 
107
123
  The entity schema to retrieve the default sort keys.
108
124
 
109
- **overrideSortKeys?**: `object`[]
125
+ ##### overrideSortKeys?
126
+
127
+ `object`[]
110
128
 
111
129
  The override sort keys.
112
130
 
@@ -115,3 +133,39 @@ The override sort keys.
115
133
  `undefined` \| [`IEntitySort`](../interfaces/IEntitySort.md)\<`T`\>[]
116
134
 
117
135
  The finalised sort keys.
136
+
137
+ ***
138
+
139
+ ### validateEntity()
140
+
141
+ > `static` **validateEntity**\<`T`\>(`entity`, `entitySchema`): `void`
142
+
143
+ Validate the entity against the schema.
144
+
145
+ #### Type Parameters
146
+
147
+ ##### T
148
+
149
+ `T`
150
+
151
+ #### Parameters
152
+
153
+ ##### entity
154
+
155
+ `T`
156
+
157
+ The entity to validate.
158
+
159
+ ##### entitySchema
160
+
161
+ [`IEntitySchema`](../interfaces/IEntitySchema.md)\<`T`\>
162
+
163
+ The schema to validate against.
164
+
165
+ #### Returns
166
+
167
+ `void`
168
+
169
+ #### Throws
170
+
171
+ If the entity is invalid.
@@ -4,33 +4,39 @@ Class to perform sort operations on entities.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new EntitySorter()
7
+ ### Constructor
8
8
 
9
- > **new EntitySorter**(): [`EntitySorter`](EntitySorter.md)
9
+ > **new EntitySorter**(): `EntitySorter`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`EntitySorter`](EntitySorter.md)
13
+ `EntitySorter`
14
14
 
15
15
  ## Methods
16
16
 
17
17
  ### sort()
18
18
 
19
- > `static` **sort**\<`T`\>(`entities`, `entitySorters`?): `T`[]
19
+ > `static` **sort**\<`T`\>(`entities`, `entitySorters?`): `T`[]
20
20
 
21
21
  Sort a list of entities using multiple keys and direction.
22
22
 
23
23
  #### Type Parameters
24
24
 
25
- **T**
25
+ ##### T
26
+
27
+ `T`
26
28
 
27
29
  #### Parameters
28
30
 
29
- **entities**: `T`[]
31
+ ##### entities
32
+
33
+ `T`[]
30
34
 
31
35
  The list of entities.
32
36
 
33
- **entitySorters?**: [`IEntitySort`](../interfaces/IEntitySort.md)\<`T`\>[]
37
+ ##### entitySorters?
38
+
39
+ [`IEntitySort`](../interfaces/IEntitySort.md)\<`T`\>[]
34
40
 
35
41
  The sort keys to use.
36
42
 
@@ -50,27 +56,39 @@ Compare two properties.
50
56
 
51
57
  #### Type Parameters
52
58
 
53
- **T**
59
+ ##### T
60
+
61
+ `T`
54
62
 
55
63
  #### Parameters
56
64
 
57
- **entity1**: `T`
65
+ ##### entity1
66
+
67
+ `T`
58
68
 
59
69
  The first entity.
60
70
 
61
- **entity2**: `T`
71
+ ##### entity2
72
+
73
+ `T`
62
74
 
63
75
  The second entity.
64
76
 
65
- **prop**: keyof `T`
77
+ ##### prop
78
+
79
+ keyof `T`
66
80
 
67
81
  The property to compare.
68
82
 
69
- **type**: [`EntitySchemaPropertyType`](../type-aliases/EntitySchemaPropertyType.md)
83
+ ##### type
84
+
85
+ [`EntitySchemaPropertyType`](../type-aliases/EntitySchemaPropertyType.md)
70
86
 
71
87
  The type of the property.
72
88
 
73
- **direction**: [`SortDirection`](../type-aliases/SortDirection.md) = `SortDirection.Ascending`
89
+ ##### direction
90
+
91
+ [`SortDirection`](../type-aliases/SortDirection.md) = `SortDirection.Ascending`
74
92
 
75
93
  The direction of the sort.
76
94
 
@@ -1,12 +1,14 @@
1
1
  # Function: entity()
2
2
 
3
- > **entity**(`options`?): `any`
3
+ > **entity**(`options?`): `any`
4
4
 
5
5
  Decorator to produce schema data for entity.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **options?**: [`IEntitySchemaOptions`](../interfaces/IEntitySchemaOptions.md)
9
+ ### options?
10
+
11
+ [`IEntitySchemaOptions`](../interfaces/IEntitySchemaOptions.md)
10
12
 
11
13
  The options for the entity.
12
14
 
@@ -6,7 +6,9 @@ Decorator to produce schema property data for entities.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **options**: `Omit`\<[`IEntitySchemaProperty`](../interfaces/IEntitySchemaProperty.md)\<`unknown`\>, `"property"`\>
9
+ ### options
10
+
11
+ `Omit`\<[`IEntitySchemaProperty`](../interfaces/IEntitySchemaProperty.md), `"property"`\>
10
12
 
11
13
  The options for the property.
12
14
 
@@ -4,7 +4,9 @@ Interface defining condition group operator.
4
4
 
5
5
  ## Type Parameters
6
6
 
7
- **T** = `unknown`
7
+ ### T
8
+
9
+ `T` = `unknown`
8
10
 
9
11
  ## Properties
10
12
 
@@ -4,7 +4,9 @@ Definition for an entity schema.
4
4
 
5
5
  ## Type Parameters
6
6
 
7
- **T** = `unknown`
7
+ ### T
8
+
9
+ `T` = `unknown`
8
10
 
9
11
  ## Properties
10
12
 
@@ -4,7 +4,9 @@ Definition for an entity schema property.
4
4
 
5
5
  ## Type Parameters
6
6
 
7
- **T** = `unknown`
7
+ ### T
8
+
9
+ `T` = `unknown`
8
10
 
9
11
  ## Properties
10
12
 
@@ -4,7 +4,9 @@ Definition of an entity property sort details.
4
4
 
5
5
  ## Type Parameters
6
6
 
7
- **T**
7
+ ### T
8
+
9
+ `T`
8
10
 
9
11
  ## Properties
10
12
 
@@ -1,5 +1,5 @@
1
1
  # Type Alias: ComparisonOperator
2
2
 
3
- > **ComparisonOperator**: *typeof* [`ComparisonOperator`](../variables/ComparisonOperator.md)\[keyof *typeof* [`ComparisonOperator`](../variables/ComparisonOperator.md)\]
3
+ > **ComparisonOperator** = *typeof* [`ComparisonOperator`](../variables/ComparisonOperator.md)\[keyof *typeof* [`ComparisonOperator`](../variables/ComparisonOperator.md)\]
4
4
 
5
5
  The types of comparisons.
@@ -1,9 +1,11 @@
1
1
  # Type Alias: EntityCondition\<T\>
2
2
 
3
- > **EntityCondition**\<`T`\>: [`IComparator`](../interfaces/IComparator.md) \| [`IComparatorGroup`](../interfaces/IComparatorGroup.md)\<`T`\>
3
+ > **EntityCondition**\<`T`\> = [`IComparator`](../interfaces/IComparator.md) \| [`IComparatorGroup`](../interfaces/IComparatorGroup.md)\<`T`\>
4
4
 
5
5
  Type defining condition for entities filtering.
6
6
 
7
7
  ## Type Parameters
8
8
 
9
- **T**
9
+ ### T
10
+
11
+ `T`
@@ -1,5 +1,5 @@
1
1
  # Type Alias: EntitySchemaPropertyFormat
2
2
 
3
- > **EntitySchemaPropertyFormat**: *typeof* [`EntitySchemaPropertyFormat`](../variables/EntitySchemaPropertyFormat.md)\[keyof *typeof* [`EntitySchemaPropertyFormat`](../variables/EntitySchemaPropertyFormat.md)\]
3
+ > **EntitySchemaPropertyFormat** = *typeof* [`EntitySchemaPropertyFormat`](../variables/EntitySchemaPropertyFormat.md)\[keyof *typeof* [`EntitySchemaPropertyFormat`](../variables/EntitySchemaPropertyFormat.md)\]
4
4
 
5
5
  Definition of the entity property type's format.
@@ -1,5 +1,5 @@
1
1
  # Type Alias: EntitySchemaPropertyType
2
2
 
3
- > **EntitySchemaPropertyType**: *typeof* [`EntitySchemaPropertyType`](../variables/EntitySchemaPropertyType.md)\[keyof *typeof* [`EntitySchemaPropertyType`](../variables/EntitySchemaPropertyType.md)\]
3
+ > **EntitySchemaPropertyType** = *typeof* [`EntitySchemaPropertyType`](../variables/EntitySchemaPropertyType.md)\[keyof *typeof* [`EntitySchemaPropertyType`](../variables/EntitySchemaPropertyType.md)\]
4
4
 
5
5
  Definition of the entity property types.
@@ -1,5 +1,5 @@
1
1
  # Type Alias: LogicalOperator
2
2
 
3
- > **LogicalOperator**: *typeof* [`LogicalOperator`](../variables/LogicalOperator.md)\[keyof *typeof* [`LogicalOperator`](../variables/LogicalOperator.md)\]
3
+ > **LogicalOperator** = *typeof* [`LogicalOperator`](../variables/LogicalOperator.md)\[keyof *typeof* [`LogicalOperator`](../variables/LogicalOperator.md)\]
4
4
 
5
5
  The logical operators for condition combining.
@@ -1,5 +1,5 @@
1
1
  # Type Alias: SortDirection
2
2
 
3
- > **SortDirection**: *typeof* [`SortDirection`](../variables/SortDirection.md)\[keyof *typeof* [`SortDirection`](../variables/SortDirection.md)\]
3
+ > **SortDirection** = *typeof* [`SortDirection`](../variables/SortDirection.md)\[keyof *typeof* [`SortDirection`](../variables/SortDirection.md)\]
4
4
 
5
5
  The sort directions.
@@ -4,7 +4,7 @@
4
4
 
5
5
  The types of comparisons.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### Equals
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Definition of the entity property format.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### Uuid
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Definition of the entity property types.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### String
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  The logical operators for condition combining.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### And
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  The sort directions.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### Ascending
10
10
 
package/locales/en.json CHANGED
@@ -2,7 +2,11 @@
2
2
  "error": {
3
3
  "entitySchemaHelper": {
4
4
  "noIsPrimary": "Property \"entitySchema.properties\" must contain a value with isPrimary set",
5
- "multipleIsPrimary": "Property \"entitySchema.properties\" contains more than one property with isPrimary set"
5
+ "multipleIsPrimary": "Property \"entitySchema.properties\" contains more than one property with isPrimary set",
6
+ "invalidEntityProperties": "The schema has no properties defined, but the entity has properties",
7
+ "invalidEntityProperty": "The entity value of \"{value}\" does not match the type \"{type}\" for property \"{property}\"",
8
+ "invalidOptional": "The entity property \"{property}\" of type \"{type}\" is not optional, but no value has been provided",
9
+ "invalidEntityKeys": "The entity had additional properties that are not in the schema, \"{keys}\""
6
10
  }
7
11
  }
8
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/entity",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.2-next.10",
4
4
  "description": "Helpers for defining and working with entities",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.1-next.9",
18
- "@twin.org/nameof": "next",
17
+ "@twin.org/core": "0.0.2-next.10",
18
+ "@twin.org/nameof": "0.0.2-next.10",
19
19
  "reflect-metadata": "0.2.2"
20
20
  },
21
21
  "main": "./dist/cjs/index.cjs",
@@ -23,11 +23,11 @@
23
23
  "types": "./dist/types/index.d.ts",
24
24
  "exports": {
25
25
  ".": {
26
+ "types": "./dist/types/index.d.ts",
26
27
  "require": "./dist/cjs/index.cjs",
27
- "import": "./dist/esm/index.mjs",
28
- "types": "./dist/types/index.d.ts"
28
+ "import": "./dist/esm/index.mjs"
29
29
  },
30
- "./locales": "./locales"
30
+ "./locales/*.json": "./locales/*.json"
31
31
  },
32
32
  "files": [
33
33
  "dist/cjs",