fiscalia_bo-nest-helpers 0.0.38 → 0.0.40
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/README.md +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/ms-files/index.d.ts +3 -0
- package/dist/ms-files/index.js +9 -0
- package/dist/ms-files/index.js.map +1 -0
- package/dist/ms-files/ms-files.module.d.ts +12 -0
- package/dist/ms-files/ms-files.module.js +61 -0
- package/dist/ms-files/ms-files.module.js.map +1 -0
- package/dist/{services → ms-files}/ms-files.service.d.ts +6 -4
- package/dist/{services → ms-files}/ms-files.service.js +5 -5
- package/dist/{services → ms-files}/ms-files.service.js.map +1 -1
- package/dist/ms-files/types.d.ts +26 -0
- package/dist/ms-files/types.js +3 -0
- package/dist/ms-files/types.js.map +1 -0
- package/dist/ms-geojson/dto/ms-geojson.dto.d.ts +15 -2
- package/dist/ms-geojson/dto/ms-geojson.dto.js +40 -8
- 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 +53 -25
- package/dist/ms-geojson/ms-geojson.service.js.map +1 -1
- package/dist/ms-pdf/types.d.ts +4 -1
- package/dist/types/input.type.d.ts +0 -26
- package/package.json +2 -1
package/README.md
CHANGED
@@ -16,7 +16,7 @@ Este proyecto esta orientado a la publicación de helpers básicos al momento de
|
|
16
16
|
|
17
17
|
De momento se tienen los siguientes servicios:
|
18
18
|
|
19
|
-
- <b>MS-FILES</b>: Para su uso debe tener la variable de entorno "
|
19
|
+
- <b>MS-FILES</b>: Para su uso debe tener la variable de entorno "SERVICE_MS_FILES_URL='url del entorno de ms-files'"
|
20
20
|
|
21
21
|
## Compilación antes de publicar
|
22
22
|
|
@@ -39,7 +39,7 @@ import { MsFilesService } from 'fiscalia_bo-nest-helpers';
|
|
39
39
|
## variables de entorno obligatorios
|
40
40
|
|
41
41
|
```properties
|
42
|
-
|
42
|
+
SERVICE_MS_FILES_URL='https://ms-files.url'
|
43
43
|
```
|
44
44
|
|
45
45
|
# USO DEL MODULO `MS-SEGURIDAD`
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './
|
1
|
+
export * from './ms-files/ms-files.service';
|
2
2
|
export * from './ms-redis/ms-redis.module';
|
3
3
|
export * from './ms-redis/ms-redis.service';
|
4
4
|
export * from './ms-redis/datapass.interceptor';
|
@@ -16,4 +16,5 @@ export * from './types';
|
|
16
16
|
export * from './helpers/request.helper';
|
17
17
|
export * as MsPersonas from './ms-personas';
|
18
18
|
export * as MsPdf from './ms-pdf';
|
19
|
+
export * as MsFiles from './ms-files';
|
19
20
|
export * as MsSkylogs from './ms-skylogs';
|
package/dist/index.js
CHANGED
@@ -14,8 +14,8 @@ 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.MsSkylogs = exports.MsPdf = exports.MsPersonas = exports.PermissionsGuard = exports.MsSeguridadHttpError = void 0;
|
18
|
-
__exportStar(require("./
|
17
|
+
exports.MsSkylogs = exports.MsFiles = exports.MsPdf = exports.MsPersonas = exports.PermissionsGuard = exports.MsSeguridadHttpError = void 0;
|
18
|
+
__exportStar(require("./ms-files/ms-files.service"), exports);
|
19
19
|
__exportStar(require("./ms-redis/ms-redis.module"), exports);
|
20
20
|
__exportStar(require("./ms-redis/ms-redis.service"), exports);
|
21
21
|
__exportStar(require("./ms-redis/datapass.interceptor"), exports);
|
@@ -35,5 +35,6 @@ __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.MsFiles = require("./ms-files");
|
38
39
|
exports.MsSkylogs = require("./ms-skylogs");
|
39
40
|
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Types = exports.MsFilesModule = exports.MsFilesService = void 0;
|
4
|
+
var ms_files_service_1 = require("./ms-files.service");
|
5
|
+
Object.defineProperty(exports, "MsFilesService", { enumerable: true, get: function () { return ms_files_service_1.MsFilesService; } });
|
6
|
+
var ms_files_module_1 = require("./ms-files.module");
|
7
|
+
Object.defineProperty(exports, "MsFilesModule", { enumerable: true, get: function () { return ms_files_module_1.MsFilesModule; } });
|
8
|
+
exports.Types = require("./types");
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ms-files/index.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,mCAAiC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
2
|
+
type MsFilesModuleOptions = {
|
3
|
+
global?: boolean;
|
4
|
+
urlMsSkyLogs?: string | undefined;
|
5
|
+
maxBodyLength?: number;
|
6
|
+
maxContentLength?: number;
|
7
|
+
};
|
8
|
+
export declare class MsFilesModule {
|
9
|
+
static register(options?: MsFilesModuleOptions): DynamicModule;
|
10
|
+
static registerAsync(options: MsFilesModuleOptions): 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 MsFilesModule_1;
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.MsFilesModule = void 0;
|
11
|
+
const axios_1 = require("@nestjs/axios");
|
12
|
+
const common_1 = require("@nestjs/common");
|
13
|
+
const ms_files_service_1 = require("./ms-files.service");
|
14
|
+
const chalk_1 = require("chalk");
|
15
|
+
let MsFilesModule = MsFilesModule_1 = class MsFilesModule {
|
16
|
+
static register(options) {
|
17
|
+
const url = (options === null || options === void 0 ? void 0 : options.urlMsSkyLogs) || process.env.SERVICE_MS_FILES_URL;
|
18
|
+
if (!url)
|
19
|
+
console.warn(chalk_1.bold.red(`SERVICE_MS_FILES_URL no definido en variables de entorno para ms-files`));
|
20
|
+
return {
|
21
|
+
global: options.global,
|
22
|
+
module: MsFilesModule_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_files_service_1.MsFilesService],
|
33
|
+
exports: [ms_files_service_1.MsFilesService],
|
34
|
+
};
|
35
|
+
}
|
36
|
+
static async registerAsync(options) {
|
37
|
+
const url = (options === null || options === void 0 ? void 0 : options.urlMsSkyLogs) || process.env.SERVICE_MS_FILES_URL;
|
38
|
+
if (!url)
|
39
|
+
console.warn(chalk_1.bold.red(`SERVICE_MS_FILES_URL no definido en variables de entorno para ms-files`));
|
40
|
+
return {
|
41
|
+
global: options.global,
|
42
|
+
module: MsFilesModule_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_files_service_1.MsFilesService],
|
53
|
+
exports: [ms_files_service_1.MsFilesService],
|
54
|
+
};
|
55
|
+
}
|
56
|
+
};
|
57
|
+
MsFilesModule = MsFilesModule_1 = __decorate([
|
58
|
+
(0, common_1.Module)({})
|
59
|
+
], MsFilesModule);
|
60
|
+
exports.MsFilesModule = MsFilesModule;
|
61
|
+
//# sourceMappingURL=ms-files.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ms-files.module.js","sourceRoot":"","sources":["../../src/ms-files/ms-files.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,yCAA2C;AAC3C,2CAAuD;AACvD,yDAAoD;AACpD,iCAA6B;AAStB,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAIxB,MAAM,CAAC,QAAQ,CAAC,OAA8B;QAC5C,MAAM,GAAG,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;QACtE,IAAI,CAAC,GAAG;YACN,OAAO,CAAC,IAAI,CACV,YAAI,CAAC,GAAG,CAAC,wEAAwE,CAAC,CACnF,CAAC;QACJ,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,eAAa;YACrB,OAAO,EAAE;gBACP,kBAAU,CAAC,QAAQ,CAAC;oBAClB,OAAO,EAAE,GAAG;oBACZ,OAAO,EAAE,IAAI;oBACb,YAAY,EAAE,CAAC;oBACf,aAAa,EAAE,OAAO,CAAC,aAAa;oBACpC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;iBAC3C,CAAC;aACH;YACD,SAAS,EAAE,CAAC,iCAAc,CAAC;YAC3B,OAAO,EAAE,CAAC,iCAAc,CAAC;SAC1B,CAAC;IACJ,CAAC;IAKD,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,OAA6B;QACtD,MAAM,GAAG,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;QACtE,IAAI,CAAC,GAAG;YACN,OAAO,CAAC,IAAI,CACV,YAAI,CAAC,GAAG,CAAC,wEAAwE,CAAC,CACnF,CAAC;QAEJ,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,eAAa;YACrB,OAAO,EAAE;gBACP,kBAAU,CAAC,QAAQ,CAAC;oBAClB,OAAO,EAAE,GAAG;oBACZ,OAAO,EAAE,IAAI;oBACb,YAAY,EAAE,CAAC;oBACf,aAAa,EAAE,OAAO,CAAC,aAAa;oBACpC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;iBAC3C,CAAC;aACH;YACD,SAAS,EAAE,CAAC,iCAAc,CAAC;YAC3B,OAAO,EAAE,CAAC,iCAAc,CAAC;SAC1B,CAAC;IACJ,CAAC;CACF,CAAA;AArDY,aAAa;IADzB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,aAAa,CAqDzB;AArDY,sCAAa"}
|
@@ -1,10 +1,12 @@
|
|
1
|
-
import { MsFileReplaceFile, MsFileVerifyExistFile } from './../types/input.type';
|
2
1
|
import { AxiosRequestHeaders } from 'axios';
|
3
|
-
import {
|
2
|
+
import { ResponseDTO, MsFileCreatedFile, MsFilesReadFile, MsFileRelocatedFile, MsFileVerifiedExistFile, MsFileReplacedFile } from '../types';
|
4
3
|
import 'dotenv/config';
|
4
|
+
import { HttpService } from '@nestjs/axios';
|
5
|
+
import { MsFileReadFile, MsFileRelocateFile, MsFileReplaceFile, MsFileVerifyExistFile, MsFileWriteFile } from './types';
|
5
6
|
export declare class MsFilesService {
|
6
|
-
|
7
|
-
|
7
|
+
private readonly httpService;
|
8
|
+
private MsFileRequest;
|
9
|
+
constructor(httpService: HttpService);
|
8
10
|
writeFileBase64V1(data: MsFileWriteFile, headers?: Partial<AxiosRequestHeaders>): Promise<ResponseDTO<MsFileCreatedFile>>;
|
9
11
|
readFileBase64V1(data: MsFileReadFile, headers?: Partial<AxiosRequestHeaders>): Promise<ResponseDTO<MsFilesReadFile>>;
|
10
12
|
getFileById(id: string, headers?: Partial<AxiosRequestHeaders>): Promise<ResponseDTO<MsFilesReadFile>>;
|
@@ -13,11 +13,11 @@ exports.MsFilesService = void 0;
|
|
13
13
|
const request_helper_1 = require("../helpers/request.helper");
|
14
14
|
require("dotenv/config");
|
15
15
|
const common_1 = require("@nestjs/common");
|
16
|
+
const axios_1 = require("@nestjs/axios");
|
16
17
|
let MsFilesService = class MsFilesService {
|
17
|
-
constructor() {
|
18
|
-
|
19
|
-
|
20
|
-
this.MsFileRequest = (0, request_helper_1.newRequestHttp)(process.env.ENV_SERVICE_MS_FILES || null);
|
18
|
+
constructor(httpService) {
|
19
|
+
this.httpService = httpService;
|
20
|
+
this.MsFileRequest = (0, request_helper_1.newHttpServiceRequest)(httpService);
|
21
21
|
}
|
22
22
|
async writeFileBase64V1(data, headers = {}) {
|
23
23
|
headers['Content-Type'] = 'application/json';
|
@@ -63,7 +63,7 @@ let MsFilesService = class MsFilesService {
|
|
63
63
|
};
|
64
64
|
MsFilesService = __decorate([
|
65
65
|
(0, common_1.Injectable)(),
|
66
|
-
__metadata("design:paramtypes", [])
|
66
|
+
__metadata("design:paramtypes", [axios_1.HttpService])
|
67
67
|
], MsFilesService);
|
68
68
|
exports.MsFilesService = MsFilesService;
|
69
69
|
//# sourceMappingURL=ms-files.service.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ms-files.service.js","sourceRoot":"","sources":["../../src/
|
1
|
+
{"version":3,"file":"ms-files.service.js","sourceRoot":"","sources":["../../src/ms-files/ms-files.service.ts"],"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c,CAAC,GAAG,kBAAkB,CAAC;QAC7C,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/F,CAAC;IAQD,KAAK,CAAC,oBAAoB,CACxB,IAAwB,EACxB,UAAwC,EAAE;QAE1C,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAC7C,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;IAQD,KAAK,CAAC,iBAAiB,CACrB,IAA2B,EAC3B,UAAwC,EAAE;QAE1C,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAC7C,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;IAOD,KAAK,CAAC,eAAe,CACnB,UAAwC,EAAE;QAG1C,OAAO,IAAI,CAAC,aAAa,CACvB;YACE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,uBAAuB;SAC7B,EACD,OAAO,CACR,CAAC;IACJ,CAAC;CACF,CAAA;AA3IY,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAI+B,mBAAW;GAH1C,cAAc,CA2I1B;AA3IY,wCAAc"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export interface MsFileWriteFile {
|
2
|
+
appName: string;
|
3
|
+
fileName: string;
|
4
|
+
base64: string;
|
5
|
+
path: string;
|
6
|
+
nas: string;
|
7
|
+
withDateSubFolder?: boolean;
|
8
|
+
}
|
9
|
+
export type MsFileReadFile = {
|
10
|
+
id?: string;
|
11
|
+
pathName?: string;
|
12
|
+
};
|
13
|
+
export type MsFileRelocateFile = {
|
14
|
+
id?: string;
|
15
|
+
pathName?: string;
|
16
|
+
newPathName: string;
|
17
|
+
replaceIfExists: boolean;
|
18
|
+
};
|
19
|
+
export type MsFileVerifyExistFile = {
|
20
|
+
pathName: string;
|
21
|
+
};
|
22
|
+
export type MsFileReplaceFile = {
|
23
|
+
id?: string;
|
24
|
+
pathName?: string;
|
25
|
+
base64: string;
|
26
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ms-files/types.ts"],"names":[],"mappings":""}
|
@@ -1,6 +1,19 @@
|
|
1
1
|
export declare class Coordinates {
|
2
2
|
coordinates: [number, number];
|
3
3
|
}
|
4
|
-
|
5
|
-
|
4
|
+
declare class GeometryDto {
|
5
|
+
type: string;
|
6
|
+
coordinates: Object;
|
6
7
|
}
|
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,25 +9,57 @@ 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.FeatureDto = 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),
|
19
18
|
(0, class_validator_1.IsArray)(),
|
20
19
|
(0, class_validator_1.IsNumber)({}, { each: true }),
|
21
20
|
__metadata("design:type", Array)
|
22
21
|
], Coordinates.prototype, "coordinates", void 0);
|
23
22
|
exports.Coordinates = Coordinates;
|
24
|
-
class
|
23
|
+
class GeometryDto {
|
25
24
|
}
|
26
25
|
__decorate([
|
27
|
-
(0,
|
26
|
+
(0, class_validator_1.IsString)(),
|
27
|
+
(0, class_validator_1.IsNotEmpty)(),
|
28
|
+
__metadata("design:type", String)
|
29
|
+
], GeometryDto.prototype, "type", void 0);
|
30
|
+
__decorate([
|
28
31
|
(0, class_validator_1.IsArray)(),
|
29
|
-
(0, class_validator_1.
|
30
|
-
__metadata("design:type",
|
31
|
-
],
|
32
|
-
|
32
|
+
(0, class_validator_1.ArrayMinSize)(1),
|
33
|
+
__metadata("design:type", Object)
|
34
|
+
], GeometryDto.prototype, "coordinates", void 0);
|
35
|
+
class properties {
|
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;
|
33
65
|
//# 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,qDAAwG;AAGxG,MAAa,WAAW;CAIvB;AAHC;IAAC,IAAA,yBAAO,GAAE;IACT,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;gDACC;AAHhC,kCAIC;AAGD,MAAM,WAAW;CAQhB;AAPC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACA;AAEb;IAAC,IAAA,yBAAO,GAAE;IACT,IAAA,8BAAY,EAAC,CAAC,CAAC;8BACH,MAAM;gDAAC;AAGtB,MAAM,UAAU;CAIf;AAHC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;wCACD;AAGd,MAAa,UAAU;CAiBtB;AAhBC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;wCACA;AAEb;IAAC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC;8BACd,WAAW;4CAAC;AAEtB;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;sCACF;AAGX;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,UAAU,CAAC;IACtB,IAAA,4BAAU,GAAE;;8CACoB;AAhBnC,gCAiBC"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Coordinates
|
1
|
+
import { Coordinates } from './dto/ms-geojson.dto';
|
2
2
|
export declare class MsGeoJsonService {
|
3
|
-
validateJson(
|
4
|
-
validateArrayCoordinatesGeoJson(coordinatesPolygon: any, { coordinates }: Coordinates, reverseCoordinates:
|
3
|
+
validateJson(dataGEOJSON: any): Promise<void>;
|
4
|
+
validateArrayCoordinatesGeoJson(coordinatesPolygon: any, { coordinates }: Coordinates, reverseCoordinates: Boolean): Promise<any>;
|
5
5
|
}
|
@@ -11,38 +11,66 @@ 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");
|
14
15
|
let MsGeoJsonService = class MsGeoJsonService {
|
15
|
-
validateJson(
|
16
|
+
async validateJson(dataGEOJSON) {
|
16
17
|
var _a;
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
for (const item of dataGEOJSON) {
|
19
|
+
if (((_a = item.geometry) === null || _a === void 0 ? void 0 : _a.coordinates) && Array.isArray(item.geometry.coordinates[0])) {
|
20
|
+
let setCoordinatesValidate = [];
|
21
|
+
for (let cood of item.geometry.coordinates) {
|
22
|
+
let setCood = cood.map(e => {
|
23
|
+
return { coordinate: [e[0], e[1]] };
|
24
|
+
});
|
25
|
+
setCoordinatesValidate.push(setCood);
|
26
|
+
}
|
27
|
+
item.geometry.coordinates = setCoordinatesValidate;
|
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
|
+
}
|
27
34
|
}
|
28
|
-
return dto;
|
29
35
|
}
|
30
36
|
async validateArrayCoordinatesGeoJson(coordinatesPolygon, { coordinates }, reverseCoordinates) {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
const isPointInside = turf.booleanPointInPolygon(pointGeoJSON, polygonGeoJSON);
|
41
|
-
return { isValid: isPointInside };
|
37
|
+
const coordinatesReal = JSON.parse(JSON.stringify(coordinatesPolygon));
|
38
|
+
let response = {
|
39
|
+
index: null,
|
40
|
+
isPointInside: false
|
41
|
+
};
|
42
|
+
await this.validateJson(coordinatesPolygon);
|
43
|
+
let setCoordinates = coordinates;
|
44
|
+
if (reverseCoordinates) {
|
45
|
+
setCoordinates = [coordinates[1], coordinates[0]];
|
42
46
|
}
|
43
|
-
|
44
|
-
|
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
|
+
}
|
71
|
+
}
|
45
72
|
}
|
73
|
+
return response;
|
46
74
|
}
|
47
75
|
};
|
48
76
|
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;AAC5C,
|
1
|
+
{"version":3,"file":"ms-geojson.service.js","sourceRoot":"","sources":["../../src/ms-geojson/ms-geojson.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,yDAA8D;AAC9D,qDAA2C;AAC3C,mCAAmC;AACnC,yDAAiD;AAG1C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAQzB,KAAK,CAAC,YAAY,CAAC,WAAe;;QAChC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;YAC9B,IAAG,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,WAAW,KAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAC;gBAC3E,IAAI,sBAAsB,GAAG,EAAE,CAAA;gBAC/B,KAAI,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAC;oBACxC,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA,EAAE;wBACxB,OAAO,EAAC,UAAU,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAA;oBACjC,CAAC,CAAC,CAAA;oBACF,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;iBACrC;gBACD,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,sBAAsB,CAAA;aACnD;YACD,MAAM,GAAG,GAAG,IAAA,gCAAY,EAAC,2BAAU,EAAE,IAAI,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAQ,EAAC,GAAG,CAAC,CAAC;YACnC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBACrB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;aACrD;SACF;IACH,CAAC;IAUD,KAAK,CAAC,+BAA+B,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AAY,EAAE,cAAc,CAAC,CAAC;gBAC/E,IAAG,aAAa,EAAC;oBACf,QAAQ,GAAG;wBACT,KAAK,EAAC,CAAC;wBACP,aAAa;qBACd,CAAA;oBACD,MAAK;iBACN;aACF;SAEJ;QACD,OAAO,QAAQ,CAAA;IACnB,CAAC;CAEJ,CAAA;AA5EY,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;GACA,gBAAgB,CA4E5B;AA5EY,4CAAgB"}
|
package/dist/ms-pdf/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
export type PaperFormat = 'Legal' | 'Folio' | 'Letter' | 'A3' | 'A4' | 'A5' | 'Tabloid';
|
1
2
|
export type MsPdfDataHeader = {
|
2
3
|
title1?: string;
|
3
4
|
title2?: string;
|
@@ -5,6 +6,7 @@ export type MsPdfDataHeader = {
|
|
5
6
|
urlQr?: string;
|
6
7
|
valueQrCode?: string;
|
7
8
|
hide?: boolean;
|
9
|
+
content?: string;
|
8
10
|
};
|
9
11
|
export type MsPdfDataFooter = {
|
10
12
|
tipoDocumento?: string;
|
@@ -12,6 +14,7 @@ export type MsPdfDataFooter = {
|
|
12
14
|
fechaHora?: string;
|
13
15
|
aprobadoFirmadoTexto?: string;
|
14
16
|
hide?: boolean;
|
17
|
+
content?: string;
|
15
18
|
};
|
16
19
|
type DataToRender = {
|
17
20
|
headerData?: MsPdfDataHeader;
|
@@ -19,7 +22,7 @@ type DataToRender = {
|
|
19
22
|
content: string;
|
20
23
|
};
|
21
24
|
export type MsPdfPageConfig = {
|
22
|
-
format?: string;
|
25
|
+
format?: string | PaperFormat;
|
23
26
|
orientation?: string;
|
24
27
|
width?: string;
|
25
28
|
height?: string;
|
@@ -4,29 +4,3 @@ export interface RequestData {
|
|
4
4
|
method: Method;
|
5
5
|
data?: any;
|
6
6
|
}
|
7
|
-
export interface MsFileWriteFile {
|
8
|
-
appName: string;
|
9
|
-
fileName: string;
|
10
|
-
base64: string;
|
11
|
-
path: string;
|
12
|
-
nas: string;
|
13
|
-
withDateSubFolder?: boolean;
|
14
|
-
}
|
15
|
-
export type MsFileReadFile = {
|
16
|
-
id?: string;
|
17
|
-
pathName?: string;
|
18
|
-
};
|
19
|
-
export type MsFileRelocateFile = {
|
20
|
-
id?: string;
|
21
|
-
pathName?: string;
|
22
|
-
newPathName: string;
|
23
|
-
replaceIfExists: boolean;
|
24
|
-
};
|
25
|
-
export type MsFileVerifyExistFile = {
|
26
|
-
pathName: string;
|
27
|
-
};
|
28
|
-
export type MsFileReplaceFile = {
|
29
|
-
id?: string;
|
30
|
-
pathName?: string;
|
31
|
-
base64: string;
|
32
|
-
};
|
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.40",
|
4
4
|
"author": "UTIC",
|
5
5
|
"contact": {
|
6
6
|
"name": "Unidad de Tecnologías de la Información y Comunicación - Ministerio Público",
|
@@ -10,6 +10,7 @@
|
|
10
10
|
"files": [
|
11
11
|
"dist/ms-seguridad/*",
|
12
12
|
"dist/ms-redis/*",
|
13
|
+
"dist/ms-files/*",
|
13
14
|
"dist/ms-personas/*",
|
14
15
|
"dist/ms-pdf/*",
|
15
16
|
"dist/ms-skylogs/*",
|