@sports-alliance/sports-lib 7.2.3 → 7.2.4
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/cjs/data/data.event.d.ts +1 -0
- package/lib/cjs/data/data.event.js +3 -0
- package/lib/cjs/data/data.jump-event.d.ts +26 -10
- package/lib/cjs/data/data.jump-event.js +52 -5
- package/lib/cjs/data/data.jump-event.spec.d.ts +1 -0
- package/lib/cjs/data/data.jump-event.spec.js +82 -0
- package/lib/cjs/data/data.rider-position-change-event.d.ts +4 -1
- package/lib/cjs/data/data.rider-position-change-event.js +9 -3
- package/lib/cjs/data/data.store.js +2 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.mtb.spec.js +8 -8
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +2 -0
- package/lib/esm/data/data.event.d.ts +1 -0
- package/lib/esm/data/data.jump-event.d.ts +26 -10
- package/lib/esm/data/data.jump-event.spec.d.ts +1 -0
- package/lib/esm/data/data.rider-position-change-event.d.ts +4 -1
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +61 -9
- package/package.json +1 -1
|
@@ -3,5 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DataEvent = void 0;
|
|
4
4
|
const data_number_1 = require("./data.number");
|
|
5
5
|
class DataEvent extends data_number_1.DataNumber {
|
|
6
|
+
get timestamp() {
|
|
7
|
+
return this.getValue();
|
|
8
|
+
}
|
|
6
9
|
}
|
|
7
10
|
exports.DataEvent = DataEvent;
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import { DataEvent } from './data.event';
|
|
2
|
+
import { DataDistance } from './data.distance';
|
|
3
|
+
import { DataSpeed } from './data.speed';
|
|
4
|
+
import { DataDuration } from './data.duration';
|
|
5
|
+
import { DataNumber } from './data.number';
|
|
6
|
+
import { DataLatitudeDegrees } from './data.latitude-degrees';
|
|
7
|
+
import { DataLongitudeDegrees } from './data.longitude-degrees';
|
|
8
|
+
export declare class DataScore extends DataNumber {
|
|
9
|
+
static type: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class DataRotations extends DataNumber {
|
|
12
|
+
static type: string;
|
|
13
|
+
}
|
|
2
14
|
export interface JumpEventInterface {
|
|
3
|
-
distance:
|
|
4
|
-
height?:
|
|
5
|
-
score:
|
|
6
|
-
hang_time?:
|
|
7
|
-
position_lat?:
|
|
8
|
-
position_long?:
|
|
9
|
-
speed?:
|
|
10
|
-
rotations?:
|
|
15
|
+
distance: DataDistance;
|
|
16
|
+
height?: DataDistance;
|
|
17
|
+
score: DataScore;
|
|
18
|
+
hang_time?: DataDuration;
|
|
19
|
+
position_lat?: DataLatitudeDegrees;
|
|
20
|
+
position_long?: DataLongitudeDegrees;
|
|
21
|
+
speed?: DataSpeed;
|
|
22
|
+
rotations?: DataRotations;
|
|
11
23
|
}
|
|
12
24
|
export declare class DataJumpEvent extends DataEvent {
|
|
13
|
-
jumpData: JumpEventInterface;
|
|
14
25
|
static type: string;
|
|
15
|
-
|
|
26
|
+
jumpData: JumpEventInterface;
|
|
27
|
+
constructor(timestampOrObj: number | {
|
|
28
|
+
timestamp: number;
|
|
29
|
+
jumpData: any;
|
|
30
|
+
}, jumpData?: any);
|
|
31
|
+
private hydrate;
|
|
16
32
|
toJSON(): any;
|
|
17
33
|
}
|
|
@@ -1,15 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataJumpEvent = void 0;
|
|
3
|
+
exports.DataJumpEvent = exports.DataRotations = exports.DataScore = void 0;
|
|
4
4
|
const data_event_1 = require("./data.event");
|
|
5
|
+
const data_distance_1 = require("./data.distance");
|
|
6
|
+
const data_speed_1 = require("./data.speed");
|
|
7
|
+
const data_duration_1 = require("./data.duration");
|
|
8
|
+
const data_number_1 = require("./data.number");
|
|
9
|
+
const data_latitude_degrees_1 = require("./data.latitude-degrees");
|
|
10
|
+
const data_longitude_degrees_1 = require("./data.longitude-degrees");
|
|
11
|
+
class DataScore extends data_number_1.DataNumber {
|
|
12
|
+
}
|
|
13
|
+
exports.DataScore = DataScore;
|
|
14
|
+
DataScore.type = 'Score';
|
|
15
|
+
class DataRotations extends data_number_1.DataNumber {
|
|
16
|
+
}
|
|
17
|
+
exports.DataRotations = DataRotations;
|
|
18
|
+
DataRotations.type = 'Rotations';
|
|
5
19
|
class DataJumpEvent extends data_event_1.DataEvent {
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
8
|
-
|
|
20
|
+
constructor(timestampOrObj, jumpData) {
|
|
21
|
+
if (typeof timestampOrObj === 'object') {
|
|
22
|
+
super(timestampOrObj.timestamp);
|
|
23
|
+
this.jumpData = this.hydrate(timestampOrObj.jumpData);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
super(timestampOrObj);
|
|
27
|
+
this.jumpData = this.hydrate(jumpData);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
hydrate(data) {
|
|
31
|
+
return {
|
|
32
|
+
distance: data.distance instanceof data_distance_1.DataDistance ? data.distance : new data_distance_1.DataDistance(data.distance),
|
|
33
|
+
height: data.height ? (data.height instanceof data_distance_1.DataDistance ? data.height : new data_distance_1.DataDistance(data.height)) : undefined,
|
|
34
|
+
score: data.score instanceof DataScore ? data.score : new DataScore(data.score),
|
|
35
|
+
hang_time: data.hang_time ? (data.hang_time instanceof data_duration_1.DataDuration ? data.hang_time : new data_duration_1.DataDuration(data.hang_time)) : undefined,
|
|
36
|
+
position_lat: data.position_lat ? (data.position_lat instanceof data_latitude_degrees_1.DataLatitudeDegrees ? data.position_lat : new data_latitude_degrees_1.DataLatitudeDegrees(data.position_lat)) : undefined,
|
|
37
|
+
position_long: data.position_long ? (data.position_long instanceof data_longitude_degrees_1.DataLongitudeDegrees ? data.position_long : new data_longitude_degrees_1.DataLongitudeDegrees(data.position_long)) : undefined,
|
|
38
|
+
speed: data.speed ? (data.speed instanceof data_speed_1.DataSpeed ? data.speed : new data_speed_1.DataSpeed(data.speed)) : undefined,
|
|
39
|
+
rotations: data.rotations ? (data.rotations instanceof DataRotations ? data.rotations : new DataRotations(data.rotations)) : undefined,
|
|
40
|
+
};
|
|
9
41
|
}
|
|
10
42
|
toJSON() {
|
|
43
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
44
|
const json = super.toJSON();
|
|
12
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
[DataJumpEvent.type]: {
|
|
47
|
+
timestamp: this.getValue(),
|
|
48
|
+
jumpData: {
|
|
49
|
+
distance: this.jumpData.distance.getValue(),
|
|
50
|
+
height: (_a = this.jumpData.height) === null || _a === void 0 ? void 0 : _a.getValue(),
|
|
51
|
+
score: this.jumpData.score.getValue(),
|
|
52
|
+
hang_time: (_b = this.jumpData.hang_time) === null || _b === void 0 ? void 0 : _b.getValue(),
|
|
53
|
+
position_lat: (_c = this.jumpData.position_lat) === null || _c === void 0 ? void 0 : _c.getValue(),
|
|
54
|
+
position_long: (_d = this.jumpData.position_long) === null || _d === void 0 ? void 0 : _d.getValue(),
|
|
55
|
+
speed: (_e = this.jumpData.speed) === null || _e === void 0 ? void 0 : _e.getValue(),
|
|
56
|
+
rotations: (_f = this.jumpData.rotations) === null || _f === void 0 ? void 0 : _f.getValue(),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
13
60
|
}
|
|
14
61
|
}
|
|
15
62
|
exports.DataJumpEvent = DataJumpEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const data_jump_event_1 = require("./data.jump-event");
|
|
4
|
+
const data_distance_1 = require("./data.distance");
|
|
5
|
+
const data_speed_1 = require("./data.speed");
|
|
6
|
+
const data_duration_1 = require("./data.duration");
|
|
7
|
+
const data_latitude_degrees_1 = require("./data.latitude-degrees");
|
|
8
|
+
const data_longitude_degrees_1 = require("./data.longitude-degrees");
|
|
9
|
+
describe('DataJumpEvent', () => {
|
|
10
|
+
const timestamp = 1234567890;
|
|
11
|
+
// Manual creation requires Data objects
|
|
12
|
+
const jumpData = {
|
|
13
|
+
distance: new data_distance_1.DataDistance(5.5),
|
|
14
|
+
height: new data_distance_1.DataDistance(1.2),
|
|
15
|
+
score: new data_jump_event_1.DataScore(85),
|
|
16
|
+
hang_time: new data_duration_1.DataDuration(0.8),
|
|
17
|
+
position_lat: new data_latitude_degrees_1.DataLatitudeDegrees(40.7128),
|
|
18
|
+
position_long: new data_longitude_degrees_1.DataLongitudeDegrees(-74.0060),
|
|
19
|
+
speed: new data_speed_1.DataSpeed(15.2),
|
|
20
|
+
rotations: new data_jump_event_1.DataRotations(0)
|
|
21
|
+
};
|
|
22
|
+
it('should be created using constructor with separate arguments (Manual)', () => {
|
|
23
|
+
const jumpEvent = new data_jump_event_1.DataJumpEvent(timestamp, jumpData);
|
|
24
|
+
expect(jumpEvent.getType()).toBe('Jump Event');
|
|
25
|
+
expect(jumpEvent.getValue()).toBe(timestamp);
|
|
26
|
+
// Expect exact object match
|
|
27
|
+
expect(jumpEvent.jumpData).toEqual(jumpData);
|
|
28
|
+
});
|
|
29
|
+
it('should be created using constructor with object argument (Manual Object)', () => {
|
|
30
|
+
const jumpEvent = new data_jump_event_1.DataJumpEvent({ timestamp, jumpData });
|
|
31
|
+
expect(jumpEvent.getType()).toBe('Jump Event');
|
|
32
|
+
expect(jumpEvent.getValue()).toBe(timestamp);
|
|
33
|
+
expect(jumpEvent.jumpData).toEqual(jumpData);
|
|
34
|
+
});
|
|
35
|
+
it('should serialize to JSON correctly', () => {
|
|
36
|
+
const jumpEvent = new data_jump_event_1.DataJumpEvent(timestamp, jumpData);
|
|
37
|
+
const json = jumpEvent.toJSON();
|
|
38
|
+
// toJSON output should be simple values
|
|
39
|
+
expect(json).toEqual({
|
|
40
|
+
'Jump Event': {
|
|
41
|
+
timestamp: timestamp,
|
|
42
|
+
jumpData: {
|
|
43
|
+
distance: 5.5,
|
|
44
|
+
height: 1.2,
|
|
45
|
+
score: 85,
|
|
46
|
+
hang_time: 0.8,
|
|
47
|
+
position_lat: 40.7128,
|
|
48
|
+
position_long: -74.0060,
|
|
49
|
+
speed: 15.2,
|
|
50
|
+
rotations: 0
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
it('should hydrate from JSON object correctly (simulating generic importer)', () => {
|
|
56
|
+
// Generic importer passes primitive values
|
|
57
|
+
const jsonValue = {
|
|
58
|
+
timestamp,
|
|
59
|
+
jumpData: {
|
|
60
|
+
distance: 5.5,
|
|
61
|
+
height: 1.2,
|
|
62
|
+
score: 85,
|
|
63
|
+
hang_time: 0.8,
|
|
64
|
+
position_lat: 40.7128,
|
|
65
|
+
position_long: -74.0060,
|
|
66
|
+
speed: 15.2,
|
|
67
|
+
rotations: 0
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// Constructor should hydrate primitives into Data objects
|
|
71
|
+
const jumpEvent = new data_jump_event_1.DataJumpEvent(jsonValue);
|
|
72
|
+
expect(jumpEvent.getType()).toBe('Jump Event');
|
|
73
|
+
expect(jumpEvent.getValue()).toBe(timestamp);
|
|
74
|
+
// Assertions check if properties are converted to Data objects
|
|
75
|
+
expect(jumpEvent.jumpData.distance).toBeInstanceOf(data_distance_1.DataDistance);
|
|
76
|
+
expect(jumpEvent.jumpData.distance.getValue()).toBe(5.5);
|
|
77
|
+
expect(jumpEvent.jumpData.score).toBeInstanceOf(data_jump_event_1.DataScore);
|
|
78
|
+
expect(jumpEvent.jumpData.score.getValue()).toBe(85);
|
|
79
|
+
expect(jumpEvent.jumpData.speed).toBeInstanceOf(data_speed_1.DataSpeed);
|
|
80
|
+
expect(jumpEvent.jumpData.speed.getValue()).toBe(15.2);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -3,5 +3,8 @@ import { RiderPosition } from './data.cycling-position';
|
|
|
3
3
|
export declare class DataRiderPositionChangeEvent extends DataEvent {
|
|
4
4
|
static type: string;
|
|
5
5
|
positionChange: RiderPosition;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(indexOrObj: number | {
|
|
7
|
+
index: number;
|
|
8
|
+
positionChange: RiderPosition;
|
|
9
|
+
}, positionChange?: RiderPosition);
|
|
7
10
|
}
|
|
@@ -3,9 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DataRiderPositionChangeEvent = void 0;
|
|
4
4
|
const data_event_1 = require("./data.event");
|
|
5
5
|
class DataRiderPositionChangeEvent extends data_event_1.DataEvent {
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
constructor(indexOrObj, positionChange) {
|
|
7
|
+
if (typeof indexOrObj === 'object') {
|
|
8
|
+
super(indexOrObj.index);
|
|
9
|
+
this.positionChange = indexOrObj.positionChange;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
super(indexOrObj);
|
|
13
|
+
this.positionChange = positionChange;
|
|
14
|
+
}
|
|
9
15
|
}
|
|
10
16
|
}
|
|
11
17
|
exports.DataRiderPositionChangeEvent = DataRiderPositionChangeEvent;
|
|
@@ -501,6 +501,8 @@ exports.DataStore = {
|
|
|
501
501
|
DataGrit: data_grit_1.DataGrit,
|
|
502
502
|
DataJumpCount: data_jump_count_1.DataJumpCount,
|
|
503
503
|
DataJumpEvent: data_jump_event_1.DataJumpEvent,
|
|
504
|
+
DataScore: data_jump_event_1.DataScore,
|
|
505
|
+
DataRotations: data_jump_event_1.DataRotations,
|
|
504
506
|
DataLeftPedalSmoothness: data_left_pedal_smoothness_1.DataLeftPedalSmoothness,
|
|
505
507
|
DataLeftTorqueEffectiveness: data_left_torque_effectiveness_1.DataLeftTorqueEffectiveness,
|
|
506
508
|
DataMaxRespirationRate: data_max_respiration_rate_1.DataMaxRespirationRate,
|
|
@@ -198,15 +198,15 @@ describe('EventImporterFIT MTB Jumps', () => {
|
|
|
198
198
|
expect(jumpEvents.length).toBe(11);
|
|
199
199
|
const jump = jumpEvents[0];
|
|
200
200
|
expect(jump.jumpData).toBeDefined();
|
|
201
|
-
expect((0, helpers_1.isNumber)(jump.jumpData.distance)).toBeTruthy();
|
|
202
|
-
expect((0, helpers_1.isNumber)(jump.jumpData.score)).toBeTruthy();
|
|
201
|
+
expect((0, helpers_1.isNumber)(jump.jumpData.distance.getValue())).toBeTruthy();
|
|
202
|
+
expect((0, helpers_1.isNumber)(jump.jumpData.score.getValue())).toBeTruthy();
|
|
203
203
|
// Verify new jump fields with expected values
|
|
204
|
-
expect(jump.jumpData.distance).toBeCloseTo(2.069, 2);
|
|
205
|
-
expect(jump.jumpData.hang_time).toBeCloseTo(0.36, 2);
|
|
206
|
-
expect(jump.jumpData.score).toBeCloseTo(62.44, 1);
|
|
207
|
-
expect(jump.jumpData.position_lat).toBeCloseTo(39.6679, 3);
|
|
208
|
-
expect(jump.jumpData.position_long).toBeCloseTo(20.8382, 3);
|
|
209
|
-
expect(jump.jumpData.speed).toBeCloseTo(5.748, 2);
|
|
204
|
+
expect(jump.jumpData.distance.getValue()).toBeCloseTo(2.069, 2);
|
|
205
|
+
expect(jump.jumpData.hang_time.getValue()).toBeCloseTo(0.36, 2);
|
|
206
|
+
expect(jump.jumpData.score.getValue()).toBeCloseTo(62.44, 1);
|
|
207
|
+
expect(jump.jumpData.position_lat.getValue()).toBeCloseTo(39.6679, 3);
|
|
208
|
+
expect(jump.jumpData.position_long.getValue()).toBeCloseTo(20.8382, 3);
|
|
209
|
+
expect(jump.jumpData.speed.getValue()).toBeCloseTo(5.748, 2);
|
|
210
210
|
console.log(`Found ${jumpEvents.length} jumps.`);
|
|
211
211
|
console.log('First jump:', jump.jumpData);
|
|
212
212
|
// Verify Jump Statistics (Min, Max, Avg)
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export * from './data/data.heart-rate-avg';
|
|
|
71
71
|
export * from './data/data.heart-rate-max';
|
|
72
72
|
export * from './data/data.heart-rate-min';
|
|
73
73
|
export * from './data/data.ibi';
|
|
74
|
+
export * from './data/data.event';
|
|
75
|
+
export * from './data/data.jump-event';
|
|
74
76
|
export * from './data/data.interface';
|
|
75
77
|
export * from './data/data.latitude-degrees';
|
|
76
78
|
export * from './data/data.left-balance';
|
package/lib/cjs/index.js
CHANGED
|
@@ -101,6 +101,8 @@ __exportStar(require("./data/data.heart-rate-avg"), exports);
|
|
|
101
101
|
__exportStar(require("./data/data.heart-rate-max"), exports);
|
|
102
102
|
__exportStar(require("./data/data.heart-rate-min"), exports);
|
|
103
103
|
__exportStar(require("./data/data.ibi"), exports);
|
|
104
|
+
__exportStar(require("./data/data.event"), exports);
|
|
105
|
+
__exportStar(require("./data/data.jump-event"), exports);
|
|
104
106
|
__exportStar(require("./data/data.interface"), exports);
|
|
105
107
|
__exportStar(require("./data/data.latitude-degrees"), exports);
|
|
106
108
|
__exportStar(require("./data/data.left-balance"), exports);
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import { DataEvent } from './data.event';
|
|
2
|
+
import { DataDistance } from './data.distance';
|
|
3
|
+
import { DataSpeed } from './data.speed';
|
|
4
|
+
import { DataDuration } from './data.duration';
|
|
5
|
+
import { DataNumber } from './data.number';
|
|
6
|
+
import { DataLatitudeDegrees } from './data.latitude-degrees';
|
|
7
|
+
import { DataLongitudeDegrees } from './data.longitude-degrees';
|
|
8
|
+
export declare class DataScore extends DataNumber {
|
|
9
|
+
static type: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class DataRotations extends DataNumber {
|
|
12
|
+
static type: string;
|
|
13
|
+
}
|
|
2
14
|
export interface JumpEventInterface {
|
|
3
|
-
distance:
|
|
4
|
-
height?:
|
|
5
|
-
score:
|
|
6
|
-
hang_time?:
|
|
7
|
-
position_lat?:
|
|
8
|
-
position_long?:
|
|
9
|
-
speed?:
|
|
10
|
-
rotations?:
|
|
15
|
+
distance: DataDistance;
|
|
16
|
+
height?: DataDistance;
|
|
17
|
+
score: DataScore;
|
|
18
|
+
hang_time?: DataDuration;
|
|
19
|
+
position_lat?: DataLatitudeDegrees;
|
|
20
|
+
position_long?: DataLongitudeDegrees;
|
|
21
|
+
speed?: DataSpeed;
|
|
22
|
+
rotations?: DataRotations;
|
|
11
23
|
}
|
|
12
24
|
export declare class DataJumpEvent extends DataEvent {
|
|
13
|
-
jumpData: JumpEventInterface;
|
|
14
25
|
static type: string;
|
|
15
|
-
|
|
26
|
+
jumpData: JumpEventInterface;
|
|
27
|
+
constructor(timestampOrObj: number | {
|
|
28
|
+
timestamp: number;
|
|
29
|
+
jumpData: any;
|
|
30
|
+
}, jumpData?: any);
|
|
31
|
+
private hydrate;
|
|
16
32
|
toJSON(): any;
|
|
17
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,5 +3,8 @@ import { RiderPosition } from './data.cycling-position';
|
|
|
3
3
|
export declare class DataRiderPositionChangeEvent extends DataEvent {
|
|
4
4
|
static type: string;
|
|
5
5
|
positionChange: RiderPosition;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(indexOrObj: number | {
|
|
7
|
+
index: number;
|
|
8
|
+
positionChange: RiderPosition;
|
|
9
|
+
}, positionChange?: RiderPosition);
|
|
7
10
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export * from './data/data.heart-rate-avg';
|
|
|
71
71
|
export * from './data/data.heart-rate-max';
|
|
72
72
|
export * from './data/data.heart-rate-min';
|
|
73
73
|
export * from './data/data.ibi';
|
|
74
|
+
export * from './data/data.event';
|
|
75
|
+
export * from './data/data.jump-event';
|
|
74
76
|
export * from './data/data.interface';
|
|
75
77
|
export * from './data/data.latitude-degrees';
|
|
76
78
|
export * from './data/data.left-balance';
|
package/lib/esm/index.js
CHANGED
|
@@ -3488,6 +3488,9 @@ var DataStepsOld = class extends DataNumber {
|
|
|
3488
3488
|
|
|
3489
3489
|
// src/data/data.event.ts
|
|
3490
3490
|
var DataEvent = class extends DataNumber {
|
|
3491
|
+
get timestamp() {
|
|
3492
|
+
return this.getValue();
|
|
3493
|
+
}
|
|
3491
3494
|
};
|
|
3492
3495
|
|
|
3493
3496
|
// src/data/data.stop-event.ts
|
|
@@ -3692,9 +3695,14 @@ var DataRiderPositionChangeEvent = class extends DataEvent {
|
|
|
3692
3695
|
static {
|
|
3693
3696
|
this.type = "Rider Position Change Event";
|
|
3694
3697
|
}
|
|
3695
|
-
constructor(
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
+
constructor(indexOrObj, positionChange) {
|
|
3699
|
+
if (typeof indexOrObj === "object") {
|
|
3700
|
+
super(indexOrObj.index);
|
|
3701
|
+
this.positionChange = indexOrObj.positionChange;
|
|
3702
|
+
} else {
|
|
3703
|
+
super(indexOrObj);
|
|
3704
|
+
this.positionChange = positionChange;
|
|
3705
|
+
}
|
|
3698
3706
|
}
|
|
3699
3707
|
};
|
|
3700
3708
|
|
|
@@ -3890,19 +3898,57 @@ var DataJumpCount = class extends DataNumber {
|
|
|
3890
3898
|
};
|
|
3891
3899
|
|
|
3892
3900
|
// src/data/data.jump-event.ts
|
|
3893
|
-
var
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
this.jumpData = jumpData;
|
|
3901
|
+
var DataScore = class extends DataNumber {
|
|
3902
|
+
static {
|
|
3903
|
+
this.type = "Score";
|
|
3897
3904
|
}
|
|
3905
|
+
};
|
|
3906
|
+
var DataRotations = class extends DataNumber {
|
|
3907
|
+
static {
|
|
3908
|
+
this.type = "Rotations";
|
|
3909
|
+
}
|
|
3910
|
+
};
|
|
3911
|
+
var DataJumpEvent = class _DataJumpEvent extends DataEvent {
|
|
3898
3912
|
static {
|
|
3899
3913
|
this.type = "Jump Event";
|
|
3900
3914
|
}
|
|
3915
|
+
constructor(timestampOrObj, jumpData) {
|
|
3916
|
+
if (typeof timestampOrObj === "object") {
|
|
3917
|
+
super(timestampOrObj.timestamp);
|
|
3918
|
+
this.jumpData = this.hydrate(timestampOrObj.jumpData);
|
|
3919
|
+
} else {
|
|
3920
|
+
super(timestampOrObj);
|
|
3921
|
+
this.jumpData = this.hydrate(jumpData);
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
hydrate(data) {
|
|
3925
|
+
return {
|
|
3926
|
+
distance: data.distance instanceof DataDistance ? data.distance : new DataDistance(data.distance),
|
|
3927
|
+
height: data.height ? data.height instanceof DataDistance ? data.height : new DataDistance(data.height) : void 0,
|
|
3928
|
+
score: data.score instanceof DataScore ? data.score : new DataScore(data.score),
|
|
3929
|
+
hang_time: data.hang_time ? data.hang_time instanceof DataDuration ? data.hang_time : new DataDuration(data.hang_time) : void 0,
|
|
3930
|
+
position_lat: data.position_lat ? data.position_lat instanceof DataLatitudeDegrees ? data.position_lat : new DataLatitudeDegrees(data.position_lat) : void 0,
|
|
3931
|
+
position_long: data.position_long ? data.position_long instanceof DataLongitudeDegrees ? data.position_long : new DataLongitudeDegrees(data.position_long) : void 0,
|
|
3932
|
+
speed: data.speed ? data.speed instanceof DataSpeed ? data.speed : new DataSpeed(data.speed) : void 0,
|
|
3933
|
+
rotations: data.rotations ? data.rotations instanceof DataRotations ? data.rotations : new DataRotations(data.rotations) : void 0
|
|
3934
|
+
};
|
|
3935
|
+
}
|
|
3901
3936
|
toJSON() {
|
|
3902
3937
|
const json = super.toJSON();
|
|
3903
3938
|
return {
|
|
3904
|
-
|
|
3905
|
-
|
|
3939
|
+
[_DataJumpEvent.type]: {
|
|
3940
|
+
timestamp: this.getValue(),
|
|
3941
|
+
jumpData: {
|
|
3942
|
+
distance: this.jumpData.distance.getValue(),
|
|
3943
|
+
height: this.jumpData.height?.getValue(),
|
|
3944
|
+
score: this.jumpData.score.getValue(),
|
|
3945
|
+
hang_time: this.jumpData.hang_time?.getValue(),
|
|
3946
|
+
position_lat: this.jumpData.position_lat?.getValue(),
|
|
3947
|
+
position_long: this.jumpData.position_long?.getValue(),
|
|
3948
|
+
speed: this.jumpData.speed?.getValue(),
|
|
3949
|
+
rotations: this.jumpData.rotations?.getValue()
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3906
3952
|
};
|
|
3907
3953
|
}
|
|
3908
3954
|
};
|
|
@@ -4627,6 +4673,8 @@ var DataStore = {
|
|
|
4627
4673
|
DataGrit,
|
|
4628
4674
|
DataJumpCount,
|
|
4629
4675
|
DataJumpEvent,
|
|
4676
|
+
DataScore,
|
|
4677
|
+
DataRotations,
|
|
4630
4678
|
DataLeftPedalSmoothness,
|
|
4631
4679
|
DataLeftTorqueEffectiveness,
|
|
4632
4680
|
DataMaxRespirationRate,
|
|
@@ -12910,6 +12958,7 @@ export {
|
|
|
12910
12958
|
DataEPOC,
|
|
12911
12959
|
DataEVPE,
|
|
12912
12960
|
DataEnergy,
|
|
12961
|
+
DataEvent,
|
|
12913
12962
|
DataFeeling,
|
|
12914
12963
|
DataGPSAltitude,
|
|
12915
12964
|
DataGradeAdjustedPace,
|
|
@@ -12935,6 +12984,7 @@ export {
|
|
|
12935
12984
|
DataHeartRateMax,
|
|
12936
12985
|
DataHeartRateMin,
|
|
12937
12986
|
DataIBI,
|
|
12987
|
+
DataJumpEvent,
|
|
12938
12988
|
DataLatitudeDegrees,
|
|
12939
12989
|
DataLeftBalance,
|
|
12940
12990
|
DataLeftPedalSmoothness,
|
|
@@ -12958,6 +13008,8 @@ export {
|
|
|
12958
13008
|
DataRightBalance,
|
|
12959
13009
|
DataRightPedalSmoothness,
|
|
12960
13010
|
DataRightTorqueEffectiveness,
|
|
13011
|
+
DataRotations,
|
|
13012
|
+
DataScore,
|
|
12961
13013
|
DataSeaLevelPressure,
|
|
12962
13014
|
DataSpeed,
|
|
12963
13015
|
DataSpeedAvg,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sports-alliance/sports-lib",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.4",
|
|
4
4
|
"description": "A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gpx",
|