@kaiord/fit 4.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pablo Albaladejo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @kaiord/fit
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@kaiord/fit.svg)](https://www.npmjs.com/package/@kaiord/fit)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ FIT format adapter for Kaiord workout data conversion. Provides reading and writing of Garmin FIT workout files using the official Garmin FIT SDK.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ pnpm add @kaiord/core @kaiord/fit
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ### With Core Providers (Recommended)
17
+
18
+ ```typescript
19
+ import { createDefaultProviders } from "@kaiord/core";
20
+ import { createFitProviders } from "@kaiord/fit";
21
+
22
+ const providers = createDefaultProviders({
23
+ fit: createFitProviders(),
24
+ });
25
+
26
+ // FIT to KRD
27
+ const krd = await providers.convertFitToKrd!({ fitBuffer });
28
+
29
+ // KRD to FIT
30
+ const fitBuffer = await providers.convertKrdToFit!({ krd });
31
+ ```
32
+
33
+ ### Standalone Adapter Access
34
+
35
+ ```typescript
36
+ import {
37
+ createGarminFitSdkReader,
38
+ createGarminFitSdkWriter,
39
+ } from "@kaiord/fit";
40
+ import { createConsoleLogger } from "@kaiord/core";
41
+
42
+ const logger = createConsoleLogger();
43
+ const reader = createGarminFitSdkReader(logger);
44
+ const writer = createGarminFitSdkWriter(logger);
45
+ ```
46
+
47
+ ## API
48
+
49
+ ### `createFitProviders(logger?: Logger): FitProviders`
50
+
51
+ Creates FIT adapter instances for use with `createDefaultProviders()`.
52
+
53
+ ### `createGarminFitSdkReader(logger: Logger): FitReader`
54
+
55
+ Creates a FIT file reader using the Garmin FIT SDK.
56
+
57
+ ### `createGarminFitSdkWriter(logger: Logger): FitWriter`
58
+
59
+ Creates a FIT file writer using the Garmin FIT SDK.
60
+
61
+ ## Supported FIT Features
62
+
63
+ - Workout files (structured workout steps)
64
+ - Activity files (recorded activity data)
65
+ - Course files (GPS routes)
66
+ - Lap messages
67
+ - Record messages (time-series data)
68
+ - Event messages
69
+ - Session/activity metadata
70
+
71
+ ## License
72
+
73
+ MIT
@@ -0,0 +1,17 @@
1
+ import { Logger, FitReader, FitWriter } from '@kaiord/core';
2
+
3
+ type FitProviders = {
4
+ fitReader: FitReader;
5
+ fitWriter: FitWriter;
6
+ };
7
+ declare const createFitProviders: (logger?: Logger) => FitProviders;
8
+
9
+ /**
10
+ * Garmin FIT SDK Adapter - converts FIT workout files to KRD format
11
+ * References: https://developer.garmin.com/fit/file-types/workout/
12
+ */
13
+
14
+ declare const createGarminFitSdkReader: (logger: Logger) => FitReader;
15
+ declare const createGarminFitSdkWriter: (logger: Logger) => FitWriter;
16
+
17
+ export { type FitProviders, createFitProviders, createGarminFitSdkReader, createGarminFitSdkWriter };