Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- run: npm install --package-lock=false
- run: npm test

Expand All @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm install --package-lock=false
- run: npm publish
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [21.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The FIT SDK documentation is available at [https://developer.garmin.com/fit](htt
## FIT SDK Developer Forum
Share your knowledge, ask questions, and get the latest FIT SDK news in the [FIT SDK Developer Forum](https://forums.garmin.com/developer/).
## FIT JavaScript SDK Requirements
The FIT JavaScript SDK uses ECMAScript module syntax and requires Node.js v14.0 or higher, or a browser with a compatible JavaScript runtime engine.
The FIT JavaScript SDK uses ECMAScript module syntax and requires Node.js v21.0 or higher, or a browser with a compatible JavaScript runtime engine.
## Install
```sh
npm install @garmin/fitsdk
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garmin/fitsdk",
"version": "21.161.0",
"version": "21.168.0",
"description": "FIT JavaScript SDK",
"main": "src/index.js",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/accumulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down
4 changes: 2 additions & 2 deletions src/bit-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down
4 changes: 2 additions & 2 deletions src/crc-calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down
15 changes: 12 additions & 3 deletions src/decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand All @@ -15,6 +15,7 @@ import BitStream from "../src/bit-stream.js";
import CrcCalculator from "./crc-calculator.js";
import FIT from "./fit.js";
import HrMesgUtils from "./utils-hr-mesg.js";
import MemoGlobUtils from "./utils-memo-glob.js";
import Profile from "./profile.js";
import Stream from "./stream.js";
import Utils from "./utils.js";
Expand Down Expand Up @@ -57,6 +58,7 @@ class Decoder {
#optConvertDateTimesToDates = true;
#optIncludeUnknownData = false;
#optMergeHeartRates = true;
#optDecodeMemoGlobs = false;

/**
* Creates a FIT File Decoder
Expand Down Expand Up @@ -179,7 +181,8 @@ class Decoder {
* @param {Boolean} [options.convertTypesToStrings=true] - (optional, default true)
* @param {boolean} [options.convertDateTimesToDates=true] - (optional, default true)
* @param {Boolean} [options.includeUnknownData=false] - (optional, default false)
* @param {boolean} [options.mergeHeartRates=true] - (optional, default false)
* @param {boolean} [options.mergeHeartRates=true] - (optional, default true)
* @param {boolean} [options.decodeMemoGlobs=true] - (optional, default false)
* @param {boolean} [options.skipHeader=false] - (optional, default false)
* @param {boolean} [options.dataOnly=false] - (optional, default false)
* @return {Object} result - {messages:Array, errors:Array}
Expand All @@ -195,6 +198,7 @@ class Decoder {
convertDateTimesToDates = true,
includeUnknownData = false,
mergeHeartRates = true,
decodeMemoGlobs = false,
skipHeader = false,
dataOnly = false,} = {}) {

Expand All @@ -208,6 +212,7 @@ class Decoder {
this.#optConvertDateTimesToDates = convertDateTimesToDates;
this.#optIncludeUnknownData = includeUnknownData;
this.#optMergeHeartRates = mergeHeartRates;
this.#optDecodeMemoGlobs = decodeMemoGlobs;

this.#localMessageDefinitions = [];
this.#developerDataDefinitions = {};
Expand All @@ -233,6 +238,10 @@ class Decoder {
if (this.#optMergeHeartRates) {
HrMesgUtils.mergeHeartRates(this.#messages.hrMesgs, this.#messages.recordMesgs);
}

if (this.#optDecodeMemoGlobs) {
MemoGlobUtils.decodeMemoGlobs(this.#messages);
}
}
catch (error) {
errors.push(error);
Expand Down
8 changes: 4 additions & 4 deletions src/encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -212,8 +212,8 @@ class Encoder {
throw new Error();
}

const scale = Array.isArray(fieldDefinition.scale) ? fieldDefinition.scale[0] : fieldDefinition.scale;
const offset = Array.isArray(fieldDefinition.offset) ? fieldDefinition.offset[0] : fieldDefinition.offset;
const scale = fieldDefinition.components.length > 1 ? 1 : fieldDefinition.scale;
const offset = fieldDefinition.components.length > 1 ? 0 : fieldDefinition.offset;

return (value + offset) * scale;
}
Expand Down
4 changes: 2 additions & 2 deletions src/fit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down
5 changes: 3 additions & 2 deletions src/mesg-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -64,6 +64,7 @@ class MesgDefinition {
type: fieldProfile[1].type,
scale: fieldProfile[1].scale,
offset: fieldProfile[1].offset,
components: fieldProfile[1].components,
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/output-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.161.0Release
// Tag = production/release/21.161.0-0-g58854c0
// Profile Version = 21.168.0Release
// Tag = production/release/21.168.0-0-gb831b31
/////////////////////////////////////////////////////////////////////////////////////////////


Expand Down
Loading