@scpxl/nodejs-framework 1.0.22 → 1.0.24

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 (278) hide show
  1. package/README.md +199 -9
  2. package/dist/api-requester/api-requester.d.ts +32 -0
  3. package/dist/api-requester/api-requester.d.ts.map +1 -0
  4. package/dist/api-requester/index.d.ts +3 -0
  5. package/dist/api-requester/index.d.ts.map +1 -0
  6. package/dist/application/base-application.d.ts +106 -0
  7. package/dist/application/base-application.d.ts.map +1 -0
  8. package/dist/application/base-application.interface.d.ts +162 -0
  9. package/dist/application/base-application.interface.d.ts.map +1 -0
  10. package/dist/application/base-application.js +3 -0
  11. package/dist/application/base-application.js.map +2 -2
  12. package/dist/application/command-application.d.ts +18 -0
  13. package/dist/application/command-application.d.ts.map +1 -0
  14. package/dist/application/command-application.interface.d.ts +26 -0
  15. package/dist/application/command-application.interface.d.ts.map +1 -0
  16. package/dist/application/index.d.ts +5 -0
  17. package/dist/application/index.d.ts.map +1 -0
  18. package/dist/application/web-application.d.ts +43 -0
  19. package/dist/application/web-application.d.ts.map +1 -0
  20. package/dist/application/web-application.interface.d.ts +21 -0
  21. package/dist/application/web-application.interface.d.ts.map +1 -0
  22. package/dist/application/web-application.js +1 -0
  23. package/dist/application/web-application.js.map +2 -2
  24. package/dist/auth/index.d.ts +2 -0
  25. package/dist/auth/index.d.ts.map +1 -0
  26. package/dist/auth/jwt.d.ts +25 -0
  27. package/dist/auth/jwt.d.ts.map +1 -0
  28. package/dist/cache/index.d.ts +2 -0
  29. package/dist/cache/index.d.ts.map +1 -0
  30. package/dist/cache/manager.d.ts +107 -0
  31. package/dist/cache/manager.d.ts.map +1 -0
  32. package/dist/cli/index.d.ts +2 -0
  33. package/dist/cli/index.d.ts.map +1 -0
  34. package/dist/cli/index.js +5655 -0
  35. package/dist/cli/index.js.map +7 -0
  36. package/dist/cluster/cluster-manager.d.ts +15 -0
  37. package/dist/cluster/cluster-manager.d.ts.map +1 -0
  38. package/dist/cluster/cluster-manager.interface.d.ts +23 -0
  39. package/dist/cluster/cluster-manager.interface.d.ts.map +1 -0
  40. package/dist/cluster/index.d.ts +2 -0
  41. package/dist/cluster/index.d.ts.map +1 -0
  42. package/dist/command/command-manager.d.ts +19 -0
  43. package/dist/command/command-manager.d.ts.map +1 -0
  44. package/dist/command/command.d.ts +27 -0
  45. package/dist/command/command.d.ts.map +1 -0
  46. package/dist/command/command.interface.d.ts +11 -0
  47. package/dist/command/command.interface.d.ts.map +1 -0
  48. package/dist/command/index.d.ts +3 -0
  49. package/dist/command/index.d.ts.map +1 -0
  50. package/dist/config/env.d.ts +11 -0
  51. package/dist/config/env.d.ts.map +1 -0
  52. package/dist/config/index.d.ts +3 -0
  53. package/dist/config/index.d.ts.map +1 -0
  54. package/dist/config/schema.d.ts +432 -0
  55. package/dist/config/schema.d.ts.map +1 -0
  56. package/dist/database/dynamic-entity-form-decorators.d.ts +31 -0
  57. package/dist/database/dynamic-entity-form-decorators.d.ts.map +1 -0
  58. package/dist/database/dynamic-entity.d.ts +15 -0
  59. package/dist/database/dynamic-entity.d.ts.map +1 -0
  60. package/dist/database/index.d.ts +5 -0
  61. package/dist/database/index.d.ts.map +1 -0
  62. package/dist/database/instance.d.ts +36 -0
  63. package/dist/database/instance.d.ts.map +1 -0
  64. package/dist/database/instance.interface.d.ts +5 -0
  65. package/dist/database/instance.interface.d.ts.map +1 -0
  66. package/dist/database/manager.d.ts +27 -0
  67. package/dist/database/manager.d.ts.map +1 -0
  68. package/dist/database/manager.interface.d.ts +18 -0
  69. package/dist/database/manager.interface.d.ts.map +1 -0
  70. package/dist/error/error-reporter.d.ts +96 -0
  71. package/dist/error/error-reporter.d.ts.map +1 -0
  72. package/dist/error/error.interface.d.ts +126 -0
  73. package/dist/error/error.interface.d.ts.map +1 -0
  74. package/dist/error/framework-errors.d.ts +113 -0
  75. package/dist/error/framework-errors.d.ts.map +1 -0
  76. package/dist/error/index.d.ts +6 -0
  77. package/dist/error/index.d.ts.map +1 -0
  78. package/dist/event/controller/base.d.ts +23 -0
  79. package/dist/event/controller/base.d.ts.map +1 -0
  80. package/dist/event/controller/base.interface.d.ts +11 -0
  81. package/dist/event/controller/base.interface.d.ts.map +1 -0
  82. package/dist/event/index.d.ts +5 -0
  83. package/dist/event/index.d.ts.map +1 -0
  84. package/dist/event/manager.d.ts +21 -0
  85. package/dist/event/manager.d.ts.map +1 -0
  86. package/dist/event/manager.interface.d.ts +137 -0
  87. package/dist/event/manager.interface.d.ts.map +1 -0
  88. package/dist/index.d.ts +22 -0
  89. package/dist/index.d.ts.map +1 -0
  90. package/dist/lifecycle/exit.d.ts +11 -0
  91. package/dist/lifecycle/exit.d.ts.map +1 -0
  92. package/dist/lifecycle/index.d.ts +7 -0
  93. package/dist/lifecycle/index.d.ts.map +1 -0
  94. package/dist/lifecycle/lifecycle-manager.d.ts +66 -0
  95. package/dist/lifecycle/lifecycle-manager.d.ts.map +1 -0
  96. package/dist/lifecycle/lifecycle-manager.js +6 -11
  97. package/dist/lifecycle/lifecycle-manager.js.map +2 -2
  98. package/dist/lifecycle/shutdown-controller.d.ts +15 -0
  99. package/dist/lifecycle/shutdown-controller.d.ts.map +1 -0
  100. package/dist/lifecycle/types.d.ts +28 -0
  101. package/dist/lifecycle/types.d.ts.map +1 -0
  102. package/dist/logger/index.d.ts +2 -0
  103. package/dist/logger/index.d.ts.map +1 -0
  104. package/dist/logger/logger.d.ts +59 -0
  105. package/dist/logger/logger.d.ts.map +1 -0
  106. package/dist/logger/logger.interface.d.ts +2 -0
  107. package/dist/logger/logger.interface.d.ts.map +1 -0
  108. package/dist/logger/logger.js +8 -1
  109. package/dist/logger/logger.js.map +2 -2
  110. package/dist/performance/cache-performance.d.ts +64 -0
  111. package/dist/performance/cache-performance.d.ts.map +1 -0
  112. package/dist/performance/database-performance.d.ts +40 -0
  113. package/dist/performance/database-performance.d.ts.map +1 -0
  114. package/dist/performance/index.d.ts +8 -0
  115. package/dist/performance/index.d.ts.map +1 -0
  116. package/dist/performance/performance-monitor.d.ts +68 -0
  117. package/dist/performance/performance-monitor.d.ts.map +1 -0
  118. package/dist/performance/performance-monitor.plugin.d.ts +24 -0
  119. package/dist/performance/performance-monitor.plugin.d.ts.map +1 -0
  120. package/dist/performance/queue-performance.d.ts +46 -0
  121. package/dist/performance/queue-performance.d.ts.map +1 -0
  122. package/dist/performance/webserver-performance.d.ts +69 -0
  123. package/dist/performance/webserver-performance.d.ts.map +1 -0
  124. package/dist/performance/websocket-performance.d.ts +44 -0
  125. package/dist/performance/websocket-performance.d.ts.map +1 -0
  126. package/dist/queue/index.d.ts +6 -0
  127. package/dist/queue/index.d.ts.map +1 -0
  128. package/dist/queue/index.interface.d.ts +10 -0
  129. package/dist/queue/index.interface.d.ts.map +1 -0
  130. package/dist/queue/job.interface.d.ts +43 -0
  131. package/dist/queue/job.interface.d.ts.map +1 -0
  132. package/dist/queue/manager.d.ts +44 -0
  133. package/dist/queue/manager.d.ts.map +1 -0
  134. package/dist/queue/manager.interface.d.ts +18 -0
  135. package/dist/queue/manager.interface.d.ts.map +1 -0
  136. package/dist/queue/processor/base.d.ts +29 -0
  137. package/dist/queue/processor/base.d.ts.map +1 -0
  138. package/dist/queue/processor/processor.interface.d.ts +16 -0
  139. package/dist/queue/processor/processor.interface.d.ts.map +1 -0
  140. package/dist/queue/worker.d.ts +14 -0
  141. package/dist/queue/worker.d.ts.map +1 -0
  142. package/dist/queue/worker.interface.d.ts +13 -0
  143. package/dist/queue/worker.interface.d.ts.map +1 -0
  144. package/dist/redis/index.d.ts +3 -0
  145. package/dist/redis/index.d.ts.map +1 -0
  146. package/dist/redis/instance.d.ts +32 -0
  147. package/dist/redis/instance.d.ts.map +1 -0
  148. package/dist/redis/instance.interface.d.ts +9 -0
  149. package/dist/redis/instance.interface.d.ts.map +1 -0
  150. package/dist/redis/manager.d.ts +15 -0
  151. package/dist/redis/manager.d.ts.map +1 -0
  152. package/dist/redis/manager.interface.d.ts +8 -0
  153. package/dist/redis/manager.interface.d.ts.map +1 -0
  154. package/dist/redis/manager.js +13 -14
  155. package/dist/redis/manager.js.map +2 -2
  156. package/dist/request-context/index.d.ts +3 -0
  157. package/dist/request-context/index.d.ts.map +1 -0
  158. package/dist/request-context/request-context.d.ts +108 -0
  159. package/dist/request-context/request-context.d.ts.map +1 -0
  160. package/dist/request-context/request-context.interface.d.ts +46 -0
  161. package/dist/request-context/request-context.interface.d.ts.map +1 -0
  162. package/dist/services/aws/index.d.ts +2 -0
  163. package/dist/services/aws/index.d.ts.map +1 -0
  164. package/dist/services/aws/s3.d.ts +54 -0
  165. package/dist/services/aws/s3.d.ts.map +1 -0
  166. package/dist/services/aws/s3.interface.d.ts +14 -0
  167. package/dist/services/aws/s3.interface.d.ts.map +1 -0
  168. package/dist/services/index.d.ts +2 -0
  169. package/dist/services/index.d.ts.map +1 -0
  170. package/dist/util/file.d.ts +58 -0
  171. package/dist/util/file.d.ts.map +1 -0
  172. package/dist/util/helper.d.ts +51 -0
  173. package/dist/util/helper.d.ts.map +1 -0
  174. package/dist/util/helper.js +72 -10
  175. package/dist/util/helper.js.map +2 -2
  176. package/dist/util/image.d.ts +12 -0
  177. package/dist/util/image.d.ts.map +1 -0
  178. package/dist/util/index.d.ts +11 -0
  179. package/dist/util/index.d.ts.map +1 -0
  180. package/dist/util/loader.d.ts +21 -0
  181. package/dist/util/loader.d.ts.map +1 -0
  182. package/dist/util/loader.js +5 -2
  183. package/dist/util/loader.js.map +2 -2
  184. package/dist/util/num.d.ts +13 -0
  185. package/dist/util/num.d.ts.map +1 -0
  186. package/dist/util/os.d.ts +6 -0
  187. package/dist/util/os.d.ts.map +1 -0
  188. package/dist/util/str.d.ts +39 -0
  189. package/dist/util/str.d.ts.map +1 -0
  190. package/dist/util/time.d.ts +19 -0
  191. package/dist/util/time.d.ts.map +1 -0
  192. package/dist/util/time.interface.d.ts +12 -0
  193. package/dist/util/time.interface.d.ts.map +1 -0
  194. package/dist/util/timing.d.ts +36 -0
  195. package/dist/util/timing.d.ts.map +1 -0
  196. package/dist/util/timing.interface.d.ts +47 -0
  197. package/dist/util/timing.interface.d.ts.map +1 -0
  198. package/dist/util/url.d.ts +7 -0
  199. package/dist/util/url.d.ts.map +1 -0
  200. package/dist/webserver/controller/auth-middleware.d.ts +21 -0
  201. package/dist/webserver/controller/auth-middleware.d.ts.map +1 -0
  202. package/dist/webserver/controller/base.d.ts +41 -0
  203. package/dist/webserver/controller/base.d.ts.map +1 -0
  204. package/dist/webserver/controller/base.interface.d.ts +50 -0
  205. package/dist/webserver/controller/base.interface.d.ts.map +1 -0
  206. package/dist/webserver/controller/entity.d.ts +94 -0
  207. package/dist/webserver/controller/entity.d.ts.map +1 -0
  208. package/dist/webserver/controller/example-auth.d.ts +12 -0
  209. package/dist/webserver/controller/example-auth.d.ts.map +1 -0
  210. package/dist/webserver/controller/health.d.ts +15 -0
  211. package/dist/webserver/controller/health.d.ts.map +1 -0
  212. package/dist/webserver/define-action.d.ts +26 -0
  213. package/dist/webserver/define-action.d.ts.map +1 -0
  214. package/dist/webserver/define-action.js +16 -0
  215. package/dist/webserver/define-action.js.map +7 -0
  216. package/dist/webserver/define-route.d.ts +53 -0
  217. package/dist/webserver/define-route.d.ts.map +1 -0
  218. package/dist/webserver/define-route.js +11 -6
  219. package/dist/webserver/define-route.js.map +2 -2
  220. package/dist/webserver/index.d.ts +14 -0
  221. package/dist/webserver/index.d.ts.map +1 -0
  222. package/dist/webserver/index.js +2 -0
  223. package/dist/webserver/index.js.map +2 -2
  224. package/dist/webserver/util.d.ts +10 -0
  225. package/dist/webserver/util.d.ts.map +1 -0
  226. package/dist/webserver/util.js +5 -2
  227. package/dist/webserver/util.js.map +2 -2
  228. package/dist/webserver/webserver.d.ts +93 -0
  229. package/dist/webserver/webserver.d.ts.map +1 -0
  230. package/dist/webserver/webserver.interface.d.ts +181 -0
  231. package/dist/webserver/webserver.interface.d.ts.map +1 -0
  232. package/dist/webserver/webserver.interface.js.map +1 -1
  233. package/dist/webserver/webserver.js +28 -31
  234. package/dist/webserver/webserver.js.map +2 -2
  235. package/dist/websocket/controller/client/base.d.ts +12 -0
  236. package/dist/websocket/controller/client/base.d.ts.map +1 -0
  237. package/dist/websocket/controller/client/base.interface.d.ts +12 -0
  238. package/dist/websocket/controller/client/base.interface.d.ts.map +1 -0
  239. package/dist/websocket/controller/server/base.d.ts +13 -0
  240. package/dist/websocket/controller/server/base.d.ts.map +1 -0
  241. package/dist/websocket/controller/server/base.interface.d.ts +13 -0
  242. package/dist/websocket/controller/server/base.interface.d.ts.map +1 -0
  243. package/dist/websocket/controllers/client/system.d.ts +6 -0
  244. package/dist/websocket/controllers/client/system.d.ts.map +1 -0
  245. package/dist/websocket/controllers/server/system.d.ts +7 -0
  246. package/dist/websocket/controllers/server/system.d.ts.map +1 -0
  247. package/dist/websocket/index.d.ts +7 -0
  248. package/dist/websocket/index.d.ts.map +1 -0
  249. package/dist/websocket/routes/client/system.d.ts +3 -0
  250. package/dist/websocket/routes/client/system.d.ts.map +1 -0
  251. package/dist/websocket/routes/server/system.d.ts +3 -0
  252. package/dist/websocket/routes/server/system.d.ts.map +1 -0
  253. package/dist/websocket/utils.d.ts +9 -0
  254. package/dist/websocket/utils.d.ts.map +1 -0
  255. package/dist/websocket/websocket-base.d.ts +19 -0
  256. package/dist/websocket/websocket-base.d.ts.map +1 -0
  257. package/dist/websocket/websocket-client-manager.d.ts +53 -0
  258. package/dist/websocket/websocket-client-manager.d.ts.map +1 -0
  259. package/dist/websocket/websocket-client-manager.interface.d.ts +8 -0
  260. package/dist/websocket/websocket-client-manager.interface.d.ts.map +1 -0
  261. package/dist/websocket/websocket-client.d.ts +35 -0
  262. package/dist/websocket/websocket-client.d.ts.map +1 -0
  263. package/dist/websocket/websocket-client.interface.d.ts +14 -0
  264. package/dist/websocket/websocket-client.interface.d.ts.map +1 -0
  265. package/dist/websocket/websocket-room-manager.d.ts +32 -0
  266. package/dist/websocket/websocket-room-manager.d.ts.map +1 -0
  267. package/dist/websocket/websocket-server.d.ts +92 -0
  268. package/dist/websocket/websocket-server.d.ts.map +1 -0
  269. package/dist/websocket/websocket-server.interface.d.ts +16 -0
  270. package/dist/websocket/websocket-server.interface.d.ts.map +1 -0
  271. package/dist/websocket/websocket-server.js +33 -9
  272. package/dist/websocket/websocket-server.js.map +2 -2
  273. package/dist/websocket/websocket-service.d.ts +44 -0
  274. package/dist/websocket/websocket-service.d.ts.map +1 -0
  275. package/dist/websocket/websocket.interface.d.ts +124 -0
  276. package/dist/websocket/websocket.interface.d.ts.map +1 -0
  277. package/package.json +13 -13
  278. package/pxl.js +0 -4
@@ -0,0 +1,18 @@
1
+ import type { ApplicationConfig } from '../application/base-application.interface.js';
2
+ import type DatabaseInstance from '../database/instance.js';
3
+ import type EventManager from '../event/manager.js';
4
+ import type { RedisInstance } from '../redis/index.js';
5
+ import type { QueueItem } from './index.interface.js';
6
+ export interface QueueManagerOptions {
7
+ /** Queue processors directory */
8
+ processorsDirectory: string;
9
+ }
10
+ export interface QueueManagerConstructorParams {
11
+ applicationConfig: ApplicationConfig;
12
+ options?: QueueManagerOptions;
13
+ queues: QueueItem[];
14
+ redisInstance: RedisInstance;
15
+ databaseInstance: DatabaseInstance | null;
16
+ eventManager?: EventManager;
17
+ }
18
+ //# sourceMappingURL=manager.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.interface.d.ts","sourceRoot":"","sources":["../../src/queue/manager.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,6BAA6B;IAC5C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B"}
@@ -0,0 +1,29 @@
1
+ import type { Job } from 'bullmq';
2
+ import type { QueueManager } from '../../queue/index.js';
3
+ import type { DatabaseInstance } from '../../database/index.js';
4
+ import type { ApplicationConfig } from '../../application/base-application.interface.js';
5
+ import type { RedisInstance } from '../../redis/index.js';
6
+ import type EventManager from '../../event/manager.js';
7
+ import type { QueueJobData } from '../job.interface.js';
8
+ export default abstract class BaseProcessor<TQueueManager extends QueueManager = QueueManager, TJobData extends QueueJobData = QueueJobData, TResult = unknown> {
9
+ protected queueManager: TQueueManager;
10
+ protected applicationConfig: ApplicationConfig;
11
+ protected redisInstance: RedisInstance;
12
+ protected databaseInstance: DatabaseInstance | null;
13
+ protected eventManager?: EventManager | undefined;
14
+ private logger;
15
+ constructor(queueManager: TQueueManager, applicationConfig: ApplicationConfig, redisInstance: RedisInstance, databaseInstance: DatabaseInstance | null, eventManager?: EventManager | undefined);
16
+ abstract process({ job }: {
17
+ job: Job<TJobData, TResult>;
18
+ }): Promise<TResult>;
19
+ /**
20
+ * Enhanced logger with structured methods
21
+ */
22
+ log: {
23
+ error: (error: Error | unknown, message?: string, meta?: Record<string, unknown>) => void;
24
+ info: (message: string, meta?: Record<string, unknown>) => void;
25
+ warn: (message: string, meta?: Record<string, unknown>) => void;
26
+ debug: (message: string, meta?: Record<string, unknown>) => void;
27
+ };
28
+ }
29
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/queue/processor/base.ts"],"names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AAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;wBAI7C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;yBAI5C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;MAG9D;CACH"}
@@ -0,0 +1,16 @@
1
+ import type QueueManager from '../manager.js';
2
+ import type { ApplicationConfig } from '../../application/base-application.interface.js';
3
+ import type { RedisInstance } from '../../redis/index.js';
4
+ import type { DatabaseInstance } from '../../database/index.js';
5
+ import type EventManager from '../../event/manager.js';
6
+ import type BaseProcessor from './base.js';
7
+ import type { QueueJobData } from '../job.interface.js';
8
+ export interface ProcessorConstructorParams<TQueueManager extends QueueManager = QueueManager, _TJobData extends QueueJobData = QueueJobData, _TResult = unknown> {
9
+ queueManager: TQueueManager;
10
+ applicationConfig: ApplicationConfig;
11
+ redisInstance: RedisInstance;
12
+ databaseInstance: DatabaseInstance | null;
13
+ eventManager?: EventManager;
14
+ }
15
+ export type ProcessorConstructor<TQueueManager extends QueueManager = QueueManager, TJobData extends QueueJobData = QueueJobData, TResult = unknown> = new (queueManager: TQueueManager, applicationConfig: ApplicationConfig, redisInstance: RedisInstance, databaseInstance: DatabaseInstance | null, eventManager?: EventManager) => BaseProcessor<TQueueManager, TJobData, TResult>;
16
+ //# sourceMappingURL=processor.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor.interface.d.ts","sourceRoot":"","sources":["../../../src/queue/processor/processor.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,YAAY,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,0BAA0B,CACzC,aAAa,SAAS,YAAY,GAAG,YAAY,EACjD,SAAS,SAAS,YAAY,GAAG,YAAY,EAC7C,QAAQ,GAAG,OAAO;IAElB,YAAY,EAAE,aAAa,CAAC;IAC5B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,MAAM,oBAAoB,CAC9B,aAAa,SAAS,YAAY,GAAG,YAAY,EACjD,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,OAAO,GAAG,OAAO,IACf,KACF,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,EACzC,YAAY,CAAC,EAAE,YAAY,KACxB,aAAa,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Worker } from 'bullmq';
2
+ import type { QueueWorkerConstructorParams } from './worker.interface.js';
3
+ export default class QueueWorker extends Worker {
4
+ private applicationConfig;
5
+ private queueManager;
6
+ private redisInstance;
7
+ constructor({ applicationConfig, queueManager, name, processor, options, redisInstance, }: QueueWorkerConstructorParams);
8
+ private onWorkerActive;
9
+ private onWorkerError;
10
+ private onWorkerFailed;
11
+ private onWorkerStalled;
12
+ private onWorkerCompleted;
13
+ }
14
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/queue/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAQ1E,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,MAAM;IAC7C,OAAO,CAAC,iBAAiB,CAAoB;IAE7C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAgB;gBAEzB,EACV,iBAAiB,EACjB,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,OAAO,EACP,aAAa,GACd,EAAE,4BAA4B;IAe/B,OAAO,CAAC,cAAc,CAMpB;IAEF,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,cAAc,CAcpB;IAEF,OAAO,CAAC,eAAe,CAErB;IAEF,OAAO,CAAC,iBAAiB,CAwBvB;CACH"}
@@ -0,0 +1,13 @@
1
+ import type { Processor, WorkerOptions } from 'bullmq';
2
+ import type { RedisInstance } from '../redis/index.js';
3
+ import type { ApplicationConfig } from '../application/base-application.interface.js';
4
+ import type QueueManager from './manager.js';
5
+ export interface QueueWorkerConstructorParams {
6
+ applicationConfig: ApplicationConfig;
7
+ queueManager: QueueManager;
8
+ name: string;
9
+ processor: string | URL | Processor<any, any, string> | null | undefined;
10
+ options?: WorkerOptions;
11
+ redisInstance: RedisInstance;
12
+ }
13
+ //# sourceMappingURL=worker.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.interface.d.ts","sourceRoot":"","sources":["../../src/queue/worker.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,KAAK,YAAY,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IACzE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;CAC9B"}
@@ -0,0 +1,3 @@
1
+ export { default as RedisManager } from './manager.js';
2
+ export { default as RedisInstance } from './instance.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/redis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { Redis } from 'ioredis';
2
+ import type { RedisInstanceProps } from './instance.interface.js';
3
+ export default class RedisInstance {
4
+ private redisManager;
5
+ client: Redis;
6
+ publisherClient: Redis;
7
+ subscriberClient: Redis;
8
+ constructor({ redisManager, client, publisherClient, subscriberClient }: RedisInstanceProps);
9
+ disconnect(): Promise<void>;
10
+ isConnected(): Promise<boolean>;
11
+ /**
12
+ * Sets a value in the cache with an optional expiration time.
13
+ *
14
+ * @param key - The key to set in the cache.
15
+ * @param value - The value to set in the cache.
16
+ * @param expiration - The expiration time in seconds (optional).
17
+ * @throws Error if the value type is not supported.
18
+ * @returns A Promise that resolves when the value is set in the cache.
19
+ */
20
+ setCache({ key, value, expiration, }: {
21
+ key: string;
22
+ value: unknown;
23
+ expiration?: number;
24
+ }): Promise<void>;
25
+ getCache({ key }: {
26
+ key: string;
27
+ }): Promise<string | null>;
28
+ deleteCache({ key }: {
29
+ key: string;
30
+ }): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/redis/instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,YAAY,CAAe;IAE5B,MAAM,EAAE,KAAK,CAAC;IACd,eAAe,EAAE,KAAK,CAAC;IACvB,gBAAgB,EAAE,KAAK,CAAC;gBAEnB,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,EAAE,kBAAkB;IAQ9E,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBjC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBtC;;;;;;;;OAQG;IACU,QAAQ,CAAC,EACpB,GAAG,EACH,KAAK,EACL,UAAU,GACX,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,OAAO,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBJ,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAM1D,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlE"}
@@ -0,0 +1,9 @@
1
+ import type { Redis } from 'ioredis';
2
+ import type { RedisManager } from './index.js';
3
+ export interface RedisInstanceProps {
4
+ redisManager: RedisManager;
5
+ client: Redis;
6
+ publisherClient: Redis;
7
+ subscriberClient: Redis;
8
+ }
9
+ //# sourceMappingURL=instance.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.interface.d.ts","sourceRoot":"","sources":["../../src/redis/instance.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC;IACd,eAAe,EAAE,KAAK,CAAC;IACvB,gBAAgB,EAAE,KAAK,CAAC;CACzB"}
@@ -0,0 +1,15 @@
1
+ import type { RedisManagerConfig as RedisManagerOptions } from './manager.interface.js';
2
+ import RedisInstance from './instance.js';
3
+ export default class RedisManager {
4
+ private logger;
5
+ private options;
6
+ instances: RedisInstance[];
7
+ constructor(config: RedisManagerOptions);
8
+ connect(): Promise<RedisInstance>;
9
+ disconnect(): Promise<void>;
10
+ /**
11
+ * Log Redis message
12
+ */
13
+ log(message: string, meta?: Record<string, unknown>): void;
14
+ }
15
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/redis/manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,aAAa,MAAM,eAAe,CAAC;AAuJ1C,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,OAAO,CAAC,MAAM,CAAyB;IAEvC,OAAO,CAAC,OAAO,CAAsB;IAE9B,SAAS,EAAE,aAAa,EAAE,CAAM;gBAE3B,MAAM,EAAE,mBAAmB;IAI1B,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IAkGjC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAiDxC;;OAEG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAGlE"}
@@ -0,0 +1,8 @@
1
+ import type { ApplicationConfig } from '../application/base-application.interface.js';
2
+ export interface RedisManagerConfig {
3
+ applicationConfig: ApplicationConfig;
4
+ host: string;
5
+ port: number;
6
+ password?: string;
7
+ }
8
+ //# sourceMappingURL=manager.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.interface.d.ts","sourceRoot":"","sources":["../../src/redis/manager.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEtF,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -9,6 +9,16 @@ const truthyPattern = /^(1|true|yes|on)$/i;
9
9
  const scheduleMicrotask = typeof globalThis.queueMicrotask === "function" ? globalThis.queueMicrotask.bind(globalThis) : (callback) => {
10
10
  void Promise.resolve().then(callback);
11
11
  };
12
+ let globalInMemoryRedisState = null;
13
+ function getGlobalInMemoryRedisState() {
14
+ globalInMemoryRedisState ??= {
15
+ store: /* @__PURE__ */ new Map(),
16
+ expirations: /* @__PURE__ */ new Map(),
17
+ subscriptions: /* @__PURE__ */ new Map()
18
+ };
19
+ return globalInMemoryRedisState;
20
+ }
21
+ __name(getGlobalInMemoryRedisState, "getGlobalInMemoryRedisState");
12
22
  class InMemoryRedisClient extends EventEmitter {
13
23
  static {
14
24
  __name(this, "InMemoryRedisClient");
@@ -96,14 +106,14 @@ class InMemoryRedisClient extends EventEmitter {
96
106
  }
97
107
  async quit() {
98
108
  this.cleanupSubscriptions();
99
- this.removeAllListeners();
100
109
  this.emit("end");
110
+ this.removeAllListeners();
101
111
  return "OK";
102
112
  }
103
113
  disconnect() {
104
114
  this.cleanupSubscriptions();
105
- this.removeAllListeners();
106
115
  this.emit("end");
116
+ this.removeAllListeners();
107
117
  }
108
118
  }
109
119
  class RedisManager {
@@ -129,20 +139,9 @@ class RedisManager {
129
139
  // Needed for bullmq
130
140
  };
131
141
  const useInMemoryRedis = truthyPattern.test(process.env.PXL_REDIS_IN_MEMORY ?? "") || truthyPattern.test(process.env.REDIS_IN_MEMORY ?? "");
132
- let sharedState;
133
- if (useInMemoryRedis) {
134
- sharedState = {
135
- store: /* @__PURE__ */ new Map(),
136
- expirations: /* @__PURE__ */ new Map(),
137
- subscriptions: /* @__PURE__ */ new Map()
138
- };
139
- }
140
142
  const createClient = /* @__PURE__ */ __name(() => {
141
143
  if (useInMemoryRedis) {
142
- if (!sharedState) {
143
- throw new Error("In-memory Redis shared state not initialized");
144
- }
145
- return new InMemoryRedisClient(sharedState);
144
+ return new InMemoryRedisClient(getGlobalInMemoryRedisState());
146
145
  }
147
146
  return new Redis(redisOptions);
148
147
  }, "createClient");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/redis/manager.ts"],
4
- "sourcesContent": ["import { Redis, type RedisOptions } from 'ioredis';\nimport { EventEmitter } from 'node:events';\nimport type { RedisManagerConfig as RedisManagerOptions } from './manager.interface.js';\nimport RedisInstance from './instance.js';\nimport { Logger } from '../logger/index.js';\nimport { CachePerformanceWrapper } from '../performance/index.js';\n\nconst truthyPattern = /^(1|true|yes|on)$/i;\nconst scheduleMicrotask =\n typeof (globalThis as any).queueMicrotask === 'function'\n ? (globalThis as any).queueMicrotask.bind(globalThis)\n : (callback: () => void) => {\n void Promise.resolve().then(callback);\n };\n\ntype RedisCallback = (error: Error | null, result?: string) => void;\n\ninterface InMemoryRedisSharedState {\n store: Map<string, string | Buffer>;\n expirations: Map<string, NodeJS.Timeout>;\n subscriptions: Map<string, Set<InMemoryRedisClient>>;\n}\n\nclass InMemoryRedisClient extends EventEmitter {\n private shared: InMemoryRedisSharedState;\n\n constructor(shared: InMemoryRedisSharedState) {\n super();\n this.shared = shared;\n\n scheduleMicrotask(() => {\n this.emit('ready');\n });\n }\n\n private cleanupSubscriptions(): void {\n for (const subscribers of this.shared.subscriptions.values()) {\n subscribers.delete(this);\n }\n }\n\n private clearExpirationForKey(key: string): void {\n const timer = this.shared.expirations.get(key);\n if (timer) {\n clearTimeout(timer);\n this.shared.expirations.delete(key);\n }\n }\n\n public ping(callback?: RedisCallback): Promise<string> {\n if (callback) {\n callback(null, 'PONG');\n return Promise.resolve('PONG');\n }\n\n return Promise.resolve('PONG');\n }\n\n public async set(...args: any[]): Promise<'OK'> {\n const [key, value, mode, expiration] = args;\n const serializedValue: string | Buffer = value instanceof Buffer ? value : String(value);\n\n this.shared.store.set(key, serializedValue);\n this.clearExpirationForKey(key);\n\n if (typeof mode === 'string' && mode.toUpperCase() === 'EX' && typeof expiration === 'number') {\n const timer = setTimeout(() => {\n this.shared.store.delete(key);\n this.shared.expirations.delete(key);\n }, expiration * 1000);\n\n if (typeof timer.unref === 'function') {\n timer.unref();\n }\n\n this.shared.expirations.set(key, timer);\n }\n\n return 'OK';\n }\n\n public async get(key: string): Promise<string | null> {\n return (this.shared.store.get(key) as string | undefined) ?? null;\n }\n\n public async del(key: string): Promise<number> {\n const existed = this.shared.store.delete(key);\n this.clearExpirationForKey(key);\n return existed ? 1 : 0;\n }\n\n public async publish(channel: string, message: string): Promise<number> {\n const subscribers = this.shared.subscriptions.get(channel);\n\n if (!subscribers || subscribers.size === 0) {\n return 0;\n }\n\n for (const subscriber of subscribers) {\n scheduleMicrotask(() => {\n subscriber.emit('message', channel, message);\n });\n }\n\n return subscribers.size;\n }\n\n public async subscribe(channel: string): Promise<number> {\n let subscribers = this.shared.subscriptions.get(channel);\n if (!subscribers) {\n subscribers = new Set<InMemoryRedisClient>();\n this.shared.subscriptions.set(channel, subscribers);\n }\n subscribers.add(this);\n return subscribers.size;\n }\n\n public async unsubscribe(channel: string): Promise<number> {\n const subscribers = this.shared.subscriptions.get(channel);\n\n if (!subscribers) {\n return 0;\n }\n\n subscribers.delete(this);\n return subscribers.size;\n }\n\n public async quit(): Promise<'OK'> {\n this.cleanupSubscriptions();\n this.removeAllListeners();\n this.emit('end');\n return 'OK';\n }\n\n public disconnect(): void {\n this.cleanupSubscriptions();\n this.removeAllListeners();\n this.emit('end');\n }\n}\n\nexport default class RedisManager {\n private logger: typeof Logger = Logger;\n\n private options: RedisManagerOptions;\n\n public instances: RedisInstance[] = [];\n\n constructor(config: RedisManagerOptions) {\n this.options = config;\n }\n\n public async connect(): Promise<RedisInstance> {\n return CachePerformanceWrapper.monitorConnection(\n 'connect',\n async () => {\n const startTime = performance.now();\n\n const redisOptions: RedisOptions = {\n host: this.options.host,\n port: this.options.port,\n password: this.options.password,\n maxRetriesPerRequest: null, // Needed for bullmq\n };\n\n const useInMemoryRedis =\n truthyPattern.test(process.env.PXL_REDIS_IN_MEMORY ?? '') ||\n truthyPattern.test(process.env.REDIS_IN_MEMORY ?? '');\n\n let sharedState: InMemoryRedisSharedState | undefined;\n if (useInMemoryRedis) {\n sharedState = {\n store: new Map<string, string | Buffer>(),\n expirations: new Map<string, NodeJS.Timeout>(),\n subscriptions: new Map<string, Set<InMemoryRedisClient>>(),\n };\n }\n\n const createClient = (): Redis => {\n if (useInMemoryRedis) {\n if (!sharedState) {\n throw new Error('In-memory Redis shared state not initialized');\n }\n return new InMemoryRedisClient(sharedState) as unknown as Redis;\n }\n\n return new Redis(redisOptions);\n };\n\n const client = createClient();\n const publisherClient = createClient();\n const subscriberClient = createClient();\n\n try {\n // Wait for all three clients to be ready\n await Promise.all([\n new Promise<void>((resolve, reject) => {\n client.once('ready', () => resolve());\n client.once('error', (error: Error) => reject(error));\n }),\n new Promise<void>((resolve, reject) => {\n publisherClient.once('ready', () => resolve());\n publisherClient.once('error', (error: Error) => reject(error));\n }),\n new Promise<void>((resolve, reject) => {\n subscriberClient.once('ready', () => resolve());\n subscriberClient.once('error', (error: Error) => reject(error));\n }),\n ]);\n\n const redisInstance = new RedisInstance({\n redisManager: this,\n client,\n publisherClient,\n subscriberClient,\n });\n\n this.instances.push(redisInstance);\n\n const duration = performance.now() - startTime;\n const meta = {\n Host: this.options.host,\n Port: this.options.port,\n Duration: `${duration.toFixed(2)}ms`,\n Mode: useInMemoryRedis ? 'in-memory' : 'network',\n };\n\n if (this.options.applicationConfig.log?.startUp) {\n this.log('Connected', meta);\n } else {\n this.logger.debug({ message: 'Redis connected', meta });\n }\n\n if (useInMemoryRedis) {\n this.logger.debug({ message: 'Using in-memory Redis stub' });\n }\n\n return redisInstance;\n } catch (error) {\n const duration = performance.now() - startTime;\n\n // Clean up clients on error\n await Promise.allSettled([client.quit(), publisherClient.quit(), subscriberClient.quit()]);\n\n this.logger.error({\n error: error instanceof Error ? error : new Error(String(error)),\n message: 'Redis connection failed',\n meta: {\n Host: this.options.host,\n Port: this.options.port,\n Duration: `${duration.toFixed(2)}ms`,\n Mode: useInMemoryRedis ? 'in-memory' : 'network',\n },\n });\n\n throw error;\n }\n },\n { host: this.options.host, port: this.options.port },\n );\n }\n\n public async disconnect(): Promise<void> {\n await CachePerformanceWrapper.monitorConnection(\n 'disconnect',\n async () => {\n const startTime = performance.now();\n const instanceCount = this.instances.length;\n\n try {\n await Promise.all(this.instances.map(instance => instance.disconnect()));\n\n const duration = performance.now() - startTime;\n\n if (instanceCount > 0) {\n const meta = {\n Instances: instanceCount,\n Host: this.options.host,\n Port: this.options.port,\n Duration: `${duration.toFixed(2)}ms`,\n };\n\n if (this.options.applicationConfig.log?.startUp) {\n this.log('Disconnected all Redis instances', meta);\n } else {\n this.logger.debug({ message: 'Redis instances disconnected', meta });\n }\n }\n\n this.instances = [];\n } catch (error) {\n const duration = performance.now() - startTime;\n\n this.logger.error({\n error: error instanceof Error ? error : new Error(String(error)),\n message: 'Redis disconnection failed',\n meta: {\n Host: this.options.host,\n Port: this.options.port,\n Instances: instanceCount,\n Duration: `${duration.toFixed(2)}ms`,\n },\n });\n\n throw error;\n }\n },\n { host: this.options.host, port: this.options.port },\n );\n }\n\n /**\n * Log Redis message\n */\n public log(message: string, meta?: Record<string, unknown>): void {\n this.logger.custom({ level: 'redis', message, meta });\n }\n}\n"],
5
- "m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,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AAAA,YAC/D,SAAS;AAAA,YACT,MAAM;AAAA,cACJ,MAAM,KAAK,QAAQ;AAAA,cACnB,MAAM,KAAK,QAAQ;AAAA,cACnB,WAAW;AAAA,cACX,UAAU,GAAG,SAAS,QAAQ,CAAC,CAAC;AAAA,YAClC;AAAA,UACF,CAAC;AAED,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,MACA,EAAE,MAAM,KAAK,QAAQ,MAAM,MAAM,KAAK,QAAQ,KAAK;AAAA,IACrD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKO,IAAI,SAAiB,MAAsC;AAChE,SAAK,OAAO,OAAO,EAAE,OAAO,SAAS,SAAS,KAAK,CAAC;AAAA,EACtD;AACF;",
4
+ "sourcesContent": ["import { Redis, type RedisOptions } from 'ioredis';\nimport { EventEmitter } from 'node:events';\nimport type { RedisManagerConfig as RedisManagerOptions } from './manager.interface.js';\nimport RedisInstance from './instance.js';\nimport { Logger } from '../logger/index.js';\nimport { CachePerformanceWrapper } from '../performance/index.js';\n\nconst truthyPattern = /^(1|true|yes|on)$/i;\nconst scheduleMicrotask =\n typeof (globalThis as any).queueMicrotask === 'function'\n ? (globalThis as any).queueMicrotask.bind(globalThis)\n : (callback: () => void) => {\n void Promise.resolve().then(callback);\n };\n\ntype RedisCallback = (error: Error | null, result?: string) => void;\n\ninterface InMemoryRedisSharedState {\n store: Map<string, string | Buffer>;\n expirations: Map<string, NodeJS.Timeout>;\n subscriptions: Map<string, Set<InMemoryRedisClient>>;\n}\n\n// Global singleton shared state for in-memory Redis\nlet globalInMemoryRedisState: InMemoryRedisSharedState | null = null;\n\nfunction getGlobalInMemoryRedisState(): InMemoryRedisSharedState {\n globalInMemoryRedisState ??= {\n store: new Map<string, string | Buffer>(),\n expirations: new Map<string, NodeJS.Timeout>(),\n subscriptions: new Map<string, Set<InMemoryRedisClient>>(),\n };\n return globalInMemoryRedisState;\n}\n\nclass InMemoryRedisClient extends EventEmitter {\n private shared: InMemoryRedisSharedState;\n\n constructor(shared: InMemoryRedisSharedState) {\n super();\n this.shared = shared;\n\n scheduleMicrotask(() => {\n this.emit('ready');\n });\n }\n\n private cleanupSubscriptions(): void {\n for (const subscribers of this.shared.subscriptions.values()) {\n subscribers.delete(this);\n }\n }\n\n private clearExpirationForKey(key: string): void {\n const timer = this.shared.expirations.get(key);\n if (timer) {\n clearTimeout(timer);\n this.shared.expirations.delete(key);\n }\n }\n\n public ping(callback?: RedisCallback): Promise<string> {\n if (callback) {\n callback(null, 'PONG');\n return Promise.resolve('PONG');\n }\n\n return Promise.resolve('PONG');\n }\n\n public async set(...args: any[]): Promise<'OK'> {\n const [key, value, mode, expiration] = args;\n const serializedValue: string | Buffer = value instanceof Buffer ? value : String(value);\n\n this.shared.store.set(key, serializedValue);\n this.clearExpirationForKey(key);\n\n if (typeof mode === 'string' && mode.toUpperCase() === 'EX' && typeof expiration === 'number') {\n const timer = setTimeout(() => {\n this.shared.store.delete(key);\n this.shared.expirations.delete(key);\n }, expiration * 1000);\n\n if (typeof timer.unref === 'function') {\n timer.unref();\n }\n\n this.shared.expirations.set(key, timer);\n }\n\n return 'OK';\n }\n\n public async get(key: string): Promise<string | null> {\n return (this.shared.store.get(key) as string | undefined) ?? null;\n }\n\n public async del(key: string): Promise<number> {\n const existed = this.shared.store.delete(key);\n this.clearExpirationForKey(key);\n return existed ? 1 : 0;\n }\n\n public async publish(channel: string, message: string): Promise<number> {\n const subscribers = this.shared.subscriptions.get(channel);\n\n if (!subscribers || subscribers.size === 0) {\n return 0;\n }\n\n for (const subscriber of subscribers) {\n scheduleMicrotask(() => {\n subscriber.emit('message', channel, message);\n });\n }\n\n return subscribers.size;\n }\n\n public async subscribe(channel: string): Promise<number> {\n let subscribers = this.shared.subscriptions.get(channel);\n if (!subscribers) {\n subscribers = new Set<InMemoryRedisClient>();\n this.shared.subscriptions.set(channel, subscribers);\n }\n subscribers.add(this);\n return subscribers.size;\n }\n\n public async unsubscribe(channel: string): Promise<number> {\n const subscribers = this.shared.subscriptions.get(channel);\n\n if (!subscribers) {\n return 0;\n }\n\n subscribers.delete(this);\n return subscribers.size;\n }\n\n public async quit(): Promise<'OK'> {\n this.cleanupSubscriptions();\n this.emit('end');\n this.removeAllListeners();\n return 'OK';\n }\n\n public disconnect(): void {\n this.cleanupSubscriptions();\n this.emit('end');\n this.removeAllListeners();\n }\n}\n\nexport default class RedisManager {\n private logger: typeof Logger = Logger;\n\n private options: RedisManagerOptions;\n\n public instances: RedisInstance[] = [];\n\n constructor(config: RedisManagerOptions) {\n this.options = config;\n }\n\n public async connect(): Promise<RedisInstance> {\n return CachePerformanceWrapper.monitorConnection(\n 'connect',\n async () => {\n const startTime = performance.now();\n\n const redisOptions: RedisOptions = {\n host: this.options.host,\n port: this.options.port,\n password: this.options.password,\n maxRetriesPerRequest: null, // Needed for bullmq\n };\n\n const useInMemoryRedis =\n truthyPattern.test(process.env.PXL_REDIS_IN_MEMORY ?? '') ||\n truthyPattern.test(process.env.REDIS_IN_MEMORY ?? '');\n\n const createClient = (): Redis => {\n if (useInMemoryRedis) {\n return new InMemoryRedisClient(getGlobalInMemoryRedisState()) as unknown as Redis;\n }\n\n return new Redis(redisOptions);\n };\n\n const client = createClient();\n const publisherClient = createClient();\n const subscriberClient = createClient();\n\n try {\n // Wait for all three clients to be ready\n await Promise.all([\n new Promise<void>((resolve, reject) => {\n client.once('ready', () => resolve());\n client.once('error', (error: Error) => reject(error));\n }),\n new Promise<void>((resolve, reject) => {\n publisherClient.once('ready', () => resolve());\n publisherClient.once('error', (error: Error) => reject(error));\n }),\n new Promise<void>((resolve, reject) => {\n subscriberClient.once('ready', () => resolve());\n subscriberClient.once('error', (error: Error) => reject(error));\n }),\n ]);\n\n const redisInstance = new RedisInstance({\n redisManager: this,\n client,\n publisherClient,\n subscriberClient,\n });\n\n this.instances.push(redisInstance);\n\n const duration = performance.now() - startTime;\n const meta = {\n Host: this.options.host,\n Port: this.options.port,\n Duration: `${duration.toFixed(2)}ms`,\n Mode: useInMemoryRedis ? 'in-memory' : 'network',\n };\n\n if (this.options.applicationConfig.log?.startUp) {\n this.log('Connected', meta);\n } else {\n this.logger.debug({ message: 'Redis connected', meta });\n }\n\n if (useInMemoryRedis) {\n this.logger.debug({ message: 'Using in-memory Redis stub' });\n }\n\n return redisInstance;\n } catch (error) {\n const duration = performance.now() - startTime;\n\n // Clean up clients on error\n await Promise.allSettled([client.quit(), publisherClient.quit(), subscriberClient.quit()]);\n\n this.logger.error({\n error: error instanceof Error ? error : new Error(String(error)),\n message: 'Redis connection failed',\n meta: {\n Host: this.options.host,\n Port: this.options.port,\n Duration: `${duration.toFixed(2)}ms`,\n Mode: useInMemoryRedis ? 'in-memory' : 'network',\n },\n });\n\n throw error;\n }\n },\n { host: this.options.host, port: this.options.port },\n );\n }\n\n public async disconnect(): Promise<void> {\n await CachePerformanceWrapper.monitorConnection(\n 'disconnect',\n async () => {\n const startTime = performance.now();\n const instanceCount = this.instances.length;\n\n try {\n await Promise.all(this.instances.map(instance => instance.disconnect()));\n\n const duration = performance.now() - startTime;\n\n if (instanceCount > 0) {\n const meta = {\n Instances: instanceCount,\n Host: this.options.host,\n Port: this.options.port,\n Duration: `${duration.toFixed(2)}ms`,\n };\n\n if (this.options.applicationConfig.log?.startUp) {\n this.log('Disconnected all Redis instances', meta);\n } else {\n this.logger.debug({ message: 'Redis instances disconnected', meta });\n }\n }\n\n this.instances = [];\n } catch (error) {\n const duration = performance.now() - startTime;\n\n this.logger.error({\n error: error instanceof Error ? error : new Error(String(error)),\n message: 'Redis disconnection failed',\n meta: {\n Host: this.options.host,\n Port: this.options.port,\n Instances: instanceCount,\n Duration: `${duration.toFixed(2)}ms`,\n },\n });\n\n throw error;\n }\n },\n { host: this.options.host, port: this.options.port },\n );\n }\n\n /**\n * Log Redis message\n */\n public log(message: string, meta?: Record<string, unknown>): void {\n this.logger.custom({ level: 'redis', message, meta });\n }\n}\n"],
5
+ "mappings": ";;AAAA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,SAAS;AAAA,YACT,MAAM;AAAA,cACJ,MAAM,KAAK,QAAQ;AAAA,cACnB,MAAM,KAAK,QAAQ;AAAA,cACnB,WAAW;AAAA,cACX,UAAU,GAAG,SAAS,QAAQ,CAAC,CAAC;AAAA,YAClC;AAAA,UACF,CAAC;AAED,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,MACA,EAAE,MAAM,KAAK,QAAQ,MAAM,MAAM,KAAK,QAAQ,KAAK;AAAA,IACrD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKO,IAAI,SAAiB,MAAsC;AAChE,SAAK,OAAO,OAAO,EAAE,OAAO,SAAS,SAAS,KAAK,CAAC;AAAA,EACtD;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,3 @@
1
+ export type { RequestContext, RunWithContextOptions } from './request-context.interface.js';
2
+ export { getRequestContext, getRequestId, getUserId, setUserId, getContextMetadata, setContextMetadata, runWithContext, runWithContextAsync, enterRequestContext, requestContextStorage, } from './request-context.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-context/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
2
+ import type { RequestContext, RunWithContextOptions } from './request-context.interface.js';
3
+ /**
4
+ * AsyncLocalStorage instance for request context
5
+ *
6
+ * This provides request-scoped storage that automatically propagates through
7
+ * async operations, enabling correlation IDs and request metadata to be
8
+ * accessible throughout the request lifecycle without explicit passing.
9
+ */
10
+ declare const requestContextStorage: AsyncLocalStorage<RequestContext>;
11
+ /**
12
+ * Get the current request context
13
+ *
14
+ * @returns The current request context, or undefined if not in a request context
15
+ *
16
+ * @example
17
+ * const context = getRequestContext();
18
+ * if (context) {
19
+ * console.log('Request ID:', context.requestId);
20
+ * }
21
+ */
22
+ export declare function getRequestContext(): RequestContext | undefined;
23
+ /**
24
+ * Get the current request ID
25
+ *
26
+ * @returns The current request ID, or undefined if not in a request context
27
+ *
28
+ * @example
29
+ * const requestId = getRequestId();
30
+ * logger.info({ message: 'Processing request', requestId });
31
+ */
32
+ export declare function getRequestId(): string | undefined;
33
+ /**
34
+ * Set metadata in the current request context
35
+ *
36
+ * @param key - Metadata key
37
+ * @param value - Metadata value
38
+ *
39
+ * @example
40
+ * setContextMetadata('operation', 'userLookup');
41
+ * setContextMetadata('cacheHit', true);
42
+ */
43
+ export declare function setContextMetadata(key: string, value: unknown): void;
44
+ /**
45
+ * Get metadata from the current request context
46
+ *
47
+ * @param key - Metadata key
48
+ * @returns Metadata value, or undefined if not found
49
+ */
50
+ export declare function getContextMetadata(key: string): unknown;
51
+ /**
52
+ * Run a function within a new request context
53
+ *
54
+ * @param options - Context options (requestId will be generated if not provided)
55
+ * @param fn - Function to run within the context
56
+ * @returns The result of the function
57
+ *
58
+ * @example
59
+ * await runWithContext({ requestId: 'custom-id' }, async () => {
60
+ * await processRequest();
61
+ * });
62
+ */
63
+ export declare function runWithContext<T>(options: RunWithContextOptions | undefined, fn: () => T): T;
64
+ /**
65
+ * Run a function within a new request context (async version)
66
+ *
67
+ * @param options - Context options (requestId will be generated if not provided)
68
+ * @param fn - Async function to run within the context
69
+ * @returns Promise resolving to the result of the function
70
+ *
71
+ * @example
72
+ * await runWithContextAsync({ requestId: 'custom-id' }, async () => {
73
+ * await processRequest();
74
+ * });
75
+ */
76
+ export declare function runWithContextAsync<T>(options: RunWithContextOptions | undefined, fn: () => Promise<T>): Promise<T>;
77
+ /**
78
+ * Update the user ID in the current request context
79
+ *
80
+ * @param userId - User ID to set
81
+ *
82
+ * @example
83
+ * // After authentication
84
+ * setUserId(authenticatedUser.id);
85
+ */
86
+ export declare function setUserId(userId: string): void;
87
+ /**
88
+ * Get the user ID from the current request context
89
+ *
90
+ * @returns The current user ID, or undefined if not set
91
+ */
92
+ export declare function getUserId(): string | undefined;
93
+ /**
94
+ * Enter a new request context (advanced usage for middleware)
95
+ *
96
+ * This sets the context for the current async execution context without
97
+ * wrapping in a callback. Use with caution - prefer runWithContext when possible.
98
+ *
99
+ * @param options - Context options
100
+ *
101
+ * @example
102
+ * // In Fastify middleware
103
+ * const requestId = req.headers['x-request-id'] || crypto.randomUUID();
104
+ * enterRequestContext({ requestId });
105
+ */
106
+ export declare function enterRequestContext(options: RunWithContextOptions): void;
107
+ export { requestContextStorage };
108
+ //# sourceMappingURL=request-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../src/request-context/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5F;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,mCAA0C,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,SAAS,CAE9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAOpE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,qBAAqB,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAS5F;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,OAAO,EAAE,qBAAqB,GAAG,SAAS,EAC1C,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CASZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAK9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CASxE;AAGD,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Request context interface
3
+ *
4
+ * This interface defines the shape of the context stored in AsyncLocalStorage
5
+ * for each HTTP request, providing correlation IDs and request metadata.
6
+ */
7
+ export interface RequestContext {
8
+ /**
9
+ * Unique request ID (UUID v4/v7) for tracing/correlation
10
+ */
11
+ requestId: string;
12
+ /**
13
+ * Request start time (performance.now() timestamp)
14
+ */
15
+ startTime?: number;
16
+ /**
17
+ * Authenticated user ID (if available)
18
+ */
19
+ userId?: string;
20
+ /**
21
+ * Additional custom metadata
22
+ */
23
+ metadata?: Record<string, unknown>;
24
+ }
25
+ /**
26
+ * Options for running code within a request context
27
+ */
28
+ export interface RunWithContextOptions {
29
+ /**
30
+ * Request ID to use (generated if not provided)
31
+ */
32
+ requestId?: string;
33
+ /**
34
+ * Request start time
35
+ */
36
+ startTime?: number;
37
+ /**
38
+ * User ID
39
+ */
40
+ userId?: string;
41
+ /**
42
+ * Additional metadata
43
+ */
44
+ metadata?: Record<string, unknown>;
45
+ }
46
+ //# sourceMappingURL=request-context.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.interface.d.ts","sourceRoot":"","sources":["../../src/request-context/request-context.interface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
@@ -0,0 +1,2 @@
1
+ export { default as AwsS3 } from './s3.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/aws/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { S3Client } from '@aws-sdk/client-s3';
2
+ import type { AwsS3ConstructorOptions } from './s3.interface.js';
3
+ interface DownloadFileOptions {
4
+ bucketName: string;
5
+ key: string;
6
+ destinationFilePath: string;
7
+ }
8
+ export default class AwsS3 {
9
+ client: S3Client;
10
+ private options;
11
+ constructor(options: Partial<AwsS3ConstructorOptions>);
12
+ private getBucketUrl;
13
+ uploadFile({ bucketName, path, body, contentType, forceDownload, publicRead, }: {
14
+ bucketName: string;
15
+ path: string;
16
+ body: Buffer;
17
+ contentType?: string;
18
+ forceDownload?: boolean;
19
+ publicRead?: boolean;
20
+ }): Promise<string>;
21
+ startMultipartUpload({ bucketName, path, publicRead, }: {
22
+ bucketName: string;
23
+ path: string;
24
+ publicRead?: boolean;
25
+ }): Promise<string | undefined>;
26
+ uploadPart({ bucketName, path, partNumber, uploadId, body, }: {
27
+ bucketName: string;
28
+ path: string;
29
+ partNumber: number;
30
+ uploadId: string;
31
+ body: any;
32
+ }): Promise<string | undefined>;
33
+ completeMultipartUpload({ bucketName, path, uploadId, parts, }: {
34
+ bucketName: string;
35
+ path: string;
36
+ uploadId: string;
37
+ parts: {
38
+ PartNumber: number;
39
+ ETag: string;
40
+ }[];
41
+ }): Promise<string>;
42
+ downloadFile({ bucketName, key, destinationFilePath, onStart, onProgress, onComplete, onError, }: DownloadFileOptions & {
43
+ onStart?: () => void;
44
+ onProgress?: (progress: number) => void;
45
+ onComplete?: () => void;
46
+ onError?: (error: Error) => void;
47
+ }): Promise<void>;
48
+ generateSignedUrl({ bucket, key }: {
49
+ bucket: string;
50
+ key: string;
51
+ }): Promise<string>;
52
+ }
53
+ export {};
54
+ //# sourceMappingURL=s3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../src/services/aws/s3.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,QAAQ,EAGT,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AASjE,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,OAAO,KAAK;IACjB,MAAM,EAAE,QAAQ,CAAC;IAExB,OAAO,CAAC,OAAO,CAA0B;gBAE7B,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC;IA4CrD,OAAO,CAAC,YAAY;IAYP,UAAU,CAAC,EACtB,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,aAAa,EACb,UAAU,GACX,EAAE;QACD,UAAU,EAA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EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAClC,GAAG,OAAO,CAAC,IAAI,CAAC;IA+EJ,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CA2BlG"}
@@ -0,0 +1,14 @@
1
+ export interface AwsS3LocalstackOptions {
2
+ enabled?: boolean;
3
+ port?: number;
4
+ }
5
+ export interface AwsS3ConstructorOptions {
6
+ region: string;
7
+ localstack: AwsS3LocalstackOptions;
8
+ credentials?: {
9
+ accessKeyId?: string;
10
+ secretAccessKey?: string;
11
+ };
12
+ endpoint?: string;
13
+ }
14
+ //# sourceMappingURL=s3.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.interface.d.ts","sourceRoot":"","sources":["../../../src/services/aws/s3.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,sBAAsB,CAAC;IACnC,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export * from './aws/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}