@golemio/pid 3.2.3-dev.1575424535 → 3.2.3-dev.1589820139

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.
Files changed (23) hide show
  1. package/dist/input-gateway/jis/JisInfotextsController.d.ts +9 -0
  2. package/dist/input-gateway/jis/JisInfotextsController.js +37 -0
  3. package/dist/input-gateway/jis/JisInfotextsController.js.map +1 -0
  4. package/dist/input-gateway/jis/JisInfotextsRouter.d.ts +9 -0
  5. package/dist/input-gateway/jis/JisInfotextsRouter.js +36 -0
  6. package/dist/input-gateway/jis/JisInfotextsRouter.js.map +1 -0
  7. package/dist/integration-engine/jis/ioc/Di.js +2 -0
  8. package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
  9. package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +1 -0
  10. package/dist/integration-engine/jis/ioc/JISContainerToken.js +1 -0
  11. package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
  12. package/dist/integration-engine/jis/workers/JISWorker.js +1 -0
  13. package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
  14. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.d.ts +10 -0
  15. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js +62 -0
  16. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js.map +1 -0
  17. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +8 -12
  18. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +13 -48
  19. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
  20. package/docs/asyncapi.yaml +96 -2
  21. package/docs/implementation_documentation.md +9 -20
  22. package/docs/openapi-input.yaml +192 -1
  23. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { BaseController } from "@golemio/core/dist/input-gateway/controllers";
2
+ import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
3
+ export declare class JisInfotextsController extends BaseController {
4
+ name: string;
5
+ protected validator: JSONSchemaValidator;
6
+ protected queuePrefix: string;
7
+ constructor();
8
+ processData: (inputData: any) => Promise<void>;
9
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.JisInfotextsController = void 0;
13
+ const JISInfotextsJsonSchema_1 = require("../../schema-definitions/jis/datasources/JISInfotextsJsonSchema");
14
+ const controllers_1 = require("@golemio/core/dist/input-gateway/controllers");
15
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
16
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
17
+ class JisInfotextsController extends controllers_1.BaseController {
18
+ constructor() {
19
+ super("jis", new golemio_validator_1.JSONSchemaValidator("jisInfotextsDataValidation", JISInfotextsJsonSchema_1.jisInfotextsJsonSchema));
20
+ this.processData = (inputData) => __awaiter(this, void 0, void 0, function* () {
21
+ try {
22
+ yield this.validator.Validate(inputData);
23
+ yield this.sendMessageToExchange("input." + this.queuePrefix + ".refreshJISInfotexts", JSON.stringify(inputData));
24
+ }
25
+ catch (err) {
26
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
27
+ throw err;
28
+ }
29
+ else {
30
+ throw new golemio_errors_1.GeneralError("Error while validating input data.", this.constructor.name, err, 422);
31
+ }
32
+ }
33
+ });
34
+ }
35
+ }
36
+ exports.JisInfotextsController = JisInfotextsController;
37
+ //# sourceMappingURL=JisInfotextsController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JisInfotextsController.js","sourceRoot":"","sources":["../../../src/input-gateway/jis/JisInfotextsController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4GAAqF;AACrF,8EAA8E;AAC9E,6EAA8F;AAC9F,mFAAkF;AAElF,MAAa,sBAAuB,SAAQ,4BAAc;IAKtD;QACI,KAAK,CAAC,KAAK,EAAE,IAAI,uCAAmB,CAAC,4BAA4B,EAAE,+CAAsB,CAAC,CAAC,CAAC;QAGzF,gBAAW,GAAG,CAAO,SAAc,EAAiB,EAAE;YACzD,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;gBACzC,MAAM,IAAI,CAAC,qBAAqB,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;aACrH;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,qCAAoB,EAAE;oBACrC,MAAM,GAAG,CAAC;iBACb;qBAAM;oBACH,MAAM,IAAI,6BAAY,CAAC,oCAAoC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;iBACjG;aACJ;QACL,CAAC,CAAA,CAAC;IAbF,CAAC;CAcJ;AArBD,wDAqBC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="express" />
2
+ import { Router } from "@golemio/core/dist/shared/express";
3
+ export declare class JisInfotextsRouter {
4
+ router: Router;
5
+ private controller;
6
+ constructor();
7
+ private initRoutes;
8
+ private post;
9
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.JisInfotextsRouter = void 0;
13
+ const CheckContentTypeMiddleware_1 = require("@golemio/core/dist/input-gateway/helpers/CheckContentTypeMiddleware");
14
+ const express_1 = require("@golemio/core/dist/shared/express");
15
+ const JisInfotextsController_1 = require("./JisInfotextsController");
16
+ class JisInfotextsRouter {
17
+ constructor() {
18
+ this.post = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ yield this.controller.processData(req.body);
21
+ res.sendStatus(204);
22
+ }
23
+ catch (err) {
24
+ next(err);
25
+ }
26
+ });
27
+ this.router = (0, express_1.Router)();
28
+ this.controller = new JisInfotextsController_1.JisInfotextsController();
29
+ this.initRoutes();
30
+ }
31
+ initRoutes() {
32
+ this.router.post("/infotexts", (0, CheckContentTypeMiddleware_1.checkContentTypeMiddleware)(["application/json"]), this.post);
33
+ }
34
+ }
35
+ exports.JisInfotextsRouter = JisInfotextsRouter;
36
+ //# sourceMappingURL=JisInfotextsRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JisInfotextsRouter.js","sourceRoot":"","sources":["../../../src/input-gateway/jis/JisInfotextsRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oHAAiH;AACjH,+DAA4F;AAC5F,qEAAkE;AAElE,MAAa,kBAAkB;IAI3B;QAUQ,SAAI,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAiB,EAAE;YACpF,IAAI;gBACA,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC5C,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;aACvB;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;QACL,CAAC,CAAA,CAAC;QAhBE,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,+CAAsB,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAEO,UAAU;QACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,IAAA,uDAA0B,EAAC,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAChG,CAAC;CAUJ;AAtBD,gDAsBC"}
@@ -10,6 +10,7 @@ const JISInfotextsDataService_1 = require("../services/JISInfotextsDataService")
10
10
  const JISInfotextsTransformation_1 = require("../transformations/JISInfotextsTransformation");
11
11
  const RefreshJISInfotextsTask_1 = require("../workers/tasks/RefreshJISInfotextsTask");
12
12
  const JISContainerToken_1 = require("./JISContainerToken");
13
+ const FetchJISInfotextsTask_1 = require("../workers/tasks/FetchJISInfotextsTask");
13
14
  //#region Initialization
14
15
  const JISContainer = Di_1.PidContainer.createChildContainer();
15
16
  exports.JISContainer = JISContainer;
@@ -27,6 +28,7 @@ JISContainer.register(JISContainerToken_1.JISContainerToken.JISInfotextsDataServ
27
28
  //#endregion
28
29
  //#region Tasks
29
30
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask, RefreshJISInfotextsTask_1.RefreshJISInfotextsTask);
31
+ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.FetchJISInfotextsTask, FetchJISInfotextsTask_1.FetchJISInfotextsTask);
30
32
  //#endregion
31
33
  //#region Transformations
32
34
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation, JISInfotextsTransformation_1.JISInfotextsTransformation);
@@ -1 +1 @@
1
- {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAE1C,gGAA6F;AAC7F,mFAAgF;AAChF,+GAA4G;AAC5G,iFAA8E;AAC9E,iFAA8E;AAC9E,8FAA2F;AAC3F,sFAAmF;AACnF,2DAAwD;AAExD,wBAAwB;AACxB,MAAM,YAAY,GAAwB,iBAAY,CAAC,oBAAoB,EAAE,CAAC;AAyBrE,oCAAY;AAxBrB,YAAY;AAEZ,sBAAsB;AACtB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AAC/G,YAAY;AAEZ,sBAAsB;AACtB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,sBAAsB,EAAE,+CAAsB,CAAC,CAAC;AACjG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,oCAAoC,EAAE,2EAAoC,CAAC,CAAC;AAC7H,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC/F,YAAY;AAEZ,kBAAkB;AAClB,YAAY,CAAC,QAAQ,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AAC1F,YAAY;AAEZ,eAAe;AACf,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACnG,YAAY;AAEZ,yBAAyB;AACzB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC"}
1
+ {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAE1C,gGAA6F;AAC7F,mFAAgF;AAChF,+GAA4G;AAC5G,iFAA8E;AAC9E,iFAA8E;AAC9E,8FAA2F;AAC3F,sFAAmF;AACnF,2DAAwD;AACxD,kFAA+E;AAE/E,wBAAwB;AACxB,MAAM,YAAY,GAAwB,iBAAY,CAAC,oBAAoB,EAAE,CAAC;AA0BrE,oCAAY;AAzBrB,YAAY;AAEZ,sBAAsB;AACtB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AAC/G,YAAY;AAEZ,sBAAsB;AACtB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,sBAAsB,EAAE,+CAAsB,CAAC,CAAC;AACjG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,oCAAoC,EAAE,2EAAoC,CAAC,CAAC;AAC7H,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC/F,YAAY;AAEZ,kBAAkB;AAClB,YAAY,CAAC,QAAQ,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AAC1F,YAAY;AAEZ,eAAe;AACf,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACnG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC/F,YAAY;AAEZ,yBAAyB;AACzB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC"}
@@ -6,5 +6,6 @@ declare const JISContainerToken: {
6
6
  JISInfotextsDataService: symbol;
7
7
  JISInfotextsTransformation: symbol;
8
8
  RefreshJISInfotextsTask: symbol;
9
+ FetchJISInfotextsTask: symbol;
9
10
  };
10
11
  export { JISContainerToken };
@@ -14,6 +14,7 @@ const JISContainerToken = {
14
14
  JISInfotextsTransformation: Symbol(),
15
15
  /* Tasks */
16
16
  RefreshJISInfotextsTask: Symbol(),
17
+ FetchJISInfotextsTask: Symbol(),
17
18
  };
18
19
  exports.JISContainerToken = JISContainerToken;
19
20
  //# sourceMappingURL=JISContainerToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,6BAA6B,EAAE,MAAM,EAAE;IACvC,kBAAkB;IAClB,sBAAsB,EAAE,MAAM,EAAE;IAChC,oCAAoC,EAAE,MAAM,EAAE;IAC9C,qBAAqB,EAAE,MAAM,EAAE;IAC/B,cAAc;IACd,uBAAuB,EAAE,MAAM,EAAE;IACjC,qBAAqB;IACrB,0BAA0B,EAAE,MAAM,EAAE;IACpC,WAAW;IACX,uBAAuB,EAAE,MAAM,EAAE;CACpC,CAAC;AAEO,8CAAiB"}
1
+ {"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,6BAA6B,EAAE,MAAM,EAAE;IACvC,kBAAkB;IAClB,sBAAsB,EAAE,MAAM,EAAE;IAChC,oCAAoC,EAAE,MAAM,EAAE;IAC9C,qBAAqB,EAAE,MAAM,EAAE;IAC/B,cAAc;IACd,uBAAuB,EAAE,MAAM,EAAE;IACjC,qBAAqB;IACrB,0BAA0B,EAAE,MAAM,EAAE;IACpC,WAAW;IACX,uBAAuB,EAAE,MAAM,EAAE;IACjC,qBAAqB,EAAE,MAAM,EAAE;CAClC,CAAC;AAEO,8CAAiB"}
@@ -15,6 +15,7 @@ class JISWorker extends workers_1.AbstractWorker {
15
15
  };
16
16
  // Register tasks
17
17
  this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask));
18
+ this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.FetchJISInfotextsTask));
18
19
  }
19
20
  }
20
21
  exports.JISWorker = JISWorker;
@@ -1 +1 @@
1
- {"version":3,"file":"JISWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/JISWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAE/E,kCAAyC;AACzC,gEAA6D;AAC7D,2CAA8C;AAG9C,MAAa,SAAU,SAAQ,wBAAc;IAGzC;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,2BAAe,CAAC,WAAW,EAAE,CAAC;QASxC,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QAPE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAA0B,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAChH,CAAC;CAMJ;AAdD,8BAcC"}
1
+ {"version":3,"file":"JISWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/JISWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAE/E,kCAAyC;AACzC,gEAA6D;AAC7D,2CAA8C;AAI9C,MAAa,SAAU,SAAQ,wBAAc;IAGzC;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,2BAAe,CAAC,WAAW,EAAE,CAAC;QAUxC,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QARE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAA0B,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC5G,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAAwB,qCAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC5G,CAAC;CAMJ;AAfD,8BAeC"}
@@ -0,0 +1,10 @@
1
+ import { JISInfotextsDataSourceFactory } from "../../datasources/JISInfotextsDataSourceFactory";
2
+ import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
3
+ export declare class FetchJISInfotextsTask extends AbstractEmptyTask {
4
+ private dataSourceFactory;
5
+ readonly queueName = "fetchJISInfotexts";
6
+ readonly queueTtl: number;
7
+ constructor(dataSourceFactory: JISInfotextsDataSourceFactory);
8
+ /** Fetch JIS Infotexts data source */
9
+ protected execute(): Promise<void>;
10
+ }
@@ -0,0 +1,62 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.FetchJISInfotextsTask = void 0;
25
+ const JISInfotextsDataSourceFactory_1 = require("../../datasources/JISInfotextsDataSourceFactory");
26
+ const JISContainerToken_1 = require("../../ioc/JISContainerToken");
27
+ const integration_engine_1 = require("@golemio/core/dist/integration-engine");
28
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
29
+ const constants_1 = require("../constants");
30
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
31
+ let FetchJISInfotextsTask = exports.FetchJISInfotextsTask = class FetchJISInfotextsTask extends integration_engine_1.AbstractEmptyTask {
32
+ constructor(dataSourceFactory) {
33
+ super(constants_1.JIS_WORKER_NAME.toLowerCase());
34
+ this.dataSourceFactory = dataSourceFactory;
35
+ this.queueName = "fetchJISInfotexts";
36
+ this.queueTtl = 20 * 1000; // 20 seconds
37
+ }
38
+ /** Fetch JIS Infotexts data source */
39
+ execute() {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ try {
42
+ const dataSource = this.dataSourceFactory.getDataSource();
43
+ const data = yield dataSource.getAll();
44
+ yield integration_engine_1.QueueManager.sendMessageToExchange("input." + this.queuePrefix + ".refreshJISInfotexts", JSON.stringify(data), {});
45
+ }
46
+ catch (err) {
47
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
48
+ throw err;
49
+ }
50
+ else {
51
+ throw new golemio_errors_1.GeneralError("Error while fetching new JIS infotexts", this.constructor.name, err);
52
+ }
53
+ }
54
+ });
55
+ }
56
+ };
57
+ exports.FetchJISInfotextsTask = FetchJISInfotextsTask = __decorate([
58
+ (0, tsyringe_1.injectable)(),
59
+ __param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory)),
60
+ __metadata("design:paramtypes", [JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory])
61
+ ], FetchJISInfotextsTask);
62
+ //# sourceMappingURL=FetchJISInfotextsTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetchJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mGAAkG;AAClG,mEAAkE;AAClE,8EAAwF;AACxF,iEAAwE;AACxE,4CAA+C;AAC/C,6EAA8F;AAGvF,IAAM,qBAAqB,mCAA3B,MAAM,qBAAsB,SAAQ,sCAAiB;IAIxD,YAEI,iBAAwD;QAExD,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAF7B,sBAAiB,GAAjB,iBAAiB,CAA+B;QAL5C,cAAS,GAAG,mBAAmB,CAAC;QAChC,aAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;IAOnD,CAAC;IAED,sCAAsC;IACtB,OAAO;;YACnB,IAAI;gBACA,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;gBAC1D,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;gBAEvC,MAAM,iCAAY,CAAC,qBAAqB,CACpC,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,sBAAsB,EACpD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EACpB,EAAE,CACL,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,qCAAoB,EAAE;oBACrC,MAAM,GAAG,CAAC;iBACb;qBAAM;oBACH,MAAM,IAAI,6BAAY,CAAC,wCAAwC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;iBAChG;aACJ;QACL,CAAC;KAAA;CACJ,CAAA;gCA9BY,qBAAqB;IADjC,IAAA,qBAAU,GAAE;IAMJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,6BAA6B,CAAC,CAAA;qCAC7B,6DAA6B;GANnD,qBAAqB,CA8BjC"}
@@ -1,20 +1,16 @@
1
- import { JISInfotextsDataSourceFactory } from "../../datasources/JISInfotextsDataSourceFactory";
2
- import { JISMetadataRepository } from "../../repositories/JISMetadataRepository";
3
1
  import { JISInfotextsDataService } from "../../services/JISInfotextsDataService";
4
2
  import { JISInfotextsTransformation } from "../../transformations/JISInfotextsTransformation";
5
- import { ILogger } from "@golemio/core/dist/helpers";
6
- import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
7
- export declare class RefreshJISInfotextsTask extends AbstractEmptyTask {
8
- private dataSourceFactory;
3
+ import { AbstractTaskJsonSchema } from "@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema";
4
+ import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
5
+ import { IJISInfotext } from "../../../../schema-definitions/jis/datasources/interfaces";
6
+ export declare class RefreshJISInfotextsTask extends AbstractTaskJsonSchema<IJISInfotext[]> {
9
7
  private infotextsDataService;
10
8
  private infotextsTransformation;
11
- private metadataRepository;
12
- private logger;
9
+ readonly schema: JSONSchemaValidator;
13
10
  readonly queueName = "refreshJISInfotexts";
14
11
  readonly queueTtl: number;
15
- constructor(dataSourceFactory: JISInfotextsDataSourceFactory, infotextsDataService: JISInfotextsDataService, infotextsTransformation: JISInfotextsTransformation, metadataRepository: JISMetadataRepository, logger: ILogger);
16
- /** Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database */
17
- protected execute(): Promise<void>;
18
- private getResponseEtag;
12
+ constructor(infotextsDataService: JISInfotextsDataService, infotextsTransformation: JISInfotextsTransformation);
13
+ /** refresh JIS Infotexts data in database */
14
+ protected execute(data: IJISInfotext[]): Promise<void>;
19
15
  private getEntitiesFromTransformationResult;
20
16
  }
@@ -22,61 +22,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.RefreshJISInfotextsTask = void 0;
25
- const JISInfotextsDataSourceFactory_1 = require("../../datasources/JISInfotextsDataSourceFactory");
26
25
  const JISContainerToken_1 = require("../../ioc/JISContainerToken");
27
- const JISMetadataRepository_1 = require("../../repositories/JISMetadataRepository");
28
26
  const JISInfotextsDataService_1 = require("../../services/JISInfotextsDataService");
29
27
  const JISInfotextsTransformation_1 = require("../../transformations/JISInfotextsTransformation");
30
- const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
31
- const integration_engine_1 = require("@golemio/core/dist/integration-engine");
32
- const ResourceNotModified_1 = require("@golemio/core/dist/integration-engine/helpers/ResourceNotModified");
33
28
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
34
29
  const constants_1 = require("../constants");
35
- let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJISInfotextsTask extends integration_engine_1.AbstractEmptyTask {
36
- constructor(dataSourceFactory, infotextsDataService, infotextsTransformation, metadataRepository, logger) {
30
+ const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
31
+ const JISInfotextsJsonSchema_1 = require("../../../../schema-definitions/jis/datasources/JISInfotextsJsonSchema");
32
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
33
+ let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJISInfotextsTask extends AbstractTaskJsonSchema_1.AbstractTaskJsonSchema {
34
+ constructor(infotextsDataService, infotextsTransformation) {
37
35
  super(constants_1.JIS_WORKER_NAME.toLowerCase());
38
- this.dataSourceFactory = dataSourceFactory;
39
36
  this.infotextsDataService = infotextsDataService;
40
37
  this.infotextsTransformation = infotextsTransformation;
41
- this.metadataRepository = metadataRepository;
42
- this.logger = logger;
38
+ this.schema = new golemio_validator_1.JSONSchemaValidator("jisInfotextsDataValidation", JISInfotextsJsonSchema_1.jisInfotextsJsonSchema);
43
39
  this.queueName = "refreshJISInfotexts";
44
- this.queueTtl = 20 * 1000; // 20 seconds
40
+ this.queueTtl = 60 * 1000; // 1 minute
45
41
  }
46
- /** Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database */
47
- execute() {
42
+ /** refresh JIS Infotexts data in database */
43
+ execute(data) {
48
44
  return __awaiter(this, void 0, void 0, function* () {
49
- const lastEtag = yield this.metadataRepository.getLastInfotextsEtag();
50
- const dataSource = this.dataSourceFactory.getDataSource(lastEtag);
51
- const { data, metadata } = yield dataSource.getAllWithMetadata();
52
- if (data instanceof ResourceNotModified_1.ResourceNotModified) {
53
- this.logger.info(`${this.constructor.name}.execute: JIS infotexts data source hasn't been updated since last refresh in ` +
54
- `database (received 304 Not Modified for request with ETag: ${lastEtag}).`);
55
- return;
56
- }
57
45
  const transformedData = this.infotextsTransformation.transformArray(data);
58
46
  const { infotexts, infotextsRopidGTFSStops } = this.getEntitiesFromTransformationResult(transformedData);
59
47
  yield this.infotextsDataService.refreshData(infotexts, infotextsRopidGTFSStops);
60
- const responseEtag = this.getResponseEtag(metadata);
61
- if (typeof responseEtag === "string") {
62
- yield this.metadataRepository.setLastInfotextsEtag(responseEtag);
63
- }
64
- else {
65
- this.logger.warn(`${this.constructor.name}.execute: JIS infotexts data source response has no ETag.`);
66
- }
67
48
  });
68
49
  }
69
- getResponseEtag(metadata) {
70
- if (typeof metadata === "object" &&
71
- metadata !== null &&
72
- "headers" in metadata &&
73
- typeof metadata.headers === "object" &&
74
- metadata.headers !== null &&
75
- "etag" in metadata.headers &&
76
- typeof metadata.headers["etag"] === "string") {
77
- return metadata.headers["etag"];
78
- }
79
- }
80
50
  getEntitiesFromTransformationResult(transformedData) {
81
51
  const infotextEntities = [];
82
52
  const infotextsRopidGTFSStopsEntities = [];
@@ -95,14 +65,9 @@ let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJIS
95
65
  };
96
66
  exports.RefreshJISInfotextsTask = RefreshJISInfotextsTask = __decorate([
97
67
  (0, tsyringe_1.injectable)(),
98
- __param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory)),
99
- __param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataService)),
100
- __param(2, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation)),
101
- __param(3, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISMetadataRepository)),
102
- __param(4, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
103
- __metadata("design:paramtypes", [JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory,
104
- JISInfotextsDataService_1.JISInfotextsDataService,
105
- JISInfotextsTransformation_1.JISInfotextsTransformation,
106
- JISMetadataRepository_1.JISMetadataRepository, Object])
68
+ __param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataService)),
69
+ __param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation)),
70
+ __metadata("design:paramtypes", [JISInfotextsDataService_1.JISInfotextsDataService,
71
+ JISInfotextsTransformation_1.JISInfotextsTransformation])
107
72
  ], RefreshJISInfotextsTask);
108
73
  //# sourceMappingURL=RefreshJISInfotextsTask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAkE;AAClE,oFAAmF;AACnF,iGAAgG;AAEhG,iEAAwE;AACxE,4CAA+C;AAC/C,iHAA8G;AAC9G,kHAAqF;AACrF,mFAAkF;AAK3E,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ,+CAAsC;IAK/E,YAEI,oBAAqD,EAErD,uBAA2D;QAE3D,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAJ7B,yBAAoB,GAApB,oBAAoB,CAAyB;QAE7C,4BAAuB,GAAvB,uBAAuB,CAA4B;QAR/C,WAAM,GAAG,IAAI,uCAAmB,CAAC,4BAA4B,EAAE,+CAAsB,CAAC,CAAC;QACvF,cAAS,GAAG,qBAAqB,CAAC;QAClC,aAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;IASjD,CAAC;IAED,6CAA6C;IAC7B,OAAO,CAAC,IAAoB;;YACxC,MAAM,eAAe,GAAG,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC1E,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC,mCAAmC,CAAC,eAAe,CAAC,CAAC;YACzG,MAAM,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QACpF,CAAC;KAAA;IAEO,mCAAmC,CAAC,eAAyE;QACjH,MAAM,gBAAgB,GAAwB,EAAE,CAAC;QACjD,MAAM,+BAA+B,GAAkC,EAAE,CAAC;QAC1E,KAAK,MAAM,EAAE,QAAQ,EAAE,uBAAuB,EAAE,IAAI,eAAe,EAAE;YACjE,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC,EAAE;gBACtC,SAAS;aACZ;YACD,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChC,+BAA+B,CAAC,IAAI,CAAC,GAAG,uBAAuB,CAAC,CAAC;SACpE;QACD,OAAO;YACH,SAAS,EAAE,gBAAgB;YAC3B,uBAAuB,EAAE,+BAA+B;SAC3D,CAAC;IACN,CAAC;CACJ,CAAA;kCApCY,uBAAuB;IADnC,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,uBAAuB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,0BAA0B,CAAC,CAAA;qCADvB,iDAAuB;QAEpB,uDAA0B;GATtD,uBAAuB,CAoCnC"}
@@ -4,9 +4,20 @@ info:
4
4
  version: 1.0.0
5
5
  description: PID
6
6
  channels:
7
+ jis.fetchJISInfotexts:
8
+ address: vehicle-positions.jis.fetchJISInfotexts
9
+ description: Fetch JIS Infotexts from data source
10
+ bindings:
11
+ amqp:
12
+ is: queue
13
+ queue:
14
+ durable: true
15
+ messages:
16
+ empty:
17
+ $ref: "#/components/messages/emptyMessage"
7
18
  jis.refreshJISInfotexts:
8
19
  address: vehicle-positions.jis.refreshJISInfotexts
9
- description: Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database
20
+ description: Refresh JIS Infotexts in database
10
21
  bindings:
11
22
  amqp:
12
23
  is: queue
@@ -14,7 +25,7 @@ channels:
14
25
  durable: true
15
26
  messages:
16
27
  empty:
17
- $ref: "#/components/messages/emptyMessage"
28
+ $ref: "#/components/messages/IJISInfotext"
18
29
  updateGTFSTripId:
19
30
  address: vehicle-positions.vehiclepositions.updateGTFSTripId
20
31
  description: some description
@@ -447,6 +458,12 @@ components:
447
458
  type: array
448
459
  items:
449
460
  $ref: "#/components/schemas/IScheduleDto"
461
+ IJISInfotext:
462
+ payload:
463
+ type: array
464
+ items:
465
+ $ref: "#/components/schemas/JisInfotext"
466
+
450
467
  schemas:
451
468
  IUpdateGTFSTripIdData:
452
469
  type: object
@@ -1508,3 +1525,80 @@ components:
1508
1525
  actual_position_timestamp_scheduled:
1509
1526
  type: string
1510
1527
  format: date-time
1528
+ JisInfotext:
1529
+ type: object
1530
+ properties:
1531
+ id:
1532
+ type: string
1533
+ format: uuid
1534
+ description: Unique identifier for the infotext
1535
+ severity_level:
1536
+ type: string
1537
+ enum:
1538
+ - SEVERE
1539
+ - WARNING
1540
+ - INFO
1541
+ description: Severity level of the infotext
1542
+ display_type:
1543
+ type: string
1544
+ description: How the infotext is displayed
1545
+ active_period:
1546
+ type: object
1547
+ properties:
1548
+ start:
1549
+ type: string
1550
+ format: date-time
1551
+ description: Start time of the active period
1552
+ end:
1553
+ type: string
1554
+ format: date-time
1555
+ description: End time of the active period
1556
+ required:
1557
+ - start
1558
+ - end
1559
+ description: The period during which the infotext is active
1560
+ description_text:
1561
+ type: object
1562
+ properties:
1563
+ cs:
1564
+ type: string
1565
+ description: Description in Czech
1566
+ en:
1567
+ type: string
1568
+ description: Description in English
1569
+ required:
1570
+ - cs
1571
+ - en
1572
+ description: Localized descriptions of the infotext
1573
+ informed_entity:
1574
+ type: object
1575
+ properties:
1576
+ stops:
1577
+ type: array
1578
+ items:
1579
+ type: object
1580
+ properties:
1581
+ stop_id:
1582
+ type: string
1583
+ description: Unique identifier for the stop
1584
+ required:
1585
+ - stop_id
1586
+ required:
1587
+ - stops
1588
+ created_timestamp:
1589
+ type: string
1590
+ format: date-time
1591
+ description: Timestamp when the infotext was created in VYMI
1592
+ last_modified_timestamp:
1593
+ type: string
1594
+ format: date-time
1595
+ description: Timestamp when the infotext was updated in VYMI
1596
+ required:
1597
+ - id
1598
+ - severity_level
1599
+ - display_type
1600
+ - active_period
1601
+ - description_text
1602
+ - informed_entity
1603
+ - created_timestamp
1604
+ - last_modified_timestamp
@@ -215,26 +215,6 @@ _:warning: Původním záměrem bylo využití OIS číselníku během zpracová
215
215
  - prod `0 */1 * * * *`
216
216
  - názvy rabbitmq front
217
217
  - vehicle-positions.ropidpresets.collectAndSaveLogs se zprávou `{ "targetMinutes": n }`
218
-
219
- #### _JIS Infotexty_
220
-
221
- - zdroj dat
222
- - baseUrl: module.pid.jis.baseUrl
223
- - infotexts path: module.pid.jis.infotexts.path
224
- - hlavičky infotexts dotazu: module.pid.jis.infotexts.headers
225
- - formát dat
226
- - protokol: http
227
- - datový typ: json
228
- - validační schéma: [JISInfotextsJsonSchema](../src/schema-definitions/jis/datasources/JISInfotextsJsonSchema.ts)
229
- - příklad vstupnich dat: [infotextsDataSourceFixture](../test/integration-engine/jis/fixtures/infotextsDataSourceFixture.ts)
230
- - frekvence stahování
231
- - cron definice:
232
- - cron.vehicle-positions.jis.refreshJISInfotexts
233
- - rabin `*/30 * * * * *`
234
- - prod `*/30 * * * * *`
235
- - název rabbitmq fronty
236
- - vehicle-positions.jis.refreshJISInfotexts
237
-
238
218
  ### _Ropid staticka data_
239
219
 
240
220
  - zdroj dat
@@ -385,6 +365,15 @@ _:warning: Původním záměrem bylo využití OIS číselníku během zpracová
385
365
  - agregace dat: 1 MB
386
366
  - odhadovaná zátěž
387
367
  - desítky až stovky zpráv za minutu
368
+ #### _JIS Infotexty_
369
+
370
+ - formát dat
371
+ - protokol: http
372
+ - datový typ: json
373
+ - validační schéma: [JISInfotextsJsonSchema](../src/schema-definitions/jis/datasources/JISInfotextsJsonSchema.ts)
374
+ - příklad vstupnich dat: [infotextsDataSourceFixture](../test/integration-engine/jis/fixtures/infotextsDataSourceFixture.ts)
375
+ - název rabbitmq fronty
376
+ - vehicle-positions.jis.refreshJISInfotexts
388
377
 
389
378
  ## Výstupní data
390
379
 
@@ -18,6 +18,8 @@ servers:
18
18
  tags:
19
19
  - name: 🛤 Vehicle Positions
20
20
  description: ""
21
+ - name: 🪧 JIS
22
+ description: ""
21
23
  paths:
22
24
  /vehiclepositions:
23
25
  post:
@@ -159,6 +161,62 @@ paths:
159
161
  WWW_Authenticate:
160
162
  schema:
161
163
  type: string
164
+ /jis/infotexts:
165
+ post:
166
+ summary: POST JIS infotexts
167
+ description: ""
168
+ tags:
169
+ - 🪧 JIS
170
+ parameters:
171
+ - in: header
172
+ name: Content-Type
173
+ schema:
174
+ type: string
175
+ example: "application/json"
176
+ required: true
177
+ requestBody:
178
+ required: true
179
+ content:
180
+ application/json:
181
+ schema:
182
+ $ref: "#/components/schemas/JisInfotexts"
183
+ examples:
184
+ json:
185
+ $ref: "#/components/examples/JisInfotextsExample"
186
+ responses:
187
+ "204":
188
+ description: Successful Operation
189
+
190
+ "422":
191
+ description: Unprocessable Entity
192
+ content:
193
+ application/json:
194
+ schema:
195
+ $ref: "#/components/schemas/Error"
196
+ example:
197
+ error_info: "validation failed [{\"keyword\":\"type\",\"dataPath\":\"[0].severity_level\",\"schemaPath\":\"#/items/properties/severity_level/type\",\"params\":{\"type\":\"string\"},\"message\":\"should be string\"}]"
198
+ error_message: "Unprocessable Entity"
199
+ error_status: 422
200
+ "400":
201
+ description: Bad Request
202
+ content:
203
+ application/json:
204
+ schema:
205
+ $ref: "#/components/schemas/Error"
206
+ example:
207
+ error_message: "Bad Request"
208
+ error_status: 400
209
+ "406":
210
+ description: Not Acceptable
211
+ "413":
212
+ description: Payload Too Large
213
+ content:
214
+ application/json:
215
+ schema:
216
+ $ref: "#/components/schemas/Error"
217
+ example:
218
+ error_message: "Request entity too large"
219
+ error_status: 413
162
220
 
163
221
  components:
164
222
  schemas:
@@ -357,7 +415,86 @@ components:
357
415
  query:
358
416
  type: string
359
417
  example: "?minutesAfter=300&limit=8&mode=departures&cisIds=40110"
360
-
418
+ JisInfotexts:
419
+ title: Jis infotexts
420
+ type: array
421
+ items:
422
+ type: object
423
+ properties:
424
+ id:
425
+ type: string
426
+ format: uuid
427
+ description: Unique identifier for the infotext
428
+ severity_level:
429
+ type: string
430
+ enum:
431
+ - SEVERE
432
+ - WARNING
433
+ - INFO
434
+ description: Severity level of the infotext
435
+ display_type:
436
+ type: string
437
+ description: How the infotext is displayed
438
+ active_period:
439
+ type: object
440
+ properties:
441
+ start:
442
+ type: string
443
+ format: date-time
444
+ description: Start time of the active period
445
+ end:
446
+ type: string
447
+ format: date-time
448
+ description: End time of the active period
449
+ required:
450
+ - start
451
+ - end
452
+ description: The period during which the infotext is active
453
+ description_text:
454
+ type: object
455
+ properties:
456
+ cs:
457
+ type: string
458
+ description: Description in Czech
459
+ en:
460
+ type: string
461
+ description: Description in English
462
+ required:
463
+ - cs
464
+ - en
465
+ description: Localized descriptions of the infotext
466
+ informed_entity:
467
+ type: object
468
+ properties:
469
+ stops:
470
+ type: array
471
+ items:
472
+ type: object
473
+ properties:
474
+ stop_id:
475
+ type: string
476
+ description: Unique identifier for the stop
477
+ required:
478
+ - stop_id
479
+ required:
480
+ - stops
481
+ created_timestamp:
482
+ type: string
483
+ format: date-time
484
+ description: Timestamp when the infotext was created in VYMI
485
+ last_modified_timestamp:
486
+ type: string
487
+ format: date-time
488
+ description: Timestamp when the infotext was updated in VYMI
489
+ required:
490
+ - id
491
+ - severity_level
492
+ - display_type
493
+ - active_period
494
+ - description_text
495
+ - informed_entity
496
+ - created_timestamp
497
+ - last_modified_timestamp
361
498
  examples:
362
499
  VehiclePositionsBodyExample:
363
500
  value: |-
@@ -433,3 +570,57 @@ components:
433
570
  "query": "?minutesAfter=40&limit=6&mode=departures&filter=routeHeadingOnceNoGapFill&order=real&aswIds=2781_2&aswIds=2781_52&skip=atStop&airCondition=true"
434
571
  }
435
572
  ]
573
+ JisInfotextsExample:
574
+ value : |-
575
+ [
576
+ {
577
+ "id": "1833020b-b8c2-4903-85d5-469b0a2ebc70",
578
+ "severity_level": "SEVERE",
579
+ "display_type": "INLINE",
580
+ "active_period": {
581
+ "start": "2024-12-05T11:12:00.000Z",
582
+ "end": "2025-01-30T23:00:00.000Z"
583
+ },
584
+ "description_text": {
585
+ "cs": "Test po aktualizaci Node.js",
586
+ "en": "This is a test"
587
+ },
588
+ "informed_entity": {
589
+ "stops": [
590
+ {
591
+ "stop_id": "U31070Z20"
592
+ },
593
+ {
594
+ "stop_id": "U32268Z1"
595
+ }
596
+ ]
597
+ },
598
+ "created_timestamp": "2024-12-06T14:08:02.669Z"
599
+ "last_modified_timestamp": "2024-12-06T14:08:02.669Z"
600
+ },
601
+ {
602
+ "id": "178c4bff-b098-41a9-b0e7-d611bd3c54ac",
603
+ "severity_level": "INFO",
604
+ "display_type": "INLINE",
605
+ "active_period": {
606
+ "start": "2024-12-03T10:44:00.000Z",
607
+ "end": null
608
+ },
609
+ "description_text": {
610
+ "cs": "Tento text se zobrazí v budoucnosti a bude mít historii",
611
+ "en": null
612
+ },
613
+ "informed_entity": {
614
+ "stops": [
615
+ {
616
+ "stop_id": "U85Z1P"
617
+ },
618
+ {
619
+ "stop_id": "U876Z1P"
620
+ }
621
+ ]
622
+ },
623
+ "created_timestamp": "2024-11-08T10:44:34.701Z"
624
+ "last_modified_timestamp": "2024-11-08T10:44:34.701Z"
625
+ }
626
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "3.2.3-dev.1575424535",
3
+ "version": "3.2.3-dev.1589820139",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",