@twin.org/entity-storage-connector-mysql 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.
@@ -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 promise = require('mysql2/promise');
7
6
 
8
7
  // Copyright 2024 IOTA Stiftung.
@@ -53,11 +52,11 @@ class MySqlEntityStorageConnector {
53
52
  }
54
53
  /**
55
54
  * Initialize the MySql environment.
56
- * @param nodeLoggingConnectorType Optional type of the logging connector.
55
+ * @param nodeLoggingComponentType Optional type of the logging component.
57
56
  * @returns A promise that resolves to a boolean indicating success.
58
57
  */
59
- async bootstrap(nodeLoggingConnectorType) {
60
- const nodeLogging = loggingModels.LoggingConnectorFactory.getIfExists(nodeLoggingConnectorType ?? "node-logging");
58
+ async bootstrap(nodeLoggingComponentType) {
59
+ const nodeLogging = core.ComponentFactory.getIfExists(nodeLoggingComponentType ?? "logging");
61
60
  try {
62
61
  const dbConnection = await this.createConnection();
63
62
  await nodeLogging?.log({
@@ -92,19 +91,16 @@ class MySqlEntityStorageConnector {
92
91
  });
93
92
  }
94
93
  catch (error) {
95
- const errors = error instanceof AggregateError ? error.errors : [error];
96
- for (const err of errors) {
97
- await nodeLogging?.log({
98
- level: "error",
99
- source: this.CLASS_NAME,
100
- ts: Date.now(),
101
- message: "databaseCreateFailed",
102
- error: core.BaseError.fromError(err),
103
- data: {
104
- database: this._config.database
105
- }
106
- });
107
- }
94
+ await nodeLogging?.log({
95
+ level: "error",
96
+ source: this.CLASS_NAME,
97
+ ts: Date.now(),
98
+ message: "databaseCreateFailed",
99
+ error: core.BaseError.fromError(error),
100
+ data: {
101
+ database: this._config.database
102
+ }
103
+ });
108
104
  return false;
109
105
  }
110
106
  return true;
@@ -1,6 +1,5 @@
1
- import { Guards, BaseError, GeneralError, Is, ObjectHelper } from '@twin.org/core';
1
+ import { Guards, ComponentFactory, BaseError, GeneralError, Is, ObjectHelper } from '@twin.org/core';
2
2
  import { EntitySchemaFactory, EntitySchemaHelper, EntitySchemaPropertyType, SortDirection, ComparisonOperator, LogicalOperator } from '@twin.org/entity';
3
- import { LoggingConnectorFactory } from '@twin.org/logging-models';
4
3
  import { createConnection } from 'mysql2/promise';
5
4
 
6
5
  // Copyright 2024 IOTA Stiftung.
@@ -51,11 +50,11 @@ class MySqlEntityStorageConnector {
51
50
  }
52
51
  /**
53
52
  * Initialize the MySql environment.
54
- * @param nodeLoggingConnectorType Optional type of the logging connector.
53
+ * @param nodeLoggingComponentType Optional type of the logging component.
55
54
  * @returns A promise that resolves to a boolean indicating success.
56
55
  */
57
- async bootstrap(nodeLoggingConnectorType) {
58
- const nodeLogging = LoggingConnectorFactory.getIfExists(nodeLoggingConnectorType ?? "node-logging");
56
+ async bootstrap(nodeLoggingComponentType) {
57
+ const nodeLogging = ComponentFactory.getIfExists(nodeLoggingComponentType ?? "logging");
59
58
  try {
60
59
  const dbConnection = await this.createConnection();
61
60
  await nodeLogging?.log({
@@ -90,19 +89,16 @@ class MySqlEntityStorageConnector {
90
89
  });
91
90
  }
92
91
  catch (error) {
93
- const errors = error instanceof AggregateError ? error.errors : [error];
94
- for (const err of errors) {
95
- await nodeLogging?.log({
96
- level: "error",
97
- source: this.CLASS_NAME,
98
- ts: Date.now(),
99
- message: "databaseCreateFailed",
100
- error: BaseError.fromError(err),
101
- data: {
102
- database: this._config.database
103
- }
104
- });
105
- }
92
+ await nodeLogging?.log({
93
+ level: "error",
94
+ source: this.CLASS_NAME,
95
+ ts: Date.now(),
96
+ message: "databaseCreateFailed",
97
+ error: BaseError.fromError(error),
98
+ data: {
99
+ database: this._config.database
100
+ }
101
+ });
106
102
  return false;
107
103
  }
108
104
  return true;
@@ -8,10 +8,10 @@ export interface IMySqlEntityStorageConnectorConstructorOptions {
8
8
  */
9
9
  entitySchema: string;
10
10
  /**
11
- * The type of logging connector to use.
11
+ * The type of logging component to use.
12
12
  * @default logging
13
13
  */
14
- loggingConnectorType?: string;
14
+ loggingComponentType?: string;
15
15
  /**
16
16
  * The configuration for the connector.
17
17
  */
@@ -16,10 +16,10 @@ export declare class MySqlEntityStorageConnector<T = unknown> implements IEntity
16
16
  constructor(options: IMySqlEntityStorageConnectorConstructorOptions);
17
17
  /**
18
18
  * Initialize the MySql environment.
19
- * @param nodeLoggingConnectorType Optional type of the logging connector.
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(nodeLoggingConnectorType?: string): Promise<boolean>;
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,21 @@
1
1
  # @twin.org/entity-storage-connector-mysql - Changelog
2
2
 
3
+ ## [0.0.2-next.6](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-mysql-v0.0.2-next.5...entity-storage-connector-mysql-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-mysql-v0.0.2-next.4...entity-storage-connector-mysql-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**(`nodeLoggingConnectorType?`): `Promise`\<`boolean`\>
51
+ > **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
52
52
 
53
53
  Initialize the MySql environment.
54
54
 
55
55
  #### Parameters
56
56
 
57
- ##### nodeLoggingConnectorType?
57
+ ##### nodeLoggingComponentType?
58
58
 
59
59
  `string`
60
60
 
61
- Optional type of the logging connector.
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
- ### loggingConnectorType?
15
+ ### loggingComponentType?
16
16
 
17
- > `optional` **loggingConnectorType**: `string`
17
+ > `optional` **loggingComponentType**: `string`
18
18
 
19
- The type of logging connector to use.
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-mysql",
3
- "version": "0.0.2-next.5",
3
+ "version": "0.0.2-next.6",
4
4
  "description": "Entity Storage connector implementation using MySQL storage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,10 +17,10 @@
17
17
  "@twin.org/core": "next",
18
18
  "@twin.org/data-json-ld": "next",
19
19
  "@twin.org/entity": "next",
20
- "@twin.org/entity-storage-models": "0.0.2-next.5",
20
+ "@twin.org/entity-storage-models": "0.0.2-next.6",
21
21
  "@twin.org/logging-models": "next",
22
22
  "@twin.org/nameof": "next",
23
- "mysql2": "3.14.2"
23
+ "mysql2": "3.14.3"
24
24
  },
25
25
  "main": "./dist/cjs/index.cjs",
26
26
  "module": "./dist/esm/index.mjs",