@campxdev/server-shared 1.4.0-alpha.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alerting/alerting.module.d.ts +3 -0
- package/dist/alerting/alerting.module.d.ts.map +1 -0
- package/dist/alerting/alerting.module.js +21 -0
- package/dist/alerting/alerting.module.js.map +1 -0
- package/dist/alerting/alerting.service.d.ts +18 -0
- package/dist/alerting/alerting.service.d.ts.map +1 -0
- package/dist/alerting/alerting.service.js +56 -0
- package/dist/alerting/alerting.service.js.map +1 -0
- package/dist/alerting/alerting.service.spec.d.ts +2 -0
- package/dist/alerting/alerting.service.spec.d.ts.map +1 -0
- package/dist/alerting/alerting.service.spec.js +42 -0
- package/dist/alerting/alerting.service.spec.js.map +1 -0
- package/dist/cloud-watch-logger/cloud-watch-logger.module.d.ts +3 -0
- package/dist/cloud-watch-logger/cloud-watch-logger.module.d.ts.map +1 -0
- package/dist/cloud-watch-logger/cloud-watch-logger.module.js +21 -0
- package/dist/cloud-watch-logger/cloud-watch-logger.module.js.map +1 -0
- package/dist/cloud-watch-logger/cloud-water-logger.service.d.ts +37 -0
- package/dist/cloud-watch-logger/cloud-water-logger.service.d.ts.map +1 -0
- package/dist/cloud-watch-logger/cloud-water-logger.service.js +147 -0
- package/dist/cloud-watch-logger/cloud-water-logger.service.js.map +1 -0
- package/dist/cloud-watch-logger/dtos/put-log-event.dto.d.ts +6 -0
- package/dist/cloud-watch-logger/dtos/put-log-event.dto.d.ts.map +1 -0
- package/dist/cloud-watch-logger/dtos/put-log-event.dto.js +29 -0
- package/dist/cloud-watch-logger/dtos/put-log-event.dto.js.map +1 -0
- package/dist/cloud-watch-logger/index.d.ts +3 -0
- package/dist/cloud-watch-logger/index.d.ts.map +1 -0
- package/dist/cloud-watch-logger/index.js +19 -0
- package/dist/cloud-watch-logger/index.js.map +1 -0
- package/dist/common/config/mongo.config.d.ts +4 -0
- package/dist/common/config/mongo.config.d.ts.map +1 -1
- package/dist/common/config/mongo.config.js +14 -1
- package/dist/common/config/mongo.config.js.map +1 -1
- package/dist/common/interfaces/context.interface.d.ts +2 -0
- package/dist/common/interfaces/context.interface.d.ts.map +1 -1
- package/dist/domain/entities/image.entity.d.ts +13 -0
- package/dist/domain/entities/image.entity.d.ts.map +1 -0
- package/dist/domain/entities/image.entity.js +64 -0
- package/dist/domain/entities/image.entity.js.map +1 -0
- package/dist/domain/entities/user.entity.d.ts +2 -0
- package/dist/domain/entities/user.entity.d.ts.map +1 -1
- package/dist/domain/entities/user.entity.js +6 -0
- package/dist/domain/entities/user.entity.js.map +1 -1
- package/dist/domain/schemas/admission.schema.d.ts +12 -0
- package/dist/domain/schemas/admission.schema.d.ts.map +1 -1
- package/dist/domain/schemas/admission.schema.js +30 -1
- package/dist/domain/schemas/admission.schema.js.map +1 -1
- package/dist/domain/schemas/tenant.schema.d.ts +1 -0
- package/dist/domain/schemas/tenant.schema.d.ts.map +1 -1
- package/dist/domain/schemas/tenant.schema.js +4 -0
- package/dist/domain/schemas/tenant.schema.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modules-handler/types/admin.types.d.ts +15 -15
- package/dist/modules-handler/types/admin.types.d.ts.map +1 -1
- package/dist/permissions/app-permissions/admin-permissions.d.ts +542 -0
- package/dist/permissions/app-permissions/admin-permissions.d.ts.map +1 -0
- package/dist/permissions/app-permissions/admin-permissions.js +552 -0
- package/dist/permissions/app-permissions/admin-permissions.js.map +1 -0
- package/dist/permissions/app-permissions/enroll-x-permissions.d.ts +6 -0
- package/dist/permissions/app-permissions/enroll-x-permissions.d.ts.map +1 -1
- package/dist/permissions/app-permissions/enroll-x-permissions.js +11 -0
- package/dist/permissions/app-permissions/enroll-x-permissions.js.map +1 -1
- package/dist/permissions/app-permissions/exams-permissions.d.ts +27 -0
- package/dist/permissions/app-permissions/exams-permissions.d.ts.map +1 -1
- package/dist/permissions/app-permissions/exams-permissions.js +82 -0
- package/dist/permissions/app-permissions/exams-permissions.js.map +1 -1
- package/dist/permissions/app-permissions/payments-permissions.d.ts +30 -0
- package/dist/permissions/app-permissions/payments-permissions.d.ts.map +1 -1
- package/dist/permissions/app-permissions/payments-permissions.js +30 -0
- package/dist/permissions/app-permissions/payments-permissions.js.map +1 -1
- package/dist/permissions/app-permissions/square-permissions.d.ts +156 -4
- package/dist/permissions/app-permissions/square-permissions.d.ts.map +1 -1
- package/dist/permissions/app-permissions/square-permissions.js +249 -30
- package/dist/permissions/app-permissions/square-permissions.js.map +1 -1
- package/dist/permissions/index.d.ts +1 -0
- package/dist/permissions/index.d.ts.map +1 -1
- package/dist/permissions/index.js +3 -1
- package/dist/permissions/index.js.map +1 -1
- package/dist/permissions/permissions.d.ts +1558 -52
- package/dist/permissions/permissions.d.ts.map +1 -1
- package/dist/permissions/permissions.js +27 -22
- package/dist/permissions/permissions.js.map +1 -1
- package/dist/request-store/request-store.d.ts +66 -0
- package/dist/request-store/request-store.d.ts.map +1 -1
- package/dist/request-store/request-store.js +22 -1
- package/dist/request-store/request-store.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +1 -0
- package/dist/utils/constants.js.map +1 -1
- package/package.json +16 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerting.module.d.ts","sourceRoot":"","sources":["../../src/alerting/alerting.module.ts"],"names":[],"mappings":"AAGA,qBAIa,cAAc;CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AlertingModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const alerting_service_1 = require("./alerting.service");
|
|
12
|
+
let AlertingModule = class AlertingModule {
|
|
13
|
+
};
|
|
14
|
+
exports.AlertingModule = AlertingModule;
|
|
15
|
+
exports.AlertingModule = AlertingModule = __decorate([
|
|
16
|
+
(0, common_1.Module)({
|
|
17
|
+
providers: [alerting_service_1.AlertingService],
|
|
18
|
+
exports: [alerting_service_1.AlertingService],
|
|
19
|
+
})
|
|
20
|
+
], AlertingModule);
|
|
21
|
+
//# sourceMappingURL=alerting.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerting.module.js","sourceRoot":"","sources":["../../src/alerting/alerting.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yDAAqD;AAM9C,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAJ1B,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,kCAAe,CAAC;QAC5B,OAAO,EAAE,CAAC,kCAAe,CAAC;KAC3B,CAAC;GACW,cAAc,CAAG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class AlertingService {
|
|
2
|
+
private cloudWatchClient;
|
|
3
|
+
constructor();
|
|
4
|
+
/**
|
|
5
|
+
* Description
|
|
6
|
+
* @param {any} namespace:string
|
|
7
|
+
* @param {any} metricName:string
|
|
8
|
+
* @param {any} value:number
|
|
9
|
+
* @param {any} unit:string='Count'
|
|
10
|
+
* @param {any} dimensions:{Name:string;Value:string}[]=[]
|
|
11
|
+
* @returns {any}
|
|
12
|
+
*/
|
|
13
|
+
publishMetric(namespace: string, metricName: string, value: number, unit?: string, dimensions?: {
|
|
14
|
+
Name: string;
|
|
15
|
+
Value: string;
|
|
16
|
+
}[]): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=alerting.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerting.service.d.ts","sourceRoot":"","sources":["../../src/alerting/alerting.service.ts"],"names":[],"mappings":"AAGA,qBACa,eAAe;IAC1B,OAAO,CAAC,gBAAgB,CAAmB;;IAO3C;;;;;;;;OAQG;IACG,aAAa,CACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,MAAgB,EACtB,UAAU,GAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAO,GACjD,OAAO,CAAC,IAAI,CAAC;CAqBjB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.AlertingService = void 0;
|
|
13
|
+
const client_cloudwatch_1 = require("@aws-sdk/client-cloudwatch");
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
let AlertingService = class AlertingService {
|
|
16
|
+
constructor() {
|
|
17
|
+
// Initialize the CloudWatch client. Consider injecting AWS region and other configs via a configuration service or .env file.
|
|
18
|
+
this.cloudWatchClient = new client_cloudwatch_1.CloudWatchClient({ region: 'ap-south-1' });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Description
|
|
22
|
+
* @param {any} namespace:string
|
|
23
|
+
* @param {any} metricName:string
|
|
24
|
+
* @param {any} value:number
|
|
25
|
+
* @param {any} unit:string='Count'
|
|
26
|
+
* @param {any} dimensions:{Name:string;Value:string}[]=[]
|
|
27
|
+
* @returns {any}
|
|
28
|
+
*/
|
|
29
|
+
async publishMetric(namespace, metricName, value, unit = 'Count', dimensions = []) {
|
|
30
|
+
const command = new client_cloudwatch_1.PutMetricDataCommand({
|
|
31
|
+
Namespace: namespace,
|
|
32
|
+
MetricData: [
|
|
33
|
+
{
|
|
34
|
+
MetricName: metricName,
|
|
35
|
+
Unit: client_cloudwatch_1.StandardUnit.Count,
|
|
36
|
+
Value: value,
|
|
37
|
+
Dimensions: dimensions,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
try {
|
|
42
|
+
await this.cloudWatchClient.send(command);
|
|
43
|
+
console.log('Metric published successfully');
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error('Error publishing metric:', error);
|
|
47
|
+
throw error; // Or handle it as appropriate for your application
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.AlertingService = AlertingService;
|
|
52
|
+
exports.AlertingService = AlertingService = __decorate([
|
|
53
|
+
(0, common_1.Injectable)(),
|
|
54
|
+
__metadata("design:paramtypes", [])
|
|
55
|
+
], AlertingService);
|
|
56
|
+
//# sourceMappingURL=alerting.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerting.service.js","sourceRoot":"","sources":["../../src/alerting/alerting.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAAkG;AAClG,2CAA4C;AAGrC,IAAM,eAAe,GAArB,MAAM,eAAe;IAG1B;QACE,8HAA8H;QAC9H,IAAI,CAAC,gBAAgB,GAAG,IAAI,oCAAgB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CACjB,SAAiB,EACjB,UAAkB,EAClB,KAAa,EACb,OAAe,OAAO,EACtB,aAAgD,EAAE;QAElD,MAAM,OAAO,GAAG,IAAI,wCAAoB,CAAC;YACvC,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE;gBACV;oBACE,UAAU,EAAE,UAAU;oBACtB,IAAI,EAAE,gCAAY,CAAC,KAAK;oBACxB,KAAK,EAAE,KAAK;oBACZ,UAAU,EAAE,UAAU;iBACvB;aACF;SACF,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YACjD,MAAM,KAAK,CAAC,CAAC,mDAAmD;QAClE,CAAC;IACH,CAAC;CACF,CAAA;AA5CY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;;GACA,eAAe,CA4C3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerting.service.spec.d.ts","sourceRoot":"","sources":["../../src/alerting/alerting.service.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_cloudwatch_1 = require("@aws-sdk/client-cloudwatch");
|
|
4
|
+
const testing_1 = require("@nestjs/testing");
|
|
5
|
+
const aws_sdk_client_mock_1 = require("aws-sdk-client-mock");
|
|
6
|
+
const alerting_service_1 = require("./alerting.service");
|
|
7
|
+
const cloudwatchMock = (0, aws_sdk_client_mock_1.mockClient)(client_cloudwatch_1.CloudWatchClient);
|
|
8
|
+
describe('AlertingService', () => {
|
|
9
|
+
let service;
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
const module = await testing_1.Test.createTestingModule({
|
|
12
|
+
providers: [alerting_service_1.AlertingService],
|
|
13
|
+
}).compile();
|
|
14
|
+
service = module.get(alerting_service_1.AlertingService);
|
|
15
|
+
cloudwatchMock.reset();
|
|
16
|
+
});
|
|
17
|
+
it('should be defined', () => {
|
|
18
|
+
expect(service).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
it('should publish metric to cloud watch successfully', async () => {
|
|
21
|
+
const namespace = 'TestNamespace';
|
|
22
|
+
const metricName = 'TestMetric';
|
|
23
|
+
const value = 1;
|
|
24
|
+
const unit = 'Count';
|
|
25
|
+
const dimensions = [{ Name: 'TestDimension', Value: 'TestValue' }];
|
|
26
|
+
cloudwatchMock.on(client_cloudwatch_1.PutMetricDataCommand).resolves({}); // Mock the CloudWatch response
|
|
27
|
+
await service.publishMetric(namespace, metricName, value, unit, dimensions);
|
|
28
|
+
expect(cloudwatchMock.calls()).toHaveLength(1);
|
|
29
|
+
const [command] = cloudwatchMock.calls()[0].args;
|
|
30
|
+
expect(command.input).toMatchObject({
|
|
31
|
+
Namespace: namespace,
|
|
32
|
+
MetricData: [
|
|
33
|
+
{
|
|
34
|
+
MetricName: metricName,
|
|
35
|
+
Value: value,
|
|
36
|
+
Dimensions: dimensions,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=alerting.service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerting.service.spec.js","sourceRoot":"","sources":["../../src/alerting/alerting.service.spec.ts"],"names":[],"mappings":";;AAAA,kEAAoF;AACpF,6CAAsD;AACtD,6DAAiD;AACjD,yDAAqD;AAErD,MAAM,cAAc,GAAG,IAAA,gCAAU,EAAC,oCAAgB,CAAC,CAAC;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,OAAwB,CAAC;IAE7B,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE,CAAC,kCAAe,CAAC;SAC7B,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,OAAO,GAAG,MAAM,CAAC,GAAG,CAAkB,kCAAe,CAAC,CAAC;QACvD,cAAc,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;QACjE,MAAM,SAAS,GAAG,eAAe,CAAC;QAClC,MAAM,UAAU,GAAG,YAAY,CAAC;QAChC,MAAM,KAAK,GAAG,CAAC,CAAC;QAChB,MAAM,IAAI,GAAG,OAAO,CAAC;QACrB,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QAEnE,cAAc,CAAC,EAAE,CAAC,wCAAoB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,+BAA+B;QAErF,MAAM,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QAE5E,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC;YAClC,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE;gBACV;oBACE,UAAU,EAAE,UAAU;oBACtB,KAAK,EAAE,KAAK;oBACZ,UAAU,EAAE,UAAU;iBACvB;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-watch-logger.module.d.ts","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-watch-logger.module.ts"],"names":[],"mappings":"AAGA,qBAIa,sBAAsB;CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CloudWatchLoggerModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const cloud_water_logger_service_1 = require("./cloud-water-logger.service");
|
|
12
|
+
let CloudWatchLoggerModule = class CloudWatchLoggerModule {
|
|
13
|
+
};
|
|
14
|
+
exports.CloudWatchLoggerModule = CloudWatchLoggerModule;
|
|
15
|
+
exports.CloudWatchLoggerModule = CloudWatchLoggerModule = __decorate([
|
|
16
|
+
(0, common_1.Module)({
|
|
17
|
+
providers: [cloud_water_logger_service_1.CloudWatchLoggerService],
|
|
18
|
+
exports: [cloud_water_logger_service_1.CloudWatchLoggerService],
|
|
19
|
+
})
|
|
20
|
+
], CloudWatchLoggerModule);
|
|
21
|
+
//# sourceMappingURL=cloud-watch-logger.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-watch-logger.module.js","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-watch-logger.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6EAAuE;AAMhE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAAG,CAAA;AAAzB,wDAAsB;iCAAtB,sBAAsB;IAJlC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,oDAAuB,CAAC;QACpC,OAAO,EAAE,CAAC,oDAAuB,CAAC;KACnC,CAAC;GACW,sBAAsB,CAAG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PutLogEventDto } from './dtos/put-log-event.dto';
|
|
2
|
+
export declare class CloudWatchLoggerService {
|
|
3
|
+
private cloudWatchClient;
|
|
4
|
+
constructor();
|
|
5
|
+
/**
|
|
6
|
+
* Creates a log stream in the specified log group.
|
|
7
|
+
*
|
|
8
|
+
* @param logGroupName - The name of the log group.
|
|
9
|
+
* @param logStreamName - The name of the log stream.
|
|
10
|
+
* @returns A promise that resolves to the response from creating the log stream.
|
|
11
|
+
* @throws UnprocessableEntityException if there is an error creating the log stream.
|
|
12
|
+
*/
|
|
13
|
+
createLogStream(logGroupName: string, logStreamName: string): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Writes log events to a CloudWatch log stream.
|
|
16
|
+
* @param data - The log event data.
|
|
17
|
+
* @returns A promise that resolves with the response from CloudWatch.
|
|
18
|
+
*/
|
|
19
|
+
putLogEvents(data: PutLogEventDto): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the sequence token for a given log stream in a log group.
|
|
22
|
+
* @param logGroupName - The name of the log group.
|
|
23
|
+
* @param logStreamName - The name of the log stream.
|
|
24
|
+
* @returns A promise that resolves to the sequence token of the log stream.
|
|
25
|
+
* @throws {UnprocessableEntityException} If there is an error retrieving the sequence token.
|
|
26
|
+
*/
|
|
27
|
+
getSequenceTokenForLogStream(logGroupName: string, logStreamName: string): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves log events from CloudWatch Logs based on the specified log group name and query.
|
|
30
|
+
* @param logGroupName - The name of the log group.
|
|
31
|
+
* @param query - The query string used to filter log events.
|
|
32
|
+
* @returns A promise that resolves to an array of log event results.
|
|
33
|
+
* @throws UnprocessableEntityException if there is an error retrieving the logs.
|
|
34
|
+
*/
|
|
35
|
+
getLogEvents(logGroupName: string, query: string): Promise<any>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=cloud-water-logger.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-water-logger.service.d.ts","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-water-logger.service.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,qBACa,uBAAuB;IAClC,OAAO,CAAC,gBAAgB,CAAuB;;IAY/C;;;;;;;OAOG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAiBhF;;;;OAIG;IACG,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC;IAmCtD;;;;;;OAMG;IACG,4BAA4B,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBhG;;;;;;OAMG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAkCtE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
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.CloudWatchLoggerService = void 0;
|
|
13
|
+
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.cloudWatchClient = new client_cloudwatch_logs_1.CloudWatchLogsClient({
|
|
18
|
+
region: 'ap-south-1',
|
|
19
|
+
credentials: {
|
|
20
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
21
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a log stream in the specified log group.
|
|
27
|
+
*
|
|
28
|
+
* @param logGroupName - The name of the log group.
|
|
29
|
+
* @param logStreamName - The name of the log stream.
|
|
30
|
+
* @returns A promise that resolves to the response from creating the log stream.
|
|
31
|
+
* @throws UnprocessableEntityException if there is an error creating the log stream.
|
|
32
|
+
*/
|
|
33
|
+
async createLogStream(logGroupName, logStreamName) {
|
|
34
|
+
const params = {
|
|
35
|
+
logGroupName,
|
|
36
|
+
logStreamName,
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
const command = new client_cloudwatch_logs_1.CreateLogStreamCommand(params);
|
|
40
|
+
const response = await this.cloudWatchClient.send(command);
|
|
41
|
+
return response;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw new common_1.UnprocessableEntityException(`Error creating log stream ${params.logGroupName}-${params.logStreamName}`, error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Writes log events to a CloudWatch log stream.
|
|
49
|
+
* @param data - The log event data.
|
|
50
|
+
* @returns A promise that resolves with the response from CloudWatch.
|
|
51
|
+
*/
|
|
52
|
+
async putLogEvents(data) {
|
|
53
|
+
const sequenceToken = await this.getSequenceTokenForLogStream(data.logGroupName, data.logStreamName);
|
|
54
|
+
const params = {
|
|
55
|
+
logGroupName: data.logGroupName,
|
|
56
|
+
logStreamName: data.logStreamName,
|
|
57
|
+
logEvents: [
|
|
58
|
+
{
|
|
59
|
+
message: data.message,
|
|
60
|
+
timestamp: Date.now(),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
sequenceToken,
|
|
64
|
+
};
|
|
65
|
+
try {
|
|
66
|
+
const command = new client_cloudwatch_logs_1.PutLogEventsCommand(params);
|
|
67
|
+
const response = await this.cloudWatchClient.send(command);
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error.name === 'ResourceNotFoundException') {
|
|
72
|
+
console.log('Log stream not found. Creating log stream...');
|
|
73
|
+
await this.createLogStream(data.logGroupName, data.logStreamName);
|
|
74
|
+
return this.putLogEvents(data);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new common_1.UnprocessableEntityException(`Error logging message to ${params.logGroupName}-${params.logStreamName}`, error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Retrieves the sequence token for a given log stream in a log group.
|
|
83
|
+
* @param logGroupName - The name of the log group.
|
|
84
|
+
* @param logStreamName - The name of the log stream.
|
|
85
|
+
* @returns A promise that resolves to the sequence token of the log stream.
|
|
86
|
+
* @throws {UnprocessableEntityException} If there is an error retrieving the sequence token.
|
|
87
|
+
*/
|
|
88
|
+
async getSequenceTokenForLogStream(logGroupName, logStreamName) {
|
|
89
|
+
const params = {
|
|
90
|
+
logGroupName,
|
|
91
|
+
logStreamNamePrefix: logStreamName,
|
|
92
|
+
};
|
|
93
|
+
try {
|
|
94
|
+
const command = new client_cloudwatch_logs_1.DescribeLogStreamsCommand(params);
|
|
95
|
+
const response = await this.cloudWatchClient.send(command);
|
|
96
|
+
const logStream = response.logStreams.find((stream) => stream.logStreamName === logStreamName);
|
|
97
|
+
return logStream?.uploadSequenceToken || null;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
throw new common_1.UnprocessableEntityException(`Error getting sequence token for log stream ${logGroupName}-${logStreamName}`, error);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Retrieves log events from CloudWatch Logs based on the specified log group name and query.
|
|
105
|
+
* @param logGroupName - The name of the log group.
|
|
106
|
+
* @param query - The query string used to filter log events.
|
|
107
|
+
* @returns A promise that resolves to an array of log event results.
|
|
108
|
+
* @throws UnprocessableEntityException if there is an error retrieving the logs.
|
|
109
|
+
*/
|
|
110
|
+
async getLogEvents(logGroupName, query) {
|
|
111
|
+
const params = {
|
|
112
|
+
logGroupName,
|
|
113
|
+
startTime: 0,
|
|
114
|
+
endTime: Date.now(),
|
|
115
|
+
queryString: query,
|
|
116
|
+
};
|
|
117
|
+
try {
|
|
118
|
+
const command = new client_cloudwatch_logs_1.StartQueryCommand(params);
|
|
119
|
+
const startQueryResponse = await this.cloudWatchClient.send(command);
|
|
120
|
+
// Polling for query results
|
|
121
|
+
let queryStatus;
|
|
122
|
+
let results;
|
|
123
|
+
do {
|
|
124
|
+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second before checking the query status
|
|
125
|
+
const getQueryResultsCommand = new client_cloudwatch_logs_1.GetQueryResultsCommand({
|
|
126
|
+
queryId: startQueryResponse.queryId,
|
|
127
|
+
});
|
|
128
|
+
const queryResults = await this.cloudWatchClient.send(getQueryResultsCommand);
|
|
129
|
+
queryStatus = queryResults.status;
|
|
130
|
+
if (queryStatus === 'Complete') {
|
|
131
|
+
results = queryResults.results;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
} while (queryStatus === 'Running' || queryStatus === 'Scheduled');
|
|
135
|
+
return results;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
throw new common_1.UnprocessableEntityException(`Error getting logs for log stream ${logGroupName}`, error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
exports.CloudWatchLoggerService = CloudWatchLoggerService;
|
|
143
|
+
exports.CloudWatchLoggerService = CloudWatchLoggerService = __decorate([
|
|
144
|
+
(0, common_1.Injectable)(),
|
|
145
|
+
__metadata("design:paramtypes", [])
|
|
146
|
+
], CloudWatchLoggerService);
|
|
147
|
+
//# sourceMappingURL=cloud-water-logger.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-water-logger.service.js","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-water-logger.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4EAayC;AACzC,2CAA0E;AAInE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAGlC;QACE,IAAI,CAAC,gBAAgB,GAAG,IAAI,6CAAoB,C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"version":3,"file":"put-log-event.dto.d.ts","sourceRoot":"","sources":["../../../src/cloud-watch-logger/dtos/put-log-event.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,cAAc;IAEzB,YAAY,EAAE,MAAM,CAAC;IAGrB,aAAa,EAAE,MAAM,CAAC;IAGtB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.PutLogEventDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class PutLogEventDto {
|
|
15
|
+
}
|
|
16
|
+
exports.PutLogEventDto = PutLogEventDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], PutLogEventDto.prototype, "logGroupName", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], PutLogEventDto.prototype, "logStreamName", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], PutLogEventDto.prototype, "message", void 0);
|
|
29
|
+
//# sourceMappingURL=put-log-event.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"put-log-event.dto.js","sourceRoot":"","sources":["../../../src/cloud-watch-logger/dtos/put-log-event.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6C;AAE7C,MAAa,cAAc;CAS1B;AATD,wCASC;AAPC;IADC,IAAA,4BAAU,GAAE;;oDACQ;AAGrB;IADC,IAAA,4BAAU,GAAE;;qDACS;AAGtB;IADC,IAAA,4BAAU,GAAE;;+CACG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloud-watch-logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cloud-watch-logger.module"), exports);
|
|
18
|
+
__exportStar(require("./cloud-water-logger.service"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud-watch-logger/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,+DAA6C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo.config.d.ts","sourceRoot":"","sources":["../../../src/common/config/mongo.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mongo.config.d.ts","sourceRoot":"","sources":["../../../src/common/config/mongo.config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,aAAa,kBAAmB,aAAa;;CAYzD,CAAC;AAEF,eAAO,MAAM,WAAW;;CAsBvB,CAAC"}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mongoConfig = void 0;
|
|
3
|
+
exports.mongoConfig = exports.mongoConfigV1 = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
|
+
const mongoConfigV1 = (configService) => {
|
|
6
|
+
const username = encodeURIComponent(configService.get('MONGO_DB_USERNAME') || '');
|
|
7
|
+
const password = encodeURIComponent(configService.get('MONGO_DB_PASSWORD') || '');
|
|
8
|
+
const DB_NAME = configService.get('MONGO_DB_NAME') || '';
|
|
9
|
+
const DB_HOST = configService.get('MONGO_DB_HOST') || '';
|
|
10
|
+
const AUTH = `${username}:${password}`;
|
|
11
|
+
const DB = `${DB_HOST}/${DB_NAME}`;
|
|
12
|
+
const MONGO_URI = `mongodb+srv://${AUTH}@${DB}?retryWrites=true&w=majority`;
|
|
13
|
+
return {
|
|
14
|
+
MONGO_URI,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
exports.mongoConfigV1 = mongoConfigV1;
|
|
5
18
|
const mongoConfig = () => {
|
|
6
19
|
if (!process.env.MONGO_DB_USERNAME ||
|
|
7
20
|
!process.env.MONGO_DB_PASSWORD ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo.config.js","sourceRoot":"","sources":["../../../src/common/config/mongo.config.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;
|
|
1
|
+
{"version":3,"file":"mongo.config.js","sourceRoot":"","sources":["../../../src/common/config/mongo.config.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAGvD,MAAM,aAAa,GAAG,CAAC,aAA4B,EAAE,EAAE;IAC5D,MAAM,QAAQ,GAAG,kBAAkB,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC,CAAC;IAClF,MAAM,QAAQ,GAAG,kBAAkB,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC,CAAC;IAClF,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IACzD,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IACzD,MAAM,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;IACvC,MAAM,EAAE,GAAG,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,iBAAiB,IAAI,IAAI,EAAE,8BAA8B,CAAC;IAE5E,OAAO;QACL,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,aAAa,iBAYxB;AAEK,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,IACE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC9B,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC9B,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa;QAC1B,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAC1B,CAAC;QACD,MAAM,IAAI,qCAA4B,CACpC,kGAAkG,CACnG,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAC1C,MAAM,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;IACvC,MAAM,EAAE,GAAG,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,iBAAiB,IAAI,IAAI,EAAE,8BAA8B,CAAC;IAE5E,OAAO;QACL,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,WAAW,eAsBtB"}
|
|
@@ -59,6 +59,7 @@ export interface TenantDetails {
|
|
|
59
59
|
smtpConfig?: SmtpConfig;
|
|
60
60
|
masterInstitutionId?: string;
|
|
61
61
|
masterInstitutionUniqueId?: number;
|
|
62
|
+
twoFactorAuthEnabled: boolean;
|
|
62
63
|
}
|
|
63
64
|
export interface SmtpConfig {
|
|
64
65
|
host: string;
|
|
@@ -102,6 +103,7 @@ export interface UserData {
|
|
|
102
103
|
userAgent?: string;
|
|
103
104
|
departmentIds?: string[];
|
|
104
105
|
groupId?: string;
|
|
106
|
+
admissionId?: string;
|
|
105
107
|
}
|
|
106
108
|
export interface SendSmsInterface {
|
|
107
109
|
to: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.interface.d.ts","sourceRoot":"","sources":["../../../src/common/interfaces/context.interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;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,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class Image {
|
|
2
|
+
id: number;
|
|
3
|
+
key: string;
|
|
4
|
+
thumbnailKey: string;
|
|
5
|
+
type: string;
|
|
6
|
+
typeId: number;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
url: string;
|
|
10
|
+
thumbUrl: string;
|
|
11
|
+
setUrl(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=image.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.entity.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/image.entity.ts"],"names":[],"mappings":"AAUA,qBACa,KAAK;IAEhB,EAAE,EAAE,MAAM,CAAC;IAGX,GAAG,EAAE,MAAM,CAAC;IAGZ,YAAY,EAAE,MAAM,CAAC;IAGrB,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;IAElB,GAAG,EAAE,MAAM,CAAC;IAEZ,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM;CAUP"}
|