@twin.org/entity-storage-connector-scylladb 0.0.1-next.9 → 0.0.1
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 +6 -12
- package/dist/esm/index.mjs +1 -7
- package/dist/types/index.d.ts +5 -2
- package/dist/types/models/IScyllaDBTableConnectorConstructorOptions.d.ts +18 -0
- package/dist/types/models/IScyllaDBViewConnectorConstructorOptions.d.ts +22 -0
- package/dist/types/scyllaDBTableConnector.d.ts +3 -10
- package/dist/types/scyllaDBViewConnector.d.ts +2 -11
- package/docs/changelog.md +105 -1
- package/docs/reference/classes/ScyllaDBTableConnector.md +56 -50
- package/docs/reference/classes/ScyllaDBViewConnector.md +48 -50
- package/docs/reference/index.md +3 -0
- package/docs/reference/interfaces/IScyllaDBConfig.md +31 -0
- package/docs/reference/interfaces/IScyllaDBTableConfig.md +4 -4
- package/docs/reference/interfaces/IScyllaDBTableConnectorConstructorOptions.md +27 -0
- package/docs/reference/interfaces/IScyllaDBViewConnectorConstructorOptions.md +35 -0
- package/package.json +10 -10
package/dist/cjs/index.cjs
CHANGED
|
@@ -444,9 +444,6 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
444
444
|
/**
|
|
445
445
|
* Create a new instance of ScyllaDBTableConnector.
|
|
446
446
|
* @param options The options for the connector.
|
|
447
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
448
|
-
* @param options.entitySchema The name of the entity schema.
|
|
449
|
-
* @param options.config The configuration for the connector.
|
|
450
447
|
*/
|
|
451
448
|
constructor(options) {
|
|
452
449
|
super(options, "ScyllaDBTableConnector");
|
|
@@ -569,23 +566,24 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
569
566
|
* @param entity The entity to set.
|
|
570
567
|
* @param conditions The optional conditions to match for the entities.
|
|
571
568
|
*/
|
|
572
|
-
async set(entity, conditions) {
|
|
573
|
-
core.Guards.object(this.CLASS_NAME, "entity", entity);
|
|
569
|
+
async set(entity$1, conditions) {
|
|
570
|
+
core.Guards.object(this.CLASS_NAME, "entity", entity$1);
|
|
571
|
+
entity.EntitySchemaHelper.validateEntity(entity$1, this.getSchema());
|
|
574
572
|
let connection;
|
|
575
|
-
const id = entity[this._primaryKey?.property];
|
|
573
|
+
const id = entity$1[this._primaryKey?.property];
|
|
576
574
|
try {
|
|
577
575
|
const propValues = [];
|
|
578
576
|
const updateValues = [];
|
|
579
577
|
conditions ??= [];
|
|
580
578
|
for (const propDesc of this._entitySchema.properties ?? []) {
|
|
581
579
|
if (!propDesc.isPrimary && !propDesc.isSecondary) {
|
|
582
|
-
propValues.push(this.propertyToDbValue(entity[propDesc.property], propDesc));
|
|
580
|
+
propValues.push(this.propertyToDbValue(entity$1[propDesc.property], propDesc));
|
|
583
581
|
updateValues.push(`"${String(propDesc.property)}"=?`);
|
|
584
582
|
}
|
|
585
583
|
else {
|
|
586
584
|
conditions.unshift({
|
|
587
585
|
property: propDesc.property,
|
|
588
|
-
value: this.propertyToDbValue(entity[propDesc.property], propDesc)
|
|
586
|
+
value: this.propertyToDbValue(entity$1[propDesc.property], propDesc)
|
|
589
587
|
});
|
|
590
588
|
}
|
|
591
589
|
}
|
|
@@ -807,10 +805,6 @@ class ScyllaDBViewConnector extends AbstractScyllaDBConnector {
|
|
|
807
805
|
/**
|
|
808
806
|
* Create a new instance of ScyllaDBViewConnector.
|
|
809
807
|
* @param options The options for the connector.
|
|
810
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
811
|
-
* @param options.entitySchema The name of the entity schema.
|
|
812
|
-
* @param options.viewSchema The name of the view schema.
|
|
813
|
-
* @param options.config The configuration for the connector.
|
|
814
808
|
*/
|
|
815
809
|
constructor(options) {
|
|
816
810
|
// We need this conversion so that types can match in the superclass and reuse the get method
|
package/dist/esm/index.mjs
CHANGED
|
@@ -442,9 +442,6 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
442
442
|
/**
|
|
443
443
|
* Create a new instance of ScyllaDBTableConnector.
|
|
444
444
|
* @param options The options for the connector.
|
|
445
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
446
|
-
* @param options.entitySchema The name of the entity schema.
|
|
447
|
-
* @param options.config The configuration for the connector.
|
|
448
445
|
*/
|
|
449
446
|
constructor(options) {
|
|
450
447
|
super(options, "ScyllaDBTableConnector");
|
|
@@ -569,6 +566,7 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
569
566
|
*/
|
|
570
567
|
async set(entity, conditions) {
|
|
571
568
|
Guards.object(this.CLASS_NAME, "entity", entity);
|
|
569
|
+
EntitySchemaHelper.validateEntity(entity, this.getSchema());
|
|
572
570
|
let connection;
|
|
573
571
|
const id = entity[this._primaryKey?.property];
|
|
574
572
|
try {
|
|
@@ -805,10 +803,6 @@ class ScyllaDBViewConnector extends AbstractScyllaDBConnector {
|
|
|
805
803
|
/**
|
|
806
804
|
* Create a new instance of ScyllaDBViewConnector.
|
|
807
805
|
* @param options The options for the connector.
|
|
808
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
809
|
-
* @param options.entitySchema The name of the entity schema.
|
|
810
|
-
* @param options.viewSchema The name of the view schema.
|
|
811
|
-
* @param options.config The configuration for the connector.
|
|
812
806
|
*/
|
|
813
807
|
constructor(options) {
|
|
814
808
|
// We need this conversion so that types can match in the superclass and reuse the get method
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./scyllaDBViewConnector";
|
|
1
|
+
export * from "./models/IScyllaDBConfig";
|
|
3
2
|
export * from "./models/IScyllaDBTableConfig";
|
|
3
|
+
export * from "./models/IScyllaDBTableConnectorConstructorOptions";
|
|
4
4
|
export * from "./models/IScyllaDBViewConfig";
|
|
5
|
+
export * from "./models/IScyllaDBViewConnectorConstructorOptions";
|
|
6
|
+
export * from "./scyllaDBTableConnector";
|
|
7
|
+
export * from "./scyllaDBViewConnector";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IScyllaDBTableConfig } from "./IScyllaDBTableConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the ScyllaDB Table Connector constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IScyllaDBTableConnectorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type of logging connector to use, defaults to no logging.
|
|
8
|
+
*/
|
|
9
|
+
loggingConnectorType?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The name of the entity schema.
|
|
12
|
+
*/
|
|
13
|
+
entitySchema: string;
|
|
14
|
+
/**
|
|
15
|
+
* The configuration for the connector.
|
|
16
|
+
*/
|
|
17
|
+
config: IScyllaDBTableConfig;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IScyllaDBViewConfig } from "./IScyllaDBViewConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the ScyllaDB View Connector constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IScyllaDBViewConnectorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type of logging connector to use, defaults to no logging.
|
|
8
|
+
*/
|
|
9
|
+
loggingConnectorType?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The name of the entity schema.
|
|
12
|
+
*/
|
|
13
|
+
entitySchema: string;
|
|
14
|
+
/**
|
|
15
|
+
* The name of the view schema.
|
|
16
|
+
*/
|
|
17
|
+
viewSchema: string;
|
|
18
|
+
/**
|
|
19
|
+
* The configuration for the connector.
|
|
20
|
+
*/
|
|
21
|
+
config: IScyllaDBViewConfig;
|
|
22
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IEntityStorageConnector } from "@twin.org/entity-storage-models";
|
|
2
2
|
import { AbstractScyllaDBConnector } from "./abstractScyllaDBConnector";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IScyllaDBTableConnectorConstructorOptions } from "./models/IScyllaDBTableConnectorConstructorOptions";
|
|
4
4
|
/**
|
|
5
5
|
* Store entities using ScyllaDB.
|
|
6
6
|
*/
|
|
@@ -12,15 +12,8 @@ export declare class ScyllaDBTableConnector<T = unknown> extends AbstractScyllaD
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a new instance of ScyllaDBTableConnector.
|
|
14
14
|
* @param options The options for the connector.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @param options.config The configuration for the connector.
|
|
18
|
-
*/
|
|
19
|
-
constructor(options: {
|
|
20
|
-
loggingConnectorType?: string;
|
|
21
|
-
entitySchema: string;
|
|
22
|
-
config: IScyllaDBTableConfig;
|
|
23
|
-
});
|
|
15
|
+
*/
|
|
16
|
+
constructor(options: IScyllaDBTableConnectorConstructorOptions);
|
|
24
17
|
/**
|
|
25
18
|
* Bootstrap the component by creating and initializing any resources it needs.
|
|
26
19
|
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IEntityStorageConnector } from "@twin.org/entity-storage-models";
|
|
2
2
|
import { AbstractScyllaDBConnector } from "./abstractScyllaDBConnector";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IScyllaDBViewConnectorConstructorOptions } from "./models/IScyllaDBViewConnectorConstructorOptions";
|
|
4
4
|
/**
|
|
5
5
|
* Manage entities using ScyllaDB Views.
|
|
6
6
|
*/
|
|
@@ -12,17 +12,8 @@ export declare class ScyllaDBViewConnector<T> extends AbstractScyllaDBConnector<
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a new instance of ScyllaDBViewConnector.
|
|
14
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
15
|
*/
|
|
20
|
-
constructor(options:
|
|
21
|
-
loggingConnectorType?: string;
|
|
22
|
-
entitySchema: string;
|
|
23
|
-
viewSchema: string;
|
|
24
|
-
config: IScyllaDBViewConfig;
|
|
25
|
-
});
|
|
16
|
+
constructor(options: IScyllaDBViewConnectorConstructorOptions);
|
|
26
17
|
/**
|
|
27
18
|
* Bootstrap the component by creating and initializing any resources it needs.
|
|
28
19
|
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# @twin.org/entity-storage-connector-scylladb - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.0.1 (2025-07-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add production release automation ([1eb4c8e](https://github.com/twinfoundation/entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
|
|
9
|
+
* release to production ([a309051](https://github.com/twinfoundation/entity-storage/commit/a3090519adebf7943232b4df12e4c6bd5afe7eed))
|
|
10
|
+
* update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
|
|
11
|
+
* use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Dependencies
|
|
20
|
+
|
|
21
|
+
* The following workspace dependencies were updated
|
|
22
|
+
* dependencies
|
|
23
|
+
* @twin.org/entity-storage-models bumped from ^0.0.0 to ^0.0.1
|
|
24
|
+
* devDependencies
|
|
25
|
+
* @twin.org/entity-storage-connector-memory bumped from ^0.0.0 to ^0.0.1
|
|
26
|
+
|
|
27
|
+
## [0.0.1-next.31](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-scylladb-v0.0.1-next.30...entity-storage-connector-scylladb-v0.0.1-next.31) (2025-06-20)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Dependencies
|
|
36
|
+
|
|
37
|
+
* The following workspace dependencies were updated
|
|
38
|
+
* dependencies
|
|
39
|
+
* @twin.org/entity-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
40
|
+
* devDependencies
|
|
41
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
42
|
+
|
|
43
|
+
## [0.0.1-next.30](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-scylladb-v0.0.1-next.29...entity-storage-connector-scylladb-v0.0.1-next.30) (2025-06-12)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Dependencies
|
|
52
|
+
|
|
53
|
+
* The following workspace dependencies were updated
|
|
54
|
+
* dependencies
|
|
55
|
+
* @twin.org/entity-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
56
|
+
* devDependencies
|
|
57
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
58
|
+
|
|
59
|
+
## [0.0.1-next.29](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-scylladb-v0.0.1-next.28...entity-storage-connector-scylladb-v0.0.1-next.29) (2025-04-17)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/entity-storage-models bumped from 0.0.1-next.28 to 0.0.1-next.29
|
|
72
|
+
* devDependencies
|
|
73
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.1-next.28 to 0.0.1-next.29
|
|
74
|
+
|
|
75
|
+
## [0.0.1-next.28](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-scylladb-v0.0.1-next.27...entity-storage-connector-scylladb-v0.0.1-next.28) (2025-04-09)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Miscellaneous Chores
|
|
79
|
+
|
|
80
|
+
* **entity-storage-connector-scylladb:** Synchronize repo versions
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Dependencies
|
|
84
|
+
|
|
85
|
+
* The following workspace dependencies were updated
|
|
86
|
+
* dependencies
|
|
87
|
+
* @twin.org/entity-storage-models bumped from 0.0.1-next.27 to 0.0.1-next.28
|
|
88
|
+
* devDependencies
|
|
89
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.1-next.27 to 0.0.1-next.28
|
|
90
|
+
|
|
91
|
+
## [0.0.1-next.27](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-scylladb-v0.0.1-next.26...entity-storage-connector-scylladb-v0.0.1-next.27) (2025-03-28)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Miscellaneous Chores
|
|
95
|
+
|
|
96
|
+
* **entity-storage-connector-scylladb:** Synchronize repo versions
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Dependencies
|
|
100
|
+
|
|
101
|
+
* The following workspace dependencies were updated
|
|
102
|
+
* dependencies
|
|
103
|
+
* @twin.org/entity-storage-models bumped from 0.0.1-next.26 to 0.0.1-next.27
|
|
104
|
+
* devDependencies
|
|
105
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.1-next.26 to 0.0.1-next.27
|
|
106
|
+
|
|
107
|
+
## v0.0.1-next.26
|
|
4
108
|
|
|
5
109
|
- Initial Release
|
|
@@ -8,7 +8,9 @@ Store entities using ScyllaDB.
|
|
|
8
8
|
|
|
9
9
|
## Type Parameters
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### T
|
|
12
|
+
|
|
13
|
+
`T` = `unknown`
|
|
12
14
|
|
|
13
15
|
## Implements
|
|
14
16
|
|
|
@@ -16,33 +18,23 @@ Store entities using ScyllaDB.
|
|
|
16
18
|
|
|
17
19
|
## Constructors
|
|
18
20
|
|
|
19
|
-
###
|
|
21
|
+
### Constructor
|
|
20
22
|
|
|
21
|
-
> **new ScyllaDBTableConnector**\<`T`\>(`options`):
|
|
23
|
+
> **new ScyllaDBTableConnector**\<`T`\>(`options`): `ScyllaDBTableConnector`\<`T`\>
|
|
22
24
|
|
|
23
25
|
Create a new instance of ScyllaDBTableConnector.
|
|
24
26
|
|
|
25
27
|
#### Parameters
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
The options for the connector.
|
|
30
|
-
|
|
31
|
-
• **options.loggingConnectorType?**: `string`
|
|
29
|
+
##### options
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
[`IScyllaDBTableConnectorConstructorOptions`](../interfaces/IScyllaDBTableConnectorConstructorOptions.md)
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
The name of the entity schema.
|
|
38
|
-
|
|
39
|
-
• **options.config**: [`IScyllaDBTableConfig`](../interfaces/IScyllaDBTableConfig.md)
|
|
40
|
-
|
|
41
|
-
The configuration for the connector.
|
|
33
|
+
The options for the connector.
|
|
42
34
|
|
|
43
35
|
#### Returns
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
`ScyllaDBTableConnector`\<`T`\>
|
|
46
38
|
|
|
47
39
|
#### Overrides
|
|
48
40
|
|
|
@@ -68,13 +60,13 @@ Runtime name for the class.
|
|
|
68
60
|
|
|
69
61
|
### getSchema()
|
|
70
62
|
|
|
71
|
-
> **getSchema**(): `IEntitySchema
|
|
63
|
+
> **getSchema**(): `IEntitySchema`
|
|
72
64
|
|
|
73
65
|
Get the schema for the entities.
|
|
74
66
|
|
|
75
67
|
#### Returns
|
|
76
68
|
|
|
77
|
-
`IEntitySchema
|
|
69
|
+
`IEntitySchema`
|
|
78
70
|
|
|
79
71
|
The schema for the entities.
|
|
80
72
|
|
|
@@ -90,21 +82,27 @@ The schema for the entities.
|
|
|
90
82
|
|
|
91
83
|
### get()
|
|
92
84
|
|
|
93
|
-
> **get**(`id`, `secondaryIndex
|
|
85
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`undefined` \| `T`\>
|
|
94
86
|
|
|
95
87
|
Get an entity.
|
|
96
88
|
|
|
97
89
|
#### Parameters
|
|
98
90
|
|
|
99
|
-
|
|
91
|
+
##### id
|
|
92
|
+
|
|
93
|
+
`string`
|
|
100
94
|
|
|
101
95
|
The id of the entity to get.
|
|
102
96
|
|
|
103
|
-
|
|
97
|
+
##### secondaryIndex?
|
|
98
|
+
|
|
99
|
+
keyof `T`
|
|
104
100
|
|
|
105
101
|
Get the item using a secondary index.
|
|
106
102
|
|
|
107
|
-
|
|
103
|
+
##### conditions?
|
|
104
|
+
|
|
105
|
+
`object`[]
|
|
108
106
|
|
|
109
107
|
The optional conditions to match for the entities.
|
|
110
108
|
|
|
@@ -126,51 +124,49 @@ The object if it can be found or undefined.
|
|
|
126
124
|
|
|
127
125
|
### query()
|
|
128
126
|
|
|
129
|
-
> **query**(`conditions
|
|
127
|
+
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
130
128
|
|
|
131
129
|
Find all the entities which match the conditions.
|
|
132
130
|
|
|
133
131
|
#### Parameters
|
|
134
132
|
|
|
135
|
-
|
|
133
|
+
##### conditions?
|
|
134
|
+
|
|
135
|
+
`EntityCondition`\<`T`\>
|
|
136
136
|
|
|
137
137
|
The conditions to match for the entities.
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
##### sortProperties?
|
|
140
|
+
|
|
141
|
+
`object`[]
|
|
140
142
|
|
|
141
143
|
The optional sort order.
|
|
142
144
|
|
|
143
|
-
|
|
145
|
+
##### properties?
|
|
146
|
+
|
|
147
|
+
keyof `T`[]
|
|
144
148
|
|
|
145
149
|
The optional properties to return, defaults to all.
|
|
146
150
|
|
|
147
|
-
|
|
151
|
+
##### cursor?
|
|
152
|
+
|
|
153
|
+
`string`
|
|
148
154
|
|
|
149
155
|
The cursor to request the next page of entities.
|
|
150
156
|
|
|
151
|
-
|
|
157
|
+
##### pageSize?
|
|
158
|
+
|
|
159
|
+
`number`
|
|
152
160
|
|
|
153
161
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
154
162
|
|
|
155
163
|
#### Returns
|
|
156
164
|
|
|
157
|
-
`Promise`\<`
|
|
165
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
158
166
|
|
|
159
167
|
All the entities for the storage matching the conditions,
|
|
160
168
|
and a cursor which can be used to request more entities.
|
|
161
169
|
|
|
162
|
-
##### entities
|
|
163
|
-
|
|
164
|
-
> **entities**: `Partial`\<`T`\>[]
|
|
165
|
-
|
|
166
|
-
The entities, which can be partial if a limited keys list was provided.
|
|
167
|
-
|
|
168
|
-
##### cursor?
|
|
169
|
-
|
|
170
|
-
> `optional` **cursor**: `string`
|
|
171
|
-
|
|
172
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
|
173
|
-
|
|
174
170
|
#### Implementation of
|
|
175
171
|
|
|
176
172
|
`IEntityStorageConnector.query`
|
|
@@ -183,13 +179,15 @@ An optional cursor, when defined can be used to call find to get more entities.
|
|
|
183
179
|
|
|
184
180
|
### bootstrap()
|
|
185
181
|
|
|
186
|
-
> **bootstrap**(`nodeLoggingConnectorType
|
|
182
|
+
> **bootstrap**(`nodeLoggingConnectorType?`): `Promise`\<`boolean`\>
|
|
187
183
|
|
|
188
184
|
Bootstrap the component by creating and initializing any resources it needs.
|
|
189
185
|
|
|
190
186
|
#### Parameters
|
|
191
187
|
|
|
192
|
-
|
|
188
|
+
##### nodeLoggingConnectorType?
|
|
189
|
+
|
|
190
|
+
`string`
|
|
193
191
|
|
|
194
192
|
The node logging connector type, defaults to "node-logging".
|
|
195
193
|
|
|
@@ -207,17 +205,21 @@ True if the bootstrapping process was successful.
|
|
|
207
205
|
|
|
208
206
|
### set()
|
|
209
207
|
|
|
210
|
-
> **set**(`entity`, `conditions
|
|
208
|
+
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
211
209
|
|
|
212
210
|
Set an entity.
|
|
213
211
|
|
|
214
212
|
#### Parameters
|
|
215
213
|
|
|
216
|
-
|
|
214
|
+
##### entity
|
|
215
|
+
|
|
216
|
+
`T`
|
|
217
217
|
|
|
218
218
|
The entity to set.
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
##### conditions?
|
|
221
|
+
|
|
222
|
+
`object`[]
|
|
221
223
|
|
|
222
224
|
The optional conditions to match for the entities.
|
|
223
225
|
|
|
@@ -233,17 +235,21 @@ The optional conditions to match for the entities.
|
|
|
233
235
|
|
|
234
236
|
### remove()
|
|
235
237
|
|
|
236
|
-
> **remove**(`id`, `conditions
|
|
238
|
+
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
237
239
|
|
|
238
240
|
Remove the entity.
|
|
239
241
|
|
|
240
242
|
#### Parameters
|
|
241
243
|
|
|
242
|
-
|
|
244
|
+
##### id
|
|
245
|
+
|
|
246
|
+
`string`
|
|
243
247
|
|
|
244
248
|
The id of the entity to remove.
|
|
245
249
|
|
|
246
|
-
|
|
250
|
+
##### conditions?
|
|
251
|
+
|
|
252
|
+
`object`[]
|
|
247
253
|
|
|
248
254
|
The optional conditions to match for the entities.
|
|
249
255
|
|
|
@@ -8,7 +8,9 @@ Manage entities using ScyllaDB Views.
|
|
|
8
8
|
|
|
9
9
|
## Type Parameters
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### T
|
|
12
|
+
|
|
13
|
+
`T`
|
|
12
14
|
|
|
13
15
|
## Implements
|
|
14
16
|
|
|
@@ -16,37 +18,23 @@ Manage entities using ScyllaDB Views.
|
|
|
16
18
|
|
|
17
19
|
## Constructors
|
|
18
20
|
|
|
19
|
-
###
|
|
21
|
+
### Constructor
|
|
20
22
|
|
|
21
|
-
> **new ScyllaDBViewConnector**\<`T`\>(`options`):
|
|
23
|
+
> **new ScyllaDBViewConnector**\<`T`\>(`options`): `ScyllaDBViewConnector`\<`T`\>
|
|
22
24
|
|
|
23
25
|
Create a new instance of ScyllaDBViewConnector.
|
|
24
26
|
|
|
25
27
|
#### Parameters
|
|
26
28
|
|
|
27
|
-
|
|
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`
|
|
29
|
+
##### options
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
[`IScyllaDBViewConnectorConstructorOptions`](../interfaces/IScyllaDBViewConnectorConstructorOptions.md)
|
|
42
32
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
The configuration for the connector.
|
|
33
|
+
The options for the connector.
|
|
46
34
|
|
|
47
35
|
#### Returns
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
`ScyllaDBViewConnector`\<`T`\>
|
|
50
38
|
|
|
51
39
|
#### Overrides
|
|
52
40
|
|
|
@@ -72,13 +60,13 @@ Runtime name for the class.
|
|
|
72
60
|
|
|
73
61
|
### getSchema()
|
|
74
62
|
|
|
75
|
-
> **getSchema**(): `IEntitySchema
|
|
63
|
+
> **getSchema**(): `IEntitySchema`
|
|
76
64
|
|
|
77
65
|
Get the schema for the entities.
|
|
78
66
|
|
|
79
67
|
#### Returns
|
|
80
68
|
|
|
81
|
-
`IEntitySchema
|
|
69
|
+
`IEntitySchema`
|
|
82
70
|
|
|
83
71
|
The schema for the entities.
|
|
84
72
|
|
|
@@ -94,21 +82,27 @@ The schema for the entities.
|
|
|
94
82
|
|
|
95
83
|
### get()
|
|
96
84
|
|
|
97
|
-
> **get**(`id`, `secondaryIndex
|
|
85
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`undefined` \| `T`\>
|
|
98
86
|
|
|
99
87
|
Get an entity.
|
|
100
88
|
|
|
101
89
|
#### Parameters
|
|
102
90
|
|
|
103
|
-
|
|
91
|
+
##### id
|
|
92
|
+
|
|
93
|
+
`string`
|
|
104
94
|
|
|
105
95
|
The id of the entity to get.
|
|
106
96
|
|
|
107
|
-
|
|
97
|
+
##### secondaryIndex?
|
|
98
|
+
|
|
99
|
+
keyof `T`
|
|
108
100
|
|
|
109
101
|
Get the item using a secondary index.
|
|
110
102
|
|
|
111
|
-
|
|
103
|
+
##### conditions?
|
|
104
|
+
|
|
105
|
+
`object`[]
|
|
112
106
|
|
|
113
107
|
The optional conditions to match for the entities.
|
|
114
108
|
|
|
@@ -130,51 +124,49 @@ The object if it can be found or undefined.
|
|
|
130
124
|
|
|
131
125
|
### query()
|
|
132
126
|
|
|
133
|
-
> **query**(`conditions
|
|
127
|
+
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
134
128
|
|
|
135
129
|
Find all the entities which match the conditions.
|
|
136
130
|
|
|
137
131
|
#### Parameters
|
|
138
132
|
|
|
139
|
-
|
|
133
|
+
##### conditions?
|
|
134
|
+
|
|
135
|
+
`EntityCondition`\<`T`\>
|
|
140
136
|
|
|
141
137
|
The conditions to match for the entities.
|
|
142
138
|
|
|
143
|
-
|
|
139
|
+
##### sortProperties?
|
|
140
|
+
|
|
141
|
+
`object`[]
|
|
144
142
|
|
|
145
143
|
The optional sort order.
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
##### properties?
|
|
146
|
+
|
|
147
|
+
keyof `T`[]
|
|
148
148
|
|
|
149
149
|
The optional properties to return, defaults to all.
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
##### cursor?
|
|
152
|
+
|
|
153
|
+
`string`
|
|
152
154
|
|
|
153
155
|
The cursor to request the next page of entities.
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
##### pageSize?
|
|
158
|
+
|
|
159
|
+
`number`
|
|
156
160
|
|
|
157
161
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
158
162
|
|
|
159
163
|
#### Returns
|
|
160
164
|
|
|
161
|
-
`Promise`\<`
|
|
165
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
162
166
|
|
|
163
167
|
All the entities for the storage matching the conditions,
|
|
164
168
|
and a cursor which can be used to request more entities.
|
|
165
169
|
|
|
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
170
|
#### Implementation of
|
|
179
171
|
|
|
180
172
|
`IEntityStorageConnector.query`
|
|
@@ -187,13 +179,15 @@ An optional cursor, when defined can be used to call find to get more entities.
|
|
|
187
179
|
|
|
188
180
|
### bootstrap()
|
|
189
181
|
|
|
190
|
-
> **bootstrap**(`nodeLoggingConnectorType
|
|
182
|
+
> **bootstrap**(`nodeLoggingConnectorType?`): `Promise`\<`boolean`\>
|
|
191
183
|
|
|
192
184
|
Bootstrap the component by creating and initializing any resources it needs.
|
|
193
185
|
|
|
194
186
|
#### Parameters
|
|
195
187
|
|
|
196
|
-
|
|
188
|
+
##### nodeLoggingConnectorType?
|
|
189
|
+
|
|
190
|
+
`string`
|
|
197
191
|
|
|
198
192
|
The node logging connector type, defaults to "node-logging".
|
|
199
193
|
|
|
@@ -217,7 +211,9 @@ Set an entity.
|
|
|
217
211
|
|
|
218
212
|
#### Parameters
|
|
219
213
|
|
|
220
|
-
|
|
214
|
+
##### entity
|
|
215
|
+
|
|
216
|
+
`T`
|
|
221
217
|
|
|
222
218
|
The entity to set.
|
|
223
219
|
|
|
@@ -239,7 +235,9 @@ Delete the entity.
|
|
|
239
235
|
|
|
240
236
|
#### Parameters
|
|
241
237
|
|
|
242
|
-
|
|
238
|
+
##### id
|
|
239
|
+
|
|
240
|
+
`string`
|
|
243
241
|
|
|
244
242
|
The id of the entity to remove.
|
|
245
243
|
|
package/docs/reference/index.md
CHANGED
|
@@ -7,5 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
## Interfaces
|
|
9
9
|
|
|
10
|
+
- [IScyllaDBConfig](interfaces/IScyllaDBConfig.md)
|
|
10
11
|
- [IScyllaDBTableConfig](interfaces/IScyllaDBTableConfig.md)
|
|
12
|
+
- [IScyllaDBTableConnectorConstructorOptions](interfaces/IScyllaDBTableConnectorConstructorOptions.md)
|
|
11
13
|
- [IScyllaDBViewConfig](interfaces/IScyllaDBViewConfig.md)
|
|
14
|
+
- [IScyllaDBViewConnectorConstructorOptions](interfaces/IScyllaDBViewConnectorConstructorOptions.md)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Interface: IScyllaDBConfig
|
|
2
|
+
|
|
3
|
+
ScyllaDB Configuration.
|
|
4
|
+
|
|
5
|
+
## Extended by
|
|
6
|
+
|
|
7
|
+
- [`IScyllaDBTableConfig`](IScyllaDBTableConfig.md)
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
### hosts
|
|
12
|
+
|
|
13
|
+
> **hosts**: `string`[]
|
|
14
|
+
|
|
15
|
+
The host to contact to.
|
|
16
|
+
|
|
17
|
+
***
|
|
18
|
+
|
|
19
|
+
### localDataCenter
|
|
20
|
+
|
|
21
|
+
> **localDataCenter**: `string`
|
|
22
|
+
|
|
23
|
+
The local data center.
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
### keyspace
|
|
28
|
+
|
|
29
|
+
> **keyspace**: `string`
|
|
30
|
+
|
|
31
|
+
The keyspace to use.
|
|
@@ -4,7 +4,7 @@ Definition of MySQL DB configuration.
|
|
|
4
4
|
|
|
5
5
|
## Extends
|
|
6
6
|
|
|
7
|
-
- `IScyllaDBConfig`
|
|
7
|
+
- [`IScyllaDBConfig`](IScyllaDBConfig.md)
|
|
8
8
|
|
|
9
9
|
## Extended by
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ The host to contact to.
|
|
|
20
20
|
|
|
21
21
|
#### Inherited from
|
|
22
22
|
|
|
23
|
-
`IScyllaDBConfig.hosts`
|
|
23
|
+
[`IScyllaDBConfig`](IScyllaDBConfig.md).[`hosts`](IScyllaDBConfig.md#hosts)
|
|
24
24
|
|
|
25
25
|
***
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ The local data center.
|
|
|
32
32
|
|
|
33
33
|
#### Inherited from
|
|
34
34
|
|
|
35
|
-
`IScyllaDBConfig.localDataCenter`
|
|
35
|
+
[`IScyllaDBConfig`](IScyllaDBConfig.md).[`localDataCenter`](IScyllaDBConfig.md#localdatacenter)
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ The keyspace to use.
|
|
|
44
44
|
|
|
45
45
|
#### Inherited from
|
|
46
46
|
|
|
47
|
-
`IScyllaDBConfig.keyspace`
|
|
47
|
+
[`IScyllaDBConfig`](IScyllaDBConfig.md).[`keyspace`](IScyllaDBConfig.md#keyspace)
|
|
48
48
|
|
|
49
49
|
***
|
|
50
50
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Interface: IScyllaDBTableConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the ScyllaDB Table Connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### loggingConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **loggingConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The type of logging connector to use, defaults to no logging.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### entitySchema
|
|
16
|
+
|
|
17
|
+
> **entitySchema**: `string`
|
|
18
|
+
|
|
19
|
+
The name of the entity schema.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### config
|
|
24
|
+
|
|
25
|
+
> **config**: [`IScyllaDBTableConfig`](IScyllaDBTableConfig.md)
|
|
26
|
+
|
|
27
|
+
The configuration for the connector.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Interface: IScyllaDBViewConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the ScyllaDB View Connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### loggingConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **loggingConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The type of logging connector to use, defaults to no logging.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### entitySchema
|
|
16
|
+
|
|
17
|
+
> **entitySchema**: `string`
|
|
18
|
+
|
|
19
|
+
The name of the entity schema.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### viewSchema
|
|
24
|
+
|
|
25
|
+
> **viewSchema**: `string`
|
|
26
|
+
|
|
27
|
+
The name of the view schema.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### config
|
|
32
|
+
|
|
33
|
+
> **config**: [`IScyllaDBViewConfig`](IScyllaDBViewConfig.md)
|
|
34
|
+
|
|
35
|
+
The configuration for the connector.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-scylladb",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Entity Storage connector implementation using ScyllaDB",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "
|
|
18
|
-
"@twin.org/entity": "
|
|
19
|
-
"@twin.org/entity-storage-models": "0.0.1
|
|
20
|
-
"@twin.org/logging-models": "
|
|
21
|
-
"@twin.org/nameof": "
|
|
22
|
-
"cassandra-driver": "
|
|
17
|
+
"@twin.org/core": "^0.0.1",
|
|
18
|
+
"@twin.org/entity": "^0.0.1",
|
|
19
|
+
"@twin.org/entity-storage-models": "^0.0.1",
|
|
20
|
+
"@twin.org/logging-models": "^0.0.1",
|
|
21
|
+
"@twin.org/nameof": "^0.0.1",
|
|
22
|
+
"cassandra-driver": "4.8.0"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|
|
25
25
|
"module": "./dist/esm/index.mjs",
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
29
30
|
"require": "./dist/cjs/index.cjs",
|
|
30
|
-
"import": "./dist/esm/index.mjs"
|
|
31
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
32
32
|
},
|
|
33
|
-
"./locales": "./locales"
|
|
33
|
+
"./locales/*.json": "./locales/*.json"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist/cjs",
|