incyclist-services 1.6.5 → 1.6.6

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.
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.GPXParser = void 0;
13
13
  const utils_1 = require("../../../utils");
14
+ const math_1 = require("../../../utils/math");
14
15
  const valid_1 = require("../../../utils/valid");
15
16
  const route_1 = require("../utils/route");
16
17
  const xml_1 = require("./xml");
@@ -120,12 +121,20 @@ class GPXParser extends xml_1.XMLParser {
120
121
  }
121
122
  points.forEach((gpxPt) => {
122
123
  const point = {
123
- lat: Number(gpxPt.lat),
124
- lng: Number(gpxPt.lon),
125
- elevation: gpxPt.ele ? Number(gpxPt.ele) : prev === null || prev === void 0 ? void 0 : prev.elevation,
124
+ lat: (0, math_1.num)(gpxPt.lat),
125
+ lng: (0, math_1.num)(gpxPt.lon),
126
+ elevation: gpxPt.ele ? (0, math_1.num)(gpxPt.ele) : prev === null || prev === void 0 ? void 0 : prev.elevation,
126
127
  routeDistance: 0,
127
128
  distance: 0
128
129
  };
130
+ if (point.lat === undefined || point.lng === undefined) {
131
+ const info = {
132
+ original: gpxPt,
133
+ parsed: point
134
+ };
135
+ this.logger.logEvent({ message: 'error', fn: 'loadPoints', reason: 'unvalid point', info });
136
+ return;
137
+ }
129
138
  if (this.props.addTime) {
130
139
  if (startTime === null) {
131
140
  point.time = 0;
@@ -4,3 +4,4 @@ export declare function sin(degree: any): number;
4
4
  export declare function asin(num: any): number;
5
5
  export declare function cos(degree: any): number;
6
6
  export declare function abs(num: any): number;
7
+ export declare const num: (value: string | number) => number;
package/lib/utils/math.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.num = void 0;
3
4
  exports.rad = rad;
4
5
  exports.degrees = degrees;
5
6
  exports.sin = sin;
@@ -25,3 +26,11 @@ function cos(degree) {
25
26
  function abs(num) {
26
27
  return Math.abs(num);
27
28
  }
29
+ const num = (value) => {
30
+ const res = Number(value);
31
+ if (isNaN(res)) {
32
+ return;
33
+ }
34
+ return res;
35
+ };
36
+ exports.num = num;
@@ -589,6 +589,8 @@ class VideoSyncHelper extends service_1.IncyclistService {
589
589
  checkIfStalledEnded(time) {
590
590
  if (!this.rlvStatus.isStalled)
591
591
  return;
592
+ if (!this.rlvPrev)
593
+ return;
592
594
  if (time > this.rlvPrev.time) {
593
595
  this.rlvStatus.isStalled = false;
594
596
  this.logEvent({ message: 'video playback unstalled' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.26"
6
6
  },
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "axios": "^1.8.2",
45
- "incyclist-devices": "^2.4.9",
45
+ "incyclist-devices": "^2.4.12",
46
46
  "promise.any": "^2.0.6",
47
47
  "semver": "^7.6.3",
48
48
  "tcx-builder": "^1.1.1",