@twin.org/entity-storage-service 0.0.3-next.3 → 0.0.3-next.30
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/README.md +2 -2
- package/dist/es/entities/schemaVersion.js +39 -0
- package/dist/es/entities/schemaVersion.js.map +1 -0
- package/dist/es/entityStorageRoutes.js +176 -4
- package/dist/es/entityStorageRoutes.js.map +1 -1
- package/dist/es/entityStorageService.js +44 -49
- package/dist/es/entityStorageService.js.map +1 -1
- package/dist/es/index.js +6 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IEntityStorageRoutesExamples.js.map +1 -1
- package/dist/es/models/ISchemaVersionServiceConfig.js +4 -0
- package/dist/es/models/ISchemaVersionServiceConfig.js.map +1 -0
- package/dist/es/models/ISchemaVersionServiceConstructorOptions.js +2 -0
- package/dist/es/models/ISchemaVersionServiceConstructorOptions.js.map +1 -0
- package/dist/es/schema.js +11 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/es/schemaVersionService.js +356 -0
- package/dist/es/schemaVersionService.js.map +1 -0
- package/dist/types/entities/schemaVersion.d.ts +19 -0
- package/dist/types/entityStorageRoutes.d.ts +33 -1
- package/dist/types/entityStorageService.d.ts +38 -3
- package/dist/types/index.d.ts +6 -1
- package/dist/types/models/IEntityStorageRoutesExamples.d.ts +8 -1
- package/dist/types/models/ISchemaVersionServiceConfig.d.ts +9 -0
- package/dist/types/models/ISchemaVersionServiceConstructorOptions.d.ts +15 -0
- package/dist/types/schema.d.ts +4 -0
- package/dist/types/schemaVersionService.d.ts +52 -0
- package/docs/changelog.md +551 -47
- package/docs/examples.md +77 -1
- package/docs/open-api/spec.json +447 -37
- package/docs/reference/classes/EntityStorageService.md +123 -9
- package/docs/reference/classes/SchemaVersion.md +39 -0
- package/docs/reference/classes/SchemaVersionService.md +103 -0
- package/docs/reference/functions/entityStorageCount.md +31 -0
- package/docs/reference/functions/entityStorageEmpty.md +31 -0
- package/docs/reference/functions/entityStorageRemoveBatch.md +31 -0
- package/docs/reference/functions/entityStorageSetBatch.md +31 -0
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +9 -0
- package/docs/reference/interfaces/IEntityStorageRoutesExamples.md +24 -8
- package/docs/reference/interfaces/IEntityStorageServiceConstructorOptions.md +3 -3
- package/docs/reference/interfaces/ISchemaVersionServiceConfig.md +11 -0
- package/docs/reference/interfaces/ISchemaVersionServiceConstructorOptions.md +25 -0
- package/locales/en.json +17 -2
- package/package.json +6 -5
|
@@ -34,7 +34,7 @@ The dependencies for the entity storage service.
|
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
37
|
-
### CLASS\_NAME
|
|
37
|
+
### CLASS\_NAME {#class_name}
|
|
38
38
|
|
|
39
39
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
## Methods
|
|
44
44
|
|
|
45
|
-
### className()
|
|
45
|
+
### className() {#classname}
|
|
46
46
|
|
|
47
47
|
> **className**(): `string`
|
|
48
48
|
|
|
@@ -60,9 +60,9 @@ The class name of the component.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### set()
|
|
63
|
+
### set() {#set}
|
|
64
64
|
|
|
65
|
-
> **set**(`entity`): `Promise`\<`void`\>
|
|
65
|
+
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
66
66
|
|
|
67
67
|
Set an entity.
|
|
68
68
|
|
|
@@ -74,6 +74,12 @@ Set an entity.
|
|
|
74
74
|
|
|
75
75
|
The entity to set.
|
|
76
76
|
|
|
77
|
+
##### conditions?
|
|
78
|
+
|
|
79
|
+
`object`[]
|
|
80
|
+
|
|
81
|
+
The optional conditions to match for the entities.
|
|
82
|
+
|
|
77
83
|
#### Returns
|
|
78
84
|
|
|
79
85
|
`Promise`\<`void`\>
|
|
@@ -86,9 +92,35 @@ The id of the entity.
|
|
|
86
92
|
|
|
87
93
|
***
|
|
88
94
|
|
|
89
|
-
###
|
|
95
|
+
### setBatch() {#setbatch}
|
|
96
|
+
|
|
97
|
+
> **setBatch**(`entities`): `Promise`\<`void`\>
|
|
98
|
+
|
|
99
|
+
Set multiple entities in a batch.
|
|
100
|
+
|
|
101
|
+
#### Parameters
|
|
102
|
+
|
|
103
|
+
##### entities
|
|
104
|
+
|
|
105
|
+
`T`[]
|
|
106
|
+
|
|
107
|
+
The entities to set.
|
|
108
|
+
|
|
109
|
+
#### Returns
|
|
110
|
+
|
|
111
|
+
`Promise`\<`void`\>
|
|
112
|
+
|
|
113
|
+
Nothing.
|
|
114
|
+
|
|
115
|
+
#### Implementation of
|
|
116
|
+
|
|
117
|
+
`IEntityStorageComponent.setBatch`
|
|
118
|
+
|
|
119
|
+
***
|
|
120
|
+
|
|
121
|
+
### get() {#get}
|
|
90
122
|
|
|
91
|
-
> **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
|
|
123
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
92
124
|
|
|
93
125
|
Get an entity.
|
|
94
126
|
|
|
@@ -106,6 +138,12 @@ keyof `T`
|
|
|
106
138
|
|
|
107
139
|
Get the item using a secondary index.
|
|
108
140
|
|
|
141
|
+
##### conditions?
|
|
142
|
+
|
|
143
|
+
`object`[]
|
|
144
|
+
|
|
145
|
+
The optional conditions to match for the entities.
|
|
146
|
+
|
|
109
147
|
#### Returns
|
|
110
148
|
|
|
111
149
|
`Promise`\<`T` \| `undefined`\>
|
|
@@ -118,9 +156,9 @@ The object if it can be found or undefined.
|
|
|
118
156
|
|
|
119
157
|
***
|
|
120
158
|
|
|
121
|
-
### remove()
|
|
159
|
+
### remove() {#remove}
|
|
122
160
|
|
|
123
|
-
> **remove**(`id`): `Promise`\<`void`\>
|
|
161
|
+
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
124
162
|
|
|
125
163
|
Remove the entity.
|
|
126
164
|
|
|
@@ -132,6 +170,12 @@ Remove the entity.
|
|
|
132
170
|
|
|
133
171
|
The id of the entity to remove.
|
|
134
172
|
|
|
173
|
+
##### conditions?
|
|
174
|
+
|
|
175
|
+
`object`[]
|
|
176
|
+
|
|
177
|
+
The optional conditions to match for the entities.
|
|
178
|
+
|
|
135
179
|
#### Returns
|
|
136
180
|
|
|
137
181
|
`Promise`\<`void`\>
|
|
@@ -144,7 +188,77 @@ Nothing.
|
|
|
144
188
|
|
|
145
189
|
***
|
|
146
190
|
|
|
147
|
-
###
|
|
191
|
+
### removeBatch() {#removebatch}
|
|
192
|
+
|
|
193
|
+
> **removeBatch**(`ids`): `Promise`\<`void`\>
|
|
194
|
+
|
|
195
|
+
Remove multiple entities by id.
|
|
196
|
+
|
|
197
|
+
#### Parameters
|
|
198
|
+
|
|
199
|
+
##### ids
|
|
200
|
+
|
|
201
|
+
`string`[]
|
|
202
|
+
|
|
203
|
+
The ids of the entities to remove.
|
|
204
|
+
|
|
205
|
+
#### Returns
|
|
206
|
+
|
|
207
|
+
`Promise`\<`void`\>
|
|
208
|
+
|
|
209
|
+
Nothing.
|
|
210
|
+
|
|
211
|
+
#### Implementation of
|
|
212
|
+
|
|
213
|
+
`IEntityStorageComponent.removeBatch`
|
|
214
|
+
|
|
215
|
+
***
|
|
216
|
+
|
|
217
|
+
### empty() {#empty}
|
|
218
|
+
|
|
219
|
+
> **empty**(): `Promise`\<`void`\>
|
|
220
|
+
|
|
221
|
+
Remove all entities from the storage.
|
|
222
|
+
|
|
223
|
+
#### Returns
|
|
224
|
+
|
|
225
|
+
`Promise`\<`void`\>
|
|
226
|
+
|
|
227
|
+
Nothing.
|
|
228
|
+
|
|
229
|
+
#### Implementation of
|
|
230
|
+
|
|
231
|
+
`IEntityStorageComponent.empty`
|
|
232
|
+
|
|
233
|
+
***
|
|
234
|
+
|
|
235
|
+
### count() {#count}
|
|
236
|
+
|
|
237
|
+
> **count**(`conditions?`): `Promise`\<`number`\>
|
|
238
|
+
|
|
239
|
+
Count all the entities which match the conditions.
|
|
240
|
+
|
|
241
|
+
#### Parameters
|
|
242
|
+
|
|
243
|
+
##### conditions?
|
|
244
|
+
|
|
245
|
+
`EntityCondition`\<`T`\>
|
|
246
|
+
|
|
247
|
+
The optional conditions to match for the entities.
|
|
248
|
+
|
|
249
|
+
#### Returns
|
|
250
|
+
|
|
251
|
+
`Promise`\<`number`\>
|
|
252
|
+
|
|
253
|
+
The total count of entities in the storage.
|
|
254
|
+
|
|
255
|
+
#### Implementation of
|
|
256
|
+
|
|
257
|
+
`IEntityStorageComponent.count`
|
|
258
|
+
|
|
259
|
+
***
|
|
260
|
+
|
|
261
|
+
### query() {#query}
|
|
148
262
|
|
|
149
263
|
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
150
264
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Class: SchemaVersion
|
|
2
|
+
|
|
3
|
+
Tracks the currently applied schema version for each managed entity schema.
|
|
4
|
+
One record per schema name. Written once on first boot, then updated after
|
|
5
|
+
each successful migration.
|
|
6
|
+
|
|
7
|
+
## Constructors
|
|
8
|
+
|
|
9
|
+
### Constructor
|
|
10
|
+
|
|
11
|
+
> **new SchemaVersion**(): `SchemaVersion`
|
|
12
|
+
|
|
13
|
+
#### Returns
|
|
14
|
+
|
|
15
|
+
`SchemaVersion`
|
|
16
|
+
|
|
17
|
+
## Properties
|
|
18
|
+
|
|
19
|
+
### schemaName {#schemaname}
|
|
20
|
+
|
|
21
|
+
> **schemaName**: `string`
|
|
22
|
+
|
|
23
|
+
The entity schema type name — primary key.
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
### version {#version}
|
|
28
|
+
|
|
29
|
+
> **version**: `number`
|
|
30
|
+
|
|
31
|
+
The currently deployed version of this schema.
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### updatedAt {#updatedat}
|
|
36
|
+
|
|
37
|
+
> **updatedAt**: `string`
|
|
38
|
+
|
|
39
|
+
ISO 8601 timestamp of the last version write.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Class: SchemaVersionService
|
|
2
|
+
|
|
3
|
+
Service that checks and applies entity schema migrations at every node start-up.
|
|
4
|
+
|
|
5
|
+
This service must be the first entry in coreTypeInitialisers.json. The engine iterates that
|
|
6
|
+
array in order to determine start sequence — there is no engine-level priority mechanism, so
|
|
7
|
+
registration position is the only guarantee that start() runs before any other service.
|
|
8
|
+
By the time start() is called, all component bootstraps have completed (every table already
|
|
9
|
+
exists) and EntitySchemaFactory / EntityStorageConnectorFactory are fully populated with every
|
|
10
|
+
registered schema and connector.
|
|
11
|
+
|
|
12
|
+
Migration mechanics: old schema versions are registered in EntitySchemaFactory by naming
|
|
13
|
+
convention — current schema = "MyEntity", first history = "MyEntityV0", second = "MyEntityV1".
|
|
14
|
+
The service groups schemas by base name (strips the trailing V number suffix) and resolves the
|
|
15
|
+
migration chain automatically by diffing consecutive versioned schemas. For steps that require
|
|
16
|
+
property renames or a custom transform hook, register an optional ISchemaMigration entry in
|
|
17
|
+
SchemaMigrationFactory under the key "Base_from_to" (e.g. "MyEntity_0_1").
|
|
18
|
+
|
|
19
|
+
Crash-window note: finalizeMigration and the subsequent version-record write are two
|
|
20
|
+
separate operations. If the process dies between them the next boot re-runs the chain
|
|
21
|
+
over already-migrated data. applyEntityTransform is NOT idempotent for structural changes
|
|
22
|
+
(newly-added optional fields would be dropped on re-run). A transaction spanning both
|
|
23
|
+
writes is a precondition for production; track this in the concurrency follow-up.
|
|
24
|
+
|
|
25
|
+
## Implements
|
|
26
|
+
|
|
27
|
+
- `IComponent`
|
|
28
|
+
|
|
29
|
+
## Constructors
|
|
30
|
+
|
|
31
|
+
### Constructor
|
|
32
|
+
|
|
33
|
+
> **new SchemaVersionService**(`options?`): `SchemaVersionService`
|
|
34
|
+
|
|
35
|
+
Create a new SchemaVersionService.
|
|
36
|
+
|
|
37
|
+
#### Parameters
|
|
38
|
+
|
|
39
|
+
##### options?
|
|
40
|
+
|
|
41
|
+
[`ISchemaVersionServiceConstructorOptions`](../interfaces/ISchemaVersionServiceConstructorOptions.md)
|
|
42
|
+
|
|
43
|
+
Optional constructor options.
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`SchemaVersionService`
|
|
48
|
+
|
|
49
|
+
## Properties
|
|
50
|
+
|
|
51
|
+
### CLASS\_NAME {#class_name}
|
|
52
|
+
|
|
53
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
54
|
+
|
|
55
|
+
Runtime name for the class.
|
|
56
|
+
|
|
57
|
+
## Methods
|
|
58
|
+
|
|
59
|
+
### className() {#classname}
|
|
60
|
+
|
|
61
|
+
> **className**(): `string`
|
|
62
|
+
|
|
63
|
+
Returns the class name.
|
|
64
|
+
|
|
65
|
+
#### Returns
|
|
66
|
+
|
|
67
|
+
`string`
|
|
68
|
+
|
|
69
|
+
The class name.
|
|
70
|
+
|
|
71
|
+
#### Implementation of
|
|
72
|
+
|
|
73
|
+
`IComponent.className`
|
|
74
|
+
|
|
75
|
+
***
|
|
76
|
+
|
|
77
|
+
### start() {#start}
|
|
78
|
+
|
|
79
|
+
> **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
80
|
+
|
|
81
|
+
Reads all registered entity schemas, groups versioned schemas by base name, reads the
|
|
82
|
+
full schemaVersion table in one pass, then orchestrates chain migrations for any schema
|
|
83
|
+
whose stored version is behind the current version declared in EntitySchemaFactory.
|
|
84
|
+
SchemaVersion itself is processed first so the version store is migrated before any
|
|
85
|
+
version records are written for other schemas.
|
|
86
|
+
|
|
87
|
+
Runs after all component bootstraps, so every managed table already exists.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### nodeLoggingComponentType?
|
|
92
|
+
|
|
93
|
+
`string`
|
|
94
|
+
|
|
95
|
+
An optional logging component type.
|
|
96
|
+
|
|
97
|
+
#### Returns
|
|
98
|
+
|
|
99
|
+
`Promise`\<`void`\>
|
|
100
|
+
|
|
101
|
+
#### Implementation of
|
|
102
|
+
|
|
103
|
+
`IComponent.start`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageCount()
|
|
2
|
+
|
|
3
|
+
> **entityStorageCount**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IEntityStorageCountResponse`\>
|
|
4
|
+
|
|
5
|
+
Count the entries in entity storage.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageCountRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`IEntityStorageCountResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageEmpty()
|
|
2
|
+
|
|
3
|
+
> **entityStorageEmpty**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Remove all entries from entity storage.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageEmptyRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageRemoveBatch()
|
|
2
|
+
|
|
3
|
+
> **entityStorageRemoveBatch**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Remove multiple entries from entity storage by id.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageRemoveBatchRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageSetBatch()
|
|
2
|
+
|
|
3
|
+
> **entityStorageSetBatch**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Set multiple entries in entity storage.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageSetBatchRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
package/docs/reference/index.md
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
5
|
+
- [SchemaVersion](classes/SchemaVersion.md)
|
|
5
6
|
- [EntityStorageService](classes/EntityStorageService.md)
|
|
7
|
+
- [SchemaVersionService](classes/SchemaVersionService.md)
|
|
6
8
|
|
|
7
9
|
## Interfaces
|
|
8
10
|
|
|
9
11
|
- [IEntityStorageRoutesExamples](interfaces/IEntityStorageRoutesExamples.md)
|
|
10
12
|
- [IEntityStorageServiceConfig](interfaces/IEntityStorageServiceConfig.md)
|
|
11
13
|
- [IEntityStorageServiceConstructorOptions](interfaces/IEntityStorageServiceConstructorOptions.md)
|
|
14
|
+
- [ISchemaVersionServiceConfig](interfaces/ISchemaVersionServiceConfig.md)
|
|
15
|
+
- [ISchemaVersionServiceConstructorOptions](interfaces/ISchemaVersionServiceConstructorOptions.md)
|
|
12
16
|
|
|
13
17
|
## Variables
|
|
14
18
|
|
|
@@ -19,6 +23,11 @@
|
|
|
19
23
|
|
|
20
24
|
- [generateRestRoutesEntityStorage](functions/generateRestRoutesEntityStorage.md)
|
|
21
25
|
- [entityStorageSet](functions/entityStorageSet.md)
|
|
26
|
+
- [entityStorageSetBatch](functions/entityStorageSetBatch.md)
|
|
27
|
+
- [entityStorageEmpty](functions/entityStorageEmpty.md)
|
|
22
28
|
- [entityStorageGet](functions/entityStorageGet.md)
|
|
23
29
|
- [entityStorageRemove](functions/entityStorageRemove.md)
|
|
24
30
|
- [entityStorageList](functions/entityStorageList.md)
|
|
31
|
+
- [entityStorageCount](functions/entityStorageCount.md)
|
|
32
|
+
- [entityStorageRemoveBatch](functions/entityStorageRemoveBatch.md)
|
|
33
|
+
- [initSchema](functions/initSchema.md)
|
|
@@ -4,9 +4,9 @@ Examples for the entity storage routes.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### set?
|
|
7
|
+
### set? {#set}
|
|
8
8
|
|
|
9
|
-
> `optional` **set
|
|
9
|
+
> `optional` **set?**: `object`
|
|
10
10
|
|
|
11
11
|
Examples for the set route.
|
|
12
12
|
|
|
@@ -16,9 +16,9 @@ Examples for the set route.
|
|
|
16
16
|
|
|
17
17
|
***
|
|
18
18
|
|
|
19
|
-
### get?
|
|
19
|
+
### get? {#get}
|
|
20
20
|
|
|
21
|
-
> `optional` **get
|
|
21
|
+
> `optional` **get?**: `object`
|
|
22
22
|
|
|
23
23
|
Examples for the get route.
|
|
24
24
|
|
|
@@ -32,9 +32,9 @@ Examples for the get route.
|
|
|
32
32
|
|
|
33
33
|
***
|
|
34
34
|
|
|
35
|
-
### remove?
|
|
35
|
+
### remove? {#remove}
|
|
36
36
|
|
|
37
|
-
> `optional` **remove
|
|
37
|
+
> `optional` **remove?**: `object`
|
|
38
38
|
|
|
39
39
|
Examples for the remove route.
|
|
40
40
|
|
|
@@ -44,9 +44,9 @@ Examples for the remove route.
|
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
47
|
-
### list?
|
|
47
|
+
### list? {#list}
|
|
48
48
|
|
|
49
|
-
> `optional` **list
|
|
49
|
+
> `optional` **list?**: `object`
|
|
50
50
|
|
|
51
51
|
Examples for the list route.
|
|
52
52
|
|
|
@@ -57,3 +57,19 @@ Examples for the list route.
|
|
|
57
57
|
#### responseExamples
|
|
58
58
|
|
|
59
59
|
> **responseExamples**: `IRestRouteResponseExample`\<`IEntityStorageListResponse`\>[]
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### count? {#count}
|
|
64
|
+
|
|
65
|
+
> `optional` **count?**: `object`
|
|
66
|
+
|
|
67
|
+
Examples for the count route.
|
|
68
|
+
|
|
69
|
+
#### requestExamples
|
|
70
|
+
|
|
71
|
+
> **requestExamples**: `IRestRouteRequestExample`\<`IEntityStorageCountRequest`\>[]
|
|
72
|
+
|
|
73
|
+
#### responseExamples
|
|
74
|
+
|
|
75
|
+
> **responseExamples**: `IRestRouteResponseExample`\<`IEntityStorageCountResponse`\>[]
|
|
@@ -4,7 +4,7 @@ Options for the Entity Storage Service constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### entityStorageType
|
|
7
|
+
### entityStorageType {#entitystoragetype}
|
|
8
8
|
|
|
9
9
|
> **entityStorageType**: `string`
|
|
10
10
|
|
|
@@ -12,8 +12,8 @@ The type of the entity storage.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### config?
|
|
15
|
+
### config? {#config}
|
|
16
16
|
|
|
17
|
-
> `optional` **config
|
|
17
|
+
> `optional` **config?**: [`IEntityStorageServiceConfig`](IEntityStorageServiceConfig.md)
|
|
18
18
|
|
|
19
19
|
The configuration for the service.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: ISchemaVersionServiceConstructorOptions
|
|
2
|
+
|
|
3
|
+
Constructor options for SchemaVersionService.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### schemaVersionStorageType? {#schemaversionstoragetype}
|
|
8
|
+
|
|
9
|
+
> `optional` **schemaVersionStorageType?**: `string`
|
|
10
|
+
|
|
11
|
+
The version storage type.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
schema-version
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### config? {#config}
|
|
22
|
+
|
|
23
|
+
> `optional` **config?**: [`ISchemaVersionServiceConfig`](ISchemaVersionServiceConfig.md)
|
|
24
|
+
|
|
25
|
+
Optional config.
|
package/locales/en.json
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"schemaVersionService": {
|
|
4
|
+
"storedVersionNewer": "Stored schema version ({stored}) for \"{schemaName}\" is newer than the current version ({current}). Downgrade is not supported.",
|
|
5
|
+
"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.",
|
|
6
|
+
"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.",
|
|
7
|
+
"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."
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"info": {
|
|
11
|
+
"schemaVersionService": {
|
|
12
|
+
"noMigrationRequired": "No migration required for schema \"{schemaName}\", version {version}.",
|
|
13
|
+
"migrationRequired": "Migration required for schema \"{schemaName}\" from version {from} to {to}.",
|
|
14
|
+
"partitionStart": "Starting migration of {itemTotal} partitions.",
|
|
15
|
+
"partitionProgress": "Migrating partition {itemIndex} of {itemTotal}.",
|
|
16
|
+
"partitionEnd": "Completed migration of {itemTotal} partitions.",
|
|
17
|
+
"partitionItemsStart": "Starting migration of {itemTotal} items in current partition.",
|
|
18
|
+
"partitionItemsProgress": "Migrating items in current partition: {itemIndex} of {itemTotal} processed.",
|
|
19
|
+
"partitionItemsEnd": "Completed migration of {itemTotal} items in current partition."
|
|
5
20
|
}
|
|
6
21
|
}
|
|
7
22
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.30",
|
|
4
|
+
"description": "Service layer exposing storage contracts and REST endpoint definitions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/twin-entity-storage.git",
|
|
8
8
|
"directory": "packages/entity-storage-service"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"@twin.org/api-models": "next",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
|
-
"@twin.org/entity-storage-models": "0.0.3-next.
|
|
20
|
+
"@twin.org/entity-storage-models": "0.0.3-next.30",
|
|
21
|
+
"@twin.org/logging-models": "next",
|
|
21
22
|
"@twin.org/nameof": "next",
|
|
22
23
|
"@twin.org/web": "next"
|
|
23
24
|
},
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"business-logic"
|
|
54
55
|
],
|
|
55
56
|
"bugs": {
|
|
56
|
-
"url": "git+https://github.com/
|
|
57
|
+
"url": "git+https://github.com/iotaledger/twin-entity-storage/issues"
|
|
57
58
|
},
|
|
58
59
|
"homepage": "https://twindev.org"
|
|
59
60
|
}
|