@sports-alliance/sports-lib 7.0.13 → 7.1.1

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 (99) hide show
  1. package/check-metrics.js +30 -0
  2. package/find-values.js +33 -0
  3. package/inspect-devices.js +21 -0
  4. package/inspect-session.js +27 -0
  5. package/lib/cjs/activities/devices/device.d.ts +1 -0
  6. package/lib/cjs/activities/devices/device.interface.d.ts +1 -0
  7. package/lib/cjs/activities/devices/device.js +1 -0
  8. package/lib/cjs/activities/devices/device.json.interface.d.ts +1 -0
  9. package/lib/cjs/data/data.age.d.ts +6 -0
  10. package/lib/cjs/data/data.age.js +12 -0
  11. package/lib/cjs/data/data.avg-flow.d.ts +5 -0
  12. package/lib/cjs/data/data.avg-flow.js +9 -0
  13. package/lib/cjs/data/data.avg-grit.d.ts +5 -0
  14. package/lib/cjs/data/data.avg-grit.js +9 -0
  15. package/lib/cjs/data/data.avg-respiration-rate.d.ts +5 -0
  16. package/lib/cjs/data/data.avg-respiration-rate.js +9 -0
  17. package/lib/cjs/data/data.avg-vam.d.ts +5 -0
  18. package/lib/cjs/data/data.avg-vam.js +9 -0
  19. package/lib/cjs/data/data.est-sweat-loss.d.ts +6 -0
  20. package/lib/cjs/data/data.est-sweat-loss.js +12 -0
  21. package/lib/cjs/data/data.flow.d.ts +5 -0
  22. package/lib/cjs/data/data.flow.js +9 -0
  23. package/lib/cjs/data/data.gender.d.ts +4 -0
  24. package/lib/cjs/data/data.gender.js +8 -0
  25. package/lib/cjs/data/data.grit.d.ts +5 -0
  26. package/lib/cjs/data/data.grit.js +9 -0
  27. package/lib/cjs/data/data.height.d.ts +6 -0
  28. package/lib/cjs/data/data.height.js +12 -0
  29. package/lib/cjs/data/data.jump-count.d.ts +6 -0
  30. package/lib/cjs/data/data.jump-count.js +12 -0
  31. package/lib/cjs/data/data.jump-event.d.ts +12 -0
  32. package/lib/cjs/data/data.jump-event.js +16 -0
  33. package/lib/cjs/data/data.left-pedal-smoothness.d.ts +6 -0
  34. package/lib/cjs/data/data.left-pedal-smoothness.js +12 -0
  35. package/lib/cjs/data/data.left-torque-effectiveness.d.ts +6 -0
  36. package/lib/cjs/data/data.left-torque-effectiveness.js +12 -0
  37. package/lib/cjs/data/data.max-respiration-rate.d.ts +5 -0
  38. package/lib/cjs/data/data.max-respiration-rate.js +9 -0
  39. package/lib/cjs/data/data.min-respiration-rate.d.ts +5 -0
  40. package/lib/cjs/data/data.min-respiration-rate.js +9 -0
  41. package/lib/cjs/data/data.primary-benefit.d.ts +6 -0
  42. package/lib/cjs/data/data.primary-benefit.js +12 -0
  43. package/lib/cjs/data/data.resting-calories.d.ts +5 -0
  44. package/lib/cjs/data/data.resting-calories.js +9 -0
  45. package/lib/cjs/data/data.right-pedal-smoothness.d.ts +6 -0
  46. package/lib/cjs/data/data.right-pedal-smoothness.js +12 -0
  47. package/lib/cjs/data/data.right-torque-effectiveness.d.ts +6 -0
  48. package/lib/cjs/data/data.right-torque-effectiveness.js +12 -0
  49. package/lib/cjs/data/data.store.js +54 -2
  50. package/lib/cjs/data/data.total-flow.d.ts +5 -0
  51. package/lib/cjs/data/data.total-flow.js +9 -0
  52. package/lib/cjs/data/data.total-grit.d.ts +5 -0
  53. package/lib/cjs/data/data.total-grit.js +9 -0
  54. package/lib/cjs/data/data.training-load-peak.d.ts +5 -0
  55. package/lib/cjs/data/data.training-load-peak.js +9 -0
  56. package/lib/cjs/data/data.weight.d.ts +6 -0
  57. package/lib/cjs/data/data.weight.js +12 -0
  58. package/lib/cjs/events/adapters/importers/fit/importer.fit.d.ts +3 -1
  59. package/lib/cjs/events/adapters/importers/fit/importer.fit.js +211 -6
  60. package/lib/cjs/events/adapters/importers/fit/importer.fit.mapper.js +42 -0
  61. package/lib/cjs/events/adapters/importers/fit/importer.fit.mtb.spec.d.ts +1 -0
  62. package/lib/cjs/events/adapters/importers/fit/importer.fit.mtb.spec.js +217 -0
  63. package/lib/cjs/events/adapters/importers/fit/importer.fit.road.spec.d.ts +1 -0
  64. package/lib/cjs/events/adapters/importers/fit/importer.fit.road.spec.js +103 -0
  65. package/lib/cjs/index.d.ts +4 -0
  66. package/lib/cjs/index.js +4 -0
  67. package/lib/esm/activities/devices/device.d.ts +1 -0
  68. package/lib/esm/activities/devices/device.interface.d.ts +1 -0
  69. package/lib/esm/activities/devices/device.json.interface.d.ts +1 -0
  70. package/lib/esm/data/data.age.d.ts +6 -0
  71. package/lib/esm/data/data.avg-flow.d.ts +5 -0
  72. package/lib/esm/data/data.avg-grit.d.ts +5 -0
  73. package/lib/esm/data/data.avg-respiration-rate.d.ts +5 -0
  74. package/lib/esm/data/data.avg-vam.d.ts +5 -0
  75. package/lib/esm/data/data.est-sweat-loss.d.ts +6 -0
  76. package/lib/esm/data/data.flow.d.ts +5 -0
  77. package/lib/esm/data/data.gender.d.ts +4 -0
  78. package/lib/esm/data/data.grit.d.ts +5 -0
  79. package/lib/esm/data/data.height.d.ts +6 -0
  80. package/lib/esm/data/data.jump-count.d.ts +6 -0
  81. package/lib/esm/data/data.jump-event.d.ts +12 -0
  82. package/lib/esm/data/data.left-pedal-smoothness.d.ts +6 -0
  83. package/lib/esm/data/data.left-torque-effectiveness.d.ts +6 -0
  84. package/lib/esm/data/data.max-respiration-rate.d.ts +5 -0
  85. package/lib/esm/data/data.min-respiration-rate.d.ts +5 -0
  86. package/lib/esm/data/data.primary-benefit.d.ts +6 -0
  87. package/lib/esm/data/data.resting-calories.d.ts +5 -0
  88. package/lib/esm/data/data.right-pedal-smoothness.d.ts +6 -0
  89. package/lib/esm/data/data.right-torque-effectiveness.d.ts +6 -0
  90. package/lib/esm/data/data.total-flow.d.ts +5 -0
  91. package/lib/esm/data/data.total-grit.d.ts +5 -0
  92. package/lib/esm/data/data.training-load-peak.d.ts +5 -0
  93. package/lib/esm/data/data.weight.d.ts +6 -0
  94. package/lib/esm/events/adapters/importers/fit/importer.fit.d.ts +3 -1
  95. package/lib/esm/events/adapters/importers/fit/importer.fit.mtb.spec.d.ts +1 -0
  96. package/lib/esm/events/adapters/importers/fit/importer.fit.road.spec.d.ts +1 -0
  97. package/lib/esm/index.d.ts +4 -0
  98. package/lib/esm/index.js +522 -4
  99. package/package.json +2 -2
package/lib/esm/index.js CHANGED
@@ -1,3 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
1
8
  // src/data/data.interface.ts
2
9
  var UnitSystem = /* @__PURE__ */ ((UnitSystem2) => {
3
10
  UnitSystem2[UnitSystem2["Metric"] = 0] = "Metric";
@@ -3739,6 +3746,281 @@ var DataGradeSmooth = class extends DataPercent {
3739
3746
  }
3740
3747
  };
3741
3748
 
3749
+ // src/data/data.weight.ts
3750
+ var DataWeight = class extends DataNumber {
3751
+ static {
3752
+ this.type = "Weight";
3753
+ }
3754
+ static {
3755
+ this.unit = "kg";
3756
+ }
3757
+ getDisplayValue() {
3758
+ return this.getValue().toFixed(1);
3759
+ }
3760
+ };
3761
+
3762
+ // src/data/data.height.ts
3763
+ var DataHeight = class extends DataNumber {
3764
+ static {
3765
+ this.type = "Height";
3766
+ }
3767
+ static {
3768
+ this.unit = "m";
3769
+ }
3770
+ getDisplayValue() {
3771
+ return this.getValue().toFixed(2);
3772
+ }
3773
+ };
3774
+
3775
+ // src/data/data.age.ts
3776
+ var DataAge = class extends DataNumber {
3777
+ static {
3778
+ this.type = "Age";
3779
+ }
3780
+ static {
3781
+ this.unit = "years";
3782
+ }
3783
+ getDisplayValue() {
3784
+ return this.getValue().toString();
3785
+ }
3786
+ };
3787
+
3788
+ // src/data/data.gender.ts
3789
+ var DataGender = class extends DataString {
3790
+ static {
3791
+ this.type = "Gender";
3792
+ }
3793
+ };
3794
+
3795
+ // src/data/data.avg-flow.ts
3796
+ var DataAvgFlow = class extends DataNumber {
3797
+ static {
3798
+ this.type = "Avg Flow";
3799
+ }
3800
+ static {
3801
+ this.unit = "";
3802
+ }
3803
+ };
3804
+
3805
+ // src/data/data.avg-grit.ts
3806
+ var DataAvgGrit = class extends DataNumber {
3807
+ static {
3808
+ this.type = "Avg Grit";
3809
+ }
3810
+ static {
3811
+ this.unit = "";
3812
+ }
3813
+ };
3814
+
3815
+ // src/data/data.avg-respiration-rate.ts
3816
+ var DataAvgRespirationRate = class extends DataNumber {
3817
+ static {
3818
+ this.type = "Avg Respiration Rate";
3819
+ }
3820
+ static {
3821
+ this.unit = "br/min";
3822
+ }
3823
+ };
3824
+
3825
+ // src/data/data.avg-vam.ts
3826
+ var DataAvgVAM = class extends DataNumber {
3827
+ static {
3828
+ this.type = "Avg VAM";
3829
+ }
3830
+ static {
3831
+ this.unit = "m/h";
3832
+ }
3833
+ };
3834
+
3835
+ // src/data/data.est-sweat-loss.ts
3836
+ var DataEstSweatLoss = class extends DataNumber {
3837
+ static {
3838
+ this.type = "Est Sweat Loss";
3839
+ }
3840
+ static {
3841
+ this.unit = "ml";
3842
+ }
3843
+ constructor(value) {
3844
+ super(value);
3845
+ }
3846
+ };
3847
+
3848
+ // src/data/data.flow.ts
3849
+ var DataFlow = class extends DataNumber {
3850
+ static {
3851
+ this.type = "Flow";
3852
+ }
3853
+ static {
3854
+ this.unit = "";
3855
+ }
3856
+ };
3857
+
3858
+ // src/data/data.grit.ts
3859
+ var DataGrit = class extends DataNumber {
3860
+ static {
3861
+ this.type = "Grit";
3862
+ }
3863
+ static {
3864
+ this.unit = "";
3865
+ }
3866
+ };
3867
+
3868
+ // src/data/data.jump-count.ts
3869
+ var DataJumpCount = class extends DataNumber {
3870
+ static {
3871
+ this.type = "Jump Count";
3872
+ }
3873
+ static {
3874
+ this.unit = "";
3875
+ }
3876
+ constructor(jumpCount) {
3877
+ super(jumpCount);
3878
+ }
3879
+ };
3880
+
3881
+ // src/data/data.jump-event.ts
3882
+ var DataJumpEvent = class extends DataEvent {
3883
+ constructor(timestamp, jumpData) {
3884
+ super(timestamp);
3885
+ this.jumpData = jumpData;
3886
+ }
3887
+ static {
3888
+ this.type = "Jump Event";
3889
+ }
3890
+ toJSON() {
3891
+ const json = super.toJSON();
3892
+ return {
3893
+ ...json,
3894
+ jumpData: this.jumpData
3895
+ };
3896
+ }
3897
+ };
3898
+
3899
+ // src/data/data.left-pedal-smoothness.ts
3900
+ var DataLeftPedalSmoothness = class extends DataNumber {
3901
+ static {
3902
+ this.type = "Left Pedal Smoothness";
3903
+ }
3904
+ static {
3905
+ this.unit = "%";
3906
+ }
3907
+ getDisplayValue() {
3908
+ return Math.round(this.getValue());
3909
+ }
3910
+ };
3911
+
3912
+ // src/data/data.left-torque-effectiveness.ts
3913
+ var DataLeftTorqueEffectiveness = class extends DataNumber {
3914
+ static {
3915
+ this.type = "Left Torque Effectiveness";
3916
+ }
3917
+ static {
3918
+ this.unit = "%";
3919
+ }
3920
+ getDisplayValue() {
3921
+ return Math.round(this.getValue());
3922
+ }
3923
+ };
3924
+
3925
+ // src/data/data.max-respiration-rate.ts
3926
+ var DataMaxRespirationRate = class extends DataNumber {
3927
+ static {
3928
+ this.type = "Max Respiration Rate";
3929
+ }
3930
+ static {
3931
+ this.unit = "br/min";
3932
+ }
3933
+ };
3934
+
3935
+ // src/data/data.min-respiration-rate.ts
3936
+ var DataMinRespirationRate = class extends DataNumber {
3937
+ static {
3938
+ this.type = "Min Respiration Rate";
3939
+ }
3940
+ static {
3941
+ this.unit = "br/min";
3942
+ }
3943
+ };
3944
+
3945
+ // src/data/data.primary-benefit.ts
3946
+ var DataPrimaryBenefit = class extends DataNumber {
3947
+ static {
3948
+ this.type = "Primary Benefit";
3949
+ }
3950
+ static {
3951
+ this.unit = "";
3952
+ }
3953
+ constructor(value) {
3954
+ super(value);
3955
+ }
3956
+ };
3957
+
3958
+ // src/data/data.resting-calories.ts
3959
+ var DataRestingCalories = class extends DataNumber {
3960
+ static {
3961
+ this.type = "Resting Calories";
3962
+ }
3963
+ static {
3964
+ this.unit = "kcal";
3965
+ }
3966
+ };
3967
+
3968
+ // src/data/data.right-pedal-smoothness.ts
3969
+ var DataRightPedalSmoothness = class extends DataNumber {
3970
+ static {
3971
+ this.type = "Right Pedal Smoothness";
3972
+ }
3973
+ static {
3974
+ this.unit = "%";
3975
+ }
3976
+ getDisplayValue() {
3977
+ return Math.round(this.getValue());
3978
+ }
3979
+ };
3980
+
3981
+ // src/data/data.right-torque-effectiveness.ts
3982
+ var DataRightTorqueEffectiveness = class extends DataNumber {
3983
+ static {
3984
+ this.type = "Right Torque Effectiveness";
3985
+ }
3986
+ static {
3987
+ this.unit = "%";
3988
+ }
3989
+ getDisplayValue() {
3990
+ return Math.round(this.getValue());
3991
+ }
3992
+ };
3993
+
3994
+ // src/data/data.total-flow.ts
3995
+ var DataTotalFlow = class extends DataNumber {
3996
+ static {
3997
+ this.type = "Total Flow";
3998
+ }
3999
+ static {
4000
+ this.unit = "";
4001
+ }
4002
+ };
4003
+
4004
+ // src/data/data.total-grit.ts
4005
+ var DataTotalGrit = class extends DataNumber {
4006
+ static {
4007
+ this.type = "Total Grit";
4008
+ }
4009
+ static {
4010
+ this.unit = "";
4011
+ }
4012
+ };
4013
+
4014
+ // src/data/data.training-load-peak.ts
4015
+ var DataTrainingLoadPeak = class extends DataNumber {
4016
+ static {
4017
+ this.type = "Training Load Peak";
4018
+ }
4019
+ static {
4020
+ this.unit = "";
4021
+ }
4022
+ };
4023
+
3742
4024
  // src/data/data.store.ts
3743
4025
  var DataTotalTrainingEffectLegacy = class extends DataAerobicTrainingEffect {
3744
4026
  static {
@@ -4010,7 +4292,31 @@ var DataStore = {
4010
4292
  DataTargetSpeedZone,
4011
4293
  DataTargetDistance,
4012
4294
  DataTargetTime,
4013
- DataTotalTrainingEffectLegacy
4295
+ DataTotalTrainingEffectLegacy,
4296
+ DataWeight,
4297
+ DataHeight,
4298
+ DataAge,
4299
+ DataGender,
4300
+ DataAvgFlow,
4301
+ DataAvgGrit,
4302
+ DataAvgRespirationRate,
4303
+ DataAvgVAM,
4304
+ DataEstSweatLoss,
4305
+ DataFlow,
4306
+ DataGrit,
4307
+ DataJumpCount,
4308
+ DataJumpEvent,
4309
+ DataLeftPedalSmoothness,
4310
+ DataLeftTorqueEffectiveness,
4311
+ DataMaxRespirationRate,
4312
+ DataMinRespirationRate,
4313
+ DataPrimaryBenefit,
4314
+ DataRestingCalories,
4315
+ DataRightPedalSmoothness,
4316
+ DataRightTorqueEffectiveness,
4317
+ DataTotalFlow,
4318
+ DataTotalGrit,
4319
+ DataTrainingLoadPeak
4014
4320
  };
4015
4321
  var DynamicDataLoader = class _DynamicDataLoader {
4016
4322
  static {
@@ -4029,7 +4335,11 @@ var DynamicDataLoader = class _DynamicDataLoader {
4029
4335
  DataPace.type,
4030
4336
  DataGradeAdjustedSpeed.type,
4031
4337
  DataGradeAdjustedPace.type,
4032
- DataSpeed.type
4338
+ DataSpeed.type,
4339
+ DataWeight.type,
4340
+ DataHeight.type,
4341
+ DataAge.type,
4342
+ DataGender.type
4033
4343
  ];
4034
4344
  }
4035
4345
  static {
@@ -9321,6 +9631,42 @@ var FITSampleMapper = [
9321
9631
  getSampleValue: (sample) => {
9322
9632
  return sample.vertical_ratio;
9323
9633
  }
9634
+ },
9635
+ {
9636
+ dataType: DataGrit.type,
9637
+ getSampleValue: (sample) => {
9638
+ return sample.grit;
9639
+ }
9640
+ },
9641
+ {
9642
+ dataType: DataFlow.type,
9643
+ getSampleValue: (sample) => {
9644
+ return sample.flow;
9645
+ }
9646
+ },
9647
+ {
9648
+ dataType: DataLeftTorqueEffectiveness.type,
9649
+ getSampleValue: (sample) => {
9650
+ return sample.left_torque_effectiveness;
9651
+ }
9652
+ },
9653
+ {
9654
+ dataType: DataRightTorqueEffectiveness.type,
9655
+ getSampleValue: (sample) => {
9656
+ return sample.right_torque_effectiveness;
9657
+ }
9658
+ },
9659
+ {
9660
+ dataType: DataLeftPedalSmoothness.type,
9661
+ getSampleValue: (sample) => {
9662
+ return sample.left_pedal_smoothness;
9663
+ }
9664
+ },
9665
+ {
9666
+ dataType: DataRightPedalSmoothness.type,
9667
+ getSampleValue: (sample) => {
9668
+ return sample.right_pedal_smoothness;
9669
+ }
9324
9670
  }
9325
9671
  ];
9326
9672
 
@@ -9386,6 +9732,7 @@ var Device = class {
9386
9732
  antTransmissionType: this.antTransmissionType || null,
9387
9733
  antNetwork: this.antNetwork || null,
9388
9734
  sourceType: this.sourceType || null,
9735
+ antId: this.antId || null,
9389
9736
  cumOperatingTime: this.cumOperatingTime || null
9390
9737
  };
9391
9738
  }
@@ -9506,7 +9853,7 @@ var ImporterFitDevelopmentDeviceNames = {
9506
9853
  };
9507
9854
 
9508
9855
  // src/events/adapters/importers/fit/importer.fit.ts
9509
- import FitFileParser from "fit-file-parser";
9856
+ var FitFileParser = __require("fit-file-parser").default;
9510
9857
  var INVALID_DATES_ELAPSED_TIME_RATIO_THRESHOLD = 1.15;
9511
9858
  var EventImporterFIT = class {
9512
9859
  static async getFromArrayBuffer(arrayBuffer, options = ActivityParsingOptions.DEFAULT, name = "New Event") {
@@ -9653,6 +10000,21 @@ var EventImporterFIT = class {
9653
10000
  }
9654
10001
  }
9655
10002
  });
10003
+ if (fitDataObject.jumps && fitDataObject.jumps.length) {
10004
+ fitDataObject.jumps.filter((jump) => {
10005
+ const timestamp = new Date(jump.timestamp);
10006
+ const margin = 24 * 60 * 60 * 1e3;
10007
+ return timestamp.getTime() >= activity.startDate.getTime() - margin && timestamp.getTime() <= activity.endDate.getTime() + margin;
10008
+ }).forEach((jump) => {
10009
+ activity.addEvent(
10010
+ new DataJumpEvent(activity.getDateIndex(jump.timestamp), {
10011
+ distance: jump.distance,
10012
+ height: jump.height,
10013
+ score: jump.score
10014
+ })
10015
+ );
10016
+ });
10017
+ }
9656
10018
  const isLengthsBased = this.isLengthsBased(sessionObject);
9657
10019
  const samples = isLengthsBased ? this.generateSamplesFromLengths(sessionObject, options) : fitDataObject.records.filter((record) => {
9658
10020
  return record.timestamp >= activity.startDate && record.timestamp <= activity.endDate;
@@ -9778,6 +10140,9 @@ var EventImporterFIT = class {
9778
10140
  device.antTransmissionType = deviceInfo.ant_transmission_type;
9779
10141
  device.antNetwork = deviceInfo.ant_network;
9780
10142
  device.sourceType = deviceInfo.source_type;
10143
+ if (deviceInfo.ant_id) {
10144
+ device.antId = deviceInfo.ant_id;
10145
+ }
9781
10146
  device.cumOperatingTime = deviceInfo.cum_operating_time;
9782
10147
  return device;
9783
10148
  });
@@ -9864,6 +10229,88 @@ var EventImporterFIT = class {
9864
10229
  options
9865
10230
  );
9866
10231
  this.getStatsFromObject(sessionObject, activity, false).forEach((stat) => activity.addStat(stat));
10232
+ if (fitDataObject.jumps && fitDataObject.jumps.length) {
10233
+ const jumpWithMets = fitDataObject.jumps.find((j) => j.enhanced_mets);
10234
+ if (jumpWithMets) {
10235
+ activity.addStat(new DataVO2Max(jumpWithMets.enhanced_mets * 3.5));
10236
+ }
10237
+ }
10238
+ if (fitDataObject.user_profile) {
10239
+ const userProfile = fitDataObject.user_profile;
10240
+ if (isNumberOrString(userProfile.weight)) {
10241
+ activity.addStat(new DataWeight(userProfile.weight));
10242
+ }
10243
+ if (isNumberOrString(userProfile.height)) {
10244
+ activity.addStat(new DataHeight(userProfile.height));
10245
+ }
10246
+ if (isNumberOrString(userProfile.age)) {
10247
+ activity.addStat(new DataAge(userProfile.age));
10248
+ }
10249
+ if (userProfile.gender) {
10250
+ activity.addStat(new DataGender(userProfile.gender));
10251
+ }
10252
+ }
10253
+ if (fitDataObject.time_in_zone && fitDataObject.time_in_zone.length) {
10254
+ const sessionTimeInZone = fitDataObject.time_in_zone.find(
10255
+ (z) => z.reference_mesg === 18 && (z.reference_index === 0 || z.reference_index === void 0)
10256
+ );
10257
+ if (sessionTimeInZone && sessionTimeInZone.time_in_hr_zone && Array.isArray(sessionTimeInZone.time_in_hr_zone)) {
10258
+ const hrZones = sessionTimeInZone.time_in_hr_zone;
10259
+ const hrZoneBoundaries = sessionTimeInZone.hr_zone_high_boundary;
10260
+ if (!activity.getStat(DataHeartRateZoneOneDuration.type)) {
10261
+ if (hrZones[0] !== void 0 && hrZones[0] !== null) {
10262
+ activity.addStat(new DataHeartRateZoneOneDuration(hrZones[0]));
10263
+ }
10264
+ if (hrZones[1] !== void 0 && hrZones[1] !== null) {
10265
+ activity.addStat(new DataHeartRateZoneTwoDuration(hrZones[1]));
10266
+ }
10267
+ if (hrZones[2] !== void 0 && hrZones[2] !== null) {
10268
+ activity.addStat(new DataHeartRateZoneThreeDuration(hrZones[2]));
10269
+ }
10270
+ if (hrZones[3] !== void 0 && hrZones[3] !== null) {
10271
+ activity.addStat(new DataHeartRateZoneFourDuration(hrZones[3]));
10272
+ }
10273
+ if (hrZones[4] !== void 0 && hrZones[4] !== null) {
10274
+ activity.addStat(new DataHeartRateZoneFiveDuration(hrZones[4]));
10275
+ }
10276
+ }
10277
+ const existingHrZones = activity.intensityZones.find((iz) => iz.type === DataHeartRate.type);
10278
+ if (!existingHrZones && Array.isArray(hrZoneBoundaries) && hrZoneBoundaries.length > 0) {
10279
+ const hrIntensityZones = new IntensityZones(DataHeartRate.type);
10280
+ hrIntensityZones.zone1Duration = hrZones[0] || 0;
10281
+ hrIntensityZones.zone2Duration = hrZones[1] || 0;
10282
+ hrIntensityZones.zone3Duration = hrZones[2] || 0;
10283
+ hrIntensityZones.zone4Duration = hrZones[3] || 0;
10284
+ hrIntensityZones.zone5Duration = hrZones[4] || 0;
10285
+ if (isNumber(hrZoneBoundaries[0]) && hrZoneBoundaries[0] !== 255) {
10286
+ hrIntensityZones.zone2LowerLimit = hrZoneBoundaries[0];
10287
+ }
10288
+ if (isNumber(hrZoneBoundaries[1]) && hrZoneBoundaries[1] !== 255) {
10289
+ hrIntensityZones.zone3LowerLimit = hrZoneBoundaries[1];
10290
+ }
10291
+ if (isNumber(hrZoneBoundaries[2]) && hrZoneBoundaries[2] !== 255) {
10292
+ hrIntensityZones.zone4LowerLimit = hrZoneBoundaries[2];
10293
+ }
10294
+ if (isNumber(hrZoneBoundaries[3]) && hrZoneBoundaries[3] !== 255) {
10295
+ hrIntensityZones.zone5LowerLimit = hrZoneBoundaries[3];
10296
+ }
10297
+ activity.intensityZones.push(hrIntensityZones);
10298
+ } else if (existingHrZones && Array.isArray(hrZoneBoundaries) && hrZoneBoundaries.length > 0) {
10299
+ if (!existingHrZones.zone2LowerLimit && isNumber(hrZoneBoundaries[0]) && hrZoneBoundaries[0] !== 255) {
10300
+ existingHrZones.zone2LowerLimit = hrZoneBoundaries[0];
10301
+ }
10302
+ if (!existingHrZones.zone3LowerLimit && isNumber(hrZoneBoundaries[1]) && hrZoneBoundaries[1] !== 255) {
10303
+ existingHrZones.zone3LowerLimit = hrZoneBoundaries[1];
10304
+ }
10305
+ if (!existingHrZones.zone4LowerLimit && isNumber(hrZoneBoundaries[2]) && hrZoneBoundaries[2] !== 255) {
10306
+ existingHrZones.zone4LowerLimit = hrZoneBoundaries[2];
10307
+ }
10308
+ if (!existingHrZones.zone5LowerLimit && isNumber(hrZoneBoundaries[3]) && hrZoneBoundaries[3] !== 255) {
10309
+ existingHrZones.zone5LowerLimit = hrZoneBoundaries[3];
10310
+ }
10311
+ }
10312
+ }
10313
+ }
9867
10314
  return activity;
9868
10315
  }
9869
10316
  }
@@ -9965,6 +10412,9 @@ var EventImporterFIT = class {
9965
10412
  if (isNumberOrString(object.max_heart_rate)) {
9966
10413
  stats.push(new DataHeartRateMax(object.max_heart_rate));
9967
10414
  }
10415
+ if (object.vo2_max_cycling && object.vo2_max_cycling > 10) {
10416
+ stats.push(new DataVO2Max(object.vo2_max_cycling));
10417
+ }
9968
10418
  if (isNumberOrString(object.avg_cadence)) {
9969
10419
  stats.push(new DataCadenceAvg(object.avg_cadence));
9970
10420
  }
@@ -9977,6 +10427,14 @@ var EventImporterFIT = class {
9977
10427
  if (isNumberOrString(object.avg_power)) {
9978
10428
  stats.push(new DataPowerAvg(object.avg_power));
9979
10429
  }
10430
+ if (isNumberOrString(object.total_flow)) {
10431
+ }
10432
+ if (isNumberOrString(object.avg_grit)) {
10433
+ stats.push(new DataAvgGrit(object.avg_grit));
10434
+ }
10435
+ if (isNumberOrString(object.avg_flow)) {
10436
+ stats.push(new DataAvgFlow(object.avg_flow));
10437
+ }
9980
10438
  if (isNumberOrString(object.min_power)) {
9981
10439
  stats.push(new DataPowerMin(object.min_power));
9982
10440
  }
@@ -10041,7 +10499,9 @@ var EventImporterFIT = class {
10041
10499
  if (isNumberOrString(object.total_training_effect)) {
10042
10500
  stats.push(new DataAerobicTrainingEffect(object.total_training_effect));
10043
10501
  }
10044
- if (isNumberOrString(object.total_anaerobic_effect)) {
10502
+ if (isNumberOrString(object.total_anaerobic_training_effect)) {
10503
+ stats.push(new DataAnaerobicTrainingEffect(object.total_anaerobic_training_effect));
10504
+ } else if (isNumberOrString(object.total_anaerobic_effect)) {
10045
10505
  stats.push(new DataAnaerobicTrainingEffect(object.total_anaerobic_effect));
10046
10506
  }
10047
10507
  if (isNumberOrString(object.estimated_vo2_max)) {
@@ -10101,6 +10561,60 @@ var EventImporterFIT = class {
10101
10561
  const avgStrideLengthMeters = object.avg_step_length / 1e3;
10102
10562
  stats.push(new DataAvgStrideLength(Math.round(avgStrideLengthMeters * 100) / 100));
10103
10563
  }
10564
+ if (isNumberOrString(object.avg_respiration_rate) || isNumberOrString(object.enhanced_avg_respiration_rate)) {
10565
+ stats.push(
10566
+ new DataAvgRespirationRate(object.enhanced_avg_respiration_rate || object.avg_respiration_rate)
10567
+ );
10568
+ }
10569
+ if (isNumberOrString(object.max_respiration_rate) || isNumberOrString(object.enhanced_max_respiration_rate)) {
10570
+ stats.push(
10571
+ new DataMaxRespirationRate(object.enhanced_max_respiration_rate || object.max_respiration_rate)
10572
+ );
10573
+ }
10574
+ if (isNumberOrString(object.min_respiration_rate) || isNumberOrString(object.enhanced_min_respiration_rate)) {
10575
+ stats.push(
10576
+ new DataMinRespirationRate(object.enhanced_min_respiration_rate || object.min_respiration_rate)
10577
+ );
10578
+ }
10579
+ if (isNumberOrString(object.total_grit)) {
10580
+ stats.push(new DataTotalGrit(object.total_grit));
10581
+ }
10582
+ if (isNumberOrString(object.avg_flow)) {
10583
+ stats.push(new DataAvgFlow(object.avg_flow));
10584
+ }
10585
+ if (isNumberOrString(object.est_sweat_loss)) {
10586
+ stats.push(new DataEstSweatLoss(object.est_sweat_loss));
10587
+ }
10588
+ if (isNumberOrString(object.primary_benefit)) {
10589
+ stats.push(new DataPrimaryBenefit(object.primary_benefit));
10590
+ }
10591
+ if (object.sport_profile_name) {
10592
+ stats.push(new DataSportProfileName(object.sport_profile_name));
10593
+ }
10594
+ if (isNumberOrString(object.jump_count)) {
10595
+ stats.push(new DataJumpCount(object.jump_count));
10596
+ }
10597
+ if (isNumberOrString(object.training_load_peak)) {
10598
+ stats.push(new DataTrainingLoadPeak(object.training_load_peak));
10599
+ }
10600
+ if (isNumber(object.start_position_lat) && isNumber(object.start_position_long)) {
10601
+ stats.push(new DataStartPosition({
10602
+ latitudeDegrees: object.start_position_lat,
10603
+ longitudeDegrees: object.start_position_long
10604
+ }));
10605
+ }
10606
+ if (isNumber(object.end_position_lat) && isNumber(object.end_position_long)) {
10607
+ stats.push(new DataEndPosition({
10608
+ latitudeDegrees: object.end_position_lat,
10609
+ longitudeDegrees: object.end_position_long
10610
+ }));
10611
+ }
10612
+ if (isNumberOrString(object.resting_calories)) {
10613
+ stats.push(new DataRestingCalories(object.resting_calories));
10614
+ }
10615
+ if (isNumberOrString(object.avg_vam)) {
10616
+ stats.push(new DataAvgVAM(object.avg_vam));
10617
+ }
10104
10618
  return stats;
10105
10619
  }
10106
10620
  static getCreatorFromFitDataObject(fitDataObject) {
@@ -11887,6 +12401,8 @@ export {
11887
12401
  DataIBI,
11888
12402
  DataLatitudeDegrees,
11889
12403
  DataLeftBalance,
12404
+ DataLeftPedalSmoothness,
12405
+ DataLeftTorqueEffectiveness,
11890
12406
  DataLongitudeDegrees,
11891
12407
  DataMovingTime,
11892
12408
  DataPace,
@@ -11904,6 +12420,8 @@ export {
11904
12420
  DataRPE,
11905
12421
  DataRecoveryTime,
11906
12422
  DataRightBalance,
12423
+ DataRightPedalSmoothness,
12424
+ DataRightTorqueEffectiveness,
11907
12425
  DataSeaLevelPressure,
11908
12426
  DataSpeed,
11909
12427
  DataSpeedAvg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sports-alliance/sports-lib",
3
- "version": "7.0.13",
3
+ "version": "7.1.1",
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.1.1",
57
+ "fit-file-parser": "2.2.1",
58
58
  "geolib": "^3.3.4",
59
59
  "gpx-builder": "^3.7.8",
60
60
  "kalmanjs": "^1.1.0",