suunto-api-wrapper 1.1.1 → 1.1.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.
package/dist/index.js CHANGED
@@ -68,13 +68,14 @@ var HttpClient = class {
68
68
  this.timeoutMs = options.timeoutMs ?? DEFAULTS.timeoutMs;
69
69
  this.retries = options.retries ?? DEFAULTS.retries;
70
70
  this.retryBackoffMs = options.retryBackoffMs ?? DEFAULTS.retryBackoffMs;
71
- this.fetchImpl = options.fetch ?? globalThis.fetch;
71
+ const fetchImpl = options.fetch ?? globalThis.fetch;
72
72
  this.beforeRequest = options.beforeRequest;
73
- if (typeof this.fetchImpl !== "function") {
73
+ if (typeof fetchImpl !== "function") {
74
74
  throw new TypeError(
75
75
  "No fetch implementation available. Use Node 18+ or pass `fetch` in options."
76
76
  );
77
77
  }
78
+ this.fetchImpl = options.fetch ? fetchImpl : fetchImpl.bind(globalThis);
78
79
  }
79
80
  get(path, options) {
80
81
  return this.request("GET", path, options);
package/dist/index.mjs CHANGED
@@ -26,13 +26,14 @@ var HttpClient = class {
26
26
  this.timeoutMs = options.timeoutMs ?? DEFAULTS.timeoutMs;
27
27
  this.retries = options.retries ?? DEFAULTS.retries;
28
28
  this.retryBackoffMs = options.retryBackoffMs ?? DEFAULTS.retryBackoffMs;
29
- this.fetchImpl = options.fetch ?? globalThis.fetch;
29
+ const fetchImpl = options.fetch ?? globalThis.fetch;
30
30
  this.beforeRequest = options.beforeRequest;
31
- if (typeof this.fetchImpl !== "function") {
31
+ if (typeof fetchImpl !== "function") {
32
32
  throw new TypeError(
33
33
  "No fetch implementation available. Use Node 18+ or pass `fetch` in options."
34
34
  );
35
35
  }
36
+ this.fetchImpl = options.fetch ? fetchImpl : fetchImpl.bind(globalThis);
36
37
  }
37
38
  get(path, options) {
38
39
  return this.request("GET", path, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suunto-api-wrapper",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Unofficial typed TypeScript client for the Suunto app API (Sports Tracker backend). Not affiliated with or endorsed by Suunto or Sports Tracker.",
5
5
  "repository": {
6
6
  "url": "https://github.com/Marius-Ar/suunto-api-wrapper"