fiscalia_bo-nest-helpers 0.0.28 → 0.0.30
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/http-service/http-service.pipes.js +1 -1
- package/dist/http-service/http-service.pipes.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ms-geojson/ms-geojson.module.d.ts +6 -2
- package/dist/ms-geojson/ms-geojson.module.js +6 -4
- package/dist/ms-geojson/ms-geojson.module.js.map +1 -1
- package/dist/ms-geojson/ms-geojson.service.d.ts +2 -2
- package/dist/ms-geojson/ms-geojson.service.js +14 -7
- package/dist/ms-geojson/ms-geojson.service.js.map +1 -1
- package/package.json +1 -1
@@ -71,7 +71,7 @@ const axiosResponseStatusMessages = {
|
|
71
71
|
exports.TransformHttpServiceResponse = (0, rxjs_1.map)((resp) => {
|
72
72
|
let response = {
|
73
73
|
error: true,
|
74
|
-
message: 'Error en el
|
74
|
+
message: 'Error en el servicio ' + resp.request.url,
|
75
75
|
response: {},
|
76
76
|
status: 500,
|
77
77
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"http-service.pipes.js","sourceRoot":"","sources":["../../src/http-service/http-service.pipes.ts"],"names":[],"mappings":";;;AACA,+BAA4D;AAG5D,MAAM,2BAA2B,GAAG;IAClC,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,wBAAwB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Ac;IACnB,GAAG,EAAE,gCAAgC;CACtC,CAAC;AAGW,QAAA,4BAA4B,GAAG,IAAA,UAAG,EAC7C,CAAC,IAA6B,EAAoB,EAAE;IAClD,IAAI,QAAQ,GAAqB;QAC/B,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"http-service.pipes.js","sourceRoot":"","sources":["../../src/http-service/http-service.pipes.ts"],"names":[],"mappings":";;;AACA,+BAA4D;AAG5D,MAAM,2BAA2B,GAAG;IAClC,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,wBAAwB;IAC7B,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,wBAAwB;IAC7B,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,sBAAsB;IAC3B,G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10,4 +10,5 @@ export * from './ms-seguridad/ms-seguridad.decorator';
|
|
10
10
|
export { PermissionsGuard } from './ms-seguridad/permision.guard';
|
11
11
|
export * from './ms-seguridad/token-auth.guard';
|
12
12
|
export * from './types';
|
13
|
+
export * from './helpers/request.helper';
|
13
14
|
export * as MsPersonas from './ms-personas';
|
package/dist/index.js
CHANGED
@@ -28,5 +28,6 @@ var permision_guard_1 = require("./ms-seguridad/permision.guard");
|
|
28
28
|
Object.defineProperty(exports, "PermissionsGuard", { enumerable: true, get: function () { return permision_guard_1.PermissionsGuard; } });
|
29
29
|
__exportStar(require("./ms-seguridad/token-auth.guard"), exports);
|
30
30
|
__exportStar(require("./types"), exports);
|
31
|
+
__exportStar(require("./helpers/request.helper"), exports);
|
31
32
|
exports.MsPersonas = require("./ms-personas");
|
32
33
|
//# sourceMappingURL=index.js.map
|
@@ -1,5 +1,9 @@
|
|
1
1
|
import { DynamicModule } from '@nestjs/common';
|
2
|
+
interface msModuleGeoJson {
|
3
|
+
global?: boolean;
|
4
|
+
}
|
2
5
|
export declare class MsGeoJsonModule {
|
3
|
-
static register(): DynamicModule;
|
4
|
-
static registerAsync(): Promise<DynamicModule>;
|
6
|
+
static register(options: msModuleGeoJson): DynamicModule;
|
7
|
+
static registerAsync(options: msModuleGeoJson): Promise<DynamicModule>;
|
5
8
|
}
|
9
|
+
export {};
|
@@ -11,20 +11,22 @@ exports.MsGeoJsonModule = void 0;
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
12
12
|
const ms_geojson_service_1 = require("./ms-geojson.service");
|
13
13
|
let MsGeoJsonModule = MsGeoJsonModule_1 = class MsGeoJsonModule {
|
14
|
-
static register() {
|
14
|
+
static register(options) {
|
15
15
|
return {
|
16
|
+
global: options.global,
|
16
17
|
module: MsGeoJsonModule_1,
|
17
18
|
imports: [],
|
18
19
|
providers: [ms_geojson_service_1.MsGeoJsonService],
|
19
20
|
exports: [ms_geojson_service_1.MsGeoJsonService],
|
20
21
|
};
|
21
22
|
}
|
22
|
-
static async registerAsync() {
|
23
|
+
static async registerAsync(options) {
|
23
24
|
return {
|
25
|
+
global: options.global,
|
24
26
|
module: MsGeoJsonModule_1,
|
25
27
|
imports: [],
|
26
|
-
providers: [
|
27
|
-
exports: [
|
28
|
+
providers: [ms_geojson_service_1.MsGeoJsonService],
|
29
|
+
exports: [ms_geojson_service_1.MsGeoJsonService],
|
28
30
|
};
|
29
31
|
}
|
30
32
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ms-geojson.module.js","sourceRoot":"","sources":["../../src/ms-geojson/ms-geojson.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,6DAAwD;
|
1
|
+
{"version":3,"file":"ms-geojson.module.js","sourceRoot":"","sources":["../../src/ms-geojson/ms-geojson.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,6DAAwD;AAOjD,IAAM,eAAe,uBAArB,MAAM,eAAe;IAI1B,MAAM,CAAC,QAAQ,CAAC,OAAwB;QACtC,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,iBAAe;YACvB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,CAAC,qCAAgB,CAAC;YAC7B,OAAO,EAAE,CAAC,qCAAgB,CAAC;SAC5B,CAAC;IACJ,CAAC;IAKD,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,OAAwB;QACjD,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,iBAAe;YACvB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,CAAC,qCAAgB,CAAC;YAC7B,OAAO,EAAE,CAAC,qCAAgB,CAAC;SAC5B,CAAC;IACJ,CAAC;CACF,CAAA;AA1BY,eAAe;IAD3B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,eAAe,CA0B3B;AA1BY,0CAAe"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Coordinates, ValidateCoordinatesPolygonDTO } from './dto/ms-geojson.dto';
|
2
2
|
export declare class MsGeoJsonService {
|
3
|
-
|
4
|
-
|
3
|
+
validateJson(input: any): ValidateCoordinatesPolygonDTO;
|
4
|
+
validateArrayCoordinatesGeoJson(coordinatesPolygon: any, { coordinates }: Coordinates, reverseCoordinates: Boolean): Promise<any>;
|
5
5
|
}
|
@@ -12,23 +12,30 @@ 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
14
|
let MsGeoJsonService = class MsGeoJsonService {
|
15
|
-
|
15
|
+
validateJson(input) {
|
16
|
+
var _a;
|
16
17
|
const dto = new ms_geojson_dto_1.ValidateCoordinatesPolygonDTO();
|
17
|
-
if (Array.isArray(input))
|
18
|
-
|
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) => ({ coordinates: coords }));
|
21
|
+
}
|
19
22
|
const errors = (0, class_validator_1.validateSync)(dto);
|
20
23
|
if (errors.length > 0) {
|
21
24
|
throw new Error('La entrada de datos es inválida.');
|
22
25
|
}
|
23
26
|
return dto;
|
24
27
|
}
|
25
|
-
|
28
|
+
;
|
29
|
+
async validateArrayCoordinatesGeoJson(coordinatesPolygon, { coordinates }, reverseCoordinates) {
|
26
30
|
try {
|
27
|
-
this.
|
28
|
-
|
31
|
+
this.validateJson(coordinatesPolygon);
|
32
|
+
let dataCoordinates = coordinatesPolygon.geometry.coordinates[0];
|
33
|
+
if (reverseCoordinates) {
|
34
|
+
dataCoordinates = dataCoordinates.map(e => [e[1], e[0]]);
|
35
|
+
}
|
29
36
|
const pointCoordinates = coordinates;
|
30
37
|
const pointGeoJSON = turf.point(pointCoordinates);
|
31
|
-
const polygonGeoJSON = turf.polygon([
|
38
|
+
const polygonGeoJSON = turf.polygon([dataCoordinates]);
|
32
39
|
const isPointInside = turf.booleanPointInPolygon(pointGeoJSON, polygonGeoJSON);
|
33
40
|
return { isValid: isPointInside };
|
34
41
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ms-geojson.service.js","sourceRoot":"","sources":["../../src/ms-geojson/ms-geojson.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,yDAAkF;AAClF,qDAA+C;AAC/C,mCAAmC;AAG5B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;
|
1
|
+
{"version":3,"file":"ms-geojson.service.js","sourceRoot":"","sources":["../../src/ms-geojson/ms-geojson.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,yDAAkF;AAClF,qDAA+C;AAC/C,mCAAmC;AAG5B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAMzB,YAAY,CAAC,KAAU;;QACnB,MAAM,GAAG,GAAG,IAAI,8CAA6B,EAAE,CAAC;QAChD,IAAG,KAAK,KAAI,MAAA,KAAK,CAAC,QAAQ,0CAAE,WAAW,CAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAC;YACpF,MAAM,gBAAgB,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;YACtD,GAAG,CAAC,kBAAkB,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,GAAG,CAAC,CAAC,MAAwB,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;SAC3G;QACD,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,MAAM,IAAI,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