@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.
Files changed (104) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/docs/assets/highlight.css +7 -0
  3. package/docs/assets/navigation.js +1 -1
  4. package/docs/classes/Application.html +45 -45
  5. package/docs/classes/Command.html +329 -0
  6. package/docs/classes/ConfigLoader.html +3 -3
  7. package/docs/classes/Database.html +2 -2
  8. package/docs/classes/DatabaseCastObject.html +2 -2
  9. package/docs/classes/DatabaseConnection.html +21 -21
  10. package/docs/classes/DatabaseQueryError.html +8 -8
  11. package/docs/classes/DeadLockError.html +8 -8
  12. package/docs/classes/DiskSpaceError.html +7 -7
  13. package/docs/classes/DropTemporaryTableQuery.html +7 -7
  14. package/docs/classes/DuplicateEntryError.html +7 -7
  15. package/docs/classes/EntityNotFoundError.html +7 -7
  16. package/docs/classes/ExpiredTokenError.html +7 -7
  17. package/docs/classes/Handler.html +2 -2
  18. package/docs/classes/IllegalStateError.html +7 -7
  19. package/docs/classes/InternalError.html +7 -7
  20. package/docs/classes/InvalidCredentialsError.html +7 -7
  21. package/docs/classes/InvalidValueError.html +7 -7
  22. package/docs/classes/LineString.html +2 -2
  23. package/docs/classes/LockWaitTimeoutError.html +8 -8
  24. package/docs/classes/ManagedDatabaseConnection.html +5 -5
  25. package/docs/classes/Middleware.html +2 -2
  26. package/docs/classes/MissingConfigError.html +7 -7
  27. package/docs/classes/MissingParameterError.html +7 -7
  28. package/docs/classes/MySQLConnection.html +25 -25
  29. package/docs/classes/MySQLDatabase.html +2 -2
  30. package/docs/classes/NotImplementedError.html +7 -7
  31. package/docs/classes/Point.html +2 -2
  32. package/docs/classes/Polygon.html +2 -2
  33. package/docs/classes/Query.html +7 -7
  34. package/docs/classes/RawError.html +7 -7
  35. package/docs/classes/RawQuery.html +7 -7
  36. package/docs/classes/Request.html +3 -3
  37. package/docs/classes/Response.html +2 -2
  38. package/docs/classes/ResponseData.html +3 -3
  39. package/docs/classes/ServiceProvider.html +2 -2
  40. package/docs/classes/ServiceResponse.html +2 -2
  41. package/docs/classes/SetSessionVariableQuery.html +7 -7
  42. package/docs/classes/StormError.html +7 -7
  43. package/docs/classes/TemporaryTableQuery.html +7 -7
  44. package/docs/classes/TimeoutError.html +7 -7
  45. package/docs/classes/Token.html +2 -2
  46. package/docs/classes/TokenManager.html +2 -2
  47. package/docs/classes/Transaction.html +2 -2
  48. package/docs/classes/UnauthorizedAccessError.html +7 -7
  49. package/docs/enums/ErrorCode.html +2 -2
  50. package/docs/enums/ExitCode.html +2 -2
  51. package/docs/enums/HTTPMethod.html +2 -2
  52. package/docs/enums/IsolationLevel.html +2 -2
  53. package/docs/enums/JWTError.html +2 -2
  54. package/docs/enums/StatusCode.html +2 -2
  55. package/docs/enums/TransactionAccessLevel.html +2 -2
  56. package/docs/functions/getInstance.html +1 -1
  57. package/docs/index.html +1 -1
  58. package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
  59. package/docs/interfaces/ICloudwatchConfig.html +2 -2
  60. package/docs/interfaces/ICloudwatchCredentials.html +2 -2
  61. package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
  62. package/docs/interfaces/IConfig.html +2 -2
  63. package/docs/interfaces/IDatabaseConfig.html +2 -2
  64. package/docs/interfaces/IDatabaseConnection.html +5 -5
  65. package/docs/interfaces/IDatabasePosition.html +2 -2
  66. package/docs/interfaces/IErrorResponse.html +2 -2
  67. package/docs/interfaces/IFormData.html +2 -2
  68. package/docs/interfaces/IInsertQueryResult.html +2 -2
  69. package/docs/interfaces/IJWTVerifyOptions.html +2 -2
  70. package/docs/interfaces/IOKPacket.html +2 -2
  71. package/docs/interfaces/IParameterMap.html +1 -1
  72. package/docs/interfaces/IQueryable.html +2 -2
  73. package/docs/interfaces/IRequestResponse.html +2 -2
  74. package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
  75. package/docs/interfaces/IStormCLIArgs.html +2 -2
  76. package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
  77. package/docs/interfaces/IUpdateQueryResult.html +2 -2
  78. package/docs/interfaces/formidable.Part.html +16 -16
  79. package/docs/types/IDeleteQueryResult.html +1 -1
  80. package/docs/types/IStoredProcedureResult.html +1 -1
  81. package/docs/types/TCoordinate.html +1 -1
  82. package/docs/types/TExpiresIn.html +1 -1
  83. package/docs/types/TSerializableResponse.html +1 -1
  84. package/docs/types/TSupportedResponsePrimitives.html +1 -1
  85. package/docs/types/TSupportedResponseTypes.html +1 -1
  86. package/lib/DatabaseCastObject.js +1 -1
  87. package/lib/DatabaseCastObject.js.map +1 -1
  88. package/lib/MySQLConnection.d.ts +1 -1
  89. package/lib/MySQLConnection.js +3 -3
  90. package/lib/MySQLConnection.js.map +1 -1
  91. package/lib/MySQLDatabase.d.ts +3 -3
  92. package/lib/MySQLDatabase.js +3 -11
  93. package/lib/MySQLDatabase.js.map +1 -1
  94. package/lib/api.d.ts +1 -0
  95. package/lib/api.js +3 -1
  96. package/lib/api.js.map +1 -1
  97. package/lib/mysql/queryFormatter.js +1 -1
  98. package/lib/mysql/queryFormatter.js.map +1 -1
  99. package/package.json +12 -13
  100. package/src/DatabaseCastObject.ts +1 -1
  101. package/src/MySQLConnection.ts +5 -5
  102. package/src/MySQLDatabase.ts +6 -15
  103. package/src/api.ts +2 -0
  104. package/src/mysql/queryFormatter.ts +1 -1
@@ -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 'mysql';
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().config.queryFormat(query.getQuery(this), query.getParametersForQuery());
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.MysqlError, results: any) => {
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.
@@ -16,7 +16,7 @@
16
16
 
17
17
  import {Database} from './Database';
18
18
  import {MySQLConnection} from './MySQLConnection';
19
- import * as MySQL from 'mysql';
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.PoolConfig, MySQL.PoolConnection> {
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.PoolConfig): void {
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
- return new Promise<void>((resolve, reject) => {
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.MysqlError, connection: MySQL.PoolConnection) => {
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
@@ -114,3 +114,5 @@ export {Polygon} from './Polygon';
114
114
  // Third-party
115
115
  import * as formidable from 'formidable';
116
116
  export {formidable};
117
+
118
+ export {Command} from 'commander';
@@ -1,5 +1,5 @@
1
1
 
2
- import * as MySQL from 'mysql';
2
+ import * as MySQL from 'mysql2';
3
3
 
4
4
  export function queryFormatter(query: string, values: any): string {
5
5
  if (!values) return query;