@sports-alliance/sports-lib 7.1.2 → 7.2.3

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 (70) hide show
  1. package/.agent/README.md +16 -0
  2. package/inspect_jump_raw.js +24 -0
  3. package/lib/cjs/data/data-ground-contact-time-balance-left.d.ts +4 -0
  4. package/lib/cjs/data/data-ground-contact-time-balance-left.js +8 -0
  5. package/lib/cjs/data/data-ground-contact-time-balance-right.d.ts +4 -0
  6. package/lib/cjs/data/data-ground-contact-time-balance-right.js +8 -0
  7. package/lib/cjs/data/data-ground-contact-time-balance.d.ts +3 -0
  8. package/lib/cjs/data/data-ground-contact-time-balance.js +7 -0
  9. package/lib/cjs/data/data-stance-time-balance-left.d.ts +1 -0
  10. package/lib/cjs/data/data-stance-time-balance-left.js +1 -0
  11. package/lib/cjs/data/data-stance-time-balance-right.d.ts +1 -0
  12. package/lib/cjs/data/data-stance-time-balance-right.js +1 -0
  13. package/lib/cjs/data/data-stance-time-balance.d.ts +1 -0
  14. package/lib/cjs/data/data-stance-time-balance.js +1 -0
  15. package/lib/cjs/data/data.depth-max.d.ts +5 -0
  16. package/lib/cjs/data/data.depth-max.js +9 -0
  17. package/lib/cjs/data/data.depth.d.ts +5 -0
  18. package/lib/cjs/data/data.depth.js +9 -0
  19. package/lib/cjs/data/data.fitness-age.d.ts +5 -0
  20. package/lib/cjs/data/data.fitness-age.js +9 -0
  21. package/lib/cjs/data/data.ground-contact-time-avg.d.ts +5 -0
  22. package/lib/cjs/data/data.ground-contact-time-avg.js +9 -0
  23. package/lib/cjs/data/data.ground-contact-time-max.d.ts +5 -0
  24. package/lib/cjs/data/data.ground-contact-time-max.js +9 -0
  25. package/lib/cjs/data/data.ground-contact-time-min.d.ts +5 -0
  26. package/lib/cjs/data/data.ground-contact-time-min.js +9 -0
  27. package/lib/cjs/data/data.ground-contact-time.d.ts +5 -0
  28. package/lib/cjs/data/data.ground-contact-time.js +9 -0
  29. package/lib/cjs/data/data.jump-event.d.ts +6 -1
  30. package/lib/cjs/data/data.jump-stats.d.ts +91 -0
  31. package/lib/cjs/data/data.jump-stats.js +112 -0
  32. package/lib/cjs/data/data.max-hr-setting.d.ts +5 -0
  33. package/lib/cjs/data/data.max-hr-setting.js +9 -0
  34. package/lib/cjs/data/data.stance-time.d.ts +1 -0
  35. package/lib/cjs/data/data.stance-time.js +1 -0
  36. package/lib/cjs/data/data.store.js +58 -1
  37. package/lib/cjs/data/data.vertical-oscillation-avg.d.ts +5 -0
  38. package/lib/cjs/data/data.vertical-oscillation-avg.js +9 -0
  39. package/lib/cjs/data/data.vertical-oscillation-max.d.ts +5 -0
  40. package/lib/cjs/data/data.vertical-oscillation-max.js +9 -0
  41. package/lib/cjs/data/data.vertical-oscillation-min.d.ts +5 -0
  42. package/lib/cjs/data/data.vertical-oscillation-min.js +9 -0
  43. package/lib/cjs/events/adapters/importers/fit/importer.fit.js +112 -9
  44. package/lib/cjs/events/adapters/importers/fit/importer.fit.mapper.js +23 -0
  45. package/lib/cjs/events/adapters/importers/fit/importer.fit.mtb.spec.js +34 -6
  46. package/lib/cjs/events/adapters/importers/suunto/importer.suunto.integration.spec.js +87 -3
  47. package/lib/cjs/events/adapters/importers/suunto/importer.suunto.json.js +86 -6
  48. package/lib/cjs/events/utilities/activity.utilities.js +38 -2
  49. package/lib/esm/data/data-ground-contact-time-balance-left.d.ts +4 -0
  50. package/lib/esm/data/data-ground-contact-time-balance-right.d.ts +4 -0
  51. package/lib/esm/data/data-ground-contact-time-balance.d.ts +3 -0
  52. package/lib/esm/data/data-stance-time-balance-left.d.ts +1 -0
  53. package/lib/esm/data/data-stance-time-balance-right.d.ts +1 -0
  54. package/lib/esm/data/data-stance-time-balance.d.ts +1 -0
  55. package/lib/esm/data/data.depth-max.d.ts +5 -0
  56. package/lib/esm/data/data.depth.d.ts +5 -0
  57. package/lib/esm/data/data.fitness-age.d.ts +5 -0
  58. package/lib/esm/data/data.ground-contact-time-avg.d.ts +5 -0
  59. package/lib/esm/data/data.ground-contact-time-max.d.ts +5 -0
  60. package/lib/esm/data/data.ground-contact-time-min.d.ts +5 -0
  61. package/lib/esm/data/data.ground-contact-time.d.ts +5 -0
  62. package/lib/esm/data/data.jump-event.d.ts +6 -1
  63. package/lib/esm/data/data.jump-stats.d.ts +91 -0
  64. package/lib/esm/data/data.max-hr-setting.d.ts +5 -0
  65. package/lib/esm/data/data.stance-time.d.ts +1 -0
  66. package/lib/esm/data/data.vertical-oscillation-avg.d.ts +5 -0
  67. package/lib/esm/data/data.vertical-oscillation-max.d.ts +5 -0
  68. package/lib/esm/data/data.vertical-oscillation-min.d.ts +5 -0
  69. package/lib/esm/index.js +555 -12
  70. package/package.json +2 -2
package/lib/esm/index.js CHANGED
@@ -3046,6 +3046,17 @@ var DataStanceTimeBalanceLeft = class extends DataStanceTimeBalance {
3046
3046
  }
3047
3047
  };
3048
3048
 
3049
+ // src/data/data-ground-contact-time-balance.ts
3050
+ var DataGroundContactTimeBalance = class extends DataPercent {
3051
+ };
3052
+
3053
+ // src/data/data-ground-contact-time-balance-left.ts
3054
+ var DataGroundContactTimeBalanceLeft = class extends DataGroundContactTimeBalance {
3055
+ static {
3056
+ this.type = "Ground Contact Time Balance Left";
3057
+ }
3058
+ };
3059
+
3049
3060
  // src/data/data.step-length.ts
3050
3061
  var DataStepLength = class extends DataDistance {
3051
3062
  static {
@@ -3669,6 +3680,13 @@ var DataStanceTimeBalanceRight = class extends DataStanceTimeBalance {
3669
3680
  }
3670
3681
  };
3671
3682
 
3683
+ // src/data/data-ground-contact-time-balance-right.ts
3684
+ var DataGroundContactTimeBalanceRight = class extends DataGroundContactTimeBalance {
3685
+ static {
3686
+ this.type = "Ground Contact Time Balance Right";
3687
+ }
3688
+ };
3689
+
3672
3690
  // src/data/data.rider-position-change-event.ts
3673
3691
  var DataRiderPositionChangeEvent = class extends DataEvent {
3674
3692
  static {
@@ -4014,6 +4032,316 @@ var DataTrainingLoadPeak = class extends DataNumber {
4014
4032
  }
4015
4033
  };
4016
4034
 
4035
+ // src/data/data.ground-contact-time.ts
4036
+ var DataGroundContactTime = class extends DataNumber {
4037
+ static {
4038
+ this.type = "Ground Contact Time";
4039
+ }
4040
+ static {
4041
+ this.unit = "ms";
4042
+ }
4043
+ };
4044
+
4045
+ // src/data/data.ground-contact-time-avg.ts
4046
+ var DataGroundContactTimeAvg = class extends DataNumber {
4047
+ static {
4048
+ this.type = "Ground Contact Time Avg";
4049
+ }
4050
+ static {
4051
+ this.unit = "ms";
4052
+ }
4053
+ };
4054
+
4055
+ // src/data/data.ground-contact-time-max.ts
4056
+ var DataGroundContactTimeMax = class extends DataNumber {
4057
+ static {
4058
+ this.type = "Ground Contact Time Max";
4059
+ }
4060
+ static {
4061
+ this.unit = "ms";
4062
+ }
4063
+ };
4064
+
4065
+ // src/data/data.ground-contact-time-min.ts
4066
+ var DataGroundContactTimeMin = class extends DataNumber {
4067
+ static {
4068
+ this.type = "Ground Contact Time Min";
4069
+ }
4070
+ static {
4071
+ this.unit = "ms";
4072
+ }
4073
+ };
4074
+
4075
+ // src/data/data.vertical-oscillation-avg.ts
4076
+ var DataVerticalOscillationAvg = class extends DataNumber {
4077
+ static {
4078
+ this.type = "Average Vertical Oscillation";
4079
+ }
4080
+ static {
4081
+ this.unit = "mm";
4082
+ }
4083
+ };
4084
+
4085
+ // src/data/data.vertical-oscillation-max.ts
4086
+ var DataVerticalOscillationMax = class extends DataNumber {
4087
+ static {
4088
+ this.type = "Maximum Vertical Oscillation";
4089
+ }
4090
+ static {
4091
+ this.unit = "mm";
4092
+ }
4093
+ };
4094
+
4095
+ // src/data/data.vertical-oscillation-min.ts
4096
+ var DataVerticalOscillationMin = class extends DataNumber {
4097
+ static {
4098
+ this.type = "Minimum Vertical Oscillation";
4099
+ }
4100
+ static {
4101
+ this.unit = "mm";
4102
+ }
4103
+ };
4104
+
4105
+ // src/data/data.fitness-age.ts
4106
+ var DataFitnessAge = class extends DataNumber {
4107
+ static {
4108
+ this.type = "Fitness Age";
4109
+ }
4110
+ static {
4111
+ this.unit = "years";
4112
+ }
4113
+ };
4114
+
4115
+ // src/data/data.max-hr-setting.ts
4116
+ var DataMaxHRSetting = class extends DataNumber {
4117
+ static {
4118
+ this.type = "Max HR Setting";
4119
+ }
4120
+ static {
4121
+ this.unit = "bpm";
4122
+ }
4123
+ };
4124
+
4125
+ // src/data/data.depth.ts
4126
+ var DataDepth = class extends DataNumber {
4127
+ static {
4128
+ this.type = "Depth";
4129
+ }
4130
+ static {
4131
+ this.unit = "m";
4132
+ }
4133
+ };
4134
+
4135
+ // src/data/data.depth-max.ts
4136
+ var DataDepthMax = class extends DataNumber {
4137
+ static {
4138
+ this.type = "Maximum Depth";
4139
+ }
4140
+ static {
4141
+ this.unit = "m";
4142
+ }
4143
+ };
4144
+
4145
+ // src/data/data.jump-stats.ts
4146
+ var DataJumpHangTimeMin = class extends DataNumber {
4147
+ static {
4148
+ this.type = "Jump Hang Time Min";
4149
+ }
4150
+ static {
4151
+ this.unit = "s";
4152
+ }
4153
+ constructor(value) {
4154
+ super(value);
4155
+ }
4156
+ };
4157
+ var DataJumpHangTimeMax = class extends DataNumber {
4158
+ static {
4159
+ this.type = "Jump Hang Time Max";
4160
+ }
4161
+ static {
4162
+ this.unit = "s";
4163
+ }
4164
+ constructor(value) {
4165
+ super(value);
4166
+ }
4167
+ };
4168
+ var DataJumpHangTimeAvg = class extends DataNumber {
4169
+ static {
4170
+ this.type = "Jump Hang Time Avg";
4171
+ }
4172
+ static {
4173
+ this.unit = "s";
4174
+ }
4175
+ constructor(value) {
4176
+ super(value);
4177
+ }
4178
+ };
4179
+ var DataJumpDistanceMin = class extends DataNumber {
4180
+ static {
4181
+ this.type = "Jump Distance Min";
4182
+ }
4183
+ static {
4184
+ this.unit = "m";
4185
+ }
4186
+ constructor(value) {
4187
+ super(value);
4188
+ }
4189
+ };
4190
+ var DataJumpDistanceMax = class extends DataNumber {
4191
+ static {
4192
+ this.type = "Jump Distance Max";
4193
+ }
4194
+ static {
4195
+ this.unit = "m";
4196
+ }
4197
+ constructor(value) {
4198
+ super(value);
4199
+ }
4200
+ };
4201
+ var DataJumpDistanceAvg = class extends DataNumber {
4202
+ static {
4203
+ this.type = "Jump Distance Avg";
4204
+ }
4205
+ static {
4206
+ this.unit = "m";
4207
+ }
4208
+ constructor(value) {
4209
+ super(value);
4210
+ }
4211
+ };
4212
+ var DataJumpSpeedMin = class extends DataNumber {
4213
+ static {
4214
+ this.type = "Jump Speed Min";
4215
+ }
4216
+ static {
4217
+ this.unit = "m/s";
4218
+ }
4219
+ constructor(value) {
4220
+ super(value);
4221
+ }
4222
+ };
4223
+ var DataJumpSpeedMax = class extends DataNumber {
4224
+ static {
4225
+ this.type = "Jump Speed Max";
4226
+ }
4227
+ static {
4228
+ this.unit = "m/s";
4229
+ }
4230
+ constructor(value) {
4231
+ super(value);
4232
+ }
4233
+ };
4234
+ var DataJumpSpeedAvg = class extends DataNumber {
4235
+ static {
4236
+ this.type = "Jump Speed Avg";
4237
+ }
4238
+ static {
4239
+ this.unit = "m/s";
4240
+ }
4241
+ constructor(value) {
4242
+ super(value);
4243
+ }
4244
+ };
4245
+ var DataJumpRotationsMin = class extends DataNumber {
4246
+ static {
4247
+ this.type = "Jump Rotations Min";
4248
+ }
4249
+ static {
4250
+ this.unit = "";
4251
+ }
4252
+ constructor(value) {
4253
+ super(value);
4254
+ }
4255
+ };
4256
+ var DataJumpRotationsMax = class extends DataNumber {
4257
+ static {
4258
+ this.type = "Jump Rotations Max";
4259
+ }
4260
+ static {
4261
+ this.unit = "";
4262
+ }
4263
+ constructor(value) {
4264
+ super(value);
4265
+ }
4266
+ };
4267
+ var DataJumpRotationsAvg = class extends DataNumber {
4268
+ static {
4269
+ this.type = "Jump Rotations Avg";
4270
+ }
4271
+ static {
4272
+ this.unit = "";
4273
+ }
4274
+ constructor(value) {
4275
+ super(value);
4276
+ }
4277
+ };
4278
+ var DataJumpScoreMin = class extends DataNumber {
4279
+ static {
4280
+ this.type = "Jump Score Min";
4281
+ }
4282
+ static {
4283
+ this.unit = "";
4284
+ }
4285
+ constructor(value) {
4286
+ super(value);
4287
+ }
4288
+ };
4289
+ var DataJumpScoreMax = class extends DataNumber {
4290
+ static {
4291
+ this.type = "Jump Score Max";
4292
+ }
4293
+ static {
4294
+ this.unit = "";
4295
+ }
4296
+ constructor(value) {
4297
+ super(value);
4298
+ }
4299
+ };
4300
+ var DataJumpScoreAvg = class extends DataNumber {
4301
+ static {
4302
+ this.type = "Jump Score Avg";
4303
+ }
4304
+ static {
4305
+ this.unit = "";
4306
+ }
4307
+ constructor(value) {
4308
+ super(value);
4309
+ }
4310
+ };
4311
+ var DataJumpHeightMin = class extends DataNumber {
4312
+ static {
4313
+ this.type = "Jump Height Min";
4314
+ }
4315
+ static {
4316
+ this.unit = "m";
4317
+ }
4318
+ constructor(value) {
4319
+ super(value);
4320
+ }
4321
+ };
4322
+ var DataJumpHeightMax = class extends DataNumber {
4323
+ static {
4324
+ this.type = "Jump Height Max";
4325
+ }
4326
+ static {
4327
+ this.unit = "m";
4328
+ }
4329
+ constructor(value) {
4330
+ super(value);
4331
+ }
4332
+ };
4333
+ var DataJumpHeightAvg = class extends DataNumber {
4334
+ static {
4335
+ this.type = "Jump Height Avg";
4336
+ }
4337
+ static {
4338
+ this.unit = "m";
4339
+ }
4340
+ constructor(value) {
4341
+ super(value);
4342
+ }
4343
+ };
4344
+
4017
4345
  // src/data/data.store.ts
4018
4346
  var DataTotalTrainingEffectLegacy = class extends DataAerobicTrainingEffect {
4019
4347
  static {
@@ -4309,7 +4637,39 @@ var DataStore = {
4309
4637
  DataRightTorqueEffectiveness,
4310
4638
  DataTotalFlow,
4311
4639
  DataTotalGrit,
4312
- DataTrainingLoadPeak
4640
+ DataTrainingLoadPeak,
4641
+ DataGroundContactTime,
4642
+ DataGroundContactTimeAvg,
4643
+ DataGroundContactTimeMax,
4644
+ DataGroundContactTimeMin,
4645
+ DataGroundContactTimeBalance,
4646
+ DataGroundContactTimeBalanceLeft,
4647
+ DataGroundContactTimeBalanceRight,
4648
+ DataVerticalOscillationAvg,
4649
+ DataVerticalOscillationMax,
4650
+ DataVerticalOscillationMin,
4651
+ DataFitnessAge,
4652
+ DataMaxHRSetting,
4653
+ DataDepth,
4654
+ DataDepthMax,
4655
+ DataJumpHangTimeMin,
4656
+ DataJumpHangTimeMax,
4657
+ DataJumpHangTimeAvg,
4658
+ DataJumpDistanceMin,
4659
+ DataJumpDistanceMax,
4660
+ DataJumpDistanceAvg,
4661
+ DataJumpSpeedMin,
4662
+ DataJumpSpeedMax,
4663
+ DataJumpSpeedAvg,
4664
+ DataJumpRotationsMin,
4665
+ DataJumpRotationsMax,
4666
+ DataJumpRotationsAvg,
4667
+ DataJumpScoreMin,
4668
+ DataJumpScoreMax,
4669
+ DataJumpScoreAvg,
4670
+ DataJumpHeightMin,
4671
+ DataJumpHeightMax,
4672
+ DataJumpHeightAvg
4313
4673
  };
4314
4674
  var DynamicDataLoader = class _DynamicDataLoader {
4315
4675
  static {
@@ -4540,6 +4900,13 @@ var DynamicDataLoader = class _DynamicDataLoader {
4540
4900
  ];
4541
4901
  }
4542
4902
  static getDataInstanceFromDataType(dataType, opts) {
4903
+ if (dataType === DataStanceTime.type) {
4904
+ dataType = DataGroundContactTime.type;
4905
+ } else if (dataType === DataStanceTimeBalanceLeft.type) {
4906
+ dataType = DataGroundContactTimeBalanceLeft.type;
4907
+ } else if (dataType === DataStanceTimeBalanceRight.type) {
4908
+ dataType = DataGroundContactTimeBalanceRight.type;
4909
+ }
4543
4910
  const className = Object.keys(DataStore).find((dataClass) => {
4544
4911
  return DataStore[dataClass] && DataStore[dataClass].type && DataStore[dataClass].type === dataType;
4545
4912
  });
@@ -6463,11 +6830,34 @@ var ActivityUtilities = class _ActivityUtilities {
6463
6830
  activity.addStat(new DataRightBalance(avgRightBalance));
6464
6831
  activity.addStat(new DataLeftBalance(100 - avgRightBalance));
6465
6832
  }
6833
+ if (!activity.getStat(DataGroundContactTimeBalanceLeft.type) && activity.hasStreamData(DataGroundContactTimeBalanceLeft.type)) {
6834
+ const avgStanceTimeLeftBalance = this.round(this.getDataTypeAvg(activity, DataGroundContactTimeBalanceLeft.type), 2);
6835
+ activity.addStat(new DataGroundContactTimeBalanceLeft(avgStanceTimeLeftBalance));
6836
+ activity.addStat(new DataGroundContactTimeBalanceRight(100 - avgStanceTimeLeftBalance));
6837
+ }
6466
6838
  if (!activity.getStat(DataStanceTimeBalanceLeft.type) && activity.hasStreamData(DataStanceTimeBalanceLeft.type)) {
6467
6839
  const avgStanceTimeLeftBalance = this.round(this.getDataTypeAvg(activity, DataStanceTimeBalanceLeft.type), 2);
6468
6840
  activity.addStat(new DataStanceTimeBalanceLeft(avgStanceTimeLeftBalance));
6469
6841
  activity.addStat(new DataStanceTimeBalanceRight(100 - avgStanceTimeLeftBalance));
6470
6842
  }
6843
+ if (!activity.getStat(DataGroundContactTimeMax.type) && activity.hasStreamData(DataGroundContactTime.type)) {
6844
+ activity.addStat(new DataGroundContactTimeMax(this.getDataTypeMax(activity, DataGroundContactTime.type)));
6845
+ }
6846
+ if (!activity.getStat(DataGroundContactTimeMin.type) && activity.hasStreamData(DataGroundContactTime.type)) {
6847
+ activity.addStat(new DataGroundContactTimeMin(this.getDataTypeMin(activity, DataGroundContactTime.type)));
6848
+ }
6849
+ if (!activity.getStat(DataGroundContactTimeAvg.type) && activity.hasStreamData(DataGroundContactTime.type)) {
6850
+ activity.addStat(new DataGroundContactTimeAvg(this.getDataTypeAvg(activity, DataGroundContactTime.type)));
6851
+ }
6852
+ if (!activity.getStat(DataVerticalOscillationMax.type) && activity.hasStreamData(DataVerticalOscillation.type)) {
6853
+ activity.addStat(new DataVerticalOscillationMax(this.getDataTypeMax(activity, DataVerticalOscillation.type)));
6854
+ }
6855
+ if (!activity.getStat(DataVerticalOscillationMin.type) && activity.hasStreamData(DataVerticalOscillation.type)) {
6856
+ activity.addStat(new DataVerticalOscillationMin(this.getDataTypeMin(activity, DataVerticalOscillation.type)));
6857
+ }
6858
+ if (!activity.getStat(DataVerticalOscillationAvg.type) && activity.hasStreamData(DataVerticalOscillation.type)) {
6859
+ activity.addStat(new DataVerticalOscillationAvg(this.getDataTypeAvg(activity, DataVerticalOscillation.type)));
6860
+ }
6471
6861
  }
6472
6862
  static generateMissingSpeedDerivedStatsForActivity(activity) {
6473
6863
  const speedMax = activity.getStat(DataSpeedMax.type);
@@ -9601,12 +9991,32 @@ var FITSampleMapper = [
9601
9991
  return sample.left_right_balance.right === false ? sample.left_right_balance.value : 100 - sample.left_right_balance.value;
9602
9992
  }
9603
9993
  },
9994
+ {
9995
+ dataType: DataGroundContactTime.type,
9996
+ getSampleValue: (sample) => {
9997
+ return sample.stance_time;
9998
+ }
9999
+ },
10000
+ // Keep DataStanceTime for backward compatibility
9604
10001
  {
9605
10002
  dataType: DataStanceTime.type,
9606
10003
  getSampleValue: (sample) => {
9607
10004
  return sample.stance_time;
9608
10005
  }
9609
10006
  },
10007
+ {
10008
+ dataType: DataGroundContactTimeBalanceLeft.type,
10009
+ getSampleValue: (sample) => {
10010
+ return sample.stance_time_balance;
10011
+ }
10012
+ },
10013
+ {
10014
+ dataType: DataGroundContactTimeBalanceRight.type,
10015
+ getSampleValue: (sample) => {
10016
+ return isNumber(sample.stance_time_balance) ? 100 - sample.stance_time_balance : null;
10017
+ }
10018
+ },
10019
+ // Keep DataStanceTimeBalanceLeft for backward compatibility
9610
10020
  {
9611
10021
  dataType: DataStanceTimeBalanceLeft.type,
9612
10022
  getSampleValue: (sample) => {
@@ -9886,6 +10296,16 @@ var EventImporterFIT = class {
9886
10296
  });
9887
10297
  });
9888
10298
  }
10299
+ if (fitDataObject.jumps && fitDataObject.jumps.length > 0) {
10300
+ fitDataObject.sessions?.forEach((session) => {
10301
+ const sessionStartTime = new Date(session.start_time).getTime();
10302
+ const sessionEndTime = sessionStartTime + (session.total_elapsed_time || 0) * 1e3;
10303
+ session.jumps = fitDataObject.jumps.filter((jump) => {
10304
+ const jumpTime = new Date(jump.timestamp).getTime();
10305
+ return jumpTime >= sessionStartTime && jumpTime < sessionEndTime;
10306
+ });
10307
+ });
10308
+ }
9889
10309
  const activities = fitDataObject.sessions.map((sessionObject) => {
9890
10310
  const activity = this.getActivityFromSessionObject(sessionObject, fitDataObject, options);
9891
10311
  sessionObject.laps.forEach((sessionLapObject, index) => {
@@ -10003,7 +10423,12 @@ var EventImporterFIT = class {
10003
10423
  new DataJumpEvent(activity.getDateIndex(jump.timestamp), {
10004
10424
  distance: jump.distance,
10005
10425
  height: jump.height,
10006
- score: jump.score
10426
+ score: jump.score,
10427
+ hang_time: jump.hang_time,
10428
+ position_lat: jump.position_lat,
10429
+ position_long: jump.position_long,
10430
+ speed: jump.speed,
10431
+ rotations: jump.rotations
10007
10432
  })
10008
10433
  );
10009
10434
  });
@@ -10222,12 +10647,6 @@ var EventImporterFIT = class {
10222
10647
  options
10223
10648
  );
10224
10649
  this.getStatsFromObject(sessionObject, activity, false).forEach((stat) => activity.addStat(stat));
10225
- if (fitDataObject.jumps && fitDataObject.jumps.length) {
10226
- const jumpWithMets = fitDataObject.jumps.find((j) => j.enhanced_mets);
10227
- if (jumpWithMets) {
10228
- activity.addStat(new DataVO2Max(jumpWithMets.enhanced_mets * 3.5));
10229
- }
10230
- }
10231
10650
  if (fitDataObject.user_profile) {
10232
10651
  const userProfile = fitDataObject.user_profile;
10233
10652
  if (isNumberOrString(userProfile.weight)) {
@@ -10542,6 +10961,7 @@ var EventImporterFIT = class {
10542
10961
  stats.push(new DataCyclingSeatedTime(seatedTime));
10543
10962
  }
10544
10963
  if (Number.isFinite(object.avg_stance_time)) {
10964
+ stats.push(new DataGroundContactTimeAvg(object.avg_stance_time));
10545
10965
  stats.push(new DataStanceTime(object.avg_stance_time));
10546
10966
  }
10547
10967
  if (Number.isFinite(object.avg_vertical_oscillation)) {
@@ -10608,6 +11028,69 @@ var EventImporterFIT = class {
10608
11028
  if (isNumberOrString(object.avg_vam)) {
10609
11029
  stats.push(new DataAvgVAM(object.avg_vam));
10610
11030
  }
11031
+ if (object.jumps && object.jumps.length > 0) {
11032
+ const jumps = object.jumps;
11033
+ let count = 0;
11034
+ let hangTimeSum = 0, hangTimeMin = Number.MAX_VALUE, hangTimeMax = -Number.MAX_VALUE;
11035
+ let distanceSum = 0, distanceMin = Number.MAX_VALUE, distanceMax = -Number.MAX_VALUE;
11036
+ let speedSum = 0, speedMin = Number.MAX_VALUE, speedMax = -Number.MAX_VALUE;
11037
+ let rotationsSum = 0, rotationsMin = Number.MAX_VALUE, rotationsMax = -Number.MAX_VALUE;
11038
+ let scoreSum = 0, scoreMin = Number.MAX_VALUE, scoreMax = -Number.MAX_VALUE;
11039
+ let heightSum = 0, heightMin = Number.MAX_VALUE, heightMax = -Number.MAX_VALUE;
11040
+ jumps.forEach((j) => {
11041
+ count++;
11042
+ if (Number.isFinite(j.hang_time)) {
11043
+ hangTimeSum += j.hang_time;
11044
+ hangTimeMin = Math.min(hangTimeMin, j.hang_time);
11045
+ hangTimeMax = Math.max(hangTimeMax, j.hang_time);
11046
+ }
11047
+ if (Number.isFinite(j.distance)) {
11048
+ distanceSum += j.distance;
11049
+ distanceMin = Math.min(distanceMin, j.distance);
11050
+ distanceMax = Math.max(distanceMax, j.distance);
11051
+ }
11052
+ if (Number.isFinite(j.speed)) {
11053
+ speedSum += j.speed;
11054
+ speedMin = Math.min(speedMin, j.speed);
11055
+ speedMax = Math.max(speedMax, j.speed);
11056
+ }
11057
+ if (Number.isFinite(j.rotations)) {
11058
+ rotationsSum += j.rotations;
11059
+ rotationsMin = Math.min(rotationsMin, j.rotations);
11060
+ rotationsMax = Math.max(rotationsMax, j.rotations);
11061
+ }
11062
+ if (Number.isFinite(j.score)) {
11063
+ scoreSum += j.score;
11064
+ scoreMin = Math.min(scoreMin, j.score);
11065
+ scoreMax = Math.max(scoreMax, j.score);
11066
+ }
11067
+ if (Number.isFinite(j.height)) {
11068
+ heightSum += j.height;
11069
+ heightMin = Math.min(heightMin, j.height);
11070
+ heightMax = Math.max(heightMax, j.height);
11071
+ }
11072
+ });
11073
+ if (count > 0) {
11074
+ if (hangTimeMin !== Number.MAX_VALUE) stats.push(new DataJumpHangTimeMin(hangTimeMin));
11075
+ if (hangTimeMax !== -Number.MAX_VALUE) stats.push(new DataJumpHangTimeMax(hangTimeMax));
11076
+ if (hangTimeSum > 0) stats.push(new DataJumpHangTimeAvg(hangTimeSum / count));
11077
+ if (distanceMin !== Number.MAX_VALUE) stats.push(new DataJumpDistanceMin(distanceMin));
11078
+ if (distanceMax !== -Number.MAX_VALUE) stats.push(new DataJumpDistanceMax(distanceMax));
11079
+ if (distanceSum > 0) stats.push(new DataJumpDistanceAvg(distanceSum / count));
11080
+ if (speedMin !== Number.MAX_VALUE) stats.push(new DataJumpSpeedMin(speedMin));
11081
+ if (speedMax !== -Number.MAX_VALUE) stats.push(new DataJumpSpeedMax(speedMax));
11082
+ if (speedSum > 0) stats.push(new DataJumpSpeedAvg(speedSum / count));
11083
+ if (rotationsMin !== Number.MAX_VALUE) stats.push(new DataJumpRotationsMin(rotationsMin));
11084
+ if (rotationsMax !== -Number.MAX_VALUE) stats.push(new DataJumpRotationsMax(rotationsMax));
11085
+ if (rotationsSum > 0) stats.push(new DataJumpRotationsAvg(rotationsSum / count));
11086
+ if (scoreMin !== Number.MAX_VALUE) stats.push(new DataJumpScoreMin(scoreMin));
11087
+ if (scoreMax !== -Number.MAX_VALUE) stats.push(new DataJumpScoreMax(scoreMax));
11088
+ if (scoreSum > 0) stats.push(new DataJumpScoreAvg(scoreSum / count));
11089
+ if (heightMin !== Number.MAX_VALUE) stats.push(new DataJumpHeightMin(heightMin));
11090
+ if (heightMax !== -Number.MAX_VALUE) stats.push(new DataJumpHeightMax(heightMax));
11091
+ if (heightSum > 0) stats.push(new DataJumpHeightAvg(heightSum / count));
11092
+ }
11093
+ }
10611
11094
  return stats;
10612
11095
  }
10613
11096
  static getCreatorFromFitDataObject(fitDataObject) {
@@ -11051,9 +11534,11 @@ var EventImporterSuuntoJSON = class {
11051
11534
  }).map((lapWindow) => lapWindow.Window) : [];
11052
11535
  const activities = activityStartEventSamples.map(
11053
11536
  (activityStartEventSample, index) => {
11537
+ const lastSampleTime = eventJSONObject.DeviceLog.Samples[eventJSONObject.DeviceLog.Samples.length - 1].TimeISO8601;
11538
+ const fallbackEndTime = stopEventSample ? stopEventSample.TimeISO8601 : lastSampleTime;
11054
11539
  const activity = new Activity(
11055
11540
  new Date(activityStartEventSample.TimeISO8601),
11056
- activityStartEventSamples.length - 1 === index ? new Date(stopEventSample ? stopEventSample.TimeISO8601 : eventJSONObject.DeviceLog.Header.TimeISO8601 || eventJSONObject.DeviceLog.Header.DateTime) : new Date(activityStartEventSamples[index + 1].TimeISO8601),
11541
+ activityStartEventSamples.length - 1 === index ? new Date(fallbackEndTime) : new Date(activityStartEventSamples[index + 1].TimeISO8601),
11057
11542
  ActivityTypes[ImporterSuuntoActivityIds[activityStartEventSample.Events[0].Activity.ActivityType]],
11058
11543
  creator,
11059
11544
  options
@@ -11174,9 +11659,6 @@ var EventImporterSuuntoJSON = class {
11174
11659
  }
11175
11660
  const event = new Event("", activities[0].startDate, activities[activities.length - 1].endDate, "suunto" /* SUUNTO */);
11176
11661
  activities.forEach((activity) => event.addActivity(activity));
11177
- this.getStats(eventJSONObject.DeviceLog.Header).forEach((stat) => {
11178
- event.addStat(stat);
11179
- });
11180
11662
  if (eventJSONObject.DeviceLog.Header.Settings) {
11181
11663
  this.getSettings(eventJSONObject.DeviceLog.Header.Settings).forEach((stat) => {
11182
11664
  event.getActivities().forEach((activity) => activity.addStat(stat));
@@ -11189,6 +11671,9 @@ var EventImporterSuuntoJSON = class {
11189
11671
  stats.forEach((stat) => activities[0].addStat(stat));
11190
11672
  }
11191
11673
  EventUtilities.generateStatsForAll(event);
11674
+ this.getStats(eventJSONObject.DeviceLog.Header).forEach((stat) => {
11675
+ event.addStat(stat);
11676
+ });
11192
11677
  resolve(event);
11193
11678
  });
11194
11679
  }
@@ -11427,6 +11912,47 @@ var EventImporterSuuntoJSON = class {
11427
11912
  }
11428
11913
  }
11429
11914
  }
11915
+ if (object.hasOwnProperty("GroundContactTime")) {
11916
+ if (Array.isArray(object.GroundContactTime)) {
11917
+ if (isNumber(object.GroundContactTime[0].Avg)) {
11918
+ stats.push(new DataGroundContactTimeAvg(object.GroundContactTime[0].Avg * 1e3));
11919
+ }
11920
+ if (isNumber(object.GroundContactTime[0].Max)) {
11921
+ stats.push(new DataGroundContactTimeMax(object.GroundContactTime[0].Max * 1e3));
11922
+ }
11923
+ if (isNumber(object.GroundContactTime[0].Min)) {
11924
+ stats.push(new DataGroundContactTimeMin(object.GroundContactTime[0].Min * 1e3));
11925
+ }
11926
+ }
11927
+ }
11928
+ if (object.hasOwnProperty("VerticalOscillation")) {
11929
+ if (Array.isArray(object.VerticalOscillation)) {
11930
+ if (isNumber(object.VerticalOscillation[0].Avg)) {
11931
+ stats.push(new DataVerticalOscillationAvg(object.VerticalOscillation[0].Avg * 1e3));
11932
+ }
11933
+ if (isNumber(object.VerticalOscillation[0].Max)) {
11934
+ stats.push(new DataVerticalOscillationMax(object.VerticalOscillation[0].Max * 1e3));
11935
+ }
11936
+ if (isNumber(object.VerticalOscillation[0].Min)) {
11937
+ stats.push(new DataVerticalOscillationMin(object.VerticalOscillation[0].Min * 1e3));
11938
+ }
11939
+ }
11940
+ }
11941
+ if (isNumber(object.FitnessAge)) {
11942
+ stats.push(new DataFitnessAge(object.FitnessAge));
11943
+ }
11944
+ if (object.Personal && isNumber(object.Personal.MaxHR)) {
11945
+ stats.push(new DataMaxHRSetting(object.Personal.MaxHR * 60));
11946
+ }
11947
+ if (object.hasOwnProperty("Depth")) {
11948
+ if (Array.isArray(object.Depth)) {
11949
+ if (isNumber(object.Depth[0].Max) && object.Depth[0].Max > 0) {
11950
+ stats.push(new DataDepthMax(object.Depth[0].Max));
11951
+ }
11952
+ } else if (isNumber(object.Depth.Max) && object.Depth.Max > 0) {
11953
+ stats.push(new DataDepthMax(object.Depth.Max));
11954
+ }
11955
+ }
11430
11956
  return stats;
11431
11957
  }
11432
11958
  };
@@ -11618,6 +12144,23 @@ var SuuntoSampleMapper = [
11618
12144
  dataType: DataBatteryVoltage.type,
11619
12145
  sampleField: "BatteryVoltage",
11620
12146
  convertSampleValue: (value) => Number(value)
12147
+ },
12148
+ {
12149
+ dataType: DataVerticalOscillation.type,
12150
+ sampleField: "VerticalOscillation",
12151
+ convertSampleValue: (value) => Number(value * 1e3)
12152
+ // Convert m to mm
12153
+ },
12154
+ {
12155
+ dataType: DataGroundContactTime.type,
12156
+ sampleField: "GroundContactTime",
12157
+ convertSampleValue: (value) => Number(value * 1e3)
12158
+ // Convert s to ms
12159
+ },
12160
+ {
12161
+ dataType: DataDepth.type,
12162
+ sampleField: "Depth",
12163
+ convertSampleValue: (value) => Number(value)
11621
12164
  }
11622
12165
  ];
11623
12166
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sports-alliance/sports-lib",
3
- "version": "7.1.2",
3
+ "version": "7.2.3",
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",
@@ -54,7 +54,7 @@
54
54
  "license": "SEE LICENSE IN LICENSE.md",
55
55
  "dependencies": {
56
56
  "fast-xml-parser": "^5.3.3",
57
- "fit-file-parser": "2.2.2",
57
+ "fit-file-parser": "2.2.5",
58
58
  "geolib": "^3.3.4",
59
59
  "gpx-builder": "^3.7.8",
60
60
  "kalmanjs": "^1.1.0",