@breautek/storm 9.1.0 → 9.2.0-beta.0
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/assets/highlight.css +7 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/classes/Application.html +45 -45
- package/docs/classes/Command.html +329 -0
- 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/IllegalStateError.html +7 -7
- 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/index.html +1 -1
- package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
- 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.Part.html +16 -16
- 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 -1
- package/docs/types/TSerializableResponse.html +1 -1
- package/docs/types/TSupportedResponsePrimitives.html +1 -1
- package/docs/types/TSupportedResponseTypes.html +1 -1
- package/lib/DatabaseCastObject.js +1 -1
- package/lib/DatabaseCastObject.js.map +1 -1
- package/lib/MySQLConnection.d.ts +1 -1
- package/lib/MySQLConnection.js +3 -3
- package/lib/MySQLConnection.js.map +1 -1
- package/lib/MySQLDatabase.d.ts +3 -3
- package/lib/MySQLDatabase.js +3 -11
- package/lib/MySQLDatabase.js.map +1 -1
- package/lib/api.d.ts +1 -0
- package/lib/api.js +3 -1
- package/lib/api.js.map +1 -1
- package/lib/mysql/queryFormatter.js +1 -1
- package/lib/mysql/queryFormatter.js.map +1 -1
- package/package.json +12 -13
- package/src/DatabaseCastObject.ts +1 -1
- package/src/MySQLConnection.ts +5 -5
- package/src/MySQLDatabase.ts +6 -15
- package/src/api.ts +2 -0
- package/src/mysql/queryFormatter.ts +1 -1
package/src/MySQLConnection.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import {DatabaseConnection} from './DatabaseConnection';
|
|
18
18
|
import {DatabaseQueryError} from './DatabaseQueryError';
|
|
19
19
|
import {getInstance} from './instance';
|
|
20
|
-
import * as MySQL from '
|
|
20
|
+
import * as MySQL from 'mysql2';
|
|
21
21
|
import {Readable} from 'stream';
|
|
22
22
|
import { StartTransactionQuery } from './private/StartTransactionQuery';
|
|
23
23
|
import { CommitQuery } from './private/CommitQuery';
|
|
@@ -35,7 +35,6 @@ import { GetBinLogPositionQuery } from './private/GetBinLogPositionQuery';
|
|
|
35
35
|
import { GetSlavePositionQuery } from './private/GetSlavePositionQuery';
|
|
36
36
|
import { GetMasterPositionQuery } from './private/GetMasterPositionQuery';
|
|
37
37
|
import { IQueryable } from './IQueryable';
|
|
38
|
-
import { queryFormatter } from './mysql/queryFormatter';
|
|
39
38
|
import { TransactionAccessLevel } from './TransactionAccessLevel';
|
|
40
39
|
import { GetProcessList, IGetProcessListOutput } from './private/GetProcessList';
|
|
41
40
|
|
|
@@ -67,6 +66,7 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
67
66
|
private $isMasterConnection: boolean;
|
|
68
67
|
|
|
69
68
|
public constructor(connection: MySQL.PoolConnection, instantiationStack: string, isReadOnly: boolean = true) {
|
|
69
|
+
connection.config.namedPlaceholders = true;
|
|
70
70
|
super(connection, isReadOnly, instantiationStack);
|
|
71
71
|
|
|
72
72
|
this.$hasReplicationEnabled = false;
|
|
@@ -74,7 +74,7 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
74
74
|
this.$transaction = false;
|
|
75
75
|
this.$isMasterConnection = null;
|
|
76
76
|
|
|
77
|
-
connection.config.queryFormat = queryFormatter.bind(this);
|
|
77
|
+
// connection.config.queryFormat = queryFormatter.bind(this);
|
|
78
78
|
|
|
79
79
|
// connection.config.queryFormat = function(query: string, values: any) {
|
|
80
80
|
// if (!values) return query;
|
|
@@ -114,7 +114,7 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
public override formatQuery(query: IQueryable<any>): string {
|
|
117
|
-
return this.getAPI().
|
|
117
|
+
return this.getAPI().format(query.getQuery(this), query.getParametersForQuery());
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
@@ -158,7 +158,7 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
158
158
|
let queryObject: MySQL.Query = this.getAPI().query({
|
|
159
159
|
sql: query,
|
|
160
160
|
timeout: this.getTimeout()
|
|
161
|
-
}, params, (error: MySQL.
|
|
161
|
+
}, params, (error: MySQL.QueryError, results: any) => {
|
|
162
162
|
if (error) {
|
|
163
163
|
let sql: string = queryObject.sql;
|
|
164
164
|
// Formatting queries can be an expensive task, so only do it if the log level is actually silly.
|
package/src/MySQLDatabase.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import {Database} from './Database';
|
|
18
18
|
import {MySQLConnection} from './MySQLConnection';
|
|
19
|
-
import * as MySQL from '
|
|
19
|
+
import * as MySQL from 'mysql2';
|
|
20
20
|
import {getInstance} from './instance';
|
|
21
21
|
import { IDatabasePosition } from './IDatabasePosition';
|
|
22
22
|
import { ConnectionReplicationWaiter } from './private/ConnectionReplicationWaiter';
|
|
@@ -24,7 +24,7 @@ import { ILogger } from '@arashi/interfaces';
|
|
|
24
24
|
|
|
25
25
|
const TAG: string = 'MySQLDatabase';
|
|
26
26
|
|
|
27
|
-
export class MySQLDatabase extends Database<MySQL.
|
|
27
|
+
export class MySQLDatabase extends Database<MySQL.PoolOptions, MySQL.PoolConnection> {
|
|
28
28
|
private $cluster: MySQL.PoolCluster;
|
|
29
29
|
|
|
30
30
|
constructor() {
|
|
@@ -47,7 +47,7 @@ export class MySQLDatabase extends Database<MySQL.PoolConfig, MySQL.PoolConnecti
|
|
|
47
47
|
return MySQL.escape(value);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
protected _addNode(nodeID: string, config: MySQL.
|
|
50
|
+
protected _addNode(nodeID: string, config: MySQL.PoolOptions): void {
|
|
51
51
|
getInstance().getLogger().trace(TAG, `Adding node to connection pool: "${nodeID}"`);
|
|
52
52
|
this.$cluster.add(nodeID, config);
|
|
53
53
|
}
|
|
@@ -57,22 +57,13 @@ export class MySQLDatabase extends Database<MySQL.PoolConfig, MySQL.PoolConnecti
|
|
|
57
57
|
this.$cluster.remove(nodeID);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
protected _destroy(): Promise<void> {
|
|
61
|
-
|
|
62
|
-
this.$cluster.end((err: MySQL.MysqlError) => {
|
|
63
|
-
if (err) {
|
|
64
|
-
reject(err);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
resolve();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
60
|
+
protected async _destroy(): Promise<void> {
|
|
61
|
+
this.$cluster.end();
|
|
71
62
|
}
|
|
72
63
|
|
|
73
64
|
private $getConnectionFromPool(query: string, requireWriteAccess: boolean, instantationStack: string): Promise<MySQLConnection> {
|
|
74
65
|
return new Promise<MySQLConnection>((resolve, reject) => {
|
|
75
|
-
this.$cluster.getConnection(query, (error: MySQL.
|
|
66
|
+
this.$cluster.getConnection(query, (error: MySQL.QueryError, connection: MySQL.PoolConnection) => {
|
|
76
67
|
if (error) {
|
|
77
68
|
reject(error);
|
|
78
69
|
return;
|
package/src/api.ts
CHANGED