@sports-alliance/sports-lib
Version:
A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc
85 lines (84 loc) • 3.74 kB
TypeScript
import { EventInterface } from '../../../event.interface';
import { CreatorInterface } from '../../../../creators/creator.interface';
import { ActivityInterface } from '../../../../activities/activity.interface';
import { DataInterface } from '../../../../data/data.interface';
import { ActivityParsingOptions } from '../../../../activities/activity-parsing-options';
import { Buffer } from 'buffer';
export declare class EventImporterFIT {
private static readonly INVALID_FIT_HRV_INTERVAL_MS;
private static readonly MIN_VALID_VO2_MAX;
private static readonly MAX_VALID_VO2_MAX;
static getFromArrayBuffer(arrayBuffer: ArrayBuffer | Buffer<ArrayBuffer>, options?: ActivityParsingOptions, name?: string): Promise<EventInterface>;
/**
* Tell if an activity is lengths based (e.g. Pool swimming activities)
* @param sessionObject
* @private
*/
private static isLengthsBased;
private static getIBIDataForActivity;
/**
* Generate streams samples based on lengths on an activity
* When based on lengths, an activity do not provides sample under records object
* @param sessionObject
* @param options
* @private
*/
private static generateSamplesFromLengths;
private static mapDeviceInfosToDevices;
private static deviceSignatureWithoutTimestamp;
/**
* Keep first+last of each contiguous run with identical signature (all fields except timestamp).
* This preserves transitions while collapsing timestamp-only spam from FIT `device_info`.
*/
private static compactDeviceInfosByRuns;
private static getNumericValue;
private static getDateFromValue;
private static getSessionlessLapStartDate;
private static getSessionlessLapEndDate;
private static buildSessionFromTopLevelMessages;
private static getFinalRecordDistance;
private static normalizeFitDataObjectForActivities;
private static isValidDate;
private static getValidLapTimestamp;
private static normalizeElapsedTimeForResolvedDates;
private static resolveInvalidLapDates;
private static getLapFromSessionLapObject;
private static getActivityFromSessionObject;
private static createIntensityZonesFromFitZones;
private static applyFitZoneHighBoundaries;
private static setIntensityZoneDuration;
private static setIntensityZoneLowerLimit;
private static hasIntensityZoneLowerLimit;
/**
* For some unknown reasons... the fit provided total_timer_time & total_elapsed_time could be inverted..
* Just swap them if that's the case
*/
private static swapTimesIfRequired;
private static getActivityTypeByKey;
private static resolveGarminProfileName;
private static getPositiveNumericValue;
private static getFirstNumericValue;
private static getFitEnumValue;
private static getPoolLengthUnit;
private static getSwimLengthType;
private static getSwimStroke;
private static getPoolLengthMeters;
private static getSwimLengthEndDate;
private static getLapWindow;
private static getLengthLapIndex;
private static getSwimLengthDistance;
private static addSwimLengthsFromSessionObject;
private static getValidVO2MaxValue;
private static getFirstValidVO2MaxValue;
private static getUserMetricForSession;
private static getStringValue;
private static getActivityTypeFromSessionObject;
static getStatsFromObject(object: any, activity: ActivityInterface, isLap: boolean): DataInterface[];
static getCreatorFromFitDataObject(fitDataObject: any): CreatorInterface;
}
export interface FITFileActivityEvent {
event: string;
timestamp: Date;
event_type: 'start' | 'stop' | 'stop_all';
data: number;
}