@twin.org/entity-storage-connector-mongodb 0.0.2-next.4 → 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/models/IMongoDbEntityStorageConnectorConstructorOptions.d.ts +2 -2
- package/dist/types/mongoDbEntityStorageConnector.d.ts +2 -2
- package/docs/changelog.md +32 -0
- package/docs/reference/classes/MongoDbEntityStorageConnector.md +3 -3
- package/docs/reference/interfaces/IMongoDbEntityStorageConnectorConstructorOptions.md +3 -3
- package/package.json +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@twin.org/core');
|
|
4
4
|
var entity = require('@twin.org/entity');
|
|
5
|
-
var loggingModels = require('@twin.org/logging-models');
|
|
6
5
|
var mongodb = require('mongodb');
|
|
7
6
|
|
|
8
7
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -52,11 +51,11 @@ class MongoDbEntityStorageConnector {
|
|
|
52
51
|
}
|
|
53
52
|
/**
|
|
54
53
|
* Initialize the MongoDb environment.
|
|
55
|
-
* @param
|
|
54
|
+
* @param nodeLoggingComponentType Optional type of the logging component.
|
|
56
55
|
* @returns A promise that resolves to a boolean indicating success.
|
|
57
56
|
*/
|
|
58
|
-
async bootstrap(
|
|
59
|
-
const nodeLogging =
|
|
57
|
+
async bootstrap(nodeLoggingComponentType) {
|
|
58
|
+
const nodeLogging = core.ComponentFactory.getIfExists(nodeLoggingComponentType ?? "logging");
|
|
60
59
|
try {
|
|
61
60
|
await this._client.connect();
|
|
62
61
|
await nodeLogging?.log({
|
|
@@ -91,19 +90,16 @@ class MongoDbEntityStorageConnector {
|
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
catch (error) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
93
|
+
await nodeLogging?.log({
|
|
94
|
+
level: "error",
|
|
95
|
+
source: this.CLASS_NAME,
|
|
96
|
+
ts: Date.now(),
|
|
97
|
+
message: "databaseCreateFailed",
|
|
98
|
+
error: core.BaseError.fromError(error),
|
|
99
|
+
data: {
|
|
100
|
+
database: this._config.database
|
|
101
|
+
}
|
|
102
|
+
});
|
|
107
103
|
return false;
|
|
108
104
|
}
|
|
109
105
|
return true;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Guards, BaseError, Is, GeneralError } from '@twin.org/core';
|
|
1
|
+
import { Guards, ComponentFactory, BaseError, Is, GeneralError } from '@twin.org/core';
|
|
2
2
|
import { EntitySchemaFactory, EntitySchemaHelper, LogicalOperator, ComparisonOperator } from '@twin.org/entity';
|
|
3
|
-
import { LoggingConnectorFactory } from '@twin.org/logging-models';
|
|
4
3
|
import { MongoClient } from 'mongodb';
|
|
5
4
|
|
|
6
5
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -50,11 +49,11 @@ class MongoDbEntityStorageConnector {
|
|
|
50
49
|
}
|
|
51
50
|
/**
|
|
52
51
|
* Initialize the MongoDb environment.
|
|
53
|
-
* @param
|
|
52
|
+
* @param nodeLoggingComponentType Optional type of the logging component.
|
|
54
53
|
* @returns A promise that resolves to a boolean indicating success.
|
|
55
54
|
*/
|
|
56
|
-
async bootstrap(
|
|
57
|
-
const nodeLogging =
|
|
55
|
+
async bootstrap(nodeLoggingComponentType) {
|
|
56
|
+
const nodeLogging = ComponentFactory.getIfExists(nodeLoggingComponentType ?? "logging");
|
|
58
57
|
try {
|
|
59
58
|
await this._client.connect();
|
|
60
59
|
await nodeLogging?.log({
|
|
@@ -89,19 +88,16 @@ class MongoDbEntityStorageConnector {
|
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
90
|
catch (error) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
91
|
+
await nodeLogging?.log({
|
|
92
|
+
level: "error",
|
|
93
|
+
source: this.CLASS_NAME,
|
|
94
|
+
ts: Date.now(),
|
|
95
|
+
message: "databaseCreateFailed",
|
|
96
|
+
error: BaseError.fromError(error),
|
|
97
|
+
data: {
|
|
98
|
+
database: this._config.database
|
|
99
|
+
}
|
|
100
|
+
});
|
|
105
101
|
return false;
|
|
106
102
|
}
|
|
107
103
|
return true;
|
|
@@ -8,10 +8,10 @@ export interface IMongoDbEntityStorageConnectorConstructorOptions {
|
|
|
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
|
*/
|
|
@@ -16,10 +16,10 @@ export declare class MongoDbEntityStorageConnector<T = unknown> implements IEnti
|
|
|
16
16
|
constructor(options: IMongoDbEntityStorageConnectorConstructorOptions);
|
|
17
17
|
/**
|
|
18
18
|
* Initialize the MongoDb 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.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @twin.org/entity-storage-connector-mongodb - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.6](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-mongodb-v0.0.2-next.5...entity-storage-connector-mongodb-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
|
+
|
|
19
|
+
## [0.0.2-next.5](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-mongodb-v0.0.2-next.4...entity-storage-connector-mongodb-v0.0.2-next.5) (2025-08-11)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Miscellaneous Chores
|
|
23
|
+
|
|
24
|
+
* **entity-storage-connector-mongodb:** Synchronize repo versions
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Dependencies
|
|
28
|
+
|
|
29
|
+
* The following workspace dependencies were updated
|
|
30
|
+
* dependencies
|
|
31
|
+
* @twin.org/entity-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
32
|
+
* devDependencies
|
|
33
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
34
|
+
|
|
3
35
|
## [0.0.2-next.4](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-mongodb-v0.0.2-next.3...entity-storage-connector-mongodb-v0.0.2-next.4) (2025-08-08)
|
|
4
36
|
|
|
5
37
|
|
|
@@ -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 MongoDb 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-mongodb",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.6",
|
|
4
4
|
"description": "Entity Storage connector implementation using MongoDb storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/core": "next",
|
|
18
18
|
"@twin.org/entity": "next",
|
|
19
|
-
"@twin.org/entity-storage-models": "0.0.2-next.
|
|
19
|
+
"@twin.org/entity-storage-models": "0.0.2-next.6",
|
|
20
20
|
"@twin.org/logging-models": "next",
|
|
21
21
|
"@twin.org/nameof": "next",
|
|
22
|
-
"mongodb": "6.
|
|
22
|
+
"mongodb": "6.18.0"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|
|
25
25
|
"module": "./dist/esm/index.mjs",
|