incyclist-services 1.3.0 → 1.3.2
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.
- package/lib/activities/ride/service.js +58 -39
- package/lib/activities/upload/velohero.d.ts +3 -1
- package/lib/activities/upload/velohero.js +9 -3
- package/lib/apps/base/api/base.d.ts +12 -0
- package/lib/apps/base/api/base.js +56 -0
- package/lib/apps/base/api/index.d.ts +1 -0
- package/lib/apps/base/api/index.js +17 -0
- package/lib/apps/base/api/strava/api.d.ts +4 -0
- package/lib/apps/base/api/strava/api.js +16 -0
- package/lib/apps/base/api/strava/index.d.ts +1 -0
- package/lib/apps/base/api/strava/index.js +17 -0
- package/lib/apps/base/api/velohero/api.d.ts +2 -10
- package/lib/apps/base/api/velohero/api.js +13 -53
- package/lib/apps/base/api/velohero/index.d.ts +2 -0
- package/lib/apps/base/api/velohero/index.js +18 -0
- package/lib/routes/base/utils/route.js +1 -1
- package/package.json +1 -1
|
@@ -265,30 +265,44 @@ let ActivityRideService = (() => {
|
|
|
265
265
|
this.current.position = position;
|
|
266
266
|
}
|
|
267
267
|
onDeviceData(data) {
|
|
268
|
-
this.current
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
update
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (this.state === 'paused' && data.speed > 0 && this.current.isAutoResume) {
|
|
277
|
-
this.resume('system');
|
|
278
|
-
return;
|
|
268
|
+
if (!this.current)
|
|
269
|
+
return;
|
|
270
|
+
try {
|
|
271
|
+
this.current.tsDeviceData = Date.now();
|
|
272
|
+
const update = Object.assign({}, data);
|
|
273
|
+
if (data.distance < 0 || data.speed === 0) {
|
|
274
|
+
update.distance = 0;
|
|
275
|
+
update.speed = 0;
|
|
279
276
|
}
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
this.current.deviceData = Object.assign(Object.assign({}, this.current.deviceData), update);
|
|
278
|
+
if (this.state !== 'active') {
|
|
279
|
+
if (this.state === 'paused' && data.speed > 0 && this.current.isAutoResume) {
|
|
280
|
+
this.resume('system');
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (this.state === 'ininitalized' && data.speed > 0) {
|
|
284
|
+
this.start();
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
this.current.deviceData.speed = 0;
|
|
282
288
|
return;
|
|
283
289
|
}
|
|
284
|
-
|
|
285
|
-
|
|
290
|
+
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
this.logError(err, 'onDeviceData');
|
|
286
293
|
}
|
|
287
294
|
}
|
|
288
295
|
onDeviceHealthUpdate(udid, status, capabilities) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
296
|
+
if (!this.current)
|
|
297
|
+
return;
|
|
298
|
+
try {
|
|
299
|
+
capabilities.forEach(capability => {
|
|
300
|
+
this.current.dataState[capability.toLowerCase()] = status;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
catch (err) {
|
|
304
|
+
this.logError(err, 'onDeviceHealthUpdate');
|
|
305
|
+
}
|
|
292
306
|
}
|
|
293
307
|
emit(eventName, ...args) {
|
|
294
308
|
if (!this.observer)
|
|
@@ -488,28 +502,33 @@ let ActivityRideService = (() => {
|
|
|
488
502
|
}
|
|
489
503
|
update() {
|
|
490
504
|
var _a, _b;
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
try {
|
|
506
|
+
const prev = Math.floor(this.activity.time);
|
|
507
|
+
this.updateActivityState();
|
|
508
|
+
const time = Math.floor(this.activity.time);
|
|
509
|
+
if (time !== prev && this.state === 'active') {
|
|
510
|
+
const distance = this.current.routeDistance - ((_b = (_a = this.prevEmit) === null || _a === void 0 ? void 0 : _a.routeDistance) !== null && _b !== void 0 ? _b : 0);
|
|
511
|
+
const data = {
|
|
512
|
+
time: this.activity.time,
|
|
513
|
+
speed: this.current.deviceData.speed,
|
|
514
|
+
routeDistance: this.current.routeDistance,
|
|
515
|
+
distance
|
|
516
|
+
};
|
|
517
|
+
this.emit('data', data);
|
|
518
|
+
this.prevEmit = data;
|
|
519
|
+
const logRecord = this.createLogRecord();
|
|
520
|
+
if (logRecord) {
|
|
521
|
+
this.activity.logs.push(logRecord);
|
|
522
|
+
this.statsCalculator.add(logRecord);
|
|
523
|
+
}
|
|
524
|
+
this.activity.distance = this.current.routeDistance - this.activity.startPos;
|
|
525
|
+
this.activity.totalElevation = this.current.elevationGain;
|
|
526
|
+
this.logActivityUpdateMessage();
|
|
527
|
+
this.updateRepo();
|
|
508
528
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
this.
|
|
512
|
-
this.updateRepo();
|
|
529
|
+
}
|
|
530
|
+
catch (err) {
|
|
531
|
+
this.logError(err, 'update');
|
|
513
532
|
}
|
|
514
533
|
}
|
|
515
534
|
createFreeRide(settings) {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { IncyclistService } from "../../base/service";
|
|
2
2
|
import { ActivityDetails } from "../base";
|
|
3
3
|
import { VeloHeroAuth } from "./types";
|
|
4
|
-
import VeloHeroApi from "../../apps/base/api
|
|
4
|
+
import { VeloHeroApi } from "../../apps/base/api";
|
|
5
5
|
export declare class VeloHeroUpload extends IncyclistService {
|
|
6
6
|
protected isInitialized: any;
|
|
7
7
|
protected username: any;
|
|
8
8
|
protected password: any;
|
|
9
9
|
protected api: VeloHeroApi;
|
|
10
|
+
protected _isConnecting: any;
|
|
10
11
|
constructor();
|
|
11
12
|
init(): boolean;
|
|
12
13
|
isConnected(): boolean;
|
|
14
|
+
isConnecting(): any;
|
|
13
15
|
login(username: string, password: string): Promise<boolean>;
|
|
14
16
|
disconnect(): void;
|
|
15
17
|
upload(activity: ActivityDetails, format?: string): Promise<boolean>;
|
|
@@ -55,8 +55,8 @@ const service_1 = require("../../base/service");
|
|
|
55
55
|
const types_1 = require("../../base/types");
|
|
56
56
|
const settings_1 = require("../../settings");
|
|
57
57
|
const crypto_1 = __importDefault(require("crypto"));
|
|
58
|
-
const api_1 = __importDefault(require("../../apps/base/api/velohero/api"));
|
|
59
58
|
const valid_1 = require("../../utils/valid");
|
|
59
|
+
const api_1 = require("../../apps/base/api");
|
|
60
60
|
let VeloHeroUpload = (() => {
|
|
61
61
|
let _classDecorators = [types_1.Singleton];
|
|
62
62
|
let _classDescriptor;
|
|
@@ -92,11 +92,17 @@ let VeloHeroUpload = (() => {
|
|
|
92
92
|
this.logger.logEvent({ message: 'error', error: err.message, fn: 'init', stack: err.stack });
|
|
93
93
|
this.isInitialized = false;
|
|
94
94
|
}
|
|
95
|
+
this.on('login-start', () => { this._isConnecting = true; });
|
|
96
|
+
this.on('login-success', () => { this._isConnecting = false; });
|
|
97
|
+
this.on('login-failure', () => { this._isConnecting = false; });
|
|
95
98
|
return this.isInitialized;
|
|
96
99
|
}
|
|
97
100
|
isConnected() {
|
|
98
101
|
return ((0, valid_1.valid)(this.username) && (0, valid_1.valid)(this.password));
|
|
99
102
|
}
|
|
103
|
+
isConnecting() {
|
|
104
|
+
return this._isConnecting;
|
|
105
|
+
}
|
|
100
106
|
login(username, password) {
|
|
101
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
108
|
this.logger.logEvent({ message: 'VeloHero Login' });
|
|
@@ -114,7 +120,7 @@ let VeloHeroUpload = (() => {
|
|
|
114
120
|
catch (err) {
|
|
115
121
|
this.logger.logEvent({ message: 'VeloHero Login failed', error: err.message });
|
|
116
122
|
this.emit('login-failure');
|
|
117
|
-
|
|
123
|
+
throw err;
|
|
118
124
|
}
|
|
119
125
|
});
|
|
120
126
|
}
|
|
@@ -207,7 +213,7 @@ let VeloHeroUpload = (() => {
|
|
|
207
213
|
}
|
|
208
214
|
getApi() {
|
|
209
215
|
if (!this.api)
|
|
210
|
-
this.api = new api_1.
|
|
216
|
+
this.api = new api_1.VeloHeroApi();
|
|
211
217
|
return this.api;
|
|
212
218
|
}
|
|
213
219
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { Form } from "../../../api/form";
|
|
3
|
+
export declare class AppApiBase {
|
|
4
|
+
protected api: AxiosInstance;
|
|
5
|
+
protected getBaseUrl(): string;
|
|
6
|
+
protected get(url: string, config?: object): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
+
protected postForm(form: Form): Promise<any>;
|
|
8
|
+
protected createForm(url: string, uploadInfo: object): Promise<Form>;
|
|
9
|
+
protected getApi(): AxiosInstance;
|
|
10
|
+
protected getUserSettings(): import("../../../settings").UserSettingsService;
|
|
11
|
+
protected getFormBinding(): import("../../../api/form").IFormPostBinding;
|
|
12
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AppApiBase = void 0;
|
|
13
|
+
const api_1 = require("../../../api");
|
|
14
|
+
const settings_1 = require("../../../settings");
|
|
15
|
+
class AppApiBase {
|
|
16
|
+
getBaseUrl() {
|
|
17
|
+
throw new Error('not implemented');
|
|
18
|
+
}
|
|
19
|
+
get(url, config) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const props = config !== null && config !== void 0 ? config : {};
|
|
22
|
+
const request = Object.assign({ method: 'get', url: this.getBaseUrl() + url, validateStatus: (status) => {
|
|
23
|
+
return (status >= 200 && status < 300) || status === 403;
|
|
24
|
+
} }, props);
|
|
25
|
+
return yield this.getApi().request(request);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
postForm(form) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const fp = this.getFormBinding();
|
|
31
|
+
return yield fp.post(form);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
createForm(url, uploadInfo) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const fp = this.getFormBinding();
|
|
37
|
+
const form = yield fp.createForm({ uri: this.getBaseUrl() + url }, uploadInfo);
|
|
38
|
+
return form;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
getApi() {
|
|
42
|
+
if (!this.api) {
|
|
43
|
+
this.api = api_1.RestApiClient.getClient();
|
|
44
|
+
return this.api;
|
|
45
|
+
}
|
|
46
|
+
return this.api;
|
|
47
|
+
}
|
|
48
|
+
getUserSettings() {
|
|
49
|
+
return (0, settings_1.useUserSettings)();
|
|
50
|
+
}
|
|
51
|
+
getFormBinding() {
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = (0, api_1.getBindings)()) === null || _a === void 0 ? void 0 : _a.form;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.AppApiBase = AppApiBase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './velohero';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
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]; } };
|
|
7
|
+
}
|
|
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);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./velohero"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StravaApi = void 0;
|
|
4
|
+
const base_1 = require("../base");
|
|
5
|
+
const BASE_URL = 'https://www.strava.com/api/v3';
|
|
6
|
+
class StravaApi extends base_1.AppApiBase {
|
|
7
|
+
getBaseUrl() {
|
|
8
|
+
try {
|
|
9
|
+
return this.getUserSettings().get('STRAVA_API', BASE_URL);
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
return BASE_URL;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.StravaApi = StravaApi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
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]; } };
|
|
7
|
+
}
|
|
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);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
1
|
import { VeloHeroAccountType, VeloHeroLoginReponse, VeloHeroUploadProps } from './types';
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
protected api: AxiosInstance;
|
|
2
|
+
import { AppApiBase } from '../base';
|
|
3
|
+
export declare class VeloHeroApi extends AppApiBase {
|
|
6
4
|
protected username: string;
|
|
7
5
|
protected password: string;
|
|
8
6
|
protected loginResponse: VeloHeroLoginReponse;
|
|
@@ -11,10 +9,4 @@ export default class VeloHeroApi {
|
|
|
11
9
|
isAuthenticated(): boolean;
|
|
12
10
|
upload(fileName: string, props?: VeloHeroUploadProps): Promise<boolean>;
|
|
13
11
|
protected getBaseUrl(): any;
|
|
14
|
-
protected get(url: string, config?: object): Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
|
-
protected postForm(form: Form): Promise<any>;
|
|
16
|
-
protected createForm(url: string, uploadInfo: object): Promise<Form>;
|
|
17
|
-
protected getApi(): AxiosInstance;
|
|
18
|
-
protected getUserSettings(): import("../../../../settings").UserSettingsService;
|
|
19
|
-
protected getFormBinding(): import("../../../../api/form").IFormPostBinding;
|
|
20
12
|
}
|
|
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
|
|
13
|
-
const settings_1 = require("../../../../settings");
|
|
12
|
+
exports.VeloHeroApi = void 0;
|
|
14
13
|
const valid_1 = require("../../../../utils/valid");
|
|
14
|
+
const base_1 = require("../base");
|
|
15
15
|
const BASE_URL = 'https://app.velohero.com';
|
|
16
|
-
class VeloHeroApi {
|
|
16
|
+
class VeloHeroApi extends base_1.AppApiBase {
|
|
17
17
|
login(username, password) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
try {
|
|
@@ -38,6 +38,8 @@ class VeloHeroApi {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
catch (err) {
|
|
41
|
+
if (err.message === 'invalid credentials')
|
|
42
|
+
throw err;
|
|
41
43
|
let error = `Internal error: ${err.message}`;
|
|
42
44
|
if (err.response) {
|
|
43
45
|
const { response } = err;
|
|
@@ -70,65 +72,23 @@ class VeloHeroApi {
|
|
|
70
72
|
pass: password,
|
|
71
73
|
view: 'json'
|
|
72
74
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
throw new Error(((_e = (_d = (_c = response.error) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.error) || response.error.message || response.error || `HTTP error ${response.status}`);
|
|
81
|
-
}
|
|
75
|
+
const form = yield this.createForm('/upload/file', uploadInfo);
|
|
76
|
+
const response = yield this.postForm(form);
|
|
77
|
+
if (response.data && !response.error) {
|
|
78
|
+
return true;
|
|
82
79
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
throw err;
|
|
80
|
+
else {
|
|
81
|
+
throw new Error(((_e = (_d = (_c = response.error) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.error) || response.error.message || response.error || `HTTP error ${response.status}`);
|
|
86
82
|
}
|
|
87
83
|
});
|
|
88
84
|
}
|
|
89
85
|
getBaseUrl() {
|
|
90
86
|
try {
|
|
91
|
-
return
|
|
87
|
+
return this.getUserSettings().get('VELOHERO_API', BASE_URL);
|
|
92
88
|
}
|
|
93
89
|
catch (_a) {
|
|
94
90
|
return BASE_URL;
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
|
-
get(url, config) {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const props = config !== null && config !== void 0 ? config : {};
|
|
100
|
-
const request = Object.assign({ method: 'get', url: this.getBaseUrl() + url, validateStatus: (status) => {
|
|
101
|
-
return (status >= 200 && status < 300) || status === 403;
|
|
102
|
-
} }, props);
|
|
103
|
-
return yield this.getApi().request(request);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
postForm(form) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const fp = this.getFormBinding();
|
|
109
|
-
return yield fp.post(form);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
createForm(url, uploadInfo) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
const fp = this.getFormBinding();
|
|
115
|
-
const form = yield fp.createForm({ uri: this.getBaseUrl() + url }, uploadInfo);
|
|
116
|
-
return form;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
getApi() {
|
|
120
|
-
if (!this.api) {
|
|
121
|
-
this.api = api_1.RestApiClient.getClient();
|
|
122
|
-
return this.api;
|
|
123
|
-
}
|
|
124
|
-
return this.api;
|
|
125
|
-
}
|
|
126
|
-
getUserSettings() {
|
|
127
|
-
return (0, settings_1.useUserSettings)();
|
|
128
|
-
}
|
|
129
|
-
getFormBinding() {
|
|
130
|
-
var _a;
|
|
131
|
-
return (_a = (0, api_1.getBindings)()) === null || _a === void 0 ? void 0 : _a.form;
|
|
132
|
-
}
|
|
133
93
|
}
|
|
134
|
-
exports.
|
|
94
|
+
exports.VeloHeroApi = VeloHeroApi;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
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]; } };
|
|
7
|
+
}
|
|
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);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -257,7 +257,7 @@ const getNextPosition = (route, props) => {
|
|
|
257
257
|
const targetRouteDistance = props.routeDistance !== undefined ? props.routeDistance : getLapTotalDistance(route, props.prev) + distance;
|
|
258
258
|
let pPrev = props.prev || Object.assign(Object.assign({}, points[0]), { lap: 1 });
|
|
259
259
|
let point, p;
|
|
260
|
-
let lap = (0, valid_1.valid)(pPrev.lap) ? pPrev.lap : 1;
|
|
260
|
+
let lap = (0, valid_1.valid)(pPrev === null || pPrev === void 0 ? void 0 : pPrev.lap) ? pPrev.lap : 1;
|
|
261
261
|
let cnt = ((_a = props.prev) === null || _a === void 0 ? void 0 : _a.cnt) || 0;
|
|
262
262
|
let targetRouteInLap;
|
|
263
263
|
if ((0, exports.checkIsLoop)(route)) {
|