@breautek/storm 5.0.1 → 6.0.1

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 (204) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/bt-config-defaults.json +0 -1
  3. package/bt-config-sample.jsonc +41 -7
  4. package/docs/assets/highlight.css +92 -0
  5. package/docs/assets/main.js +58 -0
  6. package/docs/assets/search.js +1 -0
  7. package/docs/assets/style.css +1367 -0
  8. package/docs/classes/Application.html +1278 -0
  9. package/docs/classes/BackendAuthenticationMiddleware.html +193 -0
  10. package/docs/classes/CORSMiddleware.html +259 -0
  11. package/docs/classes/ConfigLoader.html +168 -0
  12. package/docs/classes/Database.html +342 -0
  13. package/docs/classes/DatabaseCastObject.html +205 -0
  14. package/docs/classes/DatabaseConnection.html +552 -0
  15. package/docs/classes/DatabaseQueryError.html +374 -0
  16. package/docs/classes/DeadLockError.html +374 -0
  17. package/docs/classes/DiskSpaceError.html +364 -0
  18. package/docs/classes/DropTemporaryTableQuery.html +287 -0
  19. package/docs/classes/DuplicateEntryError.html +368 -0
  20. package/docs/classes/EntityNotFoundError.html +364 -0
  21. package/docs/classes/ExpiredTokenError.html +364 -0
  22. package/docs/classes/Handler.html +397 -0
  23. package/docs/classes/InternalError.html +364 -0
  24. package/docs/classes/InvalidCredentialsError.html +364 -0
  25. package/docs/classes/InvalidValueError.html +375 -0
  26. package/docs/classes/LineString.html +214 -0
  27. package/docs/classes/LockWaitTimeoutError.html +374 -0
  28. package/docs/classes/ManagedDatabaseConnection.html +412 -0
  29. package/docs/classes/Middleware.html +204 -0
  30. package/docs/classes/MissingConfigError.html +364 -0
  31. package/docs/classes/MissingParameterError.html +364 -0
  32. package/docs/classes/MySQLConnection.html +548 -0
  33. package/docs/classes/MySQLDatabase.html +355 -0
  34. package/docs/classes/NotImplementedError.html +364 -0
  35. package/docs/classes/Point.html +216 -0
  36. package/docs/classes/Polygon.html +214 -0
  37. package/docs/classes/Query.html +314 -0
  38. package/docs/classes/RawError.html +376 -0
  39. package/docs/classes/RawQuery.html +307 -0
  40. package/docs/classes/Request.html +377 -0
  41. package/docs/classes/Response.html +331 -0
  42. package/docs/classes/ResponseData.html +257 -0
  43. package/docs/classes/ServiceProvider.html +387 -0
  44. package/docs/classes/ServiceResponse.html +215 -0
  45. package/docs/classes/SetSessionVariableQuery.html +287 -0
  46. package/docs/classes/StormError.html +379 -0
  47. package/docs/classes/TemporaryTableQuery.html +292 -0
  48. package/docs/classes/Token.html +183 -0
  49. package/docs/classes/TokenManager.html +235 -0
  50. package/docs/classes/Transaction.html +269 -0
  51. package/docs/classes/UnauthorizedAccessError.html +364 -0
  52. package/docs/enums/ErrorCode.html +212 -0
  53. package/docs/enums/ExitCode.html +163 -0
  54. package/docs/enums/HTTPMethod.html +177 -0
  55. package/docs/enums/IsolationLevel.html +177 -0
  56. package/docs/enums/JWTError.html +163 -0
  57. package/docs/enums/StatusCode.html +485 -0
  58. package/docs/functions/formidable-1.html +145 -0
  59. package/docs/functions/getInstance.html +140 -0
  60. package/docs/index.html +228 -0
  61. package/docs/interfaces/IAdditionalErrorDetails.html +142 -0
  62. package/docs/interfaces/IAuthTokenData.html +174 -0
  63. package/docs/interfaces/ICloudwatchConfig.html +174 -0
  64. package/docs/interfaces/ICloudwatchCredentials.html +167 -0
  65. package/docs/interfaces/ICloudwatchStreamConfig.html +167 -0
  66. package/docs/interfaces/IConfig.html +227 -0
  67. package/docs/interfaces/IDatabaseConfig.html +200 -0
  68. package/docs/interfaces/IDatabaseConnection.html +334 -0
  69. package/docs/interfaces/IErrorResponse.html +188 -0
  70. package/docs/interfaces/IFormData.html +167 -0
  71. package/docs/interfaces/IHandler.html +173 -0
  72. package/docs/interfaces/IInsertQueryResult.html +174 -0
  73. package/docs/interfaces/IJWTVerifyOptions.html +160 -0
  74. package/docs/interfaces/IParameterMap.html +142 -0
  75. package/docs/interfaces/IQueryable.html +235 -0
  76. package/docs/interfaces/IRequestResponse.html +174 -0
  77. package/docs/interfaces/IServiceHeaders.html +142 -0
  78. package/docs/interfaces/ISetSessionVariableQueryInput.html +167 -0
  79. package/docs/interfaces/ITemporaryTableQueryInput.html +167 -0
  80. package/docs/interfaces/IUpdateQueryResult.html +167 -0
  81. package/docs/interfaces/formidable.EmitData.html +182 -0
  82. package/docs/interfaces/formidable.EventData.html +203 -0
  83. package/docs/interfaces/formidable.Fields.html +143 -0
  84. package/docs/interfaces/formidable.File.html +241 -0
  85. package/docs/interfaces/formidable.FileJSON.html +240 -0
  86. package/docs/interfaces/formidable.Files.html +143 -0
  87. package/docs/interfaces/formidable.Options.html +310 -0
  88. package/docs/interfaces/formidable.Part.html +693 -0
  89. package/docs/modules/formidable.html +161 -0
  90. package/docs/types/IDeleteQueryResult.html +136 -0
  91. package/docs/types/IHandlerError.html +141 -0
  92. package/docs/types/IHandlerResponse.html +147 -0
  93. package/docs/types/TCoordinate.html +136 -0
  94. package/docs/types/formidable.BufferEncoding.html +137 -0
  95. package/docs/types/formidable.DefaultOptions.html +137 -0
  96. package/docs/types/formidable.EnabledPlugins.html +137 -0
  97. package/docs/types/formidable.EventNames.html +137 -0
  98. package/docs/types/formidable.MappedParsers.html +137 -0
  99. package/docs/types/formidable.Plugin.html +137 -0
  100. package/docs/types/formidable.PluginFunction.html +152 -0
  101. package/docs/types/formidable.Plugins.html +137 -0
  102. package/lib/Application.d.ts +3 -0
  103. package/lib/Application.js +105 -63
  104. package/lib/Application.js.map +1 -1
  105. package/lib/IConfig.d.ts +15 -2
  106. package/lib/MySQLConnection.js +3 -3
  107. package/lib/MySQLConnection.js.map +1 -1
  108. package/lib/StatusCode.d.ts +1 -1
  109. package/lib/StatusCode.js +1 -1
  110. package/lib/Transaction.d.ts +4 -0
  111. package/lib/Transaction.js +4 -0
  112. package/lib/Transaction.js.map +1 -1
  113. package/lib/api.d.ts +1 -2
  114. package/lib/api.js +2 -4
  115. package/lib/api.js.map +1 -1
  116. package/package.json +18 -16
  117. package/src/Application.ts +131 -68
  118. package/src/IConfig.ts +18 -2
  119. package/src/MySQLConnection.ts +2 -1
  120. package/src/StatusCode.ts +1 -1
  121. package/src/Transaction.ts +4 -0
  122. package/src/api.ts +6 -2
  123. package/docs/README.md +0 -188
  124. package/docs/classes/Application.md +0 -1648
  125. package/docs/classes/BackendAuthenticationMiddleware.md +0 -49
  126. package/docs/classes/CORSMiddleware.md +0 -143
  127. package/docs/classes/ConfigLoader.md +0 -29
  128. package/docs/classes/Database.md +0 -259
  129. package/docs/classes/DatabaseCastObject.md +0 -79
  130. package/docs/classes/DatabaseConnection.md +0 -556
  131. package/docs/classes/DatabaseQueryError.md +0 -351
  132. package/docs/classes/DeadLockError.md +0 -349
  133. package/docs/classes/DiskSpaceError.md +0 -341
  134. package/docs/classes/DropTemporaryTableQuery.md +0 -207
  135. package/docs/classes/DumpStream.md +0 -23
  136. package/docs/classes/DuplicateEntryError.md +0 -343
  137. package/docs/classes/EntityNotFoundError.md +0 -341
  138. package/docs/classes/ExpiredTokenError.md +0 -341
  139. package/docs/classes/Handler.md +0 -302
  140. package/docs/classes/InternalError.md +0 -341
  141. package/docs/classes/InvalidCredentialsError.md +0 -341
  142. package/docs/classes/InvalidValueError.md +0 -349
  143. package/docs/classes/LineString.md +0 -101
  144. package/docs/classes/LockWaitTimeoutError.md +0 -349
  145. package/docs/classes/ManagedDatabaseConnection.md +0 -403
  146. package/docs/classes/Middleware.md +0 -72
  147. package/docs/classes/MissingConfigError.md +0 -341
  148. package/docs/classes/MissingParameterError.md +0 -341
  149. package/docs/classes/MySQLConnection.md +0 -569
  150. package/docs/classes/MySQLDatabase.md +0 -314
  151. package/docs/classes/NotImplementedError.md +0 -341
  152. package/docs/classes/Point.md +0 -102
  153. package/docs/classes/Polygon.md +0 -101
  154. package/docs/classes/Query.md +0 -227
  155. package/docs/classes/RawError.md +0 -351
  156. package/docs/classes/RawQuery.md +0 -224
  157. package/docs/classes/Request.md +0 -321
  158. package/docs/classes/Response.md +0 -242
  159. package/docs/classes/ResponseData.md +0 -144
  160. package/docs/classes/ServiceProvider.md +0 -296
  161. package/docs/classes/ServiceResponse.md +0 -89
  162. package/docs/classes/SetSessionVariableQuery.md +0 -207
  163. package/docs/classes/StormError.md +0 -343
  164. package/docs/classes/TemporaryTableQuery.md +0 -213
  165. package/docs/classes/Token.md +0 -43
  166. package/docs/classes/TokenManager.md +0 -105
  167. package/docs/classes/Transaction.md +0 -161
  168. package/docs/classes/UnauthorizedAccessError.md +0 -341
  169. package/docs/enums/ErrorCode.md +0 -107
  170. package/docs/enums/ExitCode.md +0 -30
  171. package/docs/enums/HTTPMethod.md +0 -52
  172. package/docs/enums/IsolationLevel.md +0 -52
  173. package/docs/enums/JWTError.md +0 -30
  174. package/docs/enums/StatusCode.md +0 -536
  175. package/docs/interfaces/IAdditionalErrorDetails.md +0 -7
  176. package/docs/interfaces/IAuthTokenData.md +0 -41
  177. package/docs/interfaces/IConfig.md +0 -112
  178. package/docs/interfaces/IDatabaseConfig.md +0 -80
  179. package/docs/interfaces/IDatabaseConnection.md +0 -262
  180. package/docs/interfaces/IErrorResponse.md +0 -63
  181. package/docs/interfaces/IFormData.md +0 -30
  182. package/docs/interfaces/IHandler.md +0 -31
  183. package/docs/interfaces/IInsertQueryResult.md +0 -41
  184. package/docs/interfaces/IJWTVerifyOptions.md +0 -19
  185. package/docs/interfaces/IParameterMap.md +0 -7
  186. package/docs/interfaces/IQueryable.md +0 -119
  187. package/docs/interfaces/IRequestResponse.md +0 -37
  188. package/docs/interfaces/IServiceHeaders.md +0 -7
  189. package/docs/interfaces/ISetSessionVariableQueryInput.md +0 -30
  190. package/docs/interfaces/ITemporaryTableQueryInput.md +0 -30
  191. package/docs/interfaces/IUpdateQueryResult.md +0 -30
  192. package/docs/interfaces/formidable.EmitData.md +0 -54
  193. package/docs/interfaces/formidable.EventData.md +0 -87
  194. package/docs/interfaces/formidable.Fields.md +0 -9
  195. package/docs/interfaces/formidable.File.md +0 -131
  196. package/docs/interfaces/formidable.FileJSON.md +0 -151
  197. package/docs/interfaces/formidable.Files.md +0 -9
  198. package/docs/interfaces/formidable.Options.md +0 -225
  199. package/docs/interfaces/formidable.Part.md +0 -793
  200. package/docs/modules/formidable.md +0 -122
  201. package/lib/DumpStream.d.ts +0 -6
  202. package/lib/DumpStream.js +0 -28
  203. package/lib/DumpStream.js.map +0 -1
  204. package/src/DumpStream.ts +0 -28
@@ -28,6 +28,10 @@ const TAG = 'Transaction';
28
28
  * This encapsulates a routine to conduct for the transaction.
29
29
  * Should the transaction fail due to a deadlock, the transaction will automatically
30
30
  * be tried.
31
+ *
32
+ * NOTE: It is unsafe to run two transactions on the same connection concurrently.
33
+ * The execution *must* be waited to complete before executing another transaction,
34
+ * on the same connection.
31
35
  */
32
36
  class Transaction {
33
37
  constructor(app, executor, retryLimit = Infinity, isolationLevel = IsolationLevel_1.IsolationLevel.REPEATABLE_READ) {
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../src/Transaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAKF,qDAAkD;AAClD,mDAAgD;AAChD,mDAAgD;AAChD,2DAAwD;AACxD,iEAA8D;AAE9D,MAAM,GAAG,GAAW,aAAa,CAAC;AAIlC;;;;;;GAMG;AACH,MAAa,WAAW;IAMpB,YAAmB,GAAgB,EAAE,QAA8B,EAAE,aAAqB,QAAQ,EAAE,iBAAiC,+BAAc,CAAC,eAAe;QAC/J,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,EAAE;YACjD,UAAU,GAAG,QAAQ,CAAC;SACzB;aACI,IAAI,UAAU,IAAI,CAAC,EAAE;YACtB,MAAM,IAAI,qCAAiB,CAAC,YAAY,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;SACxE;QAED,IAAI,CAAC,WAAW,GAAG,UAAU,CA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AAC;iBACZ;aACJ;SACJ,QAAQ,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE;IAC9C,CAAC;CACJ;AAlED,kCAkEC"}
package/lib/api.d.ts CHANGED
@@ -49,7 +49,7 @@ export { IDatabaseConfig } from './IDatabaseConfig';
49
49
  export { IJWTVerifyOptions } from './IJWTVerifyOptions';
50
50
  export { IHandler } from './IHandler';
51
51
  export { IRequestResponse } from './IRequestResponse';
52
- export { IConfig } from './IConfig';
52
+ export { IConfig, ICloudwatchConfig, ICloudwatchCredentials, ICloudwatchStreamConfig } from './IConfig';
53
53
  export { IFormData } from './IFormData';
54
54
  export { IDatabaseConnection } from './IDatabaseConnection';
55
55
  export { IServiceHeaders } from './IServiceHeaders';
@@ -58,7 +58,6 @@ export { IQueryable } from './IQueryable';
58
58
  export { Token } from './Token';
59
59
  export { TokenManager } from './TokenManager';
60
60
  export { ExitCode } from './ExitCode';
61
- export { DumpStream } from './DumpStream';
62
61
  export { TCoordinate } from './TCoordinate';
63
62
  export { DatabaseCastObject } from './DatabaseCastObject';
64
63
  export { Point } from './Point';
package/lib/api.js CHANGED
@@ -15,8 +15,8 @@
15
15
  limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.Point = exports.DatabaseCastObject = exports.DumpStream = exports.ExitCode = exports.TokenManager = exports.Token = exports.BackendAuthenticationMiddleware = exports.ServiceResponse = exports.HTTPMethod = exports.ServiceProvider = exports.CORSMiddleware = exports.Handler = exports.ResponseData = exports.Response = exports.Request = exports.Middleware = exports.StatusCode = exports.LockWaitTimeoutError = exports.DeadLockError = exports.NotImplementedError = exports.DatabaseQueryError = exports.MissingConfigError = exports.DuplicateEntryError = exports.DiskSpaceError = exports.EntityNotFoundError = exports.UnauthorizedAccessError = exports.InvalidValueError = exports.ExpiredTokenError = exports.InternalError = exports.InvalidCredentialsError = exports.MissingParameterError = exports.JWTError = exports.StormError = exports.RawError = exports.ErrorCode = exports.Transaction = exports.IsolationLevel = exports.SetSessionVariableQuery = exports.RawQuery = exports.DropTemporaryTableQuery = exports.TemporaryTableQuery = exports.Query = exports.ManagedDatabaseConnection = exports.MySQLConnection = exports.MySQLDatabase = exports.DatabaseConnection = exports.Database = exports.ConfigLoader = exports.Application = exports.getInstance = void 0;
19
- exports.formidable = exports.Polygon = exports.LineString = void 0;
18
+ exports.LineString = exports.Point = exports.DatabaseCastObject = exports.ExitCode = exports.TokenManager = exports.Token = exports.BackendAuthenticationMiddleware = exports.ServiceResponse = exports.HTTPMethod = exports.ServiceProvider = exports.CORSMiddleware = exports.Handler = exports.ResponseData = exports.Response = exports.Request = exports.Middleware = exports.StatusCode = exports.LockWaitTimeoutError = exports.DeadLockError = exports.NotImplementedError = exports.DatabaseQueryError = exports.MissingConfigError = exports.DuplicateEntryError = exports.DiskSpaceError = exports.EntityNotFoundError = exports.UnauthorizedAccessError = exports.InvalidValueError = exports.ExpiredTokenError = exports.InternalError = exports.InvalidCredentialsError = exports.MissingParameterError = exports.JWTError = exports.StormError = exports.RawError = exports.ErrorCode = exports.Transaction = exports.IsolationLevel = exports.SetSessionVariableQuery = exports.RawQuery = exports.DropTemporaryTableQuery = exports.TemporaryTableQuery = exports.Query = exports.ManagedDatabaseConnection = exports.MySQLConnection = exports.MySQLDatabase = exports.DatabaseConnection = exports.Database = exports.ConfigLoader = exports.Application = exports.getInstance = void 0;
19
+ exports.formidable = exports.Polygon = void 0;
20
20
  // Application
21
21
  var instance_1 = require("./instance");
22
22
  Object.defineProperty(exports, "getInstance", { enumerable: true, get: function () { return instance_1.getInstance; } });
@@ -118,8 +118,6 @@ Object.defineProperty(exports, "TokenManager", { enumerable: true, get: function
118
118
  // Utils
119
119
  var ExitCode_1 = require("./ExitCode");
120
120
  Object.defineProperty(exports, "ExitCode", { enumerable: true, get: function () { return ExitCode_1.ExitCode; } });
121
- var DumpStream_1 = require("./DumpStream");
122
- Object.defineProperty(exports, "DumpStream", { enumerable: true, get: function () { return DumpStream_1.DumpStream; } });
123
121
  var DatabaseCastObject_1 = require("./DatabaseCastObject");
124
122
  Object.defineProperty(exports, "DatabaseCastObject", { enumerable: true, get: function () { return DatabaseCastObject_1.DatabaseCastObject; } });
125
123
  var Point_1 = require("./Point");
package/lib/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;;AAEF,cAAc;AACd,uCAAuC;AAA/B,uGAAA,WAAW,OAAA;AACnB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AAEnB,SAAS;AACT,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AAEpB,WAAW;AACX,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,yEAAsE;AAA9D,sIAAA,yBAAyB,OAAA;AACjC,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,6DAAqF;AAA7E,0HAAA,mBAAmB,OAAA;AAC3B,qEAAkE;AAA1D,kIAAA,uBAAuB,OAAA;AAC/B,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAIhB,qEAAiG;AAAzF,kIAAA,uBAAuB,OAAA;AAC/B,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AACtB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AAEnB,SAAS;AACT,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,2CAIsB;AAHlB,wGAAA,UAAU,OAAA;AAId,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,iEAA8D;AAAtD,8HAAA,qBAAqB,OAAA;AAC7B,qEAAkE;AAA1D,kIAAA,uBAAuB,OAAA;AAC/B,iDAA8C;AAAtC,8GAAA,aAAa,O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CAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breautek/storm",
3
- "version": "5.0.1",
3
+ "version": "6.0.1",
4
4
  "description": "Object-Oriented REST API framework",
5
5
  "main": "lib/api.js",
6
6
  "types": "lib/api.d.ts",
@@ -48,39 +48,41 @@
48
48
  "@types/body-parser": "1.19.2",
49
49
  "@types/express": "4.17.17",
50
50
  "@types/formidable": "1.2.3",
51
- "@types/jsonwebtoken": "9.0.1",
51
+ "@types/jsonwebtoken": "9.0.2",
52
52
  "@types/mysql": "2.15.21",
53
- "@types/node": "18.15.0",
53
+ "@types/node": "20.1.7",
54
54
  "@types/uuid": "9.0.1",
55
55
  "ajv": "8.12.0",
56
56
  "body-parser": "1.20.2",
57
- "commander": "10.0.0",
57
+ "commander": "10.0.1",
58
58
  "express": "4.18.2",
59
59
  "form-data": "4.0.0",
60
60
  "formidable": "1.2.2",
61
61
  "jsonwebtoken": "9.0.0",
62
62
  "mysql": "2.18.1",
63
- "sql-formatter": "12.1.3",
63
+ "sql-formatter": "12.2.0",
64
64
  "tslib": "2.5.0",
65
65
  "uuid": "9.0.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@arashi/logger": "2.x"
68
+ "@arashi/logger": "4.x",
69
+ "@arashi/interfaces": "1.x"
69
70
  },
70
71
  "devDependencies": {
71
- "@arashi/logger": "2.1.0",
72
- "@totalpave/eslint-plugin": "6.0.9",
73
- "@types/jest": "29.4.0",
74
- "@typescript-eslint/eslint-plugin": "5.54.1",
75
- "@typescript-eslint/parser": "5.54.1",
72
+ "@arashi/interfaces": "1.2.1",
73
+ "@arashi/logger": "4.0.0",
74
+ "@totalpave/eslint-plugin": "6.0.10",
75
+ "@types/jest": "29.5.1",
76
+ "@typescript-eslint/eslint-plugin": "5.59.6",
77
+ "@typescript-eslint/parser": "5.59.6",
76
78
  "auto-changelog": "2.4.0",
77
- "eslint": "8.36.0",
79
+ "eslint": "8.40.0",
78
80
  "jest": "29.5.0",
79
81
  "jest-jasmine2": "29.5.0",
80
- "ts-jest": "29.0.5",
82
+ "ts-jest": "29.1.0",
81
83
  "ts-node": "10.9.1",
82
- "typedoc": "0.23.26",
83
- "typedoc-plugin-markdown": "3.14.0",
84
- "typescript": "4.9.5"
84
+ "typedoc": "0.24.7",
85
+ "typedoc-plugin-markdown": "3.15.3",
86
+ "typescript": "5.0.4"
85
87
  }
86
88
  }
@@ -24,13 +24,16 @@ import {IHandler} from './IHandler';
24
24
  import {Request} from './Request';
25
25
  import {Response} from './Response';
26
26
  import {ConfigLoader} from './ConfigLoader';
27
- import {IConfig} from './IConfig';
27
+ import {ICloudwatchConfig, IConfig} from './IConfig';
28
28
  import {Command} from 'commander';
29
29
  import * as Express from 'express';
30
30
  import * as BodyParser from 'body-parser';
31
31
  import * as http from 'http';
32
32
  import { IAuthTokenData } from '@arashi/token';
33
- import { Logger } from '@arashi/logger';
33
+ import {
34
+ Logger,
35
+ CloudWatchStream
36
+ } from '@arashi/logger';
34
37
  import { StormError } from './StormError';
35
38
 
36
39
  const TAG: string = 'Application';
@@ -77,85 +80,82 @@ export abstract class Application
77
80
  });
78
81
 
79
82
  this.$configPath = configPath || process.cwd();
83
+ }
80
84
 
85
+ public async start(): Promise<void> {
81
86
  this.$logger = new Logger(this.constructor.name);
82
87
 
83
88
  this.$logger.info(TAG, 'Application is booting...');
84
89
  this.$logger.info(TAG, 'Loading Configuration...');
85
90
 
86
- this.$load();
91
+ try {
92
+ await this.$load();
93
+ }
94
+ catch (error) {
95
+ this.$getLogger().error(TAG, error);
96
+ }
87
97
  }
88
98
 
89
- private $load(): void {
90
- this.loadConfig(this.$configPath).then((config: TConfig) => {
91
- this.$config = config;
92
- this.$logger = this._initLogger(config);
93
- this.$getLogger().trace(TAG, 'Configuration loaded.');
94
- this.emit(ApplicationEvent.CONFIG_LOADED);
95
- this._onConfigLoad(this.$config);
96
- return Promise.resolve();
97
- }).then(() => {
98
- this.$getLogger().trace(TAG, 'Initializing DB...');
99
- return this._initDB(this.getConfig());
100
- }).then((db: Database<TDBConfig, TDBConnectionAPI>) => {
101
- if (db) {
102
- this.$getLogger().trace(TAG, 'DB Initialized.');
103
- }
104
- else {
105
- this.$getLogger().trace(TAG, 'DB is not initialized.');
106
- }
107
- this.$db = db;
108
-
109
- return Promise.resolve();
110
- }).then(() => {
111
- this.$getLogger().trace(TAG, 'Starting server...');
112
- this.$server = Express();
113
- this.$server.use(BodyParser.json({
114
- type : 'application/json',
115
- limit : this.getRequestSizeLimit()
116
- }));
117
- this.$server.use(BodyParser.text({
118
- type : 'text/*',
119
- limit : this.getRequestSizeLimit()
120
- }));
121
-
122
- return Promise.resolve();
123
- }).then(() => {
124
- this.$getLogger().trace(TAG, 'Attaching handlers...');
125
- return this._attachHandlers();
126
- }).then(() => {
127
- return this._onBeforeReadyAsync();
128
- }).then(() => {
129
- return new Promise<void>((resolve, reject) => {
130
- let bindingIP: string = this.getConfig().bind;
131
- let port: number = this.getConfig().port;
132
-
133
- if (bindingIP !== null && bindingIP !== 'null') {
134
- if (this.shouldListen()) {
135
- this.$socket = http.createServer(this.$server);
136
- this.$socket.listen(port, bindingIP, () => {
137
- this.$getLogger().trace(TAG, `Server started on ${bindingIP}:${this.getPort()}`);
138
- resolve();
139
- });
140
- }
141
- else {
142
- this.$getLogger().trace(TAG, 'Server did not bind because shouldListen() returned false.');
99
+ private async $load(): Promise<void> {
100
+ this.$config = await this.loadConfig(this.$configPath);
101
+ this.$logger = this._initLogger(this.$config);
102
+
103
+ this.$getLogger().trace(TAG, 'Configuration loaded.');
104
+ this.emit(ApplicationEvent.CONFIG_LOADED);
105
+ this._onConfigLoad(this.$config);
106
+
107
+ this.$getLogger().trace(TAG, 'Initializing DB...');
108
+ this.$db = await this._initDB(this.getConfig());
109
+ if (this.$db) {
110
+ this.$getLogger().trace(TAG, 'DB Initialized.');
111
+ }
112
+ else {
113
+ this.$getLogger().trace(TAG, 'DB is not initialized.');
114
+ }
115
+
116
+ this.$getLogger().trace(TAG, 'Starting server...');
117
+ this.$server = Express();
118
+ this.$server.use(BodyParser.json({
119
+ type : 'application/json',
120
+ limit : this.getRequestSizeLimit()
121
+ }));
122
+ this.$server.use(BodyParser.text({
123
+ type : 'text/*',
124
+ limit : this.getRequestSizeLimit()
125
+ }));
126
+
127
+ this.$getLogger().trace(TAG, 'Attaching handlers...');
128
+ await this._attachHandlers();
129
+
130
+ await this._onBeforeReadyAsync();
131
+
132
+ await new Promise<void>((resolve, reject) => {
133
+ let bindingIP: string = this.getConfig().bind;
134
+ let port: number = this.getConfig().port;
135
+
136
+ if (bindingIP !== null && bindingIP !== 'null') {
137
+ if (this.shouldListen()) {
138
+ this.$socket = http.createServer(this.$server);
139
+ this.$socket.listen(port, bindingIP, () => {
140
+ this.$getLogger().trace(TAG, `Server started on ${bindingIP}:${this.getPort()}`);
143
141
  resolve();
144
- }
142
+ });
145
143
  }
146
144
  else {
147
- this.$getLogger().info(TAG, `Server does not have a bounding IP set. The server will not be listening for connections.`);
145
+ this.$getLogger().trace(TAG, 'Server did not bind because shouldListen() returned false.');
148
146
  resolve();
149
147
  }
150
- });
151
- }).then(() => {
152
- return this._initialize(this.getConfig());
153
- }).then(() => {
154
- this._onReady();
155
- this.emit('ready');
156
- }).catch((error) => {
157
- this.$getLogger().error(TAG, error);
148
+ }
149
+ else {
150
+ this.$getLogger().info(TAG, `Server does not have a bounding IP set. The server will not be listening for connections.`);
151
+ resolve();
152
+ }
158
153
  });
154
+
155
+ await this._initialize(this.getConfig());
156
+
157
+ this._onReady();
158
+ this.emit('ready');
159
159
  }
160
160
 
161
161
  protected _initialize(config: TConfig): Promise<void> {
@@ -163,7 +163,67 @@ export abstract class Application
163
163
  }
164
164
 
165
165
  protected _initLogger(config: TConfig): Logger {
166
- return new Logger(this.getName(), config.log?.level, config.log?.directory);
166
+ let logger: Logger = new Logger(this.getName(), config.log?.level);
167
+
168
+ if (config?.log?.cloudwatch) {
169
+ let cwConfig: ICloudwatchConfig = config.log.cloudwatch;
170
+ let cwCheck: string = this.$validateCWConfig(cwConfig);
171
+ if (cwCheck === null) {
172
+ this.$connectCW(logger, cwConfig);
173
+ }
174
+ else {
175
+ logger.warn(TAG, `Skipped configuration cloudwatch: ${cwCheck}`);
176
+ }
177
+ }
178
+
179
+ return logger;
180
+ }
181
+
182
+ private $connectCW(logger: Logger, cwConfig: ICloudwatchConfig): void {
183
+ logger.pipe(new CloudWatchStream({
184
+ region: cwConfig.region,
185
+ credentials: {
186
+ accessKeyId: cwConfig.credentials.accessKeyId,
187
+ secretAccessKey: cwConfig.credentials.secretAccessKey
188
+ }
189
+ }, {
190
+ group: cwConfig.stream.group,
191
+ stream: cwConfig.stream.name
192
+ }));
193
+ }
194
+
195
+ private $validateCWConfig(config: ICloudwatchConfig): string {
196
+ const BASE: string = 'missing $.log.cloudwatch.';
197
+
198
+ if (!config.region) {
199
+ return BASE + 'region';
200
+ }
201
+
202
+ if (!config.credentials) {
203
+ return BASE + 'credentials';
204
+ }
205
+
206
+ if (!config.credentials.accessKeyId) {
207
+ return BASE + 'credentials.accessKeyId';
208
+ }
209
+
210
+ if (!config.credentials.secretAccessKey) {
211
+ return BASE + 'credentials.secretAccessKey';
212
+ }
213
+
214
+ if (!config.stream) {
215
+ return BASE + 'stream';
216
+ }
217
+
218
+ if (!config.stream.group) {
219
+ return BASE + 'stream.group';
220
+ }
221
+
222
+ if (!config.stream.name) {
223
+ return BASE + 'stream.name';
224
+ }
225
+
226
+ return null;
167
227
  }
168
228
 
169
229
  public getLogger(): Logger {
@@ -244,6 +304,9 @@ export abstract class Application
244
304
 
245
305
  public async close(): Promise<void> {
246
306
  await Promise.all([ this._closeSocket(), this._closeDatabase() ]);
307
+ if (this.$logger) {
308
+ this.$logger.destroy();
309
+ }
247
310
  }
248
311
 
249
312
  protected async _closeDatabase(): Promise<void> {
package/src/IConfig.ts CHANGED
@@ -15,7 +15,23 @@
15
15
  */
16
16
 
17
17
  import { IDatabaseConfig } from './IDatabaseConfig';
18
- import {LogLevel} from '@arashi/logger';
18
+ import {LogLevel} from '@arashi/interfaces';
19
+
20
+ export interface ICloudwatchCredentials {
21
+ accessKeyId: string;
22
+ secretAccessKey: string;
23
+ }
24
+
25
+ export interface ICloudwatchStreamConfig {
26
+ group: string;
27
+ name: string;
28
+ }
29
+
30
+ export interface ICloudwatchConfig {
31
+ region: string;
32
+ credentials: ICloudwatchCredentials;
33
+ stream: ICloudwatchStreamConfig;
34
+ }
19
35
 
20
36
  export interface IConfig {
21
37
  // Server exposability
@@ -31,7 +47,7 @@ export interface IConfig {
31
47
  log?: {
32
48
  level?: LogLevel;
33
49
  filters?: Array<string>;
34
- directory?: string;
50
+ cloudwatch?: ICloudwatchConfig;
35
51
  },
36
52
 
37
53
  // Database
@@ -24,7 +24,8 @@ import { StartTransactionQuery } from './private/StartTransactionQuery';
24
24
  import { CommitQuery } from './private/CommitQuery';
25
25
  import { RollbackQuery } from './private/RollbackQuery';
26
26
  import * as SQLFormatter from 'sql-formatter';
27
- import { Logger, LogLevel } from '@arashi/logger';
27
+ import { Logger } from '@arashi/logger';
28
+ import {LogLevel} from '@arashi/interfaces';
28
29
  import { StormError } from './StormError';
29
30
  import { DeadLockError } from './DeadLockError';
30
31
  import { IsolationLevel } from './IsolationLevel';
package/src/StatusCode.ts CHANGED
@@ -31,7 +31,7 @@ export enum StatusCode {
31
31
 
32
32
  REDIR_MULTIPLE_CHOICE = 300,
33
33
  REDIR_MOVED_PERMANENTLY = 301,
34
- REDIR_FOUND = 301,
34
+ REDIR_FOUND = 302,
35
35
  REDIR_SEE_OTHER = 303,
36
36
  REDIR_NOT_MODIFIED = 304,
37
37
  REDIR_USE_PROXY = 305,
@@ -33,6 +33,10 @@ export type ITransactionExecutor = (connection: IDatabaseConnection) => Promise<
33
33
  * This encapsulates a routine to conduct for the transaction.
34
34
  * Should the transaction fail due to a deadlock, the transaction will automatically
35
35
  * be tried.
36
+ *
37
+ * NOTE: It is unsafe to run two transactions on the same connection concurrently.
38
+ * The execution *must* be waited to complete before executing another transaction,
39
+ * on the same connection.
36
40
  */
37
41
  export class Transaction implements IQueryable<void> {
38
42
  private $retryLimit: number;
package/src/api.ts CHANGED
@@ -80,7 +80,12 @@ export {IDatabaseConfig} from './IDatabaseConfig';
80
80
  export {IJWTVerifyOptions} from './IJWTVerifyOptions';
81
81
  export {IHandler} from './IHandler';
82
82
  export {IRequestResponse} from './IRequestResponse';
83
- export {IConfig} from './IConfig';
83
+ export {
84
+ IConfig,
85
+ ICloudwatchConfig,
86
+ ICloudwatchCredentials,
87
+ ICloudwatchStreamConfig
88
+ } from './IConfig';
84
89
  export {IFormData} from './IFormData';
85
90
  export {IDatabaseConnection} from './IDatabaseConnection';
86
91
  export {IServiceHeaders} from './IServiceHeaders';
@@ -93,7 +98,6 @@ export {TokenManager} from './TokenManager';
93
98
 
94
99
  // Utils
95
100
  export {ExitCode} from './ExitCode';
96
- export {DumpStream} from './DumpStream';
97
101
 
98
102
  // Database Objects
99
103
  export {TCoordinate} from './TCoordinate';