incyclist-services 1.7.56 → 1.7.58

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 (46) hide show
  1. package/lib/cjs/i18n/countries/index.js +13 -118
  2. package/lib/cjs/i18n/countries/service.js +125 -0
  3. package/lib/cjs/maps/MapArea/options.js +3 -3
  4. package/lib/cjs/maps/MapArea/utils.js +1 -1
  5. package/lib/cjs/ride/page/service.js +1 -1
  6. package/lib/cjs/ride/route/RLVDisplayService.js +13 -3
  7. package/lib/cjs/routes/base/parsers/bikelab.js +1 -1
  8. package/lib/cjs/routes/base/parsers/epm.js +12 -16
  9. package/lib/cjs/routes/base/parsers/geometry.js +1 -1
  10. package/lib/cjs/routes/base/parsers/index.js +0 -4
  11. package/lib/cjs/routes/base/parsers/tacx/TacxParser.js +294 -220
  12. package/lib/cjs/routes/base/parsers/utils.js +78 -13
  13. package/lib/cjs/routes/base/parsers/xml.js +6 -3
  14. package/lib/cjs/routes/free-ride/service.js +42 -29
  15. package/lib/cjs/routes/library/service.js +44 -10
  16. package/lib/cjs/routes/list/service.js +11 -20
  17. package/lib/cjs/ui/service.js +26 -5
  18. package/lib/cjs/utils/fileinfo.js +1 -1
  19. package/lib/esm/i18n/countries/index.js +1 -115
  20. package/lib/esm/i18n/countries/service.js +118 -0
  21. package/lib/esm/maps/MapArea/options.js +3 -3
  22. package/lib/esm/maps/MapArea/utils.js +1 -1
  23. package/lib/esm/ride/page/service.js +1 -1
  24. package/lib/esm/ride/route/RLVDisplayService.js +13 -3
  25. package/lib/esm/routes/base/parsers/bikelab.js +1 -1
  26. package/lib/esm/routes/base/parsers/epm.js +13 -17
  27. package/lib/esm/routes/base/parsers/geometry.js +1 -1
  28. package/lib/esm/routes/base/parsers/index.js +0 -4
  29. package/lib/esm/routes/base/parsers/tacx/TacxParser.js +302 -227
  30. package/lib/esm/routes/base/parsers/utils.js +75 -12
  31. package/lib/esm/routes/base/parsers/xml.js +6 -3
  32. package/lib/esm/routes/free-ride/service.js +42 -29
  33. package/lib/esm/routes/library/service.js +44 -10
  34. package/lib/esm/routes/list/service.js +11 -20
  35. package/lib/esm/ui/service.js +26 -5
  36. package/lib/esm/utils/fileinfo.js +1 -1
  37. package/lib/types/api/mq/index.d.ts +2 -0
  38. package/lib/types/i18n/countries/index.d.ts +1 -17
  39. package/lib/types/i18n/countries/model.d.ts +6 -3
  40. package/lib/types/i18n/countries/service.d.ts +18 -0
  41. package/lib/types/ride/route/RLVDisplayService.d.ts +2 -0
  42. package/lib/types/routes/base/parsers/tacx/TacxParser.d.ts +7 -2
  43. package/lib/types/routes/base/parsers/utils.d.ts +3 -1
  44. package/lib/types/routes/free-ride/service.d.ts +3 -1
  45. package/lib/types/ui/service.d.ts +4 -0
  46. package/package.json +1 -1
@@ -1,122 +1,17 @@
1
1
  "use strict";
2
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
- var _, done = false;
8
- for (var i = decorators.length - 1; i >= 0; i--) {
9
- var context = {};
10
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
- if (kind === "accessor") {
15
- if (result === void 0) continue;
16
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
- if (_ = accept(result.get)) descriptor.get = _;
18
- if (_ = accept(result.set)) descriptor.set = _;
19
- if (_ = accept(result.init)) initializers.unshift(_);
20
- }
21
- else if (_ = accept(result)) {
22
- if (kind === "field") initializers.unshift(_);
23
- else descriptor[key] = _;
24
- }
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
7
  }
26
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
- done = true;
28
- };
29
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
- var useValue = arguments.length > 2;
31
- for (var i = 0; i < initializers.length; i++) {
32
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
- }
34
- return useValue ? value : void 0;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
38
15
  };
39
16
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.getCountries = exports.Countries = void 0;
41
- const service_1 = require("../../base/service");
42
- const types_1 = require("../../base/types");
43
- const countries_json_1 = __importDefault(require("./countries.json"));
44
- const services_1 = require("../../services");
45
- let Countries = (() => {
46
- let _classDecorators = [types_1.Singleton];
47
- let _classDescriptor;
48
- let _classExtraInitializers = [];
49
- let _classThis;
50
- let _classSuper = service_1.IncyclistService;
51
- var Countries = class extends _classSuper {
52
- static { _classThis = this; }
53
- static {
54
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
55
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
56
- Countries = _classThis = _classDescriptor.value;
57
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
58
- __runInitializers(_classThis, _classExtraInitializers);
59
- }
60
- language;
61
- countryLists;
62
- constructor() {
63
- super('Countries');
64
- this.language = countries_json_1.default.locale;
65
- this.countryLists = {};
66
- this.countryLists[this.language] = countries_json_1.default;
67
- }
68
- getList(locale = this.language) {
69
- return this.countryLists[locale] || this.countryLists.en;
70
- }
71
- getCountryFromIso(iso, locale) {
72
- const list = this.getList(locale);
73
- const info = list.countries[iso.toUpperCase()];
74
- return Array.isArray(info) ? info[0] : info;
75
- }
76
- getCountiesFromIsos(iso, locale) {
77
- return iso.map(i => this.getCountryFromIso(i, locale));
78
- }
79
- getIsoFromCountry(country, locale) {
80
- const list = this.getList(locale);
81
- const isos = Object.keys(list.countries);
82
- const iso = isos.find(i => {
83
- const c = list.countries[i];
84
- if (Array.isArray(c))
85
- return c.includes(country);
86
- return c === country;
87
- });
88
- return iso;
89
- }
90
- getIsosFromCountries(countries, locale) {
91
- return countries.map(c => this.getIsoFromCountry(c, locale));
92
- }
93
- async getIsoFromLatLng(point) {
94
- const { lat, lng } = point;
95
- const query = `[out:json][timeout:25];way['addr:country'](around:20000,${lat},${lng});out tags;`;
96
- try {
97
- const result = await (0, services_1.useOverpassApi)().query(query);
98
- if (!result?.elements)
99
- return;
100
- const isos = [];
101
- result.elements?.forEach(el => {
102
- const iso = el.tags['addr:country'];
103
- if (!iso)
104
- return;
105
- if (!isos.includes(iso.toUpperCase())) {
106
- isos.push(iso.toUpperCase());
107
- }
108
- });
109
- if (isos.length < 2)
110
- return isos[0];
111
- return isos.find(iso => this.getList().countries[iso] !== undefined);
112
- }
113
- catch {
114
- return undefined;
115
- }
116
- }
117
- };
118
- return Countries = _classThis;
119
- })();
120
- exports.Countries = Countries;
121
- const getCountries = () => new Countries();
122
- exports.getCountries = getCountries;
17
+ __exportStar(require("./service"), exports);
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
8
+ };
9
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
+ var _, done = false;
15
+ for (var i = decorators.length - 1; i >= 0; i--) {
16
+ var context = {};
17
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
+ if (kind === "accessor") {
22
+ if (result === void 0) continue;
23
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
+ if (_ = accept(result.get)) descriptor.get = _;
25
+ if (_ = accept(result.set)) descriptor.set = _;
26
+ if (_ = accept(result.init)) initializers.unshift(_);
27
+ }
28
+ else if (_ = accept(result)) {
29
+ if (kind === "field") initializers.unshift(_);
30
+ else descriptor[key] = _;
31
+ }
32
+ }
33
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
+ done = true;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.getCountries = exports.Countries = void 0;
41
+ const service_1 = require("../../base/service");
42
+ const types_1 = require("../../base/types");
43
+ const countries_json_1 = __importDefault(require("./countries.json"));
44
+ const services_1 = require("../../services");
45
+ const decorators_1 = require("../../base/decorators");
46
+ let Countries = (() => {
47
+ let _classDecorators = [types_1.Singleton];
48
+ let _classDescriptor;
49
+ let _classExtraInitializers = [];
50
+ let _classThis;
51
+ let _classSuper = service_1.IncyclistService;
52
+ let _instanceExtraInitializers = [];
53
+ let _getOverpassApi_decorators;
54
+ var Countries = class extends _classSuper {
55
+ static { _classThis = this; }
56
+ static {
57
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
58
+ _getOverpassApi_decorators = [decorators_1.Injectable];
59
+ __esDecorate(this, null, _getOverpassApi_decorators, { kind: "method", name: "getOverpassApi", static: false, private: false, access: { has: obj => "getOverpassApi" in obj, get: obj => obj.getOverpassApi }, metadata: _metadata }, null, _instanceExtraInitializers);
60
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
61
+ Countries = _classThis = _classDescriptor.value;
62
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
63
+ __runInitializers(_classThis, _classExtraInitializers);
64
+ }
65
+ language = __runInitializers(this, _instanceExtraInitializers);
66
+ countryLists;
67
+ constructor() {
68
+ super('Countries');
69
+ this.language = countries_json_1.default.locale;
70
+ this.countryLists = {};
71
+ this.countryLists[this.language] = countries_json_1.default;
72
+ }
73
+ getList(locale = this.language) {
74
+ return this.countryLists[locale] || this.countryLists.en;
75
+ }
76
+ getCountryFromIso(iso, locale) {
77
+ const list = this.getList(locale);
78
+ const info = list.countries[iso.toUpperCase()];
79
+ return Array.isArray(info) ? info[0] : info;
80
+ }
81
+ getCountiesFromIsos(iso, locale) {
82
+ return iso.map(i => this.getCountryFromIso(i, locale));
83
+ }
84
+ getIsoFromCountry(country, locale) {
85
+ const list = this.getList(locale);
86
+ const isos = Object.keys(list.countries);
87
+ const iso = isos.find(i => {
88
+ const c = list.countries[i];
89
+ if (Array.isArray(c))
90
+ return c.includes(country);
91
+ return c === country;
92
+ });
93
+ return iso;
94
+ }
95
+ getIsosFromCountries(countries, locale) {
96
+ return countries.map(c => this.getIsoFromCountry(c, locale));
97
+ }
98
+ async getIsoFromLatLng(point) {
99
+ const { lat, lng } = point;
100
+ const query = `[out:json][timeout:10];is_in(${lat},${lng})->.a;rel(pivot.a)['admin_level'='2']['boundary'='administrative'];out tags;`;
101
+ try {
102
+ const result = await this.getOverpassApi().query(query);
103
+ if (!result?.elements)
104
+ return undefined;
105
+ const isos = result.elements
106
+ .map(el => el.tags['ISO3166-1:alpha2'])
107
+ .filter((iso) => !!iso)
108
+ .map(iso => iso.toUpperCase());
109
+ if (isos.length < 2)
110
+ return isos[0];
111
+ return isos.find(iso => this.getList().countries[iso] !== undefined);
112
+ }
113
+ catch {
114
+ return undefined;
115
+ }
116
+ }
117
+ getOverpassApi() {
118
+ return (0, services_1.useOverpassApi)();
119
+ }
120
+ };
121
+ return Countries = _classThis;
122
+ })();
123
+ exports.Countries = Countries;
124
+ const getCountries = () => new Countries();
125
+ exports.getCountries = getCountries;
@@ -30,12 +30,12 @@ class OptionManager {
30
30
  const path = segment.path;
31
31
  const opts = await this.getNextOptions(segment);
32
32
  if (opts?.length === 1) {
33
- if (opts[0].id !== segment.id) {
33
+ if (opts[0].id === segment.id) {
34
34
  (0, utils_1.concatPaths)(path, opts[0].path, 'after', opts[0].id);
35
35
  }
36
36
  else {
37
37
  let foundSameSegment = false;
38
- options[0].path.forEach((point, j) => {
38
+ opts[0].path.forEach((point, j) => {
39
39
  if (j === 0)
40
40
  return;
41
41
  foundSameSegment = points.some(pAll => pAll.id === point.id);
@@ -386,7 +386,7 @@ class OptionManager {
386
386
  const w = this.getWay(way);
387
387
  if (!w)
388
388
  return [];
389
- if (w.roundabout) {
389
+ if ((0, utils_1.isRoundabout)(w) && w.path[0].id !== w.path.at(-1).id) {
390
390
  const branches = (0, utils_1.splitAtPoint)(w, location);
391
391
  branches.forEach(b => {
392
392
  if (b.path.length > 1 && b.path[1].id !== prev.id) {
@@ -166,7 +166,7 @@ function splitAtPointInfo(way, split) {
166
166
  function isRoundabout(w, strictCheck = false) {
167
167
  if (!w)
168
168
  return;
169
- let roundabout = (w.tags !== undefined && (w.tags.roundabout === true || w.tags.junction === 'roundabout'));
169
+ let roundabout = (w.tags !== undefined && (w.tags.roundabout === true || w.tags.junction === 'roundabout' || w.tags.junction === 'circular'));
170
170
  if (roundabout)
171
171
  return true;
172
172
  if (strictCheck)
@@ -42,7 +42,7 @@ const display_1 = require("../display");
42
42
  const sleep_1 = require("../../utils/sleep");
43
43
  const api_1 = require("../../api");
44
44
  const monitoring_1 = require("../../monitoring");
45
- const BACKGROUND_PAUSE_TIMEOUT_MS = 60000;
45
+ const BACKGROUND_PAUSE_TIMEOUT_MS = 300000;
46
46
  let RidePageService = (() => {
47
47
  let _classDecorators = [decorators_1.Singleton];
48
48
  let _classDescriptor;
@@ -35,6 +35,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.RLVDisplayService = void 0;
38
+ const api_1 = require("../../api");
38
39
  const decorators_1 = require("../../base/decorators");
39
40
  const types_1 = require("../../base/types");
40
41
  const coaches_1 = require("../../coaches");
@@ -47,15 +48,18 @@ const RouteDisplayService_1 = require("./RouteDisplayService");
47
48
  let RLVDisplayService = (() => {
48
49
  let _classSuper = RouteDisplayService_1.RouteDisplayService;
49
50
  let _instanceExtraInitializers = [];
51
+ let _getBindings_decorators;
50
52
  let _getRouteList_decorators;
51
53
  let _getLocalization_decorators;
52
54
  let _getCoaches_decorators;
53
55
  return class RLVDisplayService extends _classSuper {
54
56
  static {
55
57
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
58
+ _getBindings_decorators = [decorators_1.Injectable];
56
59
  _getRouteList_decorators = [decorators_1.Injectable];
57
60
  _getLocalization_decorators = [decorators_1.Injectable];
58
61
  _getCoaches_decorators = [decorators_1.Injectable];
62
+ __esDecorate(this, null, _getBindings_decorators, { kind: "method", name: "getBindings", static: false, private: false, access: { has: obj => "getBindings" in obj, get: obj => obj.getBindings }, metadata: _metadata }, null, _instanceExtraInitializers);
59
63
  __esDecorate(this, null, _getRouteList_decorators, { kind: "method", name: "getRouteList", static: false, private: false, access: { has: obj => "getRouteList" in obj, get: obj => obj.getRouteList }, metadata: _metadata }, null, _instanceExtraInitializers);
60
64
  __esDecorate(this, null, _getLocalization_decorators, { kind: "method", name: "getLocalization", static: false, private: false, access: { has: obj => "getLocalization" in obj, get: obj => obj.getLocalization }, metadata: _metadata }, null, _instanceExtraInitializers);
61
65
  __esDecorate(this, null, _getCoaches_decorators, { kind: "method", name: "getCoaches", static: false, private: false, access: { has: obj => "getCoaches" in obj, get: obj => obj.getCoaches }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -129,8 +133,8 @@ let RLVDisplayService = (() => {
129
133
  const nextId = (0, routes_1.getNextVideoId)(videoRoute);
130
134
  this.logEvent({ message: 'video added', id: videoRoute.description.id, title: videoRoute.description.title, segmentDistance: videoRoute.description.distance, next: nextId });
131
135
  }
132
- catch (error) {
133
- this.logError(error, 'addVideo');
136
+ catch (err) {
137
+ this.logError(err, 'addVideo');
134
138
  }
135
139
  }
136
140
  pause() {
@@ -515,7 +519,7 @@ let RLVDisplayService = (() => {
515
519
  fileName = fileName.replace('incyclist:', 'file:');
516
520
  if (fileName.startsWith('video:') && !lc.endsWith('.avi'))
517
521
  return fileName.replace('video:', 'file:');
518
- if (fileName.startsWith('file:') && !lc.endsWith('.avi'))
522
+ if (fileName.startsWith('file:') && !lc.endsWith('.avi') && !this.isMobile())
519
523
  return fileName.replace('file:', 'video:');
520
524
  if (fileName.startsWith('video:') && lc.endsWith('.avi'))
521
525
  return fileName;
@@ -567,6 +571,12 @@ let RLVDisplayService = (() => {
567
571
  this.addVideo(nextRoute, false, current);
568
572
  return true;
569
573
  }
574
+ isMobile() {
575
+ return this.getBindings()?.appInfo?.getChannel() === 'mobile';
576
+ }
577
+ getBindings() {
578
+ return (0, api_1.getBindings)();
579
+ }
570
580
  getRouteList() {
571
581
  return (0, routes_1.useRouteList)();
572
582
  }
@@ -47,7 +47,7 @@ class BikeLabParser extends xml_1.XMLParser {
47
47
  localizedTitle: value('Description') ?? value('Name'),
48
48
  country: value('CountryCode'),
49
49
  id: value('id'),
50
- previewUrl: value('previewURL'),
50
+ previewUrl: value('previewURL') ?? undefined,
51
51
  distance: 0,
52
52
  elevation: 0,
53
53
  points: [],
@@ -52,36 +52,32 @@ class EPMParser extends xml_1.XMLParser {
52
52
  }
53
53
  async loadEpp(context) {
54
54
  const { fileInfo } = context;
55
+ (0, utils_1.fixIncorrectFileInfo)(fileInfo);
55
56
  const file = { ...fileInfo, ext: 'epp', encoding: 'binary' };
56
- let fullName = fileInfo.base ?? fileInfo.name;
57
- if (!fullName.includes('.epm')) {
58
- fullName = fullName + '.epm';
59
- }
60
- const fileName = fullName.replace('epm', 'epp');
61
- if (fileName.startsWith('http') || fileName.startsWith('file') || fileName.startsWith('/') || fileName.startsWith('\\') || fileName.startsWith('.')) {
62
- file.type = 'file';
63
- file.filename = fileName;
64
- }
65
- else if (fileInfo.type === 'url') {
66
- file.url = file.url.replace(fileInfo.name, fileName);
67
- }
68
- else {
69
- file.filename = file.filename.replace(fullName, fileName);
57
+ let base = fileInfo.base;
58
+ if (!base.includes('.epm')) {
59
+ base = base + '.epm';
70
60
  }
61
+ file.base = base.replace('.epm', '.epp');
62
+ if (file.filename)
63
+ file.filename = fileInfo.filename.replace(base, file.base);
64
+ if (file.url)
65
+ file.url = fileInfo.url.replace(base, file.base);
71
66
  const onError = () => {
72
- const nameInfo = this.getChannel() === 'mobile' ? fileName : (0, utils_2.getFileName)(file);
67
+ const nameInfo = this.getChannel() === 'mobile' ? base : (0, utils_2.getFileName)(file);
73
68
  throw new Error('Could not open EPP file: ' + nameInfo);
74
69
  };
75
70
  const loader = (0, api_1.getBindings)().loader;
76
71
  try {
77
72
  const res = await loader.open(file);
78
73
  if (res.error) {
74
+ this.logger.logEvent({ message: 'could not load EPP file', file, reason: res.error });
79
75
  onError();
80
76
  }
81
77
  return res.data;
82
78
  }
83
79
  catch (err) {
84
- this.logger.logEvent({ message: 'could not load EPP file', reason: err.message });
80
+ this.logger.logEvent({ message: 'could not load EPP file', file, reason: err.message });
85
81
  onError();
86
82
  }
87
83
  }
@@ -54,7 +54,7 @@ let GeometryParser = (() => {
54
54
  return await this.parse(file, geometry);
55
55
  }
56
56
  getPrimaryExtension() {
57
- return 'xml';
57
+ return 'json';
58
58
  }
59
59
  getCompanionExtensions() {
60
60
  return [];
@@ -25,7 +25,6 @@ const bikelab_1 = require("./bikelab");
25
25
  const epm_1 = require("./epm");
26
26
  const TacxParser_1 = require("./tacx/TacxParser");
27
27
  const utils_1 = require("./utils");
28
- const gd_eventlog_1 = require("gd-eventlog");
29
28
  const useParsers = () => {
30
29
  const parsers = factory_1.ParserFactory.getInstance();
31
30
  if (!parsers.isInitialized()) {
@@ -40,7 +39,6 @@ const useParsers = () => {
40
39
  exports.useParsers = useParsers;
41
40
  class RouteParser {
42
41
  static async parse(info) {
43
- const logger = new gd_eventlog_1.EventLogger('RouteParser');
44
42
  (0, utils_1.fixIncorrectFileInfo)(info);
45
43
  const parsers = (0, exports.useParsers)();
46
44
  const formatParsers = parsers.suppertsExtension(info.ext);
@@ -56,9 +54,7 @@ class RouteParser {
56
54
  const res = await Promise.allSettled(promises);
57
55
  const matching = res.map(promise => promise.status === 'fulfilled' ? promise.value : undefined).find(p => p !== undefined);
58
56
  if (matching) {
59
- logger.logEvent({ message: 'before import' });
60
57
  const res = await matching.parser.import(info, matching.data);
61
- logger.logEvent({ message: 'after import' });
62
58
  return res;
63
59
  }
64
60
  if (formatParsers.length === 0)