mobility-toolbox-js 2.0.0-beta.51 → 2.0.0-beta.52

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.
@@ -3,7 +3,7 @@ import { RealtimeTrajectory } from '../../types';
3
3
  * Return a filter functions based on some parameters of a vehicle.
4
4
  *
5
5
  * @param {string|Array<string>} line - A list of vehicle's name to filter. Names can be separated by a comma. Ex: 'S1,S2,S3'
6
- * @param {string|Array<string} route - A list of vehicle's route (contained in routeIdentifier property) to filter. Indentifiers can be separated by a comma. Ex: 'id1,id2,id3'
6
+ * @param {string|Array<string} route - A list of vehicle's route (contained in route_identifier property) to filter. Indentifiers can be separated by a comma. Ex: 'id1,id2,id3'
7
7
  * @param {string|Array<string} operator A list of vehicle's operator to filter. Operators can be separated by a comma. Ex: 'SBB,DB'
8
8
  * @param {Regexp} regexLine - A regex aplly of vehcile's name.
9
9
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"createTrackerFilters.d.ts","sourceRoot":"","sources":["../../../src/common/utils/createTrackerFilters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,SACX,MAAM,GAAG,MAAM,EAAE,SAChB,MAAM,GAAG,MAAM,EAAE,YACd,MAAM,GAAG,MAAM,EAAE,aAChB,MAAM,GAAG,MAAM,EAAE,mBACb,kBAAkB,KAAK,OAAO,QA2E9C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"createTrackerFilters.d.ts","sourceRoot":"","sources":["../../../src/common/utils/createTrackerFilters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,SACX,MAAM,GAAG,MAAM,EAAE,SAChB,MAAM,GAAG,MAAM,EAAE,YACd,MAAM,GAAG,MAAM,EAAE,aAChB,MAAM,GAAG,MAAM,EAAE,mBACb,kBAAkB,KAAK,OAAO,QA8E9C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Return a filter functions based on some parameters of a vehicle.
3
3
  *
4
4
  * @param {string|Array<string>} line - A list of vehicle's name to filter. Names can be separated by a comma. Ex: 'S1,S2,S3'
5
- * @param {string|Array<string} route - A list of vehicle's route (contained in routeIdentifier property) to filter. Indentifiers can be separated by a comma. Ex: 'id1,id2,id3'
5
+ * @param {string|Array<string} route - A list of vehicle's route (contained in route_identifier property) to filter. Indentifiers can be separated by a comma. Ex: 'id1,id2,id3'
6
6
  * @param {string|Array<string} operator A list of vehicle's operator to filter. Operators can be separated by a comma. Ex: 'SBB,DB'
7
7
  * @param {Regexp} regexLine - A regex aplly of vehcile's name.
8
8
  * @private
@@ -42,14 +42,21 @@ const createFilters = (line, route, operator, regexLine) => {
42
42
  const routes = typeof route === 'string' ? route.split(',') : route;
43
43
  const routeList = routes.map((item) => parseInt(item, 10));
44
44
  const routeFilter = (item) => {
45
- const routeId = parseInt(item.properties.routeIdentifier.split('.')[0], 10);
45
+ const routeIdentifier = item.properties.route_identifier ||
46
+ item.properties.routeIdentifier ||
47
+ '';
48
+ const routeId = parseInt(routeIdentifier.split('.')[0], 10);
46
49
  return routeList.includes(routeId);
47
50
  };
48
51
  filterList.push(routeFilter);
49
52
  }
50
53
  if (operator) {
51
54
  const operatorList = typeof operator === 'string' ? [operator] : operator;
52
- const operatorFilter = (item) => operatorList.some((op) => new RegExp(op, 'i').test(item.properties.operator || ''));
55
+ const operatorFilter = (item) => operatorList.some((op) => {
56
+ // operaotr is the old property tenant is the new one
57
+ const tenant = item.properties.operator || item.properties.tenant || '';
58
+ return new RegExp(op, 'i').test(tenant);
59
+ });
53
60
  filterList.push(operatorFilter);
54
61
  }
55
62
  if (!filterList.length) {
package/mbt.js CHANGED
@@ -34620,14 +34620,18 @@ uniform ${i3} ${o3} u_${a3};
34620
34620
  const routes = typeof route === "string" ? route.split(",") : route;
34621
34621
  const routeList = routes.map((item) => parseInt(item, 10));
34622
34622
  const routeFilter = (item) => {
34623
- const routeId = parseInt(item.properties.routeIdentifier.split(".")[0], 10);
34623
+ const routeIdentifier = item.properties.route_identifier || item.properties.routeIdentifier || "";
34624
+ const routeId = parseInt(routeIdentifier.split(".")[0], 10);
34624
34625
  return routeList.includes(routeId);
34625
34626
  };
34626
34627
  filterList.push(routeFilter);
34627
34628
  }
34628
34629
  if (operator) {
34629
34630
  const operatorList = typeof operator === "string" ? [operator] : operator;
34630
- const operatorFilter = (item) => operatorList.some((op) => new RegExp(op, "i").test(item.properties.operator || ""));
34631
+ const operatorFilter = (item) => operatorList.some((op) => {
34632
+ const tenant = item.properties.operator || item.properties.tenant || "";
34633
+ return new RegExp(op, "i").test(tenant);
34634
+ });
34631
34635
  filterList.push(operatorFilter);
34632
34636
  }
34633
34637
  if (!filterList.length) {