@servicelabsco/nestjs-utility-services 2.0.0 → 2.0.2

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 (54) hide show
  1. package/dist/app.controller.d.ts +1 -74
  2. package/dist/app.controller.js +2 -355
  3. package/dist/app.controller.js.map +1 -1
  4. package/dist/common/es6.classes.js +2 -0
  5. package/dist/common/es6.classes.js.map +1 -1
  6. package/dist/common/libraries/auth.js +1 -1
  7. package/dist/common/libraries/auth.js.map +1 -1
  8. package/dist/common/libraries/custom.crypt.d.ts +5 -0
  9. package/dist/common/libraries/custom.crypt.js +86 -1
  10. package/dist/common/libraries/custom.crypt.js.map +1 -1
  11. package/dist/common/libraries/custom.logger.d.ts +7 -0
  12. package/dist/common/libraries/custom.logger.js +33 -0
  13. package/dist/common/libraries/custom.logger.js.map +1 -0
  14. package/dist/common/libraries/hash.d.ts +1 -1
  15. package/dist/common/libraries/index.d.ts +1 -0
  16. package/dist/common/libraries/index.js +1 -0
  17. package/dist/common/libraries/index.js.map +1 -1
  18. package/dist/health.check.controller.d.ts +4 -1
  19. package/dist/health.check.controller.js +72 -2
  20. package/dist/health.check.controller.js.map +1 -1
  21. package/dist/main.js +1 -1
  22. package/dist/main.js.map +1 -1
  23. package/dist/migrations/1770625065996-AddIdentifierSysDocumentsTable.ts.d.ts +5 -0
  24. package/dist/migrations/1770625065996-AddIdentifierSysDocumentsTable.ts.js +15 -0
  25. package/dist/migrations/1770625065996-AddIdentifierSysDocumentsTable.ts.js.map +1 -0
  26. package/dist/platformUtility/dtos/index.d.ts +1 -0
  27. package/dist/platformUtility/dtos/index.js +1 -0
  28. package/dist/platformUtility/dtos/index.js.map +1 -1
  29. package/dist/platformUtility/dtos/lambda.zip.dto.d.ts +4 -0
  30. package/dist/platformUtility/dtos/lambda.zip.dto.js +27 -0
  31. package/dist/platformUtility/dtos/lambda.zip.dto.js.map +1 -0
  32. package/dist/platformUtility/es6.classes.d.ts +4 -2
  33. package/dist/platformUtility/es6.classes.js +4 -0
  34. package/dist/platformUtility/es6.classes.js.map +1 -1
  35. package/dist/platformUtility/services/es6.service.d.ts +3 -1
  36. package/dist/platformUtility/services/es6.service.js +6 -2
  37. package/dist/platformUtility/services/es6.service.js.map +1 -1
  38. package/dist/platformUtility/services/index.d.ts +1 -0
  39. package/dist/platformUtility/services/index.js +1 -0
  40. package/dist/platformUtility/services/index.js.map +1 -1
  41. package/dist/platformUtility/services/mail.service.js +5 -0
  42. package/dist/platformUtility/services/mail.service.js.map +1 -1
  43. package/dist/platformUtility/services/zip.service.d.ts +16 -0
  44. package/dist/platformUtility/services/zip.service.js +107 -0
  45. package/dist/platformUtility/services/zip.service.js.map +1 -0
  46. package/dist/system/entities/document.entity.d.ts +1 -0
  47. package/dist/system/entities/document.entity.js +4 -0
  48. package/dist/system/entities/document.entity.js.map +1 -1
  49. package/dist/system/services/document.service.d.ts +3 -2
  50. package/dist/system/services/document.service.js +6 -3
  51. package/dist/system/services/document.service.js.map +1 -1
  52. package/dist/system/services/scheduled.event.service.js +4 -3
  53. package/dist/system/services/scheduled.event.service.js.map +1 -1
  54. package/package.json +10 -9
@@ -35,78 +35,5 @@ export declare class AppController {
35
35
  unset(query: any): Promise<any>;
36
36
  getQueueInstance(): Promise<any>;
37
37
  queue(id: string): Promise<any>;
38
- set(req: Request): Promise<{
39
- success: boolean;
40
- key: string;
41
- setValue: string;
42
- retrievedValue: any;
43
- match: boolean;
44
- message: string;
45
- }>;
46
- cachePersistenceTest(): Promise<{
47
- success: boolean;
48
- persisted: boolean;
49
- message: string;
50
- originalValue: any;
51
- currentTime: string;
52
- instructions: string;
53
- setValue?: undefined;
54
- immediatelyRetrieved?: undefined;
55
- immediateMatch?: undefined;
56
- storeInfo?: undefined;
57
- } | {
58
- success: boolean;
59
- persisted: boolean;
60
- message: string;
61
- setValue: {
62
- timestamp: number;
63
- message: string;
64
- random: number;
65
- };
66
- immediatelyRetrieved: any;
67
- immediateMatch: boolean;
68
- storeInfo: {
69
- hasStore: any;
70
- storeType: any;
71
- isRedis: any;
72
- };
73
- instructions: string;
74
- originalValue?: undefined;
75
- currentTime?: undefined;
76
- }>;
77
- cacheDebug(): Promise<{
78
- storeInfo: any;
79
- testOperation: {
80
- set: {
81
- timestamp: number;
82
- test: boolean;
83
- };
84
- retrieved: any;
85
- success: boolean;
86
- };
87
- redisVerification: any;
88
- environment: {
89
- REDIS_HOST: string;
90
- REDIS_PORT: string;
91
- REDIS_PASSWORD: string;
92
- REDIS_USERNAME: string;
93
- REDIS_SLUG: string;
94
- };
95
- conclusion: string;
96
- recommendation: string;
97
- status: string;
98
- error?: undefined;
99
- stack?: undefined;
100
- } | {
101
- error: any;
102
- stack: any;
103
- storeInfo?: undefined;
104
- testOperation?: undefined;
105
- redisVerification?: undefined;
106
- environment?: undefined;
107
- conclusion?: undefined;
108
- recommendation?: undefined;
109
- status?: undefined;
110
- }>;
111
- redisServiceTest(): Promise<any>;
38
+ set(req: Request): Promise<any>;
112
39
  }
@@ -28,6 +28,7 @@ const sync_all_code_job_1 = require("./system/jobs/sync.all.code.job");
28
28
  const logger_service_1 = require("./system/services/logger.service");
29
29
  const property_service_1 = require("./system/services/property.service");
30
30
  const upload_service_1 = require("./system/services/upload.service");
31
+ const custom_crypt_1 = require("./common/libraries/custom.crypt");
31
32
  let AppController = class AppController {
32
33
  constructor(queueService, testJob, setScheduledEventJob, mailService, propertyService, sqlService, executeCodeFixJob, syncAllCodeJob, auditService, redisService, uploadService, loggerService, cacheService) {
33
34
  this.queueService = queueService;
@@ -61,343 +62,7 @@ let AppController = class AppController {
61
62
  return this.queueService.getJobDetails(id);
62
63
  }
63
64
  async set(req) {
64
- const key = 'test-001';
65
- const value = 'test-value';
66
- await this.cacheService.delete(key);
67
- const retrieved = await this.cacheService.get(key);
68
- return {
69
- success: true,
70
- key,
71
- setValue: value,
72
- retrievedValue: retrieved,
73
- match: value === retrieved,
74
- message: retrieved === value
75
- ? 'Cache is working! Value persisted correctly.'
76
- : 'Cache retrieval failed. Check Redis connection and persistence.',
77
- };
78
- }
79
- async cachePersistenceTest() {
80
- const key = 'persistence-test';
81
- const testValue = {
82
- timestamp: Date.now(),
83
- message: 'This value should persist after restart',
84
- random: Math.random(),
85
- };
86
- const existing = await this.cacheService.get(key);
87
- if (existing) {
88
- return {
89
- success: true,
90
- persisted: true,
91
- message: '✅ Cache persistence is working! Value survived restart.',
92
- originalValue: existing,
93
- currentTime: new Date().toISOString(),
94
- instructions: 'Restart the app and call this endpoint again. If you see this message, persistence is working.',
95
- };
96
- }
97
- else {
98
- await this.cacheService.set(key, testValue);
99
- const immediatelyRetrieved = await this.cacheService.get(key);
100
- const storeInfo = await this.cacheService.getStoreInfo();
101
- return {
102
- success: true,
103
- persisted: false,
104
- message: 'Value set. Restart the app and call this endpoint again to test persistence.',
105
- setValue: testValue,
106
- immediatelyRetrieved: immediatelyRetrieved,
107
- immediateMatch: JSON.stringify(testValue) === JSON.stringify(immediatelyRetrieved),
108
- storeInfo: {
109
- hasStore: storeInfo.hasStore,
110
- storeType: storeInfo.storeType,
111
- isRedis: storeInfo.isRedis || storeInfo.keyvBackend === 'Redis',
112
- },
113
- instructions: '1. Restart your NestJS application\n2. Call GET /cache-persistence-test again\n3. If you see persisted: true, cache persistence is working!\n\n⚠️ If storeInfo.isRedis is false, cache may be using in-memory store.',
114
- };
115
- }
116
- }
117
- async cacheDebug() {
118
- try {
119
- const storeInfo = await this.cacheService.getStoreInfo();
120
- const testKey = 'debug-test';
121
- const testValue = { timestamp: Date.now(), test: true };
122
- await this.cacheService.set(testKey, testValue);
123
- const retrieved = await this.cacheService.get(testKey);
124
- await this.cacheService.delete(testKey);
125
- const envInfo = {
126
- REDIS_HOST: process.env.REDIS_HOST || 'not set',
127
- REDIS_PORT: process.env.REDIS_PORT || 'not set',
128
- REDIS_PASSWORD: process.env.REDIS_PASSWORD ? '***set***' : 'not set',
129
- REDIS_USERNAME: process.env.REDIS_USERNAME || 'not set',
130
- REDIS_SLUG: process.env.REDIS_SLUG || 'not set',
131
- };
132
- let redisVerification = null;
133
- try {
134
- const redisTestKey = `__redis_verify_${Date.now()}`;
135
- const redisTestValue = 'redis-verification-test';
136
- await this.redisService.set(redisTestKey, redisTestValue);
137
- const redisRetrieved = await this.redisService.get(redisTestKey);
138
- await this.redisService.del(redisTestKey);
139
- const cacheSlug = process.env.REDIS_SLUG || 'cache';
140
- const cacheKey = `cache.${testKey}`;
141
- let cacheKeyInRedis = false;
142
- let cacheKeysWithPrefix = [];
143
- try {
144
- const retrieved = await this.redisService.get(cacheKey);
145
- cacheKeyInRedis = !!retrieved;
146
- const searchPattern = '*cache*';
147
- const allKeys = await this.redisService.keys(searchPattern);
148
- cacheKeysWithPrefix = allKeys || [];
149
- }
150
- catch (e) {
151
- }
152
- redisVerification = {
153
- directRedisAccess: true,
154
- redisServiceWorking: redisRetrieved === redisTestValue,
155
- cacheKey: cacheKey,
156
- cacheKeyInRedis: !!cacheKeyInRedis,
157
- cacheSlug: cacheSlug,
158
- cacheKeysFound: cacheKeysWithPrefix.length,
159
- sampleCacheKeys: cacheKeysWithPrefix.slice(0, 5),
160
- message: cacheKeyInRedis
161
- ? '✅ Cache key found in Redis! Cache is using Redis store.'
162
- : cacheKeysWithPrefix.length > 0
163
- ? `⚠️ Cache key not found, but ${cacheKeysWithPrefix.length} other cache keys found in Redis. Cache is likely using Redis.`
164
- : '⚠️ No cache keys found in Redis. Cache may be using in-memory store or keys expired.',
165
- };
166
- }
167
- catch (e) {
168
- redisVerification = {
169
- directRedisAccess: false,
170
- error: e.message,
171
- };
172
- }
173
- const likelyUsingRedis = storeInfo.isRedis || (storeInfo.redisTest?.setSuccess && storeInfo.redisTest?.getSuccess) || redisVerification?.directRedisAccess;
174
- return {
175
- storeInfo,
176
- testOperation: {
177
- set: testValue,
178
- retrieved,
179
- success: JSON.stringify(testValue) === JSON.stringify(retrieved),
180
- },
181
- redisVerification,
182
- environment: envInfo,
183
- conclusion: likelyUsingRedis
184
- ? '✅ Cache appears to be using Redis store. To verify persistence, restart the app and check if cached values remain.'
185
- : '⚠️ Cannot confirm Redis store is being used. Cache is working but may be in-memory. Check Redis connection and cache configuration.',
186
- recommendation: likelyUsingRedis
187
- ? '✅ Redis store is likely configured. Ensure Redis persistence (RDB/AOF) is enabled for data to survive restarts. Test by restarting the app and checking if cached values persist.'
188
- : '⚠️ Warning: Cache may be using in-memory store. Data will be lost on restart. Verify Redis connection and check application logs for connection errors.',
189
- status: likelyUsingRedis ? 'OK' : 'WARNING',
190
- };
191
- }
192
- catch (error) {
193
- return {
194
- error: error.message,
195
- stack: error.stack,
196
- };
197
- }
198
- }
199
- async redisServiceTest() {
200
- const testResults = {
201
- timestamp: new Date().toISOString(),
202
- tests: {},
203
- summary: {
204
- passed: 0,
205
- failed: 0,
206
- total: 0,
207
- },
208
- environment: {
209
- REDIS_SLUG: process.env.REDIS_SLUG || 'not set',
210
- REDIS_PREFIX: process.env.REDIS_PREFIX || 'not set',
211
- REDIS_HOST: process.env.REDIS_HOST || 'not set',
212
- REDIS_PORT: process.env.REDIS_PORT || 'not set',
213
- activePrefix: process.env.REDIS_SLUG || process.env.REDIS_PREFIX || 'not set (this will cause issues)',
214
- },
215
- };
216
- try {
217
- if (!process.env.REDIS_SLUG && !process.env.REDIS_PREFIX) {
218
- return {
219
- success: false,
220
- error: 'REDIS_SLUG or REDIS_PREFIX environment variable is not set',
221
- message: '⚠️ REDIS_SLUG (or REDIS_PREFIX) must be set for RedisService to work correctly. The getIdentifier() method requires it.',
222
- environment: testResults.environment,
223
- recommendation: 'Set REDIS_SLUG in your .env file (e.g., REDIS_SLUG=devnu)',
224
- };
225
- }
226
- const testKey = `redis-service-test-${Date.now()}`;
227
- const testValue = `test-value-${Math.random()}`;
228
- testResults.tests.set = {
229
- key: testKey,
230
- value: testValue,
231
- result: null,
232
- success: false,
233
- error: null,
234
- };
235
- try {
236
- const setResult = await this.redisService.set(testKey, testValue);
237
- testResults.tests.set.result = setResult;
238
- testResults.tests.set.success = setResult === 'OK' || setResult === 'ok';
239
- }
240
- catch (setError) {
241
- testResults.tests.set.error = setError.message;
242
- testResults.tests.set.success = false;
243
- }
244
- testResults.summary.total++;
245
- if (testResults.tests.set.success)
246
- testResults.summary.passed++;
247
- else
248
- testResults.summary.failed++;
249
- testResults.tests.get = {
250
- key: testKey,
251
- expectedValue: testValue,
252
- retrievedValue: null,
253
- success: false,
254
- error: null,
255
- };
256
- try {
257
- const getResult = await this.redisService.get(testKey);
258
- testResults.tests.get.retrievedValue = getResult;
259
- testResults.tests.get.success = getResult === testValue;
260
- }
261
- catch (getError) {
262
- testResults.tests.get.error = getError.message;
263
- testResults.tests.get.success = false;
264
- }
265
- testResults.summary.total++;
266
- if (testResults.tests.get.success)
267
- testResults.summary.passed++;
268
- else
269
- testResults.summary.failed++;
270
- testResults.tests.exists = {
271
- key: testKey,
272
- result: null,
273
- success: false,
274
- error: null,
275
- };
276
- try {
277
- const existsResult = await this.redisService.exists(testKey);
278
- testResults.tests.exists.result = existsResult;
279
- testResults.tests.exists.success = existsResult === 1;
280
- }
281
- catch (existsError) {
282
- testResults.tests.exists.error = existsError.message;
283
- testResults.tests.exists.success = false;
284
- }
285
- testResults.summary.total++;
286
- if (testResults.tests.exists.success)
287
- testResults.summary.passed++;
288
- else
289
- testResults.summary.failed++;
290
- testResults.tests.ttl = {
291
- key: testKey,
292
- result: null,
293
- success: false,
294
- error: null,
295
- };
296
- try {
297
- const ttlResult = await this.redisService.ttl(testKey);
298
- testResults.tests.ttl.result = ttlResult;
299
- testResults.tests.ttl.success = ttlResult >= -1;
300
- }
301
- catch (ttlError) {
302
- testResults.tests.ttl.error = ttlError.message;
303
- testResults.tests.ttl.success = false;
304
- }
305
- testResults.summary.total++;
306
- if (testResults.tests.ttl.success)
307
- testResults.summary.passed++;
308
- else
309
- testResults.summary.failed++;
310
- const keysPattern = `redis-service-test*`;
311
- testResults.tests.keys = {
312
- pattern: keysPattern,
313
- result: null,
314
- success: false,
315
- error: null,
316
- skipped: false,
317
- };
318
- try {
319
- const redisPrefix = process.env.REDIS_SLUG || process.env.REDIS_PREFIX;
320
- if (!redisPrefix) {
321
- testResults.tests.keys.skipped = true;
322
- testResults.tests.keys.error = 'REDIS_SLUG or REDIS_PREFIX not set - keys test skipped';
323
- testResults.tests.keys.success = false;
324
- testResults.summary.total++;
325
- testResults.summary.failed++;
326
- }
327
- else {
328
- const keysResult = await this.redisService.keys(keysPattern);
329
- testResults.tests.keys.result = keysResult;
330
- testResults.tests.keys.success = Array.isArray(keysResult);
331
- testResults.summary.total++;
332
- if (testResults.tests.keys.success)
333
- testResults.summary.passed++;
334
- else
335
- testResults.summary.failed++;
336
- }
337
- }
338
- catch (keysError) {
339
- testResults.tests.keys.error = keysError.message;
340
- testResults.tests.keys.success = false;
341
- testResults.summary.total++;
342
- testResults.summary.failed++;
343
- }
344
- testResults.tests.del = {
345
- key: testKey,
346
- result: null,
347
- success: false,
348
- };
349
- const delResult = await this.redisService.del(testKey);
350
- testResults.tests.del.result = delResult;
351
- testResults.tests.del.success = delResult === 1;
352
- testResults.summary.total++;
353
- if (testResults.tests.del.success)
354
- testResults.summary.passed++;
355
- else
356
- testResults.summary.failed++;
357
- const existsAfterDel = await this.redisService.exists(testKey);
358
- testResults.tests.del.existsAfterDelete = existsAfterDel;
359
- testResults.tests.del.fullyDeleted = existsAfterDel === 0;
360
- const incrKey = `redis-service-test-incr-${Date.now()}`;
361
- testResults.tests.incr = {
362
- key: incrKey,
363
- results: [],
364
- success: false,
365
- };
366
- const incr1 = await this.redisService.incr(incrKey);
367
- const incr2 = await this.redisService.incr(incrKey);
368
- const incr3 = await this.redisService.incr(incrKey);
369
- testResults.tests.incr.results = [incr1, incr2, incr3];
370
- testResults.tests.incr.success = incr1 === 1 && incr2 === 2 && incr3 === 3;
371
- testResults.summary.total++;
372
- if (testResults.tests.incr.success)
373
- testResults.summary.passed++;
374
- else
375
- testResults.summary.failed++;
376
- await this.redisService.del(incrKey);
377
- testResults.environment = {
378
- REDIS_SLUG: process.env.REDIS_SLUG || 'not set',
379
- REDIS_PREFIX: process.env.REDIS_PREFIX || 'not set',
380
- REDIS_HOST: process.env.REDIS_HOST || 'not set',
381
- REDIS_PORT: process.env.REDIS_PORT || 'not set',
382
- REDIS_PASSWORD: process.env.REDIS_PASSWORD ? 'set' : 'not set',
383
- REDIS_USERNAME: process.env.REDIS_USERNAME || 'not set',
384
- activePrefix: process.env.REDIS_SLUG || process.env.REDIS_PREFIX || 'not set',
385
- };
386
- testResults.status = testResults.summary.failed === 0 ? 'OK' : 'FAILED';
387
- testResults.message =
388
- testResults.summary.failed === 0
389
- ? '✅ RedisService is working correctly! All tests passed.'
390
- : `⚠️ RedisService has issues. ${testResults.summary.failed} test(s) failed.`;
391
- return testResults;
392
- }
393
- catch (error) {
394
- return {
395
- success: false,
396
- error: error.message,
397
- stack: error.stack,
398
- message: '❌ RedisService test failed with an error. Check Redis connection and configuration.',
399
- };
400
- }
65
+ return custom_crypt_1.CustomCrypt.decrypt('U2FsdGVkX187Cv+jpliQ3EZV/BG4GRf/pLOwZ0q91/y2L9gyVaY3LVSByb2i2Gju3qbc3OJBUHvOUH46nsRa3A==');
401
66
  }
402
67
  };
403
68
  exports.AppController = AppController;
@@ -446,24 +111,6 @@ __decorate([
446
111
  __metadata("design:paramtypes", [Object]),
447
112
  __metadata("design:returntype", Promise)
448
113
  ], AppController.prototype, "set", null);
449
- __decorate([
450
- (0, common_1.Get)('cache-persistence-test'),
451
- __metadata("design:type", Function),
452
- __metadata("design:paramtypes", []),
453
- __metadata("design:returntype", Promise)
454
- ], AppController.prototype, "cachePersistenceTest", null);
455
- __decorate([
456
- (0, common_1.Get)('cache-debug'),
457
- __metadata("design:type", Function),
458
- __metadata("design:paramtypes", []),
459
- __metadata("design:returntype", Promise)
460
- ], AppController.prototype, "cacheDebug", null);
461
- __decorate([
462
- (0, common_1.Get)('redis-service-test'),
463
- __metadata("design:type", Function),
464
- __metadata("design:paramtypes", []),
465
- __metadata("design:returntype", Promise)
466
- ], AppController.prototype, "redisServiceTest", null);
467
114
  exports.AppController = AppController = __decorate([
468
115
  (0, common_1.Controller)(),
469
116
  __metadata("design:paramtypes", [queue_service_1.QueueService,
@@ -1 +1 @@
1
- {"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0E;AAE1E,kDAA+C;AAC/C,8DAA0D;AAC1D,4EAAwE;AACxE,4EAAwE;AACxE,0EAAsE;AACtE,4EAAwE;AACxE,4EAAwE;AACxE,wEAAoE;AACpE,6EAAuE;AACvE,mFAA6E;AAC7E,uEAAiE;AACjE,qEAAiE;AACjE,yEAAqE;AACrE,qEAAiE;AAU1D,IAAM,aAAa,GAAnB,MAAM,aAAa;IAgBtB,YACqB,YAA0B,EACxB,OAAgB,EAChB,oBAA0C,EAC1C,WAAwB,EACxB,eAAgC,EAChC,UAAsB,EACtB,iBAAoC,EACpC,cAA8B,EAC9B,YAA0B,EAC1B,YAA0B,EAC1B,aAA4B,EAC5B,aAA4B,EAC5B,YAA0B;QAZ5B,iBAAY,GAAZ,YAAY,CAAc;QACxB,YAAO,GAAP,OAAO,CAAS;QAChB,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,gBAAW,GAAX,WAAW,CAAa;QACxB,oBAAe,GAAf,eAAe,CAAiB;QAChC,eAAU,GAAV,UAAU,CAAY;QACtB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,kBAAa,GAAb,aAAa,CAAe;QAC5B,kBAAa,GAAb,aAAa,CAAe;QAC5B,iBAAY,GAAZ,YAAY,CAAc;IAC9C,CAAC;IAOE,AAAN,KAAK,CAAC,GAAG;QACL,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACvC,CAAC;IAOK,AAAN,KAAK,C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A,YAAG,GAAE,CAAA;;;;wCAEf;wBA/FQ,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAkB0B,4BAAY;QACf,kBAAO;QACM,8CAAoB;QAC7B,0BAAW;QACP,kCAAe;QACpB,wBAAU;QACH,wCAAiB;QACpB,kCAAc;QAChB,4BAAY;QACZ,4BAAY;QACX,8BAAa;QACb,8BAAa;QACd,4BAAY;GA7BxC,aAAa,CAgGzB"}
@@ -39,6 +39,7 @@ const common_mongo_entity_1 = require("./libraries/common.mongo.entity");
39
39
  const common_service_1 = require("./libraries/common.service");
40
40
  const common_subscriber_1 = require("./libraries/common.subscriber");
41
41
  const custom_crypt_1 = require("./libraries/custom.crypt");
42
+ const custom_logger_1 = require("./libraries/custom.logger");
42
43
  const data_manager_1 = require("./libraries/data.manager");
43
44
  const database_event_evaluator_1 = require("./libraries/database.event.evaluator");
44
45
  const date_util_1 = require("./libraries/date.util");
@@ -94,6 +95,7 @@ const es6Classes = {
94
95
  common_service_1.CommonService,
95
96
  common_subscriber_1.CommonSubscriber,
96
97
  custom_crypt_1.CustomCrypt,
98
+ custom_logger_1.CustomLogger,
97
99
  data_manager_1.DataManager,
98
100
  database_event_evaluator_1.DatabaseEventEvaluator,
99
101
  date_util_1.DateUtil,
@@ -1 +1 @@
1
- {"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/common/es6.classes.ts"],"names":[],"mappings":";;AAAA,kEAA6D;AAC7D,wEAAmE;AACnE,8EAAwE;AACxE,4EAAsE;AACtE,kEAA6D;AAC7D,wEAAmE;AACnE,4EAAsE;AACtE,0EAAoE;AACpE,4DAAuD;AACvD,8DAAyD;AACzD,8DAAyD;AACzD,oFAA8E;AAC9E,8EAAwE;AACxE,oEAA8D;AAC9D,oEAA8D;AAC9D,sEAAgE;AAChE,wDAAmD;AACnD,4EAAsE;AACtE,0DAAqD;AACrD,gEAA2D;AAC3D,4DAAuD;AACvD,4EAAsE;AACtE,oEAAgE;AAChE,gEAA4D;AAC5D,8EAA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B;QAChB,kCAAe;QACf,8BAAa;QACb,qCAAgB;QAChB,uCAAiB;QACjB,uCAAiB;QACjB,mDAAuB;QACvB,8BAAa;KAChB;CACJ,CAAC;AAEF,kBAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/common/es6.classes.ts"],"names":[],"mappings":";;AAAA,kEAA6D;AAC7D,wEAAmE;AACnE,8EAAwE;AACxE,4EAAsE;AACtE,kEAA6D;AAC7D,wEAAmE;AACnE,4EAAsE;AACtE,0EAAoE;AACpE,4DAAuD;AACvD,8DAAyD;AACzD,8DAAyD;AACzD,oFAA8E;AAC9E,8EAAwE;AACxE,oEAA8D;AAC9D,oEAA8D;AAC9D,sEAAgE;AAChE,wDAAmD;AACnD,4EAAsE;AACtE,0DAAqD;AACrD,gEAA2D;AAC3D,4DAAuD;AACvD,4EAAsE;AACtE,oEAAgE;AAChE,gEAA4D;AAC5D,8EAA0E;AAC1E,oFAA8E;AAC9E,0EAAsE;AACtE,gFAA4E;AAC5E,2CAAwC;AACxC,+EAA0E;AAC1E,2DAAuD;AACvD,iEAA6D;AAC7D,6DAAyD;AACzD,uDAAmD;AACnD,qEAAgE;AAChE,yEAAoE;AACpE,+DAA2D;AAC3D,qEAAiE;AACjE,2DAAuD;AACvD,6DAAyD;AACzD,2DAAuD;AACvD,mFAA8E;AAC9E,qDAAiD;AACjD,mEAA+D;AAC/D,2EAAsE;AACtE,yEAAoE;AACpE,2CAAwC;AACxC,+DAA2D;AAC3D,2DAAuD;AACvD,qEAAiE;AACjE,mEAA+D;AAC/D,+DAA2D;AAC3D,uEAAkE;AAClE,yEAAoE;AACpE,yEAAoE;AACpE,qFAAgF;AAChF,+DAA2D;AAE3D,MAAM,UAAU,GAAG;IACf,QAAQ,EAAE,CAAC,iCAAc,CAAC;IAC1B,IAAI,EAAE;QACF,2CAAmB;QACnB,gDAAqB;QACrB,8CAAoB;QACpB,qCAAgB;QAChB,2CAAmB;QACnB,8CAAoB;QACpB,4CAAmB;QACnB,+BAAa;QACb,iCAAc;QACd,iCAAc;QACd,sDAAwB;QACxB,gDAAqB;QACrB,sCAAgB;QAChB,sCAAgB;QAChB,wCAAiB;QACjB,2BAAW;QACX,8CAAoB;QACpB,6BAAY;QACZ,mCAAe;QACf,+BAAa;QACb,8CAAoB;KACvB;IACD,UAAU,EAAE,CAAC,kCAAe,EAAE,8BAAa,EAAE,4CAAoB,EAAE,gDAAqB,EAAE,wCAAkB,EAAE,8CAAqB,CAAC;IACpI,SAAS,EAAE;QACP,WAAI;QACJ,6CAAoB;QACpB,0BAAW;QACX,gCAAc;QACd,4BAAY;QACZ,sBAAS;QACT,mCAAe;QACf,uCAAiB;QACjB,8BAAa;QACb,oCAAgB;QAChB,0BAAW;QACX,4BAAY;QACZ,0BAAW;QACX,iDAAsB;QACtB,oBAAQ;QACR,kCAAe;QACf,yCAAkB;QAClB,uCAAiB;QACjB,WAAI;QACJ,8BAAa;QACb,0BAAW;QACX,oCAAgB;QAChB,kCAAe;QACf,8BAAa;QACb,qCAAgB;QAChB,uCAAiB;QACjB,uCAAiB;QACjB,mDAAuB;QACvB,8BAAa;KAChB;CACJ,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Auth = void 0;
4
- const httpContext = require("express-http-context");
4
+ const httpContext = require("express-http-context2");
5
5
  class Auth {
6
6
  static user() {
7
7
  return httpContext.get('auth');
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/common/libraries/auth.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AASpD,MAAa,IAAI;IAOb,MAAM,CAAC,IAAI;QACP,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAQD,MAAM,CAAC,KAAK;QACR,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/B,CAAC;IAQD,MAAM,CAAC,EAAE;QACL,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAClC,CAAC;IAQD,MAAM,CAAC,KAAK,CAAC,IAAmB;QAC5B,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;CACJ;AA5CD,oBA4CC"}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/common/libraries/auth.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AASrD,MAAa,IAAI;IAOb,MAAM,CAAC,IAAI;QACP,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAQD,MAAM,CAAC,KAAK;QACR,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/B,CAAC;IAQD,MAAM,CAAC,EAAE;QACL,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAClC,CAAC;IAQD,MAAM,CAAC,KAAK,CAAC,IAAmB;QAC5B,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;CACJ;AA5CD,oBA4CC"}
@@ -4,4 +4,9 @@ export declare class CustomCrypt {
4
4
  private static getKey;
5
5
  static encrypt(data: any): string;
6
6
  static decrypt(cipherText: string): any;
7
+ private static tryDecrypt;
8
+ private static tryDecryptSaltedFormat;
9
+ private static evpBytesToKey;
10
+ private static looksLikeEncrypted;
11
+ private static tryPlaintextFallback;
7
12
  }
@@ -23,7 +23,23 @@ class CustomCrypt {
23
23
  return iv.toString('base64') + ':' + encrypted;
24
24
  }
25
25
  static decrypt(cipherText) {
26
+ if (cipherText == null || cipherText === '') {
27
+ return false;
28
+ }
26
29
  const key = this.getKey();
30
+ const decrypted = this.tryDecrypt(cipherText, key);
31
+ if (decrypted !== false) {
32
+ return decrypted;
33
+ }
34
+ if (!this.looksLikeEncrypted(cipherText)) {
35
+ return this.tryPlaintextFallback(cipherText);
36
+ }
37
+ return false;
38
+ }
39
+ static tryDecrypt(cipherText, key) {
40
+ const saltedResult = this.tryDecryptSaltedFormat(cipherText);
41
+ if (saltedResult !== false)
42
+ return saltedResult;
27
43
  try {
28
44
  let iv;
29
45
  let encrypted;
@@ -54,7 +70,76 @@ class CustomCrypt {
54
70
  decrypted += decipher.final('utf8');
55
71
  return JSON.parse(decrypted);
56
72
  }
57
- catch (error) {
73
+ catch {
74
+ return false;
75
+ }
76
+ }
77
+ static tryDecryptSaltedFormat(cipherText) {
78
+ try {
79
+ const decoded = Buffer.from(cipherText, 'base64');
80
+ if (decoded.length < 16)
81
+ return false;
82
+ const saltedPrefix = decoded.slice(0, 8).toString('utf8');
83
+ if (saltedPrefix !== 'Salted__')
84
+ return false;
85
+ const salt = decoded.slice(8, 16);
86
+ const ciphertext = decoded.slice(16);
87
+ const secretKey = process.env.APP_KEY || '';
88
+ if (!secretKey)
89
+ return false;
90
+ const { key, iv } = this.evpBytesToKey(secretKey, salt, 32, 16);
91
+ const decipher = crypto.createDecipheriv(this.algorithm, key, iv);
92
+ let decrypted = decipher.update(ciphertext);
93
+ decrypted = Buffer.concat([decrypted, decipher.final()]);
94
+ return JSON.parse(decrypted.toString('utf8'));
95
+ }
96
+ catch {
97
+ return false;
98
+ }
99
+ }
100
+ static evpBytesToKey(password, salt, keyLen, ivLen) {
101
+ const passwordBuf = Buffer.from(password, 'utf8');
102
+ const hashes = [];
103
+ let prev = Buffer.alloc(0);
104
+ while (hashes.length * 16 < keyLen + ivLen) {
105
+ const h = crypto.createHash('md5');
106
+ h.update(prev);
107
+ h.update(passwordBuf);
108
+ h.update(salt);
109
+ prev = h.digest();
110
+ hashes.push(prev);
111
+ }
112
+ const combined = Buffer.concat(hashes);
113
+ return {
114
+ key: combined.slice(0, keyLen),
115
+ iv: combined.slice(keyLen, keyLen + ivLen),
116
+ };
117
+ }
118
+ static looksLikeEncrypted(text) {
119
+ if (text.includes(':')) {
120
+ const parts = text.split(':');
121
+ const firstPart = parts[0];
122
+ if (/^[A-Za-z0-9+/]+=*$/.test(firstPart) && firstPart.length >= 16) {
123
+ return true;
124
+ }
125
+ }
126
+ if (/^[A-Za-z0-9+/]+=*$/.test(text) && text.length >= 24) {
127
+ return true;
128
+ }
129
+ return false;
130
+ }
131
+ static tryPlaintextFallback(cipherText) {
132
+ try {
133
+ const trimmed = cipherText.trim();
134
+ if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
135
+ return JSON.parse(cipherText);
136
+ }
137
+ if (trimmed.startsWith('[') && trimmed.endsWith(']')) {
138
+ return JSON.parse(cipherText);
139
+ }
140
+ return cipherText;
141
+ }
142
+ catch {
58
143
  return false;
59
144
  }
60
145
  }