fiscalia_bo-nest-helpers 0.0.37 → 0.0.38
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/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/ms-geojson/dto/ms-geojson.dto.d.ts +2 -15
- package/dist/ms-geojson/dto/ms-geojson.dto.js +8 -40
- package/dist/ms-geojson/dto/ms-geojson.dto.js.map +1 -1
- package/dist/ms-geojson/ms-geojson.service.d.ts +3 -3
- package/dist/ms-geojson/ms-geojson.service.js +25 -53
- package/dist/ms-geojson/ms-geojson.service.js.map +1 -1
- package/dist/ms-skylogs/index.d.ts +3 -0
- package/dist/ms-skylogs/index.js +9 -0
- package/dist/ms-skylogs/index.js.map +1 -0
- package/dist/ms-skylogs/ms-logs.module.d.ts +12 -0
- package/dist/ms-skylogs/ms-logs.module.js +61 -0
- package/dist/ms-skylogs/ms-logs.module.js.map +1 -0
- package/dist/ms-skylogs/ms-logs.service.d.ts +11 -0
- package/dist/ms-skylogs/ms-logs.service.js +55 -0
- package/dist/ms-skylogs/ms-logs.service.js.map +1 -0
- package/dist/ms-skylogs/types.d.ts +47 -0
- package/dist/ms-skylogs/types.js +3 -0
- package/dist/ms-skylogs/types.js.map +1 -0
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.MsPdf = exports.MsPersonas = exports.PermissionsGuard = exports.MsSeguridadHttpError = void 0;
|
17
|
+
exports.MsSkylogs = exports.MsPdf = exports.MsPersonas = exports.PermissionsGuard = exports.MsSeguridadHttpError = void 0;
|
18
18
|
__exportStar(require("./services/ms-files.service"), exports);
|
19
19
|
__exportStar(require("./ms-redis/ms-redis.module"), exports);
|
20
20
|
__exportStar(require("./ms-redis/ms-redis.service"), exports);
|
@@ -35,4 +35,5 @@ __exportStar(require("./types"), exports);
|
|
35
35
|
__exportStar(require("./helpers/request.helper"), exports);
|
36
36
|
exports.MsPersonas = require("./ms-personas");
|
37
37
|
exports.MsPdf = require("./ms-pdf");
|
38
|
+
exports.MsSkylogs = require("./ms-skylogs");
|
38
39
|
//# sourceMappingURL=index.js.map
|
@@ -1,19 +1,6 @@
|
|
1
1
|
export declare class Coordinates {
|
2
2
|
coordinates: [number, number];
|
3
3
|
}
|
4
|
-
declare class
|
5
|
-
|
6
|
-
coordinates: Object;
|
4
|
+
export declare class ValidateCoordinatesPolygonDTO {
|
5
|
+
polygonCoordinates: Coordinates[];
|
7
6
|
}
|
8
|
-
declare class properties {
|
9
|
-
name: string;
|
10
|
-
}
|
11
|
-
export declare class FeatureDto {
|
12
|
-
type: string;
|
13
|
-
geometry: GeometryDto;
|
14
|
-
id: string;
|
15
|
-
properties: {
|
16
|
-
name: properties;
|
17
|
-
};
|
18
|
-
}
|
19
|
-
export {};
|
@@ -9,57 +9,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.
|
12
|
+
exports.ValidateCoordinatesPolygonDTO = exports.Coordinates = void 0;
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
14
14
|
const class_validator_1 = require("class-validator");
|
15
15
|
class Coordinates {
|
16
16
|
}
|
17
17
|
__decorate([
|
18
|
+
(0, class_transformer_1.Type)(() => Number),
|
18
19
|
(0, class_validator_1.IsArray)(),
|
19
20
|
(0, class_validator_1.IsNumber)({}, { each: true }),
|
20
21
|
__metadata("design:type", Array)
|
21
22
|
], Coordinates.prototype, "coordinates", void 0);
|
22
23
|
exports.Coordinates = Coordinates;
|
23
|
-
class
|
24
|
+
class ValidateCoordinatesPolygonDTO {
|
24
25
|
}
|
25
26
|
__decorate([
|
26
|
-
(0,
|
27
|
-
(0, class_validator_1.IsNotEmpty)(),
|
28
|
-
__metadata("design:type", String)
|
29
|
-
], GeometryDto.prototype, "type", void 0);
|
30
|
-
__decorate([
|
27
|
+
(0, class_transformer_1.Type)(() => Coordinates),
|
31
28
|
(0, class_validator_1.IsArray)(),
|
32
|
-
(0, class_validator_1.
|
33
|
-
__metadata("design:type",
|
34
|
-
],
|
35
|
-
|
36
|
-
}
|
37
|
-
__decorate([
|
38
|
-
(0, class_validator_1.IsString)(),
|
39
|
-
(0, class_validator_1.IsNotEmpty)(),
|
40
|
-
__metadata("design:type", String)
|
41
|
-
], properties.prototype, "name", void 0);
|
42
|
-
class FeatureDto {
|
43
|
-
}
|
44
|
-
__decorate([
|
45
|
-
(0, class_validator_1.IsString)(),
|
46
|
-
(0, class_validator_1.IsNotEmpty)(),
|
47
|
-
__metadata("design:type", String)
|
48
|
-
], FeatureDto.prototype, "type", void 0);
|
49
|
-
__decorate([
|
50
|
-
(0, class_validator_1.ValidateNested)(),
|
51
|
-
(0, class_transformer_1.Type)(() => GeometryDto),
|
52
|
-
__metadata("design:type", GeometryDto)
|
53
|
-
], FeatureDto.prototype, "geometry", void 0);
|
54
|
-
__decorate([
|
55
|
-
(0, class_validator_1.IsString)(),
|
56
|
-
(0, class_validator_1.IsNotEmpty)(),
|
57
|
-
__metadata("design:type", String)
|
58
|
-
], FeatureDto.prototype, "id", void 0);
|
59
|
-
__decorate([
|
60
|
-
(0, class_transformer_1.Type)(() => properties),
|
61
|
-
(0, class_validator_1.IsNotEmpty)(),
|
62
|
-
__metadata("design:type", Object)
|
63
|
-
], FeatureDto.prototype, "properties", void 0);
|
64
|
-
exports.FeatureDto = FeatureDto;
|
29
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
30
|
+
__metadata("design:type", Array)
|
31
|
+
], ValidateCoordinatesPolygonDTO.prototype, "polygonCoordinates", void 0);
|
32
|
+
exports.ValidateCoordinatesPolygonDTO = ValidateCoordinatesPolygonDTO;
|
65
33
|
//# sourceMappingURL=ms-geojson.dto.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ms-geojson.dto.js","sourceRoot":"","sources":["../../../src/ms-geojson/dto/ms-geojson.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,
|
1
|
+
{"version":3,"file":"ms-geojson.dto.js","sourceRoot":"","sources":["../../../src/ms-geojson/dto/ms-geojson.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAoE;AAEpE,MAAa,WAAW;CAKvB;AAJC;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAClB,IAAA,yBAAO,GAAE;IACT,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;gDACC;AAJhC,kCAKC;AAED,MAAa,6BAA6B;CAKzC;AAJC;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC;IACvB,IAAA,yBAAO,GAAE;IACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;yEACG;AAJpC,sEAKC"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Coordinates } from './dto/ms-geojson.dto';
|
1
|
+
import { Coordinates, ValidateCoordinatesPolygonDTO } from './dto/ms-geojson.dto';
|
2
2
|
export declare class MsGeoJsonService {
|
3
|
-
validateJson(
|
4
|
-
validateArrayCoordinatesGeoJson(coordinatesPolygon: any, { coordinates }: Coordinates, reverseCoordinates:
|
3
|
+
validateJson(input: any): ValidateCoordinatesPolygonDTO;
|
4
|
+
validateArrayCoordinatesGeoJson(coordinatesPolygon: any, { coordinates }: Coordinates, reverseCoordinates: boolean): Promise<any>;
|
5
5
|
}
|
@@ -11,66 +11,38 @@ const common_1 = require("@nestjs/common");
|
|
11
11
|
const ms_geojson_dto_1 = require("./dto/ms-geojson.dto");
|
12
12
|
const class_validator_1 = require("class-validator");
|
13
13
|
const turf = require("@turf/turf");
|
14
|
-
const class_transformer_1 = require("class-transformer");
|
15
14
|
let MsGeoJsonService = class MsGeoJsonService {
|
16
|
-
|
15
|
+
validateJson(input) {
|
17
16
|
var _a;
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
const dto = (0, class_transformer_1.plainToClass)(ms_geojson_dto_1.FeatureDto, item);
|
30
|
-
const errors = await (0, class_validator_1.validate)(dto);
|
31
|
-
if (errors.length > 0) {
|
32
|
-
throw new Error('La entrada de datos es inválida.');
|
33
|
-
}
|
17
|
+
const dto = new ms_geojson_dto_1.ValidateCoordinatesPolygonDTO();
|
18
|
+
if (input && ((_a = input.geometry) === null || _a === void 0 ? void 0 : _a.coordinates) && Array.isArray(input.geometry.coordinates[0])) {
|
19
|
+
const arrayCoordinates = input.geometry.coordinates[0];
|
20
|
+
dto.polygonCoordinates = arrayCoordinates === null || arrayCoordinates === void 0 ? void 0 : arrayCoordinates.map((coords) => ({
|
21
|
+
coordinates: coords,
|
22
|
+
}));
|
23
|
+
}
|
24
|
+
const errors = (0, class_validator_1.validateSync)(dto);
|
25
|
+
if (errors.length > 0) {
|
26
|
+
throw new Error('La entrada de datos es inválida.');
|
34
27
|
}
|
28
|
+
return dto;
|
35
29
|
}
|
36
30
|
async validateArrayCoordinatesGeoJson(coordinatesPolygon, { coordinates }, reverseCoordinates) {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
await this.validateJson(coordinatesPolygon);
|
43
|
-
let setCoordinates = coordinates;
|
44
|
-
if (reverseCoordinates) {
|
45
|
-
setCoordinates = [coordinates[1], coordinates[0]];
|
46
|
-
}
|
47
|
-
for (let [i, cood] of coordinatesReal.entries()) {
|
48
|
-
if (cood.geometry.type === "MultiPolygon") {
|
49
|
-
const polygonGeoJSON = turf.multiPolygon(cood.geometry.coordinates);
|
50
|
-
const pointGeoJSON = turf.point(setCoordinates);
|
51
|
-
const isPointInside = turf.booleanPointInPolygon(pointGeoJSON, polygonGeoJSON);
|
52
|
-
if (isPointInside) {
|
53
|
-
response = {
|
54
|
-
index: i,
|
55
|
-
isPointInside
|
56
|
-
};
|
57
|
-
break;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
else if (cood.geometry.type === "Polygon") {
|
61
|
-
const polygonGeoJSON = turf.polygon(cood.geometry.coordinates);
|
62
|
-
const pointGeoJSON = turf.point(setCoordinates);
|
63
|
-
const isPointInside = turf.booleanPointInPolygon(pointGeoJSON, polygonGeoJSON);
|
64
|
-
if (isPointInside) {
|
65
|
-
response = {
|
66
|
-
index: i,
|
67
|
-
isPointInside
|
68
|
-
};
|
69
|
-
break;
|
70
|
-
}
|
31
|
+
try {
|
32
|
+
this.validateJson(coordinatesPolygon);
|
33
|
+
let dataCoordinates = coordinatesPolygon.geometry.coordinates[0];
|
34
|
+
if (reverseCoordinates) {
|
35
|
+
dataCoordinates = dataCoordinates.map((e) => [e[1], e[0]]);
|
71
36
|
}
|
37
|
+
const pointCoordinates = coordinates;
|
38
|
+
const pointGeoJSON = turf.point(pointCoordinates);
|
39
|
+
const polygonGeoJSON = turf.polygon([dataCoordinates]);
|
40
|
+
const isPointInside = turf.booleanPointInPolygon(pointGeoJSON, polygonGeoJSON);
|
41
|
+
return { isValid: isPointInside };
|
42
|
+
}
|
43
|
+
catch (error) {
|
44
|
+
throw error.message;
|
72
45
|
}
|
73
|
-
return response;
|
74
46
|
}
|
75
47
|
};
|
76
48
|
MsGeoJsonService = __decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ms-geojson.service.js","sourceRoot":"","sources":["../../src/ms-geojson/ms-geojson.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5D;YACD,MAAM,gBAAgB,GAAG,WAAW,CAAC;YACrC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAClD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;YACvD,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;YAC/E,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SACnC;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC,OAAO,CAAC;SACrB;IACH,CAAC;CACF,CAAA;AAjDY,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;GACA,gBAAgB,CAiD5B;AAjDY,4CAAgB"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Types = exports.MsLogsModule = exports.MsLogsService = void 0;
|
4
|
+
var ms_logs_service_1 = require("./ms-logs.service");
|
5
|
+
Object.defineProperty(exports, "MsLogsService", { enumerable: true, get: function () { return ms_logs_service_1.MsLogsService; } });
|
6
|
+
var ms_logs_module_1 = require("./ms-logs.module");
|
7
|
+
Object.defineProperty(exports, "MsLogsModule", { enumerable: true, get: function () { return ms_logs_module_1.MsLogsModule; } });
|
8
|
+
exports.Types = require("./types");
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ms-skylogs/index.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,mCAAiC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
2
|
+
type SkylogModuleOptions = {
|
3
|
+
global?: boolean;
|
4
|
+
urlMsSkyLogs?: string | undefined;
|
5
|
+
maxBodyLength?: number;
|
6
|
+
maxContentLength?: number;
|
7
|
+
};
|
8
|
+
export declare class MsLogsModule {
|
9
|
+
static register(options?: SkylogModuleOptions): DynamicModule;
|
10
|
+
static registerAsync(options: SkylogModuleOptions): Promise<DynamicModule>;
|
11
|
+
}
|
12
|
+
export {};
|
@@ -0,0 +1,61 @@
|
|
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 MsLogsModule_1;
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.MsLogsModule = void 0;
|
11
|
+
const common_1 = require("@nestjs/common");
|
12
|
+
const chalk_1 = require("chalk");
|
13
|
+
const ms_logs_service_1 = require("./ms-logs.service");
|
14
|
+
const axios_1 = require("@nestjs/axios");
|
15
|
+
let MsLogsModule = MsLogsModule_1 = class MsLogsModule {
|
16
|
+
static register(options) {
|
17
|
+
const url = (options === null || options === void 0 ? void 0 : options.urlMsSkyLogs) || process.env.ENV_SERVICE_MS_SKYLOGS;
|
18
|
+
if (!url)
|
19
|
+
console.warn(chalk_1.bold.red(`ENV_SERVICE_MS_SKYLOGS no definido en variables de entorno`));
|
20
|
+
return {
|
21
|
+
global: options.global,
|
22
|
+
module: MsLogsModule_1,
|
23
|
+
imports: [
|
24
|
+
axios_1.HttpModule.register({
|
25
|
+
baseURL: url,
|
26
|
+
timeout: 5000,
|
27
|
+
maxRedirects: 5,
|
28
|
+
maxBodyLength: options.maxBodyLength,
|
29
|
+
maxContentLength: options.maxContentLength,
|
30
|
+
}),
|
31
|
+
],
|
32
|
+
providers: [ms_logs_service_1.MsLogsService],
|
33
|
+
exports: [ms_logs_service_1.MsLogsService],
|
34
|
+
};
|
35
|
+
}
|
36
|
+
static async registerAsync(options) {
|
37
|
+
const url = (options === null || options === void 0 ? void 0 : options.urlMsSkyLogs) || process.env.ENV_SERVICE_MS_SKYLOGS;
|
38
|
+
if (!url)
|
39
|
+
console.warn(chalk_1.bold.red(`ENV_SERVICE_MS_SKYLOGS no definido en variables de entorno`));
|
40
|
+
return {
|
41
|
+
global: options.global,
|
42
|
+
module: MsLogsModule_1,
|
43
|
+
imports: [
|
44
|
+
axios_1.HttpModule.register({
|
45
|
+
baseURL: url,
|
46
|
+
timeout: 5000,
|
47
|
+
maxRedirects: 5,
|
48
|
+
maxBodyLength: options.maxBodyLength,
|
49
|
+
maxContentLength: options.maxContentLength,
|
50
|
+
}),
|
51
|
+
],
|
52
|
+
providers: [ms_logs_service_1.MsLogsService],
|
53
|
+
exports: [ms_logs_service_1.MsLogsService],
|
54
|
+
};
|
55
|
+
}
|
56
|
+
};
|
57
|
+
MsLogsModule = MsLogsModule_1 = __decorate([
|
58
|
+
(0, common_1.Module)({})
|
59
|
+
], MsLogsModule);
|
60
|
+
exports.MsLogsModule = MsLogsModule;
|
61
|
+
//# sourceMappingURL=ms-logs.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ms-logs.module.js","sourceRoot":"","sources":["../../src/ms-skylogs/ms-logs.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,iCAA6B;AAC7B,uDAAkD;AAClD,yCAA2C;AASpC,IAAM,YAAY,oBAAlB,MAAM,YAAY;IAIvB,MAAM,CAAC,QAAQ,CAAC,OAA6B;QAC3C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,CAAC,+BAAa,CAAC;SACzB,CAAC;IACJ,CAAC;CACF,CAAA;AA/CY,YAAY;IADxB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,YAAY,CA+CxB;AA/CY,oCAAY"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { HttpService } from '@nestjs/axios';
|
2
|
+
import { IAccesoLog, IErrorLog, IEventoLog, ILoginLog } from './types';
|
3
|
+
export declare class MsLogsService {
|
4
|
+
private readonly httpService;
|
5
|
+
private requestHttpService;
|
6
|
+
constructor(httpService: HttpService);
|
7
|
+
sendLoginLog(loginData: ILoginLog): Promise<any>;
|
8
|
+
sendAccesoLog(accesoData: IAccesoLog): Promise<any>;
|
9
|
+
sendEventoLog(eventoData: IEventoLog): Promise<any>;
|
10
|
+
sendErrorLog(errorData: IErrorLog): Promise<any>;
|
11
|
+
}
|
@@ -0,0 +1,55 @@
|
|
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.MsLogsService = void 0;
|
13
|
+
const axios_1 = require("@nestjs/axios");
|
14
|
+
const common_1 = require("@nestjs/common");
|
15
|
+
const request_helper_1 = require("../helpers/request.helper");
|
16
|
+
let MsLogsService = class MsLogsService {
|
17
|
+
constructor(httpService) {
|
18
|
+
this.httpService = httpService;
|
19
|
+
this.requestHttpService = (0, request_helper_1.newHttpServiceRequest)(httpService);
|
20
|
+
}
|
21
|
+
async sendLoginLog(loginData) {
|
22
|
+
return this.requestHttpService({
|
23
|
+
url: '/set/login',
|
24
|
+
method: 'POST',
|
25
|
+
data: loginData,
|
26
|
+
});
|
27
|
+
}
|
28
|
+
async sendAccesoLog(accesoData) {
|
29
|
+
return this.requestHttpService({
|
30
|
+
url: '/set/view',
|
31
|
+
method: 'POST',
|
32
|
+
data: accesoData,
|
33
|
+
});
|
34
|
+
}
|
35
|
+
async sendEventoLog(eventoData) {
|
36
|
+
return this.requestHttpService({
|
37
|
+
url: '/set/evento',
|
38
|
+
method: 'POST',
|
39
|
+
data: eventoData,
|
40
|
+
});
|
41
|
+
}
|
42
|
+
async sendErrorLog(errorData) {
|
43
|
+
return this.requestHttpService({
|
44
|
+
url: '/set/error',
|
45
|
+
method: 'POST',
|
46
|
+
data: errorData,
|
47
|
+
});
|
48
|
+
}
|
49
|
+
};
|
50
|
+
MsLogsService = __decorate([
|
51
|
+
(0, common_1.Injectable)(),
|
52
|
+
__metadata("design:paramtypes", [axios_1.HttpService])
|
53
|
+
], MsLogsService);
|
54
|
+
exports.MsLogsService = MsLogsService;
|
55
|
+
//# sourceMappingURL=ms-logs.service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ms-logs.service.js","sourceRoot":"","sources":["../../src/ms-skylogs/ms-logs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAA4C;AAC5C,8DAAmE;AAI5D,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGxB,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QAEnD,IAAI,CAAC,kBAAkB,GAAG,IAAA,sCAAqB,EAAC,WAAW,CAAC,CAAC;IAC/D,CAAC;IAOD,KAAK,CAAC,YAAY,CAAC,SAAoB;QACrC,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,GAAG,EAAE,YAAY;YACjB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACL,CAAC;IAOD,KAAK,CAAC,aAAa,CAAC,UAAsB;QACxC,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,GAAG,EAAE,WAAW;YAChB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;IACL,CAAC;IAOD,KAAK,CAAC,aAAa,CAAC,UAAsB;QACxC,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;IACL,CAAC;IAOD,KAAK,CAAC,YAAY,CAAC,SAAoB;QACrC,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,GAAG,EAAE,YAAY;YACjB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA3DY,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAI+B,mBAAW;GAH1C,aAAa,CA2DzB;AA3DY,sCAAa"}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { Method } from 'axios';
|
2
|
+
export type Request = `${Method | string} ${string}`;
|
3
|
+
export type IP = `${number}.${number}.${number}.${number}`;
|
4
|
+
export interface ILoginLog {
|
5
|
+
aplicacion: string;
|
6
|
+
funcionario_id: number;
|
7
|
+
funcionario_ci: string;
|
8
|
+
funcionario_nombre: string;
|
9
|
+
dispositivo_ip: IP;
|
10
|
+
dispositivo_so: string;
|
11
|
+
dispositivo_navegador: string;
|
12
|
+
}
|
13
|
+
export interface IAccesoLog {
|
14
|
+
aplicacion: string;
|
15
|
+
apartado: string;
|
16
|
+
apartado_info_extra: string;
|
17
|
+
tabla_id: number;
|
18
|
+
tabla_nombre: string;
|
19
|
+
funcionario_id: number;
|
20
|
+
funcionario_ci: string;
|
21
|
+
funcionario_nombre: string;
|
22
|
+
dispositivo_ip: IP;
|
23
|
+
dispositivo_so: string;
|
24
|
+
dispositivo_navegador: string;
|
25
|
+
}
|
26
|
+
export interface IEventoLog {
|
27
|
+
aplicacion: string;
|
28
|
+
evento: string;
|
29
|
+
tabla_id: number | string;
|
30
|
+
tabla_nombre: string;
|
31
|
+
tabla_pre_cambios: any;
|
32
|
+
request: Request;
|
33
|
+
funcionario_id: number;
|
34
|
+
funcionario_ci: string;
|
35
|
+
funcionario_nombre: string;
|
36
|
+
dispositivo_ip: IP;
|
37
|
+
dispositivo_so: string;
|
38
|
+
dispositivo_navegador: string;
|
39
|
+
}
|
40
|
+
export interface IErrorLog {
|
41
|
+
aplicacion: string;
|
42
|
+
evento: string;
|
43
|
+
tabla_id: number | string;
|
44
|
+
tabla_nombre: string;
|
45
|
+
request: Request;
|
46
|
+
error_string_json: string;
|
47
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ms-skylogs/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "fiscalia_bo-nest-helpers",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.38",
|
4
4
|
"author": "UTIC",
|
5
5
|
"contact": {
|
6
6
|
"name": "Unidad de Tecnologías de la Información y Comunicación - Ministerio Público",
|
@@ -12,6 +12,7 @@
|
|
12
12
|
"dist/ms-redis/*",
|
13
13
|
"dist/ms-personas/*",
|
14
14
|
"dist/ms-pdf/*",
|
15
|
+
"dist/ms-skylogs/*",
|
15
16
|
"dist/http-service/*",
|
16
17
|
"dist/services/*",
|
17
18
|
"dist/ms-geojson/*",
|