@twin.org/entity-storage-connector-scylladb 0.0.1-next.8 → 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 +51 -23
- package/dist/esm/index.mjs +49 -21
- package/dist/types/abstractScyllaDBConnector.d.ts +5 -1
- 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 +19 -12
- package/dist/types/scyllaDBViewConnector.d.ts +2 -11
- package/docs/changelog.md +105 -1
- package/docs/reference/classes/ScyllaDBTableConnector.md +66 -48
- package/docs/reference/classes/ScyllaDBViewConnector.md +51 -49
- 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
|
@@ -81,9 +81,10 @@ class AbstractScyllaDBConnector {
|
|
|
81
81
|
* Get an entity.
|
|
82
82
|
* @param id The id of the entity to get.
|
|
83
83
|
* @param secondaryIndex Get the item using a secondary index.
|
|
84
|
+
* @param conditions The optional conditions to match for the entities.
|
|
84
85
|
* @returns The object if it can be found or undefined.
|
|
85
86
|
*/
|
|
86
|
-
async get(id, secondaryIndex) {
|
|
87
|
+
async get(id, secondaryIndex, conditions) {
|
|
87
88
|
core.Guards.stringValue(this.CLASS_NAME, "id", id);
|
|
88
89
|
let connection;
|
|
89
90
|
try {
|
|
@@ -443,9 +444,6 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
443
444
|
/**
|
|
444
445
|
* Create a new instance of ScyllaDBTableConnector.
|
|
445
446
|
* @param options The options for the connector.
|
|
446
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
447
|
-
* @param options.entitySchema The name of the entity schema.
|
|
448
|
-
* @param options.config The configuration for the connector.
|
|
449
447
|
*/
|
|
450
448
|
constructor(options) {
|
|
451
449
|
super(options, "ScyllaDBTableConnector");
|
|
@@ -566,22 +564,36 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
566
564
|
/**
|
|
567
565
|
* Set an entity.
|
|
568
566
|
* @param entity The entity to set.
|
|
567
|
+
* @param conditions The optional conditions to match for the entities.
|
|
569
568
|
*/
|
|
570
|
-
async set(entity) {
|
|
571
|
-
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());
|
|
572
572
|
let connection;
|
|
573
|
-
const id = entity[this._primaryKey?.property];
|
|
573
|
+
const id = entity$1[this._primaryKey?.property];
|
|
574
574
|
try {
|
|
575
|
-
const propNames = this._entitySchema.properties?.map(f => `"${String(f.property)}"`) ?? [];
|
|
576
575
|
const propValues = [];
|
|
577
|
-
const
|
|
578
|
-
|
|
576
|
+
const updateValues = [];
|
|
577
|
+
conditions ??= [];
|
|
579
578
|
for (const propDesc of this._entitySchema.properties ?? []) {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
579
|
+
if (!propDesc.isPrimary && !propDesc.isSecondary) {
|
|
580
|
+
propValues.push(this.propertyToDbValue(entity$1[propDesc.property], propDesc));
|
|
581
|
+
updateValues.push(`"${String(propDesc.property)}"=?`);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
conditions.unshift({
|
|
585
|
+
property: propDesc.property,
|
|
586
|
+
value: this.propertyToDbValue(entity$1[propDesc.property], propDesc)
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
const { sqlCondition, conditionValues } = this.buildConditions(conditions);
|
|
591
|
+
let conditionString = "";
|
|
592
|
+
if (sqlCondition.length > 0) {
|
|
593
|
+
conditionString = ` WHERE ${sqlCondition}`;
|
|
594
|
+
propValues.push(...conditionValues);
|
|
583
595
|
}
|
|
584
|
-
const sql = `
|
|
596
|
+
const sql = `UPDATE "${this._fullTableName}" SET ${updateValues.join(",")}${conditionString}`;
|
|
585
597
|
await this._logging?.log({
|
|
586
598
|
level: "info",
|
|
587
599
|
source: this.CLASS_NAME,
|
|
@@ -602,15 +614,18 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
602
614
|
}
|
|
603
615
|
}
|
|
604
616
|
/**
|
|
605
|
-
*
|
|
617
|
+
* Remove the entity.
|
|
606
618
|
* @param id The id of the entity to remove.
|
|
619
|
+
* @param conditions The optional conditions to match for the entities.
|
|
607
620
|
*/
|
|
608
|
-
async remove(id) {
|
|
621
|
+
async remove(id, conditions) {
|
|
609
622
|
core.Guards.stringValue(this.CLASS_NAME, "id", id);
|
|
610
623
|
let connection;
|
|
611
|
-
const primaryFieldValue = this.propertyToDbValue(id, this._primaryKey);
|
|
612
624
|
try {
|
|
613
|
-
|
|
625
|
+
conditions ??= [];
|
|
626
|
+
conditions.unshift({ property: this._primaryKey?.property, value: id });
|
|
627
|
+
const { sqlCondition, conditionValues } = this.buildConditions(conditions);
|
|
628
|
+
const sql = `DELETE FROM "${this._fullTableName}" WHERE ${sqlCondition}`;
|
|
614
629
|
await this._logging?.log({
|
|
615
630
|
level: "info",
|
|
616
631
|
source: this.CLASS_NAME,
|
|
@@ -619,7 +634,7 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
619
634
|
data: { sql }
|
|
620
635
|
});
|
|
621
636
|
connection = await this.openConnection();
|
|
622
|
-
await this.execute(connection, sql,
|
|
637
|
+
await this.execute(connection, sql, conditionValues);
|
|
623
638
|
}
|
|
624
639
|
catch (error) {
|
|
625
640
|
throw new core.GeneralError(this.CLASS_NAME, "removeFailed", {
|
|
@@ -748,6 +763,23 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
748
763
|
}
|
|
749
764
|
return dbType;
|
|
750
765
|
}
|
|
766
|
+
/**
|
|
767
|
+
* Build the conditions for the query.
|
|
768
|
+
* @param conditions The optional conditions to match for the entities.
|
|
769
|
+
* @returns The SQL conditions and the values.
|
|
770
|
+
*/
|
|
771
|
+
buildConditions(conditions) {
|
|
772
|
+
const conditionValues = [];
|
|
773
|
+
const sqlConditions = [];
|
|
774
|
+
if (core.Is.arrayValue(conditions)) {
|
|
775
|
+
for (const condition of conditions) {
|
|
776
|
+
sqlConditions.push(`"${condition.property}"=?`);
|
|
777
|
+
const schemaProperty = this._entitySchema.properties?.find(s => s.property === condition.property);
|
|
778
|
+
conditionValues.push(this.propertyToDbValue(condition.value, schemaProperty));
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
return { sqlCondition: sqlConditions.join(" AND "), conditionValues };
|
|
782
|
+
}
|
|
751
783
|
}
|
|
752
784
|
|
|
753
785
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -773,10 +805,6 @@ class ScyllaDBViewConnector extends AbstractScyllaDBConnector {
|
|
|
773
805
|
/**
|
|
774
806
|
* Create a new instance of ScyllaDBViewConnector.
|
|
775
807
|
* @param options The options for the connector.
|
|
776
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
777
|
-
* @param options.entitySchema The name of the entity schema.
|
|
778
|
-
* @param options.viewSchema The name of the view schema.
|
|
779
|
-
* @param options.config The configuration for the connector.
|
|
780
808
|
*/
|
|
781
809
|
constructor(options) {
|
|
782
810
|
// We need this conversion so that types can match in the superclass and reuse the get method
|
package/dist/esm/index.mjs
CHANGED
|
@@ -79,9 +79,10 @@ class AbstractScyllaDBConnector {
|
|
|
79
79
|
* Get an entity.
|
|
80
80
|
* @param id The id of the entity to get.
|
|
81
81
|
* @param secondaryIndex Get the item using a secondary index.
|
|
82
|
+
* @param conditions The optional conditions to match for the entities.
|
|
82
83
|
* @returns The object if it can be found or undefined.
|
|
83
84
|
*/
|
|
84
|
-
async get(id, secondaryIndex) {
|
|
85
|
+
async get(id, secondaryIndex, conditions) {
|
|
85
86
|
Guards.stringValue(this.CLASS_NAME, "id", id);
|
|
86
87
|
let connection;
|
|
87
88
|
try {
|
|
@@ -441,9 +442,6 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
441
442
|
/**
|
|
442
443
|
* Create a new instance of ScyllaDBTableConnector.
|
|
443
444
|
* @param options The options for the connector.
|
|
444
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
445
|
-
* @param options.entitySchema The name of the entity schema.
|
|
446
|
-
* @param options.config The configuration for the connector.
|
|
447
445
|
*/
|
|
448
446
|
constructor(options) {
|
|
449
447
|
super(options, "ScyllaDBTableConnector");
|
|
@@ -564,22 +562,36 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
564
562
|
/**
|
|
565
563
|
* Set an entity.
|
|
566
564
|
* @param entity The entity to set.
|
|
565
|
+
* @param conditions The optional conditions to match for the entities.
|
|
567
566
|
*/
|
|
568
|
-
async set(entity) {
|
|
567
|
+
async set(entity, conditions) {
|
|
569
568
|
Guards.object(this.CLASS_NAME, "entity", entity);
|
|
569
|
+
EntitySchemaHelper.validateEntity(entity, this.getSchema());
|
|
570
570
|
let connection;
|
|
571
571
|
const id = entity[this._primaryKey?.property];
|
|
572
572
|
try {
|
|
573
|
-
const propNames = this._entitySchema.properties?.map(f => `"${String(f.property)}"`) ?? [];
|
|
574
573
|
const propValues = [];
|
|
575
|
-
const
|
|
576
|
-
|
|
574
|
+
const updateValues = [];
|
|
575
|
+
conditions ??= [];
|
|
577
576
|
for (const propDesc of this._entitySchema.properties ?? []) {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
577
|
+
if (!propDesc.isPrimary && !propDesc.isSecondary) {
|
|
578
|
+
propValues.push(this.propertyToDbValue(entity[propDesc.property], propDesc));
|
|
579
|
+
updateValues.push(`"${String(propDesc.property)}"=?`);
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
conditions.unshift({
|
|
583
|
+
property: propDesc.property,
|
|
584
|
+
value: this.propertyToDbValue(entity[propDesc.property], propDesc)
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
const { sqlCondition, conditionValues } = this.buildConditions(conditions);
|
|
589
|
+
let conditionString = "";
|
|
590
|
+
if (sqlCondition.length > 0) {
|
|
591
|
+
conditionString = ` WHERE ${sqlCondition}`;
|
|
592
|
+
propValues.push(...conditionValues);
|
|
581
593
|
}
|
|
582
|
-
const sql = `
|
|
594
|
+
const sql = `UPDATE "${this._fullTableName}" SET ${updateValues.join(",")}${conditionString}`;
|
|
583
595
|
await this._logging?.log({
|
|
584
596
|
level: "info",
|
|
585
597
|
source: this.CLASS_NAME,
|
|
@@ -600,15 +612,18 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
600
612
|
}
|
|
601
613
|
}
|
|
602
614
|
/**
|
|
603
|
-
*
|
|
615
|
+
* Remove the entity.
|
|
604
616
|
* @param id The id of the entity to remove.
|
|
617
|
+
* @param conditions The optional conditions to match for the entities.
|
|
605
618
|
*/
|
|
606
|
-
async remove(id) {
|
|
619
|
+
async remove(id, conditions) {
|
|
607
620
|
Guards.stringValue(this.CLASS_NAME, "id", id);
|
|
608
621
|
let connection;
|
|
609
|
-
const primaryFieldValue = this.propertyToDbValue(id, this._primaryKey);
|
|
610
622
|
try {
|
|
611
|
-
|
|
623
|
+
conditions ??= [];
|
|
624
|
+
conditions.unshift({ property: this._primaryKey?.property, value: id });
|
|
625
|
+
const { sqlCondition, conditionValues } = this.buildConditions(conditions);
|
|
626
|
+
const sql = `DELETE FROM "${this._fullTableName}" WHERE ${sqlCondition}`;
|
|
612
627
|
await this._logging?.log({
|
|
613
628
|
level: "info",
|
|
614
629
|
source: this.CLASS_NAME,
|
|
@@ -617,7 +632,7 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
617
632
|
data: { sql }
|
|
618
633
|
});
|
|
619
634
|
connection = await this.openConnection();
|
|
620
|
-
await this.execute(connection, sql,
|
|
635
|
+
await this.execute(connection, sql, conditionValues);
|
|
621
636
|
}
|
|
622
637
|
catch (error) {
|
|
623
638
|
throw new GeneralError(this.CLASS_NAME, "removeFailed", {
|
|
@@ -746,6 +761,23 @@ class ScyllaDBTableConnector extends AbstractScyllaDBConnector {
|
|
|
746
761
|
}
|
|
747
762
|
return dbType;
|
|
748
763
|
}
|
|
764
|
+
/**
|
|
765
|
+
* Build the conditions for the query.
|
|
766
|
+
* @param conditions The optional conditions to match for the entities.
|
|
767
|
+
* @returns The SQL conditions and the values.
|
|
768
|
+
*/
|
|
769
|
+
buildConditions(conditions) {
|
|
770
|
+
const conditionValues = [];
|
|
771
|
+
const sqlConditions = [];
|
|
772
|
+
if (Is.arrayValue(conditions)) {
|
|
773
|
+
for (const condition of conditions) {
|
|
774
|
+
sqlConditions.push(`"${condition.property}"=?`);
|
|
775
|
+
const schemaProperty = this._entitySchema.properties?.find(s => s.property === condition.property);
|
|
776
|
+
conditionValues.push(this.propertyToDbValue(condition.value, schemaProperty));
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return { sqlCondition: sqlConditions.join(" AND "), conditionValues };
|
|
780
|
+
}
|
|
749
781
|
}
|
|
750
782
|
|
|
751
783
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -771,10 +803,6 @@ class ScyllaDBViewConnector extends AbstractScyllaDBConnector {
|
|
|
771
803
|
/**
|
|
772
804
|
* Create a new instance of ScyllaDBViewConnector.
|
|
773
805
|
* @param options The options for the connector.
|
|
774
|
-
* @param options.loggingConnectorType The type of logging connector to use, defaults to "logging".
|
|
775
|
-
* @param options.entitySchema The name of the entity schema.
|
|
776
|
-
* @param options.viewSchema The name of the view schema.
|
|
777
|
-
* @param options.config The configuration for the connector.
|
|
778
806
|
*/
|
|
779
807
|
constructor(options) {
|
|
780
808
|
// We need this conversion so that types can match in the superclass and reuse the get method
|
|
@@ -26,9 +26,13 @@ export declare abstract class AbstractScyllaDBConnector<T> {
|
|
|
26
26
|
* Get an entity.
|
|
27
27
|
* @param id The id of the entity to get.
|
|
28
28
|
* @param secondaryIndex Get the item using a secondary index.
|
|
29
|
+
* @param conditions The optional conditions to match for the entities.
|
|
29
30
|
* @returns The object if it can be found or undefined.
|
|
30
31
|
*/
|
|
31
|
-
get(id: string, secondaryIndex?: keyof T
|
|
32
|
+
get(id: string, secondaryIndex?: keyof T, conditions?: {
|
|
33
|
+
property: keyof T;
|
|
34
|
+
value: unknown;
|
|
35
|
+
}[]): Promise<T | undefined>;
|
|
32
36
|
/**
|
|
33
37
|
* Find all the entities which match the conditions.
|
|
34
38
|
* @param conditions The conditions to match for the entities.
|
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
|
-
* @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
15
|
*/
|
|
19
|
-
constructor(options:
|
|
20
|
-
loggingConnectorType?: string;
|
|
21
|
-
entitySchema: string;
|
|
22
|
-
config: IScyllaDBTableConfig;
|
|
23
|
-
});
|
|
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".
|
|
@@ -30,13 +23,21 @@ export declare class ScyllaDBTableConnector<T = unknown> extends AbstractScyllaD
|
|
|
30
23
|
/**
|
|
31
24
|
* Set an entity.
|
|
32
25
|
* @param entity The entity to set.
|
|
26
|
+
* @param conditions The optional conditions to match for the entities.
|
|
33
27
|
*/
|
|
34
|
-
set(entity: T
|
|
28
|
+
set(entity: T, conditions?: {
|
|
29
|
+
property: keyof T;
|
|
30
|
+
value: unknown;
|
|
31
|
+
}[]): Promise<void>;
|
|
35
32
|
/**
|
|
36
|
-
*
|
|
33
|
+
* Remove the entity.
|
|
37
34
|
* @param id The id of the entity to remove.
|
|
35
|
+
* @param conditions The optional conditions to match for the entities.
|
|
38
36
|
*/
|
|
39
|
-
remove(id: string
|
|
37
|
+
remove(id: string, conditions?: {
|
|
38
|
+
property: keyof T;
|
|
39
|
+
value: unknown;
|
|
40
|
+
}[]): Promise<void>;
|
|
40
41
|
/**
|
|
41
42
|
* Drops table.
|
|
42
43
|
*/
|
|
@@ -45,4 +46,10 @@ export declare class ScyllaDBTableConnector<T = unknown> extends AbstractScyllaD
|
|
|
45
46
|
* Truncates (clear) table.
|
|
46
47
|
*/
|
|
47
48
|
truncateTable(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Build the conditions for the query.
|
|
51
|
+
* @param conditions The optional conditions to match for the entities.
|
|
52
|
+
* @returns The SQL conditions and the values.
|
|
53
|
+
*/
|
|
54
|
+
private buildConditions;
|
|
48
55
|
}
|
|
@@ -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`
|
|
32
|
-
|
|
33
|
-
The type of logging connector to use, defaults to "logging".
|
|
29
|
+
##### options
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
[`IScyllaDBTableConnectorConstructorOptions`](../interfaces/IScyllaDBTableConnectorConstructorOptions.md)
|
|
36
32
|
|
|
37
|
-
The
|
|
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,20 +82,30 @@ 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
|
|
|
103
|
+
##### conditions?
|
|
104
|
+
|
|
105
|
+
`object`[]
|
|
106
|
+
|
|
107
|
+
The optional conditions to match for the entities.
|
|
108
|
+
|
|
107
109
|
#### Returns
|
|
108
110
|
|
|
109
111
|
`Promise`\<`undefined` \| `T`\>
|
|
@@ -122,51 +124,49 @@ The object if it can be found or undefined.
|
|
|
122
124
|
|
|
123
125
|
### query()
|
|
124
126
|
|
|
125
|
-
> **query**(`conditions
|
|
127
|
+
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
126
128
|
|
|
127
129
|
Find all the entities which match the conditions.
|
|
128
130
|
|
|
129
131
|
#### Parameters
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
##### conditions?
|
|
134
|
+
|
|
135
|
+
`EntityCondition`\<`T`\>
|
|
132
136
|
|
|
133
137
|
The conditions to match for the entities.
|
|
134
138
|
|
|
135
|
-
|
|
139
|
+
##### sortProperties?
|
|
140
|
+
|
|
141
|
+
`object`[]
|
|
136
142
|
|
|
137
143
|
The optional sort order.
|
|
138
144
|
|
|
139
|
-
|
|
145
|
+
##### properties?
|
|
146
|
+
|
|
147
|
+
keyof `T`[]
|
|
140
148
|
|
|
141
149
|
The optional properties to return, defaults to all.
|
|
142
150
|
|
|
143
|
-
|
|
151
|
+
##### cursor?
|
|
152
|
+
|
|
153
|
+
`string`
|
|
144
154
|
|
|
145
155
|
The cursor to request the next page of entities.
|
|
146
156
|
|
|
147
|
-
|
|
157
|
+
##### pageSize?
|
|
158
|
+
|
|
159
|
+
`number`
|
|
148
160
|
|
|
149
161
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
150
162
|
|
|
151
163
|
#### Returns
|
|
152
164
|
|
|
153
|
-
`Promise`\<`
|
|
165
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
154
166
|
|
|
155
167
|
All the entities for the storage matching the conditions,
|
|
156
168
|
and a cursor which can be used to request more entities.
|
|
157
169
|
|
|
158
|
-
##### entities
|
|
159
|
-
|
|
160
|
-
> **entities**: `Partial`\<`T`\>[]
|
|
161
|
-
|
|
162
|
-
The entities, which can be partial if a limited keys list was provided.
|
|
163
|
-
|
|
164
|
-
##### cursor?
|
|
165
|
-
|
|
166
|
-
> `optional` **cursor**: `string`
|
|
167
|
-
|
|
168
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
|
169
|
-
|
|
170
170
|
#### Implementation of
|
|
171
171
|
|
|
172
172
|
`IEntityStorageConnector.query`
|
|
@@ -179,13 +179,15 @@ An optional cursor, when defined can be used to call find to get more entities.
|
|
|
179
179
|
|
|
180
180
|
### bootstrap()
|
|
181
181
|
|
|
182
|
-
> **bootstrap**(`nodeLoggingConnectorType
|
|
182
|
+
> **bootstrap**(`nodeLoggingConnectorType?`): `Promise`\<`boolean`\>
|
|
183
183
|
|
|
184
184
|
Bootstrap the component by creating and initializing any resources it needs.
|
|
185
185
|
|
|
186
186
|
#### Parameters
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
##### nodeLoggingConnectorType?
|
|
189
|
+
|
|
190
|
+
`string`
|
|
189
191
|
|
|
190
192
|
The node logging connector type, defaults to "node-logging".
|
|
191
193
|
|
|
@@ -203,16 +205,24 @@ True if the bootstrapping process was successful.
|
|
|
203
205
|
|
|
204
206
|
### set()
|
|
205
207
|
|
|
206
|
-
> **set**(`entity`): `Promise`\<`void`\>
|
|
208
|
+
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
207
209
|
|
|
208
210
|
Set an entity.
|
|
209
211
|
|
|
210
212
|
#### Parameters
|
|
211
213
|
|
|
212
|
-
|
|
214
|
+
##### entity
|
|
215
|
+
|
|
216
|
+
`T`
|
|
213
217
|
|
|
214
218
|
The entity to set.
|
|
215
219
|
|
|
220
|
+
##### conditions?
|
|
221
|
+
|
|
222
|
+
`object`[]
|
|
223
|
+
|
|
224
|
+
The optional conditions to match for the entities.
|
|
225
|
+
|
|
216
226
|
#### Returns
|
|
217
227
|
|
|
218
228
|
`Promise`\<`void`\>
|
|
@@ -225,16 +235,24 @@ The entity to set.
|
|
|
225
235
|
|
|
226
236
|
### remove()
|
|
227
237
|
|
|
228
|
-
> **remove**(`id`): `Promise`\<`void`\>
|
|
238
|
+
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
229
239
|
|
|
230
|
-
|
|
240
|
+
Remove the entity.
|
|
231
241
|
|
|
232
242
|
#### Parameters
|
|
233
243
|
|
|
234
|
-
|
|
244
|
+
##### id
|
|
245
|
+
|
|
246
|
+
`string`
|
|
235
247
|
|
|
236
248
|
The id of the entity to remove.
|
|
237
249
|
|
|
250
|
+
##### conditions?
|
|
251
|
+
|
|
252
|
+
`object`[]
|
|
253
|
+
|
|
254
|
+
The optional conditions to match for the entities.
|
|
255
|
+
|
|
238
256
|
#### Returns
|
|
239
257
|
|
|
240
258
|
`Promise`\<`void`\>
|
|
@@ -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,20 +82,30 @@ 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
|
|
|
103
|
+
##### conditions?
|
|
104
|
+
|
|
105
|
+
`object`[]
|
|
106
|
+
|
|
107
|
+
The optional conditions to match for the entities.
|
|
108
|
+
|
|
111
109
|
#### Returns
|
|
112
110
|
|
|
113
111
|
`Promise`\<`undefined` \| `T`\>
|
|
@@ -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
|
|
|
@@ -213,7 +211,9 @@ 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
|
|
|
@@ -235,7 +235,9 @@ Delete the entity.
|
|
|
235
235
|
|
|
236
236
|
#### Parameters
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
##### id
|
|
239
|
+
|
|
240
|
+
`string`
|
|
239
241
|
|
|
240
242
|
The id of the entity to remove.
|
|
241
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",
|