@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
78 lines (77 loc) • 2.51 kB
TypeScript
export interface ActivityParsingStreamOptions {
smooth?: {
altitudeSmooth?: boolean;
grade?: boolean;
gradeSmooth?: boolean;
};
fixAbnormal?: {
speed?: boolean;
};
/**
* Optional allowlist of stream types to include in final activity output.
*
* This is currently enforced for FIT/TCX/GPX importers.
*/
includeTypes?: string[];
}
export interface ActivityParsingTssOverridesOptions {
functionalThresholdPower?: number;
functionalThresholdPace?: number;
lactateThresholdHR?: number;
maxHeartRate?: number;
restingHeartRate?: number;
refSwimSpeed?: number;
thresholdSwimSpeed?: number;
metScore?: number;
thresholdMet?: number;
}
export interface ActivityParsingTssOptions {
overrides?: ActivityParsingTssOverridesOptions;
preserveImportedTss?: boolean;
enableHeuristicFallbacks?: boolean;
}
export interface ActivityParsingOptionsInput {
streams?: ActivityParsingStreamOptions;
tss?: ActivityParsingTssOptions;
maxActivityDurationDays?: number;
generateUnitStreams?: boolean;
deviceInfoMode?: 'raw' | 'changes';
}
export declare class ActivityParsingOptions {
static readonly DEFAULT: ActivityParsingOptions;
/**
* Enable/Disable streams calculations
*/
streams: {
smooth: {
altitudeSmooth?: boolean;
grade?: boolean;
gradeSmooth?: boolean;
};
fixAbnormal: {
speed?: boolean;
};
includeTypes?: string[];
};
tss?: {
overrides: ActivityParsingTssOverridesOptions;
preserveImportedTss: boolean;
enableHeuristicFallbacks: boolean;
};
maxActivityDurationDays: number;
generateUnitStreams: boolean;
/**
* Controls how FIT `device_info` records are exposed on `activity.creator.devices`.
*
* Some FIT files emit the same device identity every second with only `timestamp` changing,
* which can generate very large payloads.
*
* - `raw`: Keep all parsed `device_info` rows (backwards-compatible default).
* - `changes`: Keep only state transitions by collapsing contiguous rows that differ by timestamp only.
*
* `summary` is intentionally not exposed for now to avoid changing payload semantics beyond
* run-compaction and to keep this release backwards-safe.
*/
deviceInfoMode: 'raw' | 'changes';
constructor(options?: ActivityParsingOptionsInput);
}