trails/apps/journal/app/lib/sync
Ullrich Schäfer a9c0093877
Add Wahoo push action route + OAuth callback resume
Adds /api/sync/push/:provider/:routeId as the user-triggered entry
point for pushing a route. The route action delegates to a new
pushes.server.ts pipeline that:

- resolves the latest route_versions row and uses that GPX (not
  routes.gpx) so the bytes Wahoo gets match the snapshot the user
  sees
- short-circuits on (user, route, version, provider) idempotency:
  a successful prior push returns the existing remote_id without
  re-calling Wahoo
- detects scope_missing before hitting Wahoo and redirects through
  getAuthUrl with a base64url-encoded state carrying pushAfter +
  returnTo
- refreshes tokens once on PushError({ code: "token_expired" }) and
  retries the push, then updates sync_connections in place
- records every outcome in sync_pushes (insert on first attempt,
  update on retry) so the UI can show success/failure state

The OAuth callback handler now decodes the state, resumes a
pushAfter pipeline server-side after exchangeCode, and handles the
?error=access_denied path with a needs_permission notice.

Also flips packages/fit/src/fitsdk.d.ts to a regular .ts side-effect
shim so journal's tsc picks up the @garmin/fitsdk module declaration
when consuming the workspace package via source.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 22:41:24 +02:00
..
providers Add Wahoo pushRoute and SyncProvider push interface 2026-04-30 22:36:45 +02:00
connections.server.ts Add Wahoo pushRoute and SyncProvider push interface 2026-04-30 22:36:45 +02:00
imports.server.ts Add activity import source badge, delete action, and No GPS indicator 2026-04-05 16:49:42 +02:00
pushes.server.test.ts Add Wahoo push action route + OAuth callback resume 2026-04-30 22:41:24 +02:00
pushes.server.ts Add Wahoo push action route + OAuth callback resume 2026-04-30 22:41:24 +02:00
registry.ts Add Wahoo activity sync with provider-agnostic framework 2026-04-04 11:22:02 +01:00
types.ts Add Wahoo pushRoute and SyncProvider push interface 2026-04-30 22:36:45 +02:00