@twin.org/entity-storage-connector-cosmosdb 0.0.1-next.13 → 0.0.1-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +0 -3
- package/dist/esm/index.mjs +0 -3
- package/dist/types/cosmosDbEntityStorageConnector.d.ts +2 -9
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/ICosmosDbEntityStorageConnectorConstructorOptions.d.ts +19 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/CosmosDbEntityStorageConnector.md +46 -38
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/ICosmosDbEntityStorageConnectorConstructorOptions.md +33 -0
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -63,9 +63,6 @@ class CosmosDbEntityStorageConnector {
|
|
|
63
63
|
/**
|
|
64
64
|
* Create a new instance of CosmosDbEntityStorageConnector.
|
|
65
65
|
* @param options The options for the connector.
|
|
66
|
-
* @param options.entitySchema The schema for the entity.
|
|
67
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to no logging.
|
|
68
|
-
* @param options.config The configuration for the connector.
|
|
69
66
|
*/
|
|
70
67
|
constructor(options) {
|
|
71
68
|
core.Guards.object(this.CLASS_NAME, "options", options);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -61,9 +61,6 @@ class CosmosDbEntityStorageConnector {
|
|
|
61
61
|
/**
|
|
62
62
|
* Create a new instance of CosmosDbEntityStorageConnector.
|
|
63
63
|
* @param options The options for the connector.
|
|
64
|
-
* @param options.entitySchema The schema for the entity.
|
|
65
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to no logging.
|
|
66
|
-
* @param options.config The configuration for the connector.
|
|
67
64
|
*/
|
|
68
65
|
constructor(options) {
|
|
69
66
|
Guards.object(this.CLASS_NAME, "options", options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EntityCondition, type IEntitySchema, SortDirection } from "@twin.org/entity";
|
|
2
2
|
import type { IEntityStorageConnector } from "@twin.org/entity-storage-models";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ICosmosDbEntityStorageConnectorConstructorOptions } from "./models/ICosmosDbEntityStorageConnectorConstructorOptions";
|
|
4
4
|
/**
|
|
5
5
|
* Class for performing entity storage operations using Cosmos DB.
|
|
6
6
|
*/
|
|
@@ -12,15 +12,8 @@ export declare class CosmosDbEntityStorageConnector<T = unknown> implements IEnt
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a new instance of CosmosDbEntityStorageConnector.
|
|
14
14
|
* @param options The options for the connector.
|
|
15
|
-
* @param options.entitySchema The schema for the entity.
|
|
16
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to no logging.
|
|
17
|
-
* @param options.config The configuration for the connector.
|
|
18
15
|
*/
|
|
19
|
-
constructor(options:
|
|
20
|
-
entitySchema: string;
|
|
21
|
-
loggingConnectorType?: string;
|
|
22
|
-
config: ICosmosDbEntityStorageConnectorConfig;
|
|
23
|
-
});
|
|
16
|
+
constructor(options: ICosmosDbEntityStorageConnectorConstructorOptions);
|
|
24
17
|
/**
|
|
25
18
|
* Initialize the Cosmos DB environment.
|
|
26
19
|
* @param nodeLoggingConnectorType Optional type of the logging connector.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ICosmosDbEntityStorageConnectorConfig } from "./ICosmosDbEntityStorageConnectorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* The options for the cosmos db entity storage connector constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface ICosmosDbEntityStorageConnectorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The schema for the entity.
|
|
8
|
+
*/
|
|
9
|
+
entitySchema: string;
|
|
10
|
+
/**
|
|
11
|
+
* The type of logging connector to use.
|
|
12
|
+
* @default logging
|
|
13
|
+
*/
|
|
14
|
+
loggingConnectorType?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The configuration for the connector.
|
|
17
|
+
*/
|
|
18
|
+
config: ICosmosDbEntityStorageConnectorConfig;
|
|
19
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -20,21 +20,11 @@ Create a new instance of CosmosDbEntityStorageConnector.
|
|
|
20
20
|
|
|
21
21
|
#### Parameters
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
##### options
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
• **options.entitySchema**: `string`
|
|
28
|
-
|
|
29
|
-
The schema for the entity.
|
|
30
|
-
|
|
31
|
-
• **options.loggingConnectorType?**: `string`
|
|
25
|
+
[`ICosmosDbEntityStorageConnectorConstructorOptions`](../interfaces/ICosmosDbEntityStorageConnectorConstructorOptions.md)
|
|
32
26
|
|
|
33
|
-
The
|
|
34
|
-
|
|
35
|
-
• **options.config**: [`ICosmosDbEntityStorageConnectorConfig`](../interfaces/ICosmosDbEntityStorageConnectorConfig.md)
|
|
36
|
-
|
|
37
|
-
The configuration for the connector.
|
|
27
|
+
The options for the connector.
|
|
38
28
|
|
|
39
29
|
#### Returns
|
|
40
30
|
|
|
@@ -62,7 +52,9 @@ Initialize the Cosmos DB environment.
|
|
|
62
52
|
|
|
63
53
|
#### Parameters
|
|
64
54
|
|
|
65
|
-
|
|
55
|
+
##### nodeLoggingConnectorType?
|
|
56
|
+
|
|
57
|
+
`string`
|
|
66
58
|
|
|
67
59
|
Optional type of the logging connector.
|
|
68
60
|
|
|
@@ -80,13 +72,13 @@ A promise that resolves to a boolean indicating success.
|
|
|
80
72
|
|
|
81
73
|
### getSchema()
|
|
82
74
|
|
|
83
|
-
> **getSchema**(): `IEntitySchema
|
|
75
|
+
> **getSchema**(): `IEntitySchema`
|
|
84
76
|
|
|
85
77
|
Get the schema for the entities.
|
|
86
78
|
|
|
87
79
|
#### Returns
|
|
88
80
|
|
|
89
|
-
`IEntitySchema
|
|
81
|
+
`IEntitySchema`
|
|
90
82
|
|
|
91
83
|
The schema for the entities.
|
|
92
84
|
|
|
@@ -104,15 +96,21 @@ Get an entity from Cosmos DB.
|
|
|
104
96
|
|
|
105
97
|
#### Parameters
|
|
106
98
|
|
|
107
|
-
|
|
99
|
+
##### id
|
|
100
|
+
|
|
101
|
+
`string`
|
|
108
102
|
|
|
109
103
|
The id of the entity to get, or the index value if secondaryIndex is set.
|
|
110
104
|
|
|
111
|
-
|
|
105
|
+
##### secondaryIndex?
|
|
106
|
+
|
|
107
|
+
keyof `T`
|
|
112
108
|
|
|
113
109
|
Get the item using a secondary index.
|
|
114
110
|
|
|
115
|
-
|
|
111
|
+
##### conditions?
|
|
112
|
+
|
|
113
|
+
`object`[]
|
|
116
114
|
|
|
117
115
|
The optional conditions to match for the entities.
|
|
118
116
|
|
|
@@ -136,11 +134,15 @@ Set an entity.
|
|
|
136
134
|
|
|
137
135
|
#### Parameters
|
|
138
136
|
|
|
139
|
-
|
|
137
|
+
##### entity
|
|
138
|
+
|
|
139
|
+
`T`
|
|
140
140
|
|
|
141
141
|
The entity to set.
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
##### conditions?
|
|
144
|
+
|
|
145
|
+
`object`[]
|
|
144
146
|
|
|
145
147
|
The optional conditions to match for the entities.
|
|
146
148
|
|
|
@@ -164,11 +166,15 @@ Remove the entity.
|
|
|
164
166
|
|
|
165
167
|
#### Parameters
|
|
166
168
|
|
|
167
|
-
|
|
169
|
+
##### id
|
|
170
|
+
|
|
171
|
+
`string`
|
|
168
172
|
|
|
169
173
|
The id of the entity to remove.
|
|
170
174
|
|
|
171
|
-
|
|
175
|
+
##### conditions?
|
|
176
|
+
|
|
177
|
+
`object`[]
|
|
172
178
|
|
|
173
179
|
The optional conditions to match for the entities.
|
|
174
180
|
|
|
@@ -186,47 +192,49 @@ Nothing.
|
|
|
186
192
|
|
|
187
193
|
### query()
|
|
188
194
|
|
|
189
|
-
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`
|
|
195
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
|
190
196
|
|
|
191
197
|
Find all the entities which match the conditions.
|
|
192
198
|
|
|
193
199
|
#### Parameters
|
|
194
200
|
|
|
195
|
-
|
|
201
|
+
##### conditions?
|
|
202
|
+
|
|
203
|
+
`EntityCondition`\<`T`\>
|
|
196
204
|
|
|
197
205
|
The conditions to match for the entities.
|
|
198
206
|
|
|
199
|
-
|
|
207
|
+
##### sortProperties?
|
|
208
|
+
|
|
209
|
+
`object`[]
|
|
200
210
|
|
|
201
211
|
The optional sort order.
|
|
202
212
|
|
|
203
|
-
|
|
213
|
+
##### properties?
|
|
214
|
+
|
|
215
|
+
keyof `T`[]
|
|
204
216
|
|
|
205
217
|
The optional properties to return, defaults to all.
|
|
206
218
|
|
|
207
|
-
|
|
219
|
+
##### cursor?
|
|
220
|
+
|
|
221
|
+
`string`
|
|
208
222
|
|
|
209
223
|
The cursor to request the next page of entities.
|
|
210
224
|
|
|
211
|
-
|
|
225
|
+
##### pageSize?
|
|
226
|
+
|
|
227
|
+
`number`
|
|
212
228
|
|
|
213
229
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
214
230
|
|
|
215
231
|
#### Returns
|
|
216
232
|
|
|
217
|
-
`Promise`\<`
|
|
233
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
|
218
234
|
|
|
219
235
|
All the entities for the storage matching the conditions,
|
|
220
236
|
and a cursor which can be used to request more entities.
|
|
221
237
|
|
|
222
|
-
##### entities
|
|
223
|
-
|
|
224
|
-
> **entities**: `Partial`\<`T`\>[]
|
|
225
|
-
|
|
226
|
-
##### cursor?
|
|
227
|
-
|
|
228
|
-
> `optional` **cursor**: `string`
|
|
229
|
-
|
|
230
238
|
#### Implementation of
|
|
231
239
|
|
|
232
240
|
`IEntityStorageConnector.query`
|
package/docs/reference/index.md
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Interface: ICosmosDbEntityStorageConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
The options for the cosmos db entity storage connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### entitySchema
|
|
8
|
+
|
|
9
|
+
> **entitySchema**: `string`
|
|
10
|
+
|
|
11
|
+
The schema for the entity.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### loggingConnectorType?
|
|
16
|
+
|
|
17
|
+
> `optional` **loggingConnectorType**: `string`
|
|
18
|
+
|
|
19
|
+
The type of logging connector to use.
|
|
20
|
+
|
|
21
|
+
#### Default
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
logging
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
***
|
|
28
|
+
|
|
29
|
+
### config
|
|
30
|
+
|
|
31
|
+
> **config**: [`ICosmosDbEntityStorageConnectorConfig`](ICosmosDbEntityStorageConnectorConfig.md)
|
|
32
|
+
|
|
33
|
+
The configuration for the connector.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-cosmosdb",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.15",
|
|
4
4
|
"description": "Entity Storage connector implementation using CosmosDB storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@azure/cosmos": "^4.
|
|
18
|
-
"@azure/identity": "^4.
|
|
17
|
+
"@azure/cosmos": "^4.2.0",
|
|
18
|
+
"@azure/identity": "^4.5.0",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/entity": "next",
|
|
21
|
-
"@twin.org/entity-storage-models": "0.0.1-next.
|
|
21
|
+
"@twin.org/entity-storage-models": "0.0.1-next.15",
|
|
22
22
|
"@twin.org/logging-models": "next",
|
|
23
23
|
"@twin.org/nameof": "next"
|
|
24
24
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"import": "./dist/esm/index.mjs",
|
|
32
32
|
"types": "./dist/types/index.d.ts"
|
|
33
33
|
},
|
|
34
|
-
"./locales": "./locales"
|
|
34
|
+
"./locales/*.json": "./locales/*.json"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist/cjs",
|