@golemio/pid 2.24.2-dev.1536500241 → 2.24.2-dev.1537993987

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 (26) hide show
  1. package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.d.ts +1 -1
  2. package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js +8 -5
  3. package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js.map +1 -1
  4. package/dist/integration-engine/jis/ioc/Di.js +2 -0
  5. package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
  6. package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +1 -0
  7. package/dist/integration-engine/jis/ioc/JISContainerToken.js +1 -0
  8. package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
  9. package/dist/integration-engine/jis/repositories/JISMetadataRepository.d.ts +15 -0
  10. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js +91 -0
  11. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js.map +1 -0
  12. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +7 -1
  13. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +38 -5
  14. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
  15. package/dist/schema-definitions/jis/redis/const.d.ts +1 -0
  16. package/dist/schema-definitions/jis/redis/const.js +5 -0
  17. package/dist/schema-definitions/jis/redis/const.js.map +1 -0
  18. package/dist/schema-definitions/jis/redis/interfaces/IJISMetadataDto.d.ts +10 -0
  19. package/dist/schema-definitions/jis/redis/interfaces/IJISMetadataDto.js +3 -0
  20. package/dist/schema-definitions/jis/redis/interfaces/IJISMetadataDto.js.map +1 -0
  21. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.d.ts +4 -0
  22. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js +27 -0
  23. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js.map +1 -0
  24. package/docs/asyncapi.yaml +17 -0
  25. package/docs/implementation_documentation.md +7 -1
  26. package/package.json +3 -3
@@ -5,6 +5,6 @@ export declare class JISInfotextsDataSourceFactory {
5
5
  private config;
6
6
  constructor(config: ISimpleConfig);
7
7
  private static DATASOURCE_NAME;
8
- getDataSource(): IDataSource<IJISInfotext[]>;
8
+ getDataSource(etag?: string): IDataSource<IJISInfotext[]>;
9
9
  private getProtocolStrategy;
10
10
  }
@@ -24,18 +24,21 @@ let JISInfotextsDataSourceFactory = exports.JISInfotextsDataSourceFactory = JISI
24
24
  constructor(config) {
25
25
  this.config = config;
26
26
  }
27
- getDataSource() {
28
- return new integration_engine_1.DataSource(JISInfotextsDataSourceFactory_1.DATASOURCE_NAME, this.getProtocolStrategy(), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.JSONSchemaValidator(JISInfotextsDataSourceFactory_1.DATASOURCE_NAME + "Validator", JISInfotextsJsonSchema_1.jisInfotextsJsonSchema));
27
+ getDataSource(etag) {
28
+ return new integration_engine_1.DataSource(JISInfotextsDataSourceFactory_1.DATASOURCE_NAME, this.getProtocolStrategy(etag), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.JSONSchemaValidator(JISInfotextsDataSourceFactory_1.DATASOURCE_NAME + "Validator", JISInfotextsJsonSchema_1.jisInfotextsJsonSchema));
29
29
  }
30
- getProtocolStrategy() {
30
+ getProtocolStrategy(etag) {
31
31
  const baseUrl = this.config.getValue("module.pid.jis.baseUrl");
32
- const headers = this.config.getValue("module.pid.jis.infotexts.headers");
32
+ let headers = this.config.getValue("module.pid.jis.infotexts.headers");
33
33
  const urlPath = this.config.getValue("module.pid.jis.infotexts.path");
34
34
  const url = new URL(urlPath, baseUrl).toString();
35
+ if (typeof etag === "string") {
36
+ headers = Object.assign(Object.assign({}, headers), { "If-None-Match": etag, "Cache-Control": "no-store" });
37
+ }
35
38
  return new HTTPFetchProtocolStrategy_1.HTTPFetchProtocolStrategy({
36
39
  method: "GET",
37
40
  url,
38
- headers: headers,
41
+ headers,
39
42
  timeoutInSeconds: 20,
40
43
  });
41
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"JISInfotextsDataSourceFactory.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,+GAAqF;AAErF,wEAAqE;AACrE,8EAAwH;AACxH,6IAA0I;AAC1I,mFAAkF;AAClF,iEAAwE;AAGjE,IAAM,6BAA6B,6EAAnC,MAAM,6BAA6B;IACtC,YAAoD,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAItE,aAAa;QAChB,OAAO,IAAI,+BAAU,CACjB,+BAA6B,CAAC,eAAe,EAC7C,IAAI,CAAC,mBAAmB,EAAE,EAC1B,IAAI,yCAAoB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,EAC7C,IAAI,uCAAmB,CAAC,+BAA6B,CAAC,eAAe,GAAG,WAAW,EAAE,+CAAsB,CAAC,CAC/G,CAAC;IACN,CAAC;IAEO,mBAAmB;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAS,wBAAwB,CAAC,CAAC;QACvE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAc,kCAAkC,CAAC,CAAC;QACtF,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAS,+BAA+B,CAAC,CAAC;QAC9E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;QAEjD,OAAO,IAAI,qDAAyB,CAAC;YACjC,MAAM,EAAE,KAAK;YACb,GAAG;YACH,OAAO,EAAE,OAAyC;YAClD,gBAAgB,EAAE,EAAE;SACvB,CAAC,CAAC;IACP,CAAC;;AAvBc,6CAAe,GAAG,wBAAwB,AAA3B,CAA4B;wCAHjD,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;;GADlC,6BAA6B,CA2BzC"}
1
+ {"version":3,"file":"JISInfotextsDataSourceFactory.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,+GAAqF;AAErF,wEAAqE;AACrE,8EAAwH;AACxH,6IAA0I;AAC1I,mFAAkF;AAClF,iEAAwE;AAGjE,IAAM,6BAA6B,6EAAnC,MAAM,6BAA6B;IACtC,YAAoD,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAItE,aAAa,CAAC,IAAa;QAC9B,OAAO,IAAI,+BAAU,CACjB,+BAA6B,CAAC,eAAe,EAC7C,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAC9B,IAAI,yCAAoB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,EAC7C,IAAI,uCAAmB,CAAC,+BAA6B,CAAC,eAAe,GAAG,WAAW,EAAE,+CAAsB,CAAC,CAC/G,CAAC;IACN,CAAC;IAEO,mBAAmB,CAAC,IAAa;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAS,wBAAwB,CAAC,CAAC;QACvE,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAc,kCAAkC,CAAgB,CAAC;QACnG,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAS,+BAA+B,CAAC,CAAC;QAC9E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;QAEjD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC1B,OAAO,mCAAQ,OAAO,KAAE,eAAe,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,GAAE,CAAC;SAChF;QAED,OAAO,IAAI,qDAAyB,CAAC;YACjC,MAAM,EAAE,KAAK;YACb,GAAG;YACH,OAAO;YACP,gBAAgB,EAAE,EAAE;SACvB,CAAC,CAAC;IACP,CAAC;;AA3Bc,6CAAe,GAAG,wBAAwB,AAA3B,CAA4B;wCAHjD,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;;GADlC,6BAA6B,CA+BzC"}
@@ -5,6 +5,7 @@ const Di_1 = require("../../ioc/Di");
5
5
  const JISInfotextsDataSourceFactory_1 = require("../datasources/JISInfotextsDataSourceFactory");
6
6
  const JISInfotextsRepository_1 = require("../repositories/JISInfotextsRepository");
7
7
  const JISInfotextsRopidGTFSStopsRepository_1 = require("../repositories/JISInfotextsRopidGTFSStopsRepository");
8
+ const JISMetadataRepository_1 = require("../repositories/JISMetadataRepository");
8
9
  const JISInfotextsDataService_1 = require("../services/JISInfotextsDataService");
9
10
  const JISInfotextsTransformation_1 = require("../transformations/JISInfotextsTransformation");
10
11
  const RefreshJISInfotextsTask_1 = require("../workers/tasks/RefreshJISInfotextsTask");
@@ -19,6 +20,7 @@ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotext
19
20
  //#region Repositories
20
21
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRepository, JISInfotextsRepository_1.JISInfotextsRepository);
21
22
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository, JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository);
23
+ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISMetadataRepository, JISMetadataRepository_1.JISMetadataRepository);
22
24
  //#endregion
23
25
  //#region Services
24
26
  JISContainer.register(JISContainerToken_1.JISContainerToken.JISInfotextsDataService, JISInfotextsDataService_1.JISInfotextsDataService);
@@ -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,8FAA2F;AAC3F,sFAAmF;AACnF,2DAAwD;AAExD,wBAAwB;AACxB,MAAM,YAAY,GAAwB,iBAAY,CAAC,oBAAoB,EAAE,CAAC;AAwBrE,oCAAY;AAvBrB,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;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;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"}
@@ -2,6 +2,7 @@ declare const JISContainerToken: {
2
2
  JISInfotextsDataSourceFactory: symbol;
3
3
  JISInfotextsRepository: symbol;
4
4
  JISInfotextsRopidGTFSStopsRepository: symbol;
5
+ JISMetadataRepository: symbol;
5
6
  JISInfotextsDataService: symbol;
6
7
  JISInfotextsTransformation: symbol;
7
8
  RefreshJISInfotextsTask: symbol;
@@ -7,6 +7,7 @@ const JISContainerToken = {
7
7
  /* Repositories */
8
8
  JISInfotextsRepository: Symbol(),
9
9
  JISInfotextsRopidGTFSStopsRepository: Symbol(),
10
+ JISMetadataRepository: Symbol(),
10
11
  /* Services */
11
12
  JISInfotextsDataService: Symbol(),
12
13
  /* Transformations */
@@ -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,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;CACpC,CAAC;AAEO,8CAAiB"}
@@ -0,0 +1,15 @@
1
+ import { RedisModel } from "@golemio/core/dist/integration-engine/models/RedisModel";
2
+ export declare class JISMetadataRepository extends RedisModel {
3
+ static readonly NAMESPACE_PREFIX = "jisMetadata";
4
+ protected readonly key = "main";
5
+ constructor();
6
+ /** Get the Etag of the last JIS Infotexts response */
7
+ getLastInfotextsEtag(): Promise<string | undefined>;
8
+ /**
9
+ * Set the Etag of the last JIS Infotexts response to a given new value
10
+ *
11
+ * @param etag The new Etag of the last JIS Infotexts response
12
+ */
13
+ setLastInfotextsEtag(etag: string): Promise<void>;
14
+ private initializeMetadata;
15
+ }
@@ -0,0 +1,91 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ var JISMetadataRepository_1;
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.JISMetadataRepository = void 0;
23
+ const const_1 = require("../../../schema-definitions/jis/redis/const");
24
+ const JISMetadataDtoSchema_1 = require("../../../schema-definitions/jis/redis/schemas/JISMetadataDtoSchema");
25
+ const RedisModel_1 = require("@golemio/core/dist/integration-engine/models/RedisModel");
26
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
27
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
28
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
29
+ let JISMetadataRepository = exports.JISMetadataRepository = JISMetadataRepository_1 = class JISMetadataRepository extends RedisModel_1.RedisModel {
30
+ constructor() {
31
+ super("JISMetadataRepository", {
32
+ decodeDataAfterGet: JSON.parse,
33
+ encodeDataBeforeSave: JSON.stringify,
34
+ isKeyConstructedFromData: false,
35
+ prefix: JISMetadataRepository_1.NAMESPACE_PREFIX,
36
+ }, new golemio_validator_1.JSONSchemaValidator("JISMetadataRepositoryValidator", JISMetadataDtoSchema_1.JISMetadataDtoSchema));
37
+ this.key = "main";
38
+ }
39
+ /** Get the Etag of the last JIS Infotexts response */
40
+ getLastInfotextsEtag() {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ try {
43
+ const metadata = yield this.get(this.key);
44
+ return metadata === null || metadata === void 0 ? void 0 : metadata.infotexts.lastResponse.etag;
45
+ }
46
+ catch (err) {
47
+ if (err instanceof golemio_errors_1.GeneralError)
48
+ throw err;
49
+ throw new golemio_errors_1.GeneralError("Error while getting last infotexts etag", this.constructor.name, err);
50
+ }
51
+ });
52
+ }
53
+ /**
54
+ * Set the Etag of the last JIS Infotexts response to a given new value
55
+ *
56
+ * @param etag The new Etag of the last JIS Infotexts response
57
+ */
58
+ setLastInfotextsEtag(etag) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ try {
61
+ let metadata = yield this.get(this.key);
62
+ if (!metadata)
63
+ metadata = this.initializeMetadata();
64
+ metadata.infotexts.lastResponse.etag = etag;
65
+ metadata.infotexts.lastResponse.updatedAt = new Date().toISOString();
66
+ yield this.set(this.key, metadata);
67
+ }
68
+ catch (err) {
69
+ if (err instanceof golemio_errors_1.GeneralError)
70
+ throw err;
71
+ throw new golemio_errors_1.GeneralError("Error while updating last infotexts etag", this.constructor.name, err);
72
+ }
73
+ });
74
+ }
75
+ initializeMetadata() {
76
+ return {
77
+ infotexts: {
78
+ lastResponse: {
79
+ etag: "",
80
+ updatedAt: new Date().toISOString(),
81
+ },
82
+ },
83
+ };
84
+ }
85
+ };
86
+ JISMetadataRepository.NAMESPACE_PREFIX = const_1.JIS_METADATA_NAMESPACE_PREFIX;
87
+ exports.JISMetadataRepository = JISMetadataRepository = JISMetadataRepository_1 = __decorate([
88
+ (0, tsyringe_1.injectable)(),
89
+ __metadata("design:paramtypes", [])
90
+ ], JISMetadataRepository);
91
+ //# sourceMappingURL=JISMetadataRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISMetadataRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISMetadataRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAqE;AAErE,6GAAmF;AACnF,wFAAqF;AACrF,6EAAwE;AACxE,mFAAkF;AAClF,iEAAgE;AAGzD,IAAM,qBAAqB,6DAA3B,MAAM,qBAAsB,SAAQ,uBAAU;IAKjD;QACI,KAAK,CACD,uBAAuB,EACvB;YACI,kBAAkB,EAAE,IAAI,CAAC,KAAK;YAC9B,oBAAoB,EAAE,IAAI,CAAC,SAAS;YACpC,wBAAwB,EAAE,KAAK;YAC/B,MAAM,EAAE,uBAAqB,CAAC,gBAAgB;SACjD,EACD,IAAI,uCAAmB,CAAC,gCAAgC,EAAE,2CAAoB,CAAC,CAClF,CAAC;QAZa,QAAG,GAAG,MAAM,CAAC;IAahC,CAAC;IAED,sDAAsD;IAChD,oBAAoB;;YACtB,IAAI;gBACA,MAAM,QAAQ,GAAgC,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACvE,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC;aAChD;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,6BAAY;oBAAE,MAAM,GAAG,CAAC;gBAC3C,MAAM,IAAI,6BAAY,CAAC,yCAAyC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aACjG;QACL,CAAC;KAAA;IAED;;;;OAIG;IACG,oBAAoB,CAAC,IAAY;;YACnC,IAAI;gBACA,IAAI,QAAQ,GAAgC,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACrE,IAAI,CAAC,QAAQ;oBAAE,QAAQ,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBACpD,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC;gBAC5C,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;gBACrE,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;aACtC;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,6BAAY;oBAAE,MAAM,GAAG,CAAC;gBAC3C,MAAM,IAAI,6BAAY,CAAC,0CAA0C,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAClG;QACL,CAAC;KAAA;IAEO,kBAAkB;QACtB,OAAO;YACH,SAAS,EAAE;gBACP,YAAY,EAAE;oBACV,IAAI,EAAE,EAAE;oBACR,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACtC;aACJ;SACJ,CAAC;IACN,CAAC;;AAvDsB,sCAAgB,GAAG,qCAA6B,AAAhC,CAAiC;gCAD/D,qBAAqB;IADjC,IAAA,qBAAU,GAAE;;GACA,qBAAqB,CAyDjC"}
@@ -1,14 +1,20 @@
1
1
  import { JISInfotextsDataSourceFactory } from "../../datasources/JISInfotextsDataSourceFactory";
2
+ import { JISMetadataRepository } from "../../repositories/JISMetadataRepository";
2
3
  import { JISInfotextsDataService } from "../../services/JISInfotextsDataService";
3
4
  import { JISInfotextsTransformation } from "../../transformations/JISInfotextsTransformation";
5
+ import { ILogger } from "@golemio/core/dist/helpers";
4
6
  import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
5
7
  export declare class RefreshJISInfotextsTask extends AbstractEmptyTask {
6
8
  private dataSourceFactory;
7
9
  private infotextsDataService;
8
10
  private infotextsTransformation;
11
+ private metadataRepository;
12
+ private logger;
9
13
  readonly queueName = "refreshJISInfotexts";
10
14
  readonly queueTtl: number;
11
- constructor(dataSourceFactory: JISInfotextsDataSourceFactory, infotextsDataService: JISInfotextsDataService, infotextsTransformation: JISInfotextsTransformation);
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 */
12
17
  protected execute(): Promise<void>;
18
+ private getResponseEtag;
13
19
  private getEntitiesFromTransformationResult;
14
20
  }
@@ -24,29 +24,59 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.RefreshJISInfotextsTask = void 0;
25
25
  const JISInfotextsDataSourceFactory_1 = require("../../datasources/JISInfotextsDataSourceFactory");
26
26
  const JISContainerToken_1 = require("../../ioc/JISContainerToken");
27
+ const JISMetadataRepository_1 = require("../../repositories/JISMetadataRepository");
27
28
  const JISInfotextsDataService_1 = require("../../services/JISInfotextsDataService");
28
29
  const JISInfotextsTransformation_1 = require("../../transformations/JISInfotextsTransformation");
30
+ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
29
31
  const integration_engine_1 = require("@golemio/core/dist/integration-engine");
32
+ const ResourceNotModified_1 = require("@golemio/core/dist/integration-engine/helpers/ResourceNotModified");
30
33
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
31
34
  const constants_1 = require("../constants");
32
35
  let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJISInfotextsTask extends integration_engine_1.AbstractEmptyTask {
33
- constructor(dataSourceFactory, infotextsDataService, infotextsTransformation) {
36
+ constructor(dataSourceFactory, infotextsDataService, infotextsTransformation, metadataRepository, logger) {
34
37
  super(constants_1.JIS_WORKER_NAME.toLowerCase());
35
38
  this.dataSourceFactory = dataSourceFactory;
36
39
  this.infotextsDataService = infotextsDataService;
37
40
  this.infotextsTransformation = infotextsTransformation;
41
+ this.metadataRepository = metadataRepository;
42
+ this.logger = logger;
38
43
  this.queueName = "refreshJISInfotexts";
39
- this.queueTtl = 1 * 60 * 1000; // 1 minute;
44
+ this.queueTtl = 20 * 1000; // 20 seconds
40
45
  }
46
+ /** Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database */
41
47
  execute() {
42
48
  return __awaiter(this, void 0, void 0, function* () {
43
- const dataSource = this.dataSourceFactory.getDataSource();
44
- const data = yield dataSource.getAll();
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
+ }
45
57
  const transformedData = this.infotextsTransformation.transformArray(data);
46
58
  const { infotexts, infotextsRopidGTFSStops } = this.getEntitiesFromTransformationResult(transformedData);
47
59
  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
+ }
48
67
  });
49
68
  }
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
+ }
50
80
  getEntitiesFromTransformationResult(transformedData) {
51
81
  const infotextEntities = [];
52
82
  const infotextsRopidGTFSStopsEntities = [];
@@ -68,8 +98,11 @@ exports.RefreshJISInfotextsTask = RefreshJISInfotextsTask = __decorate([
68
98
  __param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory)),
69
99
  __param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataService)),
70
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)),
71
103
  __metadata("design:paramtypes", [JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory,
72
104
  JISInfotextsDataService_1.JISInfotextsDataService,
73
- JISInfotextsTransformation_1.JISInfotextsTransformation])
105
+ JISInfotextsTransformation_1.JISInfotextsTransformation,
106
+ JISMetadataRepository_1.JISMetadataRepository, Object])
74
107
  ], RefreshJISInfotextsTask);
75
108
  //# sourceMappingURL=RefreshJISInfotextsTask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mGAAkG;AAClG,mEAAkE;AAClE,oFAAmF;AACnF,iGAAgG;AAEhG,8EAA0E;AAC1E,iEAAwE;AACxE,4CAA+C;AAGxC,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ,sCAAiB;IAI1D,YAEI,iBAAwD,EAExD,oBAAqD,EAErD,uBAA2D;QAE3D,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAN7B,sBAAiB,GAAjB,iBAAiB,CAA+B;QAEhD,yBAAoB,GAApB,oBAAoB,CAAyB;QAE7C,4BAAuB,GAAvB,uBAAuB,CAA4B;QAT/C,cAAS,GAAG,qBAAqB,CAAC;QAClC,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;IAWtD,CAAC;IAEe,OAAO;;YACnB,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;YAC1D,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;YACvC,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,GAAmB,EAAE,CAAC;QAC5C,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;kCAtCY,uBAAuB;IADnC,IAAA,qBAAU,GAAE;IAMJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,6BAA6B,CAAC,CAAA;IAEvD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,uBAAuB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,0BAA0B,CAAC,CAAA;qCAH1B,6DAA6B;QAE1B,iDAAuB;QAEpB,uDAA0B;GAVtD,uBAAuB,CAsCnC"}
1
+ {"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export declare const JIS_METADATA_NAMESPACE_PREFIX = "jisMetadata";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JIS_METADATA_NAMESPACE_PREFIX = void 0;
4
+ exports.JIS_METADATA_NAMESPACE_PREFIX = "jisMetadata";
5
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/schema-definitions/jis/redis/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,6BAA6B,GAAG,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ interface IEndpointMetadata {
2
+ lastResponse: {
3
+ etag: string;
4
+ updatedAt: string;
5
+ };
6
+ }
7
+ export interface IJISMetadataDto {
8
+ infotexts: IEndpointMetadata;
9
+ }
10
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IJISMetadataDto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IJISMetadataDto.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/jis/redis/interfaces/IJISMetadataDto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { JSONSchemaType } from "@golemio/core/dist/shared/ajv";
2
+ import { IJISMetadataDto } from "../interfaces/IJISMetadataDto";
3
+ declare const jisMetadataDtoSchema: JSONSchemaType<IJISMetadataDto>;
4
+ export { jisMetadataDtoSchema as JISMetadataDtoSchema };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JISMetadataDtoSchema = void 0;
4
+ const jisMetadataDtoSchema = {
5
+ $schema: "http://json-schema.org/draft-04/schema#",
6
+ title: "JISMetadataDto",
7
+ type: "object",
8
+ properties: {
9
+ infotexts: {
10
+ type: "object",
11
+ properties: {
12
+ lastResponse: {
13
+ type: "object",
14
+ properties: {
15
+ etag: { type: "string" },
16
+ updatedAt: { type: "string", format: "date-time" },
17
+ },
18
+ required: ["etag", "updatedAt"],
19
+ },
20
+ },
21
+ required: ["lastResponse"],
22
+ },
23
+ },
24
+ required: ["infotexts"],
25
+ };
26
+ exports.JISMetadataDtoSchema = jisMetadataDtoSchema;
27
+ //# sourceMappingURL=JISMetadataDtoSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISMetadataDtoSchema.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.ts"],"names":[],"mappings":";;;AAGA,MAAM,oBAAoB,GAAoC;IAC1D,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,gBAAgB;IACvB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,SAAS,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,YAAY,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACxB,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE;qBACrD;oBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;iBAClC;aACJ;YACD,QAAQ,EAAE,CAAC,cAAc,CAAC;SAC7B;KACJ;IACD,QAAQ,EAAE,CAAC,WAAW,CAAC;CAC1B,CAAC;AAC+B,oDAAoB"}
@@ -4,6 +4,17 @@ info:
4
4
  version: 1.0.0
5
5
  description: PID
6
6
  channels:
7
+ jis.refreshJISInfotexts:
8
+ address: vehicle-positions.jis.refreshJISInfotexts
9
+ description: Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database
10
+ bindings:
11
+ amqp:
12
+ is: queue
13
+ queue:
14
+ durable: true
15
+ messages:
16
+ empty:
17
+ $ref: "#/components/messages/emptyMessage"
7
18
  updateGTFSTripId:
8
19
  address: vehicle-positions.vehiclepositions.updateGTFSTripId
9
20
  description: some description
@@ -234,6 +245,10 @@ channels:
234
245
  empty:
235
246
  $ref: "#/components/messages/EmptyObject"
236
247
  operations:
248
+ jis.refreshJISInfotexts:
249
+ action: "send"
250
+ channel:
251
+ $ref: "#/channels/jis.refreshJISInfotexts"
237
252
  updateGTFSTripId:
238
253
  action: "send"
239
254
  channel:
@@ -312,6 +327,8 @@ operations:
312
327
  $ref: "#/channels/processMetroRunMessages"
313
328
  components:
314
329
  messages:
330
+ emptyMessage:
331
+ title: Empty message
315
332
  saveTramRunsToDB:
316
333
  payload:
317
334
  type: object
@@ -1113,7 +1113,7 @@ Worker má na starost stahování VYMI (JIS) infotextů, jejich transformaci a u
1113
1113
 
1114
1114
  - vstupní rabbitmq fronta
1115
1115
  - název: vehicle-positions.jis.refreshJISInfotexts
1116
- - TTL: 1 minuta
1116
+ - TTL: 20 sekund
1117
1117
  - parametry: žádné
1118
1118
  - závislé fronty (do kterých jsou odesílány zprávy z metody workeru)
1119
1119
  - žádné
@@ -1121,6 +1121,12 @@ Worker má na starost stahování VYMI (JIS) infotextů, jejich transformaci a u
1121
1121
  - JIS Infotexty
1122
1122
  - transformace
1123
1123
  - [JISInfotextsTransformation](../src/integration-engine/jis/transformations/JISInfotextsTransformation.ts)
1124
+ - popis
1125
+ - z Redisu je získán ETag poslední přijaté odpovědi datového zdroje
1126
+ - z datového zdroje jsou podmíněným dotazem s posledním ETagem získána data a metadata
1127
+ - pokud na straně datového zdroje došlo k aktualizaci dat, je provedena transformace
1128
+ - transformovaná data jsou uložena do Postgres a starší záznamy jsou odstraněny
1129
+ - v Redisu je aktualizován poslední přijatý ETag
1124
1130
  - data modely
1125
1131
  - JISInfotextsModel `jis_infotexts`
1126
1132
  - JISInfotextsRopidGTFSStopsModel `jis_infotexts_ropidgtfs_stops`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.24.2-dev.1536500241",
3
+ "version": "2.24.2-dev.1537993987",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "@commitlint/cli": "^11.0.0",
38
38
  "@commitlint/config-conventional": "^11.0.0",
39
39
  "@golemio/cli": "1.7.3",
40
- "@golemio/core": "1.15.0",
40
+ "@golemio/core": "1.15.2-dev.1536581038",
41
41
  "@golemio/db-common": "1.1.4",
42
42
  "@golemio/eslint-config": "1.1.2",
43
43
  "@types/amqplib": "^0.5.17",
@@ -73,7 +73,7 @@
73
73
  "typescript-transform-paths": "^3.4.6"
74
74
  },
75
75
  "peerDependencies": {
76
- "@golemio/core": ">=1.14.1-rc.1470811358"
76
+ "@golemio/core": ">=1.15.2-dev.1536581038"
77
77
  },
78
78
  "dependencies": {
79
79
  "@golemio/ovapi-gtfs-realtime-bindings": "1.2.4-dev.1288219308",