@breautek/storm 9.0.7 → 9.1.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 (105) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/docs/assets/hierarchy.js +1 -1
  3. package/docs/assets/navigation.js +1 -1
  4. package/docs/assets/search.js +1 -1
  5. package/docs/classes/Application.html +45 -45
  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 +46 -0
  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/hierarchy.html +1 -1
  58. package/docs/index.html +1 -1
  59. package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
  60. package/docs/interfaces/ICloudwatchConfig.html +2 -2
  61. package/docs/interfaces/ICloudwatchCredentials.html +2 -2
  62. package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
  63. package/docs/interfaces/IConfig.html +2 -2
  64. package/docs/interfaces/IDatabaseConfig.html +2 -2
  65. package/docs/interfaces/IDatabaseConnection.html +5 -5
  66. package/docs/interfaces/IDatabasePosition.html +2 -2
  67. package/docs/interfaces/IErrorResponse.html +2 -2
  68. package/docs/interfaces/IFormData.html +2 -2
  69. package/docs/interfaces/IInsertQueryResult.html +2 -2
  70. package/docs/interfaces/IJWTVerifyOptions.html +2 -2
  71. package/docs/interfaces/IOKPacket.html +2 -2
  72. package/docs/interfaces/IParameterMap.html +1 -1
  73. package/docs/interfaces/IQueryable.html +2 -2
  74. package/docs/interfaces/IRequestResponse.html +2 -2
  75. package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
  76. package/docs/interfaces/IStormCLIArgs.html +2 -2
  77. package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
  78. package/docs/interfaces/IUpdateQueryResult.html +2 -2
  79. package/docs/interfaces/formidable.FileJSON.html +7 -7
  80. package/docs/interfaces/formidable.Part.html +17 -17
  81. package/docs/types/IDeleteQueryResult.html +1 -1
  82. package/docs/types/IStoredProcedureResult.html +1 -1
  83. package/docs/types/TCoordinate.html +1 -1
  84. package/docs/types/TExpiresIn.html +1 -1
  85. package/docs/types/TSerializableResponse.html +1 -1
  86. package/docs/types/TSupportedResponsePrimitives.html +1 -1
  87. package/docs/types/TSupportedResponseTypes.html +1 -1
  88. package/lib/Application.js +4 -4
  89. package/lib/Application.js.map +1 -1
  90. package/lib/IllegalStateError.d.ts +15 -0
  91. package/lib/IllegalStateError.js +34 -0
  92. package/lib/IllegalStateError.js.map +1 -0
  93. package/lib/ManagedDatabaseConnection.js +3 -3
  94. package/lib/ManagedDatabaseConnection.js.map +1 -1
  95. package/lib/MySQLDatabase.js +1 -1
  96. package/lib/MySQLDatabase.js.map +1 -1
  97. package/lib/api.d.ts +1 -0
  98. package/lib/api.js +4 -2
  99. package/lib/api.js.map +1 -1
  100. package/package.json +7 -7
  101. package/src/Application.ts +4 -4
  102. package/src/IllegalStateError.ts +36 -0
  103. package/src/ManagedDatabaseConnection.ts +3 -3
  104. package/src/MySQLDatabase.ts +1 -1
  105. package/src/api.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breautek/storm",
3
- "version": "9.0.7",
3
+ "version": "9.1.0",
4
4
  "description": "Object-Oriented REST API framework",
5
5
  "main": "lib/api.js",
6
6
  "types": "lib/api.d.ts",
@@ -51,7 +51,7 @@
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.14",
54
+ "@types/node": "24.1.0",
55
55
  "@types/uuid": "10.0.0",
56
56
  "ajv": "8.17.1",
57
57
  "body-parser": "2.2.0",
@@ -73,16 +73,16 @@
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
+ "@totalpave/eslint-plugin": "7.0.15",
77
77
  "@types/jest": "30.0.0",
78
78
  "@types/ms": "2.1.0",
79
79
  "auto-changelog": "2.5.0",
80
- "jest": "30.0.4",
81
- "jest-jasmine2": "30.0.4",
80
+ "jest": "30.0.5",
81
+ "jest-jasmine2": "30.0.5",
82
82
  "ts-jest": "29.4.0",
83
83
  "ts-node": "10.9.2",
84
- "typedoc": "0.28.7",
85
- "typedoc-plugin-markdown": "4.7.0",
84
+ "typedoc": "0.28.8",
85
+ "typedoc-plugin-markdown": "4.8.0",
86
86
  "typescript": "5.8.3"
87
87
  }
88
88
  }
@@ -359,19 +359,19 @@ export abstract class Application
359
359
  public attachHandlerInstance(path: string, handler: Handler): void {
360
360
  this.$server.get(path, (request: Express.Request, response: Express.Response) => {
361
361
  let r: Request = new Request(request);
362
- handler.get(r, new Response(this, response, r.getURL()));
362
+ void handler.get(r, new Response(this, response, r.getURL()));
363
363
  });
364
364
  this.$server.post(path, (request: Express.Request, response: Express.Response) => {
365
365
  let r: Request = new Request(request);
366
- handler.post(r, new Response(this, response, r.getURL()));
366
+ void handler.post(r, new Response(this, response, r.getURL()));
367
367
  });
368
368
  this.$server.put(path, (request: Express.Request, response: Express.Response) => {
369
369
  let r: Request = new Request(request);
370
- handler.put(r, new Response(this, response, r.getURL()));
370
+ void handler.put(r, new Response(this, response, r.getURL()));
371
371
  });
372
372
  this.$server.delete(path, (request: Express.Request, response: Express.Response) => {
373
373
  let r: Request = new Request(request);
374
- handler.delete(r, new Response(this, response, r.getURL()));
374
+ void handler.delete(r, new Response(this, response, r.getURL()));
375
375
  });
376
376
  }
377
377
 
@@ -0,0 +1,36 @@
1
+
2
+ import { StatusCode } from './StatusCode';
3
+ import { StormError } from './StormError';
4
+
5
+ /**
6
+ * @since 9.1.0
7
+ *
8
+ * An error that describes an illegal state
9
+ */
10
+ export class IllegalStateError extends StormError<string> {
11
+ public constructor(message: string) {
12
+ super(message);
13
+ }
14
+
15
+ public override getMessage(): string {
16
+ return this.getPrivateDetails();
17
+ }
18
+
19
+ public override getHTTPCode(): StatusCode {
20
+ return StatusCode.ERR_BAD_REQUEST;
21
+ }
22
+
23
+ public override getCode(): number {
24
+ return 0;
25
+ }
26
+
27
+ public override getLocaleCode(): string {
28
+ return '@breautek/storm/IllegalStateError/message';
29
+ }
30
+
31
+ public override getLocaleParameters(): Record<string, string> {
32
+ return {
33
+ message: this.getMessage()
34
+ };
35
+ }
36
+ }
@@ -76,14 +76,14 @@ export class ManagedDatabaseConnection implements IDatabaseConnection {
76
76
  getInstance().getLogger().warn(TAG, 'Rolling back a transaction because setConnection was called on a ManagedDatabaseConnection in a transaction in progress.');
77
77
  getInstance().getLogger().trace(TAG, new Error('Stacktrace'));
78
78
  oldConnection.rollback().then(() => {
79
- oldConnection.close();
79
+ return oldConnection.close();
80
80
  }).catch((error: any) => {
81
81
  getInstance().getLogger().error(TAG, error);
82
- oldConnection.close(true);
82
+ void oldConnection.close(true);
83
83
  });
84
84
  }
85
85
  else {
86
- oldConnection.close();
86
+ void oldConnection.close();
87
87
  }
88
88
  }
89
89
 
@@ -107,7 +107,7 @@ export class MySQLDatabase extends Database<MySQL.PoolConfig, MySQL.PoolConnecti
107
107
  await waiter.wait(position);
108
108
  }
109
109
  catch (ex) {
110
- conn.close(true);
110
+ void conn.close(true);
111
111
  throw ex;
112
112
  }
113
113
  }
package/src/api.ts CHANGED
@@ -68,6 +68,7 @@ export {DatabaseQueryError} from './DatabaseQueryError';
68
68
  export {NotImplementedError} from './NotImplementedError';
69
69
  export {DeadLockError} from './DeadLockError';
70
70
  export {LockWaitTimeoutError} from './LockWaitTimeoutError';
71
+ export {IllegalStateError} from './IllegalStateError';
71
72
 
72
73
  // HTTP
73
74
  export {StatusCode} from './StatusCode';