fit-file-parser 5.2.0 → 6.0.2

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.
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GARMIN_TYPES = exports.GARMIN_MESSAGES = exports.GARMIN_PROFILE_VERSION = void 0;
4
- exports.GARMIN_PROFILE_VERSION = {
5
- major: 21,
6
- minor: 208,
7
- patch: 0,
8
- type: 'Release',
9
- };
10
- exports.GARMIN_MESSAGES = {
1
+ /**
2
+ * Static, community-maintained FIT interoperability profile.
3
+ *
4
+ * This table is ordinary project source maintained under the repository's MIT
5
+ * license. See PROFILE.md for the maintenance and verification policy.
6
+ */
7
+ export const PROFILE_MESSAGES = {
11
8
  0: {
12
9
  0: {
13
10
  field: 'type',
@@ -2589,6 +2586,13 @@ exports.GARMIN_MESSAGES = {
2589
2586
  offset: 0,
2590
2587
  units: 'Breaths/min',
2591
2588
  },
2589
+ 178: {
2590
+ field: 'est_sweat_loss',
2591
+ type: 'uint16',
2592
+ scale: 1,
2593
+ offset: 0,
2594
+ units: 'ml',
2595
+ },
2592
2596
  180: {
2593
2597
  field: 'enhanced_min_respiration_rate',
2594
2598
  type: 'uint16',
@@ -2643,6 +2647,13 @@ exports.GARMIN_MESSAGES = {
2643
2647
  offset: 0,
2644
2648
  units: 'Flow',
2645
2649
  },
2650
+ 188: {
2651
+ field: 'primary_benefit',
2652
+ type: 'uint8',
2653
+ scale: 1,
2654
+ offset: 0,
2655
+ units: '',
2656
+ },
2646
2657
  192: {
2647
2658
  field: 'workout_feel',
2648
2659
  type: 'uint8',
@@ -2724,6 +2735,27 @@ exports.GARMIN_MESSAGES = {
2724
2735
  offset: 0,
2725
2736
  units: 'm',
2726
2737
  },
2738
+ 205: {
2739
+ field: 'beginning_potential_stamina',
2740
+ type: 'uint8',
2741
+ scale: 1,
2742
+ offset: 0,
2743
+ units: 'percent',
2744
+ },
2745
+ 206: {
2746
+ field: 'ending_potential_stamina',
2747
+ type: 'uint8',
2748
+ scale: 1,
2749
+ offset: 0,
2750
+ units: 'percent',
2751
+ },
2752
+ 207: {
2753
+ field: 'min_stamina',
2754
+ type: 'uint8',
2755
+ scale: 1,
2756
+ offset: 0,
2757
+ units: 'percent',
2758
+ },
2727
2759
  208: {
2728
2760
  field: 'avg_core_temperature',
2729
2761
  type: 'uint16',
@@ -4422,6 +4454,13 @@ exports.GARMIN_MESSAGES = {
4422
4454
  offset: 0,
4423
4455
  units: 'm',
4424
4456
  },
4457
+ 90: {
4458
+ field: 'garmin_performance_condition',
4459
+ type: 'sint8',
4460
+ scale: 1,
4461
+ offset: 0,
4462
+ units: '',
4463
+ },
4425
4464
  91: {
4426
4465
  field: 'absolute_pressure',
4427
4466
  type: 'uint32',
@@ -4629,6 +4668,20 @@ exports.GARMIN_MESSAGES = {
4629
4668
  offset: 0,
4630
4669
  units: 'percent',
4631
4670
  },
4671
+ 137: {
4672
+ field: 'potential_stamina',
4673
+ type: 'uint8',
4674
+ scale: 1,
4675
+ offset: 0,
4676
+ units: 'percent',
4677
+ },
4678
+ 138: {
4679
+ field: 'stamina',
4680
+ type: 'uint8',
4681
+ scale: 1,
4682
+ offset: 0,
4683
+ units: 'percent',
4684
+ },
4632
4685
  139: {
4633
4686
  field: 'core_temperature',
4634
4687
  type: 'uint16',
@@ -4959,6 +5012,13 @@ exports.GARMIN_MESSAGES = {
4959
5012
  offset: 0,
4960
5013
  units: '',
4961
5014
  },
5015
+ 24: {
5016
+ field: 'ant_id',
5017
+ type: 'uint32z',
5018
+ scale: 1,
5019
+ offset: 0,
5020
+ units: '',
5021
+ },
4962
5022
  25: {
4963
5023
  field: 'source_type',
4964
5024
  type: 'source_type',
@@ -6401,6 +6461,107 @@ exports.GARMIN_MESSAGES = {
6401
6461
  },
6402
6462
  name: 'hrv',
6403
6463
  },
6464
+ 79: {
6465
+ 0: {
6466
+ field: 'vo2_max',
6467
+ type: 'uint16',
6468
+ scale: 292.57142857142856,
6469
+ offset: 0,
6470
+ units: 'ml/kg/min',
6471
+ },
6472
+ 1: {
6473
+ field: 'age',
6474
+ type: 'uint8',
6475
+ scale: 1,
6476
+ offset: 0,
6477
+ units: 'years',
6478
+ },
6479
+ 2: {
6480
+ field: 'height',
6481
+ type: 'uint8',
6482
+ scale: 100,
6483
+ offset: 0,
6484
+ units: 'm',
6485
+ },
6486
+ 3: {
6487
+ field: 'weight',
6488
+ type: 'uint16',
6489
+ scale: 10,
6490
+ offset: 0,
6491
+ units: 'kg',
6492
+ },
6493
+ 4: {
6494
+ field: 'gender',
6495
+ type: 'gender',
6496
+ scale: 1,
6497
+ offset: 0,
6498
+ units: '',
6499
+ },
6500
+ 6: {
6501
+ field: 'max_heart_rate',
6502
+ type: 'uint8',
6503
+ scale: 1,
6504
+ offset: 0,
6505
+ units: 'bpm',
6506
+ },
6507
+ 8: {
6508
+ field: 'remaining_recovery_time',
6509
+ type: 'uint16',
6510
+ scale: 1,
6511
+ offset: 0,
6512
+ units: '',
6513
+ },
6514
+ 11: {
6515
+ field: 'lthr',
6516
+ type: 'uint16',
6517
+ scale: 1,
6518
+ offset: 0,
6519
+ units: 'bpm',
6520
+ },
6521
+ 12: {
6522
+ field: 'ltpower',
6523
+ type: 'uint16',
6524
+ scale: 1,
6525
+ offset: 0,
6526
+ units: 'watts',
6527
+ },
6528
+ 13: {
6529
+ field: 'ltspeed',
6530
+ type: 'uint16',
6531
+ scale: 1000,
6532
+ offset: 0,
6533
+ units: 'm/s',
6534
+ },
6535
+ 16: {
6536
+ field: 'start_of_activity',
6537
+ type: 'date_time',
6538
+ scale: 1,
6539
+ offset: 0,
6540
+ units: '',
6541
+ },
6542
+ 19: {
6543
+ field: 'first_vo2_max',
6544
+ type: 'uint32',
6545
+ scale: 18724.571428571428,
6546
+ offset: 0,
6547
+ units: 'ml/kg/min',
6548
+ },
6549
+ 35: {
6550
+ field: 'end_of_previous_activity',
6551
+ type: 'date_time',
6552
+ scale: 1,
6553
+ offset: 0,
6554
+ units: '',
6555
+ },
6556
+ 253: {
6557
+ field: 'timestamp',
6558
+ type: 'date_time',
6559
+ scale: 1,
6560
+ offset: 0,
6561
+ units: '',
6562
+ },
6563
+ name: 'user_metrics',
6564
+ },
6404
6565
  80: {
6405
6566
  0: {
6406
6567
  field: 'fractional_timestamp',
@@ -7256,6 +7417,93 @@ exports.GARMIN_MESSAGES = {
7256
7417
  },
7257
7418
  name: 'hr',
7258
7419
  },
7420
+ 140: {
7421
+ 1: {
7422
+ field: 'new_max_heart_rate',
7423
+ type: 'uint8',
7424
+ scale: 1,
7425
+ offset: 0,
7426
+ units: 'bpm',
7427
+ },
7428
+ 4: {
7429
+ field: 'aerobic_training_effect',
7430
+ type: 'uint8',
7431
+ scale: 10,
7432
+ offset: 0,
7433
+ units: '',
7434
+ },
7435
+ 7: {
7436
+ field: 'vo2_max',
7437
+ type: 'uint32',
7438
+ scale: 18724.571428571428,
7439
+ offset: 0,
7440
+ units: 'ml/kg/min',
7441
+ },
7442
+ 9: {
7443
+ field: 'recovery_time',
7444
+ type: 'uint16',
7445
+ scale: 1,
7446
+ offset: 0,
7447
+ units: 'min',
7448
+ },
7449
+ 11: {
7450
+ field: 'sport',
7451
+ type: 'sport',
7452
+ scale: 1,
7453
+ offset: 0,
7454
+ units: '',
7455
+ },
7456
+ 20: {
7457
+ field: 'anaerobic_training_effect',
7458
+ type: 'uint8',
7459
+ scale: 10,
7460
+ offset: 0,
7461
+ units: '',
7462
+ },
7463
+ 29: {
7464
+ field: 'first_vo2_max',
7465
+ type: 'uint32',
7466
+ scale: 18724.571428571428,
7467
+ offset: 0,
7468
+ units: 'ml/kg/min',
7469
+ },
7470
+ 41: {
7471
+ field: 'primary_benefit',
7472
+ type: 'uint8',
7473
+ scale: 1,
7474
+ offset: 0,
7475
+ units: '',
7476
+ },
7477
+ 60: {
7478
+ field: 'total_ascent',
7479
+ type: 'uint16',
7480
+ scale: 1,
7481
+ offset: 0,
7482
+ units: 'm',
7483
+ },
7484
+ 61: {
7485
+ field: 'total_descent',
7486
+ type: 'uint16',
7487
+ scale: 1,
7488
+ offset: 0,
7489
+ units: 'm',
7490
+ },
7491
+ 62: {
7492
+ field: 'avg_power',
7493
+ type: 'uint16',
7494
+ scale: 1,
7495
+ offset: 0,
7496
+ units: 'watts',
7497
+ },
7498
+ 63: {
7499
+ field: 'avg_heart_rate',
7500
+ type: 'uint8',
7501
+ scale: 1,
7502
+ offset: 0,
7503
+ units: 'bpm',
7504
+ },
7505
+ name: 'activity_metrics',
7506
+ },
7259
7507
  142: {
7260
7508
  0: {
7261
7509
  field: 'event',
@@ -11790,6 +12038,27 @@ exports.GARMIN_MESSAGES = {
11790
12038
  offset: 0,
11791
12039
  units: 's',
11792
12040
  },
12041
+ 107: {
12042
+ field: 'beginning_potential_stamina',
12043
+ type: 'uint8',
12044
+ scale: 1,
12045
+ offset: 0,
12046
+ units: 'percent',
12047
+ },
12048
+ 108: {
12049
+ field: 'ending_potential_stamina',
12050
+ type: 'uint8',
12051
+ scale: 1,
12052
+ offset: 0,
12053
+ units: 'percent',
12054
+ },
12055
+ 109: {
12056
+ field: 'min_stamina',
12057
+ type: 'uint8',
12058
+ scale: 1,
12059
+ offset: 0,
12060
+ units: 'percent',
12061
+ },
11793
12062
  110: {
11794
12063
  field: 'total_moving_time',
11795
12064
  type: 'uint32',
@@ -13035,7 +13304,7 @@ exports.GARMIN_MESSAGES = {
13035
13304
  name: 'sleep_disruption_overnight_severity',
13036
13305
  },
13037
13306
  };
13038
- exports.GARMIN_TYPES = {
13307
+ export const PROFILE_TYPES = {
13039
13308
  activity: {
13040
13309
  0: 'manual',
13041
13310
  1: 'auto_multi_sport',
@@ -15765,6 +16034,7 @@ exports.GARMIN_TYPES = {
15765
16034
  55: 'monitoring',
15766
16035
  72: 'training_file',
15767
16036
  78: 'hrv',
16037
+ 79: 'user_metrics',
15768
16038
  80: 'ant_rx',
15769
16039
  81: 'ant_tx',
15770
16040
  82: 'ant_channel_id',
@@ -15777,6 +16047,7 @@ exports.GARMIN_TYPES = {
15777
16047
  129: 'weather_alert',
15778
16048
  131: 'cadence_zone',
15779
16049
  132: 'hr',
16050
+ 140: 'activity_metrics',
15780
16051
  142: 'segment_lap',
15781
16052
  145: 'memo_glob',
15782
16053
  148: 'segment_id',
@@ -264,6 +264,7 @@ export function generateFitType() {
264
264
  generateProperty('messages', ts.factory.createTypeReferenceNode('ParsedMessages')),
265
265
  generateArrayProperty('raw_developer_fields', ts.factory.createTypeReferenceNode('ParsedRawDeveloperField')),
266
266
  generateArrayProperty('raw_messages', ts.factory.createTypeReferenceNode('ParsedRawFitMessage')),
267
+ generateArrayProperty('unmapped_messages', ts.factory.createTypeReferenceNode('ParsedRawFitMessage')),
267
268
  ...Object.keys(referenceProperties).map(prop => generateProperty(prop, ts.factory.createTypeReferenceNode(snakeToCamel(referenceProperties[prop].replace('?', ''))), referenceProperties[prop].startsWith('?'))),
268
269
  ...Object.keys(collectionProperties).map(prop => generateArrayProperty(prop, collectionProperties[prop] === 'unknown'
269
270
  ? ts.factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fit-file-parser",
3
3
  "type": "module",
4
- "version": "5.2.0",
4
+ "version": "6.0.2",
5
5
  "private": false,
6
6
  "description": "Parse your .FIT files easily, directly from JS (Garmin, Polar, Suunto)",
7
7
  "author": {
@@ -44,6 +44,7 @@
44
44
  "CHANGELOG.md",
45
45
  "CONTRIBUTORS.md",
46
46
  "LICENSE",
47
+ "PROFILE.md",
47
48
  "README.md",
48
49
  "dist/"
49
50
  ],
@@ -54,13 +55,13 @@
54
55
  }
55
56
  ],
56
57
  "scripts": {
57
- "dev": "tsx --watch --watch-path=src/type_generator.ts --watch-path=src/fit.ts --watch-path=src/garmin_profile.generated.ts codegen/codegen.ts",
58
- "codegen:profile": "tsx codegen/garmin-profile.ts",
59
- "codegen": "npm run codegen:profile && tsx codegen/codegen.ts",
60
- "codegen:check": "tsx codegen/garmin-profile.ts --check && tsx codegen/codegen.ts --check",
61
- "profile:audit": "npm run codegen:check && tsx scripts/profile-audit.ts",
58
+ "dev": "tsx --watch --watch-path=src/type_generator.ts --watch-path=src/fit.ts --watch-path=src/profile.ts codegen/codegen.ts",
59
+ "codegen": "tsx codegen/codegen.ts",
60
+ "codegen:check": "tsx codegen/codegen.ts --check",
61
+ "profile:check": "npm run codegen:check && tsx scripts/profile-check.ts",
62
+ "compatibility:check": "npm run build && tsx scripts/compatibility-check.ts",
62
63
  "corpus:check": "tsx scripts/corpus-check.ts",
63
- "check": "npm run profile:audit && npm run lint && npm run type-check && npm test -- --run && npm run build",
64
+ "check": "npm run profile:check && npm run lint && npm run type-check && npm test -- --run && npm run build",
64
65
  "example-output": "node examples/parse.js examples/example.fit > examples/output-example.json",
65
66
  "example-output-tank": "node examples/parse.js examples/example-diving.fit > examples/output-diving.json",
66
67
  "example-output-summary-first": "node examples/parse.js examples/triathlon_summary_first.fit > examples/output_summary_first.json",
@@ -71,7 +72,8 @@
71
72
  "lint": "eslint .",
72
73
  "fmt": "eslint --fix .",
73
74
  "type-check": "tsc --noEmit",
74
- "build": "tsc --noCheck && tsc --project tsconfig.cjs.json --noCheck && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
75
+ "clean": "tsx scripts/clean-dist.ts",
76
+ "build": "npm run clean && tsc --noCheck && tsc --project tsconfig.cjs.json --noCheck && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
75
77
  "prepack": "npm run build"
76
78
  },
77
79
  "test": "vitest",
@@ -80,7 +82,6 @@
80
82
  },
81
83
  "devDependencies": {
82
84
  "@antfu/eslint-config": "^6.2.0",
83
- "@garmin/fitsdk": "21.208.0",
84
85
  "@types/node": "^24.10.1",
85
86
  "@vitest/coverage-v8": "^4.0.13",
86
87
  "eslint": "^9.10.0",
@@ -1,9 +0,0 @@
1
- import type { Message } from './fit.js';
2
- export declare const GARMIN_PROFILE_VERSION: {
3
- readonly major: 21;
4
- readonly minor: 208;
5
- readonly patch: 0;
6
- readonly type: "Release";
7
- };
8
- export declare const GARMIN_MESSAGES: Record<number, Message>;
9
- export declare const GARMIN_TYPES: Record<string, Record<number, string | number>>;
@@ -1,9 +0,0 @@
1
- import type { Message } from './fit.js';
2
- export declare const GARMIN_PROFILE_VERSION: {
3
- readonly major: 21;
4
- readonly minor: 208;
5
- readonly patch: 0;
6
- readonly type: "Release";
7
- };
8
- export declare const GARMIN_MESSAGES: Record<number, Message>;
9
- export declare const GARMIN_TYPES: Record<string, Record<number, string | number>>;