@sports-alliance/sports-lib 7.1.1 → 7.2.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/cjs/data/data-ground-contact-time-balance-left.d.ts +4 -0
- package/lib/cjs/data/data-ground-contact-time-balance-left.js +8 -0
- package/lib/cjs/data/data-ground-contact-time-balance-right.d.ts +4 -0
- package/lib/cjs/data/data-ground-contact-time-balance-right.js +8 -0
- package/lib/cjs/data/data-ground-contact-time-balance.d.ts +3 -0
- package/lib/cjs/data/data-ground-contact-time-balance.js +7 -0
- package/lib/cjs/data/data-stance-time-balance-left.d.ts +1 -0
- package/lib/cjs/data/data-stance-time-balance-left.js +1 -0
- package/lib/cjs/data/data-stance-time-balance-right.d.ts +1 -0
- package/lib/cjs/data/data-stance-time-balance-right.js +1 -0
- package/lib/cjs/data/data-stance-time-balance.d.ts +1 -0
- package/lib/cjs/data/data-stance-time-balance.js +1 -0
- package/lib/cjs/data/data.depth-max.d.ts +5 -0
- package/lib/cjs/data/data.depth-max.js +9 -0
- package/lib/cjs/data/data.depth.d.ts +5 -0
- package/lib/cjs/data/data.depth.js +9 -0
- package/lib/cjs/data/data.fitness-age.d.ts +5 -0
- package/lib/cjs/data/data.fitness-age.js +9 -0
- package/lib/cjs/data/data.ground-contact-time-avg.d.ts +5 -0
- package/lib/cjs/data/data.ground-contact-time-avg.js +9 -0
- package/lib/cjs/data/data.ground-contact-time-max.d.ts +5 -0
- package/lib/cjs/data/data.ground-contact-time-max.js +9 -0
- package/lib/cjs/data/data.ground-contact-time-min.d.ts +5 -0
- package/lib/cjs/data/data.ground-contact-time-min.js +9 -0
- package/lib/cjs/data/data.ground-contact-time.d.ts +5 -0
- package/lib/cjs/data/data.ground-contact-time.js +9 -0
- package/lib/cjs/data/data.max-hr-setting.d.ts +5 -0
- package/lib/cjs/data/data.max-hr-setting.js +9 -0
- package/lib/cjs/data/data.stance-time.d.ts +1 -0
- package/lib/cjs/data/data.stance-time.js +1 -0
- package/lib/cjs/data/data.store.js +39 -1
- package/lib/cjs/data/data.vertical-oscillation-avg.d.ts +5 -0
- package/lib/cjs/data/data.vertical-oscillation-avg.js +9 -0
- package/lib/cjs/data/data.vertical-oscillation-max.d.ts +5 -0
- package/lib/cjs/data/data.vertical-oscillation-max.js +9 -0
- package/lib/cjs/data/data.vertical-oscillation-min.d.ts +5 -0
- package/lib/cjs/data/data.vertical-oscillation-min.js +9 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.js +40 -3
- package/lib/cjs/events/adapters/importers/fit/importer.fit.mapper.js +23 -0
- package/lib/cjs/events/adapters/importers/suunto/importer.suunto.integration.spec.js +87 -3
- package/lib/cjs/events/adapters/importers/suunto/importer.suunto.json.js +86 -6
- package/lib/cjs/events/utilities/activity.utilities.js +38 -2
- package/lib/esm/data/data-ground-contact-time-balance-left.d.ts +4 -0
- package/lib/esm/data/data-ground-contact-time-balance-right.d.ts +4 -0
- package/lib/esm/data/data-ground-contact-time-balance.d.ts +3 -0
- package/lib/esm/data/data-stance-time-balance-left.d.ts +1 -0
- package/lib/esm/data/data-stance-time-balance-right.d.ts +1 -0
- package/lib/esm/data/data-stance-time-balance.d.ts +1 -0
- package/lib/esm/data/data.depth-max.d.ts +5 -0
- package/lib/esm/data/data.depth.d.ts +5 -0
- package/lib/esm/data/data.fitness-age.d.ts +5 -0
- package/lib/esm/data/data.ground-contact-time-avg.d.ts +5 -0
- package/lib/esm/data/data.ground-contact-time-max.d.ts +5 -0
- package/lib/esm/data/data.ground-contact-time-min.d.ts +5 -0
- package/lib/esm/data/data.ground-contact-time.d.ts +5 -0
- package/lib/esm/data/data.max-hr-setting.d.ts +5 -0
- package/lib/esm/data/data.stance-time.d.ts +1 -0
- package/lib/esm/data/data.vertical-oscillation-avg.d.ts +5 -0
- package/lib/esm/data/data.vertical-oscillation-max.d.ts +5 -0
- package/lib/esm/data/data.vertical-oscillation-min.d.ts +5 -0
- package/lib/esm/index.js +259 -13
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGroundContactTimeBalanceLeft = void 0;
|
|
4
|
+
const data_ground_contact_time_balance_1 = require("./data-ground-contact-time-balance");
|
|
5
|
+
class DataGroundContactTimeBalanceLeft extends data_ground_contact_time_balance_1.DataGroundContactTimeBalance {
|
|
6
|
+
}
|
|
7
|
+
exports.DataGroundContactTimeBalanceLeft = DataGroundContactTimeBalanceLeft;
|
|
8
|
+
DataGroundContactTimeBalanceLeft.type = 'Ground Contact Time Balance Left';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGroundContactTimeBalanceRight = void 0;
|
|
4
|
+
const data_ground_contact_time_balance_1 = require("./data-ground-contact-time-balance");
|
|
5
|
+
class DataGroundContactTimeBalanceRight extends data_ground_contact_time_balance_1.DataGroundContactTimeBalance {
|
|
6
|
+
}
|
|
7
|
+
exports.DataGroundContactTimeBalanceRight = DataGroundContactTimeBalanceRight;
|
|
8
|
+
DataGroundContactTimeBalanceRight.type = 'Ground Contact Time Balance Right';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGroundContactTimeBalance = void 0;
|
|
4
|
+
const data_percent_1 = require("./data.percent");
|
|
5
|
+
class DataGroundContactTimeBalance extends data_percent_1.DataPercent {
|
|
6
|
+
}
|
|
7
|
+
exports.DataGroundContactTimeBalance = DataGroundContactTimeBalance;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataStanceTimeBalanceLeft = void 0;
|
|
4
4
|
const data_stance_time_balance_1 = require("./data-stance-time-balance");
|
|
5
|
+
/** @deprecated Use DataGroundContactTimeBalanceLeft instead */
|
|
5
6
|
class DataStanceTimeBalanceLeft extends data_stance_time_balance_1.DataStanceTimeBalance {
|
|
6
7
|
}
|
|
7
8
|
exports.DataStanceTimeBalanceLeft = DataStanceTimeBalanceLeft;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataStanceTimeBalanceRight = void 0;
|
|
4
4
|
const data_stance_time_balance_1 = require("./data-stance-time-balance");
|
|
5
|
+
/** @deprecated Use DataGroundContactTimeBalanceRight instead */
|
|
5
6
|
class DataStanceTimeBalanceRight extends data_stance_time_balance_1.DataStanceTimeBalance {
|
|
6
7
|
}
|
|
7
8
|
exports.DataStanceTimeBalanceRight = DataStanceTimeBalanceRight;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataStanceTimeBalance = void 0;
|
|
4
4
|
const data_percent_1 = require("./data.percent");
|
|
5
|
+
/** @deprecated Use DataGroundContactTimeBalance instead */
|
|
5
6
|
class DataStanceTimeBalance extends data_percent_1.DataPercent {
|
|
6
7
|
}
|
|
7
8
|
exports.DataStanceTimeBalance = DataStanceTimeBalance;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataDepthMax = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataDepthMax extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataDepthMax = DataDepthMax;
|
|
8
|
+
DataDepthMax.type = 'Maximum Depth';
|
|
9
|
+
DataDepthMax.unit = 'm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataDepth = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataDepth extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataDepth = DataDepth;
|
|
8
|
+
DataDepth.type = 'Depth';
|
|
9
|
+
DataDepth.unit = 'm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataFitnessAge = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataFitnessAge extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataFitnessAge = DataFitnessAge;
|
|
8
|
+
DataFitnessAge.type = 'Fitness Age';
|
|
9
|
+
DataFitnessAge.unit = 'years';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGroundContactTimeAvg = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataGroundContactTimeAvg extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataGroundContactTimeAvg = DataGroundContactTimeAvg;
|
|
8
|
+
DataGroundContactTimeAvg.type = 'Ground Contact Time Avg';
|
|
9
|
+
DataGroundContactTimeAvg.unit = 'ms';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGroundContactTimeMax = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataGroundContactTimeMax extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataGroundContactTimeMax = DataGroundContactTimeMax;
|
|
8
|
+
DataGroundContactTimeMax.type = 'Ground Contact Time Max';
|
|
9
|
+
DataGroundContactTimeMax.unit = 'ms';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGroundContactTimeMin = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataGroundContactTimeMin extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataGroundContactTimeMin = DataGroundContactTimeMin;
|
|
8
|
+
DataGroundContactTimeMin.type = 'Ground Contact Time Min';
|
|
9
|
+
DataGroundContactTimeMin.unit = 'ms';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGroundContactTime = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataGroundContactTime extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataGroundContactTime = DataGroundContactTime;
|
|
8
|
+
DataGroundContactTime.type = 'Ground Contact Time';
|
|
9
|
+
DataGroundContactTime.unit = 'ms';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataMaxHRSetting = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataMaxHRSetting extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataMaxHRSetting = DataMaxHRSetting;
|
|
8
|
+
DataMaxHRSetting.type = 'Max HR Setting';
|
|
9
|
+
DataMaxHRSetting.unit = 'bpm';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataStanceTime = void 0;
|
|
4
4
|
const data_number_1 = require("./data.number");
|
|
5
|
+
/** @deprecated Use DataGroundContactTime instead */
|
|
5
6
|
class DataStanceTime extends data_number_1.DataNumber {
|
|
6
7
|
}
|
|
7
8
|
exports.DataStanceTime = DataStanceTime;
|
|
@@ -102,6 +102,7 @@ const data_power_right_1 = require("./data.power-right");
|
|
|
102
102
|
const data_power_left_1 = require("./data.power-left");
|
|
103
103
|
const data_stance_time_1 = require("./data.stance-time");
|
|
104
104
|
const data_stance_time_balance_left_1 = require("./data-stance-time-balance-left");
|
|
105
|
+
const data_ground_contact_time_balance_left_1 = require("./data-ground-contact-time-balance-left");
|
|
105
106
|
const data_step_length_1 = require("./data.step-length");
|
|
106
107
|
const data_vertical_ratio_1 = require("./data.vertical-ratio");
|
|
107
108
|
const data_description_1 = require("./data.description");
|
|
@@ -167,6 +168,8 @@ const data_target_speed_zone_1 = require("./data.target-speed-zone");
|
|
|
167
168
|
const data_target_distance_1 = require("./data.target-distance");
|
|
168
169
|
const data_target_time_1 = require("./data.target-time");
|
|
169
170
|
const data_stance_time_balance_right_1 = require("./data-stance-time-balance-right");
|
|
171
|
+
const data_ground_contact_time_balance_right_1 = require("./data-ground-contact-time-balance-right");
|
|
172
|
+
const data_ground_contact_time_balance_1 = require("./data-ground-contact-time-balance");
|
|
170
173
|
const data_rider_position_change_event_1 = require("./data.rider-position-change-event");
|
|
171
174
|
const data_sport_profile_name_1 = require("./data.sport-profile-name");
|
|
172
175
|
const data_balance_1 = require("./data.balance");
|
|
@@ -199,6 +202,17 @@ const data_right_torque_effectiveness_1 = require("./data.right-torque-effective
|
|
|
199
202
|
const data_total_flow_1 = require("./data.total-flow");
|
|
200
203
|
const data_total_grit_1 = require("./data.total-grit");
|
|
201
204
|
const data_training_load_peak_1 = require("./data.training-load-peak");
|
|
205
|
+
const data_ground_contact_time_1 = require("./data.ground-contact-time");
|
|
206
|
+
const data_ground_contact_time_avg_1 = require("./data.ground-contact-time-avg");
|
|
207
|
+
const data_ground_contact_time_max_1 = require("./data.ground-contact-time-max");
|
|
208
|
+
const data_ground_contact_time_min_1 = require("./data.ground-contact-time-min");
|
|
209
|
+
const data_vertical_oscillation_avg_1 = require("./data.vertical-oscillation-avg");
|
|
210
|
+
const data_vertical_oscillation_max_1 = require("./data.vertical-oscillation-max");
|
|
211
|
+
const data_vertical_oscillation_min_1 = require("./data.vertical-oscillation-min");
|
|
212
|
+
const data_fitness_age_1 = require("./data.fitness-age");
|
|
213
|
+
const data_max_hr_setting_1 = require("./data.max-hr-setting");
|
|
214
|
+
const data_depth_1 = require("./data.depth");
|
|
215
|
+
const data_depth_max_1 = require("./data.depth-max");
|
|
202
216
|
// "Total Training effect" was renamed to "Aerobic Training Effect" in sports-lib 6.0
|
|
203
217
|
class DataTotalTrainingEffectLegacy extends data_aerobic_training_effect_1.DataAerobicTrainingEffect {
|
|
204
218
|
}
|
|
@@ -496,10 +510,34 @@ exports.DataStore = {
|
|
|
496
510
|
DataRightTorqueEffectiveness: data_right_torque_effectiveness_1.DataRightTorqueEffectiveness,
|
|
497
511
|
DataTotalFlow: data_total_flow_1.DataTotalFlow,
|
|
498
512
|
DataTotalGrit: data_total_grit_1.DataTotalGrit,
|
|
499
|
-
DataTrainingLoadPeak: data_training_load_peak_1.DataTrainingLoadPeak
|
|
513
|
+
DataTrainingLoadPeak: data_training_load_peak_1.DataTrainingLoadPeak,
|
|
514
|
+
DataGroundContactTime: data_ground_contact_time_1.DataGroundContactTime,
|
|
515
|
+
DataGroundContactTimeAvg: data_ground_contact_time_avg_1.DataGroundContactTimeAvg,
|
|
516
|
+
DataGroundContactTimeMax: data_ground_contact_time_max_1.DataGroundContactTimeMax,
|
|
517
|
+
DataGroundContactTimeMin: data_ground_contact_time_min_1.DataGroundContactTimeMin,
|
|
518
|
+
DataGroundContactTimeBalance: data_ground_contact_time_balance_1.DataGroundContactTimeBalance,
|
|
519
|
+
DataGroundContactTimeBalanceLeft: data_ground_contact_time_balance_left_1.DataGroundContactTimeBalanceLeft,
|
|
520
|
+
DataGroundContactTimeBalanceRight: data_ground_contact_time_balance_right_1.DataGroundContactTimeBalanceRight,
|
|
521
|
+
DataVerticalOscillationAvg: data_vertical_oscillation_avg_1.DataVerticalOscillationAvg,
|
|
522
|
+
DataVerticalOscillationMax: data_vertical_oscillation_max_1.DataVerticalOscillationMax,
|
|
523
|
+
DataVerticalOscillationMin: data_vertical_oscillation_min_1.DataVerticalOscillationMin,
|
|
524
|
+
DataFitnessAge: data_fitness_age_1.DataFitnessAge,
|
|
525
|
+
DataMaxHRSetting: data_max_hr_setting_1.DataMaxHRSetting,
|
|
526
|
+
DataDepth: data_depth_1.DataDepth,
|
|
527
|
+
DataDepthMax: data_depth_max_1.DataDepthMax
|
|
500
528
|
};
|
|
501
529
|
class DynamicDataLoader {
|
|
502
530
|
static getDataInstanceFromDataType(dataType, opts) {
|
|
531
|
+
// Redirect legacy Stance Time types to Ground Contact Time
|
|
532
|
+
if (dataType === data_stance_time_1.DataStanceTime.type) {
|
|
533
|
+
dataType = data_ground_contact_time_1.DataGroundContactTime.type;
|
|
534
|
+
}
|
|
535
|
+
else if (dataType === data_stance_time_balance_left_1.DataStanceTimeBalanceLeft.type) {
|
|
536
|
+
dataType = data_ground_contact_time_balance_left_1.DataGroundContactTimeBalanceLeft.type;
|
|
537
|
+
}
|
|
538
|
+
else if (dataType === data_stance_time_balance_right_1.DataStanceTimeBalanceRight.type) {
|
|
539
|
+
dataType = data_ground_contact_time_balance_right_1.DataGroundContactTimeBalanceRight.type;
|
|
540
|
+
}
|
|
503
541
|
const className = Object.keys(exports.DataStore).find(dataClass => {
|
|
504
542
|
return exports.DataStore[dataClass] && exports.DataStore[dataClass].type && exports.DataStore[dataClass].type === dataType;
|
|
505
543
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataVerticalOscillationAvg = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataVerticalOscillationAvg extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataVerticalOscillationAvg = DataVerticalOscillationAvg;
|
|
8
|
+
DataVerticalOscillationAvg.type = 'Average Vertical Oscillation';
|
|
9
|
+
DataVerticalOscillationAvg.unit = 'mm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataVerticalOscillationMax = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataVerticalOscillationMax extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataVerticalOscillationMax = DataVerticalOscillationMax;
|
|
8
|
+
DataVerticalOscillationMax.type = 'Maximum Vertical Oscillation';
|
|
9
|
+
DataVerticalOscillationMax.unit = 'mm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataVerticalOscillationMin = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataVerticalOscillationMin extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataVerticalOscillationMin = DataVerticalOscillationMin;
|
|
8
|
+
DataVerticalOscillationMin.type = 'Minimum Vertical Oscillation';
|
|
9
|
+
DataVerticalOscillationMin.unit = 'mm';
|
|
@@ -1,4 +1,37 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -96,6 +129,7 @@ const data_cycling_standing_time_1 = require("../../../../data/data.cycling-stan
|
|
|
96
129
|
const data_cycling_seated_time_1 = require("../../../../data/data.cycling-seated-time");
|
|
97
130
|
const data_cycling_position_1 = require("../../../../data/data.cycling-position");
|
|
98
131
|
const data_rider_position_change_event_1 = require("../../../../data/data.rider-position-change-event");
|
|
132
|
+
const data_ground_contact_time_avg_1 = require("../../../../data/data.ground-contact-time-avg");
|
|
99
133
|
const data_stance_time_1 = require("../../../../data/data.stance-time");
|
|
100
134
|
const data_vertical_oscillation_1 = require("../../../../data/data.vertical-oscillation");
|
|
101
135
|
const data_vertical_ratio_1 = require("../../../../data/data.vertical-ratio");
|
|
@@ -133,14 +167,13 @@ const data_age_1 = require("../../../../data/data.age");
|
|
|
133
167
|
const data_gender_1 = require("../../../../data/data.gender");
|
|
134
168
|
const data_avg_grit_1 = require("../../../../data/data.avg-grit");
|
|
135
169
|
const data_jump_event_1 = require("../../../../data/data.jump-event");
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
137
|
-
// @ts-ignore
|
|
138
|
-
const FitFileParser = require('fit-file-parser').default;
|
|
139
170
|
// Threshold to detect that session.timestamp are not trustable (when exceeding 15% of session.total_elapsed_time)
|
|
140
171
|
const INVALID_DATES_ELAPSED_TIME_RATIO_THRESHOLD = 1.15;
|
|
141
172
|
class EventImporterFIT {
|
|
142
173
|
static getFromArrayBuffer(arrayBuffer_1) {
|
|
143
174
|
return __awaiter(this, arguments, void 0, function* (arrayBuffer, options = activity_parsing_options_1.ActivityParsingOptions.DEFAULT, name = 'New Event') {
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
const { default: FitFileParser } = yield Promise.resolve().then(() => __importStar(require('fit-file-parser')));
|
|
144
177
|
return new Promise((resolve, reject) => {
|
|
145
178
|
const fitFileParser = new FitFileParser({
|
|
146
179
|
force: true,
|
|
@@ -976,7 +1009,11 @@ class EventImporterFIT {
|
|
|
976
1009
|
stats.push(new data_cycling_seated_time_1.DataCyclingSeatedTime(seatedTime));
|
|
977
1010
|
}
|
|
978
1011
|
// Running dynamics
|
|
1012
|
+
// Stance Time
|
|
979
1013
|
if (Number.isFinite(object.avg_stance_time)) {
|
|
1014
|
+
stats.push(new data_ground_contact_time_avg_1.DataGroundContactTimeAvg(object.avg_stance_time));
|
|
1015
|
+
// Keep DataStanceTime for backward compatibility (if needed, though logically it's an Avg)
|
|
1016
|
+
// The original code mapped avg_stance_time to DataStanceTime, which was arguably incorrect naming or type usage
|
|
980
1017
|
stats.push(new data_stance_time_1.DataStanceTime(object.avg_stance_time));
|
|
981
1018
|
}
|
|
982
1019
|
if (Number.isFinite(object.avg_vertical_oscillation)) {
|
|
@@ -21,6 +21,9 @@ const data_stryd_distance_1 = require("../../../../data/data.stryd-distance");
|
|
|
21
21
|
const data_stryd_speed_1 = require("../../../../data/data.stryd-speed");
|
|
22
22
|
const data_right_balance_1 = require("../../../../data/data.right-balance");
|
|
23
23
|
const data_left_balance_1 = require("../../../../data/data.left-balance");
|
|
24
|
+
const data_ground_contact_time_1 = require("../../../../data/data.ground-contact-time");
|
|
25
|
+
const data_ground_contact_time_balance_left_1 = require("../../../../data/data-ground-contact-time-balance-left");
|
|
26
|
+
const data_ground_contact_time_balance_right_1 = require("../../../../data/data-ground-contact-time-balance-right");
|
|
24
27
|
const data_stance_time_1 = require("../../../../data/data.stance-time");
|
|
25
28
|
const data_stance_time_balance_left_1 = require("../../../../data/data-stance-time-balance-left");
|
|
26
29
|
const data_step_length_1 = require("../../../../data/data.step-length");
|
|
@@ -213,12 +216,32 @@ exports.FITSampleMapper = [
|
|
|
213
216
|
: 100 - sample.left_right_balance.value;
|
|
214
217
|
}
|
|
215
218
|
},
|
|
219
|
+
{
|
|
220
|
+
dataType: data_ground_contact_time_1.DataGroundContactTime.type,
|
|
221
|
+
getSampleValue: (sample) => {
|
|
222
|
+
return sample.stance_time;
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
// Keep DataStanceTime for backward compatibility
|
|
216
226
|
{
|
|
217
227
|
dataType: data_stance_time_1.DataStanceTime.type,
|
|
218
228
|
getSampleValue: (sample) => {
|
|
219
229
|
return sample.stance_time;
|
|
220
230
|
}
|
|
221
231
|
},
|
|
232
|
+
{
|
|
233
|
+
dataType: data_ground_contact_time_balance_left_1.DataGroundContactTimeBalanceLeft.type,
|
|
234
|
+
getSampleValue: (sample) => {
|
|
235
|
+
return sample.stance_time_balance; // The field sample refers to the balance on left leg
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
dataType: data_ground_contact_time_balance_right_1.DataGroundContactTimeBalanceRight.type,
|
|
240
|
+
getSampleValue: (sample) => {
|
|
241
|
+
return (0, helpers_1.isNumber)(sample.stance_time_balance) ? 100 - sample.stance_time_balance : null;
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
// Keep DataStanceTimeBalanceLeft for backward compatibility
|
|
222
245
|
{
|
|
223
246
|
dataType: data_stance_time_balance_left_1.DataStanceTimeBalanceLeft.type,
|
|
224
247
|
getSampleValue: (sample) => {
|
|
@@ -45,6 +45,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
const fs = __importStar(require("fs"));
|
|
46
46
|
const path = __importStar(require("path"));
|
|
47
47
|
const importer_suunto_json_1 = require("./importer.suunto.json");
|
|
48
|
+
const data_ground_contact_time_1 = require("../../../../data/data.ground-contact-time");
|
|
49
|
+
const data_ground_contact_time_avg_1 = require("../../../../data/data.ground-contact-time-avg");
|
|
50
|
+
const data_ground_contact_time_max_1 = require("../../../../data/data.ground-contact-time-max");
|
|
51
|
+
const data_ground_contact_time_min_1 = require("../../../../data/data.ground-contact-time-min");
|
|
52
|
+
const data_vertical_oscillation_1 = require("../../../../data/data.vertical-oscillation");
|
|
53
|
+
const data_vertical_oscillation_avg_1 = require("../../../../data/data.vertical-oscillation-avg");
|
|
54
|
+
const data_vertical_oscillation_max_1 = require("../../../../data/data.vertical-oscillation-max");
|
|
55
|
+
const data_vertical_oscillation_min_1 = require("../../../../data/data.vertical-oscillation-min");
|
|
56
|
+
const data_fitness_age_1 = require("../../../../data/data.fitness-age");
|
|
57
|
+
const data_max_hr_setting_1 = require("../../../../data/data.max-hr-setting");
|
|
48
58
|
describe('EventImporterSuuntoJSON Integration', () => {
|
|
49
59
|
// Go up 5 levels from src/events/adapters/importers/suunto -> sports-lib root
|
|
50
60
|
const samplesDir = path.resolve(__dirname, '../../../../../samples/suunto');
|
|
@@ -58,7 +68,6 @@ describe('EventImporterSuuntoJSON Integration', () => {
|
|
|
58
68
|
console.warn('No .json files found in samples directory.');
|
|
59
69
|
return;
|
|
60
70
|
}
|
|
61
|
-
console.log(`Found ${files.length} .json files to test:`, files);
|
|
62
71
|
for (const file of files) {
|
|
63
72
|
const filePath = path.join(samplesDir, file);
|
|
64
73
|
const fileString = fs.readFileSync(filePath, 'utf-8');
|
|
@@ -67,7 +76,6 @@ describe('EventImporterSuuntoJSON Integration', () => {
|
|
|
67
76
|
const event = yield importer_suunto_json_1.EventImporterSuuntoJSON.getFromJSONString(fileString);
|
|
68
77
|
expect(event).toBeDefined();
|
|
69
78
|
expect(event.getActivities().length).toBeGreaterThan(0);
|
|
70
|
-
console.log(`✅ Successfully parsed ${file}`);
|
|
71
79
|
}
|
|
72
80
|
catch (error) {
|
|
73
81
|
console.error(`❌ Failed to parse ${file}:`, error);
|
|
@@ -75,5 +83,81 @@ describe('EventImporterSuuntoJSON Integration', () => {
|
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
}));
|
|
78
|
-
|
|
86
|
+
describe('running-with-extra-data.json', () => {
|
|
87
|
+
let event;
|
|
88
|
+
let activity;
|
|
89
|
+
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
const filePath = path.join(samplesDir, 'running-with-extra-data.json');
|
|
91
|
+
if (!fs.existsSync(filePath)) {
|
|
92
|
+
console.warn('running-with-extra-data.json not found. Skipping detailed tests.');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const fileString = fs.readFileSync(filePath, 'utf-8');
|
|
96
|
+
event = yield importer_suunto_json_1.EventImporterSuuntoJSON.getFromJSONString(fileString);
|
|
97
|
+
// DEBUG: print one sample's date from the source file just blindly
|
|
98
|
+
// (we can't easily access json here again without parsing, but we can infer from activity)
|
|
99
|
+
// Find the main running activity (longest duration)
|
|
100
|
+
activity = event.getActivities().reduce((prev, current) => (prev.getDuration().getValue() > current.getDuration().getValue()) ? prev : current);
|
|
101
|
+
}));
|
|
102
|
+
it('should parse Ground Contact Time stream', () => {
|
|
103
|
+
if (!activity)
|
|
104
|
+
return;
|
|
105
|
+
// Depending on the file structure, GCT might be in the first or second activity.
|
|
106
|
+
// We selected the longest one.
|
|
107
|
+
const hasStream = activity.hasStreamData(data_ground_contact_time_1.DataGroundContactTime.type);
|
|
108
|
+
expect(hasStream).toBe(true);
|
|
109
|
+
if (hasStream) {
|
|
110
|
+
const stream = activity.getStreamData(data_ground_contact_time_1.DataGroundContactTime.type);
|
|
111
|
+
expect(stream.length).toBeGreaterThan(0);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
it('should parse Ground Contact Time stats (avg, max, min)', () => {
|
|
115
|
+
if (!activity)
|
|
116
|
+
return;
|
|
117
|
+
const avgStat = activity.getStat(data_ground_contact_time_avg_1.DataGroundContactTimeAvg.type);
|
|
118
|
+
const maxStat = activity.getStat(data_ground_contact_time_max_1.DataGroundContactTimeMax.type);
|
|
119
|
+
const minStat = activity.getStat(data_ground_contact_time_min_1.DataGroundContactTimeMin.type);
|
|
120
|
+
expect(avgStat).toBeDefined();
|
|
121
|
+
expect(avgStat === null || avgStat === void 0 ? void 0 : avgStat.getValue()).toBeCloseTo(255.969, 3);
|
|
122
|
+
expect(maxStat).toBeDefined();
|
|
123
|
+
expect(maxStat === null || maxStat === void 0 ? void 0 : maxStat.getValue()).toBe(339);
|
|
124
|
+
expect(minStat).toBeDefined();
|
|
125
|
+
expect(minStat === null || minStat === void 0 ? void 0 : minStat.getValue()).toBe(219);
|
|
126
|
+
});
|
|
127
|
+
it('should parse Vertical Oscillation stream', () => {
|
|
128
|
+
if (!activity)
|
|
129
|
+
return;
|
|
130
|
+
const hasStream = activity.hasStreamData(data_vertical_oscillation_1.DataVerticalOscillation.type);
|
|
131
|
+
expect(hasStream).toBe(true);
|
|
132
|
+
});
|
|
133
|
+
it('should parse Vertical Oscillation stats (avg, max, min)', () => {
|
|
134
|
+
if (!activity)
|
|
135
|
+
return;
|
|
136
|
+
const avgStat = activity.getStat(data_vertical_oscillation_avg_1.DataVerticalOscillationAvg.type);
|
|
137
|
+
const maxStat = activity.getStat(data_vertical_oscillation_max_1.DataVerticalOscillationMax.type);
|
|
138
|
+
const minStat = activity.getStat(data_vertical_oscillation_min_1.DataVerticalOscillationMin.type);
|
|
139
|
+
expect(avgStat).toBeDefined();
|
|
140
|
+
expect(avgStat === null || avgStat === void 0 ? void 0 : avgStat.getValue()).toBeCloseTo(74.359, 3);
|
|
141
|
+
expect(maxStat).toBeDefined();
|
|
142
|
+
expect(maxStat === null || maxStat === void 0 ? void 0 : maxStat.getValue()).toBe(87);
|
|
143
|
+
expect(minStat).toBeDefined();
|
|
144
|
+
expect(minStat === null || minStat === void 0 ? void 0 : minStat.getValue()).toBe(42);
|
|
145
|
+
});
|
|
146
|
+
it('should parse Fitness Age from header (Event or Activity)', () => {
|
|
147
|
+
let stat = event.getStat(data_fitness_age_1.DataFitnessAge.type);
|
|
148
|
+
if (!stat && activity) {
|
|
149
|
+
stat = activity.getStat(data_fitness_age_1.DataFitnessAge.type);
|
|
150
|
+
}
|
|
151
|
+
expect(stat).toBeDefined();
|
|
152
|
+
expect(stat === null || stat === void 0 ? void 0 : stat.getValue()).toBe(25);
|
|
153
|
+
});
|
|
154
|
+
it('should parse Personal MaxHR from header (Event or Activity)', () => {
|
|
155
|
+
let stat = event.getStat(data_max_hr_setting_1.DataMaxHRSetting.type);
|
|
156
|
+
if (!stat && activity) {
|
|
157
|
+
stat = activity.getStat(data_max_hr_setting_1.DataMaxHRSetting.type);
|
|
158
|
+
}
|
|
159
|
+
expect(stat).toBeDefined();
|
|
160
|
+
expect(stat === null || stat === void 0 ? void 0 : stat.getValue()).toBe(171);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
79
163
|
});
|