fiscalia_bo-nest-helpers 0.1.78 → 0.1.80

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.
@@ -1 +1 @@
1
- {"version":3,"file":"validator.functions.js","sourceRoot":"","sources":["../../src/custom-validators/validator.functions.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qDAA2C;AAC3C,MAAM,QAAQ,GAAG;IACf,MAAM,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG;IACpC,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE;QACvB,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO;YAAE,OAAO,GAAG,KAAK,MAAM,CAAC;;YAE3D,MAAM,IAAI,sBAAa,CACrB;gBACE,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE,iCAAiC;gBAC1C,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,GAAG;aACZ,EACD,GAAG,CACJ,CAAC;IACN,CAAC;IACD,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE;QACtB,IAAI,IAAA,0BAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;;YAEvF,MAAM,IAAI,sBAAa,CACrB;gBACE,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE,gCAAgC;gBACzC,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,GAAG;aACZ,EACD,GAAG,CACJ,CAAC;IACN,CAAC;IACD,MAAM,EAAE,CAAC,KAAU,EAAE,EAAE;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,KAAyB,EAAE,QAAa,EAAE,EAAE;IAC7E,IAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;QACxC,OAAO,KAAK,CAAC;KACd;SAAM;QACL,OAAO,QAAQ,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;KAC3C;AACH,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B"}
1
+ {"version":3,"file":"validator.functions.js","sourceRoot":"","sources":["../../src/custom-validators/validator.functions.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qDAA2C;AAC3C,MAAM,QAAQ,GAAG;IACf,MAAM,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG;IACpC,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE;QACvB,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO;YAAE,OAAO,GAAG,KAAK,MAAM,CAAC;;YAE3D,MAAM,IAAI,sBAAa,CACrB;gBACE,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE,iCAAiC;gBAC1C,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,GAAG;aACZ,EACD,GAAG,CACJ,CAAC;IACN,CAAC;IACD,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE;QACtB,IAAI,IAAA,0BAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;;YAEvF,MAAM,IAAI,sBAAa,CACrB;gBACE,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE,gCAAgC;gBACzC,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,GAAG;aACZ,EACD,GAAG,CACJ,CAAC;IACN,CAAC;IACD,MAAM,EAAE,CAAC,KAAU,EAAE,EAAE;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,KAAyB,EAAE,QAAa,EAAE,EAAE;IAC7E,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;QACzC,OAAO,KAAK,CAAC;KACd;SAAM;QACL,OAAO,QAAQ,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;KAC3C;AACH,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B"}
@@ -0,0 +1,2 @@
1
+ export * from './logs.module';
2
+ export * from './logs.service';
@@ -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("./logs.module"), exports);
18
+ __exportStar(require("./logs.service"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ms-logs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,iDAA+B"}
@@ -0,0 +1,39 @@
1
+ interface CommonBodyFields {
2
+ aplicacion: string;
3
+ funcionario_id: number;
4
+ funcionario_ci: string;
5
+ funcionario_nombre: string;
6
+ dispositivo_ip: string;
7
+ dispositivo_so: string;
8
+ dispositivo_navegador: string;
9
+ }
10
+ interface CommonTableFields {
11
+ tabla_id: string;
12
+ tabla_nombre: string;
13
+ }
14
+ export type loginLog = CommonBodyFields;
15
+ export interface viewLog extends CommonBodyFields, CommonTableFields {
16
+ apartado: string;
17
+ apartado_info_extra: string;
18
+ }
19
+ export interface eventLog extends CommonBodyFields, CommonTableFields {
20
+ evento: string;
21
+ tabla_pre_cambios?: string;
22
+ request: string;
23
+ }
24
+ export interface errorLog extends CommonTableFields {
25
+ aplicacion: string;
26
+ evento: string;
27
+ request: string;
28
+ error_string_json: string;
29
+ }
30
+ export interface searchLogs {
31
+ log: string;
32
+ aplicacion?: string;
33
+ funcionario_id?: number;
34
+ fechaInicio?: string;
35
+ fechaFin?: string;
36
+ page: number;
37
+ pageSize: number;
38
+ }
39
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=log.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.interface.js","sourceRoot":"","sources":["../../src/ms-logs/log.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { MsLogsService } from './logs.service';
2
+ export declare class LogsController {
3
+ private readonly msLogsService;
4
+ constructor(msLogsService: MsLogsService);
5
+ generateLogLogin(res: any): Promise<any>;
6
+ generateLogView(res: any): Promise<any>;
7
+ generateLogEvent(res: any): Promise<any>;
8
+ generateLogError(res: any): Promise<any>;
9
+ generateLogSearch(res: any): Promise<any>;
10
+ }
@@ -0,0 +1,154 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.LogsController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const logs_service_1 = require("./logs.service");
18
+ let LogsController = class LogsController {
19
+ constructor(msLogsService) {
20
+ this.msLogsService = msLogsService;
21
+ }
22
+ async generateLogLogin(res) {
23
+ try {
24
+ const response = await this.msLogsService.generateLogLogin({
25
+ aplicacion: 'jl1',
26
+ funcionario_id: 1,
27
+ funcionario_ci: '51234124',
28
+ funcionario_nombre: 'Javier Contreras Mamani',
29
+ dispositivo_ip: '192.168.0.1',
30
+ dispositivo_so: 'Windows 11',
31
+ dispositivo_navegador: 'Chrome 99',
32
+ });
33
+ return res.status(common_1.HttpStatus.OK).json(response);
34
+ }
35
+ catch (error) {
36
+ throw res.status(common_1.HttpStatus.BAD_GATEWAY).json(error);
37
+ }
38
+ }
39
+ async generateLogView(res) {
40
+ try {
41
+ const response = await this.msLogsService.generateLogView({
42
+ aplicacion: 'jl2',
43
+ apartado: 'caso',
44
+ apartado_info_extra: 'cud: 3143233',
45
+ tabla_id: 'string',
46
+ tabla_nombre: 'vacaciones',
47
+ funcionario_id: 1,
48
+ funcionario_ci: '51234124',
49
+ funcionario_nombre: 'Javier Contreras Mamani',
50
+ dispositivo_ip: '192.168.0.1',
51
+ dispositivo_so: 'Windows 11',
52
+ dispositivo_navegador: 'Chrome 99',
53
+ });
54
+ return res.status(common_1.HttpStatus.OK).json(response);
55
+ }
56
+ catch (error) {
57
+ throw res.status(common_1.HttpStatus.BAD_GATEWAY).json(error);
58
+ }
59
+ }
60
+ async generateLogEvent(res) {
61
+ try {
62
+ const response = await this.msLogsService.generateLogEvents({
63
+ aplicacion: 'jl2',
64
+ evento: 'editar',
65
+ tabla_id: '1001',
66
+ tabla_nombre: 'vacaciones',
67
+ tabla_pre_cambios: '{id:123,nombre:"misnombre"}',
68
+ request: 'PUT /listar/vacaciones',
69
+ funcionario_id: 1,
70
+ funcionario_ci: '5131343',
71
+ funcionario_nombre: 'Javier Contreras Mamani',
72
+ dispositivo_ip: '192.168.0.1',
73
+ dispositivo_so: 'Windows 11',
74
+ dispositivo_navegador: 'Chrome 99',
75
+ });
76
+ return res.status(common_1.HttpStatus.OK).json(response);
77
+ }
78
+ catch (error) {
79
+ throw res.status(common_1.HttpStatus.BAD_GATEWAY).json(error);
80
+ }
81
+ }
82
+ async generateLogError(res) {
83
+ try {
84
+ const response = await this.msLogsService.generateLogError({
85
+ aplicacion: 'jl2',
86
+ evento: 'Listar vacaciones',
87
+ tabla_id: 'string',
88
+ tabla_nombre: 'vacaciones',
89
+ request: 'POST /listar/vacaciones',
90
+ error_string_json: 'string',
91
+ });
92
+ return res.status(common_1.HttpStatus.OK).json(response);
93
+ }
94
+ catch (error) {
95
+ throw res.status(common_1.HttpStatus.BAD_GATEWAY).json(error);
96
+ }
97
+ }
98
+ async generateLogSearch(res) {
99
+ try {
100
+ const response = await this.msLogsService.searchLogs({
101
+ log: 'logs_login',
102
+ fechaInicio: '2023-09-15',
103
+ fechaFin: '2023-09-18',
104
+ page: 1,
105
+ pageSize: 10,
106
+ });
107
+ return res.status(common_1.HttpStatus.OK).json(response);
108
+ }
109
+ catch (error) {
110
+ throw res.status(common_1.HttpStatus.BAD_GATEWAY).json(error);
111
+ }
112
+ }
113
+ };
114
+ __decorate([
115
+ (0, common_1.Post)('/log-login'),
116
+ __param(0, (0, common_1.Res)()),
117
+ __metadata("design:type", Function),
118
+ __metadata("design:paramtypes", [Object]),
119
+ __metadata("design:returntype", Promise)
120
+ ], LogsController.prototype, "generateLogLogin", null);
121
+ __decorate([
122
+ (0, common_1.Post)('/log-view'),
123
+ __param(0, (0, common_1.Res)()),
124
+ __metadata("design:type", Function),
125
+ __metadata("design:paramtypes", [Object]),
126
+ __metadata("design:returntype", Promise)
127
+ ], LogsController.prototype, "generateLogView", null);
128
+ __decorate([
129
+ (0, common_1.Post)('/log-event'),
130
+ __param(0, (0, common_1.Res)()),
131
+ __metadata("design:type", Function),
132
+ __metadata("design:paramtypes", [Object]),
133
+ __metadata("design:returntype", Promise)
134
+ ], LogsController.prototype, "generateLogEvent", null);
135
+ __decorate([
136
+ (0, common_1.Post)('/log-error'),
137
+ __param(0, (0, common_1.Res)()),
138
+ __metadata("design:type", Function),
139
+ __metadata("design:paramtypes", [Object]),
140
+ __metadata("design:returntype", Promise)
141
+ ], LogsController.prototype, "generateLogError", null);
142
+ __decorate([
143
+ (0, common_1.Post)('/log-search'),
144
+ __param(0, (0, common_1.Res)()),
145
+ __metadata("design:type", Function),
146
+ __metadata("design:paramtypes", [Object]),
147
+ __metadata("design:returntype", Promise)
148
+ ], LogsController.prototype, "generateLogSearch", null);
149
+ LogsController = __decorate([
150
+ (0, common_1.Controller)('logs'),
151
+ __metadata("design:paramtypes", [logs_service_1.MsLogsService])
152
+ ], LogsController);
153
+ exports.LogsController = LogsController;
154
+ //# sourceMappingURL=logs.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.controller.js","sourceRoot":"","sources":["../../src/ms-logs/logs.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoG;AACpG,iDAA+C;AAGxC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAGvD,AAAN,KAAK,CAAC,gBAAgB,CAAQ,GAAG;QAC/B,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC;gBACzD,UAAU,EAAE,KAAK;gBACjB,cAAc,EAAE,CAAC;gBACjB,cAAc,EAAE,UAAU;gBAC1B,kBAAkB,EAAE,yBAAyB;gBAC7C,cAAc,EAAE,aAAa;gBAC7B,cAAc,EAAE,YAAY;gBAC5B,qBAAqB,EAAE,WAAW;aAC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AAC;YACH,OAAO,GAAG,CAAC,MAAM,CAAC,mBAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACjD;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,GAAG,CAAC,MAAM,CAAC,mBAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACtD;IACH,CAAC;CACF,CAAA;AAhGO;IADL,IAAA,aAAI,EAAC,YAAY,CAAC;IACK,WAAA,IAAA,YAAG,GAAE,CAAA;;;;sDAe5B;AAGK;IADL,IAAA,aAAI,EAAC,WAAW,CAAC;IACK,WAAA,IAAA,YAAG,GAAE,CAAA;;;;qDAmB3B;AAGK;IADL,IAAA,aAAI,EAAC,YAAY,CAAC;IACK,WAAA,IAAA,YAAG,GAAE,CAAA;;;;sDAoB5B;AAGK;IADL,IAAA,aAAI,EAAC,YAAY,CAAC;IACK,WAAA,IAAA,YAAG,GAAE,CAAA;;;;sDAc5B;AAGK;IADL,IAAA,aAAI,EAAC,aAAa,CAAC;IACK,WAAA,IAAA,YAAG,GAAE,CAAA;;;;uDAe7B;AAnGU,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAE2B,4BAAa;GAD9C,cAAc,CAoG1B;AApGY,wCAAc"}
@@ -0,0 +1,13 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ type MsLogsModuleOptions = {
3
+ global?: boolean;
4
+ urlMsLogs?: string | undefined;
5
+ timeout?: number;
6
+ maxBodyLength?: number;
7
+ maxContentLength?: number;
8
+ };
9
+ export declare class MsLogsModule {
10
+ static register(options?: MsLogsModuleOptions): DynamicModule;
11
+ static registerAsync(options: MsLogsModuleOptions): Promise<DynamicModule>;
12
+ }
13
+ export {};
@@ -0,0 +1,64 @@
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 axios_1 = require("@nestjs/axios");
12
+ const common_1 = require("@nestjs/common");
13
+ const logs_service_1 = require("./logs.service");
14
+ const chalk_1 = require("chalk");
15
+ let MsLogsModule = MsLogsModule_1 = class MsLogsModule {
16
+ static register(options) {
17
+ const url = (options === null || options === void 0 ? void 0 : options.urlMsLogs) || process.env.SERVICE_MS_LOGS;
18
+ if (!url)
19
+ console.warn(chalk_1.bold.red(`SERVICE_MS_LOGS no definido en variables de entorno para ms-files`));
20
+ return {
21
+ global: options.global,
22
+ module: MsLogsModule_1,
23
+ providers: [
24
+ logs_service_1.MsLogsService,
25
+ {
26
+ provide: 'BASE_URL',
27
+ useValue: url,
28
+ },
29
+ ],
30
+ exports: [logs_service_1.MsLogsService],
31
+ };
32
+ }
33
+ static async registerAsync(options) {
34
+ const url = (options === null || options === void 0 ? void 0 : options.urlMsLogs) || process.env.SERVICE_MS_LOGS;
35
+ if (!url)
36
+ console.warn(chalk_1.bold.red(`SERVICE_MS_LOGS no definido en variables de entorno para ms-files`));
37
+ return {
38
+ global: options.global,
39
+ module: MsLogsModule_1,
40
+ providers: [
41
+ logs_service_1.MsLogsService,
42
+ {
43
+ provide: 'BASE_URL',
44
+ useValue: url,
45
+ },
46
+ ],
47
+ exports: [logs_service_1.MsLogsService],
48
+ };
49
+ }
50
+ };
51
+ MsLogsModule = MsLogsModule_1 = __decorate([
52
+ (0, common_1.Module)({
53
+ imports: [axios_1.HttpModule],
54
+ providers: [
55
+ logs_service_1.MsLogsService,
56
+ {
57
+ provide: 'BASE_URL',
58
+ useValue: process.env.SERVICE_MS_LOGS,
59
+ },
60
+ ],
61
+ })
62
+ ], MsLogsModule);
63
+ exports.MsLogsModule = MsLogsModule;
64
+ //# sourceMappingURL=logs.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.module.js","sourceRoot":"","sources":["../../src/ms-logs/logs.module.ts"],"names":[],"mappings":";;;;;;;;;;AAUA,yCAA2C;AAC3C,2CAAuD;AACvD,iDAA+C;AAC/C,iCAA6B;AAsBtB,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,OAA6B;QAC3C,MAAM,GAAG,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,KAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC9D,IAAI,CAAC,GAAG;YACN,OAAO,CAAC,IAAI,CAAC,YAAI,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC,CAAC;QAC9F,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,cAAY;YACpB,SAAS,EAAE;gBACT,4BAAa;gBACb;oBACE,OAAO,EAAE,UAAU;oBACnB,QAAQ,EAAE,GAAG;iBACd;aACF;YACD,OAAO,EAAE,CAAC,4BAAa,CAAC;SACzB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,OAA4B;QACrD,MAAM,GAAG,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,KAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC9D,IAAI,CAAC,GAAG;YACN,OAAO,CAAC,IAAI,CAAC,YAAI,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC,CAAC;QAE9F,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,cAAY;YACpB,SAAS,EAAE;gBACT,4BAAa;gBACb;oBACE,OAAO,EAAE,UAAU;oBACnB,QAAQ,EAAE,GAAG;iBACd;aACF;YACD,OAAO,EAAE,CAAC,4BAAa,CAAC;SACzB,CAAC;IACJ,CAAC;CACF,CAAA;AArCY,YAAY;IAXxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,kBAAU,CAAC;QAErB,SAAS,EAAE;YACT,4BAAa;YACb;gBACE,OAAO,EAAE,UAAU;gBACnB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;aACtC;SACF;KACF,CAAC;GACW,YAAY,CAqCxB;AArCY,oCAAY"}
@@ -0,0 +1,14 @@
1
+ import { HttpService } from '@nestjs/axios';
2
+ import { AxiosResponse } from 'axios';
3
+ import { Observable } from 'rxjs';
4
+ import { errorLog, eventLog, loginLog, searchLogs, viewLog } from './log.interface';
5
+ export declare class MsLogsService {
6
+ private baseUrl;
7
+ private readonly httpService;
8
+ constructor(baseUrl: string, httpService: HttpService);
9
+ generateLogLogin(log: loginLog): Promise<Observable<AxiosResponse<any[]>>>;
10
+ generateLogView(log: viewLog): Promise<Observable<AxiosResponse<any[]>>>;
11
+ generateLogEvents(log: eventLog): Promise<Observable<AxiosResponse<any[]>>>;
12
+ generateLogError(log: errorLog): Promise<Observable<AxiosResponse<any[]>>>;
13
+ searchLogs(log: searchLogs): Promise<Observable<AxiosResponse<any[]>>>;
14
+ }
@@ -0,0 +1,84 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MsLogsService = void 0;
16
+ const axios_1 = require("@nestjs/axios");
17
+ const common_1 = require("@nestjs/common");
18
+ const rxjs_1 = require("rxjs");
19
+ let MsLogsService = class MsLogsService {
20
+ constructor(baseUrl, httpService) {
21
+ this.baseUrl = baseUrl;
22
+ this.httpService = httpService;
23
+ }
24
+ async generateLogLogin(log) {
25
+ try {
26
+ const response = await (0, rxjs_1.firstValueFrom)(this.httpService.post(`${this.baseUrl}/logs/set/login`, log));
27
+ return response.data;
28
+ }
29
+ catch (error) {
30
+ throw error.response.data;
31
+ }
32
+ }
33
+ async generateLogView(log) {
34
+ try {
35
+ const response = await this.httpService
36
+ .post(`${this.baseUrl}/logs/set/view`, log)
37
+ .toPromise();
38
+ return response.data;
39
+ }
40
+ catch (error) {
41
+ throw error.response.data;
42
+ }
43
+ }
44
+ async generateLogEvents(log) {
45
+ try {
46
+ const response = await this.httpService
47
+ .post(`${this.baseUrl}/logs/set/event`, log)
48
+ .toPromise();
49
+ return response.data;
50
+ }
51
+ catch (error) {
52
+ throw error.response.data;
53
+ }
54
+ }
55
+ async generateLogError(log) {
56
+ try {
57
+ const response = await this.httpService
58
+ .post(`${this.baseUrl}/logs/set/error`, log)
59
+ .toPromise();
60
+ return response.data;
61
+ }
62
+ catch (error) {
63
+ throw error.response.data;
64
+ }
65
+ }
66
+ async searchLogs(log) {
67
+ try {
68
+ const response = await this.httpService
69
+ .post(`${this.baseUrl}/logs/get/logs`, log)
70
+ .toPromise();
71
+ return response.data;
72
+ }
73
+ catch (error) {
74
+ throw error.response.data;
75
+ }
76
+ }
77
+ };
78
+ MsLogsService = __decorate([
79
+ (0, common_1.Injectable)(),
80
+ __param(0, (0, common_1.Inject)('BASE_URL')),
81
+ __metadata("design:paramtypes", [String, axios_1.HttpService])
82
+ ], MsLogsService);
83
+ exports.MsLogsService = MsLogsService;
84
+ //# sourceMappingURL=logs.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.service.js","sourceRoot":"","sources":["../../src/ms-logs/logs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAAoD;AAEpD,+BAAkD;AAI3C,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAC8B,OAAe,EAC1B,WAAwB;QADb,YAAO,GAAP,OAAO,CAAQ;QAC1B,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ,KAAK,CAAC,gBAAgB,CAAC,GAAa;QAClC,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,iBAAiB,EAAE,GAAG,CAAC,CAC7D,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;SAC3B;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,GAAY;QAChC,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW;iBACpC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,gBAAgB,EAAE,GAAG,CAAC;iBAC1C,SAAS,EAAE,CAAC;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;SAC3B;IACH,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,GAAa;QACnC,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW;iBACpC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,iBAAiB,EAAE,GAAG,CAAC;iBAC3C,SAAS,EAAE,CAAC;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;SAC3B;IACH,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,GAAa;QAClC,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW;iBACpC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,iBAAiB,EAAE,GAAG,CAAC;iBAC3C,SAAS,EAAE,CAAC;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;SAC3B;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,GAAe;QAC9B,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW;iBACpC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,gBAAgB,EAAE,GAAG,CAAC;iBAC1C,SAAS,EAAE,CAAC;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;SAC3B;IACH,CAAC;CACF,CAAA;AA5DY,aAAa;IADzB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,UAAU,CAAC,CAAA;6CACW,mBAAW;GAHhC,aAAa,CA4DzB;AA5DY,sCAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiscalia_bo-nest-helpers",
3
- "version": "0.1.78",
3
+ "version": "0.1.80",
4
4
  "description": "Helpers y servicios para NestJS",
5
5
  "author": "UTIC - Ministerio Público",
6
6
  "contact": {
@@ -21,6 +21,7 @@
21
21
  "dist/custom-validators/*",
22
22
  "dist/decorators/*",
23
23
  "dist/dto/*",
24
+ "dist/ms-logs/*",
24
25
  "dist/ms-skylogs/*",
25
26
  "dist/http-service/*",
26
27
  "dist/services/*",