@breautek/storm 9.0.5 → 9.0.7
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 +13 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- 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/hierarchy.html +1 -1
- package/docs/index.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/TExpiresIn.html +1 -0
- 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/TokenManager.d.ts +2 -1
- package/lib/TokenManager.js +0 -1
- package/lib/TokenManager.js.map +1 -1
- package/lib/api.d.ts +1 -1
- package/lib/api.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 +5 -4
- package/pnpm-workspace.yaml +6 -0
- package/src/MySQLDatabase.ts +8 -1
- package/src/TokenManager.ts +3 -1
- package/src/api.ts +1 -1
- package/src/private/ConnectionReplicationWaiter.ts +3 -5
- package/src/private/GetSlavePositionQuery.ts +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionReplicationWaiter.js","sourceRoot":"","sources":["../../src/private/ConnectionReplicationWaiter.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;EAcE;;;AAIF,
|
|
1
|
+
{"version":3,"file":"ConnectionReplicationWaiter.js","sourceRoot":"","sources":["../../src/private/ConnectionReplicationWaiter.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;EAcE;;;AAIF,kDAA+C;AAE/C,MAAa,2BAA2B;IAqBpC,YAAmB,IAAyB,EAAE,aAAqB,2BAA2B,CAAC,mBAAmB;QAC9G,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAEO,MAAM,CAAC,OAAe;QAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,UAAU,CAAC,GAAG,EAAE;gBACZ,OAAO,EAAE,CAAC;YACd,CAAC,EAAE,OAAO,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAAyB,EAAE,UAAkB,2BAA2B,CAAC,eAAe;QACtG,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;YACxB,OAAO;QACX,CAAC;QAED,IAAI,aAAa,GAAY,KAAK,CAAC;QACnC,IAAI,UAAU,GAAY,KAAK,CAAC;QAEhC,IAAI,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,aAAa,GAAG,IAAI,CAAC;QACzB,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,OAAO,IAAI,EAAE,CAAC;YACV,IAAI,aAAa,EAAE,CAAC;gBAChB,UAAU,GAAG,IAAI,CAAC;gBAClB,MAAM;YACV,CAAC;YAED,IAAI,UAAU,GAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,0BAA0B,EAAE,CAAC;YAElF,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,6CAA6C;gBAC7C,MAAM;YACV,CAAC;YAED,uDAAuD;YACvD,wDAAwD;YACxD,2BAA2B;YAC3B,IAAI,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;gBAChC,MAAM;YACV,CAAC;YAED,wDAAwD;YACxD,mDAAmD;YACnD,IAAI,UAAU,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC5E,MAAM;YACV,CAAC;YAED,gEAAgE;YAChE,4CAA4C;YAC5C,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACb,+CAA+C;YAC/C,6BAA6B;YAC7B,MAAM,IAAI,2BAAY,EAAE,CAAC;QAC7B,CAAC;QAED,+BAA+B;QAC/B,YAAY,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC;;AArFL,kEAsFC;AArFG;;;;;GAKG;AACoB,+CAAmB,GAAW,IAAI,CAAC;AAE1D;;;;;;GAMG;AACoB,2CAAe,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,oBAAoB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GetBinLogPositionQuery } from './GetBinLogPositionQuery';
|
|
2
2
|
interface IStatus {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Relay_Source_Log_File: string;
|
|
4
|
+
Exec_Source_Log_Pos: string;
|
|
5
5
|
}
|
|
6
6
|
export declare class GetSlavePositionQuery extends GetBinLogPositionQuery<IStatus> {
|
|
7
7
|
protected _getQuery(): string;
|
|
@@ -19,13 +19,13 @@ exports.GetSlavePositionQuery = void 0;
|
|
|
19
19
|
const GetBinLogPositionQuery_1 = require("./GetBinLogPositionQuery");
|
|
20
20
|
class GetSlavePositionQuery extends GetBinLogPositionQuery_1.GetBinLogPositionQuery {
|
|
21
21
|
_getQuery() {
|
|
22
|
-
return 'SHOW
|
|
22
|
+
return 'SHOW REPLICA STATUS';
|
|
23
23
|
}
|
|
24
24
|
_getFile(row) {
|
|
25
|
-
return row.
|
|
25
|
+
return row.Relay_Source_Log_File;
|
|
26
26
|
}
|
|
27
27
|
_getPosition(row) {
|
|
28
|
-
return row.
|
|
28
|
+
return row.Exec_Source_Log_Pos;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.GetSlavePositionQuery = GetSlavePositionQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetSlavePositionQuery.js","sourceRoot":"","sources":["../../src/private/GetSlavePositionQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,qEAAkE;AAOlE,MAAa,qBAAsB,SAAQ,+CAA+B;IAEnD,SAAS;QACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"GetSlavePositionQuery.js","sourceRoot":"","sources":["../../src/private/GetSlavePositionQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,qEAAkE;AAOlE,MAAa,qBAAsB,SAAQ,+CAA+B;IAEnD,SAAS;QACxB,OAAO,qBAAqB,CAAC;IACjC,CAAC;IAEkB,QAAQ,CAAC,GAAY;QACpC,OAAO,GAAG,CAAC,qBAAqB,CAAC;IACrC,CAAC;IAEkB,YAAY,CAAC,GAAY;QACxC,OAAO,GAAG,CAAC,mBAAmB,CAAC;IACnC,CAAC;CACJ;AAbD,sDAaC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breautek/storm",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.7",
|
|
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,8 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@arashi/interfaces": "1.2.1",
|
|
74
74
|
"@arashi/logger": "4.1.3",
|
|
75
|
-
"@
|
|
75
|
+
"@jest/types": "30.0.5",
|
|
76
|
+
"@totalpave/eslint-plugin": "7.0.13",
|
|
76
77
|
"@types/jest": "30.0.0",
|
|
77
78
|
"@types/ms": "2.1.0",
|
|
78
79
|
"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
|
package/src/TokenManager.ts
CHANGED
|
@@ -24,6 +24,8 @@ import { StringValue } from 'ms';
|
|
|
24
24
|
|
|
25
25
|
// const TAG: string = 'TokenManager';
|
|
26
26
|
|
|
27
|
+
export type TExpiresIn = StringValue | number;
|
|
28
|
+
|
|
27
29
|
export class TokenManager<TAuthToken extends IAuthTokenData = IAuthTokenData> {
|
|
28
30
|
private $secret: string;
|
|
29
31
|
|
|
@@ -31,7 +33,7 @@ export class TokenManager<TAuthToken extends IAuthTokenData = IAuthTokenData> {
|
|
|
31
33
|
this.$secret = secret;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
public sign(payload: {[key: string]: any}, expiresIn:
|
|
36
|
+
public sign(payload: {[key: string]: any}, expiresIn: TExpiresIn): Promise<Token> {
|
|
35
37
|
return new Promise<Token>((resolve, reject) => {
|
|
36
38
|
randomBytes(64, (err: Error, buffer: Buffer) => {
|
|
37
39
|
if (err) {
|
package/src/api.ts
CHANGED
|
@@ -98,7 +98,7 @@ export {IDatabasePosition} from './IDatabasePosition';
|
|
|
98
98
|
|
|
99
99
|
// Token
|
|
100
100
|
export {Token} from './Token';
|
|
101
|
-
export {TokenManager} from './TokenManager';
|
|
101
|
+
export {TokenManager, TExpiresIn} from './TokenManager';
|
|
102
102
|
|
|
103
103
|
// Utils
|
|
104
104
|
export {ExitCode} from './ExitCode';
|
|
@@ -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
|
}
|