suunto-api-wrapper 1.1.0 → 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 +3 -2
- package/dist/index.mjs +3 -2
- package/package.json +6 -4
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
|
-
|
|
71
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
72
72
|
this.beforeRequest = options.beforeRequest;
|
|
73
|
-
if (typeof
|
|
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
|
-
|
|
29
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
30
30
|
this.beforeRequest = options.beforeRequest;
|
|
31
|
-
if (typeof
|
|
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.
|
|
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"
|
|
@@ -18,14 +18,13 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
|
-
"engines": {
|
|
22
|
-
"node": ">=20"
|
|
23
|
-
},
|
|
24
21
|
"scripts": {
|
|
25
22
|
"build": "tsup",
|
|
26
23
|
"dev": "tsup --watch",
|
|
27
24
|
"typecheck": "tsc --noEmit",
|
|
28
25
|
"test": "vitest run",
|
|
26
|
+
"test:node": "vitest run --project node",
|
|
27
|
+
"test:browser": "vitest run --project browser",
|
|
29
28
|
"test:watch": "vitest"
|
|
30
29
|
},
|
|
31
30
|
"keywords": [],
|
|
@@ -34,6 +33,9 @@
|
|
|
34
33
|
"type": "commonjs",
|
|
35
34
|
"devDependencies": {
|
|
36
35
|
"@types/node": "^25.9.1",
|
|
36
|
+
"@vitest/browser": "^4.1.8",
|
|
37
|
+
"@vitest/browser-playwright": "^4.1.8",
|
|
38
|
+
"playwright": "^1.60.0",
|
|
37
39
|
"tsup": "^8.5.1",
|
|
38
40
|
"typescript": "^6.0.3",
|
|
39
41
|
"vitest": "^4.1.7"
|