@twin.org/entity-storage-connector-cosmosdb 0.0.2-next.5 → 0.0.2-next.6
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 +13 -17
- package/dist/esm/index.mjs +14 -18
- package/dist/types/cosmosDbEntityStorageConnector.d.ts +2 -2
- package/dist/types/models/ICosmosDbEntityStorageConnectorConstructorOptions.d.ts +2 -2
- package/docs/changelog.md +16 -0
- package/docs/reference/classes/CosmosDbEntityStorageConnector.md +3 -3
- package/docs/reference/interfaces/ICosmosDbEntityStorageConnectorConstructorOptions.md +3 -3
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var cosmos = require('@azure/cosmos');
|
|
4
4
|
var core = require('@twin.org/core');
|
|
5
5
|
var entity = require('@twin.org/entity');
|
|
6
|
-
var loggingModels = require('@twin.org/logging-models');
|
|
7
6
|
|
|
8
7
|
// Copyright 2024 IOTA Stiftung.
|
|
9
8
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -86,11 +85,11 @@ class CosmosDbEntityStorageConnector {
|
|
|
86
85
|
}
|
|
87
86
|
/**
|
|
88
87
|
* Initialize the Cosmos DB environment.
|
|
89
|
-
* @param
|
|
88
|
+
* @param nodeLoggingComponentType Optional type of the logging component.
|
|
90
89
|
* @returns A promise that resolves to a boolean indicating success.
|
|
91
90
|
*/
|
|
92
|
-
async bootstrap(
|
|
93
|
-
const nodeLogging =
|
|
91
|
+
async bootstrap(nodeLoggingComponentType) {
|
|
92
|
+
const nodeLogging = core.ComponentFactory.getIfExists(nodeLoggingComponentType ?? "logging");
|
|
94
93
|
// Create the database if it does not exist
|
|
95
94
|
try {
|
|
96
95
|
await nodeLogging?.log({
|
|
@@ -129,19 +128,16 @@ class CosmosDbEntityStorageConnector {
|
|
|
129
128
|
});
|
|
130
129
|
}
|
|
131
130
|
else {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
131
|
+
await nodeLogging?.log({
|
|
132
|
+
level: "error",
|
|
133
|
+
source: this.CLASS_NAME,
|
|
134
|
+
ts: Date.now(),
|
|
135
|
+
message: "databaseCreateFailed",
|
|
136
|
+
error: core.BaseError.fromError(error),
|
|
137
|
+
data: {
|
|
138
|
+
databaseId: this._config.databaseId
|
|
139
|
+
}
|
|
140
|
+
});
|
|
145
141
|
return false;
|
|
146
142
|
}
|
|
147
143
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CosmosClient, CosmosDbDiagnosticLevel, PartitionKeyKind } from '@azure/cosmos';
|
|
2
|
-
import { Guards, BaseError, Is, GeneralError, Coerce, ObjectHelper } from '@twin.org/core';
|
|
2
|
+
import { Guards, ComponentFactory, BaseError, Is, GeneralError, Coerce, ObjectHelper } from '@twin.org/core';
|
|
3
3
|
import { EntitySchemaFactory, EntitySchemaHelper, SortDirection, ComparisonOperator, LogicalOperator } from '@twin.org/entity';
|
|
4
|
-
import { LoggingConnectorFactory } from '@twin.org/logging-models';
|
|
5
4
|
|
|
6
5
|
// Copyright 2024 IOTA Stiftung.
|
|
7
6
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -84,11 +83,11 @@ class CosmosDbEntityStorageConnector {
|
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* Initialize the Cosmos DB environment.
|
|
87
|
-
* @param
|
|
86
|
+
* @param nodeLoggingComponentType Optional type of the logging component.
|
|
88
87
|
* @returns A promise that resolves to a boolean indicating success.
|
|
89
88
|
*/
|
|
90
|
-
async bootstrap(
|
|
91
|
-
const nodeLogging =
|
|
89
|
+
async bootstrap(nodeLoggingComponentType) {
|
|
90
|
+
const nodeLogging = ComponentFactory.getIfExists(nodeLoggingComponentType ?? "logging");
|
|
92
91
|
// Create the database if it does not exist
|
|
93
92
|
try {
|
|
94
93
|
await nodeLogging?.log({
|
|
@@ -127,19 +126,16 @@ class CosmosDbEntityStorageConnector {
|
|
|
127
126
|
});
|
|
128
127
|
}
|
|
129
128
|
else {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
129
|
+
await nodeLogging?.log({
|
|
130
|
+
level: "error",
|
|
131
|
+
source: this.CLASS_NAME,
|
|
132
|
+
ts: Date.now(),
|
|
133
|
+
message: "databaseCreateFailed",
|
|
134
|
+
error: BaseError.fromError(error),
|
|
135
|
+
data: {
|
|
136
|
+
databaseId: this._config.databaseId
|
|
137
|
+
}
|
|
138
|
+
});
|
|
143
139
|
return false;
|
|
144
140
|
}
|
|
145
141
|
}
|
|
@@ -16,10 +16,10 @@ export declare class CosmosDbEntityStorageConnector<T = unknown> implements IEnt
|
|
|
16
16
|
constructor(options: ICosmosDbEntityStorageConnectorConstructorOptions);
|
|
17
17
|
/**
|
|
18
18
|
* Initialize the Cosmos DB environment.
|
|
19
|
-
* @param
|
|
19
|
+
* @param nodeLoggingComponentType Optional type of the logging component.
|
|
20
20
|
* @returns A promise that resolves to a boolean indicating success.
|
|
21
21
|
*/
|
|
22
|
-
bootstrap(
|
|
22
|
+
bootstrap(nodeLoggingComponentType?: string): Promise<boolean>;
|
|
23
23
|
/**
|
|
24
24
|
* Get the schema for the entities.
|
|
25
25
|
* @returns The schema for the entities.
|
|
@@ -8,10 +8,10 @@ export interface ICosmosDbEntityStorageConnectorConstructorOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
entitySchema: string;
|
|
10
10
|
/**
|
|
11
|
-
* The type of logging
|
|
11
|
+
* The type of logging component to use.
|
|
12
12
|
* @default logging
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
loggingComponentType?: string;
|
|
15
15
|
/**
|
|
16
16
|
* The configuration for the connector.
|
|
17
17
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @twin.org/entity-storage-connector-cosmosdb - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.6](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-cosmosdb-v0.0.2-next.5...entity-storage-connector-cosmosdb-v0.0.2-next.6) (2025-08-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update framework core ([b59a380](https://github.com/twinfoundation/entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/entity-storage-models bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
18
|
+
|
|
3
19
|
## [0.0.2-next.5](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-cosmosdb-v0.0.2-next.4...entity-storage-connector-cosmosdb-v0.0.2-next.5) (2025-08-11)
|
|
4
20
|
|
|
5
21
|
|
|
@@ -48,17 +48,17 @@ Runtime name for the class.
|
|
|
48
48
|
|
|
49
49
|
### bootstrap()
|
|
50
50
|
|
|
51
|
-
> **bootstrap**(`
|
|
51
|
+
> **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
52
52
|
|
|
53
53
|
Initialize the Cosmos DB environment.
|
|
54
54
|
|
|
55
55
|
#### Parameters
|
|
56
56
|
|
|
57
|
-
#####
|
|
57
|
+
##### nodeLoggingComponentType?
|
|
58
58
|
|
|
59
59
|
`string`
|
|
60
60
|
|
|
61
|
-
Optional type of the logging
|
|
61
|
+
Optional type of the logging component.
|
|
62
62
|
|
|
63
63
|
#### Returns
|
|
64
64
|
|
|
@@ -12,11 +12,11 @@ The schema for the entity.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### loggingComponentType?
|
|
16
16
|
|
|
17
|
-
> `optional` **
|
|
17
|
+
> `optional` **loggingComponentType**: `string`
|
|
18
18
|
|
|
19
|
-
The type of logging
|
|
19
|
+
The type of logging component to use.
|
|
20
20
|
|
|
21
21
|
#### Default
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-cosmosdb",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.6",
|
|
4
4
|
"description": "Entity Storage connector implementation using CosmosDB storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@azure/cosmos": "4.
|
|
18
|
-
"@azure/identity": "4.
|
|
17
|
+
"@azure/cosmos": "4.5.0",
|
|
18
|
+
"@azure/identity": "4.11.1",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/entity": "next",
|
|
21
|
-
"@twin.org/entity-storage-models": "0.0.2-next.
|
|
21
|
+
"@twin.org/entity-storage-models": "0.0.2-next.6",
|
|
22
22
|
"@twin.org/logging-models": "next",
|
|
23
23
|
"@twin.org/nameof": "next"
|
|
24
24
|
},
|