@venizia/ignis-helpers 0.0.1-2 → 0.0.1-4

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 (150) hide show
  1. package/LICENSE.md +102 -0
  2. package/README.md +43 -0
  3. package/dist/common/constants/app.d.ts +1 -1
  4. package/dist/common/constants/app.js +8 -8
  5. package/dist/common/constants/http.d.ts +1 -1
  6. package/dist/common/constants/http.js +13 -13
  7. package/dist/common/constants/index.d.ts +3 -3
  8. package/dist/common/constants/mime.d.ts +1 -1
  9. package/dist/common/constants/mime.js +4 -4
  10. package/dist/common/index.d.ts +2 -2
  11. package/dist/common/types.d.ts +13 -13
  12. package/dist/common/types.js +2 -2
  13. package/dist/helpers/base.d.ts +1 -1
  14. package/dist/helpers/base.js +3 -3
  15. package/dist/helpers/cron/cron.helper.d.ts +2 -2
  16. package/dist/helpers/cron/cron.helper.js +2 -2
  17. package/dist/helpers/cron/index.d.ts +1 -1
  18. package/dist/helpers/crypto/algorithms/aes.algorithm.d.ts +3 -3
  19. package/dist/helpers/crypto/algorithms/aes.algorithm.js +10 -10
  20. package/dist/helpers/crypto/algorithms/base.algorithm.d.ts +2 -2
  21. package/dist/helpers/crypto/algorithms/base.algorithm.js +1 -1
  22. package/dist/helpers/crypto/algorithms/index.d.ts +3 -3
  23. package/dist/helpers/crypto/algorithms/rsa.algorithm.d.ts +3 -3
  24. package/dist/helpers/crypto/algorithms/rsa.algorithm.js +10 -10
  25. package/dist/helpers/crypto/common/index.d.ts +2 -2
  26. package/dist/helpers/crypto/index.d.ts +2 -2
  27. package/dist/helpers/env/app-env.d.ts +1 -1
  28. package/dist/helpers/env/app-env.js +9 -9
  29. package/dist/helpers/env/index.d.ts +2 -2
  30. package/dist/helpers/error/app-error.d.ts +1 -1
  31. package/dist/helpers/error/index.d.ts +2 -2
  32. package/dist/helpers/error/types.d.ts +1 -1
  33. package/dist/helpers/error/types.js +5 -5
  34. package/dist/helpers/index.d.ts +14 -14
  35. package/dist/helpers/inversion/common/index.d.ts +2 -2
  36. package/dist/helpers/inversion/common/keys.js +6 -6
  37. package/dist/helpers/inversion/common/types.d.ts +4 -4
  38. package/dist/helpers/inversion/container.d.ts +2 -2
  39. package/dist/helpers/inversion/index.d.ts +4 -4
  40. package/dist/helpers/inversion/registry.d.ts +2 -2
  41. package/dist/helpers/logger/application-logger.d.ts +2 -2
  42. package/dist/helpers/logger/application-logger.js +8 -8
  43. package/dist/helpers/logger/default-logger.d.ts +3 -3
  44. package/dist/helpers/logger/default-logger.js +23 -23
  45. package/dist/helpers/logger/factory.d.ts +1 -1
  46. package/dist/helpers/logger/factory.js +1 -1
  47. package/dist/helpers/logger/index.d.ts +5 -5
  48. package/dist/helpers/logger/transports/dgram.transport.d.ts +2 -2
  49. package/dist/helpers/logger/transports/dgram.transport.js +5 -5
  50. package/dist/helpers/logger/transports/index.d.ts +1 -1
  51. package/dist/helpers/logger/types.d.ts +1 -1
  52. package/dist/helpers/logger/types.js +9 -9
  53. package/dist/helpers/network/http-request/base-network-request.helper.d.ts +12 -12
  54. package/dist/helpers/network/http-request/base-network-request.helper.js +10 -10
  55. package/dist/helpers/network/http-request/fetcher/axios-fetcher.d.ts +5 -5
  56. package/dist/helpers/network/http-request/fetcher/axios-fetcher.js +5 -5
  57. package/dist/helpers/network/http-request/fetcher/base-fetcher.d.ts +1 -1
  58. package/dist/helpers/network/http-request/fetcher/base-fetcher.js +8 -8
  59. package/dist/helpers/network/http-request/fetcher/index.d.ts +3 -3
  60. package/dist/helpers/network/http-request/fetcher/node-fetcher.d.ts +2 -2
  61. package/dist/helpers/network/http-request/fetcher/node-fetcher.js +6 -6
  62. package/dist/helpers/network/http-request/index.d.ts +2 -2
  63. package/dist/helpers/network/http-request/types.d.ts +4 -4
  64. package/dist/helpers/network/index.d.ts +3 -3
  65. package/dist/helpers/network/tcp-socket/base-tcp-client.helper.d.ts +4 -4
  66. package/dist/helpers/network/tcp-socket/base-tcp-client.helper.js +17 -17
  67. package/dist/helpers/network/tcp-socket/base-tcp-server.helper.d.ts +6 -6
  68. package/dist/helpers/network/tcp-socket/base-tcp-server.helper.js +18 -18
  69. package/dist/helpers/network/tcp-socket/index.d.ts +6 -6
  70. package/dist/helpers/network/tcp-socket/network-tcp-client.helper.d.ts +4 -4
  71. package/dist/helpers/network/tcp-socket/network-tcp-server.helper.d.ts +4 -4
  72. package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.d.ts +4 -4
  73. package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.d.ts +4 -4
  74. package/dist/helpers/network/udp-socket/index.d.ts +1 -1
  75. package/dist/helpers/network/udp-socket/network-udp-client.helper.d.ts +3 -3
  76. package/dist/helpers/network/udp-socket/network-udp-client.helper.js +14 -14
  77. package/dist/helpers/queue/bullmq/helper.d.ts +4 -4
  78. package/dist/helpers/queue/bullmq/helper.js +10 -10
  79. package/dist/helpers/queue/bullmq/index.d.ts +1 -1
  80. package/dist/helpers/queue/common/index.d.ts +1 -1
  81. package/dist/helpers/queue/common/types.d.ts +1 -1
  82. package/dist/helpers/queue/index.d.ts +4 -4
  83. package/dist/helpers/queue/internal/helper.d.ts +3 -3
  84. package/dist/helpers/queue/internal/helper.js +11 -11
  85. package/dist/helpers/queue/internal/index.d.ts +1 -1
  86. package/dist/helpers/queue/mqtt/helper.d.ts +2 -2
  87. package/dist/helpers/queue/mqtt/helper.js +8 -8
  88. package/dist/helpers/queue/mqtt/index.d.ts +1 -1
  89. package/dist/helpers/redis/cluster.helper.d.ts +3 -3
  90. package/dist/helpers/redis/default.helper.d.ts +3 -3
  91. package/dist/helpers/redis/default.helper.js +40 -40
  92. package/dist/helpers/redis/index.d.ts +4 -4
  93. package/dist/helpers/redis/single.helper.d.ts +3 -3
  94. package/dist/helpers/redis/types.d.ts +3 -3
  95. package/dist/helpers/socket-io/client/helper.d.ts +3 -3
  96. package/dist/helpers/socket-io/client/helper.js +8 -8
  97. package/dist/helpers/socket-io/client/index.d.ts +1 -1
  98. package/dist/helpers/socket-io/common/constants.js +10 -10
  99. package/dist/helpers/socket-io/common/index.d.ts +2 -2
  100. package/dist/helpers/socket-io/common/types.d.ts +6 -6
  101. package/dist/helpers/socket-io/index.d.ts +3 -3
  102. package/dist/helpers/socket-io/server/helper.d.ts +3 -3
  103. package/dist/helpers/socket-io/server/helper.js +41 -41
  104. package/dist/helpers/socket-io/server/index.d.ts +1 -1
  105. package/dist/helpers/storage/in-memory/helper.d.ts +2 -2
  106. package/dist/helpers/storage/in-memory/index.d.ts +1 -1
  107. package/dist/helpers/storage/index.d.ts +2 -2
  108. package/dist/helpers/storage/minio/helper.d.ts +3 -3
  109. package/dist/helpers/storage/minio/helper.js +7 -7
  110. package/dist/helpers/storage/minio/index.d.ts +1 -1
  111. package/dist/helpers/testing/base-test-plan.d.ts +2 -2
  112. package/dist/helpers/testing/base-test-plan.js +4 -4
  113. package/dist/helpers/testing/common/constants.d.ts +1 -1
  114. package/dist/helpers/testing/common/constants.js +3 -3
  115. package/dist/helpers/testing/common/index.d.ts +2 -2
  116. package/dist/helpers/testing/common/types.d.ts +3 -3
  117. package/dist/helpers/testing/describe.d.ts +2 -2
  118. package/dist/helpers/testing/describe.js +5 -5
  119. package/dist/helpers/testing/index.d.ts +6 -6
  120. package/dist/helpers/testing/test-case.d.ts +3 -3
  121. package/dist/helpers/testing/test-case.js +1 -1
  122. package/dist/helpers/testing/test-handler.d.ts +3 -3
  123. package/dist/helpers/testing/test-handler.js +2 -2
  124. package/dist/helpers/testing/test-plan.d.ts +2 -2
  125. package/dist/helpers/worker-thread/base.d.ts +6 -6
  126. package/dist/helpers/worker-thread/base.js +15 -15
  127. package/dist/helpers/worker-thread/base.js.map +1 -1
  128. package/dist/helpers/worker-thread/index.d.ts +4 -4
  129. package/dist/helpers/worker-thread/types.d.ts +2 -2
  130. package/dist/helpers/worker-thread/worker-bus.d.ts +4 -4
  131. package/dist/helpers/worker-thread/worker-bus.d.ts.map +1 -1
  132. package/dist/helpers/worker-thread/worker-bus.js +14 -9
  133. package/dist/helpers/worker-thread/worker-bus.js.map +1 -1
  134. package/dist/helpers/worker-thread/worker-pool.d.ts +2 -2
  135. package/dist/helpers/worker-thread/worker-pool.js +6 -6
  136. package/dist/index.d.ts +4 -4
  137. package/dist/utilities/crypto.utility.d.ts +1 -1
  138. package/dist/utilities/crypto.utility.js +2 -2
  139. package/dist/utilities/date.utility.d.ts +1 -1
  140. package/dist/utilities/date.utility.js +6 -6
  141. package/dist/utilities/index.d.ts +7 -7
  142. package/dist/utilities/module.utility.js +2 -2
  143. package/dist/utilities/parse.utility.js +18 -18
  144. package/dist/utilities/performance.utility.d.ts +1 -1
  145. package/dist/utilities/performance.utility.js +5 -5
  146. package/dist/utilities/promise.utility.d.ts +1 -1
  147. package/dist/utilities/promise.utility.js +3 -3
  148. package/dist/utilities/request.utility.d.ts +1 -1
  149. package/dist/utilities/request.utility.js +7 -7
  150. package/package.json +23 -29
@@ -1,2 +1,2 @@
1
- export * from "./helper";
1
+ export * from './helper';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SocketIOConstants = void 0;
4
4
  class SocketIOConstants {
5
- static { this.EVENT_PING = "ping"; }
6
- static { this.EVENT_CONNECT = "connection"; }
7
- static { this.EVENT_DISCONNECT = "disconnect"; }
8
- static { this.EVENT_JOIN = "join"; }
9
- static { this.EVENT_LEAVE = "leave"; }
10
- static { this.EVENT_AUTHENTICATE = "authenticate"; }
11
- static { this.EVENT_AUTHENTICATED = "authenticated"; }
12
- static { this.EVENT_UNAUTHENTICATE = "unauthenticated"; }
13
- static { this.ROOM_DEFAULT = "io-default"; }
14
- static { this.ROOM_NOTIFICATION = "io-notification"; }
5
+ static { this.EVENT_PING = 'ping'; }
6
+ static { this.EVENT_CONNECT = 'connection'; }
7
+ static { this.EVENT_DISCONNECT = 'disconnect'; }
8
+ static { this.EVENT_JOIN = 'join'; }
9
+ static { this.EVENT_LEAVE = 'leave'; }
10
+ static { this.EVENT_AUTHENTICATE = 'authenticate'; }
11
+ static { this.EVENT_AUTHENTICATED = 'authenticated'; }
12
+ static { this.EVENT_UNAUTHENTICATE = 'unauthenticated'; }
13
+ static { this.ROOM_DEFAULT = 'io-default'; }
14
+ static { this.ROOM_NOTIFICATION = 'io-notification'; }
15
15
  }
16
16
  exports.SocketIOConstants = SocketIOConstants;
17
17
  //# sourceMappingURL=constants.js.map
@@ -1,3 +1,3 @@
1
- export * from "./constants";
2
- export * from "./types";
1
+ export * from './constants';
2
+ export * from './types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,9 @@
1
- import { IncomingHttpHeaders } from "node:http";
2
- import { ParsedUrlQuery } from "node:querystring";
3
- import { SocketOptions } from "socket.io-client";
4
- import { Server as HTTPServer } from "node:http";
5
- import { Socket as IOSocket, ServerOptions } from "socket.io";
6
- import { DefaultRedisHelper } from "../../../helpers/redis";
1
+ import { IncomingHttpHeaders } from 'node:http';
2
+ import { ParsedUrlQuery } from 'node:querystring';
3
+ import { SocketOptions } from 'socket.io-client';
4
+ import { Server as HTTPServer } from 'node:http';
5
+ import { Socket as IOSocket, ServerOptions } from 'socket.io';
6
+ import { DefaultRedisHelper } from '../../../helpers/redis';
7
7
  export interface IHandshake {
8
8
  headers: IncomingHttpHeaders;
9
9
  time: string;
@@ -1,4 +1,4 @@
1
- export * from "./client";
2
- export * from "./common";
3
- export * from "./server";
1
+ export * from './client';
2
+ export * from './common';
3
+ export * from './server';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
- import { BaseHelper } from "../../../helpers/base";
2
- import { Server as IOServer, Socket as IOSocket } from "socket.io";
3
- import { ISocketIOServerOptions } from "../common";
1
+ import { BaseHelper } from '../../../helpers/base';
2
+ import { Server as IOServer, Socket as IOSocket } from 'socket.io';
3
+ import { ISocketIOServerOptions } from '../common';
4
4
  export declare class SocketIOServerHelper extends BaseHelper {
5
5
  private server;
6
6
  private serverOptions;
@@ -32,7 +32,7 @@ class SocketIOServerHelper extends base_1.BaseHelper {
32
32
  if (!opts.server) {
33
33
  throw (0, error_1.getError)({
34
34
  statusCode: 500,
35
- message: "[SocketIOServerHelper] Invalid server and lb-application to initialize io-socket server!",
35
+ message: '[SocketIOServerHelper] Invalid server and lb-application to initialize io-socket server!',
36
36
  });
37
37
  }
38
38
  this.server = opts.server;
@@ -40,7 +40,7 @@ class SocketIOServerHelper extends base_1.BaseHelper {
40
40
  if (!this.redisConnection) {
41
41
  throw (0, error_1.getError)({
42
42
  statusCode: 500,
43
- message: "Invalid redis connection to config socket.io adapter!",
43
+ message: 'Invalid redis connection to config socket.io adapter!',
44
44
  });
45
45
  }
46
46
  this.configure();
@@ -60,10 +60,10 @@ class SocketIOServerHelper extends base_1.BaseHelper {
60
60
  on(opts) {
61
61
  const { topic, handler } = opts;
62
62
  if (!topic || !handler) {
63
- throw (0, error_1.getError)({ message: "[on] Invalid topic or event handler!" });
63
+ throw (0, error_1.getError)({ message: '[on] Invalid topic or event handler!' });
64
64
  }
65
65
  if (!this.io) {
66
- throw (0, error_1.getError)({ message: "[on] IOServer is not initialized yet!" });
66
+ throw (0, error_1.getError)({ message: '[on] IOServer is not initialized yet!' });
67
67
  }
68
68
  this.io.on(topic, handler);
69
69
  }
@@ -77,78 +77,78 @@ class SocketIOServerHelper extends base_1.BaseHelper {
77
77
  'socket.io',
78
78
  ],
79
79
  }); */
80
- this.logger.info("[configure][%s] Configuring IO Server", this.identifier);
80
+ this.logger.info('[configure][%s] Configuring IO Server', this.identifier);
81
81
  if (!this.server) {
82
82
  throw (0, error_1.getError)({
83
83
  statusCode: 500,
84
- message: "[DANGER] Invalid server instance to init Socket.io server!",
84
+ message: '[DANGER] Invalid server instance to init Socket.io server!',
85
85
  });
86
86
  }
87
87
  this.io = new socket_io_1.Server(this.server, this.serverOptions);
88
88
  // Config socket.io redis adapter
89
89
  this.io.adapter((0, redis_adapter_1.createAdapter)(this.redisConnection.getClient().duplicate(), // Redis PUB Client
90
90
  this.redisConnection.getClient().duplicate()));
91
- this.logger.info("[configure] SocketIO Server initialized Redis Adapter");
91
+ this.logger.info('[configure] SocketIO Server initialized Redis Adapter');
92
92
  // Config socket.io redis emitter
93
93
  this.emitter = new redis_emitter_1.Emitter(this.redisConnection.getClient().duplicate());
94
- this.emitter.redisClient.on("error", (error) => {
95
- this.logger.error("[configure][Emitter] On Error: %j", error);
94
+ this.emitter.redisClient.on('error', (error) => {
95
+ this.logger.error('[configure][Emitter] On Error: %j', error);
96
96
  });
97
- this.logger.info("[configure] SocketIO Server initialized Redis Emitter!");
97
+ this.logger.info('[configure] SocketIO Server initialized Redis Emitter!');
98
98
  // Handle socket.io new connection
99
99
  this.io.on(common_1.SocketIOConstants.EVENT_CONNECT, (socket) => {
100
100
  this.onClientConnect({ socket });
101
101
  });
102
- this.logger.info("[configure] SocketIO Server READY | Path: %s | Address: %j", this.serverOptions?.path ?? "", this.server?.address());
103
- this.logger.debug("[configure] Whether http listening: %s", this.server?.listening);
102
+ this.logger.info('[configure] SocketIO Server READY | Path: %s | Address: %j', this.serverOptions?.path ?? '', this.server?.address());
103
+ this.logger.debug('[configure] Whether http listening: %s', this.server?.listening);
104
104
  }
105
105
  // -------------------------------------------------------------------------------------------------------------
106
106
  onClientConnect(opts) {
107
107
  const { socket } = opts;
108
108
  if (!socket) {
109
- this.logger.info("[onClientConnect] Invalid new socket connection!");
109
+ this.logger.info('[onClientConnect] Invalid new socket connection!');
110
110
  return;
111
111
  }
112
112
  // Validate user identifier
113
113
  const { id, handshake } = socket;
114
114
  const { headers } = handshake;
115
115
  if (this.clients[id]) {
116
- this.logger.info("[onClientConnect] Socket client already existed: %j", {
116
+ this.logger.info('[onClientConnect] Socket client already existed: %j', {
117
117
  id,
118
118
  headers,
119
119
  });
120
120
  return;
121
121
  }
122
- this.logger.info("[onClientConnect] New connection request with options: %j", { id, headers });
122
+ this.logger.info('[onClientConnect] New connection request with options: %j', { id, headers });
123
123
  this.clients[id] = {
124
124
  id,
125
125
  socket,
126
- state: "unauthorized",
126
+ state: 'unauthorized',
127
127
  authenticateTimeout: setTimeout(() => {
128
- if (this.clients[id]?.state === "authenticated") {
128
+ if (this.clients[id]?.state === 'authenticated') {
129
129
  return;
130
130
  }
131
131
  this.disconnect({ socket });
132
132
  }, this.authenticateTimeout),
133
133
  };
134
134
  socket.on(common_1.SocketIOConstants.EVENT_AUTHENTICATE, () => {
135
- this.clients[id].state = "authenticating";
135
+ this.clients[id].state = 'authenticating';
136
136
  this.authenticateFn(handshake)
137
137
  .then(rs => {
138
- this.logger.info("[onClientAuthenticate] Socket: %s | Authenticate result: %s", id, rs);
138
+ this.logger.info('[onClientAuthenticate] Socket: %s | Authenticate result: %s', id, rs);
139
139
  // Valid connection
140
140
  if (rs) {
141
141
  this.onClientAuthenticated({ socket });
142
142
  return;
143
143
  }
144
144
  // Invalid connection
145
- this.clients[id].state = "unauthorized";
145
+ this.clients[id].state = 'unauthorized';
146
146
  this.send({
147
147
  destination: socket.id,
148
148
  payload: {
149
149
  topic: common_1.SocketIOConstants.EVENT_UNAUTHENTICATE,
150
150
  data: {
151
- message: "Invalid token token authenticate! Please login again!",
151
+ message: 'Invalid token token authenticate! Please login again!',
152
152
  time: new Date().toISOString(),
153
153
  },
154
154
  },
@@ -159,14 +159,14 @@ class SocketIOServerHelper extends base_1.BaseHelper {
159
159
  })
160
160
  .catch(error => {
161
161
  // Unexpected error while authenticating connection
162
- this.clients[id].state = "unauthorized";
163
- this.logger.error("[onClientConnect] Connection: %s | Failed to authenticate new socket connection | Error: %s", id, error);
162
+ this.clients[id].state = 'unauthorized';
163
+ this.logger.error('[onClientConnect] Connection: %s | Failed to authenticate new socket connection | Error: %s', id, error);
164
164
  this.send({
165
165
  destination: socket.id,
166
166
  payload: {
167
167
  topic: common_1.SocketIOConstants.EVENT_UNAUTHENTICATE,
168
168
  data: {
169
- message: "Failed to authenticate connection! Please login again!",
169
+ message: 'Failed to authenticate connection! Please login again!',
170
170
  time: new Date().toISOString(),
171
171
  },
172
172
  },
@@ -182,26 +182,26 @@ class SocketIOServerHelper extends base_1.BaseHelper {
182
182
  onClientAuthenticated(opts) {
183
183
  const { socket } = opts;
184
184
  if (!socket) {
185
- this.logger.info("[onClientAuthenticated] Invalid new socket connection!");
185
+ this.logger.info('[onClientAuthenticated] Invalid new socket connection!');
186
186
  return;
187
187
  }
188
188
  // Validate user identifier
189
189
  const { id } = socket;
190
190
  if (!this.clients[id]) {
191
- this.logger.info("[onClientAuthenticated] Unknown client id %s to continue!", id);
191
+ this.logger.info('[onClientAuthenticated] Unknown client id %s to continue!', id);
192
192
  this.disconnect({ socket });
193
193
  return;
194
194
  }
195
- this.clients[id].state = "authenticated";
195
+ this.clients[id].state = 'authenticated';
196
196
  this.ping({ socket, doIgnoreAuth: true });
197
197
  // Valid connection
198
- this.logger.info("[onClientAuthenticated] Connection: %s | Identifier: %s | CONNECTED | Time: %s", id, this.identifier, new Date().toISOString());
198
+ this.logger.info('[onClientAuthenticated] Connection: %s | Identifier: %s | CONNECTED | Time: %s', id, this.identifier, new Date().toISOString());
199
199
  Promise.all(this.defaultRooms.map((room) => Promise.resolve(socket.join(room))))
200
200
  .then(() => {
201
- this.logger.info("[onClientAuthenticated] Connection %s joined all defaultRooms %s", id, this.defaultRooms);
201
+ this.logger.info('[onClientAuthenticated] Connection %s joined all defaultRooms %s', id, this.defaultRooms);
202
202
  })
203
203
  .catch(error => {
204
- this.logger.error("[onClientAuthenticated] Connection %s failed to join defaultRooms %s | Error: %s", id, this.defaultRooms, error);
204
+ this.logger.error('[onClientAuthenticated] Connection %s failed to join defaultRooms %s | Error: %s', id, this.defaultRooms, error);
205
205
  });
206
206
  // Handle events
207
207
  socket.on(common_1.SocketIOConstants.EVENT_DISCONNECT, () => {
@@ -214,12 +214,12 @@ class SocketIOServerHelper extends base_1.BaseHelper {
214
214
  }
215
215
  Promise.all(rooms.map((room) => socket.join(room)))
216
216
  .then(() => {
217
- this.logger.info("[%s] Connection: %s joined all rooms %s", common_1.SocketIOConstants.EVENT_JOIN, id, rooms);
217
+ this.logger.info('[%s] Connection: %s joined all rooms %s', common_1.SocketIOConstants.EVENT_JOIN, id, rooms);
218
218
  })
219
219
  .catch(error => {
220
- this.logger.error("[%s] Connection %s failed to join rooms %s | Error: %s", common_1.SocketIOConstants.EVENT_JOIN, id, rooms, error);
220
+ this.logger.error('[%s] Connection %s failed to join rooms %s | Error: %s', common_1.SocketIOConstants.EVENT_JOIN, id, rooms, error);
221
221
  });
222
- this.logger.info("[%s] Connection: %s | JOIN Rooms: %j", common_1.SocketIOConstants.EVENT_JOIN, id, rooms);
222
+ this.logger.info('[%s] Connection: %s | JOIN Rooms: %j', common_1.SocketIOConstants.EVENT_JOIN, id, rooms);
223
223
  });
224
224
  socket.on(common_1.SocketIOConstants.EVENT_LEAVE, (payload) => {
225
225
  const { rooms = [] } = payload || { room: [] };
@@ -228,12 +228,12 @@ class SocketIOServerHelper extends base_1.BaseHelper {
228
228
  }
229
229
  Promise.all(rooms.map((room) => socket.leave(room)))
230
230
  .then(() => {
231
- this.logger.info("[%s] Connection %s left all rooms %s", common_1.SocketIOConstants.EVENT_LEAVE, id, rooms);
231
+ this.logger.info('[%s] Connection %s left all rooms %s', common_1.SocketIOConstants.EVENT_LEAVE, id, rooms);
232
232
  })
233
233
  .catch(error => {
234
- this.logger.error("[%s] Connection %s failed to leave rooms %s | Error: %s", common_1.SocketIOConstants.EVENT_LEAVE, id, rooms, error);
234
+ this.logger.error('[%s] Connection %s failed to leave rooms %s | Error: %s', common_1.SocketIOConstants.EVENT_LEAVE, id, rooms, error);
235
235
  });
236
- this.logger.info("[%s] Connection: %s | LEAVE Rooms: %j", common_1.SocketIOConstants.EVENT_LEAVE, id, rooms);
236
+ this.logger.info('[%s] Connection: %s | LEAVE Rooms: %j', common_1.SocketIOConstants.EVENT_LEAVE, id, rooms);
237
237
  });
238
238
  this.clients[id].interval = setInterval(() => {
239
239
  this.ping({ socket, doIgnoreAuth: true });
@@ -252,19 +252,19 @@ class SocketIOServerHelper extends base_1.BaseHelper {
252
252
  this.onClientConnected?.({ socket })
253
253
  ?.then(() => { })
254
254
  .catch(error => {
255
- this.logger.error("[onClientConnected][Handler] Error: %s", error);
255
+ this.logger.error('[onClientConnected][Handler] Error: %s', error);
256
256
  });
257
257
  }
258
258
  // -------------------------------------------------------------------------------------------------------------
259
259
  ping(opts) {
260
260
  const { socket, doIgnoreAuth } = opts;
261
261
  if (!socket) {
262
- this.logger.info("[ping] Socket is undefined to PING!");
262
+ this.logger.info('[ping] Socket is undefined to PING!');
263
263
  return;
264
264
  }
265
265
  const client = this.clients[socket.id];
266
- if (!doIgnoreAuth && client.state !== "authenticated") {
267
- this.logger.info("[ping] Socket client is not authenticated | Authenticated: %s", client.state);
266
+ if (!doIgnoreAuth && client.state !== 'authenticated') {
267
+ this.logger.info('[ping] Socket client is not authenticated | Authenticated: %s', client.state);
268
268
  this.disconnect({ socket });
269
269
  return;
270
270
  }
@@ -296,7 +296,7 @@ class SocketIOServerHelper extends base_1.BaseHelper {
296
296
  }
297
297
  delete this.clients[id];
298
298
  }
299
- this.logger.info("[disconnect] Connection: %s | DISCONNECT | Time: %s", id, new Date().toISOString());
299
+ this.logger.info('[disconnect] Connection: %s | DISCONNECT | Time: %s', id, new Date().toISOString());
300
300
  socket.disconnect();
301
301
  }
302
302
  // -------------------------------------------------------------------------------------------------------------
@@ -1,2 +1,2 @@
1
- export * from "./helper";
1
+ export * from './helper';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { AnyObject } from "../../../common";
2
- import { BaseHelper } from "../../../helpers/base";
1
+ import { AnyObject } from '../../../common';
2
+ import { BaseHelper } from '../../../helpers/base';
3
3
  export declare class MemoryStorageHelper<T extends object = AnyObject> extends BaseHelper {
4
4
  private container;
5
5
  constructor(opts?: {
@@ -1,2 +1,2 @@
1
- export * from "./helper";
1
+ export * from './helper';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from "./in-memory";
2
- export * from "./minio";
1
+ export * from './in-memory';
2
+ export * from './minio';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
- import { BaseHelper } from "../../../helpers/base";
2
- import { Client, ClientOptions } from "minio";
3
- import { Readable } from "node:stream";
1
+ import { BaseHelper } from '../../../helpers/base';
2
+ import { Client, ClientOptions } from 'minio';
3
+ import { Readable } from 'node:stream';
4
4
  export interface IUploadFile {
5
5
  originalname: string;
6
6
  mimetype: string;
@@ -44,7 +44,7 @@ class MinioHelper extends base_1.BaseHelper {
44
44
  const { name } = opts;
45
45
  if (!name || (0, isEmpty_1.default)(name)) {
46
46
  throw (0, error_1.getError)({
47
- message: "[createBucket] Invalid name to create bucket!",
47
+ message: '[createBucket] Invalid name to create bucket!',
48
48
  });
49
49
  }
50
50
  await this.client.makeBucket(name);
@@ -56,7 +56,7 @@ class MinioHelper extends base_1.BaseHelper {
56
56
  const { name } = opts;
57
57
  if (!name || (0, isEmpty_1.default)(name)) {
58
58
  throw (0, error_1.getError)({
59
- message: "[removeBucket] Invalid name to remove bucket!",
59
+ message: '[removeBucket] Invalid name to remove bucket!',
60
60
  });
61
61
  }
62
62
  await this.client.removeBucket(name);
@@ -90,9 +90,9 @@ class MinioHelper extends base_1.BaseHelper {
90
90
  for (const file of files) {
91
91
  const { originalname: originalName, size } = file;
92
92
  if (!originalName || (0, isEmpty_1.default)(originalName)) {
93
- this.logger.error("[upload] Invalid original name!");
93
+ this.logger.error('[upload] Invalid original name!');
94
94
  throw (0, error_1.getError)({
95
- message: "[upload] Invalid original file name | please check again files!",
95
+ message: '[upload] Invalid original file name | please check again files!',
96
96
  });
97
97
  }
98
98
  if (!size) {
@@ -104,7 +104,7 @@ class MinioHelper extends base_1.BaseHelper {
104
104
  // Upload all files
105
105
  const uploadPromises = files.map(async (file) => {
106
106
  const { originalname: originalName, mimetype: mimeType, buffer, size, encoding } = file;
107
- const normalizeName = originalName.toLowerCase().replace(/ /g, "_");
107
+ const normalizeName = originalName.toLowerCase().replace(/ /g, '_');
108
108
  const t = new Date().getTime();
109
109
  const uploadInfo = await this.client.putObject(bucket, normalizeName, buffer, size, {
110
110
  originalName,
@@ -113,7 +113,7 @@ class MinioHelper extends base_1.BaseHelper {
113
113
  encoding,
114
114
  mimeType,
115
115
  });
116
- this.logger.info("[upload] Uploaded: %j | Took: %s (ms)", uploadInfo, new Date().getTime() - t);
116
+ this.logger.info('[upload] Uploaded: %j | Took: %s (ms)', uploadInfo, new Date().getTime() - t);
117
117
  return {
118
118
  bucket,
119
119
  fileName: normalizeName,
@@ -145,7 +145,7 @@ class MinioHelper extends base_1.BaseHelper {
145
145
  }
146
146
  // ---------------------------------------------------------------------
147
147
  getListObjects(opts) {
148
- const { bucket, prefix = "", useRecursive = false } = opts;
148
+ const { bucket, prefix = '', useRecursive = false } = opts;
149
149
  const listObjects = this.client.listObjects(bucket, prefix, useRecursive);
150
150
  return listObjects;
151
151
  }
@@ -1,2 +1,2 @@
1
- export * from "./helper";
1
+ export * from './helper';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { MemoryStorageHelper } from "../../helpers/storage";
2
- import { ITestCase, ITestHooks, ITestPlan, ITestPlanOptions } from "./common";
1
+ import { MemoryStorageHelper } from '../../helpers/storage';
2
+ import { ITestCase, ITestHooks, ITestPlan, ITestPlanOptions } from './common';
3
3
  export declare abstract class BaseTestPlan<R extends object> implements ITestPlan<R> {
4
4
  private logger;
5
5
  private registry;
@@ -48,19 +48,19 @@ class BaseTestPlan {
48
48
  return registry.get(opts.key);
49
49
  }
50
50
  execute() {
51
- this.logger.info("[run] START RUNNING TEST CASE | Total test cases: %s", this.testCases.length);
51
+ this.logger.info('[run] START RUNNING TEST CASE | Total test cases: %s', this.testCases.length);
52
52
  if (!this.testCases.length) {
53
- this.logger.info("[run] Not found test case(s)");
53
+ this.logger.info('[run] Not found test case(s)');
54
54
  return;
55
55
  }
56
56
  for (const testCase of this.testCases) {
57
57
  try {
58
- (0, node_test_1.it)(`RUN Test Case | Code: ${testCase.code} | Description: ${testCase.name ? `${testCase.name} - ` : ""}${testCase.description} | Expect: ${testCase.expectation}`, () => {
58
+ (0, node_test_1.it)(`RUN Test Case | Code: ${testCase.code} | Description: ${testCase.name ? `${testCase.name} - ` : ''}${testCase.description} | Expect: ${testCase.expectation}`, () => {
59
59
  return testCase.run();
60
60
  });
61
61
  }
62
62
  catch (error) {
63
- this.logger.error("[%s] Failed to finish test case | error: %s", testCase.name, error);
63
+ this.logger.error('[%s] Failed to finish test case | error: %s', testCase.name, error);
64
64
  }
65
65
  }
66
66
  }
@@ -1,4 +1,4 @@
1
- import { TTestCaseDecision } from "./types";
1
+ import { TTestCaseDecision } from './types';
2
2
  export declare class TestCaseDecisions {
3
3
  static readonly UNKNOWN: TTestCaseDecision;
4
4
  static readonly FAIL: TTestCaseDecision;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TestCaseDecisions = void 0;
4
4
  class TestCaseDecisions {
5
- static { this.UNKNOWN = "000_UNKNOWN"; }
6
- static { this.FAIL = "000_FAIL"; }
7
- static { this.SUCCESS = "200_SUCCESS"; }
5
+ static { this.UNKNOWN = '000_UNKNOWN'; }
6
+ static { this.FAIL = '000_FAIL'; }
7
+ static { this.SUCCESS = '200_SUCCESS'; }
8
8
  }
9
9
  exports.TestCaseDecisions = TestCaseDecisions;
10
10
  //# sourceMappingURL=constants.js.map
@@ -1,3 +1,3 @@
1
- export * from "./constants";
2
- export * from "./types";
1
+ export * from './constants';
2
+ export * from './types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { AnyObject, AnyType, ValueOrPromise } from "../../../common";
2
- import { MemoryStorageHelper } from "../../../helpers/storage";
1
+ import { AnyObject, AnyType, ValueOrPromise } from '../../../common';
2
+ import { MemoryStorageHelper } from '../../../helpers/storage';
3
3
  export interface ITestContext<R extends object> {
4
4
  scope: string;
5
5
  getRegistry: () => MemoryStorageHelper<R>;
@@ -11,7 +11,7 @@ export interface ITestContext<R extends object> {
11
11
  key: keyof R;
12
12
  }) => E;
13
13
  }
14
- export type TTestCaseDecision = "000_UNKNOWN" | "000_FAIL" | "200_SUCCESS";
14
+ export type TTestCaseDecision = '000_UNKNOWN' | '000_FAIL' | '200_SUCCESS';
15
15
  export interface ITestCaseInput {
16
16
  }
17
17
  export interface ITestCaseHandler<R extends object = {}, I extends object = {}> {
@@ -1,5 +1,5 @@
1
- import { ApplicationLogger } from "../logger";
2
- import { ITestPlan } from "./common";
1
+ import { ApplicationLogger } from '../logger';
2
+ import { ITestPlan } from './common';
3
3
  export declare class TestDescribe<R extends object> {
4
4
  testPlan: ITestPlan<R>;
5
5
  logger: ApplicationLogger;
@@ -19,22 +19,22 @@ class TestDescribe {
19
19
  }
20
20
  const fn = () => {
21
21
  (0, node_test_1.before)(async () => {
22
- const hook = this.testPlan.getHook({ key: "before" });
22
+ const hook = this.testPlan.getHook({ key: 'before' });
23
23
  await hook?.(this.testPlan);
24
24
  });
25
25
  (0, node_test_1.beforeEach)(async () => {
26
- const hook = this.testPlan.getHook({ key: "beforeEach" });
26
+ const hook = this.testPlan.getHook({ key: 'beforeEach' });
27
27
  await hook?.(this.testPlan);
28
28
  });
29
29
  (0, node_test_1.after)(async () => {
30
- const hook = this.testPlan.getHook({ key: "after" });
30
+ const hook = this.testPlan.getHook({ key: 'after' });
31
31
  await hook?.(this.testPlan);
32
32
  });
33
33
  (0, node_test_1.afterEach)(async () => {
34
- const hook = this.testPlan.getHook({ key: "afterEach" });
34
+ const hook = this.testPlan.getHook({ key: 'afterEach' });
35
35
  await hook?.(this.testPlan);
36
36
  });
37
- this.logger.info("[run][%s] START executing test plan!", this.testPlan.scope);
37
+ this.logger.info('[run][%s] START executing test plan!', this.testPlan.scope);
38
38
  this.testPlan.execute();
39
39
  };
40
40
  (0, node_test_1.describe)(this.testPlan.scope, fn);
@@ -1,7 +1,7 @@
1
- export * from "./base-test-plan";
2
- export * from "./common";
3
- export * from "./describe";
4
- export * from "./test-case";
5
- export * from "./test-handler";
6
- export * from "./test-plan";
1
+ export * from './base-test-plan';
2
+ export * from './common';
3
+ export * from './describe';
4
+ export * from './test-case';
5
+ export * from './test-handler';
6
+ export * from './test-plan';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
- import { AnyObject } from "../../common/types";
2
- import { ITestCase } from "./common";
3
- import { TestCaseHandler } from "./test-handler";
1
+ import { AnyObject } from '../../common/types';
2
+ import { ITestCase } from './common';
3
+ import { TestCaseHandler } from './test-handler';
4
4
  export interface ITestCaseOptions<R extends object = {}, I extends object = {}> {
5
5
  code: string;
6
6
  name?: string;
@@ -9,7 +9,7 @@ const get_1 = __importDefault(require("lodash/get"));
9
9
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
10
10
  class TestCase {
11
11
  constructor(opts) {
12
- const validateFields = ["code", "description", "expectation"];
12
+ const validateFields = ['code', 'description', 'expectation'];
13
13
  for (const key of validateFields) {
14
14
  const value = (0, get_1.default)(opts, key, null);
15
15
  if (value && !(0, isEmpty_1.default)(value)) {
@@ -1,6 +1,6 @@
1
- import { ValueOrPromise } from "../../common";
2
- import { ApplicationLogger } from "../logger";
3
- import { ITestCaseHandler, ITestCaseInput, ITestContext, TTestCaseDecision } from "./common";
1
+ import { ValueOrPromise } from '../../common';
2
+ import { ApplicationLogger } from '../logger';
3
+ import { ITestCaseHandler, ITestCaseInput, ITestContext, TTestCaseDecision } from './common';
4
4
  export interface ITestCaseHandlerOptions<R extends object, I extends ITestCaseInput = {}> {
5
5
  scope?: string;
6
6
  context: ITestContext<R>;
@@ -36,7 +36,7 @@ class TestCaseHandler extends BaseTestCaseHandler {
36
36
  validateRs = await this.validate(executeRs);
37
37
  }
38
38
  catch (error) {
39
- this.logger.error("[_execute] Failed to execute test handler | Error: %s", error);
39
+ this.logger.error('[_execute] Failed to execute test handler | Error: %s', error);
40
40
  }
41
41
  node_assert_1.default.equal(validateRs, common_1.TestCaseDecisions.SUCCESS);
42
42
  }
@@ -44,7 +44,7 @@ class TestCaseHandler extends BaseTestCaseHandler {
44
44
  const validator = this.validator ?? this.getValidator();
45
45
  if (!validator) {
46
46
  throw (0, error_1.getError)({
47
- message: "[validate] Invalid test case validator!",
47
+ message: '[validate] Invalid test case validator!',
48
48
  });
49
49
  }
50
50
  return validator(opts) ?? common_1.TestCaseDecisions.UNKNOWN;
@@ -1,5 +1,5 @@
1
- import { BaseTestPlan } from "./base-test-plan";
2
- import { ITestPlanOptions } from "./common";
1
+ import { BaseTestPlan } from './base-test-plan';
2
+ import { ITestPlanOptions } from './common';
3
3
  export declare class TestPlan<R extends object> extends BaseTestPlan<R> {
4
4
  static newInstance<R extends object>(opts: ITestPlanOptions<R>): TestPlan<R>;
5
5
  }