@twin.org/entity-storage-models 0.0.3-next.24 → 0.0.3-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.
Files changed (39) hide show
  1. package/dist/es/helpers/migrationHelper.js +125 -86
  2. package/dist/es/helpers/migrationHelper.js.map +1 -1
  3. package/dist/es/index.js +1 -3
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/es/models/IEntityStorageMigrationConnector.js.map +1 -1
  6. package/dist/es/models/IMigrationOptions.js.map +1 -1
  7. package/dist/es/models/IResolvedMigrationStep.js.map +1 -1
  8. package/dist/es/models/ISchemaMigration.js.map +1 -1
  9. package/dist/es/models/entityPropertyTransformer.js +2 -0
  10. package/dist/es/models/entityPropertyTransformer.js.map +1 -0
  11. package/dist/types/helpers/migrationHelper.d.ts +34 -26
  12. package/dist/types/index.d.ts +1 -3
  13. package/dist/types/models/IEntityStorageMigrationConnector.d.ts +2 -2
  14. package/dist/types/models/IMigrationOptions.d.ts +6 -21
  15. package/dist/types/models/IResolvedMigrationStep.d.ts +7 -5
  16. package/dist/types/models/ISchemaMigration.d.ts +7 -4
  17. package/dist/types/models/entityPropertyTransformer.d.ts +6 -0
  18. package/docs/changelog.md +7 -0
  19. package/docs/reference/classes/MigrationHelper.md +91 -50
  20. package/docs/reference/index.md +4 -6
  21. package/docs/reference/interfaces/IEntityStorageMigrationConnector.md +2 -2
  22. package/docs/reference/interfaces/IMigrationOptions.md +9 -79
  23. package/docs/reference/interfaces/IResolvedMigrationStep.md +9 -13
  24. package/docs/reference/interfaces/ISchemaMigration.md +9 -12
  25. package/docs/reference/type-aliases/EntityPropertyTransformer.md +34 -0
  26. package/locales/en.json +8 -7
  27. package/package.json +2 -1
  28. package/dist/es/entities/schemaVersion.js +0 -39
  29. package/dist/es/entities/schemaVersion.js.map +0 -1
  30. package/dist/es/schema.js +0 -11
  31. package/dist/es/schema.js.map +0 -1
  32. package/dist/es/services/schemaVersionService.js +0 -265
  33. package/dist/es/services/schemaVersionService.js.map +0 -1
  34. package/dist/types/entities/schemaVersion.d.ts +0 -19
  35. package/dist/types/schema.d.ts +0 -4
  36. package/dist/types/services/schemaVersionService.d.ts +0 -60
  37. package/docs/reference/classes/SchemaVersion.md +0 -39
  38. package/docs/reference/classes/SchemaVersionService.md +0 -130
  39. package/docs/reference/functions/initSchema.md +0 -9
@@ -1,4 +1,4 @@
1
- import type { IMigrationOptions } from "./IMigrationOptions.js";
1
+ import type { EntityPropertyTransformer } from "./entityPropertyTransformer.js";
2
2
  /**
3
3
  * Optional per-step override for a single version-to-version migration.
4
4
  * Only register an entry in SchemaMigrationFactory when a step requires property
@@ -20,8 +20,11 @@ export interface ISchemaMigration<T = unknown, U = unknown> {
20
20
  to: string;
21
21
  }[];
22
22
  /**
23
- * Optional per-property transformer for object/array properties that cannot be
24
- * automatically coerced. T is the source entity type, U is the target entity type.
23
+ * Optional transformation for properties, usually only called for object and array types.
24
+ * @param schema1Property The property schema in the old schema.
25
+ * @param schemaProperty2 The property schema in the new schema.
26
+ * @param value The value of the property in the old schema.
27
+ * @returns The transformed value to match the new schema.
25
28
  */
26
- transformEntityProperty?: IMigrationOptions<T, U>["transformEntityProperty"];
29
+ transformEntityProperty?: EntityPropertyTransformer<T, U>;
27
30
  }
@@ -0,0 +1,6 @@
1
+ import type { IEntitySchemaProperty } from "@twin.org/entity";
2
+ /**
3
+ * Type for the optional transformEntityProperty function.
4
+ * Used in migration steps for custom property transformations.
5
+ */
6
+ export type EntityPropertyTransformer<T = unknown, U = unknown> = (schema1Property: IEntitySchemaProperty<T>, schemaProperty2: IEntitySchemaProperty<U>, value: unknown) => unknown;
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.25](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-models-v0.0.3-next.24...entity-storage-models-v0.0.3-next.25) (2026-06-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * migration progress ([#121](https://github.com/iotaledger/twin-entity-storage/issues/121)) ([d032162](https://github.com/iotaledger/twin-entity-storage/commit/d032162768b6b7d4ccca7e39b80f8bc3ba46440e))
9
+
3
10
  ## [0.0.3-next.24](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-models-v0.0.3-next.23...entity-storage-models-v0.0.3-next.24) (2026-06-08)
4
11
 
5
12
 
@@ -24,56 +24,93 @@ Runtime name for the class.
24
24
 
25
25
  ## Methods
26
26
 
27
- ### applyEntityTransform() {#applyentitytransform}
27
+ ### migrateWithChain() {#migratewithchain}
28
28
 
29
- > `static` **applyEntityTransform**\<`T`, `U`\>(`entity`, `schemaDiff`, `transformEntityProperty?`): `U`
29
+ > `static` **migrateWithChain**(`sourceConnector`, `targetSchemaName`, `steps`, `options?`, `loggingComponentType?`): `Promise`\<\{ `finalConnector`: [`IEntityStorageConnector`](../interfaces/IEntityStorageConnector.md); `migrated`: `number`; \}\>
30
30
 
31
- Applies the entity transformation for a single diff, handling added, removed, and
32
- modified properties according to the provided schema diff and optional transform hook.
31
+ Performs a chain migration in a single connector swap, regardless of how many version
32
+ steps the chain spans. Creates one target connector, reads all source entities, applies
33
+ applyEntityChain to each, writes them to the target, then finalizes the migration.
34
+ A chain of one step is equivalent to a traditional single-step migration.
33
35
 
34
- #### Type Parameters
36
+ #### Parameters
35
37
 
36
- ##### T
38
+ ##### sourceConnector
37
39
 
38
- `T` = `unknown`
40
+ [`IEntityStorageMigrationConnector`](../interfaces/IEntityStorageMigrationConnector.md)
39
41
 
40
- ##### U
42
+ The connector holding data at the stored schema version.
41
43
 
42
- `U` = `unknown`
44
+ ##### targetSchemaName
43
45
 
44
- #### Parameters
46
+ `string`
45
47
 
46
- ##### entity
48
+ The schema name for the current version (used to create the target connector).
47
49
 
48
- `Partial`\<`T`\>
50
+ ##### steps
49
51
 
50
- The entity to transform.
52
+ [`IResolvedMigrationStep`](../interfaces/IResolvedMigrationStep.md)\<`unknown`, `unknown`\>[]
51
53
 
52
- ##### schemaDiff
54
+ Ordered, fully-resolved migration steps from stored to current version.
53
55
 
54
- `IEntitySchemaDiff`\<`T`, `U`\>
56
+ ##### options?
55
57
 
56
- The schema diff between the old and new schemas.
58
+ [`IMigrationOptions`](../interfaces/IMigrationOptions.md)
57
59
 
58
- ##### transformEntityProperty?
60
+ Optional migration options.
59
61
 
60
- (`schema1Property`, `schemaProperty2`, `value`) => `unknown`
62
+ ##### loggingComponentType?
61
63
 
62
- Optional per-property transform hook for object/array properties.
64
+ `string`
65
+
66
+ The optional component type to use for logging the migration progress.
63
67
 
64
68
  #### Returns
65
69
 
66
- `U`
70
+ `Promise`\<\{ `finalConnector`: [`IEntityStorageConnector`](../interfaces/IEntityStorageConnector.md); `migrated`: `number`; \}\>
67
71
 
68
- The transformed entity ready to be written to the new schema.
72
+ The finalized connector and the count of migrated entities.
69
73
 
70
- #### Throws
74
+ ***
71
75
 
72
- GeneralError if a transformation is required for an object or array property but no transformEntityProperty function is provided.
76
+ ### migratePartitionWithChain() {#migratepartitionwithchain}
73
77
 
74
- #### Throws
78
+ > `static` **migratePartitionWithChain**(`source`, `target`, `steps`, `options?`): `Promise`\<`number`\>
75
79
 
76
- GeneralError if coercion of a modified property results in undefined for a non-optional target property.
80
+ Reads all entities from one partition of the source connector, applies the migration
81
+ chain to each entity, and writes the results to the target connector.
82
+
83
+ #### Parameters
84
+
85
+ ##### source
86
+
87
+ [`IEntityStorageMigrationConnector`](../interfaces/IEntityStorageMigrationConnector.md)
88
+
89
+ The connector to read from (already bootstrapped).
90
+
91
+ ##### target
92
+
93
+ [`IEntityStorageConnector`](../interfaces/IEntityStorageConnector.md)
94
+
95
+ The connector to write to (already bootstrapped).
96
+
97
+ ##### steps
98
+
99
+ [`IResolvedMigrationStep`](../interfaces/IResolvedMigrationStep.md)\<`unknown`, `unknown`\>[]
100
+
101
+ Ordered, fully-resolved migration steps.
102
+
103
+ ##### options?
104
+
105
+ [`IMigrationOptions`](../interfaces/IMigrationOptions.md)
106
+
107
+ Optional migration options (batchSize, progress callbacks, transformEntityProperty).
108
+
109
+ #### Returns
110
+
111
+ `Promise`\<`number`\>
112
+
113
+ The number of entities migrated.
77
114
 
78
115
  ***
79
116
 
@@ -109,49 +146,53 @@ The entity transformed to the shape described by steps[last].toProperties.
109
146
 
110
147
  ***
111
148
 
112
- ### migrateWithChain() {#migratewithchain}
113
-
114
- > `static` **migrateWithChain**(`sourceConnector`, `targetSchemaName`, `steps`, `loggingComponentType?`, `batchSize?`): `Promise`\<\{ `finalConnector`: [`IEntityStorageConnector`](../interfaces/IEntityStorageConnector.md); `migrated`: `number`; \}\>
149
+ ### applyEntityTransform() {#applyentitytransform}
115
150
 
116
- Performs a chain migration in a single connector swap, regardless of how many version
117
- steps the chain spans. Creates one target connector, reads all source entities, applies
118
- applyEntityChain to each, writes them to the target, then finalizes the migration.
119
- A chain of one step is equivalent to a traditional single-step migration.
151
+ > `static` **applyEntityTransform**\<`T`, `U`\>(`entity`, `schemaDiff`, `transformEntityProperty?`): `U`
120
152
 
121
- #### Parameters
153
+ Applies the entity transformation for a single diff, handling added, removed, and
154
+ modified properties according to the provided schema diff and optional transform hook.
122
155
 
123
- ##### sourceConnector
156
+ #### Type Parameters
124
157
 
125
- [`IEntityStorageMigrationConnector`](../interfaces/IEntityStorageMigrationConnector.md)
158
+ ##### T
126
159
 
127
- The connector holding data at the stored schema version.
160
+ `T` = `unknown`
128
161
 
129
- ##### targetSchemaName
162
+ ##### U
130
163
 
131
- `string`
164
+ `U` = `unknown`
132
165
 
133
- The schema name for the current version (used to create the target connector).
166
+ #### Parameters
134
167
 
135
- ##### steps
168
+ ##### entity
136
169
 
137
- [`IResolvedMigrationStep`](../interfaces/IResolvedMigrationStep.md)\<`unknown`, `unknown`\>[]
170
+ `Partial`\<`T`\>
138
171
 
139
- Ordered, fully-resolved migration steps from stored to current version.
172
+ The entity to transform.
140
173
 
141
- ##### loggingComponentType?
174
+ ##### schemaDiff
142
175
 
143
- `string`
176
+ `IEntitySchemaDiff`\<`T`, `U`\>
144
177
 
145
- An optional logging component type for connector startup.
178
+ The schema diff between the old and new schemas.
146
179
 
147
- ##### batchSize?
180
+ ##### transformEntityProperty?
148
181
 
149
- `number` = `100`
182
+ [`EntityPropertyTransformer`](../type-aliases/EntityPropertyTransformer.md)\<`T`, `U`\>
150
183
 
151
- Number of entities to read and write per batch. Defaults to 100.
184
+ Optional per-property transform hook for object/array properties.
152
185
 
153
186
  #### Returns
154
187
 
155
- `Promise`\<\{ `finalConnector`: [`IEntityStorageConnector`](../interfaces/IEntityStorageConnector.md); `migrated`: `number`; \}\>
188
+ `U`
156
189
 
157
- The finalized connector and the count of migrated entities.
190
+ The transformed entity ready to be written to the new schema.
191
+
192
+ #### Throws
193
+
194
+ GeneralError if a transformation is required for an object or array property but no transformEntityProperty function is provided.
195
+
196
+ #### Throws
197
+
198
+ GeneralError if coercion of a modified property results in undefined for a non-optional target property.
@@ -2,10 +2,8 @@
2
2
 
3
3
  ## Classes
4
4
 
5
- - [SchemaVersion](classes/SchemaVersion.md)
6
5
  - [EntityStorageHelper](classes/EntityStorageHelper.md)
7
6
  - [MigrationHelper](classes/MigrationHelper.md)
8
- - [SchemaVersionService](classes/SchemaVersionService.md)
9
7
 
10
8
  ## Interfaces
11
9
 
@@ -27,11 +25,11 @@
27
25
  - [IEntityStorageSetBatchRequest](interfaces/IEntityStorageSetBatchRequest.md)
28
26
  - [IEntityStorageSetRequest](interfaces/IEntityStorageSetRequest.md)
29
27
 
28
+ ## Type Aliases
29
+
30
+ - [EntityPropertyTransformer](type-aliases/EntityPropertyTransformer.md)
31
+
30
32
  ## Variables
31
33
 
32
34
  - [EntityStorageConnectorFactory](variables/EntityStorageConnectorFactory.md)
33
35
  - [SchemaMigrationFactory](variables/SchemaMigrationFactory.md)
34
-
35
- ## Functions
36
-
37
- - [initSchema](functions/initSchema.md)
@@ -345,7 +345,7 @@ The target connector to finalize the migration with.
345
345
 
346
346
  ##### options?
347
347
 
348
- [`IMigrationOptions`](IMigrationOptions.md)\<`T`, `U`\>
348
+ [`IMigrationOptions`](IMigrationOptions.md)
349
349
 
350
350
  The options to control how the migration is finalized.
351
351
 
@@ -385,7 +385,7 @@ The target connector to cleanup the migration with.
385
385
 
386
386
  ##### options?
387
387
 
388
- [`IMigrationOptions`](IMigrationOptions.md)\<`T`, `U`\>
388
+ [`IMigrationOptions`](IMigrationOptions.md)
389
389
 
390
390
  The options to control how the migration is cleaned up.
391
391
 
@@ -1,17 +1,7 @@
1
- # Interface: IMigrationOptions\<T, U\>
1
+ # Interface: IMigrationOptions
2
2
 
3
3
  Options controlling how a schema migration is executed.
4
4
 
5
- ## Type Parameters
6
-
7
- ### T
8
-
9
- `T`
10
-
11
- ### U
12
-
13
- `U`
14
-
15
5
  ## Properties
16
6
 
17
7
  ### batchSize? {#batchsize}
@@ -28,91 +18,31 @@ Number of entities to read and write per batch.
28
18
 
29
19
  ***
30
20
 
31
- ### transformEntityProperty? {#transformentityproperty}
32
-
33
- > `optional` **transformEntityProperty?**: (`schema1Property`, `schemaProperty2`, `value`) => `unknown`
34
-
35
- Optional transformation for properties, usually only called for object and array types.
36
-
37
- #### Parameters
38
-
39
- ##### schema1Property
40
-
41
- `IEntitySchemaProperty`\<`T`\>
42
-
43
- The property schema in the old schema.
44
-
45
- ##### schemaProperty2
46
-
47
- `IEntitySchemaProperty`\<`U`\>
48
-
49
- The property schema in the new schema.
50
-
51
- ##### value
52
-
53
- `unknown`
54
-
55
- The value of the property in the old schema.
56
-
57
- #### Returns
58
-
59
- `unknown`
60
-
61
- The transformed value to match the new schema.
62
-
63
- ***
64
-
65
- ### onPartitionProgress? {#onpartitionprogress}
66
-
67
- > `optional` **onPartitionProgress?**: (`rowTotal`, `rowIndex`) => `Promise`\<`void`\>
68
-
69
- Called for each partition for progress tracking.
70
-
71
- #### Parameters
72
-
73
- ##### rowTotal
74
-
75
- `number`
76
-
77
- The total number of rows to migrate.
78
-
79
- ##### rowIndex
80
-
81
- `number`
82
-
83
- The number of rows migrated so far.
84
-
85
- #### Returns
86
-
87
- `Promise`\<`void`\>
88
-
89
- ***
90
-
91
- ### onStepProgress? {#onstepprogress}
21
+ ### onProgress? {#onprogress}
92
22
 
93
- > `optional` **onStepProgress?**: (`stepKey`, `itemTotal`, `itemIndex`) => `Promise`\<`void`\>
23
+ > `optional` **onProgress?**: (`progressItem`, `itemTotal`, `itemIndex`) => `Promise`\<`void`\>
94
24
 
95
- Called for overall progress tracking.
25
+ Called for progress tracking.
96
26
 
97
27
  #### Parameters
98
28
 
99
- ##### stepKey
29
+ ##### progressItem
100
30
 
101
- `string`
31
+ `"partitionStart"` \| `"partitionProgress"` \| `"partitionEnd"` \| `"partitionItemsStart"` \| `"partitionItemsProgress"` \| `"partitionItemsEnd"`
102
32
 
103
- The key representing the current step in the migration.
33
+ The item progress being updated.
104
34
 
105
35
  ##### itemTotal
106
36
 
107
37
  `number`
108
38
 
109
- The total number of items in this progress.
39
+ The total number of rows to migrate.
110
40
 
111
41
  ##### itemIndex
112
42
 
113
43
  `number`
114
44
 
115
- The number of items processed so far.
45
+ The number of rows migrated so far.
116
46
 
117
47
  #### Returns
118
48
 
@@ -57,26 +57,22 @@ Optional property renames for this step, forwarded to EntitySchemaDiffHelper.dif
57
57
 
58
58
  ### transformEntityProperty? {#transformentityproperty}
59
59
 
60
- > `optional` **transformEntityProperty?**: (`schema1Property`, `schemaProperty2`, `value`) => `unknown`
60
+ > `optional` **transformEntityProperty?**: [`EntityPropertyTransformer`](../type-aliases/EntityPropertyTransformer.md)\<`T`, `U`\>
61
61
 
62
- Optional per-property transformer for object/array properties that the structural
63
- diff cannot handle automatically. Sourced from an ISchemaMigration override when
64
- one is registered in SchemaMigrationFactory for this step.
62
+ Optional transformation for properties, usually only called for object and array types.
65
63
 
66
- #### Parameters
64
+ #### Param
67
65
 
68
- ##### schema1Property
66
+ The property schema in the old schema.
69
67
 
70
- `IEntitySchemaProperty`\<`T`\>
68
+ #### Param
71
69
 
72
- ##### schemaProperty2
70
+ The property schema in the new schema.
73
71
 
74
- `IEntitySchemaProperty`\<`U`\>
72
+ #### Param
75
73
 
76
- ##### value
77
-
78
- `unknown`
74
+ The value of the property in the old schema.
79
75
 
80
76
  #### Returns
81
77
 
82
- `unknown`
78
+ The transformed value to match the new schema.
@@ -41,25 +41,22 @@ Optional property renames to apply during this step.
41
41
 
42
42
  ### transformEntityProperty? {#transformentityproperty}
43
43
 
44
- > `optional` **transformEntityProperty?**: (`schema1Property`, `schemaProperty2`, `value`) => `unknown`
44
+ > `optional` **transformEntityProperty?**: [`EntityPropertyTransformer`](../type-aliases/EntityPropertyTransformer.md)\<`T`, `U`\>
45
45
 
46
- Optional per-property transformer for object/array properties that cannot be
47
- automatically coerced. T is the source entity type, U is the target entity type.
46
+ Optional transformation for properties, usually only called for object and array types.
48
47
 
49
- #### Parameters
48
+ #### Param
50
49
 
51
- ##### schema1Property
50
+ The property schema in the old schema.
52
51
 
53
- `IEntitySchemaProperty`\<`T`\>
52
+ #### Param
54
53
 
55
- ##### schemaProperty2
54
+ The property schema in the new schema.
56
55
 
57
- `IEntitySchemaProperty`\<`U`\>
56
+ #### Param
58
57
 
59
- ##### value
60
-
61
- `unknown`
58
+ The value of the property in the old schema.
62
59
 
63
60
  #### Returns
64
61
 
65
- `unknown`
62
+ The transformed value to match the new schema.
@@ -0,0 +1,34 @@
1
+ # Type Alias: EntityPropertyTransformer\<T, U\>
2
+
3
+ > **EntityPropertyTransformer**\<`T`, `U`\> = (`schema1Property`, `schemaProperty2`, `value`) => `unknown`
4
+
5
+ Type for the optional transformEntityProperty function.
6
+ Used in migration steps for custom property transformations.
7
+
8
+ ## Type Parameters
9
+
10
+ ### T
11
+
12
+ `T` = `unknown`
13
+
14
+ ### U
15
+
16
+ `U` = `unknown`
17
+
18
+ ## Parameters
19
+
20
+ ### schema1Property
21
+
22
+ `IEntitySchemaProperty`\<`T`\>
23
+
24
+ ### schemaProperty2
25
+
26
+ `IEntitySchemaProperty`\<`U`\>
27
+
28
+ ### value
29
+
30
+ `unknown`
31
+
32
+ ## Returns
33
+
34
+ `unknown`
package/locales/en.json CHANGED
@@ -5,15 +5,16 @@
5
5
  "propertyNotInSchema": "The property \"{property}\" does not exist in the schema and cannot be used for projection"
6
6
  },
7
7
  "migrationHelper": {
8
- "migrationFailed": "Migration failed.",
8
+ "migrateSchemaFailed": "Migration failed for schema \"{schemaName}\".",
9
9
  "transformRequiredForProperty": "A transformation function is required to migrate property \"{from}\" to \"{to}\" of type \"{type}\"",
10
10
  "coercionProducedUndefined": "Coercion of property \"{property}\" to type \"{type}\" produced undefined but the property is not optional"
11
- },
12
- "schemaVersionService": {
13
- "storedVersionNewer": "Stored schema version ({stored}) for \"{schemaName}\" is newer than the current version ({current}). Downgrade is not supported.",
14
- "noMigrationStep": "No migration step from version {missingFromVersion} to {missingToVersion} found for \"{schemaName}\". Cannot complete migration from {stored} to {current}. Register the versioned schema class \"{schemaName}V{missingFromVersion}\" in EntitySchemaFactory.",
15
- "noMigrationStepTarget": "No target schema for migration step {missingFromVersion} to {missingToVersion} found for \"{schemaName}\". Cannot complete migration from {stored} to {current}. Register the versioned schema class \"{schemaName}V{missingToVersion}\" in EntitySchemaFactory.",
16
- "connectorNotMigrationCapable": "Schema \"{schemaName}\" needs migration from version {stored} to {current} but its connector does not support automatic migration. Please migrate the schema manually before starting the node."
11
+ }
12
+ },
13
+ "info": {
14
+ "migrationHelper": {
15
+ "migrateSchemaStarting": "Migrating schema \"{schemaName}\"",
16
+ "migrateSchemaFinalizing": "Finalizing migration of schema \"{schemaName}\"",
17
+ "migrateSchemaComplete": "Migration of schema \"{schemaName}\" complete"
17
18
  }
18
19
  }
19
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-models",
3
- "version": "0.0.3-next.24",
3
+ "version": "0.0.3-next.25",
4
4
  "description": "Shared models for storage contracts, requests, responses and connector capabilities.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,6 +17,7 @@
17
17
  "@twin.org/context": "next",
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/entity": "next",
20
+ "@twin.org/logging-models": "next",
20
21
  "@twin.org/nameof": "next"
21
22
  },
22
23
  "main": "./dist/es/index.js",
@@ -1,39 +0,0 @@
1
- // Copyright 2026 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { entity, property } from "@twin.org/entity";
4
- /**
5
- * Tracks the currently applied schema version for each managed entity schema.
6
- * One record per schema name. Written once on first boot, then updated after
7
- * each successful migration.
8
- */
9
- let SchemaVersion = class SchemaVersion {
10
- /**
11
- * The entity schema type name — primary key.
12
- */
13
- schemaName;
14
- /**
15
- * The currently deployed version of this schema.
16
- */
17
- version;
18
- /**
19
- * ISO 8601 timestamp of the last version write.
20
- */
21
- updatedAt;
22
- };
23
- __decorate([
24
- property({ type: "string", isPrimary: true }),
25
- __metadata("design:type", String)
26
- ], SchemaVersion.prototype, "schemaName", void 0);
27
- __decorate([
28
- property({ type: "integer" }),
29
- __metadata("design:type", Number)
30
- ], SchemaVersion.prototype, "version", void 0);
31
- __decorate([
32
- property({ type: "string", format: "date-time" }),
33
- __metadata("design:type", String)
34
- ], SchemaVersion.prototype, "updatedAt", void 0);
35
- SchemaVersion = __decorate([
36
- entity()
37
- ], SchemaVersion);
38
- export { SchemaVersion };
39
- //# sourceMappingURL=schemaVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaVersion.js","sourceRoot":"","sources":["../../../src/entities/schemaVersion.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;GAIG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;IACzB;;OAEG;IAEI,UAAU,CAAU;IAE3B;;OAEG;IAEI,OAAO,CAAU;IAExB;;OAEG;IAEI,SAAS,CAAU;CAC1B,CAAA;AAbO;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;iDACnB;AAMpB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;8CACN;AAMjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;;gDACxB;AAjBd,aAAa;IADzB,MAAM,EAAE;GACI,aAAa,CAkBzB","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { entity, property } from \"@twin.org/entity\";\n\n/**\n * Tracks the currently applied schema version for each managed entity schema.\n * One record per schema name. Written once on first boot, then updated after\n * each successful migration.\n */\n@entity()\nexport class SchemaVersion {\n\t/**\n\t * The entity schema type name — primary key.\n\t */\n\t@property({ type: \"string\", isPrimary: true })\n\tpublic schemaName!: string;\n\n\t/**\n\t * The currently deployed version of this schema.\n\t */\n\t@property({ type: \"integer\" })\n\tpublic version!: number;\n\n\t/**\n\t * ISO 8601 timestamp of the last version write.\n\t */\n\t@property({ type: \"string\", format: \"date-time\" })\n\tpublic updatedAt!: string;\n}\n"]}
package/dist/es/schema.js DELETED
@@ -1,11 +0,0 @@
1
- // Copyright 2026 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { EntitySchemaFactory, EntitySchemaHelper } from "@twin.org/entity";
4
- import { SchemaVersion } from "./entities/schemaVersion.js";
5
- /**
6
- * Initialize the schema for the entity storage models.
7
- */
8
- export function initSchema() {
9
- EntitySchemaFactory.register("SchemaVersion", () => EntitySchemaHelper.getSchema(SchemaVersion));
10
- }
11
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;GAEG;AACH,MAAM,UAAU,UAAU;IACzB,mBAAmB,CAAC,QAAQ,kBAA0B,GAAG,EAAE,CAC1D,kBAAkB,CAAC,SAAS,CAAC,aAAa,CAAC,CAC3C,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { EntitySchemaFactory, EntitySchemaHelper } from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { SchemaVersion } from \"./entities/schemaVersion.js\";\n\n/**\n * Initialize the schema for the entity storage models.\n */\nexport function initSchema(): void {\n\tEntitySchemaFactory.register(nameof<SchemaVersion>(), () =>\n\t\tEntitySchemaHelper.getSchema(SchemaVersion)\n\t);\n}\n"]}