@golemio/pid 3.2.2-dev.1568614793 → 3.2.2-dev.1568978088
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/output-gateway/public/routers/v2/V2PublicVehiclePositionsRouter.js +2 -5
- package/dist/output-gateway/public/routers/v2/V2PublicVehiclePositionsRouter.js.map +1 -1
- package/dist/output-gateway/public/routers/v2/helpers/CustomBBoxValidator.d.ts +12 -0
- package/dist/output-gateway/public/routers/v2/helpers/CustomBBoxValidator.js +31 -0
- package/dist/output-gateway/public/routers/v2/helpers/CustomBBoxValidator.js.map +1 -0
- package/docs/openapi-output.yaml +2 -1
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
|
10
10
|
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
11
11
|
const express_1 = require("@golemio/core/dist/shared/express");
|
|
12
12
|
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
13
|
+
const CustomBBoxValidator_1 = require("./helpers/CustomBBoxValidator");
|
|
13
14
|
const CustomScopeValidator_1 = require("./helpers/CustomScopeValidator");
|
|
14
15
|
const CustomTypeValidator_1 = require("./helpers/CustomTypeValidator");
|
|
15
16
|
class V2PublicVehiclePositionsRouter extends AbstractRouter_1.AbstractRouter {
|
|
@@ -25,11 +26,7 @@ class V2PublicVehiclePositionsRouter extends AbstractRouter_1.AbstractRouter {
|
|
|
25
26
|
}
|
|
26
27
|
initRoutes() {
|
|
27
28
|
this.router.get("/", [
|
|
28
|
-
(0, express_validator_1.query)("boundingBox")
|
|
29
|
-
.optional()
|
|
30
|
-
.matches(/^\d+\.?\d*(,\d+\.?\d*){3}$/) // 50.123,14.243,50.017,14.573
|
|
31
|
-
.not()
|
|
32
|
-
.isArray(),
|
|
29
|
+
(0, express_validator_1.query)("boundingBox").optional().custom(CustomBBoxValidator_1.CustomBBoxValidator.validate),
|
|
33
30
|
(0, express_validator_1.query)("routeShortName").optional().not().isEmpty({ ignore_whitespace: true }),
|
|
34
31
|
(0, express_validator_1.query)("routeType").optional().custom(CustomTypeValidator_1.CustomTypeValidator.validate),
|
|
35
32
|
], Validation_1.checkErrors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V2PublicVehiclePositionsRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/routers/v2/V2PublicVehiclePositionsRouter.ts"],"names":[],"mappings":";;;AAAA,gHAAkH;AAClH,qCAAsD;AACtD,2DAA6D;AAE7D,yDAAoD;AACpD,sFAAmF;AAGnF,6EAA2E;AAC3E,+DAAuE;AACvE,+DAA2D;AAC3D,mFAA2E;AAC3E,yEAAsE;AACtE,uEAAoE;AAEpE,MAAa,8BAA+B,SAAQ,+BAAc;IAO9D;QACI,KAAK,CAAC,wBAAY,CAAC,EAAE,EAAE,yBAAyB,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,qBAAqB,GAAG,sBAAiB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACpH,IAAI,CAAC,8BAA8B,GAAG,sBAAiB,CAAC,OAAO,CAC3D,oBAAc,CAAC,8BAA8B,CAChD,CAAC;QACF,IAAI,CAAC,0BAA0B,GAAG,IAAI,uEAAkC,EAAE,CAAC;QAC3E,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,sBAAiB,CAAC,OAAO,CAAe,6BAAa,CAAC,YAAY,CAAC,CAAC;QAC3F,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC;IAES,UAAU;QAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,GAAG,EACH;YACI,IAAA,yBAAK,EAAC,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"V2PublicVehiclePositionsRouter.js","sourceRoot":"","sources":["../../../../../src/output-g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BoxValidator {
|
|
3
|
+
/**
|
|
4
|
+
* Bounding box format: topLat,topLon,bottomLat,bottomLon
|
|
5
|
+
* 4 positive or negative floating point numbers separated by commas
|
|
6
|
+
* @example 50.073619,14.414826,50.092867,14.438086
|
|
7
|
+
*/
|
|
8
|
+
private static BOUNDING_BOX_REGEX;
|
|
9
|
+
static validate: CustomValidator;
|
|
10
|
+
private static isLatitudeValid;
|
|
11
|
+
private static isLongitudeValid;
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CustomBBoxValidator = void 0;
|
|
5
|
+
class CustomBBoxValidator {
|
|
6
|
+
static isLatitudeValid(latitude) {
|
|
7
|
+
return latitude >= -90 && latitude <= 90;
|
|
8
|
+
}
|
|
9
|
+
static isLongitudeValid(longitude) {
|
|
10
|
+
return longitude >= -180 && longitude <= 180;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CustomBBoxValidator = CustomBBoxValidator;
|
|
14
|
+
_a = CustomBBoxValidator;
|
|
15
|
+
/**
|
|
16
|
+
* Bounding box format: topLat,topLon,bottomLat,bottomLon
|
|
17
|
+
* 4 positive or negative floating point numbers separated by commas
|
|
18
|
+
* @example 50.073619,14.414826,50.092867,14.438086
|
|
19
|
+
*/
|
|
20
|
+
CustomBBoxValidator.BOUNDING_BOX_REGEX = /^(?:-?\d+?(?:\.\d+?)?,){3}-?\d+?(?:\.\d+?)?$/;
|
|
21
|
+
CustomBBoxValidator.validate = (value, _) => {
|
|
22
|
+
if (typeof value !== "string" || value.trim().length === 0 || value.length > 80 || !_a.BOUNDING_BOX_REGEX.test(value)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const [topLat, topLon, bottomLat, bottomLon] = value.split(",").map((coordinate) => Number.parseFloat(coordinate));
|
|
26
|
+
return (_a.isLatitudeValid(topLat) &&
|
|
27
|
+
_a.isLatitudeValid(bottomLat) &&
|
|
28
|
+
_a.isLongitudeValid(topLon) &&
|
|
29
|
+
_a.isLongitudeValid(bottomLon));
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=CustomBBoxValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomBBoxValidator.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/public/routers/v2/helpers/CustomBBoxValidator.ts"],"names":[],"mappings":";;;;AAEA,MAAa,mBAAmB;IAuBpB,MAAM,CAAC,eAAe,CAAC,QAAgB;QAC3C,OAAO,QAAQ,IAAI,CAAC,EAAE,IAAI,QAAQ,IAAI,EAAE,CAAC;IAC7C,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,SAAiB;QAC7C,OAAO,SAAS,IAAI,CAAC,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;IACjD,CAAC;;AA7BL,kDA8BC;;AA7BG;;;;GAIG;AACY,sCAAkB,GAAG,8CAA8C,AAAjD,CAAkD;AAErE,4BAAQ,GAAoB,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,IAAI,CAAC,EAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACrH,OAAO,KAAK,CAAC;KAChB;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAEnH,OAAO,CACH,EAAI,CAAC,eAAe,CAAC,MAAM,CAAC;QAC5B,EAAI,CAAC,eAAe,CAAC,SAAS,CAAC;QAC/B,EAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAC7B,EAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CACnC,CAAC;AACN,CAAC,AAbqB,CAapB"}
|
package/docs/openapi-output.yaml
CHANGED
|
@@ -1403,7 +1403,8 @@ paths:
|
|
|
1403
1403
|
schema:
|
|
1404
1404
|
type: string
|
|
1405
1405
|
example: '50.123,14.243,50.017,14.573'
|
|
1406
|
-
description:
|
|
1406
|
+
description: |
|
|
1407
|
+
Filter by bounding box in format "topLeft.lat,topLeft.lon,bottomRight.lat,bottomRight.lon". Latitude must be in range -90 to 90, longitude in range -180 to 180. Polygons that fit only partialy to selected bounding box are included
|
|
1407
1408
|
- name: routeShortName
|
|
1408
1409
|
in: query
|
|
1409
1410
|
schema:
|