@ikonintegration/ikapi 4.0.1 → 5.0.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 (236) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.cjs +81 -0
  3. package/.github/workflows/npmpublish.yml +8 -19
  4. package/.github/workflows/prs.yml +12 -0
  5. package/README.md +89 -99
  6. package/dist/index.d.ts +16 -0
  7. package/dist/index.js +27 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/package-lock.json +11881 -0
  10. package/dist/package.json +81 -0
  11. package/dist/src/API/Request.d.ts +125 -0
  12. package/dist/src/API/Request.js +185 -0
  13. package/dist/src/API/Request.js.map +1 -0
  14. package/dist/src/API/Response.d.ts +188 -0
  15. package/dist/src/API/Response.js +270 -0
  16. package/dist/src/API/Response.js.map +1 -0
  17. package/dist/src/BaseEvent/DynamoTransaction.d.ts +70 -0
  18. package/dist/src/BaseEvent/DynamoTransaction.js +104 -0
  19. package/dist/src/BaseEvent/DynamoTransaction.js.map +1 -0
  20. package/dist/src/BaseEvent/EventProcessor.d.ts +58 -0
  21. package/dist/src/BaseEvent/EventProcessor.js +101 -0
  22. package/dist/src/BaseEvent/EventProcessor.js.map +1 -0
  23. package/dist/src/BaseEvent/Process.d.ts +50 -0
  24. package/dist/src/BaseEvent/Process.js +64 -0
  25. package/dist/src/BaseEvent/Process.js.map +1 -0
  26. package/dist/src/BaseEvent/StepTransaction.d.ts +23 -0
  27. package/dist/src/BaseEvent/StepTransaction.js +27 -0
  28. package/dist/src/BaseEvent/StepTransaction.js.map +1 -0
  29. package/dist/src/BaseEvent/Transaction.d.ts +149 -0
  30. package/dist/src/BaseEvent/Transaction.js +224 -0
  31. package/dist/src/BaseEvent/Transaction.js.map +1 -0
  32. package/dist/src/Cache/Redis.d.ts +29 -0
  33. package/dist/src/Cache/Redis.js +80 -0
  34. package/dist/src/Cache/Redis.js.map +1 -0
  35. package/dist/src/Cache/types.d.ts +31 -0
  36. package/dist/src/Cache/types.js +2 -0
  37. package/dist/src/Cache/types.js.map +1 -0
  38. package/dist/src/Config/Configuration.d.ts +123 -0
  39. package/dist/src/Config/Configuration.js +109 -0
  40. package/dist/src/Config/Configuration.js.map +1 -0
  41. package/dist/src/Config/EnvironmentVar.d.ts +74 -0
  42. package/dist/src/Config/EnvironmentVar.js +138 -0
  43. package/dist/src/Config/EnvironmentVar.js.map +1 -0
  44. package/dist/src/Crypto/Crypto.d.ts +45 -0
  45. package/dist/src/Crypto/Crypto.js +72 -0
  46. package/dist/src/Crypto/Crypto.js.map +1 -0
  47. package/dist/src/Database/Database.d.ts +21 -0
  48. package/dist/src/Database/Database.js +15 -0
  49. package/dist/src/Database/Database.js.map +1 -0
  50. package/dist/src/Database/DatabaseManager.d.ts +47 -0
  51. package/dist/src/Database/DatabaseManager.js +60 -0
  52. package/dist/src/Database/DatabaseManager.js.map +1 -0
  53. package/dist/src/Database/DatabaseTransaction.d.ts +101 -0
  54. package/dist/src/Database/DatabaseTransaction.js +126 -0
  55. package/dist/src/Database/DatabaseTransaction.js.map +1 -0
  56. package/dist/src/Database/index.d.ts +10 -0
  57. package/dist/src/Database/index.js +15 -0
  58. package/dist/src/Database/index.js.map +1 -0
  59. package/dist/src/Database/integrations/dynamo/DynamoDatabase.d.ts +35 -0
  60. package/dist/src/Database/integrations/dynamo/DynamoDatabase.js +59 -0
  61. package/dist/src/Database/integrations/dynamo/DynamoDatabase.js.map +1 -0
  62. package/dist/src/Database/integrations/kysely/KyselyDatabase.d.ts +66 -0
  63. package/dist/src/Database/integrations/kysely/KyselyDatabase.js +86 -0
  64. package/dist/src/Database/integrations/kysely/KyselyDatabase.js.map +1 -0
  65. package/dist/src/Database/integrations/kysely/KyselyTransaction.d.ts +70 -0
  66. package/dist/src/Database/integrations/kysely/KyselyTransaction.js +118 -0
  67. package/dist/src/Database/integrations/kysely/KyselyTransaction.js.map +1 -0
  68. package/dist/src/Database/integrations/pgsql/PostgresDatabase.d.ts +36 -0
  69. package/dist/src/Database/integrations/pgsql/PostgresDatabase.js +54 -0
  70. package/dist/src/Database/integrations/pgsql/PostgresDatabase.js.map +1 -0
  71. package/dist/src/Database/integrations/pgsql/PostgresTransaction.d.ts +63 -0
  72. package/dist/src/Database/integrations/pgsql/PostgresTransaction.js +61 -0
  73. package/dist/src/Database/integrations/pgsql/PostgresTransaction.js.map +1 -0
  74. package/dist/src/Database/types.d.ts +76 -0
  75. package/dist/src/Database/types.js +2 -0
  76. package/dist/src/Database/types.js.map +1 -0
  77. package/dist/src/Globals.d.ts +93 -0
  78. package/dist/src/Globals.js +99 -0
  79. package/dist/src/Globals.js.map +1 -0
  80. package/dist/src/Logger/Logger.d.ts +161 -0
  81. package/dist/src/Logger/Logger.js +299 -0
  82. package/dist/src/Logger/Logger.js.map +1 -0
  83. package/dist/src/Mailer/Mailer.d.ts +78 -0
  84. package/dist/src/Mailer/Mailer.js +182 -0
  85. package/dist/src/Mailer/Mailer.js.map +1 -0
  86. package/dist/src/Publisher/Publisher.d.ts +39 -0
  87. package/dist/src/Publisher/Publisher.js +77 -0
  88. package/dist/src/Publisher/Publisher.js.map +1 -0
  89. package/dist/src/Server/RouteResolver.d.ts +33 -0
  90. package/dist/src/Server/RouteResolver.js +100 -0
  91. package/dist/src/Server/RouteResolver.js.map +1 -0
  92. package/dist/src/Server/Router.d.ts +157 -0
  93. package/dist/src/Server/Router.js +32 -0
  94. package/dist/src/Server/Router.js.map +1 -0
  95. package/dist/src/Server/lib/ContainerServer.d.ts +42 -0
  96. package/dist/src/Server/lib/ContainerServer.js +66 -0
  97. package/dist/src/Server/lib/ContainerServer.js.map +1 -0
  98. package/dist/src/Server/lib/Server.d.ts +45 -0
  99. package/dist/src/Server/lib/Server.js +93 -0
  100. package/dist/src/Server/lib/Server.js.map +1 -0
  101. package/dist/src/Server/lib/container/GenericHandler.d.ts +9 -0
  102. package/dist/src/Server/lib/container/GenericHandler.js +82 -0
  103. package/dist/src/Server/lib/container/GenericHandler.js.map +1 -0
  104. package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +52 -0
  105. package/dist/src/Server/lib/container/GenericHandlerEvent.js +132 -0
  106. package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +1 -0
  107. package/dist/src/Server/lib/container/HealthHandler.d.ts +9 -0
  108. package/dist/src/Server/lib/container/HealthHandler.js +19 -0
  109. package/dist/src/Server/lib/container/HealthHandler.js.map +1 -0
  110. package/dist/src/Server/lib/container/Proxy.d.ts +67 -0
  111. package/dist/src/Server/lib/container/Proxy.js +143 -0
  112. package/dist/src/Server/lib/container/Proxy.js.map +1 -0
  113. package/dist/src/Server/lib/container/Utils.d.ts +14 -0
  114. package/dist/src/Server/lib/container/Utils.js +37 -0
  115. package/dist/src/Server/lib/container/Utils.js.map +1 -0
  116. package/dist/src/Util/AsyncSingleton.d.ts +31 -0
  117. package/dist/src/Util/AsyncSingleton.js +83 -0
  118. package/dist/src/Util/AsyncSingleton.js.map +1 -0
  119. package/dist/src/Util/Utils.d.ts +61 -0
  120. package/dist/src/Util/Utils.js +147 -0
  121. package/dist/src/Util/Utils.js.map +1 -0
  122. package/dist/src/Validation/Validator.d.ts +17 -0
  123. package/dist/src/Validation/Validator.js +39 -0
  124. package/dist/src/Validation/Validator.js.map +1 -0
  125. package/dist/tsconfig.tsbuildinfo +1 -0
  126. package/index.ts +41 -0
  127. package/jest.config.ts +37 -0
  128. package/jest.smoke.config.ts +34 -0
  129. package/package.json +66 -22
  130. package/src/API/Request.ts +214 -0
  131. package/src/API/Response.ts +370 -0
  132. package/src/BaseEvent/DynamoTransaction.ts +175 -0
  133. package/src/BaseEvent/EventProcessor.ts +140 -0
  134. package/src/BaseEvent/Process.ts +78 -0
  135. package/src/BaseEvent/StepTransaction.ts +35 -0
  136. package/src/BaseEvent/Transaction.ts +323 -0
  137. package/src/Cache/Redis.ts +89 -0
  138. package/src/Cache/types.ts +33 -0
  139. package/src/Config/Configuration.ts +199 -0
  140. package/src/Config/EnvironmentVar.ts +142 -0
  141. package/src/Crypto/Crypto.ts +89 -0
  142. package/src/Database/Database.ts +22 -0
  143. package/src/Database/DatabaseManager.ts +67 -0
  144. package/src/Database/DatabaseTransaction.ts +170 -0
  145. package/src/Database/index.ts +27 -0
  146. package/src/Database/integrations/dynamo/DynamoDatabase.ts +58 -0
  147. package/src/Database/integrations/kysely/KyselyDatabase.ts +99 -0
  148. package/src/Database/integrations/kysely/KyselyTransaction.ts +172 -0
  149. package/src/Database/integrations/pgsql/PostgresDatabase.ts +56 -0
  150. package/src/Database/integrations/pgsql/PostgresTransaction.ts +87 -0
  151. package/src/Database/types.ts +85 -0
  152. package/src/Globals.ts +103 -0
  153. package/src/Logger/Logger.ts +363 -0
  154. package/src/Mailer/Mailer.ts +217 -0
  155. package/src/Publisher/Publisher.ts +96 -0
  156. package/src/Server/RouteResolver.ts +124 -0
  157. package/src/Server/Router.ts +200 -0
  158. package/src/Server/lib/ContainerServer.ts +65 -0
  159. package/src/Server/lib/Server.ts +109 -0
  160. package/src/Server/lib/container/GenericHandler.ts +76 -0
  161. package/src/Server/lib/container/GenericHandlerEvent.ts +154 -0
  162. package/src/Server/lib/container/HealthHandler.ts +11 -0
  163. package/src/Server/lib/container/Proxy.ts +172 -0
  164. package/src/Server/lib/container/Utils.ts +33 -0
  165. package/src/Util/AsyncSingleton.ts +86 -0
  166. package/src/Util/Utils.ts +131 -0
  167. package/src/Validation/Validator.ts +45 -0
  168. package/tests/API/Request.test.ts +273 -0
  169. package/tests/API/Response.test.ts +367 -0
  170. package/tests/BaseEvent/DynamoTransaction.test.ts +272 -0
  171. package/tests/BaseEvent/EventProcessor.test.ts +263 -0
  172. package/tests/BaseEvent/Process.test.ts +47 -0
  173. package/tests/BaseEvent/StepTransaction.test.ts +44 -0
  174. package/tests/BaseEvent/Transaction.test.ts +402 -0
  175. package/tests/Cache/Redis-client.test.ts +90 -0
  176. package/tests/Cache/Redis-cluster.test.ts +100 -0
  177. package/tests/Config/Config.test.ts +205 -0
  178. package/tests/Config/EnvironmentVar.test.ts +251 -0
  179. package/tests/Crypto/Crypto.test.ts +88 -0
  180. package/tests/Database/DatabaseManager.test.ts +79 -0
  181. package/tests/Database/integrations/dynamo/DynamoDatabase.test.ts +44 -0
  182. package/tests/Database/integrations/kysely/KyselyDatabase.test.ts +113 -0
  183. package/tests/Database/integrations/kysely/KyselyTransaction.test.ts +119 -0
  184. package/tests/Database/integrations/pg/PostgresDatabase.test.ts +76 -0
  185. package/tests/Database/integrations/pg/PostgresTransaction.test.ts +118 -0
  186. package/tests/Logger/Logger.test.ts +215 -0
  187. package/tests/Mailer/Mailer.test.ts +59 -0
  188. package/tests/Publisher/Publisher.test.ts +60 -0
  189. package/tests/Server/RouteResolver.test.ts +116 -0
  190. package/tests/Server/Router.test.ts +39 -0
  191. package/tests/Server/lib/ContainerServer.test.ts +531 -0
  192. package/tests/Server/lib/Server.test.ts +12 -0
  193. package/tests/Server/lib/container/GenericHandler.test.ts +131 -0
  194. package/tests/Server/lib/container/GenericHandlerEvent.test.ts +103 -0
  195. package/tests/Server/lib/container/HealthHandler.test.ts +30 -0
  196. package/tests/Server/lib/container/Proxy.test.ts +268 -0
  197. package/tests/Server/lib/container/Utils.test.ts +47 -0
  198. package/tests/Test.utils.ts +78 -0
  199. package/tests/Utils/Utils.test.ts +229 -0
  200. package/tests/Validation/Validator.test.ts +82 -0
  201. package/tsconfig.json +26 -0
  202. package/tsconfig.smoke.json +26 -0
  203. package/index.js +0 -88
  204. package/src/API/IKRequest.js +0 -52
  205. package/src/API/IKResponse.js +0 -119
  206. package/src/API/IKUtils.js +0 -51
  207. package/src/BaseEvent/IKProcess.js +0 -77
  208. package/src/BaseEvent/IKTransaction.js +0 -139
  209. package/src/Cache/Prototype/IKCache.js +0 -17
  210. package/src/Cache/Redis/IKRedis.js +0 -148
  211. package/src/Database/DDB/IKDB.js +0 -56
  212. package/src/Database/DDB/IKDBBaseExpression.js +0 -130
  213. package/src/Database/DDB/IKDBBaseQuery.js +0 -151
  214. package/src/Database/DDB/IKDBQueryBatchGet.js +0 -37
  215. package/src/Database/DDB/IKDBQueryBatchWrite.js +0 -64
  216. package/src/Database/DDB/IKDBQueryDelete.js +0 -34
  217. package/src/Database/DDB/IKDBQueryGet.js +0 -48
  218. package/src/Database/DDB/IKDBQueryPut.js +0 -87
  219. package/src/Database/DDB/IKDBQueryScan.js +0 -45
  220. package/src/Database/DDB/IKDBQueryTransactionalWrite.js +0 -69
  221. package/src/Database/DDB/IKDBQueryUpdate.js +0 -221
  222. package/src/Database/DDB/_IKDBQueryTransactionalRead.js +0 -46
  223. package/src/Database/PSQL/IKDB.js +0 -41
  224. package/src/Database/PSQL/IKDBBaseQuery.js +0 -26
  225. package/src/Database/Prototype/IKDB.js +0 -21
  226. package/src/Database/Prototype/IKDBBaseQuery.js +0 -14
  227. package/src/IKDynamoStream.js +0 -42
  228. package/src/IKEventProcessor.js +0 -42
  229. package/src/IKGlobals.js +0 -24
  230. package/src/IKRouter.js +0 -47
  231. package/src/IKStepTransaction.js +0 -14
  232. package/src/Logger/IKLogger.js +0 -136
  233. package/src/Mailer/IKMailer.js +0 -69
  234. package/src/Publisher/IKPublisher.js +0 -44
  235. package/src/Tracker/IKExecutionTracker.js +0 -79
  236. package/src/Validation/IKValidation.js +0 -76
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Class containing global constants and configurations for the application.
3
+ */
4
+ export default class Globals {
5
+ /**
6
+ * A constant string representing an error message for input validation failure.
7
+ */
8
+ static ErrorResponseValidationFail: string;
9
+ /**
10
+ * A constant string representing an error response for an invalid server response.
11
+ */
12
+ static ErrorResponseInvalidServerResponse: string;
13
+ /**
14
+ * The error message for an unhandled error when processing a request.
15
+ */
16
+ static ErrorResponseUnhandledError: string;
17
+ /**
18
+ * A static string representing an error response when there are no records to be processed.
19
+ */
20
+ static ErrorResponseNoRecords: string;
21
+ /**
22
+ * Represents an error code for a missing parameter.
23
+ * @type {string}
24
+ */
25
+ static ErrorCode_MissingParam: string;
26
+ /**
27
+ * Represents an error code for invalid input.
28
+ * @type {string}
29
+ */
30
+ static ErrorCode_InvalidInput: string;
31
+ /**
32
+ * Represents an error code for an API error.
33
+ * @type {string}
34
+ */
35
+ static ErrorCode_APIError: string;
36
+ /**
37
+ * Represents the error code for when there are no records found.
38
+ * @type {string}
39
+ */
40
+ static ErrorCode_NoRecords: string;
41
+ /**
42
+ * Retrieves the default port number for HTTP listeners.
43
+ * The port number is obtained from the environment variable "PORT" and parsed as an integer.
44
+ * If the environment variable is not set or cannot be parsed as an integer, the default port number 9000 is used.
45
+ * @returns {number} - The default port number for HTTP listeners.
46
+ */
47
+ static Listener_HTTP_DefaultPort: number;
48
+ /**
49
+ * The default host for the HTTP listener.
50
+ */
51
+ static Listener_HTTP_DefaultHost: string;
52
+ /**
53
+ * The HTTP proxy route listener for all routes.
54
+ * @type {string}
55
+ */
56
+ static Listener_HTTP_ProxyRoute: string;
57
+ /**
58
+ * Retrieves the default timeout value for HTTP listeners.
59
+ * @returns {number} The default timeout value in milliseconds.
60
+ */
61
+ static Listener_HTTP_DefaultTimeout: number;
62
+ /**
63
+ * The default health check route for the HTTP listener.
64
+ * @type {string}
65
+ */
66
+ static Listener_HTTP_DefaultHealthCheckRoute: string;
67
+ /**
68
+ * The response message for an exception that occurred during request execution in the Proxy.
69
+ */
70
+ static Resp_MSG_EXCEPTION: string;
71
+ /**
72
+ * The response code for an exception that occurred during execution.
73
+ */
74
+ static Resp_CODE_EXCEPTION: string;
75
+ /**
76
+ * The HTTP response status code for an exception scenario.
77
+ */
78
+ static Resp_STATUSCODE_EXCEPTION: number;
79
+ /**
80
+ * The error message for an invalid response from the server.
81
+ */
82
+ static Resp_MSG_INVALIDRESP: string;
83
+ /**
84
+ * Represents the response code for an invalid response.
85
+ */
86
+ static Resp_CODE_INVALIDRESP: string;
87
+ /**
88
+ * The HTTP response status code for an invalid response.
89
+ * @type {number}
90
+ * @default 400
91
+ */
92
+ static Resp_STATUSCODE_INVALIDRESP: number;
93
+ }
@@ -0,0 +1,99 @@
1
+ import dotenv from 'dotenv';
2
+ import Utils from './Util/Utils.js';
3
+ // important for dev env to load .env file
4
+ dotenv.config();
5
+ /**
6
+ * Class containing global constants and configurations for the application.
7
+ */
8
+ class Globals {
9
+ }
10
+ /**
11
+ * A constant string representing an error message for input validation failure.
12
+ */
13
+ Globals.ErrorResponseValidationFail = 'Input validation failed: '; //400
14
+ /**
15
+ * A constant string representing an error response for an invalid server response.
16
+ */
17
+ Globals.ErrorResponseInvalidServerResponse = 'No valid response, this is a system error.'; //400
18
+ /**
19
+ * The error message for an unhandled error when processing a request.
20
+ */
21
+ Globals.ErrorResponseUnhandledError = 'Unhandled error when processing request.'; //400
22
+ /**
23
+ * A static string representing an error response when there are no records to be processed.
24
+ */
25
+ Globals.ErrorResponseNoRecords = 'No events to be processed.'; //400
26
+ /**
27
+ * Represents an error code for a missing parameter.
28
+ * @type {string}
29
+ */
30
+ Globals.ErrorCode_MissingParam = 'MISSING_PARAM';
31
+ /**
32
+ * Represents an error code for invalid input.
33
+ * @type {string}
34
+ */
35
+ Globals.ErrorCode_InvalidInput = 'INVALID_INPUT';
36
+ /**
37
+ * Represents an error code for an API error.
38
+ * @type {string}
39
+ */
40
+ Globals.ErrorCode_APIError = 'API_ERROR';
41
+ /**
42
+ * Represents the error code for when there are no records found.
43
+ * @type {string}
44
+ */
45
+ Globals.ErrorCode_NoRecords = 'EMPTY_EVENT';
46
+ /**
47
+ * Retrieves the default port number for HTTP listeners.
48
+ * The port number is obtained from the environment variable "PORT" and parsed as an integer.
49
+ * If the environment variable is not set or cannot be parsed as an integer, the default port number 9000 is used.
50
+ * @returns {number} - The default port number for HTTP listeners.
51
+ */
52
+ Globals.Listener_HTTP_DefaultPort = Utils.parseIntNullIfNaN(process.env.PORT) || 9000;
53
+ /**
54
+ * The default host for the HTTP listener.
55
+ */
56
+ Globals.Listener_HTTP_DefaultHost = 'localhost';
57
+ /**
58
+ * The HTTP proxy route listener for all routes.
59
+ * @type {string}
60
+ */
61
+ Globals.Listener_HTTP_ProxyRoute = '*';
62
+ /**
63
+ * Retrieves the default timeout value for HTTP listeners.
64
+ * @returns {number} The default timeout value in milliseconds.
65
+ */
66
+ Globals.Listener_HTTP_DefaultTimeout = Utils.parseIntNullIfNaN(process.env.TIMEOUT) || 30000;
67
+ /**
68
+ * The default health check route for the HTTP listener.
69
+ * @type {string}
70
+ */
71
+ Globals.Listener_HTTP_DefaultHealthCheckRoute = process.env.HEALTH_ROUTE || '/health';
72
+ /**
73
+ * The response message for an exception that occurred during request execution in the Proxy.
74
+ */
75
+ Globals.Resp_MSG_EXCEPTION = '[Proxy]: Exception during request execution!';
76
+ /**
77
+ * The response code for an exception that occurred during execution.
78
+ */
79
+ Globals.Resp_CODE_EXCEPTION = 'EXEC_EXCEPTION';
80
+ /**
81
+ * The HTTP response status code for an exception scenario.
82
+ */
83
+ Globals.Resp_STATUSCODE_EXCEPTION = 502;
84
+ /**
85
+ * The error message for an invalid response from the server.
86
+ */
87
+ Globals.Resp_MSG_INVALIDRESP = '[Proxy]: Invalid response from server!';
88
+ /**
89
+ * Represents the response code for an invalid response.
90
+ */
91
+ Globals.Resp_CODE_INVALIDRESP = 'EMPTY_RESPONSE';
92
+ /**
93
+ * The HTTP response status code for an invalid response.
94
+ * @type {number}
95
+ * @default 400
96
+ */
97
+ Globals.Resp_STATUSCODE_INVALIDRESP = 400;
98
+ export default Globals;
99
+ //# sourceMappingURL=Globals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Globals.js","sourceRoot":"","sources":["../../src/Globals.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,KAAK,MAAM,iBAAiB,CAAA;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf;;GAEG;AACH,MAAqB,OAAO;;AAC1B;;GAEG;AACW,mCAA2B,GAAG,2BAA2B,CAAA,CAAC,KAAK;AAC7E;;GAEG;AACW,0CAAkC,GAAG,4CAA4C,CAAA,CAAC,KAAK;AACrG;;GAEG;AACW,mCAA2B,GAAG,0CAA0C,CAAA,CAAC,KAAK;AAC5F;;GAEG;AACW,8BAAsB,GAAG,4BAA4B,CAAA,CAAC,KAAK;AACzE;;;GAGG;AACW,8BAAsB,GAAG,eAAe,CAAA;AACtD;;;GAGG;AACW,8BAAsB,GAAG,eAAe,CAAA;AACtD;;;GAGG;AACW,0BAAkB,GAAG,WAAW,CAAA;AAC9C;;;GAGG;AACW,2BAAmB,GAAG,aAAa,CAAA;AAEjD;;;;;GAKG;AACW,iCAAyB,GAAG,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;AAC3F;;GAEG;AACW,iCAAyB,GAAG,WAAW,CAAA;AACrD;;;GAGG;AACW,gCAAwB,GAAG,GAAG,CAAA;AAC5C;;;GAGG;AACW,oCAA4B,GAAG,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAA;AAClG;;;GAGG;AACW,6CAAqC,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,SAAS,CAAA;AAE3F;;GAEG;AACW,0BAAkB,GAAG,8CAA8C,CAAA;AACjF;;GAEG;AACW,2BAAmB,GAAG,gBAAgB,CAAA;AACpD;;GAEG;AACW,iCAAyB,GAAG,GAAG,CAAA;AAE7C;;GAEG;AACW,4BAAoB,GAAG,wCAAwC,CAAA;AAC7E;;GAEG;AACW,6BAAqB,GAAG,gBAAgB,CAAA;AACtD;;;;GAIG;AACW,mCAA2B,GAAG,GAAG,CAAA;eA3F5B,OAAO"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Enumeration of log levels.
3
+ * @enum {string}
4
+ * @property {string} DEBUG - Debug log level.
5
+ * @property {string} INFO - Info log level.
6
+ * @property {string} WARN - Warning log level.
7
+ * @property {string} ERROR - Error log level.
8
+ */
9
+ export declare enum LOG_LEVELS {
10
+ DEBUG = "DEBUG",
11
+ INFO = "INFO",
12
+ WARN = "WARN",
13
+ ERROR = "ERROR"
14
+ }
15
+ /**
16
+ * Configuration options for the logger.
17
+ * @typedef {Object} LoggerConfig
18
+ * @property {boolean | Array<string>} [sensitiveFilteringKeywords] - Specifies whether to filter sensitive keywords in log messages. Can be a boolean value or an array of strings.
19
+ * @property {LOG_LEVELS | string} [logLevel] - The log level to use for logging. Can be one of the predefined log levels or a custom string value.
20
+ */
21
+ export type LoggerConfig = {
22
+ sensitiveFilteringKeywords?: boolean | Array<string>;
23
+ logLevel?: LOG_LEVELS | string;
24
+ };
25
+ /**
26
+ * Logger class for logging messages with different log levels.
27
+ */
28
+ export default class Logger {
29
+ /**
30
+ * The optional configuration object for the logger.
31
+ */
32
+ private config?;
33
+ /**
34
+ * Private property representing the transaction ID.
35
+ * @type {string}
36
+ * @private
37
+ */
38
+ private transactionID;
39
+ /**
40
+ * An array of strings representing a blacklist of filters
41
+ */
42
+ private filterBlacklist;
43
+ /**
44
+ * The current log level for the application.
45
+ * @private
46
+ * @type {LOG_LEVELS}
47
+ */
48
+ private _LOG_LEVEL;
49
+ /**
50
+ * The origin of the object.
51
+ * @private
52
+ * @type {any}
53
+ */
54
+ private origin;
55
+ /**
56
+ * Constructs a Logger object with the given configuration and transaction ID.
57
+ * @param {config} config - The configuration object for the logger. Can be undefined.
58
+ * @param {string} transactionID - The ID of the transaction associated with the logger.
59
+ * @returns None
60
+ */
61
+ constructor(config: LoggerConfig | undefined, transactionID: string);
62
+ /**
63
+ * Returns a boolean value indicating whether the notGlobalLogger function is executed successfully.
64
+ * @returns {boolean} - true if the function is executed successfully, false otherwise.
65
+ */
66
+ notGlobalLogger(): boolean;
67
+ /**
68
+ * Logs the given arguments with the debug log level.
69
+ * @param {...any} args - The arguments to be logged.
70
+ * @returns None
71
+ */
72
+ debug(...args: any[]): void;
73
+ /**
74
+ * Logs the given arguments with the INFO log level.
75
+ * @param {...any} args - The arguments to be logged.
76
+ * @returns None
77
+ */
78
+ log(...args: any[]): void;
79
+ /**
80
+ * Logs an informational message.
81
+ * @param {...any} args - The message(s) to log.
82
+ * @returns None
83
+ */
84
+ info(...args: any[]): void;
85
+ /**
86
+ * Logs a warning message with the provided arguments.
87
+ * @param {...any} args - The arguments to be logged as a warning message.
88
+ * @returns None
89
+ */
90
+ warning(...args: any[]): void;
91
+ /**
92
+ * Logs a warning message to the console.
93
+ * @param {...any} args - The arguments to be logged.
94
+ * @returns None
95
+ */
96
+ warn(...args: any[]): void;
97
+ /**
98
+ * Logs an error message with the given arguments.
99
+ * @param {...any} args - The arguments to log as an error message.
100
+ * @returns None
101
+ */
102
+ error(...args: any[]): void;
103
+ /**
104
+ * Logs an exception with optional additional arguments.
105
+ * @param {any} exception - The exception to log.
106
+ * @param {...any} args - Additional arguments to include in the log.
107
+ * @returns None
108
+ */
109
+ exception(exception: any, ...args: any[]): void;
110
+ /**
111
+ * Sets up the console bindings for logging purposes.
112
+ * @private
113
+ * @returns None
114
+ */
115
+ private setupBindings;
116
+ /**
117
+ * Formats a log message with the specified log level, message, and caller.
118
+ * @param {LOG_LEVELS} level - The log level of the message.
119
+ * @param {Array<string>} msg - An array of strings representing the message.
120
+ * @param {string} caller - The name of the caller function.
121
+ * @returns {string} - The formatted log message.
122
+ */
123
+ private formattedLog;
124
+ /**
125
+ * Retrieves the name of the caller function at the specified index in the stack trace.
126
+ * @param {number} index - The index of the caller function in the stack trace.
127
+ * @returns {string} The name of the caller function along with the file path and line number.
128
+ */
129
+ private callerName;
130
+ /**
131
+ * Processes log messages based on the specified log level.
132
+ * @param {LOG_LEVELS} level - The level of the log message.
133
+ * @param {any} args - The arguments to be logged.
134
+ * @returns None
135
+ */
136
+ private processLog;
137
+ private formatArgument;
138
+ /**
139
+ * Logs an exception along with additional arguments and the stack trace.
140
+ * @param {Error} exception - The exception object to log.
141
+ * @param {...any} args - Additional arguments to include in the log.
142
+ * @returns None
143
+ */
144
+ private iexception;
145
+ /**
146
+ * Pushes a log message to the console with the specified log level.
147
+ * @param {LOG_LEVELS} level - The log level of the message.
148
+ * @param {string} fMsg - The formatted log message.
149
+ * @returns None
150
+ */
151
+ private pushLog;
152
+ /**
153
+ * Suppresses sensitive information in the given value based on the filter blacklist.
154
+ * @param {any} value - The value to suppress sensitive information from.
155
+ * @returns {string} - The value with sensitive information suppressed.
156
+ */
157
+ private suppressSensitiveInfo;
158
+ private suppressSensitiveInfoItem;
159
+ private suppressSensitiveString;
160
+ private suppressSensitiveObject;
161
+ }
@@ -0,0 +1,299 @@
1
+ import abind from 'abind';
2
+ import stringify from 'json-stringify-safe';
3
+ import stackTrace from 'stack-trace';
4
+ import Utils from '../Util/Utils.js';
5
+ /**
6
+ * Enumeration of log levels.
7
+ * @enum {string}
8
+ * @property {string} DEBUG - Debug log level.
9
+ * @property {string} INFO - Info log level.
10
+ * @property {string} WARN - Warning log level.
11
+ * @property {string} ERROR - Error log level.
12
+ */
13
+ export var LOG_LEVELS;
14
+ (function (LOG_LEVELS) {
15
+ LOG_LEVELS["DEBUG"] = "DEBUG";
16
+ LOG_LEVELS["INFO"] = "INFO";
17
+ LOG_LEVELS["WARN"] = "WARN";
18
+ LOG_LEVELS["ERROR"] = "ERROR";
19
+ })(LOG_LEVELS || (LOG_LEVELS = {}));
20
+ /**
21
+ * A constant that represents the console object to be used for logging.
22
+ * If the console object has a property named 'notGlobalLogger', it is assumed
23
+ * to be a custom logger and the 'origin' property is used as the console object.
24
+ * Otherwise, the global console object is used.
25
+ * @type {Console}
26
+ */
27
+ const PURE_CONSOLE = console['notGlobalLogger'] ? console['origin'] : console;
28
+ /**
29
+ * The default log function that is used for logging messages.
30
+ * @type {Function}
31
+ */
32
+ const DEFAULT_LOG_FUNCTION = PURE_CONSOLE.log.bind(PURE_CONSOLE);
33
+ /**
34
+ * Creates a blacklist array by mapping each string in the given array to its lowercase form.
35
+ * The resulting blacklist array is used to filter out sensitive information.
36
+ * @type {string[]} blacklist - An array of strings to be converted to lowercase and used as a blacklist.
37
+ * @returns {string[]} - An array of lowercase strings representing the blacklist.
38
+ */
39
+ const blacklist = ['password', 'token', 'accounts', 'rawBody'].map(s => s.toLowerCase());
40
+ /* Used to have a clean log */
41
+ const defaultSuppress = ['rawBody'].map(s => s.toLowerCase());
42
+ /**
43
+ * Logger class for logging messages with different log levels.
44
+ */
45
+ export default class Logger {
46
+ /**
47
+ * Constructs a Logger object with the given configuration and transaction ID.
48
+ * @param {config} config - The configuration object for the logger. Can be undefined.
49
+ * @param {string} transactionID - The ID of the transaction associated with the logger.
50
+ * @returns None
51
+ */
52
+ constructor(config, transactionID) {
53
+ abind(this);
54
+ //
55
+ this.origin = PURE_CONSOLE;
56
+ this._LOG_LEVEL = (config === null || config === void 0 ? void 0 : config.logLevel)
57
+ ? LOG_LEVELS[config === null || config === void 0 ? void 0 : config.logLevel] || LOG_LEVELS.DEBUG
58
+ : LOG_LEVELS.DEBUG;
59
+ this.config = config || {};
60
+ this.transactionID = transactionID;
61
+ this.filterBlacklist = this.config.sensitiveFilteringKeywords
62
+ ? Array.isArray(this.config.sensitiveFilteringKeywords)
63
+ ? this.config.sensitiveFilteringKeywords
64
+ : blacklist
65
+ : defaultSuppress;
66
+ //
67
+ this.setupBindings();
68
+ //
69
+ this.log('Using logger with level: ' + this._LOG_LEVEL.toString());
70
+ this.debug('logger config: ', this.config);
71
+ }
72
+ /**
73
+ * Returns a boolean value indicating whether the notGlobalLogger function is executed successfully.
74
+ * @returns {boolean} - true if the function is executed successfully, false otherwise.
75
+ */
76
+ notGlobalLogger() {
77
+ return true;
78
+ }
79
+ /**
80
+ * Logs the given arguments with the debug log level.
81
+ * @param {...any} args - The arguments to be logged.
82
+ * @returns None
83
+ */
84
+ debug(...args) {
85
+ this.processLog(LOG_LEVELS.DEBUG, args);
86
+ }
87
+ /**
88
+ * Logs the given arguments with the INFO log level.
89
+ * @param {...any} args - The arguments to be logged.
90
+ * @returns None
91
+ */
92
+ log(...args) {
93
+ this.processLog(LOG_LEVELS.INFO, args);
94
+ }
95
+ /**
96
+ * Logs an informational message.
97
+ * @param {...any} args - The message(s) to log.
98
+ * @returns None
99
+ */
100
+ info(...args) {
101
+ this.processLog(LOG_LEVELS.INFO, args);
102
+ }
103
+ /**
104
+ * Logs a warning message with the provided arguments.
105
+ * @param {...any} args - The arguments to be logged as a warning message.
106
+ * @returns None
107
+ */
108
+ warning(...args) {
109
+ this.processLog(LOG_LEVELS.WARN, args);
110
+ }
111
+ /**
112
+ * Logs a warning message to the console.
113
+ * @param {...any} args - The arguments to be logged.
114
+ * @returns None
115
+ */
116
+ warn(...args) {
117
+ this.processLog(LOG_LEVELS.WARN, args);
118
+ }
119
+ /**
120
+ * Logs an error message with the given arguments.
121
+ * @param {...any} args - The arguments to log as an error message.
122
+ * @returns None
123
+ */
124
+ error(...args) {
125
+ this.processLog(LOG_LEVELS.ERROR, args);
126
+ }
127
+ /**
128
+ * Logs an exception with optional additional arguments.
129
+ * @param {any} exception - The exception to log.
130
+ * @param {...any} args - Additional arguments to include in the log.
131
+ * @returns None
132
+ */
133
+ exception(exception, ...args) {
134
+ this.iexception(exception, args);
135
+ }
136
+ /**
137
+ * Sets up the console bindings for logging purposes.
138
+ * @private
139
+ * @returns None
140
+ */
141
+ setupBindings() {
142
+ global.console = {
143
+ debug: (...args) => this.processLog(LOG_LEVELS.DEBUG, args),
144
+ log: (...args) => this.processLog(LOG_LEVELS.INFO, args),
145
+ info: (...args) => this.processLog(LOG_LEVELS.INFO, args),
146
+ warn: (...args) => this.processLog(LOG_LEVELS.WARN, args),
147
+ error: (...args) => this.processLog(LOG_LEVELS.ERROR, args),
148
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
149
+ // @ts-ignore
150
+ warning: (...args) => this.processLog(LOG_LEVELS.WARN, args),
151
+ exception: (exception, ...args) => this.iexception(exception, args),
152
+ };
153
+ }
154
+ /**
155
+ * Formats a log message with the specified log level, message, and caller.
156
+ * @param {LOG_LEVELS} level - The log level of the message.
157
+ * @param {Array<string>} msg - An array of strings representing the message.
158
+ * @param {string} caller - The name of the caller function.
159
+ * @returns {string} - The formatted log message.
160
+ */
161
+ formattedLog(level, msg, caller) {
162
+ if (Utils.isHybridlessContainer() && this.transactionID) {
163
+ return `${this.transactionID}` + ` [${level.toString()}] [${caller}] ${msg.join(' ')}`;
164
+ }
165
+ else {
166
+ return `[${level.toString()}] [${caller}] ${msg.join(' ')}`;
167
+ }
168
+ }
169
+ /**
170
+ * Retrieves the name of the caller function at the specified index in the stack trace.
171
+ * @param {number} index - The index of the caller function in the stack trace.
172
+ * @returns {string} The name of the caller function along with the file path and line number.
173
+ */
174
+ callerName(index) {
175
+ var _a, _b, _c, _d, _e, _f;
176
+ const safeIndex = Math.min(index, stackTrace.get().length);
177
+ if (stackTrace.get()[safeIndex]) {
178
+ let callerName = (_c = (_b = (_a = stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.get()) === null || _a === void 0 ? void 0 : _a[safeIndex]) === null || _b === void 0 ? void 0 : _b.getFileName()) === null || _c === void 0 ? void 0 : _c.split('/');
179
+ callerName = (_d = callerName === null || callerName === void 0 ? void 0 : callerName.slice(callerName === null || callerName === void 0 ? void 0 : callerName.indexOf('src'))) === null || _d === void 0 ? void 0 : _d.join('/');
180
+ return callerName + ':' + ((_f = (_e = stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.get()) === null || _e === void 0 ? void 0 : _e[safeIndex]) === null || _f === void 0 ? void 0 : _f.getLineNumber());
181
+ }
182
+ return '';
183
+ }
184
+ /**
185
+ * Processes log messages based on the specified log level.
186
+ * @param {LOG_LEVELS} level - The level of the log message.
187
+ * @param {any} args - The arguments to be logged.
188
+ * @returns None
189
+ */
190
+ processLog(level, args) {
191
+ if (level < this._LOG_LEVEL)
192
+ return;
193
+ //get args
194
+ const msg = [];
195
+ for (const arg of args) {
196
+ // Deep clone object so we dont modify source
197
+ const fMsg = this.formatArgument(arg);
198
+ msg.push(fMsg);
199
+ }
200
+ //push into logs stack
201
+ // todo: improve error stack
202
+ this.pushLog(level, this.formattedLog(level, msg, this.callerName(3)));
203
+ }
204
+ formatArgument(arg) {
205
+ if (arg instanceof Error) {
206
+ return arg.message + '\n' + arg.stack;
207
+ }
208
+ if (arg && typeof arg === 'object') {
209
+ return stringify(this.suppressSensitiveInfo(JSON.parse(stringify(arg))), null, 2);
210
+ }
211
+ return `${this.suppressSensitiveInfo(arg)}`;
212
+ }
213
+ /**
214
+ * Logs an exception along with additional arguments and the stack trace.
215
+ * @param {Error} exception - The exception object to log.
216
+ * @param {...any} args - Additional arguments to include in the log.
217
+ * @returns None
218
+ */
219
+ iexception(exception, ...args) {
220
+ //format message
221
+ const msg = [];
222
+ //push exeception
223
+ msg.push(exception.toString() + ' -');
224
+ //get args
225
+ for (const arg of args)
226
+ if (arg != exception)
227
+ msg.push(arg);
228
+ if (exception.stack)
229
+ msg.push(exception.stack); //push Exeception stack at the end
230
+ //push into logs stack
231
+ this.pushLog(LOG_LEVELS.ERROR, this.formattedLog(LOG_LEVELS.ERROR, msg, this.callerName(3)));
232
+ }
233
+ /**
234
+ * Pushes a log message to the console with the specified log level.
235
+ * @param {LOG_LEVELS} level - The log level of the message.
236
+ * @param {string} fMsg - The formatted log message.
237
+ * @returns None
238
+ */
239
+ pushLog(level, fMsg) {
240
+ DEFAULT_LOG_FUNCTION.apply(PURE_CONSOLE, [fMsg]);
241
+ }
242
+ /**
243
+ * Suppresses sensitive information in the given value based on the filter blacklist.
244
+ * @param {any} value - The value to suppress sensitive information from.
245
+ * @returns {string} - The value with sensitive information suppressed.
246
+ */
247
+ suppressSensitiveInfo(value) {
248
+ if (!value || !this.filterBlacklist.length)
249
+ return value;
250
+ const parent = [value];
251
+ const stack = [{ value, parent, key: 0 }];
252
+ while (stack.length > 0) {
253
+ this.suppressSensitiveInfoItem(stack.pop(), stack.push.bind(stack));
254
+ }
255
+ return parent[0];
256
+ }
257
+ suppressSensitiveInfoItem({ value, parent, key }, push) {
258
+ if (!value)
259
+ return;
260
+ if (typeof value === 'string') {
261
+ this.suppressSensitiveString({ value, parent, key }, push);
262
+ }
263
+ else if (Array.isArray(value)) {
264
+ value.forEach((v, index) => push({ value: v, parent: value, key: index }));
265
+ }
266
+ else if (typeof value === 'object') {
267
+ this.suppressSensitiveObject(value, push);
268
+ }
269
+ }
270
+ suppressSensitiveString({ value, parent, key }, push) {
271
+ var _a;
272
+ let modifiedValue = value;
273
+ try {
274
+ // Try to parse json string
275
+ modifiedValue = JSON.parse(value);
276
+ push({ value: modifiedValue, parent, key });
277
+ }
278
+ catch (_b) {
279
+ const lower = value.toLowerCase();
280
+ if (this.filterBlacklist.some(f => lower == f))
281
+ modifiedValue = `**SUPPRESSED_SENSITIVE_DATA** (${((_a = String(modifiedValue)) === null || _a === void 0 ? void 0 : _a.length) || 0} len)`;
282
+ }
283
+ parent[key] = modifiedValue;
284
+ }
285
+ suppressSensitiveObject(value, push) {
286
+ Object.entries(value).forEach(([k, v]) => {
287
+ var _a;
288
+ const lower = k.toLowerCase();
289
+ const match = v && this.filterBlacklist.some(f => lower == f);
290
+ if (match) {
291
+ value[k] = `**SUPPRESSED_SENSITIVE_DATA** (${((_a = String(v)) === null || _a === void 0 ? void 0 : _a.length) || 0} len)`;
292
+ }
293
+ else {
294
+ push({ value: v, parent: value, key: k });
295
+ }
296
+ });
297
+ }
298
+ }
299
+ //# sourceMappingURL=Logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/Logger/Logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAC3C,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,OAAO,KAAK,MAAM,kBAAkB,CAAA;AAEpC;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,6BAAe,CAAA;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