@golemio/pid 5.5.1-dev.2307186507 → 5.5.1-dev.2316323342

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.
@@ -54,4 +54,4 @@ INSERT INTO vehiclepositions_positions (created_at,delay,delay_stop_arrival,dela
54
54
 
55
55
  -- vehiclepositions_cis_stops
56
56
  insert into vehiclepositions_cis_stops (rt_trip_id, cis_stop_group_id, cis_stop_platform_code, created_at, updated_at) VALUES
57
- (concat(CURRENT_DATE,'T10:05:00Z_2530'), 5457076, '1A/1', now(), now());
57
+ (concat(CURRENT_DATE,'T10:05:00Z_2530'), 5457076, '1A', now(), now());
@@ -2,14 +2,15 @@ import { IMpvStopContent } from "../../../../../../schema-definitions/vehicle-po
2
2
  export declare class MpvStopParser {
3
3
  /**
4
4
  * Parse and sanitize current platform code
5
- * 1/3 -> 1/3
5
+ * 1/3 -> 1
6
6
  * -/3 -> 3
7
7
  * 1/- -> 1
8
8
  * -/BUS -> BUS
9
- * 2/100V -> 2/100V
9
+ * 2/100V -> 2
10
10
  * -/5 C-F -> 5
11
- * 2/5 A -> 2/5
11
+ * 2/5 A -> 2
12
12
  * 5A/- A C -> 5A
13
13
  */
14
+ private static shortPlatformRegex;
14
15
  static parsePlatformCode(cisStop: IMpvStopContent): string | null;
15
16
  }
@@ -2,24 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MpvStopParser = void 0;
4
4
  class MpvStopParser {
5
- /**
6
- * Parse and sanitize current platform code
7
- * 1/3 -> 1/3
8
- * -/3 -> 3
9
- * 1/- -> 1
10
- * -/BUS -> BUS
11
- * 2/100V -> 2/100V
12
- * -/5 C-F -> 5
13
- * 2/5 A -> 2/5
14
- * 5A/- A C -> 5A
15
- */
16
5
  static parsePlatformCode(cisStop) {
17
6
  const platformCode = cisStop.$.stan;
18
7
  if (!platformCode) {
19
8
  return null;
20
9
  }
21
- return platformCode.replace(/-\/|\/-|\s+.*$/g, "");
10
+ const matches = platformCode.match(MpvStopParser.shortPlatformRegex);
11
+ const candidate = (matches ?? [platformCode])[0];
12
+ return candidate.split(/\s+/)[0].trim();
22
13
  }
23
14
  }
24
15
  exports.MpvStopParser = MpvStopParser;
16
+ /**
17
+ * Parse and sanitize current platform code
18
+ * 1/3 -> 1
19
+ * -/3 -> 3
20
+ * 1/- -> 1
21
+ * -/BUS -> BUS
22
+ * 2/100V -> 2
23
+ * -/5 C-F -> 5
24
+ * 2/5 A -> 2
25
+ * 5A/- A C -> 5A
26
+ */
27
+ MpvStopParser.shortPlatformRegex = /[^/-]+/;
25
28
  //# sourceMappingURL=MpvStopParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MpvStopParser.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/mpv-net/MpvStopParser.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IACtB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,iBAAiB,CAAC,OAAwB;QAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;CACJ;AApBD,sCAoBC"}
1
+ {"version":3,"file":"MpvStopParser.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/mpv-net/MpvStopParser.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAatB,MAAM,CAAC,iBAAiB,CAAC,OAAwB;QAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;QACrE,MAAM,SAAS,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;;AArBL,sCAsBC;AArBG;;;;;;;;;;GAUG;AACY,gCAAkB,GAAG,QAAQ,CAAC"}
@@ -15,15 +15,13 @@ export declare class PlatformCodeResolver {
15
15
  * - for other route types, the departure platform code is used (GTFS)
16
16
  * @param departure Must have `route_type` and `platform_code` properties
17
17
  * @param cisStopPlatformCode For trains - this is where the `cis_stop_platform_code` goes
18
- * @param makeItShort Applies parsing for trains to get shorter platform from 6J/26J => 6J
19
18
  */
20
- static resolveDirect(departure: MinimalDeparture, cisStopPlatformCode: string | null, makeItShort?: boolean): string | null;
19
+ static resolveDirect(departure: MinimalDeparture, cisStopPlatformCode: string | null): string | null;
21
20
  /**
22
21
  * Determine platform code based on the following rules:
23
22
  * if current stop time is known, use its RT CIS platform code (if available)
24
23
  * otherwise use GTFS schedule platform code
25
24
  */
26
25
  static fromStopTimeCisShort(departure: MinimalDeparture, stopTime: PossiblyStopTime): string | null;
27
- private static shortTrainPlatform;
28
26
  }
29
27
  export {};
@@ -10,12 +10,11 @@ class PlatformCodeResolver {
10
10
  * - for other route types, the departure platform code is used (GTFS)
11
11
  * @param departure Must have `route_type` and `platform_code` properties
12
12
  * @param cisStopPlatformCode For trains - this is where the `cis_stop_platform_code` goes
13
- * @param makeItShort Applies parsing for trains to get shorter platform from 6J/26J => 6J
14
13
  */
15
- static resolveDirect(departure, cisStopPlatformCode, makeItShort = false) {
14
+ static resolveDirect(departure, cisStopPlatformCode) {
16
15
  const { route_type, platform_code } = departure;
17
16
  if (route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.TRAIN && cisStopPlatformCode != null) {
18
- return makeItShort ? PlatformCodeResolver.shortTrainPlatform(cisStopPlatformCode) : cisStopPlatformCode;
17
+ return cisStopPlatformCode;
19
18
  }
20
19
  return platform_code;
21
20
  }
@@ -25,10 +24,7 @@ class PlatformCodeResolver {
25
24
  * otherwise use GTFS schedule platform code
26
25
  */
27
26
  static fromStopTimeCisShort(departure, stopTime) {
28
- return PlatformCodeResolver.resolveDirect(departure, stopTime?.cis_stop_platform_code ?? null, true);
29
- }
30
- static shortTrainPlatform(platformCode) {
31
- return (PlatformCodeResolver.shortPlatformRegex.exec(platformCode) ?? [platformCode])[0];
27
+ return PlatformCodeResolver.resolveDirect(departure, stopTime?.cis_stop_platform_code ?? null);
32
28
  }
33
29
  }
34
30
  exports.PlatformCodeResolver = PlatformCodeResolver;
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformCodeResolver.js","sourceRoot":"","sources":["../../../src/output-gateway/shared/PlatformCodeResolver.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAU5D,MAAa,oBAAoB;IAG7B;;;;;;;;OAQG;IACI,MAAM,CAAC,aAAa,CACvB,SAA2B,EAC3B,mBAAkC,EAClC,cAAuB,KAAK;QAE5B,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;QAChD,IAAI,UAAU,KAAK,kCAAiB,CAAC,KAAK,IAAI,mBAAmB,IAAI,IAAI,EAAE,CAAC;YACxE,OAAO,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC;QAC5G,CAAC;QAED,OAAO,aAAa,CAAC;IACzB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,oBAAoB,CAAC,SAA2B,EAAE,QAA0B;QACtF,OAAO,oBAAoB,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,sBAAsB,IAAI,IAAI,EAAE,IAAI,CAAC,CAAC;IACzG,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAAC,YAAoB;QAClD,OAAO,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,CAAC;;AAnCL,oDAoCC;AAnCkB,uCAAkB,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"PlatformCodeResolver.js","sourceRoot":"","sources":["../../../src/output-gateway/shared/PlatformCodeResolver.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAU5D,MAAa,oBAAoB;IAG7B;;;;;;;OAOG;IACI,MAAM,CAAC,aAAa,CAAC,SAA2B,EAAE,mBAAkC;QACvF,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;QAChD,IAAI,UAAU,KAAK,kCAAiB,CAAC,KAAK,IAAI,mBAAmB,IAAI,IAAI,EAAE,CAAC;YACxE,OAAO,mBAAmB,CAAC;QAC/B,CAAC;QAED,OAAO,aAAa,CAAC;IACzB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,oBAAoB,CAAC,SAA2B,EAAE,QAA0B;QACtF,OAAO,oBAAoB,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,sBAAsB,IAAI,IAAI,CAAC,CAAC;IACnG,CAAC;;AA1BL,oDA2BC;AA1BkB,uCAAkB,GAAG,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "5.5.1-dev.2307186507",
3
+ "version": "5.5.1-dev.2316323342",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",