Commit 8102fe5
feat(garmin-connect): add Garmin Connect API client package (#131)
* feat(garmin-connect): add Garmin Connect API client package
Add @kaiord/garmin-connect package that provides HTTP transport for
communicating with Garmin Connect. Implements SSO authentication
(CSRF + credentials + OAuth1/OAuth2 exchange), Bearer token management
with auto-refresh, and full workout CRUD (push/pull/list/delete).
Also adds generic ports to @kaiord/core (WorkoutService, AuthProvider,
TokenStore) designed to be reusable for other platforms (Strava, etc).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: apply lint fixes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(garmin-connect): address CodeRabbit review comments
- Fix broken export_tokens/restore_tokens round-trip (track oauth1 token)
- Fix refresh token failure hanging subscribers (try/catch/finally + reject)
- Add clearTokens() to HTTP client, use in logout instead of zombie tokens
- Fix checkAccountLocked to only throw on ACCOUNT_LOCKED status
- Fix checkPageTitle to use captured group substring match
- Add HTTP response status checks in SSO functions
- Refactor workout service into standalone helper functions (<40 lines each)
- Wire Zod schemas for runtime validation of push/list responses
- Consistent error wrapping with ServiceApiError across all CRUD operations
- Move types before import in package.json exports
- Add token refresh tests (proactive, reactive, coalescing, failure)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(garmin-connect): address second round of review comments
- Add res.ok check in fetchConsumer before parsing JSON
- Use block bodies in forEach callbacks to avoid implicit returns
- Set file permissions to 0o600 for token store (owner-only)
- Document cookie-aware fetch requirement on garminSso
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(garmin-connect): add cookie-aware fetch, simplify API, integration tests
- Add fetch-cookie for SSO cookie persistence across requests
- Simplify API surface to only login, list, and push operations
- Remove pull and remove operations
- Split HTTP modules for readability (<100 lines per file)
- Extract shared types, token refresh, and OAuth consumer modules
- Add integration tests with real Garmin Connect login
- Add CI integration-garmin job with GitHub secrets
- Add JSDoc to Zod response schemas
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore(garmin-connect): apply prettier formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(garmin-connect): address CodeRabbit review comments and fix integration tests
- Fix vitest integration config: use dedicated config file instead of --testPathPattern
- Remove unsafe default fetchFn in garminSso (force cookie-aware fetch)
- Add res.ok check on 401-retry path in authFetch
- Handle 204 empty responses in del method
- Add HTTP status check on CSRF page fetch
- Fix CI always() condition for integration-garmin job
- Document third-party S3 dependency for OAuth consumer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove claude-code-review workflow
The Anthropic API account has no credits, causing the workflow to fail
on every PR. Remove until billing is resolved.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(garmin-connect): accept string dates in workout summary schema
Garmin API returns createdDate/updatedDate as strings, not numbers.
Update Zod schema and mapper types to accept both.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(garmin-connect): move integration test next to entry point
Move from src/adapters/integration/ to src/index.integration.test.ts
to follow convention of keeping tests alongside their source files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(garmin-connect): add README and npm publish/release configuration
Add garmin-connect to changeset linked packages, release workflow version
tracking, and GitHub releases script. Add README matching monorepo style.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore(garmin-connect): apply prettier formatting to README
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Pablo Albaladejo <pablo.albaladejo@aircall.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 4b45e02 commit 8102fe5
File tree
45 files changed
+2384
-152
lines changed- .changeset
- .github/workflows
- docs
- packages
- core/src
- domain/types
- ports
- garmin-connect
- src
- adapters
- auth
- client
- http
- mappers
- schemas
- token-store
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
45 files changed
+2384
-152
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
84 | 95 | | |
85 | 96 | | |
86 | 97 | | |
| |||
94 | 105 | | |
95 | 106 | | |
96 | 107 | | |
| 108 | + | |
97 | 109 | | |
98 | 110 | | |
99 | 111 | | |
| |||
105 | 117 | | |
106 | 118 | | |
107 | 119 | | |
| 120 | + | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
| |||
156 | 169 | | |
157 | 170 | | |
158 | 171 | | |
159 | | - | |
| 172 | + | |
160 | 173 | | |
161 | 174 | | |
162 | 175 | | |
| |||
211 | 224 | | |
212 | 225 | | |
213 | 226 | | |
214 | | - | |
| 227 | + | |
215 | 228 | | |
216 | 229 | | |
217 | 230 | | |
| |||
328 | 341 | | |
329 | 342 | | |
330 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
331 | 369 | | |
332 | 370 | | |
333 | 371 | | |
| |||
390 | 428 | | |
391 | 429 | | |
392 | 430 | | |
393 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
394 | 441 | | |
395 | 442 | | |
396 | 443 | | |
| |||
399 | 446 | | |
400 | 447 | | |
401 | 448 | | |
402 | | - | |
| 449 | + | |
| 450 | + | |
403 | 451 | | |
404 | 452 | | |
405 | 453 | | |
| |||
427 | 475 | | |
428 | 476 | | |
429 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
430 | 481 | | |
431 | 482 | | |
432 | 483 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| 108 | + | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| |||
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
123 | 134 | | |
124 | 135 | | |
125 | 136 | | |
| |||
174 | 185 | | |
175 | 186 | | |
176 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
177 | 192 | | |
178 | 193 | | |
179 | 194 | | |
| |||
0 commit comments