@twin.org/entity-storage-models 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/factories/schemaMigrationFactory.js +17 -0
- package/dist/es/factories/schemaMigrationFactory.js.map +1 -0
- package/dist/es/helpers/entityStorageHelper.js +126 -0
- package/dist/es/helpers/entityStorageHelper.js.map +1 -0
- package/dist/es/helpers/migrationHelper.js +232 -0
- package/dist/es/helpers/migrationHelper.js.map +1 -0
- package/dist/es/index.js +14 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IEntityStorageComponent.js.map +1 -1
- package/dist/es/models/IEntityStorageConnector.js.map +1 -1
- package/dist/es/models/IEntityStorageMigrationConnector.js +2 -0
- package/dist/es/models/IEntityStorageMigrationConnector.js.map +1 -0
- package/dist/es/models/IMigrationOptions.js +4 -0
- package/dist/es/models/IMigrationOptions.js.map +1 -0
- package/dist/es/models/IResolvedMigrationStep.js +2 -0
- package/dist/es/models/IResolvedMigrationStep.js.map +1 -0
- package/dist/es/models/ISchemaMigration.js +2 -0
- package/dist/es/models/ISchemaMigration.js.map +1 -0
- package/dist/es/models/api/IEntityStorageCountRequest.js +4 -0
- package/dist/es/models/api/IEntityStorageCountRequest.js.map +1 -0
- package/dist/es/models/api/IEntityStorageCountResponse.js +4 -0
- package/dist/es/models/api/IEntityStorageCountResponse.js.map +1 -0
- package/dist/es/models/api/IEntityStorageEmptyRequest.js +4 -0
- package/dist/es/models/api/IEntityStorageEmptyRequest.js.map +1 -0
- package/dist/es/models/api/IEntityStorageGetRequest.js.map +1 -1
- package/dist/es/models/api/IEntityStorageRemoveBatchRequest.js +4 -0
- package/dist/es/models/api/IEntityStorageRemoveBatchRequest.js.map +1 -0
- package/dist/es/models/api/IEntityStorageRemoveRequest.js.map +1 -1
- package/dist/es/models/api/IEntityStorageSetBatchRequest.js +4 -0
- package/dist/es/models/api/IEntityStorageSetBatchRequest.js.map +1 -0
- package/dist/es/models/api/IEntityStorageSetRequest.js.map +1 -1
- package/dist/es/models/entityPropertyTransformer.js +2 -0
- package/dist/es/models/entityPropertyTransformer.js.map +1 -0
- package/dist/types/factories/schemaMigrationFactory.d.ts +14 -0
- package/dist/types/helpers/entityStorageHelper.d.ts +59 -0
- package/dist/types/helpers/migrationHelper.d.ts +65 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/models/IEntityStorageComponent.d.ts +38 -3
- package/dist/types/models/IEntityStorageConnector.d.ts +23 -0
- package/dist/types/models/IEntityStorageMigrationConnector.d.ts +35 -0
- package/dist/types/models/IMigrationOptions.d.ts +17 -0
- package/dist/types/models/IResolvedMigrationStep.d.ts +38 -0
- package/dist/types/models/ISchemaMigration.d.ts +30 -0
- package/dist/types/models/api/IEntityStorageCountRequest.d.ts +14 -0
- package/dist/types/models/api/IEntityStorageCountResponse.d.ts +14 -0
- package/dist/types/models/api/IEntityStorageEmptyRequest.d.ts +5 -0
- package/dist/types/models/api/IEntityStorageGetRequest.d.ts +4 -0
- package/dist/types/models/api/IEntityStorageRemoveBatchRequest.d.ts +9 -0
- package/dist/types/models/api/IEntityStorageRemoveRequest.d.ts +9 -0
- package/dist/types/models/api/IEntityStorageSetBatchRequest.d.ts +9 -0
- package/dist/types/models/api/IEntityStorageSetRequest.d.ts +9 -0
- package/dist/types/models/entityPropertyTransformer.d.ts +6 -0
- package/docs/changelog.md +308 -44
- package/docs/examples.md +87 -1
- package/docs/reference/classes/EntityStorageHelper.md +209 -0
- package/docs/reference/classes/MigrationHelper.md +198 -0
- package/docs/reference/index.md +19 -0
- package/docs/reference/interfaces/IEntityStorageComponent.md +105 -7
- package/docs/reference/interfaces/IEntityStorageConnector.md +89 -5
- package/docs/reference/interfaces/IEntityStorageCountRequest.md +17 -0
- package/docs/reference/interfaces/IEntityStorageCountResponse.md +17 -0
- package/docs/reference/interfaces/IEntityStorageEmptyRequest.md +3 -0
- package/docs/reference/interfaces/IEntityStorageGetRequest.md +10 -4
- package/docs/reference/interfaces/IEntityStorageGetResponse.md +1 -1
- package/docs/reference/interfaces/IEntityStorageListRequest.md +8 -8
- package/docs/reference/interfaces/IEntityStorageListResponse.md +2 -2
- package/docs/reference/interfaces/IEntityStorageMigrationConnector.md +402 -0
- package/docs/reference/interfaces/IEntityStorageRemoveBatchRequest.md +11 -0
- package/docs/reference/interfaces/IEntityStorageRemoveRequest.md +15 -1
- package/docs/reference/interfaces/IEntityStorageSetBatchRequest.md +11 -0
- package/docs/reference/interfaces/IEntityStorageSetRequest.md +15 -1
- package/docs/reference/interfaces/IMigrationOptions.md +49 -0
- package/docs/reference/interfaces/IResolvedMigrationStep.md +78 -0
- package/docs/reference/interfaces/ISchemaMigration.md +62 -0
- package/docs/reference/type-aliases/EntityPropertyTransformer.md +34 -0
- package/docs/reference/variables/SchemaMigrationFactory.md +13 -0
- package/locales/en.json +18 -1
- package/package.json +6 -4
|
@@ -6,6 +6,10 @@ Interface describing an entity storage connector.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
+
## Extended by
|
|
10
|
+
|
|
11
|
+
- [`IEntityStorageMigrationConnector`](IEntityStorageMigrationConnector.md)
|
|
12
|
+
|
|
9
13
|
## Type Parameters
|
|
10
14
|
|
|
11
15
|
### T
|
|
@@ -14,7 +18,7 @@ Interface describing an entity storage connector.
|
|
|
14
18
|
|
|
15
19
|
## Methods
|
|
16
20
|
|
|
17
|
-
### getSchema()
|
|
21
|
+
### getSchema() {#getschema}
|
|
18
22
|
|
|
19
23
|
> **getSchema**(): `IEntitySchema`
|
|
20
24
|
|
|
@@ -28,7 +32,7 @@ The schema for the entities.
|
|
|
28
32
|
|
|
29
33
|
***
|
|
30
34
|
|
|
31
|
-
### set()
|
|
35
|
+
### set() {#set}
|
|
32
36
|
|
|
33
37
|
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
34
38
|
|
|
@@ -56,7 +60,29 @@ The id of the entity.
|
|
|
56
60
|
|
|
57
61
|
***
|
|
58
62
|
|
|
59
|
-
###
|
|
63
|
+
### setBatch() {#setbatch}
|
|
64
|
+
|
|
65
|
+
> **setBatch**(`entities`): `Promise`\<`void`\>
|
|
66
|
+
|
|
67
|
+
Set multiple entities in a batch.
|
|
68
|
+
|
|
69
|
+
#### Parameters
|
|
70
|
+
|
|
71
|
+
##### entities
|
|
72
|
+
|
|
73
|
+
`T`[]
|
|
74
|
+
|
|
75
|
+
The entities to set.
|
|
76
|
+
|
|
77
|
+
#### Returns
|
|
78
|
+
|
|
79
|
+
`Promise`\<`void`\>
|
|
80
|
+
|
|
81
|
+
Nothing.
|
|
82
|
+
|
|
83
|
+
***
|
|
84
|
+
|
|
85
|
+
### get() {#get}
|
|
60
86
|
|
|
61
87
|
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
62
88
|
|
|
@@ -90,7 +116,7 @@ The object if it can be found or undefined.
|
|
|
90
116
|
|
|
91
117
|
***
|
|
92
118
|
|
|
93
|
-
### remove()
|
|
119
|
+
### remove() {#remove}
|
|
94
120
|
|
|
95
121
|
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
96
122
|
|
|
@@ -118,7 +144,29 @@ Nothing.
|
|
|
118
144
|
|
|
119
145
|
***
|
|
120
146
|
|
|
121
|
-
###
|
|
147
|
+
### removeBatch() {#removebatch}
|
|
148
|
+
|
|
149
|
+
> **removeBatch**(`ids`): `Promise`\<`void`\>
|
|
150
|
+
|
|
151
|
+
Remove multiple entities by id.
|
|
152
|
+
|
|
153
|
+
#### Parameters
|
|
154
|
+
|
|
155
|
+
##### ids
|
|
156
|
+
|
|
157
|
+
`string`[]
|
|
158
|
+
|
|
159
|
+
The ids of the entities to remove.
|
|
160
|
+
|
|
161
|
+
#### Returns
|
|
162
|
+
|
|
163
|
+
`Promise`\<`void`\>
|
|
164
|
+
|
|
165
|
+
Nothing.
|
|
166
|
+
|
|
167
|
+
***
|
|
168
|
+
|
|
169
|
+
### query() {#query}
|
|
122
170
|
|
|
123
171
|
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
124
172
|
|
|
@@ -162,3 +210,39 @@ The suggested number of entities to return in each chunk, in some scenarios can
|
|
|
162
210
|
|
|
163
211
|
All the entities for the storage matching the conditions,
|
|
164
212
|
and a cursor which can be used to request more entities.
|
|
213
|
+
|
|
214
|
+
***
|
|
215
|
+
|
|
216
|
+
### empty() {#empty}
|
|
217
|
+
|
|
218
|
+
> **empty**(): `Promise`\<`void`\>
|
|
219
|
+
|
|
220
|
+
Remove all entities from the storage.
|
|
221
|
+
|
|
222
|
+
#### Returns
|
|
223
|
+
|
|
224
|
+
`Promise`\<`void`\>
|
|
225
|
+
|
|
226
|
+
Nothing.
|
|
227
|
+
|
|
228
|
+
***
|
|
229
|
+
|
|
230
|
+
### count() {#count}
|
|
231
|
+
|
|
232
|
+
> **count**(`conditions?`): `Promise`\<`number`\>
|
|
233
|
+
|
|
234
|
+
Count all the entities which match the conditions.
|
|
235
|
+
|
|
236
|
+
#### Parameters
|
|
237
|
+
|
|
238
|
+
##### conditions?
|
|
239
|
+
|
|
240
|
+
`EntityCondition`\<`T`\>
|
|
241
|
+
|
|
242
|
+
The optional conditions to match for the entities.
|
|
243
|
+
|
|
244
|
+
#### Returns
|
|
245
|
+
|
|
246
|
+
`Promise`\<`number`\>
|
|
247
|
+
|
|
248
|
+
The total count of entities in the storage.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: IEntityStorageCountRequest
|
|
2
|
+
|
|
3
|
+
Count the entries in entity storage.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### query? {#query}
|
|
8
|
+
|
|
9
|
+
> `optional` **query?**: `object`
|
|
10
|
+
|
|
11
|
+
The query parameters.
|
|
12
|
+
|
|
13
|
+
#### conditions?
|
|
14
|
+
|
|
15
|
+
> `optional` **conditions?**: `string`
|
|
16
|
+
|
|
17
|
+
The optional conditions to filter the count, JSON encoded EntityCondition.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: IEntityStorageCountResponse
|
|
2
|
+
|
|
3
|
+
The response for counting entries in entity storage.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### body {#body}
|
|
8
|
+
|
|
9
|
+
> **body**: `object`
|
|
10
|
+
|
|
11
|
+
The body of the response.
|
|
12
|
+
|
|
13
|
+
#### count
|
|
14
|
+
|
|
15
|
+
> **count**: `number`
|
|
16
|
+
|
|
17
|
+
The total count of entities.
|
|
@@ -4,7 +4,7 @@ Get an entry from entity storage.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### pathParams
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
8
|
|
|
9
9
|
> **pathParams**: `object`
|
|
10
10
|
|
|
@@ -18,14 +18,20 @@ The id of the entity to get.
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### query?
|
|
21
|
+
### query? {#query}
|
|
22
22
|
|
|
23
|
-
> `optional` **query
|
|
23
|
+
> `optional` **query?**: `object`
|
|
24
24
|
|
|
25
25
|
The query parameters.
|
|
26
26
|
|
|
27
27
|
#### secondaryIndex?
|
|
28
28
|
|
|
29
|
-
> `optional` **secondaryIndex
|
|
29
|
+
> `optional` **secondaryIndex?**: `string`
|
|
30
30
|
|
|
31
31
|
The secondary index to query with the id.
|
|
32
|
+
|
|
33
|
+
#### conditions?
|
|
34
|
+
|
|
35
|
+
> `optional` **conditions?**: `string`
|
|
36
|
+
|
|
37
|
+
The optional conditions to match for the entity, JSON encoded array of property/value pairs.
|
|
@@ -4,44 +4,44 @@ Query the entries from entity storage.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### query?
|
|
7
|
+
### query? {#query}
|
|
8
8
|
|
|
9
|
-
> `optional` **query
|
|
9
|
+
> `optional` **query?**: `object`
|
|
10
10
|
|
|
11
11
|
The parameters from the query.
|
|
12
12
|
|
|
13
13
|
#### conditions?
|
|
14
14
|
|
|
15
|
-
> `optional` **conditions
|
|
15
|
+
> `optional` **conditions?**: `string`
|
|
16
16
|
|
|
17
17
|
The condition for the query as JSON version of EntityCondition type.
|
|
18
18
|
|
|
19
19
|
#### orderBy?
|
|
20
20
|
|
|
21
|
-
> `optional` **orderBy
|
|
21
|
+
> `optional` **orderBy?**: `string`
|
|
22
22
|
|
|
23
23
|
The order property for the results.
|
|
24
24
|
|
|
25
25
|
#### orderByDirection?
|
|
26
26
|
|
|
27
|
-
> `optional` **orderByDirection
|
|
27
|
+
> `optional` **orderByDirection?**: `SortDirection`
|
|
28
28
|
|
|
29
29
|
The direction for the order, defaults to desc.
|
|
30
30
|
|
|
31
31
|
#### properties?
|
|
32
32
|
|
|
33
|
-
> `optional` **properties
|
|
33
|
+
> `optional` **properties?**: `string`
|
|
34
34
|
|
|
35
35
|
The properties to return in the response as a comma separated list, by default returns all properties.
|
|
36
36
|
|
|
37
37
|
#### limit?
|
|
38
38
|
|
|
39
|
-
> `optional` **limit
|
|
39
|
+
> `optional` **limit?**: `string`
|
|
40
40
|
|
|
41
41
|
Limit the number of entities to return.
|
|
42
42
|
|
|
43
43
|
#### cursor?
|
|
44
44
|
|
|
45
|
-
> `optional` **cursor
|
|
45
|
+
> `optional` **cursor?**: `string`
|
|
46
46
|
|
|
47
47
|
The cursor to get next chunk of data, returned in previous response.
|
|
@@ -4,7 +4,7 @@ Response to getting the list of entries from a query.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### body
|
|
7
|
+
### body {#body}
|
|
8
8
|
|
|
9
9
|
> **body**: `object`
|
|
10
10
|
|
|
@@ -18,6 +18,6 @@ The entities from the query.
|
|
|
18
18
|
|
|
19
19
|
#### cursor?
|
|
20
20
|
|
|
21
|
-
> `optional` **cursor
|
|
21
|
+
> `optional` **cursor?**: `string`
|
|
22
22
|
|
|
23
23
|
The cursor for the next page.
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
# Interface: IEntityStorageMigrationConnector\<T\>
|
|
2
|
+
|
|
3
|
+
Interface describing an entity storage migration connector.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- [`IEntityStorageConnector`](IEntityStorageConnector.md)\<`T`\>
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
### T
|
|
12
|
+
|
|
13
|
+
`T` = `unknown`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### getSchema() {#getschema}
|
|
18
|
+
|
|
19
|
+
> **getSchema**(): `IEntitySchema`
|
|
20
|
+
|
|
21
|
+
Get the schema for the entities.
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`IEntitySchema`
|
|
26
|
+
|
|
27
|
+
The schema for the entities.
|
|
28
|
+
|
|
29
|
+
#### Inherited from
|
|
30
|
+
|
|
31
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`getSchema`](IEntityStorageConnector.md#getschema)
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### set() {#set}
|
|
36
|
+
|
|
37
|
+
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
38
|
+
|
|
39
|
+
Set an entity.
|
|
40
|
+
|
|
41
|
+
#### Parameters
|
|
42
|
+
|
|
43
|
+
##### entity
|
|
44
|
+
|
|
45
|
+
`T`
|
|
46
|
+
|
|
47
|
+
The entity to set.
|
|
48
|
+
|
|
49
|
+
##### conditions?
|
|
50
|
+
|
|
51
|
+
`object`[]
|
|
52
|
+
|
|
53
|
+
The optional conditions to match for the entities.
|
|
54
|
+
|
|
55
|
+
#### Returns
|
|
56
|
+
|
|
57
|
+
`Promise`\<`void`\>
|
|
58
|
+
|
|
59
|
+
The id of the entity.
|
|
60
|
+
|
|
61
|
+
#### Inherited from
|
|
62
|
+
|
|
63
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`set`](IEntityStorageConnector.md#set)
|
|
64
|
+
|
|
65
|
+
***
|
|
66
|
+
|
|
67
|
+
### setBatch() {#setbatch}
|
|
68
|
+
|
|
69
|
+
> **setBatch**(`entities`): `Promise`\<`void`\>
|
|
70
|
+
|
|
71
|
+
Set multiple entities in a batch.
|
|
72
|
+
|
|
73
|
+
#### Parameters
|
|
74
|
+
|
|
75
|
+
##### entities
|
|
76
|
+
|
|
77
|
+
`T`[]
|
|
78
|
+
|
|
79
|
+
The entities to set.
|
|
80
|
+
|
|
81
|
+
#### Returns
|
|
82
|
+
|
|
83
|
+
`Promise`\<`void`\>
|
|
84
|
+
|
|
85
|
+
Nothing.
|
|
86
|
+
|
|
87
|
+
#### Inherited from
|
|
88
|
+
|
|
89
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`setBatch`](IEntityStorageConnector.md#setbatch)
|
|
90
|
+
|
|
91
|
+
***
|
|
92
|
+
|
|
93
|
+
### get() {#get}
|
|
94
|
+
|
|
95
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
96
|
+
|
|
97
|
+
Get an entity.
|
|
98
|
+
|
|
99
|
+
#### Parameters
|
|
100
|
+
|
|
101
|
+
##### id
|
|
102
|
+
|
|
103
|
+
`string`
|
|
104
|
+
|
|
105
|
+
The id of the entity to get, or the index value if secondaryIndex is set.
|
|
106
|
+
|
|
107
|
+
##### secondaryIndex?
|
|
108
|
+
|
|
109
|
+
keyof `T`
|
|
110
|
+
|
|
111
|
+
Get the item using a secondary index.
|
|
112
|
+
|
|
113
|
+
##### conditions?
|
|
114
|
+
|
|
115
|
+
`object`[]
|
|
116
|
+
|
|
117
|
+
The optional conditions to match for the entities.
|
|
118
|
+
|
|
119
|
+
#### Returns
|
|
120
|
+
|
|
121
|
+
`Promise`\<`T` \| `undefined`\>
|
|
122
|
+
|
|
123
|
+
The object if it can be found or undefined.
|
|
124
|
+
|
|
125
|
+
#### Inherited from
|
|
126
|
+
|
|
127
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`get`](IEntityStorageConnector.md#get)
|
|
128
|
+
|
|
129
|
+
***
|
|
130
|
+
|
|
131
|
+
### remove() {#remove}
|
|
132
|
+
|
|
133
|
+
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
134
|
+
|
|
135
|
+
Remove the entity.
|
|
136
|
+
|
|
137
|
+
#### Parameters
|
|
138
|
+
|
|
139
|
+
##### id
|
|
140
|
+
|
|
141
|
+
`string`
|
|
142
|
+
|
|
143
|
+
The id of the entity to remove.
|
|
144
|
+
|
|
145
|
+
##### conditions?
|
|
146
|
+
|
|
147
|
+
`object`[]
|
|
148
|
+
|
|
149
|
+
The optional conditions to match for the entities.
|
|
150
|
+
|
|
151
|
+
#### Returns
|
|
152
|
+
|
|
153
|
+
`Promise`\<`void`\>
|
|
154
|
+
|
|
155
|
+
Nothing.
|
|
156
|
+
|
|
157
|
+
#### Inherited from
|
|
158
|
+
|
|
159
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`remove`](IEntityStorageConnector.md#remove)
|
|
160
|
+
|
|
161
|
+
***
|
|
162
|
+
|
|
163
|
+
### removeBatch() {#removebatch}
|
|
164
|
+
|
|
165
|
+
> **removeBatch**(`ids`): `Promise`\<`void`\>
|
|
166
|
+
|
|
167
|
+
Remove multiple entities by id.
|
|
168
|
+
|
|
169
|
+
#### Parameters
|
|
170
|
+
|
|
171
|
+
##### ids
|
|
172
|
+
|
|
173
|
+
`string`[]
|
|
174
|
+
|
|
175
|
+
The ids of the entities to remove.
|
|
176
|
+
|
|
177
|
+
#### Returns
|
|
178
|
+
|
|
179
|
+
`Promise`\<`void`\>
|
|
180
|
+
|
|
181
|
+
Nothing.
|
|
182
|
+
|
|
183
|
+
#### Inherited from
|
|
184
|
+
|
|
185
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`removeBatch`](IEntityStorageConnector.md#removebatch)
|
|
186
|
+
|
|
187
|
+
***
|
|
188
|
+
|
|
189
|
+
### query() {#query}
|
|
190
|
+
|
|
191
|
+
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
192
|
+
|
|
193
|
+
Query all the entities which match the conditions.
|
|
194
|
+
|
|
195
|
+
#### Parameters
|
|
196
|
+
|
|
197
|
+
##### conditions?
|
|
198
|
+
|
|
199
|
+
`EntityCondition`\<`T`\>
|
|
200
|
+
|
|
201
|
+
The conditions to match for the entities.
|
|
202
|
+
|
|
203
|
+
##### sortProperties?
|
|
204
|
+
|
|
205
|
+
`object`[]
|
|
206
|
+
|
|
207
|
+
The optional sort order.
|
|
208
|
+
|
|
209
|
+
##### properties?
|
|
210
|
+
|
|
211
|
+
keyof `T`[]
|
|
212
|
+
|
|
213
|
+
The optional properties to return, defaults to all.
|
|
214
|
+
|
|
215
|
+
##### cursor?
|
|
216
|
+
|
|
217
|
+
`string`
|
|
218
|
+
|
|
219
|
+
The cursor to request the next chunk of entities.
|
|
220
|
+
|
|
221
|
+
##### limit?
|
|
222
|
+
|
|
223
|
+
`number`
|
|
224
|
+
|
|
225
|
+
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
226
|
+
|
|
227
|
+
#### Returns
|
|
228
|
+
|
|
229
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
230
|
+
|
|
231
|
+
All the entities for the storage matching the conditions,
|
|
232
|
+
and a cursor which can be used to request more entities.
|
|
233
|
+
|
|
234
|
+
#### Inherited from
|
|
235
|
+
|
|
236
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`query`](IEntityStorageConnector.md#query)
|
|
237
|
+
|
|
238
|
+
***
|
|
239
|
+
|
|
240
|
+
### empty() {#empty}
|
|
241
|
+
|
|
242
|
+
> **empty**(): `Promise`\<`void`\>
|
|
243
|
+
|
|
244
|
+
Remove all entities from the storage.
|
|
245
|
+
|
|
246
|
+
#### Returns
|
|
247
|
+
|
|
248
|
+
`Promise`\<`void`\>
|
|
249
|
+
|
|
250
|
+
Nothing.
|
|
251
|
+
|
|
252
|
+
#### Inherited from
|
|
253
|
+
|
|
254
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`empty`](IEntityStorageConnector.md#empty)
|
|
255
|
+
|
|
256
|
+
***
|
|
257
|
+
|
|
258
|
+
### count() {#count}
|
|
259
|
+
|
|
260
|
+
> **count**(`conditions?`): `Promise`\<`number`\>
|
|
261
|
+
|
|
262
|
+
Count all the entities which match the conditions.
|
|
263
|
+
|
|
264
|
+
#### Parameters
|
|
265
|
+
|
|
266
|
+
##### conditions?
|
|
267
|
+
|
|
268
|
+
`EntityCondition`\<`T`\>
|
|
269
|
+
|
|
270
|
+
The optional conditions to match for the entities.
|
|
271
|
+
|
|
272
|
+
#### Returns
|
|
273
|
+
|
|
274
|
+
`Promise`\<`number`\>
|
|
275
|
+
|
|
276
|
+
The total count of entities in the storage.
|
|
277
|
+
|
|
278
|
+
#### Inherited from
|
|
279
|
+
|
|
280
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md).[`count`](IEntityStorageConnector.md#count)
|
|
281
|
+
|
|
282
|
+
***
|
|
283
|
+
|
|
284
|
+
### getPartitionContextIds() {#getpartitioncontextids}
|
|
285
|
+
|
|
286
|
+
> **getPartitionContextIds**(): `Promise`\<`IContextIds`[]\>
|
|
287
|
+
|
|
288
|
+
Get a unique list of all the context ids from the storage.
|
|
289
|
+
|
|
290
|
+
#### Returns
|
|
291
|
+
|
|
292
|
+
`Promise`\<`IContextIds`[]\>
|
|
293
|
+
|
|
294
|
+
The list of unique context ids.
|
|
295
|
+
|
|
296
|
+
***
|
|
297
|
+
|
|
298
|
+
### createTargetConnector() {#createtargetconnector}
|
|
299
|
+
|
|
300
|
+
> **createTargetConnector**\<`U`\>(`newEntitySchema`): `Promise`\<[`IEntityStorageConnector`](IEntityStorageConnector.md)\<`U`\>\>
|
|
301
|
+
|
|
302
|
+
Create the target connector for performing the migration it will use a temporary storage location.
|
|
303
|
+
|
|
304
|
+
#### Type Parameters
|
|
305
|
+
|
|
306
|
+
##### U
|
|
307
|
+
|
|
308
|
+
`U`
|
|
309
|
+
|
|
310
|
+
#### Parameters
|
|
311
|
+
|
|
312
|
+
##### newEntitySchema
|
|
313
|
+
|
|
314
|
+
`string`
|
|
315
|
+
|
|
316
|
+
The name of the new entity schema to create the connector for.
|
|
317
|
+
|
|
318
|
+
#### Returns
|
|
319
|
+
|
|
320
|
+
`Promise`\<[`IEntityStorageConnector`](IEntityStorageConnector.md)\<`U`\>\>
|
|
321
|
+
|
|
322
|
+
Connector for performing the migration.
|
|
323
|
+
|
|
324
|
+
***
|
|
325
|
+
|
|
326
|
+
### finalizeMigration() {#finalizemigration}
|
|
327
|
+
|
|
328
|
+
> **finalizeMigration**\<`U`\>(`targetConnector`, `options?`, `loggingComponentType?`): `Promise`\<[`IEntityStorageConnector`](IEntityStorageConnector.md)\<`U`\>\>
|
|
329
|
+
|
|
330
|
+
Finalize the migration by tearing down the old connector and replacing it with the target connector.
|
|
331
|
+
|
|
332
|
+
#### Type Parameters
|
|
333
|
+
|
|
334
|
+
##### U
|
|
335
|
+
|
|
336
|
+
`U`
|
|
337
|
+
|
|
338
|
+
#### Parameters
|
|
339
|
+
|
|
340
|
+
##### targetConnector
|
|
341
|
+
|
|
342
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md)\<`U`\>
|
|
343
|
+
|
|
344
|
+
The target connector to finalize the migration with.
|
|
345
|
+
|
|
346
|
+
##### options?
|
|
347
|
+
|
|
348
|
+
[`IMigrationOptions`](IMigrationOptions.md)
|
|
349
|
+
|
|
350
|
+
The options to control how the migration is finalized.
|
|
351
|
+
|
|
352
|
+
##### loggingComponentType?
|
|
353
|
+
|
|
354
|
+
`string`
|
|
355
|
+
|
|
356
|
+
The optional component type to use for logging the migration progress.
|
|
357
|
+
|
|
358
|
+
#### Returns
|
|
359
|
+
|
|
360
|
+
`Promise`\<[`IEntityStorageConnector`](IEntityStorageConnector.md)\<`U`\>\>
|
|
361
|
+
|
|
362
|
+
A promise that resolves when the migration is finalized and returns the final connector.
|
|
363
|
+
|
|
364
|
+
***
|
|
365
|
+
|
|
366
|
+
### cleanupMigration() {#cleanupmigration}
|
|
367
|
+
|
|
368
|
+
> **cleanupMigration**\<`U`\>(`targetConnector`, `options?`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
369
|
+
|
|
370
|
+
Cleanup the migration if a migration fails or needs to be aborted.
|
|
371
|
+
|
|
372
|
+
#### Type Parameters
|
|
373
|
+
|
|
374
|
+
##### U
|
|
375
|
+
|
|
376
|
+
`U`
|
|
377
|
+
|
|
378
|
+
#### Parameters
|
|
379
|
+
|
|
380
|
+
##### targetConnector
|
|
381
|
+
|
|
382
|
+
[`IEntityStorageConnector`](IEntityStorageConnector.md)\<`U`\> \| `undefined`
|
|
383
|
+
|
|
384
|
+
The target connector to cleanup the migration with.
|
|
385
|
+
|
|
386
|
+
##### options?
|
|
387
|
+
|
|
388
|
+
[`IMigrationOptions`](IMigrationOptions.md)
|
|
389
|
+
|
|
390
|
+
The options to control how the migration is cleaned up.
|
|
391
|
+
|
|
392
|
+
##### loggingComponentType?
|
|
393
|
+
|
|
394
|
+
`string`
|
|
395
|
+
|
|
396
|
+
The optional component type to use for logging the migration progress.
|
|
397
|
+
|
|
398
|
+
#### Returns
|
|
399
|
+
|
|
400
|
+
`Promise`\<`void`\>
|
|
401
|
+
|
|
402
|
+
A promise that resolves when the migration is cleaned up.
|