@golemio/pid 2.12.5-dev.1229819245 → 2.12.5-dev.1230045631

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.
@@ -2,9 +2,11 @@ import { ICommonRunWithMessageDto } from "../../../../../schema-definitions/vehi
2
2
  import { CommonRunsRepository } from "../data-access/CommonRunsRepository";
3
3
  export declare class CommonMessageProcessor {
4
4
  private readonly runsRepository;
5
+ private logger;
5
6
  constructor(runsRepository: CommonRunsRepository);
6
7
  /**
7
8
  * Create/update and process transformed run
8
9
  */
9
10
  processTransformedRun: (element: ICommonRunWithMessageDto) => Promise<void>;
11
+ private logElementIssues;
10
12
  }
@@ -10,10 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CommonMessageProcessor = void 0;
13
+ const Di_1 = require("../../../../ioc/Di");
13
14
  const vehicle_positions_1 = require("../../../../../schema-definitions/vehicle-positions");
15
+ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
14
16
  const config_1 = require("@golemio/core/dist/integration-engine/config");
15
17
  const queueprocessors_1 = require("@golemio/core/dist/integration-engine/queueprocessors");
18
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
16
19
  const const_1 = require("../../../../../const");
20
+ const ONE_HOUR_IN_MILLIS = 60 * 60 * 1000;
21
+ const MIN_HOURS_DIFF_TO_LOG = 22;
17
22
  class CommonMessageProcessor {
18
23
  constructor(runsRepository) {
19
24
  this.runsRepository = runsRepository;
@@ -21,6 +26,7 @@ class CommonMessageProcessor {
21
26
  * Create/update and process transformed run
22
27
  */
23
28
  this.processTransformedRun = (element) => __awaiter(this, void 0, void 0, function* () {
29
+ this.logElementIssues(element);
24
30
  const record = yield this.runsRepository.getRunRecordForUpdate(element.run);
25
31
  let outputMsg;
26
32
  if (record) {
@@ -38,6 +44,15 @@ class CommonMessageProcessor {
38
44
  }
39
45
  yield queueprocessors_1.QueueManager.sendMessageToExchange(`${config_1.config.RABBIT_EXCHANGE_NAME}.${vehicle_positions_1.VehiclePositions.name.toLowerCase()}`, "updateRunsGTFSTripId", outputMsg);
40
46
  });
47
+ this.logger = Di_1.PidContainer.resolve(CoreToken_1.CoreToken.Logger);
48
+ }
49
+ logElementIssues(element) {
50
+ if (element.run_message.actual_stop_timestamp_scheduled instanceof Date &&
51
+ element.run_message.actual_stop_timestamp_scheduled.getTime() - Date.now() >=
52
+ MIN_HOURS_DIFF_TO_LOG * ONE_HOUR_IN_MILLIS) {
53
+ this.logger.error(new golemio_errors_1.GeneralError(`Message timestamp 'tjr' of value '${element.run_message.actual_stop_timestamp_scheduled}' is 22+ hrs ` +
54
+ `ahead (line ${element.run.line_short_name}, run ${element.run.run_number})`, this.constructor.name));
55
+ }
41
56
  }
42
57
  }
43
58
  exports.CommonMessageProcessor = CommonMessageProcessor;
@@ -1 +1 @@
1
- {"version":3,"file":"CommonMessageProcessor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2FAA0D;AAE1D,yEAAsE;AAEtE,2FAAqF;AACrF,gDAAyE;AAGzE,MAAa,sBAAsB;IAC/B,YAA6B,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;QAEjE;;WAEG;QACI,0BAAqB,GAAG,CAAO,OAAiC,EAAiB,EAAE;YACtF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE5E,IAAI,SAAmC,CAAC;YACxC,IAAI,MAAM,EAAE;gBACR,IACI,CAAC,OAAO,CAAC,WAAW,CAAC,+BAA+B;oBACpD,CAAC,yCAAiC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAC9E;oBACE,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBACxG,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,+BAA+B;wBAAE,OAAO;oBACrF,OAAO,CAAC,WAAW,CAAC,+BAA+B,GAAG,iBAAiB,CAAC,+BAA+B,CAAC;iBAC3G;gBAED,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;aAChF;iBAAM;gBACH,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;aACrE;YAED,MAAM,8BAAY,CAAC,qBAAqB,CACpC,GAAG,eAAM,CAAC,oBAAoB,IAAI,oCAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EACvE,sBAAsB,EACtB,SAAS,CACZ,CAAC;QACN,CAAC,CAAA,CAAC;IA7BkE,CAAC;CA8BxE;AA/BD,wDA+BC"}
1
+ {"version":3,"file":"CommonMessageProcessor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA0C;AAC1C,2FAA0D;AAE1D,wEAAqE;AAErE,yEAAsE;AACtE,2FAAqF;AACrF,6EAAwE;AACxE,gDAAyE;AAGzE,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAa,sBAAsB;IAG/B,YAA6B,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;QAIjE;;WAEG;QACI,0BAAqB,GAAG,CAAO,OAAiC,EAAiB,EAAE;YACtF,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,MAAM,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CAAC,MAAM,CAAC,KAAK,CACb,IAAI,6BAAY,CACZ,qCAAqC,OAAO,CAAC,WAAW,CAAC,+BAA+B,eAAe;gBACnG,eAAe,OAAO,CAAC,GAAG,CAAC,eAAe,SAAS,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,EAChF,IAAI,CAAC,WAAW,CAAC,IAAI,CACxB,CACJ,CAAC;SACL;IACL,CAAC;CACJ;AApDD,wDAoDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.12.5-dev.1229819245",
3
+ "version": "2.12.5-dev.1230045631",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",