@pinta365/strava 0.0.1

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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +390 -0
  3. package/esm/_dnt.shims.d.ts +2 -0
  4. package/esm/_dnt.shims.js +57 -0
  5. package/esm/deps/jsr.io/@cross/runtime/1.2.1/mod.d.ts +126 -0
  6. package/esm/deps/jsr.io/@cross/runtime/1.2.1/mod.js +480 -0
  7. package/esm/mod.d.ts +27 -0
  8. package/esm/mod.js +27 -0
  9. package/esm/package.json +3 -0
  10. package/esm/src/auth/oauth.d.ts +68 -0
  11. package/esm/src/auth/oauth.js +203 -0
  12. package/esm/src/auth/scopes.d.ts +52 -0
  13. package/esm/src/auth/scopes.js +71 -0
  14. package/esm/src/auth/token-store.d.ts +57 -0
  15. package/esm/src/auth/token-store.js +142 -0
  16. package/esm/src/client.d.ts +98 -0
  17. package/esm/src/client.js +235 -0
  18. package/esm/src/errors.d.ts +52 -0
  19. package/esm/src/errors.js +102 -0
  20. package/esm/src/http/deduplication.d.ts +33 -0
  21. package/esm/src/http/deduplication.js +96 -0
  22. package/esm/src/http/rate-limiter.d.ts +47 -0
  23. package/esm/src/http/rate-limiter.js +168 -0
  24. package/esm/src/http/request.d.ts +24 -0
  25. package/esm/src/http/request.js +158 -0
  26. package/esm/src/http/retry.d.ts +9 -0
  27. package/esm/src/http/retry.js +61 -0
  28. package/esm/src/resources/activities.d.ts +149 -0
  29. package/esm/src/resources/activities.js +189 -0
  30. package/esm/src/resources/athletes.d.ts +37 -0
  31. package/esm/src/resources/athletes.js +85 -0
  32. package/esm/src/resources/clubs.d.ts +45 -0
  33. package/esm/src/resources/clubs.js +71 -0
  34. package/esm/src/resources/gears.d.ts +17 -0
  35. package/esm/src/resources/gears.js +27 -0
  36. package/esm/src/resources/routes.d.ts +33 -0
  37. package/esm/src/resources/routes.js +71 -0
  38. package/esm/src/resources/segment-efforts.d.ts +38 -0
  39. package/esm/src/resources/segment-efforts.js +53 -0
  40. package/esm/src/resources/segments.d.ts +42 -0
  41. package/esm/src/resources/segments.js +67 -0
  42. package/esm/src/resources/streams.d.ts +44 -0
  43. package/esm/src/resources/streams.js +75 -0
  44. package/esm/src/resources/uploads.d.ts +41 -0
  45. package/esm/src/resources/uploads.js +79 -0
  46. package/esm/src/types/api.d.ts +9 -0
  47. package/esm/src/types/api.js +7 -0
  48. package/esm/src/types/common.d.ts +65 -0
  49. package/esm/src/types/common.js +4 -0
  50. package/esm/src/types/generated.d.ts +731 -0
  51. package/esm/src/types/generated.js +7 -0
  52. package/esm/src/utils/pagination.d.ts +45 -0
  53. package/esm/src/utils/pagination.js +112 -0
  54. package/esm/src/utils/transformers.d.ts +30 -0
  55. package/esm/src/utils/transformers.js +189 -0
  56. package/esm/src/utils/validators.d.ts +53 -0
  57. package/esm/src/utils/validators.js +84 -0
  58. package/package.json +40 -0
  59. package/script/_dnt.shims.d.ts +2 -0
  60. package/script/_dnt.shims.js +60 -0
  61. package/script/deps/jsr.io/@cross/runtime/1.2.1/mod.d.ts +126 -0
  62. package/script/deps/jsr.io/@cross/runtime/1.2.1/mod.js +526 -0
  63. package/script/mod.d.ts +27 -0
  64. package/script/mod.js +73 -0
  65. package/script/package.json +3 -0
  66. package/script/src/auth/oauth.d.ts +68 -0
  67. package/script/src/auth/oauth.js +211 -0
  68. package/script/src/auth/scopes.d.ts +52 -0
  69. package/script/src/auth/scopes.js +79 -0
  70. package/script/src/auth/token-store.d.ts +57 -0
  71. package/script/src/auth/token-store.js +182 -0
  72. package/script/src/client.d.ts +98 -0
  73. package/script/src/client.js +239 -0
  74. package/script/src/errors.d.ts +52 -0
  75. package/script/src/errors.js +111 -0
  76. package/script/src/http/deduplication.d.ts +33 -0
  77. package/script/src/http/deduplication.js +100 -0
  78. package/script/src/http/rate-limiter.d.ts +47 -0
  79. package/script/src/http/rate-limiter.js +172 -0
  80. package/script/src/http/request.d.ts +24 -0
  81. package/script/src/http/request.js +161 -0
  82. package/script/src/http/retry.d.ts +9 -0
  83. package/script/src/http/retry.js +64 -0
  84. package/script/src/resources/activities.d.ts +149 -0
  85. package/script/src/resources/activities.js +193 -0
  86. package/script/src/resources/athletes.d.ts +37 -0
  87. package/script/src/resources/athletes.js +89 -0
  88. package/script/src/resources/clubs.d.ts +45 -0
  89. package/script/src/resources/clubs.js +75 -0
  90. package/script/src/resources/gears.d.ts +17 -0
  91. package/script/src/resources/gears.js +31 -0
  92. package/script/src/resources/routes.d.ts +33 -0
  93. package/script/src/resources/routes.js +75 -0
  94. package/script/src/resources/segment-efforts.d.ts +38 -0
  95. package/script/src/resources/segment-efforts.js +57 -0
  96. package/script/src/resources/segments.d.ts +42 -0
  97. package/script/src/resources/segments.js +71 -0
  98. package/script/src/resources/streams.d.ts +44 -0
  99. package/script/src/resources/streams.js +79 -0
  100. package/script/src/resources/uploads.d.ts +41 -0
  101. package/script/src/resources/uploads.js +83 -0
  102. package/script/src/types/api.d.ts +9 -0
  103. package/script/src/types/api.js +23 -0
  104. package/script/src/types/common.d.ts +65 -0
  105. package/script/src/types/common.js +5 -0
  106. package/script/src/types/generated.d.ts +731 -0
  107. package/script/src/types/generated.js +8 -0
  108. package/script/src/utils/pagination.d.ts +45 -0
  109. package/script/src/utils/pagination.js +118 -0
  110. package/script/src/utils/transformers.d.ts +30 -0
  111. package/script/src/utils/transformers.js +196 -0
  112. package/script/src/utils/validators.d.ts +53 -0
  113. package/script/src/utils/validators.js +92 -0
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Enum of supported Runtimes.
3
+ * @enum {string}
4
+ */
5
+ export declare enum Runtime {
6
+ Deno = "deno",
7
+ Bun = "bun",
8
+ Node = "node",
9
+ Browser = "browser",
10
+ Tauri = "tauri",
11
+ Workerd = "workerd",
12
+ Netlify = "netlify",
13
+ EdgeLight = "edgelight",
14
+ Fastly = "fastly",
15
+ Unsupported = "unsupported"
16
+ }
17
+ /**
18
+ * Enum of supported Operating Systems.
19
+ * @enum {string}
20
+ */
21
+ export declare enum OperatingSystem {
22
+ Windows = "windows",
23
+ macOS = "macos",
24
+ Linux = "linux",
25
+ Android = "android",
26
+ Unix = "unix",
27
+ iOS = "ios",
28
+ Unsupported = "unsupported"
29
+ }
30
+ /**
31
+ * Enum of supported Products.
32
+ * @enum {string}
33
+ */
34
+ export declare enum Product {
35
+ Deno = "deno",
36
+ Bun = "bun",
37
+ Node = "node",
38
+ Tauri = "tauri",
39
+ Workerd = "workerd",
40
+ Netlify = "netlify",
41
+ EdgeLight = "edgelight",
42
+ Fastly = "fastly",
43
+ Firefox = "firefox",
44
+ Safari = "safari",
45
+ Chrome = "chrome",
46
+ Edge = "edge",
47
+ Opera = "opera",
48
+ Brave = "brave",
49
+ Unsupported = "unsupported"
50
+ }
51
+ /**
52
+ * Enum of common CPU architectures.
53
+ * @enum {string}
54
+ */
55
+ export declare enum Architecture {
56
+ x86 = "x86",
57
+ x64 = "x86_64",
58
+ arm = "arm",
59
+ arm64 = "arm64",
60
+ Unsupported = "unsupported"
61
+ }
62
+ /**
63
+ * Dynamically determines the current runtime environment.
64
+ */
65
+ export declare function getCurrentRuntime(): Runtime;
66
+ /**
67
+ * Dynamically determines the current operating system.
68
+ */
69
+ export declare function getCurrentOS(): OperatingSystem;
70
+ /**
71
+ * Determine operating system from user agent string, if possible
72
+ */
73
+ export declare function getOSFromUserAgent(userAgent: string): OperatingSystem;
74
+ /**
75
+ * Dynamically determines the current browser and its version (if applicable).
76
+ */
77
+ export declare function getCurrentProduct(): Product;
78
+ /**
79
+ * Determines the product from a user agent string, if possible
80
+ */
81
+ export declare function getProductFromUserAgent(userAgent: string): Product;
82
+ /**
83
+ * Dynamically determines the version of the current product/runtime
84
+ * @returns {string} A string containing the detected version, or undefined if the product is not supported.
85
+ */
86
+ export declare function getCurrentVersion(): string | undefined;
87
+ /**
88
+ * Determines the product version from a user agent string, if possible
89
+ */
90
+ export declare function getVersionFromUserAgent(userAgent: string): string | undefined;
91
+ /**
92
+ * Attempts to determine the current CPU architecture of the runtime's environment.
93
+ */
94
+ export declare function getCurrentArchitecture(): Architecture;
95
+ /**
96
+ * Logs current system information to the console.
97
+ *
98
+ * @param {boolean} [useTable=false] - If true, formats the output as a table.
99
+ */
100
+ export declare function dumpSystemInfo(useTable?: boolean): void;
101
+ /**
102
+ * Gets the current system information as a formatted JSON string.
103
+ * @returns {string}
104
+ */
105
+ export declare function getSystemInfo(): string;
106
+ /**
107
+ * Static variable containing the current runtime.
108
+ */
109
+ export declare const CurrentRuntime: Runtime;
110
+ /**
111
+ * Static variable containing the current product.
112
+ */
113
+ export declare const CurrentProduct: Product;
114
+ /**
115
+ * Static variable containing the current product/runtime version.
116
+ */
117
+ export declare const CurrentVersion: string | undefined;
118
+ /**
119
+ * Static variable containing the current operating system.
120
+ */
121
+ export declare const CurrentOS: OperatingSystem | undefined;
122
+ /**
123
+ * Static variable containing the current operating system.
124
+ */
125
+ export declare const CurrentArchitecture: Architecture | undefined;
126
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1,526 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CurrentArchitecture = exports.CurrentOS = exports.CurrentVersion = exports.CurrentProduct = exports.CurrentRuntime = exports.Architecture = exports.Product = exports.OperatingSystem = exports.Runtime = void 0;
37
+ exports.getCurrentRuntime = getCurrentRuntime;
38
+ exports.getCurrentOS = getCurrentOS;
39
+ exports.getOSFromUserAgent = getOSFromUserAgent;
40
+ exports.getCurrentProduct = getCurrentProduct;
41
+ exports.getProductFromUserAgent = getProductFromUserAgent;
42
+ exports.getCurrentVersion = getCurrentVersion;
43
+ exports.getVersionFromUserAgent = getVersionFromUserAgent;
44
+ exports.getCurrentArchitecture = getCurrentArchitecture;
45
+ exports.dumpSystemInfo = dumpSystemInfo;
46
+ exports.getSystemInfo = getSystemInfo;
47
+ // deno-lint-ignore-file no-process-global
48
+ /* Private functions */
49
+ const dntShim = __importStar(require("../../../../../_dnt.shims.js"));
50
+ function getChromeVersion(userAgent) {
51
+ const match = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
52
+ return match ? match[2] : "Unknown";
53
+ }
54
+ function getFirefoxVersion(userAgent) {
55
+ const match = userAgent.match(/Firefox\/([0-9]+)\./);
56
+ return match ? match[1] : "Unknown";
57
+ }
58
+ function getEdgeVersion(userAgent) {
59
+ const match = userAgent.match(/Edg\/([0-9]+)\./);
60
+ return match ? match[1] : "Unknown";
61
+ }
62
+ function getSafariVersion(userAgent) {
63
+ const match = userAgent.match(/Version\/([0-9]+)\.([0-9]+)(\.[0-9]+)?/);
64
+ if (match)
65
+ return `${match[1]}.${match[2]}`;
66
+ return "Unknown";
67
+ }
68
+ function getOperaVersion(userAgent) {
69
+ // Look for either 'Opera/' or 'OPR/' followed by the version
70
+ const match = userAgent.match(/(Opera|OPR)\/([0-9]+)\./);
71
+ return match ? match[2] : "Unknown";
72
+ }
73
+ function getBraveVersion(userAgent) {
74
+ const match = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
75
+ return match ? match[2] : "Unknown";
76
+ }
77
+ /**
78
+ * Enum of supported Runtimes.
79
+ * @enum {string}
80
+ */
81
+ var Runtime;
82
+ (function (Runtime) {
83
+ Runtime["Deno"] = "deno";
84
+ Runtime["Bun"] = "bun";
85
+ Runtime["Node"] = "node";
86
+ Runtime["Browser"] = "browser";
87
+ Runtime["Tauri"] = "tauri";
88
+ Runtime["Workerd"] = "workerd";
89
+ Runtime["Netlify"] = "netlify";
90
+ Runtime["EdgeLight"] = "edgelight";
91
+ Runtime["Fastly"] = "fastly";
92
+ Runtime["Unsupported"] = "unsupported";
93
+ })(Runtime || (exports.Runtime = Runtime = {}));
94
+ /**
95
+ * Enum of supported Operating Systems.
96
+ * @enum {string}
97
+ */
98
+ var OperatingSystem;
99
+ (function (OperatingSystem) {
100
+ OperatingSystem["Windows"] = "windows";
101
+ OperatingSystem["macOS"] = "macos";
102
+ OperatingSystem["Linux"] = "linux";
103
+ OperatingSystem["Android"] = "android";
104
+ OperatingSystem["Unix"] = "unix";
105
+ OperatingSystem["iOS"] = "ios";
106
+ OperatingSystem["Unsupported"] = "unsupported";
107
+ })(OperatingSystem || (exports.OperatingSystem = OperatingSystem = {}));
108
+ /**
109
+ * Enum of supported Products.
110
+ * @enum {string}
111
+ */
112
+ var Product;
113
+ (function (Product) {
114
+ // All runtimes
115
+ Product["Deno"] = "deno";
116
+ Product["Bun"] = "bun";
117
+ Product["Node"] = "node";
118
+ Product["Tauri"] = "tauri";
119
+ Product["Workerd"] = "workerd";
120
+ Product["Netlify"] = "netlify";
121
+ Product["EdgeLight"] = "edgelight";
122
+ Product["Fastly"] = "fastly";
123
+ // All browsers
124
+ Product["Firefox"] = "firefox";
125
+ Product["Safari"] = "safari";
126
+ Product["Chrome"] = "chrome";
127
+ Product["Edge"] = "edge";
128
+ Product["Opera"] = "opera";
129
+ Product["Brave"] = "brave";
130
+ // And unsupported
131
+ Product["Unsupported"] = "unsupported";
132
+ })(Product || (exports.Product = Product = {}));
133
+ /**
134
+ * Enum of common CPU architectures.
135
+ * @enum {string}
136
+ */
137
+ var Architecture;
138
+ (function (Architecture) {
139
+ Architecture["x86"] = "x86";
140
+ Architecture["x64"] = "x86_64";
141
+ Architecture["arm"] = "arm";
142
+ Architecture["arm64"] = "arm64";
143
+ Architecture["Unsupported"] = "unsupported";
144
+ })(Architecture || (exports.Architecture = Architecture = {}));
145
+ ///**
146
+ // * Interface for Tauri-specific information.
147
+ // */
148
+ //export interface TauriInfo {
149
+ // /** The application version, as defined in `tauri.conf.json`. */
150
+ // version?: string;
151
+ // /** The application name, as defined in `tauri.conf.json`. */
152
+ // name?: string;
153
+ // /** The application's bundle identifier, as defined in `tauri.conf.json`. */
154
+ // identifier?: string;
155
+ // /** The version of the underlying Tauri runtime. */
156
+ // tauriVersion?: string;
157
+ //}
158
+ /**
159
+ * Verifies if a property exists in the global namespace and optionally checks its type.
160
+ *
161
+ * @param {string} name - The name of the property to verify.
162
+ * @param {string} [typeString] - The expected type of the property (optional).
163
+ * @returns {boolean} True if the property exists and matches the type (if provided), False otherwise.
164
+ */
165
+ function verifyGlobal(name, typeString) {
166
+ return name in dntShim.dntGlobalThis && (!typeString || typeof dntShim.dntGlobalThis[name] === typeString);
167
+ }
168
+ // Disable getTauriInfo() while I figure some things out.
169
+ ///**
170
+ // * Gets Tauri-specific information asynchronously.
171
+ // * Only works when running in a Tauri application.
172
+ // * @returns {Promise<TauriInfo>} Tauri-specific data
173
+ // */
174
+ //export async function getTauriInfo(): Promise<TauriInfo> {
175
+ // if (getCurrentRuntime() !== Runtime.Tauri) {
176
+ // return {};
177
+ // }
178
+ //
179
+ // try {
180
+ // const { getVersion, getName, getIdentifier, getTauriVersion } = await import("@tauri-apps/api/app");
181
+ //
182
+ // const [version, name, identifier, tauriVersion] = await Promise.all([
183
+ // getVersion().catch(() => undefined),
184
+ // getName().catch(() => undefined),
185
+ // getIdentifier().catch(() => undefined),
186
+ // getTauriVersion().catch(() => undefined),
187
+ // ]);
188
+ //
189
+ // return { version, name, identifier, tauriVersion };
190
+ // } catch (_e) {
191
+ // return {};
192
+ // }
193
+ //}
194
+ /**
195
+ * Dynamically determines the current runtime environment.
196
+ */
197
+ function getCurrentRuntime() {
198
+ if (verifyGlobal("Deno", "object"))
199
+ return Runtime.Deno;
200
+ if (verifyGlobal("Bun", "object"))
201
+ return Runtime.Bun;
202
+ if (verifyGlobal("Netlify", "object"))
203
+ return Runtime.Netlify;
204
+ if (verifyGlobal("EdgeRuntime", "string"))
205
+ return Runtime.EdgeLight;
206
+ if (globalThis.navigator?.userAgent === "Cloudflare-Workers")
207
+ return Runtime.Workerd;
208
+ if (verifyGlobal("fastly", "object"))
209
+ return Runtime.Fastly;
210
+ if (verifyGlobal("process", "object") &&
211
+ //@ts-ignore Runtime detection
212
+ typeof process.versions !== "undefined" &&
213
+ //@ts-ignore Runtime detection
214
+ typeof process.versions.node !== "undefined") {
215
+ return Runtime.Node;
216
+ }
217
+ if (verifyGlobal("window", "object")) { // Check for Browser or Tauri
218
+ // Check for Tauri first (Tauri runs in a webview, so it has window)
219
+ if (verifyGlobal("__TAURI__", "object"))
220
+ return Runtime.Tauri;
221
+ return Runtime.Browser;
222
+ }
223
+ return Runtime.Unsupported;
224
+ }
225
+ /**
226
+ * Dynamically determines the current operating system.
227
+ */
228
+ function getCurrentOS() {
229
+ const runtime = getCurrentRuntime();
230
+ switch (runtime) {
231
+ case Runtime.Deno:
232
+ switch (Deno.build.os) {
233
+ case "darwin":
234
+ return OperatingSystem.macOS;
235
+ case "windows":
236
+ return OperatingSystem.Windows;
237
+ case "linux":
238
+ return OperatingSystem.Linux;
239
+ case "android":
240
+ return OperatingSystem.Android;
241
+ case "aix":
242
+ case "freebsd":
243
+ case "illumos":
244
+ case "netbsd":
245
+ case "solaris":
246
+ return OperatingSystem.Unix;
247
+ }
248
+ return OperatingSystem.Unsupported;
249
+ case Runtime.Node:
250
+ // @ts-ignore Cross Runtime
251
+ switch (process.platform) {
252
+ case "darwin":
253
+ return OperatingSystem.macOS;
254
+ case "win32":
255
+ return OperatingSystem.Windows;
256
+ case "linux":
257
+ return OperatingSystem.Linux;
258
+ case "android":
259
+ return OperatingSystem.Android;
260
+ case "aix":
261
+ case "freebsd":
262
+ case "openbsd":
263
+ case "sunos":
264
+ return OperatingSystem.Unix;
265
+ }
266
+ return OperatingSystem.Unsupported;
267
+ case Runtime.Bun:
268
+ // @ts-ignore Cross Runtime
269
+ switch (process.platform) {
270
+ case "darwin":
271
+ return OperatingSystem.macOS;
272
+ case "win32":
273
+ return OperatingSystem.Windows;
274
+ case "linux":
275
+ return OperatingSystem.Linux;
276
+ case "android":
277
+ return OperatingSystem.Android;
278
+ case "aix":
279
+ case "freebsd":
280
+ case "openbsd":
281
+ case "sunos":
282
+ return OperatingSystem.Unix;
283
+ }
284
+ return OperatingSystem.Unsupported;
285
+ case Runtime.Tauri:
286
+ case Runtime.Browser: {
287
+ if ("userAgent" in navigator) {
288
+ const userAgent = navigator.userAgent;
289
+ return getOSFromUserAgent(userAgent);
290
+ }
291
+ }
292
+ }
293
+ return OperatingSystem.Unsupported;
294
+ }
295
+ /**
296
+ * Determine operating system from user agent string, if possible
297
+ */
298
+ function getOSFromUserAgent(userAgent) {
299
+ if (userAgent.indexOf("Win") !== -1)
300
+ return OperatingSystem.Windows;
301
+ if (userAgent.indexOf("like Mac") !== -1)
302
+ return OperatingSystem.iOS;
303
+ if (userAgent.indexOf("Mac") !== -1)
304
+ return OperatingSystem.macOS;
305
+ if (userAgent.indexOf("Android") !== -1)
306
+ return OperatingSystem.Android;
307
+ if (userAgent.indexOf("X11") !== -1 || userAgent.indexOf("Linux") !== -1)
308
+ return OperatingSystem.Linux;
309
+ return OperatingSystem.Unsupported;
310
+ }
311
+ /**
312
+ * Dynamically determines the current browser and its version (if applicable).
313
+ */
314
+ function getCurrentProduct() {
315
+ const runtime = getCurrentRuntime();
316
+ switch (runtime) {
317
+ case Runtime.Deno:
318
+ return Product.Deno;
319
+ case Runtime.Node:
320
+ return Product.Node;
321
+ case Runtime.Bun:
322
+ return Product.Bun;
323
+ case Runtime.Tauri:
324
+ return Product.Tauri;
325
+ case Runtime.Workerd:
326
+ return Product.Workerd;
327
+ case Runtime.Netlify:
328
+ return Product.Netlify;
329
+ case Runtime.EdgeLight:
330
+ return Product.EdgeLight;
331
+ case Runtime.Fastly:
332
+ return Product.Fastly;
333
+ case Runtime.Browser: {
334
+ // Brave can not be detected from user agent string, handle separately
335
+ if (verifyGlobal("brave") && "brave" in navigator)
336
+ return Product.Brave;
337
+ // For browser, get the specific browser
338
+ const userAgent = navigator.userAgent;
339
+ return getProductFromUserAgent(userAgent);
340
+ }
341
+ default:
342
+ return Product.Unsupported;
343
+ }
344
+ }
345
+ /**
346
+ * Determines the product from a user agent string, if possible
347
+ */
348
+ function getProductFromUserAgent(userAgent) {
349
+ if (userAgent.indexOf("Opera") !== -1 || userAgent.indexOf("OPR") !== -1)
350
+ return Product.Opera;
351
+ if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1)
352
+ return Product.Safari;
353
+ if (userAgent.indexOf("Edg") !== -1)
354
+ return Product.Edge;
355
+ if (userAgent.indexOf("Chrome") !== -1)
356
+ return Product.Chrome;
357
+ if (userAgent.indexOf("Firefox") !== -1)
358
+ return Product.Firefox;
359
+ return Product.Unsupported;
360
+ }
361
+ /**
362
+ * Dynamically determines the version of the current product/runtime
363
+ * @returns {string} A string containing the detected version, or undefined if the product is not supported.
364
+ */
365
+ function getCurrentVersion() {
366
+ const product = getCurrentProduct();
367
+ switch (product) {
368
+ case Product.Deno:
369
+ // @ts-ignore Runtime detection
370
+ return Deno.version.deno;
371
+ case Product.Node:
372
+ // @ts-ignore Runtime detection
373
+ return process.versions.node;
374
+ case Product.Bun:
375
+ // @ts-ignore Runtime detection
376
+ return process.versions.bun;
377
+ case Product.Tauri: //Fallthrough to default handling.
378
+ default: {
379
+ const userAgent = globalThis.navigator?.userAgent;
380
+ return getVersionFromUserAgent(userAgent);
381
+ }
382
+ }
383
+ }
384
+ /**
385
+ * Determines the product version from a user agent string, if possible
386
+ */
387
+ function getVersionFromUserAgent(userAgent) {
388
+ const product = getProductFromUserAgent(userAgent);
389
+ switch (product) {
390
+ case Product.Chrome:
391
+ return getChromeVersion(userAgent);
392
+ case Product.Firefox:
393
+ return getFirefoxVersion(userAgent);
394
+ case Product.Edge:
395
+ return getEdgeVersion(userAgent);
396
+ case Product.Safari:
397
+ return getSafariVersion(userAgent);
398
+ case Product.Opera:
399
+ return getOperaVersion(userAgent);
400
+ case Product.Brave:
401
+ return getBraveVersion(userAgent);
402
+ default:
403
+ return undefined;
404
+ }
405
+ }
406
+ /**
407
+ * Attempts to determine the current CPU architecture of the runtime's environment.
408
+ */
409
+ function getCurrentArchitecture() {
410
+ const runtime = getCurrentRuntime();
411
+ switch (runtime) {
412
+ case Runtime.Deno:
413
+ if (Deno.build.arch === "x86_64")
414
+ return Architecture.x64;
415
+ if (Deno.build.arch === "aarch64")
416
+ return Architecture.arm64;
417
+ if (Deno.build.os === "darwin")
418
+ return Architecture.x64;
419
+ return Architecture.x86;
420
+ case Runtime.Bun:
421
+ case Runtime.Node:
422
+ // @ts-ignore Cross Runtime
423
+ switch (process.arch) {
424
+ case "arm":
425
+ return Architecture.arm;
426
+ case "arm64":
427
+ return Architecture.arm64;
428
+ case "ia32":
429
+ return Architecture.x86;
430
+ case "x64":
431
+ return Architecture.x64;
432
+ case "loong64":
433
+ case "mips":
434
+ case "mipsel":
435
+ case "ppc":
436
+ case "ppc64":
437
+ case "riscv64":
438
+ case "s390":
439
+ case "s390x":
440
+ return Architecture.Unsupported;
441
+ }
442
+ return Architecture.Unsupported;
443
+ case Runtime.Tauri:
444
+ case Runtime.Browser: {
445
+ const userAgent = navigator.userAgent;
446
+ // @ts-ignore Cross Runtime
447
+ const platform = navigator.platform;
448
+ if (platform.indexOf("Win64") !== -1 || platform.indexOf("x64") !== -1 || platform.indexOf("x86_64") !== -1)
449
+ return Architecture.x64;
450
+ if (platform.indexOf("Win32") !== -1 || (platform.indexOf("x86") !== -1 && platform.indexOf("x86_64") === -1))
451
+ return Architecture.x86;
452
+ if (userAgent.indexOf("Win64") !== -1 || userAgent.indexOf("x64") !== -1 || userAgent.indexOf("x86_64") !== -1)
453
+ return Architecture.x64;
454
+ if (userAgent.indexOf("Win32") !== -1 || (userAgent.indexOf("x86") !== -1 && userAgent.indexOf("x86_64") === -1))
455
+ return Architecture.x86;
456
+ if (userAgent.indexOf("arm64") !== -1)
457
+ return Architecture.arm64;
458
+ if (userAgent.indexOf("arm") !== -1) {
459
+ return Architecture.arm;
460
+ }
461
+ // @ts-ignore Cross Runtime
462
+ if (platform.indexOf("iPhone") || platform.indexOf("iPad") || (userAgent.indexOf("Mac") !== -1 && "ontouchend" in document)) {
463
+ // Likely aarch64 on newer iOS devices and Apple Silicon Macs
464
+ return Architecture.arm64;
465
+ }
466
+ return Architecture.Unsupported;
467
+ }
468
+ }
469
+ return Architecture.Unsupported;
470
+ }
471
+ /**
472
+ * Retrieves the current system information.
473
+ * @returns {SystemInfo} An object containing the system information.
474
+ */
475
+ function getSystemInfoInternal() {
476
+ const systemInfo = {
477
+ runtime: exports.CurrentRuntime,
478
+ product: exports.CurrentProduct,
479
+ version: exports.CurrentVersion,
480
+ os: exports.CurrentOS,
481
+ architecture: exports.CurrentArchitecture,
482
+ };
483
+ return systemInfo;
484
+ }
485
+ /**
486
+ * Logs current system information to the console.
487
+ *
488
+ * @param {boolean} [useTable=false] - If true, formats the output as a table.
489
+ */
490
+ function dumpSystemInfo(useTable = false) {
491
+ const systemInfo = getSystemInfoInternal();
492
+ if (useTable) {
493
+ console.table(systemInfo);
494
+ }
495
+ else {
496
+ console.log(JSON.stringify(systemInfo, null, 2));
497
+ }
498
+ }
499
+ /**
500
+ * Gets the current system information as a formatted JSON string.
501
+ * @returns {string}
502
+ */
503
+ function getSystemInfo() {
504
+ const systemInfo = getSystemInfoInternal();
505
+ return JSON.stringify(systemInfo);
506
+ }
507
+ /**
508
+ * Static variable containing the current runtime.
509
+ */
510
+ exports.CurrentRuntime = getCurrentRuntime();
511
+ /**
512
+ * Static variable containing the current product.
513
+ */
514
+ exports.CurrentProduct = getCurrentProduct();
515
+ /**
516
+ * Static variable containing the current product/runtime version.
517
+ */
518
+ exports.CurrentVersion = getCurrentVersion();
519
+ /**
520
+ * Static variable containing the current operating system.
521
+ */
522
+ exports.CurrentOS = getCurrentOS();
523
+ /**
524
+ * Static variable containing the current operating system.
525
+ */
526
+ exports.CurrentArchitecture = getCurrentArchitecture();
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @pinta365/strava - TypeScript client for Strava API v3
3
+ *
4
+ * A cross-runtime (Deno, Node.js, Bun, Browser) library for interacting with the Strava API.
5
+ */
6
+ export { StravaClient } from "./src/client.js";
7
+ export type { AuthCredentials, ClientOptions } from "./src/client.js";
8
+ export { StravaAuthError, StravaError, StravaNotFoundError, StravaRateLimitError, StravaServerError, StravaValidationError } from "./src/errors.js";
9
+ export { exchangeCode, getAuthorizationUrl, OAuthManager, refreshAccessToken } from "./src/auth/oauth.js";
10
+ export { formatScopes, hasAllScopes, hasScope, parseScopes, StravaScope, validateScopes } from "./src/auth/scopes.js";
11
+ export type { TokenData, TokenStore } from "./src/auth/token-store.js";
12
+ export { FileSystemTokenStore, getDefaultTokenStore, LocalStorageTokenStore, MemoryTokenStore } from "./src/auth/token-store.js";
13
+ export type { PaginationOptions, RateLimitInfo, RateLimitStrategy, RequestConfig, RetryConfig } from "./src/types/common.js";
14
+ export type { Activity, ActivityStats, ActivityTotal, ActivityType, ActivityZone, Athlete, Club, Comment, DetailedActivity, DetailedAthlete, DetailedClub, DetailedGear, DetailedSegment, DetailedSegmentEffort, ExplorerResponse, ExplorerSegment, Gear, Lap, LatLng, PhotosSummary, PolylineMap, Route, Segment, SegmentEffort, Split, SportType, StreamSet, SummaryActivity, SummaryAthlete, SummaryClub, SummaryGear, SummaryPRSegmentEffort, SummarySegment, SummarySegmentEffort, UpdatableActivity, Upload, Waypoint, Zones, } from "./src/types/api.js";
15
+ export { AthletesResource } from "./src/resources/athletes.js";
16
+ export { ActivitiesResource } from "./src/resources/activities.js";
17
+ export { SegmentsResource } from "./src/resources/segments.js";
18
+ export { SegmentEffortsResource } from "./src/resources/segment-efforts.js";
19
+ export { ClubsResource } from "./src/resources/clubs.js";
20
+ export { GearsResource } from "./src/resources/gears.js";
21
+ export { RoutesResource } from "./src/resources/routes.js";
22
+ export { UploadsResource } from "./src/resources/uploads.js";
23
+ export { StreamsResource } from "./src/resources/streams.js";
24
+ export { buildPaginationQuery, listAll, PaginatedIterator } from "./src/utils/pagination.js";
25
+ export { addComputedFields, applyTransformations, flattenResponses, transformDates } from "./src/utils/transformers.js";
26
+ export { validateDate, validateNonEmptyString, validateNonNegativeInteger, validatePagination, validatePositiveInteger, validateRange, } from "./src/utils/validators.js";
27
+ //# sourceMappingURL=mod.d.ts.map