Search by

endurance / activity-gpx

endurance

GPX recorded tracks mapped to Endurance Activity import streams

Package info

github.com/youmad/endurance-activity-gpx

pkg:composer/endurance/activity-gpx

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-11-23 20:54 UTC

This package is auto-updated.

Last update: 2026-11-23 20:58:04 UTC


README

Import one recorded GPX track through Endurance Activity's staged writer.

composer require endurance/activity-gpx

Supply an Activity stream importer and an application callback that creates the Activity with the validated start time:

use Endurance\ActivityGpx\Import\ImportGpxActivity;

$result = new ImportGpxActivity($activityStreamImporter)->import(
    activityId: $activityId,
    idempotencyKey: $stableRetryKey,
    source: $stream,
    onPrepared: fn ($start) => $ensureActivityStarted->handle($activityId, $start),
);
  • Exactly one nonempty track is required. Every point needs a zoned absolute timestamp with at most six fractional digits, ordered across all segments. Multiple tracks and route-only/untimed inputs raise UnsupportedGpxActivity.
  • The caller owns the input. A private disk spool validates the whole document before onPrepared and generation acquisition. Memory is bounded; temporary disk use grows with input. onProgress supports cancellation and lease checks.
  • onImported runs inside activation. Retries use the same Activity/idempotency key; a completed import does not publish or invoke that callback again.
  • Reports distinguish reported readings from derived GPS estimates. Segments preserve gaps; they do not imply pauses. No sessions, laps or timer events are invented, and elapsed time is not measured timer time.

For an already selected track, PrepareGpxTrackActivity::prepare() accepts a completed GPX read and a repeatable point factory. Keep that source unchanged until the prepared items have been fully consumed.

Types in Internal and elements marked @internal are not public API.

License: MPL-2.0.