@garmin/fitsdk 21.202.0 → 21.205.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.
@@ -0,0 +1,55 @@
1
+ /////////////////////////////////////////////////////////////////////////////////////////////
2
+ // Copyright 2026 Garmin International, Inc.
3
+ // Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
4
+ // may not use this file except in compliance with the Flexible and Interoperable Data
5
+ // Transfer (FIT) Protocol License.
6
+ /////////////////////////////////////////////////////////////////////////////////////////////
7
+ // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
+ // Profile Version = 21.205.0Release
9
+ // Tag = production/release/21.205.0-0-gb3c261eb
10
+ /////////////////////////////////////////////////////////////////////////////////////////////
11
+
12
+
13
+ export declare const Utils: {
14
+ /** Millisecond offset between the UNIX epoch (1970-01-01) and the FIT epoch (1989-12-31): `631065600000`. */
15
+ readonly FIT_EPOCH_MS: number;
16
+
17
+ /**
18
+ * Converts a FIT DateTime value to a JavaScript `Date`.
19
+ * @param datetime - Seconds since the FIT epoch (1989-12-31 00:00:00 UTC).
20
+ * @returns The equivalent JavaScript `Date`.
21
+ */
22
+ convertDateTimeToDate(datetime: number): Date;
23
+
24
+ /**
25
+ * Converts a JavaScript `Date` to a FIT DateTime value.
26
+ * @param date - The JavaScript `Date` to convert.
27
+ * @returns Seconds since the FIT epoch (1989-12-31 00:00:00 UTC).
28
+ */
29
+ convertDateToDateTime(date: Date): number;
30
+
31
+ /** FIT base type numeric constants. */
32
+ readonly FitBaseType: {
33
+ readonly ENUM: number;
34
+ readonly SINT8: number;
35
+ readonly UINT8: number;
36
+ readonly SINT16: number;
37
+ readonly UINT16: number;
38
+ readonly SINT32: number;
39
+ readonly UINT32: number;
40
+ readonly STRING: number;
41
+ readonly FLOAT32: number;
42
+ readonly FLOAT64: number;
43
+ readonly UINT8Z: number;
44
+ readonly UINT16Z: number;
45
+ readonly UINT32Z: number;
46
+ readonly BYTE: number;
47
+ readonly SINT64: number;
48
+ readonly UINT64: number;
49
+ readonly UINT64Z: number;
50
+ };
51
+ /** Maps a FIT base type number to its string field-type name (e.g. `3` → `"uint8"`). */
52
+ readonly BaseTypeToFieldType: Record<number, string>;
53
+ /** Maps a FIT field-type name to its base type number (e.g. `"uint8"` → `3`). */
54
+ readonly FieldTypeToBaseType: Record<string, number>;
55
+ };
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.202.0Release
9
- // Tag = production/release/21.202.0-0-g9a57aebc
8
+ // Profile Version = 21.205.0Release
9
+ // Tag = production/release/21.205.0-0-gb3c261eb
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -5,17 +5,25 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.202.0Release
9
- // Tag = production/release/21.202.0-0-g9a57aebc
8
+ // Profile Version = 21.205.0Release
9
+ // Tag = production/release/21.205.0-0-gb3c261eb
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
13
- const sanitizeValues = (values) => {
13
+ const sanitizeValues = (values, { legacyArrayMode = false, isArray = false } = {}) => {
14
14
  if (onlyNullValues(values)) {
15
15
  return null;
16
16
  }
17
17
 
18
- return values.length === 1 ? values[0] : values;
18
+ if (legacyArrayMode) {
19
+ return values.length === 1 ? values[0] : values;
20
+ }
21
+
22
+ if (isArray) {
23
+ return values;
24
+ }
25
+
26
+ return values[0];
19
27
  }
20
28
 
21
29
  const trimStringTrailingNulls = (string) => {
@@ -35,11 +43,11 @@ const trimStringTrailingNulls = (string) => {
35
43
  return strings.length === 1 ? strings[0] : strings;
36
44
  }
37
45
 
38
- const onlyNullValues = (values) => values.reduce((state, value) => value != null ? false : state, true);
46
+ const onlyNullValues = (values) => values.every(value => value == null);
39
47
 
40
48
  const onlyInvalidValues = (rawFieldValue, invalidValue) => {
41
49
  if (Array.isArray(rawFieldValue)) {
42
- return rawFieldValue.reduce((state, value) => value != invalidValue ? false : state, true);
50
+ return rawFieldValue.every(value => value === invalidValue);
43
51
  }
44
52
 
45
53
  return rawFieldValue === invalidValue;
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.202.0Release
9
- // Tag = production/release/21.202.0-0-g9a57aebc
8
+ // Profile Version = 21.205.0Release
9
+ // Tag = production/release/21.205.0-0-gb3c261eb
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
  import Profile from "./profile.js";
package/src/utils.js CHANGED
@@ -5,33 +5,19 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.202.0Release
9
- // Tag = production/release/21.202.0-0-g9a57aebc
8
+ // Profile Version = 21.205.0Release
9
+ // Tag = production/release/21.205.0-0-gb3c261eb
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
13
13
  import FIT from "./fit.js";
14
14
 
15
- /**
16
- * The millisecond offset between UNIX and FIT Epochs (631065600000).
17
- * @const {number}
18
- */
19
15
  const FIT_EPOCH_MS = 631065600000;
20
16
 
21
- /**
22
- * Convert a FIT DateTime to a JavaScript Date
23
- * @param {number} datetime - Seconds since FIT EPOCH
24
- * @returns {Date} A JavaScript Date object
25
- */
26
17
  const convertDateTimeToDate = (datetime) => {
27
18
  return new Date((datetime ?? 0) * 1000 + FIT_EPOCH_MS);
28
19
  };
29
20
 
30
- /**
31
- * Convert a JavaScript Date to a FIT DateTime
32
- * @param {Date} A JavaScript Date object
33
- * @return {number} datetime - Seconds since FIT EPOCH
34
- */
35
21
  const convertDateToDateTime = (date) => {
36
22
  return (date.getTime() - FIT_EPOCH_MS) / 1000;
37
23
  };