@twin.org/entity-storage-connector-scylladb 0.0.1-next.10

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.
@@ -0,0 +1,252 @@
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
+ ### getSchema()
74
+
75
+ > **getSchema**(): `IEntitySchema`\<`unknown`\>
76
+
77
+ Get the schema for the entities.
78
+
79
+ #### Returns
80
+
81
+ `IEntitySchema`\<`unknown`\>
82
+
83
+ The schema for the entities.
84
+
85
+ #### Implementation of
86
+
87
+ `IEntityStorageConnector.getSchema`
88
+
89
+ #### Inherited from
90
+
91
+ `AbstractScyllaDBConnector.getSchema`
92
+
93
+ ***
94
+
95
+ ### get()
96
+
97
+ > **get**(`id`, `secondaryIndex`?, `conditions`?): `Promise`\<`undefined` \| `T`\>
98
+
99
+ Get an entity.
100
+
101
+ #### Parameters
102
+
103
+ • **id**: `string`
104
+
105
+ The id of the entity to get.
106
+
107
+ • **secondaryIndex?**: keyof `T`
108
+
109
+ Get the item using a secondary index.
110
+
111
+ • **conditions?**: `object`[]
112
+
113
+ The optional conditions to match for the entities.
114
+
115
+ #### Returns
116
+
117
+ `Promise`\<`undefined` \| `T`\>
118
+
119
+ The object if it can be found or undefined.
120
+
121
+ #### Implementation of
122
+
123
+ `IEntityStorageConnector.get`
124
+
125
+ #### Inherited from
126
+
127
+ `AbstractScyllaDBConnector.get`
128
+
129
+ ***
130
+
131
+ ### query()
132
+
133
+ > **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
134
+
135
+ Find all the entities which match the conditions.
136
+
137
+ #### Parameters
138
+
139
+ • **conditions?**: `EntityCondition`\<`T`\>
140
+
141
+ The conditions to match for the entities.
142
+
143
+ • **sortProperties?**: `object`[]
144
+
145
+ The optional sort order.
146
+
147
+ • **properties?**: keyof `T`[]
148
+
149
+ The optional properties to return, defaults to all.
150
+
151
+ • **cursor?**: `string`
152
+
153
+ The cursor to request the next page of entities.
154
+
155
+ • **pageSize?**: `number`
156
+
157
+ The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
158
+
159
+ #### Returns
160
+
161
+ `Promise`\<`object`\>
162
+
163
+ All the entities for the storage matching the conditions,
164
+ and a cursor which can be used to request more entities.
165
+
166
+ ##### entities
167
+
168
+ > **entities**: `Partial`\<`T`\>[]
169
+
170
+ The entities, which can be partial if a limited keys list was provided.
171
+
172
+ ##### cursor?
173
+
174
+ > `optional` **cursor**: `string`
175
+
176
+ An optional cursor, when defined can be used to call find to get more entities.
177
+
178
+ #### Implementation of
179
+
180
+ `IEntityStorageConnector.query`
181
+
182
+ #### Inherited from
183
+
184
+ `AbstractScyllaDBConnector.query`
185
+
186
+ ***
187
+
188
+ ### bootstrap()
189
+
190
+ > **bootstrap**(`nodeLoggingConnectorType`?): `Promise`\<`boolean`\>
191
+
192
+ Bootstrap the component by creating and initializing any resources it needs.
193
+
194
+ #### Parameters
195
+
196
+ • **nodeLoggingConnectorType?**: `string`
197
+
198
+ The node logging connector type, defaults to "node-logging".
199
+
200
+ #### Returns
201
+
202
+ `Promise`\<`boolean`\>
203
+
204
+ True if the bootstrapping process was successful.
205
+
206
+ #### Implementation of
207
+
208
+ `IEntityStorageConnector.bootstrap`
209
+
210
+ ***
211
+
212
+ ### set()
213
+
214
+ > **set**(`entity`): `Promise`\<`void`\>
215
+
216
+ Set an entity.
217
+
218
+ #### Parameters
219
+
220
+ • **entity**: `T`
221
+
222
+ The entity to set.
223
+
224
+ #### Returns
225
+
226
+ `Promise`\<`void`\>
227
+
228
+ #### Implementation of
229
+
230
+ `IEntityStorageConnector.set`
231
+
232
+ ***
233
+
234
+ ### remove()
235
+
236
+ > **remove**(`id`): `Promise`\<`void`\>
237
+
238
+ Delete the entity.
239
+
240
+ #### Parameters
241
+
242
+ • **id**: `string`
243
+
244
+ The id of the entity to remove.
245
+
246
+ #### Returns
247
+
248
+ `Promise`\<`void`\>
249
+
250
+ #### Implementation of
251
+
252
+ `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)
@@ -0,0 +1,61 @@
1
+ # Interface: IScyllaDBTableConfig
2
+
3
+ Definition of MySQL DB configuration.
4
+
5
+ ## Extends
6
+
7
+ - `IScyllaDBConfig`
8
+
9
+ ## Extended by
10
+
11
+ - [`IScyllaDBViewConfig`](IScyllaDBViewConfig.md)
12
+
13
+ ## Properties
14
+
15
+ ### hosts
16
+
17
+ > **hosts**: `string`[]
18
+
19
+ The host to contact to.
20
+
21
+ #### Inherited from
22
+
23
+ `IScyllaDBConfig.hosts`
24
+
25
+ ***
26
+
27
+ ### localDataCenter
28
+
29
+ > **localDataCenter**: `string`
30
+
31
+ The local data center.
32
+
33
+ #### Inherited from
34
+
35
+ `IScyllaDBConfig.localDataCenter`
36
+
37
+ ***
38
+
39
+ ### keyspace
40
+
41
+ > **keyspace**: `string`
42
+
43
+ The keyspace to use.
44
+
45
+ #### Inherited from
46
+
47
+ `IScyllaDBConfig.keyspace`
48
+
49
+ ***
50
+
51
+ ### tableName?
52
+
53
+ > `optional` **tableName**: `string`
54
+
55
+ The name of the table for the storage.
56
+
57
+ #### Default
58
+
59
+ ```ts
60
+ To the camel case of the entity name.
61
+ ```
@@ -0,0 +1,75 @@
1
+ # Interface: IScyllaDBViewConfig
2
+
3
+ Definition of MySQL DB configuration.
4
+
5
+ ## Extends
6
+
7
+ - [`IScyllaDBTableConfig`](IScyllaDBTableConfig.md)
8
+
9
+ ## Properties
10
+
11
+ ### hosts
12
+
13
+ > **hosts**: `string`[]
14
+
15
+ The host to contact to.
16
+
17
+ #### Inherited from
18
+
19
+ [`IScyllaDBTableConfig`](IScyllaDBTableConfig.md).[`hosts`](IScyllaDBTableConfig.md#hosts)
20
+
21
+ ***
22
+
23
+ ### localDataCenter
24
+
25
+ > **localDataCenter**: `string`
26
+
27
+ The local data center.
28
+
29
+ #### Inherited from
30
+
31
+ [`IScyllaDBTableConfig`](IScyllaDBTableConfig.md).[`localDataCenter`](IScyllaDBTableConfig.md#localdatacenter)
32
+
33
+ ***
34
+
35
+ ### keyspace
36
+
37
+ > **keyspace**: `string`
38
+
39
+ The keyspace to use.
40
+
41
+ #### Inherited from
42
+
43
+ [`IScyllaDBTableConfig`](IScyllaDBTableConfig.md).[`keyspace`](IScyllaDBTableConfig.md#keyspace)
44
+
45
+ ***
46
+
47
+ ### tableName?
48
+
49
+ > `optional` **tableName**: `string`
50
+
51
+ The name of the table for the storage.
52
+
53
+ #### Default
54
+
55
+ ```ts
56
+ To the camel case of the entity name.
57
+ ```
58
+
59
+ #### Inherited from
60
+
61
+ [`IScyllaDBTableConfig`](IScyllaDBTableConfig.md).[`tableName`](IScyllaDBTableConfig.md#tablename)
62
+
63
+ ***
64
+
65
+ ### viewName?
66
+
67
+ > `optional` **viewName**: `string`
68
+
69
+ The name of view.
70
+
71
+ #### Default
72
+
73
+ ```ts
74
+ To the camel case of the entity name with View appended.
75
+ ```
@@ -0,0 +1,28 @@
1
+ {
2
+ "info": {
3
+ "scyllaDBTableConnector": {
4
+ "tableCreating": "Creating table \"{table}\"",
5
+ "tableCreated": "Created table \"{table}\"",
6
+ "tableExists": "Skipping create table \"{table}\" as it already exists",
7
+ "typeCreated": "Created type \"{typeName}\"",
8
+ "sql": "SQL: \"{sql}\""
9
+ },
10
+ "scyllaDBViewConnector": {
11
+ "viewCreating": "Creating view \"{view}\"",
12
+ "viewCreated": "Created view \"{view}\"",
13
+ "viewExists": "Skipping create view \"{view}\" as it already exists",
14
+ "typeCreated": "Created type \"{typeName}\"",
15
+ "sql": "SQL: \"{sql}\""
16
+ }
17
+ },
18
+ "error": {
19
+ "scyllaDBTableConnector": {
20
+ "tableCreateFailed": "Creating table \"{table}\" failed",
21
+ "getFailed": "Getting item with \"{id}\" failed",
22
+ "dropTableFailed": " \"{table}\" cannot be dropped",
23
+ "truncateTableFailed": " \"{table}\" cannot be dropped",
24
+ "removeFailed": "Removing item with \"{id}\" failed",
25
+ "findFailed": "Error while querying data on \"{table}\""
26
+ }
27
+ }
28
+ }
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@twin.org/entity-storage-connector-scylladb",
3
+ "version": "0.0.1-next.10",
4
+ "description": "Entity Storage connector implementation using ScyllaDB",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/twinfoundation/entity-storage.git",
8
+ "directory": "packages/entity-storage-connector-scylladb"
9
+ },
10
+ "author": "jose.cantera@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=20.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@twin.org/core": "next",
18
+ "@twin.org/entity": "next",
19
+ "@twin.org/entity-storage-models": "0.0.1-next.10",
20
+ "@twin.org/logging-models": "next",
21
+ "@twin.org/nameof": "next",
22
+ "cassandra-driver": "^4.7.2"
23
+ },
24
+ "main": "./dist/cjs/index.cjs",
25
+ "module": "./dist/esm/index.mjs",
26
+ "types": "./dist/types/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "require": "./dist/cjs/index.cjs",
30
+ "import": "./dist/esm/index.mjs",
31
+ "types": "./dist/types/index.d.ts"
32
+ },
33
+ "./locales": "./locales"
34
+ },
35
+ "files": [
36
+ "dist/cjs",
37
+ "dist/esm",
38
+ "dist/types",
39
+ "locales",
40
+ "docs"
41
+ ]
42
+ }