@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.
- package/dist/app.controller.d.ts +1 -74
- package/dist/app.controller.js +2 -355
- package/dist/app.controller.js.map +1 -1
- package/dist/common/es6.classes.js +2 -0
- package/dist/common/es6.classes.js.map +1 -1
- package/dist/common/libraries/auth.js +1 -1
- package/dist/common/libraries/auth.js.map +1 -1
- package/dist/common/libraries/custom.crypt.d.ts +5 -0
- package/dist/common/libraries/custom.crypt.js +86 -1
- package/dist/common/libraries/custom.crypt.js.map +1 -1
- package/dist/common/libraries/custom.logger.d.ts +7 -0
- package/dist/common/libraries/custom.logger.js +33 -0
- package/dist/common/libraries/custom.logger.js.map +1 -0
- package/dist/common/libraries/hash.d.ts +1 -1
- package/dist/common/libraries/index.d.ts +1 -0
- package/dist/common/libraries/index.js +1 -0
- package/dist/common/libraries/index.js.map +1 -1
- package/dist/health.check.controller.d.ts +4 -1
- package/dist/health.check.controller.js +72 -2
- package/dist/health.check.controller.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/migrations/1770625065996-AddIdentifierSysDocumentsTable.ts.d.ts +5 -0
- package/dist/migrations/1770625065996-AddIdentifierSysDocumentsTable.ts.js +15 -0
- package/dist/migrations/1770625065996-AddIdentifierSysDocumentsTable.ts.js.map +1 -0
- package/dist/platformUtility/dtos/index.d.ts +1 -0
- package/dist/platformUtility/dtos/index.js +1 -0
- package/dist/platformUtility/dtos/index.js.map +1 -1
- package/dist/platformUtility/dtos/lambda.zip.dto.d.ts +4 -0
- package/dist/platformUtility/dtos/lambda.zip.dto.js +27 -0
- package/dist/platformUtility/dtos/lambda.zip.dto.js.map +1 -0
- package/dist/platformUtility/es6.classes.d.ts +4 -2
- package/dist/platformUtility/es6.classes.js +4 -0
- package/dist/platformUtility/es6.classes.js.map +1 -1
- package/dist/platformUtility/services/es6.service.d.ts +3 -1
- package/dist/platformUtility/services/es6.service.js +6 -2
- package/dist/platformUtility/services/es6.service.js.map +1 -1
- package/dist/platformUtility/services/index.d.ts +1 -0
- package/dist/platformUtility/services/index.js +1 -0
- package/dist/platformUtility/services/index.js.map +1 -1
- package/dist/platformUtility/services/mail.service.js +5 -0
- package/dist/platformUtility/services/mail.service.js.map +1 -1
- package/dist/platformUtility/services/zip.service.d.ts +16 -0
- package/dist/platformUtility/services/zip.service.js +107 -0
- package/dist/platformUtility/services/zip.service.js.map +1 -0
- package/dist/system/entities/document.entity.d.ts +1 -0
- package/dist/system/entities/document.entity.js +4 -0
- package/dist/system/entities/document.entity.js.map +1 -1
- package/dist/system/services/document.service.d.ts +3 -2
- package/dist/system/services/document.service.js +6 -3
- package/dist/system/services/document.service.js.map +1 -1
- package/dist/system/services/scheduled.event.service.js +4 -3
- package/dist/system/services/scheduled.event.service.js.map +1 -1
- package/package.json +10 -9
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ZipService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const operation_exception_1 = require("../../common/exceptions/operation.exception");
|
|
15
|
+
const common_service_1 = require("../../common/libraries/common.service");
|
|
16
|
+
const property_service_1 = require("../../system/services/property.service");
|
|
17
|
+
const remote_request_service_1 = require("./remote.request.service");
|
|
18
|
+
let ZipService = class ZipService extends common_service_1.CommonService {
|
|
19
|
+
constructor(propertyService, remoteRequestService) {
|
|
20
|
+
super();
|
|
21
|
+
this.propertyService = propertyService;
|
|
22
|
+
this.remoteRequestService = remoteRequestService;
|
|
23
|
+
this.publicExposed = true;
|
|
24
|
+
}
|
|
25
|
+
async zip(files) {
|
|
26
|
+
const token = await this.getZipToken();
|
|
27
|
+
if (!token)
|
|
28
|
+
throw new operation_exception_1.OperationException('Zip token not found');
|
|
29
|
+
const options = {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
url: 'https://5rpkoai7vk.execute-api.ap-south-1.amazonaws.com/prod/zip-files',
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: `Bearer ${token}`,
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
},
|
|
36
|
+
data: files,
|
|
37
|
+
timeout: 900000,
|
|
38
|
+
maxBodyLength: Infinity,
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
const response = await this.remoteRequestService.sendThroughAxios(options);
|
|
42
|
+
if (response?.data?.success) {
|
|
43
|
+
return response.data.zipUrl;
|
|
44
|
+
}
|
|
45
|
+
const apiError = response?.data?.error || 'Failed to create zip file';
|
|
46
|
+
throw new operation_exception_1.OperationException(apiError);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error instanceof operation_exception_1.OperationException)
|
|
50
|
+
throw error;
|
|
51
|
+
const message = error?.response?.data?.error ?? error?.response?.data?.message ?? error?.message ?? 'Zip request failed';
|
|
52
|
+
throw new operation_exception_1.OperationException(message);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async unzip(url) {
|
|
56
|
+
const token = await this.getUnzipToken();
|
|
57
|
+
if (!token)
|
|
58
|
+
throw new operation_exception_1.OperationException('Unzip token not found');
|
|
59
|
+
const options = {
|
|
60
|
+
method: 'post',
|
|
61
|
+
maxBodyLength: Infinity,
|
|
62
|
+
url: 'https://stogyux6hk.execute-api.ap-south-1.amazonaws.com/prod/unzip-files',
|
|
63
|
+
headers: {
|
|
64
|
+
Authorization: `Bearer ${token}`,
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
},
|
|
67
|
+
data: { url },
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
const response = await this.remoteRequestService.sendThroughAxios(options);
|
|
71
|
+
if (response?.data?.success) {
|
|
72
|
+
return response.data.files || [];
|
|
73
|
+
}
|
|
74
|
+
const apiError = response?.data?.error || 'Failed to unzip file';
|
|
75
|
+
throw new operation_exception_1.OperationException(apiError);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (error instanceof operation_exception_1.OperationException)
|
|
79
|
+
throw error;
|
|
80
|
+
const message = error?.response?.data?.error ?? error?.response?.data?.message ?? error?.message ?? 'Unzip request failed';
|
|
81
|
+
throw new operation_exception_1.OperationException(message);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async getZipToken() {
|
|
85
|
+
if (this.zipToken)
|
|
86
|
+
return this.zipToken;
|
|
87
|
+
this.zipToken = await this.propertyService.get('lambda.zip.token');
|
|
88
|
+
if (!this.zipToken)
|
|
89
|
+
throw new operation_exception_1.OperationException('Zip token not found, set property lambda.zip.token');
|
|
90
|
+
return this.zipToken;
|
|
91
|
+
}
|
|
92
|
+
async getUnzipToken() {
|
|
93
|
+
if (this.unzipToken)
|
|
94
|
+
return this.unzipToken;
|
|
95
|
+
this.unzipToken = await this.propertyService.get('lambda.unzip.token');
|
|
96
|
+
if (!this.unzipToken)
|
|
97
|
+
throw new operation_exception_1.OperationException('Unzip token not found, set property lambda.unzip.token');
|
|
98
|
+
return this.unzipToken;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
exports.ZipService = ZipService;
|
|
102
|
+
exports.ZipService = ZipService = __decorate([
|
|
103
|
+
(0, common_1.Injectable)(),
|
|
104
|
+
__metadata("design:paramtypes", [property_service_1.PropertyService,
|
|
105
|
+
remote_request_service_1.RemoteRequestService])
|
|
106
|
+
], ZipService);
|
|
107
|
+
//# sourceMappingURL=zip.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/zip.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qFAAiF;AACjF,0EAAsE;AACtE,6EAAyE;AACzE,qEAAgE;AAQzD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,8BAAa;IAMzC,YACuB,eAAgC,EAChC,oBAA0C;QAE7D,KAAK,EAAE,CAAC;QAHW,oBAAe,GAAf,eAAe,CAAiB;QAChC,yBAAoB,GAApB,oBAAoB,CAAsB;QAJvD,kBAAa,GAAG,IAAI,CAAC;IAO/B,CAAC;IAMD,KAAK,CAAC,GAAG,CAAC,KAAqB;QAC3B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,wCAAkB,CAAC,qBAAqB,CAAC,CAAC;QAEhE,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,wEAAwE;YAC7E,OAAO,EAAE;gBACL,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,cAAc,EAAE,kBAAkB;aACrC;YACD,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;SAC1B,CAAC;QAEF,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAE3E,IAAI,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gBAC1B,O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|
|
34
34
|
__metadata("design:type", Number)
|
|
35
35
|
], DocumentEntity.prototype, "type_id", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], DocumentEntity.prototype, "identifier", void 0);
|
|
36
40
|
__decorate([
|
|
37
41
|
(0, typeorm_1.Column)('json'),
|
|
38
42
|
__metadata("design:type", document_attributes_dto_1.DocumentAttributesDto)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.entity.js","sourceRoot":"","sources":["../../../src/system/entities/document.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgE;AAChE,wEAAoE;AACpE,6EAAwE;AACxE,+DAA0D;AASnD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,4BAAY;
|
|
1
|
+
{"version":3,"file":"document.entity.js","sourceRoot":"","sources":["../../../src/system/entities/document.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgE;AAChE,wEAAoE;AACpE,6EAAwE;AACxE,+DAA0D;AASnD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,4BAAY;CAuB/C,CAAA;AAvBY,wCAAc;AAEvB;IADC,IAAA,gBAAM,GAAE;;mDACW;AAGpB;IADC,IAAA,gBAAM,GAAE;;iDACS;AAGlB;IADC,IAAA,gBAAM,GAAE;;oDACY;AAGrB;IADC,IAAA,gBAAM,GAAE;;+CACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;kDACU;AAGnB;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;8BACH,+CAAqB;kDAAC;AAKlC;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAiB,CAAC;IAClC,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8BAC1B,uCAAiB;4CAAC;yBAtBf,cAAc;IAD1B,IAAA,gBAAM,EAAC,eAAe,CAAC;GACX,cAAc,CAuB1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CommonService } from '../../common/libraries/common.service';
|
|
1
2
|
import { SourceColumnDto } from '../../platformUtility/dtos/source.column.dto';
|
|
2
3
|
import { FileUploadDto } from '../dtos/file.upload.dto';
|
|
3
4
|
import { DocumentEntity } from '../entities/document.entity';
|
|
4
|
-
import { CommonService } from '../../common/libraries/common.service';
|
|
5
5
|
export declare class DocumentService extends CommonService {
|
|
6
6
|
protected publicExposed: boolean;
|
|
7
7
|
getDocuments(query: {
|
|
@@ -9,7 +9,8 @@ export declare class DocumentService extends CommonService {
|
|
|
9
9
|
source_id: number;
|
|
10
10
|
type_id?: number;
|
|
11
11
|
limit?: number;
|
|
12
|
+
identifier?: string;
|
|
12
13
|
}): Promise<any[]>;
|
|
13
|
-
setDocument(source: SourceColumnDto, file: FileUploadDto): Promise<DocumentEntity>;
|
|
14
|
+
setDocument(source: SourceColumnDto, file: FileUploadDto, identifier?: string): Promise<DocumentEntity>;
|
|
14
15
|
setDocuments(source: SourceColumnDto, files: FileUploadDto[]): Promise<DocumentEntity[]>;
|
|
15
16
|
}
|
|
@@ -10,22 +10,24 @@ exports.DocumentService = void 0;
|
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const typeorm_1 = require("typeorm");
|
|
12
12
|
const access_exception_1 = require("../../common/exceptions/access.exception");
|
|
13
|
+
const common_service_1 = require("../../common/libraries/common.service");
|
|
13
14
|
const platform_utility_1 = require("../../common/libraries/platform.utility");
|
|
14
15
|
const document_entity_1 = require("../entities/document.entity");
|
|
15
|
-
const common_service_1 = require("../../common/libraries/common.service");
|
|
16
16
|
let DocumentService = class DocumentService extends common_service_1.CommonService {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
19
|
this.publicExposed = true;
|
|
20
20
|
}
|
|
21
21
|
async getDocuments(query) {
|
|
22
|
+
const take = query.limit || 100;
|
|
23
|
+
delete query.limit;
|
|
22
24
|
return document_entity_1.DocumentEntity.find({
|
|
23
25
|
where: { ...query, document_url: (0, typeorm_1.Not)((0, typeorm_1.IsNull)()) },
|
|
24
26
|
relations: ['creator'],
|
|
25
|
-
take
|
|
27
|
+
take,
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
|
-
async setDocument(source, file) {
|
|
30
|
+
async setDocument(source, file, identifier) {
|
|
29
31
|
if (!file.document_url)
|
|
30
32
|
return;
|
|
31
33
|
if (!platform_utility_1.PlatformUtility.isValidUrl(file.document_url))
|
|
@@ -40,6 +42,7 @@ let DocumentService = class DocumentService extends common_service_1.CommonServi
|
|
|
40
42
|
if (!document?.id && file.type_id)
|
|
41
43
|
document.type_id = file.type_id;
|
|
42
44
|
document.attributes = { ...document.attributes, ...file.attributes, comments: file.comments };
|
|
45
|
+
document.identifier = identifier || document.identifier;
|
|
43
46
|
return document.save();
|
|
44
47
|
}
|
|
45
48
|
async setDocuments(source, files) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.service.js","sourceRoot":"","sources":["../../../src/system/services/document.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAsC;AACtC,+EAA2E;AAC3E,8EAA0E;AAG1E,iEAA6D;
|
|
1
|
+
{"version":3,"file":"document.service.js","sourceRoot":"","sources":["../../../src/system/services/document.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAsC;AACtC,+EAA2E;AAC3E,0EAAsE;AACtE,8EAA0E;AAG1E,iEAA6D;AAStD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,8BAAa;IAA3C;;QACO,kBAAa,GAAG,IAAI,CAAC;IAqEnC,CAAC;IA1DG,KAAK,CAAC,YAAY,CAAC,KAAwG;QACvH,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC;QAChC,OAAO,KAAK,CAAC,KAAK,CAAC;QAEnB,OAAO,gCAAc,CAAC,IAAI,CAAC;YACvB,KAAK,EAAE,EAAE,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AI,EAAE,CAAC;IAC3B,CAAC;IAQD,KAAK,CAAC,YAAY,CAAC,MAAuB,EAAE,KAAsB;QAC9D,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC;YAAE,OAAO;QAEpD,MAAM,GAAG,GAAG,EAAE,CAAC;QAEf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC/C,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAA;AAtEY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;GACA,eAAe,CAsE3B"}
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ScheduledEventService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
-
const
|
|
14
|
+
const cron_parser_1 = require("cron-parser");
|
|
15
15
|
const date_fns_1 = require("date-fns");
|
|
16
16
|
const typeorm_1 = require("typeorm");
|
|
17
17
|
const date_util_1 = require("../../common/libraries/date.util");
|
|
@@ -49,13 +49,14 @@ let ScheduledEventService = class ScheduledEventService {
|
|
|
49
49
|
lastRunTime = lastRunTime < startDate ? startDate : lastRunTime;
|
|
50
50
|
if (lastRunTime > endDate)
|
|
51
51
|
return;
|
|
52
|
-
const nextTime =
|
|
52
|
+
const nextTime = cron_parser_1.CronExpressionParser.parse(timing, {
|
|
53
53
|
currentDate: lastRunTime,
|
|
54
54
|
endDate,
|
|
55
|
+
tz: 'UTC',
|
|
55
56
|
});
|
|
56
57
|
while (dates.length <= +maxCount) {
|
|
57
58
|
if (!nextTime.hasNext())
|
|
58
|
-
|
|
59
|
+
break;
|
|
59
60
|
const next = nextTime.next().toDate();
|
|
60
61
|
const date = await this.withTimezoneOffset(next);
|
|
61
62
|
if (date < now)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled.event.service.js","sourceRoot":"","sources":["../../../src/system/services/scheduled.event.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"scheduled.event.service.js","sourceRoot":"","sources":["../../../src/system/services/scheduled.event.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,uCAAkD;AAClD,qCAAiE;AACjE,gEAA4D;AAE5D,4EAAwE;AACxE,uEAAkE;AAClE,+EAA0E;AAC1E,yDAAqD;AAS9C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAM9B,YACqB,eAAgC,EAC9B,UAAsB;QADxB,oBAAe,GAAf,eAAe,CAAiB;QAC9B,eAAU,GAAV,UAAU,CAAY;IAC1C,CAAC;IAOJ,KAAK,CAAC,sBAAsB,CAAC,MAAuB;QAChD,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAE1C,MAAM,GAAG,GAAG,4KAA4K,WAAW,uBAAuB,SAAS,EAAE,CAAC;QAEtO,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAOD,KAAK,CAAC,kBAAkB,CAAC,MAAuB;QAC5C,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC1C,OAAO,qCAAgB,CAAC,UAAU,CAAC;YAC/B,WAAW;YACX,SAAS;YACT,UAAU,EAAE,IAAA,gBAAM,GAAE;SACvB,CAAC,CAAC;IACP,CAAC;IAUD,KAAK,CAAC,YAAY,CAAC,MAAuB,EAAE,MAAc,EAAE,SAAe,EAAE,OAAa;QACtF,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,C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|
|
1
1
|
{
|
|
2
2
|
"name": "@servicelabsco/nestjs-utility-services",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "NestJS generic packages to support development",
|
|
5
5
|
"author": "Hemant Kumar Sah <hemantanshu@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"m:rev": "./node_modules/.bin/ts-node ./node_modules/.bin/typeorm migration:revert -d src/config/orm.config.ts",
|
|
33
33
|
"command": "npx nestjs-command",
|
|
34
34
|
"console": "node dist/console.js",
|
|
35
|
+
"runtime-check": "curl -s http://localhost:${SERVER_PORT:-4000}/health/runtime-check | jq . 2>/dev/null || curl -s http://localhost:${SERVER_PORT:-4000}/health/runtime-check",
|
|
35
36
|
"save": "bash ./commit.sh"
|
|
36
37
|
},
|
|
37
38
|
"keywords": [
|
|
@@ -71,23 +72,23 @@
|
|
|
71
72
|
"@sentry/node": "^10.34.0",
|
|
72
73
|
"@socket.io/redis-adapter": "^8.2.1",
|
|
73
74
|
"axios": "^1.7.9",
|
|
74
|
-
"bcryptjs": "^
|
|
75
|
+
"bcryptjs": "^3.0.3",
|
|
75
76
|
"bullmq": "^5.66.5",
|
|
76
77
|
"class-transformer": "^0.5.1",
|
|
77
|
-
"class-validator": "^0.
|
|
78
|
+
"class-validator": "^0.15.1",
|
|
78
79
|
"compression": "^1.7.4",
|
|
79
|
-
"cron-parser": "^
|
|
80
|
-
"date-fns": "^
|
|
80
|
+
"cron-parser": "^5.5.0",
|
|
81
|
+
"date-fns": "^4.1.0",
|
|
81
82
|
"dotenv": "^17.2.3",
|
|
82
83
|
"exceljs": "^4.4.0",
|
|
83
|
-
"express-http-
|
|
84
|
+
"express-http-context2": "^1.0.0",
|
|
84
85
|
"express-rate-limit": "^8.2.1",
|
|
85
86
|
"handlebars": "^4.7.8",
|
|
86
87
|
"helmet": "^8.1.0",
|
|
87
88
|
"html-to-text": "^9.0.5",
|
|
88
89
|
"ioredis": "^5.9.2",
|
|
89
|
-
"mongodb": "^
|
|
90
|
-
"nodemailer": "^
|
|
90
|
+
"mongodb": "^7.1.0",
|
|
91
|
+
"nodemailer": "^8.0.2",
|
|
91
92
|
"pg": "^8.17.1",
|
|
92
93
|
"redis": "^5.10.0",
|
|
93
94
|
"reflect-metadata": "^0.2.2",
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
"@types/jest": "^30.0.0",
|
|
108
109
|
"@types/multer": "^2.0.0",
|
|
109
110
|
"@types/node": "^22.10.5",
|
|
110
|
-
"@types/supertest": "^
|
|
111
|
+
"@types/supertest": "^7.2.0",
|
|
111
112
|
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
112
113
|
"@typescript-eslint/parser": "^8.53.0",
|
|
113
114
|
"eslint": "^9.39.2",
|