@breautek/storm 9.0.5 → 9.0.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/CHANGELOG.md +7 -0
- package/docs/classes/Application.html +45 -45
- package/docs/classes/ConfigLoader.html +3 -3
- package/docs/classes/Database.html +2 -2
- package/docs/classes/DatabaseCastObject.html +2 -2
- package/docs/classes/DatabaseConnection.html +21 -21
- package/docs/classes/DatabaseQueryError.html +8 -8
- package/docs/classes/DeadLockError.html +8 -8
- package/docs/classes/DiskSpaceError.html +7 -7
- package/docs/classes/DropTemporaryTableQuery.html +7 -7
- package/docs/classes/DuplicateEntryError.html +7 -7
- package/docs/classes/EntityNotFoundError.html +7 -7
- package/docs/classes/ExpiredTokenError.html +7 -7
- package/docs/classes/Handler.html +2 -2
- package/docs/classes/InternalError.html +7 -7
- package/docs/classes/InvalidCredentialsError.html +7 -7
- package/docs/classes/InvalidValueError.html +7 -7
- package/docs/classes/LineString.html +2 -2
- package/docs/classes/LockWaitTimeoutError.html +8 -8
- package/docs/classes/ManagedDatabaseConnection.html +5 -5
- package/docs/classes/Middleware.html +2 -2
- package/docs/classes/MissingConfigError.html +7 -7
- package/docs/classes/MissingParameterError.html +7 -7
- package/docs/classes/MySQLConnection.html +25 -25
- package/docs/classes/MySQLDatabase.html +2 -2
- package/docs/classes/NotImplementedError.html +7 -7
- package/docs/classes/Point.html +2 -2
- package/docs/classes/Polygon.html +2 -2
- package/docs/classes/Query.html +7 -7
- package/docs/classes/RawError.html +7 -7
- package/docs/classes/RawQuery.html +7 -7
- package/docs/classes/Request.html +3 -3
- package/docs/classes/Response.html +2 -2
- package/docs/classes/ResponseData.html +3 -3
- package/docs/classes/ServiceProvider.html +2 -2
- package/docs/classes/ServiceResponse.html +2 -2
- package/docs/classes/SetSessionVariableQuery.html +7 -7
- package/docs/classes/StormError.html +7 -7
- package/docs/classes/TemporaryTableQuery.html +7 -7
- package/docs/classes/TimeoutError.html +7 -7
- package/docs/classes/Token.html +2 -2
- package/docs/classes/TokenManager.html +2 -2
- package/docs/classes/Transaction.html +2 -2
- package/docs/classes/UnauthorizedAccessError.html +7 -7
- package/docs/enums/ErrorCode.html +2 -2
- package/docs/enums/ExitCode.html +2 -2
- package/docs/enums/HTTPMethod.html +2 -2
- package/docs/enums/IsolationLevel.html +2 -2
- package/docs/enums/JWTError.html +2 -2
- package/docs/enums/StatusCode.html +2 -2
- package/docs/enums/TransactionAccessLevel.html +2 -2
- package/docs/functions/getInstance.html +1 -1
- package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
- package/docs/interfaces/IAuthTokenData.html +2 -2
- package/docs/interfaces/ICloudwatchConfig.html +2 -2
- package/docs/interfaces/ICloudwatchCredentials.html +2 -2
- package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
- package/docs/interfaces/IConfig.html +2 -2
- package/docs/interfaces/IDatabaseConfig.html +2 -2
- package/docs/interfaces/IDatabaseConnection.html +5 -5
- package/docs/interfaces/IDatabasePosition.html +2 -2
- package/docs/interfaces/IErrorResponse.html +2 -2
- package/docs/interfaces/IFormData.html +2 -2
- package/docs/interfaces/IInsertQueryResult.html +2 -2
- package/docs/interfaces/IJWTVerifyOptions.html +2 -2
- package/docs/interfaces/IOKPacket.html +2 -2
- package/docs/interfaces/IParameterMap.html +1 -1
- package/docs/interfaces/IQueryable.html +2 -2
- package/docs/interfaces/IRequestResponse.html +2 -2
- package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
- package/docs/interfaces/IStormCLIArgs.html +2 -2
- package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
- package/docs/interfaces/IUpdateQueryResult.html +2 -2
- package/docs/interfaces/formidable.EmitData.html +2 -2
- package/docs/interfaces/formidable.EventData.html +2 -2
- package/docs/interfaces/formidable.File.html +9 -9
- package/docs/interfaces/formidable.FileJSON.html +7 -7
- package/docs/interfaces/formidable.Options.html +16 -16
- package/docs/interfaces/formidable.Part.html +17 -17
- package/docs/types/IDeleteQueryResult.html +1 -1
- package/docs/types/IStoredProcedureResult.html +1 -1
- package/docs/types/TCoordinate.html +1 -1
- package/docs/types/TSerializableResponse.html +1 -1
- package/docs/types/TSupportedResponsePrimitives.html +1 -1
- package/docs/types/TSupportedResponseTypes.html +1 -1
- package/docs/types/formidable.BufferEncoding.html +1 -1
- package/docs/types/formidable.DefaultOptions.html +1 -1
- package/docs/types/formidable.EnabledPlugins.html +1 -1
- package/docs/types/formidable.EventNames.html +1 -1
- package/docs/types/formidable.Fields.html +1 -1
- package/docs/types/formidable.Files.html +1 -1
- package/docs/types/formidable.MappedParsers.html +1 -1
- package/docs/types/formidable.Plugin.html +1 -1
- package/docs/types/formidable.PluginFunction.html +1 -1
- package/docs/types/formidable.Plugins.html +1 -1
- package/docs/variables/formidable.html +1 -1
- package/lib/MySQLDatabase.js +5 -1
- package/lib/MySQLDatabase.js.map +1 -1
- package/lib/private/ConnectionReplicationWaiter.js +3 -5
- package/lib/private/ConnectionReplicationWaiter.js.map +1 -1
- package/lib/private/GetSlavePositionQuery.d.ts +2 -2
- package/lib/private/GetSlavePositionQuery.js +3 -3
- package/lib/private/GetSlavePositionQuery.js.map +1 -1
- package/package.json +4 -4
- package/pnpm-workspace.yaml +6 -0
- package/src/MySQLDatabase.ts +8 -1
- package/src/private/ConnectionReplicationWaiter.ts +3 -5
- package/src/private/GetSlavePositionQuery.ts +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breautek/storm",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.6",
|
|
4
4
|
"description": "Object-Oriented REST API framework",
|
|
5
5
|
"main": "lib/api.js",
|
|
6
6
|
"types": "lib/api.d.ts",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"@types/formidable": "3.4.5",
|
|
52
52
|
"@types/jsonwebtoken": "9.0.10",
|
|
53
53
|
"@types/mysql": "2.15.27",
|
|
54
|
-
"@types/node": "24.0.
|
|
54
|
+
"@types/node": "24.0.14",
|
|
55
55
|
"@types/uuid": "10.0.0",
|
|
56
56
|
"ajv": "8.17.1",
|
|
57
57
|
"body-parser": "2.2.0",
|
|
58
58
|
"commander": "14.0.0",
|
|
59
59
|
"express": "5.1.0",
|
|
60
|
-
"form-data": "4.0.
|
|
60
|
+
"form-data": "4.0.4",
|
|
61
61
|
"formidable": "3.5.4",
|
|
62
62
|
"jsonwebtoken": "9.0.2",
|
|
63
63
|
"mysql": "2.18.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@arashi/interfaces": "1.2.1",
|
|
74
74
|
"@arashi/logger": "4.1.3",
|
|
75
|
-
"@totalpave/eslint-plugin": "7.0.
|
|
75
|
+
"@totalpave/eslint-plugin": "7.0.13",
|
|
76
76
|
"@types/jest": "30.0.0",
|
|
77
77
|
"@types/ms": "2.1.0",
|
|
78
78
|
"auto-changelog": "2.5.0",
|
package/src/MySQLDatabase.ts
CHANGED
|
@@ -20,6 +20,7 @@ import * as MySQL from 'mysql';
|
|
|
20
20
|
import {getInstance} from './instance';
|
|
21
21
|
import { IDatabasePosition } from './IDatabasePosition';
|
|
22
22
|
import { ConnectionReplicationWaiter } from './private/ConnectionReplicationWaiter';
|
|
23
|
+
import { ILogger } from '@arashi/interfaces';
|
|
23
24
|
|
|
24
25
|
const TAG: string = 'MySQLDatabase';
|
|
25
26
|
|
|
@@ -83,13 +84,19 @@ export class MySQLDatabase extends Database<MySQL.PoolConfig, MySQL.PoolConnecti
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
protected override async _getConnection(query: string, requireWriteAccess: boolean, position?: IDatabasePosition): Promise<MySQLConnection> {
|
|
86
|
-
getInstance().getLogger()
|
|
87
|
+
let logger: ILogger = getInstance().getLogger();
|
|
88
|
+
logger.trace(TAG, `Querying connection pool for "${query}".`);
|
|
87
89
|
let instantationStack: string = new Error().stack;
|
|
88
90
|
|
|
89
91
|
let conn: MySQLConnection = await this.$getConnectionFromPool(query, requireWriteAccess, instantationStack);
|
|
90
92
|
await conn.__internal_init();
|
|
91
93
|
|
|
94
|
+
logger.trace(TAG, `Replication Enabled: ${conn.hasReplicationEnabled() ? 'true' : 'false'}`);
|
|
95
|
+
logger.trace(TAG, `Connection Replicating: ${conn.isReplication() ? 'true' : 'false'}`);
|
|
96
|
+
|
|
97
|
+
|
|
92
98
|
if (conn.hasReplicationEnabled() && conn.isReplication() && position && position.page && position.position) {
|
|
99
|
+
logger.trace(TAG, 'Connection is waiting on Replication');
|
|
93
100
|
// master connections will not wait on database positions
|
|
94
101
|
// they are guarenteed to be at the tip.
|
|
95
102
|
// readonly, or otherwise known as replication connections
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
import { IDatabaseConnection } from '../IDatabaseConnection';
|
|
19
19
|
import { IDatabasePosition } from '../IDatabasePosition';
|
|
20
|
-
import { InternalError } from '../InternalError';
|
|
21
20
|
import { TimeoutError } from '../TimeoutError';
|
|
22
21
|
|
|
23
22
|
export class ConnectionReplicationWaiter {
|
|
@@ -74,10 +73,9 @@ export class ConnectionReplicationWaiter {
|
|
|
74
73
|
|
|
75
74
|
let currentPos: IDatabasePosition = await this.$conn.getCurrentDatabasePosition();
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
throw new InternalError('Database Position not supported');
|
|
76
|
+
if (!currentPos) {
|
|
77
|
+
// Replication not supported... just continue
|
|
78
|
+
break;
|
|
81
79
|
}
|
|
82
80
|
|
|
83
81
|
// If the current page is greater than the target page,
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
import { GetBinLogPositionQuery } from './GetBinLogPositionQuery';
|
|
18
18
|
|
|
19
19
|
interface IStatus {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
Relay_Source_Log_File: string;
|
|
21
|
+
Exec_Source_Log_Pos: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export class GetSlavePositionQuery extends GetBinLogPositionQuery<IStatus> {
|
|
25
25
|
|
|
26
26
|
protected override _getQuery(): string {
|
|
27
|
-
return 'SHOW
|
|
27
|
+
return 'SHOW REPLICA STATUS';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
protected override _getFile(row: IStatus): string {
|
|
31
|
-
return row.
|
|
31
|
+
return row.Relay_Source_Log_File;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
protected override _getPosition(row: IStatus): string {
|
|
35
|
-
return row.
|
|
35
|
+
return row.Exec_Source_Log_Pos;
|
|
36
36
|
}
|
|
37
37
|
}
|