@sports-alliance/sports-lib 6.1.0 → 6.1.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.
- package/jest.config.js +3 -2
- package/lib/cjs/activities/activity.d.ts +1 -0
- package/lib/cjs/activities/activity.interface.d.ts +5 -0
- package/lib/cjs/activities/activity.js +7 -0
- package/lib/cjs/activities/activity.types.d.ts +1 -0
- package/lib/cjs/activities/activity.types.js +1 -0
- package/lib/cjs/data/data.store.export.spec.js +2 -2
- package/lib/cjs/events/adapters/importers/fit/importer.fit.garmin.profile.data.d.ts +12 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.garmin.profile.data.js +868 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.garmin.profile.mapper.d.ts +22 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.garmin.profile.mapper.js +110 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.js +26 -10
- package/lib/cjs/events/adapters/importers/fit/importer.fit.spec.js +1 -1
- package/lib/cjs/index.d.ts +114 -0
- package/lib/cjs/index.js +124 -0
- package/lib/cjs/specs/activity-duration-stream.integration.spec.d.ts +1 -0
- package/lib/cjs/specs/activity-duration-stream.integration.spec.js +59 -0
- package/lib/esm/activities/activity.d.ts +1 -0
- package/lib/esm/activities/activity.interface.d.ts +5 -0
- package/lib/esm/activities/activity.js +7 -0
- package/lib/esm/activities/activity.types.d.ts +1 -0
- package/lib/esm/activities/activity.types.js +1 -0
- package/lib/esm/data/data.store.export.spec.js +2 -2
- package/lib/esm/events/adapters/importers/fit/importer.fit.garmin.profile.data.d.ts +12 -0
- package/lib/esm/events/adapters/importers/fit/importer.fit.garmin.profile.data.js +865 -0
- package/lib/esm/events/adapters/importers/fit/importer.fit.garmin.profile.mapper.d.ts +22 -0
- package/lib/esm/events/adapters/importers/fit/importer.fit.garmin.profile.mapper.js +106 -0
- package/lib/esm/events/adapters/importers/fit/importer.fit.js +26 -10
- package/lib/esm/events/adapters/importers/fit/importer.fit.spec.js +1 -1
- package/lib/esm/index.d.ts +114 -0
- package/lib/esm/index.js +114 -0
- package/lib/esm/specs/activity-duration-stream.integration.spec.d.ts +1 -0
- package/lib/esm/specs/activity-duration-stream.integration.spec.js +57 -0
- package/package.json +2 -1
package/jest.config.js
CHANGED
|
@@ -3,11 +3,12 @@ module.exports = {
|
|
|
3
3
|
'^.+\\.(ts|tsx)$': 'ts-jest',
|
|
4
4
|
'^.+\\.(js|jsx)$': 'babel-jest'
|
|
5
5
|
},
|
|
6
|
-
transformIgnorePatterns: ['node_modules/(?!fit-file-parser)'],
|
|
6
|
+
transformIgnorePatterns: ['node_modules/(?!fit-file-parser|@garmin/fitsdk)'],
|
|
7
|
+
testPathIgnorePatterns: ['<rootDir>/lib/', '<rootDir>/node_modules/'],
|
|
7
8
|
moduleNameMapper: {
|
|
8
9
|
'^node:buffer$': '<rootDir>/node_modules/buffer/index.js'
|
|
9
10
|
},
|
|
10
|
-
testTimeout:
|
|
11
|
+
testTimeout: 480000, // Allow 240s for integrations tests
|
|
11
12
|
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
|
|
12
13
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
13
14
|
// Since Jest 27 'node' env is the default and recommended one.
|
|
@@ -70,6 +70,7 @@ export declare class Activity extends DurationClassAbstract implements ActivityI
|
|
|
70
70
|
addEvent(event: DataEvent): this;
|
|
71
71
|
setAllEvents(events: DataEvent[]): this;
|
|
72
72
|
generateTimeStream(streamTypes?: string[]): StreamInterface;
|
|
73
|
+
generateDurationStream(streamTypes?: string[]): StreamInterface;
|
|
73
74
|
getDateIndex(date: Date): number;
|
|
74
75
|
toJSON(): ActivityJSONInterface;
|
|
75
76
|
}
|
|
@@ -197,6 +197,11 @@ export interface ActivityInterface extends StatsClassInterface, DurationClassInt
|
|
|
197
197
|
* @param streamTypes
|
|
198
198
|
*/
|
|
199
199
|
generateTimeStream(streamTypes?: string[]): StreamInterface;
|
|
200
|
+
/**
|
|
201
|
+
* Generates a duration stream based on the type of streams requested
|
|
202
|
+
* @param streamTypes
|
|
203
|
+
*/
|
|
204
|
+
generateDurationStream(streamTypes?: string[]): StreamInterface;
|
|
200
205
|
/**
|
|
201
206
|
* Gets the date index/duration from a date relative to the activity
|
|
202
207
|
* @param date
|
|
@@ -14,6 +14,7 @@ const data_stop_all_event_1 = require("../data/data.stop-all-event");
|
|
|
14
14
|
const data_time_1 = require("../data/data.time");
|
|
15
15
|
const activity_utilities_1 = require("../events/utilities/activity.utilities");
|
|
16
16
|
const data_distance_1 = require("../data/data.distance");
|
|
17
|
+
const data_duration_1 = require("../data/data.duration");
|
|
17
18
|
const data_rider_position_change_event_1 = require("../data/data.rider-position-change-event");
|
|
18
19
|
const activity_parsing_options_1 = require("./activity-parsing-options");
|
|
19
20
|
const parsing_event_lib_error_1 = require("../errors/parsing-event-lib.error");
|
|
@@ -216,6 +217,12 @@ class Activity extends duration_class_abstract_1.DurationClassAbstract {
|
|
|
216
217
|
});
|
|
217
218
|
return timeStream;
|
|
218
219
|
}
|
|
220
|
+
generateDurationStream(streamTypes = []) {
|
|
221
|
+
const timeStream = this.generateTimeStream(streamTypes);
|
|
222
|
+
const durationStream = this.createStream(data_duration_1.DataDuration.type);
|
|
223
|
+
durationStream.setData(timeStream.getData());
|
|
224
|
+
return durationStream;
|
|
225
|
+
}
|
|
219
226
|
getDateIndex(date) {
|
|
220
227
|
// @todo ceil vs floor (still debatable)
|
|
221
228
|
return Math.round((+date - +this.startDate) / 1000);
|
|
@@ -232,6 +232,7 @@ var ActivityTypes;
|
|
|
232
232
|
ActivityTypes["cycling_cyclocross"] = "Mountain Biking";
|
|
233
233
|
ActivityTypes["mountain"] = "Mountain Biking";
|
|
234
234
|
ActivityTypes["Mountain biking"] = "Mountain Biking";
|
|
235
|
+
ActivityTypes["cycling_downhill"] = "Downhill Cycling";
|
|
235
236
|
/**
|
|
236
237
|
* Motorcycling
|
|
237
238
|
*/
|
|
@@ -40,7 +40,7 @@ describe('DataStore Export Verification', () => {
|
|
|
40
40
|
'data.boolean.ts',
|
|
41
41
|
'data.percent.ts',
|
|
42
42
|
'data.array.ts',
|
|
43
|
-
'data.balance.ts'
|
|
43
|
+
'data.balance.ts' // interface/base
|
|
44
44
|
];
|
|
45
45
|
files.forEach(file => {
|
|
46
46
|
// Only verify regular TS files related to data
|
|
@@ -76,7 +76,7 @@ describe('DataStore Export Verification', () => {
|
|
|
76
76
|
else {
|
|
77
77
|
// If it doesn't have a 'type', it acts like a base class (e.g. DataQuantity)
|
|
78
78
|
// We can log it or ignore it.
|
|
79
|
-
// For now, let's assume if it's named Data*, it might be relevant,
|
|
79
|
+
// For now, let's assume if it's named Data*, it might be relevant,
|
|
80
80
|
// but strictly enforcing presence in DataStore usually requires the 'type' to be useful for the loader.
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const GarminManufacturers: {
|
|
2
|
+
[index: number]: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const GarminProducts: {
|
|
5
|
+
[index: number]: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const GarminSports: {
|
|
8
|
+
[index: number]: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const GarminSubSports: {
|
|
11
|
+
[index: number]: string;
|
|
12
|
+
};
|