@twin.org/entity-storage-connector-scylladb 0.0.1-next.2
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/LICENSE +201 -0
- package/README.md +35 -0
- package/dist/cjs/index.cjs +867 -0
- package/dist/esm/index.mjs +864 -0
- package/dist/types/abstractScyllaDBConnector.d.ts +50 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/models/IScyllaDBConfig.d.ts +17 -0
- package/dist/types/models/IScyllaDBTableConfig.d.ts +11 -0
- package/dist/types/models/IScyllaDBViewConfig.d.ts +11 -0
- package/dist/types/scyllaDBTableConnector.d.ts +48 -0
- package/dist/types/scyllaDBViewConnector.d.ts +42 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/ScyllaDBTableConnector.md +246 -0
- package/docs/reference/classes/ScyllaDBViewConnector.md +226 -0
- package/docs/reference/index.md +11 -0
- package/docs/reference/interfaces/IScyllaDBTableConfig.md +61 -0
- package/docs/reference/interfaces/IScyllaDBViewConfig.md +75 -0
- package/locales/en.json +28 -0
- package/package.json +73 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SortDirection, type EntityCondition } from "@twin.org/entity";
|
|
2
|
+
import type { IScyllaDBTableConfig } from "./models/IScyllaDBTableConfig";
|
|
3
|
+
/**
|
|
4
|
+
* Store entities using ScyllaDB.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class AbstractScyllaDBConnector<T> {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new instance of AbstractScyllaDBConnector.
|
|
9
|
+
* @param options The options for the connector.
|
|
10
|
+
* @param options.loggingConnectorType The type of logging connector to use, defaults to no logging.
|
|
11
|
+
* @param options.entitySchema The name of the entity schema.
|
|
12
|
+
* @param options.config The configuration for the connector.
|
|
13
|
+
* @param className The name of the derived class.
|
|
14
|
+
*/
|
|
15
|
+
constructor(options: {
|
|
16
|
+
loggingConnectorType?: string;
|
|
17
|
+
entitySchema: string;
|
|
18
|
+
config: IScyllaDBTableConfig;
|
|
19
|
+
}, className: string);
|
|
20
|
+
/**
|
|
21
|
+
* Get an entity.
|
|
22
|
+
* @param id The id of the entity to get.
|
|
23
|
+
* @param secondaryIndex Get the item using a secondary index.
|
|
24
|
+
* @returns The object if it can be found or undefined.
|
|
25
|
+
*/
|
|
26
|
+
get(id: string, secondaryIndex?: keyof T): Promise<T | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Find all the entities which match the conditions.
|
|
29
|
+
* @param conditions The conditions to match for the entities.
|
|
30
|
+
* @param sortProperties The optional sort order.
|
|
31
|
+
* @param properties The optional properties to return, defaults to all.
|
|
32
|
+
* @param cursor The cursor to request the next page of entities.
|
|
33
|
+
* @param pageSize The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
34
|
+
* @returns All the entities for the storage matching the conditions,
|
|
35
|
+
* and a cursor which can be used to request more entities.
|
|
36
|
+
*/
|
|
37
|
+
query(conditions?: EntityCondition<T>, sortProperties?: {
|
|
38
|
+
property: keyof T;
|
|
39
|
+
sortDirection: SortDirection;
|
|
40
|
+
}[], properties?: (keyof T)[], cursor?: string, pageSize?: number): Promise<{
|
|
41
|
+
/**
|
|
42
|
+
* The entities, which can be partial if a limited keys list was provided.
|
|
43
|
+
*/
|
|
44
|
+
entities: Partial<T>[];
|
|
45
|
+
/**
|
|
46
|
+
* An optional cursor, when defined can be used to call find to get more entities.
|
|
47
|
+
*/
|
|
48
|
+
cursor?: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScyllaDB Configuration.
|
|
3
|
+
*/
|
|
4
|
+
export interface IScyllaDBConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The host to contact to.
|
|
7
|
+
*/
|
|
8
|
+
hosts: string[];
|
|
9
|
+
/**
|
|
10
|
+
* The local data center.
|
|
11
|
+
*/
|
|
12
|
+
localDataCenter: string;
|
|
13
|
+
/**
|
|
14
|
+
* The keyspace to use.
|
|
15
|
+
*/
|
|
16
|
+
keyspace: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IScyllaDBConfig } from "./IScyllaDBConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Definition of MySQL DB configuration.
|
|
4
|
+
*/
|
|
5
|
+
export interface IScyllaDBTableConfig extends IScyllaDBConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the table for the storage.
|
|
8
|
+
* @default To the camel case of the entity name.
|
|
9
|
+
*/
|
|
10
|
+
tableName?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IScyllaDBTableConfig } from "./IScyllaDBTableConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Definition of MySQL DB configuration.
|
|
4
|
+
*/
|
|
5
|
+
export interface IScyllaDBViewConfig extends IScyllaDBTableConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The name of view.
|
|
8
|
+
* @default To the camel case of the entity name with View appended.
|
|
9
|
+
*/
|
|
10
|
+
viewName?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { IEntityStorageConnector } from "@twin.org/entity-storage-models";
|
|
2
|
+
import { AbstractScyllaDBConnector } from "./abstractScyllaDBConnector";
|
|
3
|
+
import type { IScyllaDBTableConfig } from "./models/IScyllaDBTableConfig";
|
|
4
|
+
/**
|
|
5
|
+
* Store entities using ScyllaDB.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ScyllaDBTableConnector<T = unknown> extends AbstractScyllaDBConnector<T> implements IEntityStorageConnector<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Runtime name for the class.
|
|
10
|
+
*/
|
|
11
|
+
readonly CLASS_NAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new instance of ScyllaDBTableConnector.
|
|
14
|
+
* @param options The options for the connector.
|
|
15
|
+
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
16
|
+
* @param options.entitySchema The name of the entity schema.
|
|
17
|
+
* @param options.config The configuration for the connector.
|
|
18
|
+
*/
|
|
19
|
+
constructor(options: {
|
|
20
|
+
loggingConnectorType?: string;
|
|
21
|
+
entitySchema: string;
|
|
22
|
+
config: IScyllaDBTableConfig;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Bootstrap the component by creating and initializing any resources it needs.
|
|
26
|
+
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
|
27
|
+
* @returns True if the bootstrapping process was successful.
|
|
28
|
+
*/
|
|
29
|
+
bootstrap(nodeLoggingConnectorType?: string): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Set an entity.
|
|
32
|
+
* @param entity The entity to set.
|
|
33
|
+
*/
|
|
34
|
+
set(entity: T): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete the entity.
|
|
37
|
+
* @param id The id of the entity to remove.
|
|
38
|
+
*/
|
|
39
|
+
remove(id: string): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Drops table.
|
|
42
|
+
*/
|
|
43
|
+
dropTable(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Truncates (clear) table.
|
|
46
|
+
*/
|
|
47
|
+
truncateTable(): Promise<void>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { IEntityStorageConnector } from "@twin.org/entity-storage-models";
|
|
2
|
+
import { AbstractScyllaDBConnector } from "./abstractScyllaDBConnector";
|
|
3
|
+
import type { IScyllaDBViewConfig } from "./models/IScyllaDBViewConfig";
|
|
4
|
+
/**
|
|
5
|
+
* Manage entities using ScyllaDB Views.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ScyllaDBViewConnector<T> extends AbstractScyllaDBConnector<T> implements IEntityStorageConnector<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Runtime name for the class.
|
|
10
|
+
*/
|
|
11
|
+
readonly CLASS_NAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new instance of ScyllaDBViewConnector.
|
|
14
|
+
* @param options The options for the connector.
|
|
15
|
+
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
16
|
+
* @param options.entitySchema The name of the entity schema.
|
|
17
|
+
* @param options.viewSchema The name of the view schema.
|
|
18
|
+
* @param options.config The configuration for the connector.
|
|
19
|
+
*/
|
|
20
|
+
constructor(options: {
|
|
21
|
+
loggingConnectorType?: string;
|
|
22
|
+
entitySchema: string;
|
|
23
|
+
viewSchema: string;
|
|
24
|
+
config: IScyllaDBViewConfig;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Bootstrap the component by creating and initializing any resources it needs.
|
|
28
|
+
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
|
29
|
+
* @returns True if the bootstrapping process was successful.
|
|
30
|
+
*/
|
|
31
|
+
bootstrap(nodeLoggingConnectorType?: string): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Set an entity.
|
|
34
|
+
* @param entity The entity to set.
|
|
35
|
+
*/
|
|
36
|
+
set(entity: T): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete the entity.
|
|
39
|
+
* @param id The id of the entity to remove.
|
|
40
|
+
*/
|
|
41
|
+
remove(id: string): Promise<void>;
|
|
42
|
+
}
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/entity-storage-connector-scylladb - Examples
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Class: ScyllaDBTableConnector\<T\>
|
|
2
|
+
|
|
3
|
+
Store entities using ScyllaDB.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `AbstractScyllaDBConnector`\<`T`\>
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
• **T** = `unknown`
|
|
12
|
+
|
|
13
|
+
## Implements
|
|
14
|
+
|
|
15
|
+
- `IEntityStorageConnector`\<`T`\>
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### new ScyllaDBTableConnector()
|
|
20
|
+
|
|
21
|
+
> **new ScyllaDBTableConnector**\<`T`\>(`options`): [`ScyllaDBTableConnector`](ScyllaDBTableConnector.md)\<`T`\>
|
|
22
|
+
|
|
23
|
+
Create a new instance of ScyllaDBTableConnector.
|
|
24
|
+
|
|
25
|
+
#### Parameters
|
|
26
|
+
|
|
27
|
+
• **options**
|
|
28
|
+
|
|
29
|
+
The options for the connector.
|
|
30
|
+
|
|
31
|
+
• **options.loggingConnectorType?**: `string`
|
|
32
|
+
|
|
33
|
+
The type of logging connector to use, defaults to "logging".
|
|
34
|
+
|
|
35
|
+
• **options.entitySchema**: `string`
|
|
36
|
+
|
|
37
|
+
The name of the entity schema.
|
|
38
|
+
|
|
39
|
+
• **options.config**: [`IScyllaDBTableConfig`](../interfaces/IScyllaDBTableConfig.md)
|
|
40
|
+
|
|
41
|
+
The configuration for the connector.
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
[`ScyllaDBTableConnector`](ScyllaDBTableConnector.md)\<`T`\>
|
|
46
|
+
|
|
47
|
+
#### Overrides
|
|
48
|
+
|
|
49
|
+
`AbstractScyllaDBConnector<T>.constructor`
|
|
50
|
+
|
|
51
|
+
## Properties
|
|
52
|
+
|
|
53
|
+
### CLASS\_NAME
|
|
54
|
+
|
|
55
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
56
|
+
|
|
57
|
+
Runtime name for the class.
|
|
58
|
+
|
|
59
|
+
#### Implementation of
|
|
60
|
+
|
|
61
|
+
`IEntityStorageConnector.CLASS_NAME`
|
|
62
|
+
|
|
63
|
+
#### Overrides
|
|
64
|
+
|
|
65
|
+
`AbstractScyllaDBConnector.CLASS_NAME`
|
|
66
|
+
|
|
67
|
+
## Methods
|
|
68
|
+
|
|
69
|
+
### get()
|
|
70
|
+
|
|
71
|
+
> **get**(`id`, `secondaryIndex`?): `Promise`\<`undefined` \| `T`\>
|
|
72
|
+
|
|
73
|
+
Get an entity.
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
• **id**: `string`
|
|
78
|
+
|
|
79
|
+
The id of the entity to get.
|
|
80
|
+
|
|
81
|
+
• **secondaryIndex?**: keyof `T`
|
|
82
|
+
|
|
83
|
+
Get the item using a secondary index.
|
|
84
|
+
|
|
85
|
+
#### Returns
|
|
86
|
+
|
|
87
|
+
`Promise`\<`undefined` \| `T`\>
|
|
88
|
+
|
|
89
|
+
The object if it can be found or undefined.
|
|
90
|
+
|
|
91
|
+
#### Implementation of
|
|
92
|
+
|
|
93
|
+
`IEntityStorageConnector.get`
|
|
94
|
+
|
|
95
|
+
#### Inherited from
|
|
96
|
+
|
|
97
|
+
`AbstractScyllaDBConnector.get`
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
### query()
|
|
102
|
+
|
|
103
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
|
|
104
|
+
|
|
105
|
+
Find all the entities which match the conditions.
|
|
106
|
+
|
|
107
|
+
#### Parameters
|
|
108
|
+
|
|
109
|
+
• **conditions?**: `EntityCondition`\<`T`\>
|
|
110
|
+
|
|
111
|
+
The conditions to match for the entities.
|
|
112
|
+
|
|
113
|
+
• **sortProperties?**: `object`[]
|
|
114
|
+
|
|
115
|
+
The optional sort order.
|
|
116
|
+
|
|
117
|
+
• **properties?**: keyof `T`[]
|
|
118
|
+
|
|
119
|
+
The optional properties to return, defaults to all.
|
|
120
|
+
|
|
121
|
+
• **cursor?**: `string`
|
|
122
|
+
|
|
123
|
+
The cursor to request the next page of entities.
|
|
124
|
+
|
|
125
|
+
• **pageSize?**: `number`
|
|
126
|
+
|
|
127
|
+
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`Promise`\<`object`\>
|
|
132
|
+
|
|
133
|
+
All the entities for the storage matching the conditions,
|
|
134
|
+
and a cursor which can be used to request more entities.
|
|
135
|
+
|
|
136
|
+
##### entities
|
|
137
|
+
|
|
138
|
+
> **entities**: `Partial`\<`T`\>[]
|
|
139
|
+
|
|
140
|
+
The entities, which can be partial if a limited keys list was provided.
|
|
141
|
+
|
|
142
|
+
##### cursor?
|
|
143
|
+
|
|
144
|
+
> `optional` **cursor**: `string`
|
|
145
|
+
|
|
146
|
+
An optional cursor, when defined can be used to call find to get more entities.
|
|
147
|
+
|
|
148
|
+
#### Implementation of
|
|
149
|
+
|
|
150
|
+
`IEntityStorageConnector.query`
|
|
151
|
+
|
|
152
|
+
#### Inherited from
|
|
153
|
+
|
|
154
|
+
`AbstractScyllaDBConnector.query`
|
|
155
|
+
|
|
156
|
+
***
|
|
157
|
+
|
|
158
|
+
### bootstrap()
|
|
159
|
+
|
|
160
|
+
> **bootstrap**(`nodeLoggingConnectorType`?): `Promise`\<`boolean`\>
|
|
161
|
+
|
|
162
|
+
Bootstrap the component by creating and initializing any resources it needs.
|
|
163
|
+
|
|
164
|
+
#### Parameters
|
|
165
|
+
|
|
166
|
+
• **nodeLoggingConnectorType?**: `string`
|
|
167
|
+
|
|
168
|
+
The node logging connector type, defaults to "node-logging".
|
|
169
|
+
|
|
170
|
+
#### Returns
|
|
171
|
+
|
|
172
|
+
`Promise`\<`boolean`\>
|
|
173
|
+
|
|
174
|
+
True if the bootstrapping process was successful.
|
|
175
|
+
|
|
176
|
+
#### Implementation of
|
|
177
|
+
|
|
178
|
+
`IEntityStorageConnector.bootstrap`
|
|
179
|
+
|
|
180
|
+
***
|
|
181
|
+
|
|
182
|
+
### set()
|
|
183
|
+
|
|
184
|
+
> **set**(`entity`): `Promise`\<`void`\>
|
|
185
|
+
|
|
186
|
+
Set an entity.
|
|
187
|
+
|
|
188
|
+
#### Parameters
|
|
189
|
+
|
|
190
|
+
• **entity**: `T`
|
|
191
|
+
|
|
192
|
+
The entity to set.
|
|
193
|
+
|
|
194
|
+
#### Returns
|
|
195
|
+
|
|
196
|
+
`Promise`\<`void`\>
|
|
197
|
+
|
|
198
|
+
#### Implementation of
|
|
199
|
+
|
|
200
|
+
`IEntityStorageConnector.set`
|
|
201
|
+
|
|
202
|
+
***
|
|
203
|
+
|
|
204
|
+
### remove()
|
|
205
|
+
|
|
206
|
+
> **remove**(`id`): `Promise`\<`void`\>
|
|
207
|
+
|
|
208
|
+
Delete the entity.
|
|
209
|
+
|
|
210
|
+
#### Parameters
|
|
211
|
+
|
|
212
|
+
• **id**: `string`
|
|
213
|
+
|
|
214
|
+
The id of the entity to remove.
|
|
215
|
+
|
|
216
|
+
#### Returns
|
|
217
|
+
|
|
218
|
+
`Promise`\<`void`\>
|
|
219
|
+
|
|
220
|
+
#### Implementation of
|
|
221
|
+
|
|
222
|
+
`IEntityStorageConnector.remove`
|
|
223
|
+
|
|
224
|
+
***
|
|
225
|
+
|
|
226
|
+
### dropTable()
|
|
227
|
+
|
|
228
|
+
> **dropTable**(): `Promise`\<`void`\>
|
|
229
|
+
|
|
230
|
+
Drops table.
|
|
231
|
+
|
|
232
|
+
#### Returns
|
|
233
|
+
|
|
234
|
+
`Promise`\<`void`\>
|
|
235
|
+
|
|
236
|
+
***
|
|
237
|
+
|
|
238
|
+
### truncateTable()
|
|
239
|
+
|
|
240
|
+
> **truncateTable**(): `Promise`\<`void`\>
|
|
241
|
+
|
|
242
|
+
Truncates (clear) table.
|
|
243
|
+
|
|
244
|
+
#### Returns
|
|
245
|
+
|
|
246
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Class: ScyllaDBViewConnector\<T\>
|
|
2
|
+
|
|
3
|
+
Manage entities using ScyllaDB Views.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `AbstractScyllaDBConnector`\<`T`\>
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
• **T**
|
|
12
|
+
|
|
13
|
+
## Implements
|
|
14
|
+
|
|
15
|
+
- `IEntityStorageConnector`\<`T`\>
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### new ScyllaDBViewConnector()
|
|
20
|
+
|
|
21
|
+
> **new ScyllaDBViewConnector**\<`T`\>(`options`): [`ScyllaDBViewConnector`](ScyllaDBViewConnector.md)\<`T`\>
|
|
22
|
+
|
|
23
|
+
Create a new instance of ScyllaDBViewConnector.
|
|
24
|
+
|
|
25
|
+
#### Parameters
|
|
26
|
+
|
|
27
|
+
• **options**
|
|
28
|
+
|
|
29
|
+
The options for the connector.
|
|
30
|
+
|
|
31
|
+
• **options.loggingConnectorType?**: `string`
|
|
32
|
+
|
|
33
|
+
The type of logging connector to use, defaults to "logging".
|
|
34
|
+
|
|
35
|
+
• **options.entitySchema**: `string`
|
|
36
|
+
|
|
37
|
+
The name of the entity schema.
|
|
38
|
+
|
|
39
|
+
• **options.viewSchema**: `string`
|
|
40
|
+
|
|
41
|
+
The name of the view schema.
|
|
42
|
+
|
|
43
|
+
• **options.config**: [`IScyllaDBViewConfig`](../interfaces/IScyllaDBViewConfig.md)
|
|
44
|
+
|
|
45
|
+
The configuration for the connector.
|
|
46
|
+
|
|
47
|
+
#### Returns
|
|
48
|
+
|
|
49
|
+
[`ScyllaDBViewConnector`](ScyllaDBViewConnector.md)\<`T`\>
|
|
50
|
+
|
|
51
|
+
#### Overrides
|
|
52
|
+
|
|
53
|
+
`AbstractScyllaDBConnector<T>.constructor`
|
|
54
|
+
|
|
55
|
+
## Properties
|
|
56
|
+
|
|
57
|
+
### CLASS\_NAME
|
|
58
|
+
|
|
59
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
60
|
+
|
|
61
|
+
Runtime name for the class.
|
|
62
|
+
|
|
63
|
+
#### Implementation of
|
|
64
|
+
|
|
65
|
+
`IEntityStorageConnector.CLASS_NAME`
|
|
66
|
+
|
|
67
|
+
#### Overrides
|
|
68
|
+
|
|
69
|
+
`AbstractScyllaDBConnector.CLASS_NAME`
|
|
70
|
+
|
|
71
|
+
## Methods
|
|
72
|
+
|
|
73
|
+
### get()
|
|
74
|
+
|
|
75
|
+
> **get**(`id`, `secondaryIndex`?): `Promise`\<`undefined` \| `T`\>
|
|
76
|
+
|
|
77
|
+
Get an entity.
|
|
78
|
+
|
|
79
|
+
#### Parameters
|
|
80
|
+
|
|
81
|
+
• **id**: `string`
|
|
82
|
+
|
|
83
|
+
The id of the entity to get.
|
|
84
|
+
|
|
85
|
+
• **secondaryIndex?**: keyof `T`
|
|
86
|
+
|
|
87
|
+
Get the item using a secondary index.
|
|
88
|
+
|
|
89
|
+
#### Returns
|
|
90
|
+
|
|
91
|
+
`Promise`\<`undefined` \| `T`\>
|
|
92
|
+
|
|
93
|
+
The object if it can be found or undefined.
|
|
94
|
+
|
|
95
|
+
#### Implementation of
|
|
96
|
+
|
|
97
|
+
`IEntityStorageConnector.get`
|
|
98
|
+
|
|
99
|
+
#### Inherited from
|
|
100
|
+
|
|
101
|
+
`AbstractScyllaDBConnector.get`
|
|
102
|
+
|
|
103
|
+
***
|
|
104
|
+
|
|
105
|
+
### query()
|
|
106
|
+
|
|
107
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
|
|
108
|
+
|
|
109
|
+
Find all the entities which match the conditions.
|
|
110
|
+
|
|
111
|
+
#### Parameters
|
|
112
|
+
|
|
113
|
+
• **conditions?**: `EntityCondition`\<`T`\>
|
|
114
|
+
|
|
115
|
+
The conditions to match for the entities.
|
|
116
|
+
|
|
117
|
+
• **sortProperties?**: `object`[]
|
|
118
|
+
|
|
119
|
+
The optional sort order.
|
|
120
|
+
|
|
121
|
+
• **properties?**: keyof `T`[]
|
|
122
|
+
|
|
123
|
+
The optional properties to return, defaults to all.
|
|
124
|
+
|
|
125
|
+
• **cursor?**: `string`
|
|
126
|
+
|
|
127
|
+
The cursor to request the next page of entities.
|
|
128
|
+
|
|
129
|
+
• **pageSize?**: `number`
|
|
130
|
+
|
|
131
|
+
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
132
|
+
|
|
133
|
+
#### Returns
|
|
134
|
+
|
|
135
|
+
`Promise`\<`object`\>
|
|
136
|
+
|
|
137
|
+
All the entities for the storage matching the conditions,
|
|
138
|
+
and a cursor which can be used to request more entities.
|
|
139
|
+
|
|
140
|
+
##### entities
|
|
141
|
+
|
|
142
|
+
> **entities**: `Partial`\<`T`\>[]
|
|
143
|
+
|
|
144
|
+
The entities, which can be partial if a limited keys list was provided.
|
|
145
|
+
|
|
146
|
+
##### cursor?
|
|
147
|
+
|
|
148
|
+
> `optional` **cursor**: `string`
|
|
149
|
+
|
|
150
|
+
An optional cursor, when defined can be used to call find to get more entities.
|
|
151
|
+
|
|
152
|
+
#### Implementation of
|
|
153
|
+
|
|
154
|
+
`IEntityStorageConnector.query`
|
|
155
|
+
|
|
156
|
+
#### Inherited from
|
|
157
|
+
|
|
158
|
+
`AbstractScyllaDBConnector.query`
|
|
159
|
+
|
|
160
|
+
***
|
|
161
|
+
|
|
162
|
+
### bootstrap()
|
|
163
|
+
|
|
164
|
+
> **bootstrap**(`nodeLoggingConnectorType`?): `Promise`\<`boolean`\>
|
|
165
|
+
|
|
166
|
+
Bootstrap the component by creating and initializing any resources it needs.
|
|
167
|
+
|
|
168
|
+
#### Parameters
|
|
169
|
+
|
|
170
|
+
• **nodeLoggingConnectorType?**: `string`
|
|
171
|
+
|
|
172
|
+
The node logging connector type, defaults to "node-logging".
|
|
173
|
+
|
|
174
|
+
#### Returns
|
|
175
|
+
|
|
176
|
+
`Promise`\<`boolean`\>
|
|
177
|
+
|
|
178
|
+
True if the bootstrapping process was successful.
|
|
179
|
+
|
|
180
|
+
#### Implementation of
|
|
181
|
+
|
|
182
|
+
`IEntityStorageConnector.bootstrap`
|
|
183
|
+
|
|
184
|
+
***
|
|
185
|
+
|
|
186
|
+
### set()
|
|
187
|
+
|
|
188
|
+
> **set**(`entity`): `Promise`\<`void`\>
|
|
189
|
+
|
|
190
|
+
Set an entity.
|
|
191
|
+
|
|
192
|
+
#### Parameters
|
|
193
|
+
|
|
194
|
+
• **entity**: `T`
|
|
195
|
+
|
|
196
|
+
The entity to set.
|
|
197
|
+
|
|
198
|
+
#### Returns
|
|
199
|
+
|
|
200
|
+
`Promise`\<`void`\>
|
|
201
|
+
|
|
202
|
+
#### Implementation of
|
|
203
|
+
|
|
204
|
+
`IEntityStorageConnector.set`
|
|
205
|
+
|
|
206
|
+
***
|
|
207
|
+
|
|
208
|
+
### remove()
|
|
209
|
+
|
|
210
|
+
> **remove**(`id`): `Promise`\<`void`\>
|
|
211
|
+
|
|
212
|
+
Delete the entity.
|
|
213
|
+
|
|
214
|
+
#### Parameters
|
|
215
|
+
|
|
216
|
+
• **id**: `string`
|
|
217
|
+
|
|
218
|
+
The id of the entity to remove.
|
|
219
|
+
|
|
220
|
+
#### Returns
|
|
221
|
+
|
|
222
|
+
`Promise`\<`void`\>
|
|
223
|
+
|
|
224
|
+
#### Implementation of
|
|
225
|
+
|
|
226
|
+
`IEntityStorageConnector.remove`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @twin.org/entity-storage-connector-scylladb
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [ScyllaDBTableConnector](classes/ScyllaDBTableConnector.md)
|
|
6
|
+
- [ScyllaDBViewConnector](classes/ScyllaDBViewConnector.md)
|
|
7
|
+
|
|
8
|
+
## Interfaces
|
|
9
|
+
|
|
10
|
+
- [IScyllaDBTableConfig](interfaces/IScyllaDBTableConfig.md)
|
|
11
|
+
- [IScyllaDBViewConfig](interfaces/IScyllaDBViewConfig.md)
|