incyclist-services 1.9.17 → 1.9.18
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/lib/__tests__/data/activities/activity.json +754 -0
- package/lib/__tests__/data/activities/boston.json +858 -0
- package/lib/__tests__/data/activities/fittest.json +42 -0
- package/lib/__tests__/data/activities/laptest.json +1534 -0
- package/lib/__tests__/data/activities/palmcove.json +2090 -0
- package/lib/__tests__/data/activities/prevRide1.json +1 -0
- package/lib/__tests__/data/activities/troll-90.json +1 -0
- package/lib/__tests__/data/activities/v3.json +421 -0
- package/lib/__tests__/data/activities/vancouver.json +1 -0
- package/lib/__tests__/data/activities/with_workout.json +1 -0
- package/lib/__tests__/data/apps/komoot/coordinates.json +1 -0
- package/lib/__tests__/data/apps/komoot/tour_planned.json +1 -0
- package/lib/__tests__/data/db/db.json +604 -0
- package/lib/__tests__/data/db/routes.json +125 -0
- package/lib/__tests__/data/db/videos.json +465 -0
- package/lib/__tests__/data/overpass/MapArea-test1.json +639 -0
- package/lib/__tests__/data/overpass/default-2.json +45177 -0
- package/lib/__tests__/data/overpass/default-3.json +18263 -0
- package/lib/__tests__/data/overpass/default-location.json +10004 -0
- package/lib/__tests__/data/overpass/garden-issue1.json +19498 -0
- package/lib/__tests__/data/overpass/miami.json +150879 -0
- package/lib/__tests__/data/overpass/roundabout-issue2.json +89321 -0
- package/lib/__tests__/data/overpass/roundabout-issues.json +75572 -0
- package/lib/__tests__/data/overpass/roundabout-test.json +58104 -0
- package/lib/__tests__/data/rlv/Tryvann.json +1 -0
- package/lib/__tests__/data/rlv/holzweiler.json +6235 -0
- package/lib/__tests__/data/rlv/pointfix.json +1 -0
- package/lib/__tests__/data/rlv/valdrome.json +114 -0
- package/lib/__tests__/data/routes/demo.json +1 -0
- package/lib/__tests__/data/routes/heidweiher.json +1 -0
- package/lib/__tests__/data/routes/sydney.json +1 -0
- package/lib/__tests__/data/routes/sydney1.json +1 -0
- package/lib/__tests__/data/routes/sydney2.json +3896 -0
- package/lib/__tests__/data/workouts/db.json +1 -0
- package/lib/__tests__/utils/fileAccessMock.d.ts +5 -0
- package/lib/__tests__/utils/fileAccessMock.js +21 -0
- package/lib/__tests__/utils/fixture.d.ts +1 -0
- package/lib/__tests__/utils/fixture.js +23 -0
- package/lib/__tests__/utils/formPost.d.ts +6 -0
- package/lib/__tests__/utils/formPost.js +39 -0
- package/lib/__tests__/utils/loadFile.d.ts +1 -0
- package/lib/__tests__/utils/loadFile.js +10 -0
- package/lib/cjs/devices/page/base/guidance/guidance.js +563 -0
- package/lib/cjs/devices/page/base/guidance/index.js +15 -0
- package/lib/cjs/devices/page/base/guidance/types.js +2 -0
- package/lib/cjs/devices/pairing/helper.js +95 -0
- package/lib/cjs/devices/pairing/service.js +2 -1
- package/lib/esm/devices/page/base/guidance/guidance.js +559 -0
- package/lib/esm/devices/page/base/guidance/index.js +1 -0
- package/lib/esm/devices/page/base/guidance/types.js +1 -0
- package/lib/esm/devices/pairing/helper.js +85 -0
- package/lib/esm/devices/pairing/service.js +2 -1
- package/lib/src/activities/active-rides/index.d.ts +2 -0
- package/lib/src/activities/active-rides/index.js +2 -0
- package/lib/src/activities/active-rides/mq.d.ts +28 -0
- package/lib/src/activities/active-rides/mq.js +187 -0
- package/lib/src/activities/active-rides/service.d.ts +136 -0
- package/lib/src/activities/active-rides/service.js +973 -0
- package/lib/src/activities/active-rides/service.unit.test.d.ts +1 -0
- package/lib/src/activities/active-rides/service.unit.test.js +475 -0
- package/lib/src/activities/active-rides/sessions.d.ts +0 -0
- package/lib/src/activities/active-rides/sessions.js +0 -0
- package/lib/src/activities/active-rides/types.d.ts +105 -0
- package/lib/src/activities/active-rides/types.js +1 -0
- package/lib/src/activities/base/api/active-rides/api.d.ts +13 -0
- package/lib/src/activities/base/api/active-rides/api.e2e.test.d.ts +1 -0
- package/lib/src/activities/base/api/active-rides/api.e2e.test.js +10 -0
- package/lib/src/activities/base/api/active-rides/api.js +118 -0
- package/lib/src/activities/base/api/active-rides/api.unit.test.d.ts +1 -0
- package/lib/src/activities/base/api/active-rides/api.unit.test.js +74 -0
- package/lib/src/activities/base/api/active-rides/index.d.ts +2 -0
- package/lib/src/activities/base/api/active-rides/index.js +2 -0
- package/lib/src/activities/base/api/active-rides/types.d.ts +5 -0
- package/lib/src/activities/base/api/active-rides/types.js +1 -0
- package/lib/src/activities/base/api/fitconvert/consts.d.ts +2 -0
- package/lib/src/activities/base/api/fitconvert/consts.js +2 -0
- package/lib/src/activities/base/api/fitconvert/fitconvert.d.ts +9 -0
- package/lib/src/activities/base/api/fitconvert/fitconvert.e2e.test.d.ts +1 -0
- package/lib/src/activities/base/api/fitconvert/fitconvert.e2e.test.js +32 -0
- package/lib/src/activities/base/api/fitconvert/fitconvert.js +94 -0
- package/lib/src/activities/base/api/fitconvert/fitconvert.unit.test.d.ts +1 -0
- package/lib/src/activities/base/api/fitconvert/fitconvert.unit.test.js +38 -0
- package/lib/src/activities/base/api/fitconvert/index.d.ts +1 -0
- package/lib/src/activities/base/api/fitconvert/index.js +1 -0
- package/lib/src/activities/base/api/index.d.ts +1 -0
- package/lib/src/activities/base/api/index.js +1 -0
- package/lib/src/activities/base/convert/converter.d.ts +7 -0
- package/lib/src/activities/base/convert/converter.js +17 -0
- package/lib/src/activities/base/convert/converter.unit.test.d.ts +1 -0
- package/lib/src/activities/base/convert/converter.unit.test.js +39 -0
- package/lib/src/activities/base/convert/factory.d.ts +8 -0
- package/lib/src/activities/base/convert/factory.js +72 -0
- package/lib/src/activities/base/convert/factory.unit.test.d.ts +1 -0
- package/lib/src/activities/base/convert/factory.unit.test.js +51 -0
- package/lib/src/activities/base/convert/fit/index.d.ts +2 -0
- package/lib/src/activities/base/convert/fit/index.js +2 -0
- package/lib/src/activities/base/convert/fit/local-fit.d.ts +16 -0
- package/lib/src/activities/base/convert/fit/local-fit.js +246 -0
- package/lib/src/activities/base/convert/fit/local-fit.unit.test.d.ts +1 -0
- package/lib/src/activities/base/convert/fit/local-fit.unit.test.js +225 -0
- package/lib/src/activities/base/convert/fit/remote-fit.d.ts +13 -0
- package/lib/src/activities/base/convert/fit/remote-fit.js +51 -0
- package/lib/src/activities/base/convert/fit/remote-fit.unit.test.d.ts +1 -0
- package/lib/src/activities/base/convert/fit/remote-fit.unit.test.js +36 -0
- package/lib/src/activities/base/convert/index.d.ts +4 -0
- package/lib/src/activities/base/convert/index.js +4 -0
- package/lib/src/activities/base/convert/tcx/index.d.ts +1 -0
- package/lib/src/activities/base/convert/tcx/index.js +1 -0
- package/lib/src/activities/base/convert/tcx/tcx.d.ts +25 -0
- package/lib/src/activities/base/convert/tcx/tcx.js +206 -0
- package/lib/src/activities/base/convert/tcx/tcx.unit.test.d.ts +1 -0
- package/lib/src/activities/base/convert/tcx/tcx.unit.test.js +75 -0
- package/lib/src/activities/base/convert/tcx/types.d.ts +5 -0
- package/lib/src/activities/base/convert/tcx/types.js +1 -0
- package/lib/src/activities/base/convert/types.d.ts +7 -0
- package/lib/src/activities/base/convert/types.js +5 -0
- package/lib/src/activities/base/index.d.ts +5 -0
- package/lib/src/activities/base/index.js +5 -0
- package/lib/src/activities/base/model/index.d.ts +212 -0
- package/lib/src/activities/base/model/index.js +6 -0
- package/lib/src/activities/base/repo/db.d.ts +62 -0
- package/lib/src/activities/base/repo/db.js +543 -0
- package/lib/src/activities/base/repo/db.unit.test.d.ts +1 -0
- package/lib/src/activities/base/repo/db.unit.test.js +189 -0
- package/lib/src/activities/base/repo/index.d.ts +2 -0
- package/lib/src/activities/base/repo/index.js +2 -0
- package/lib/src/activities/base/repo/migration/factory.d.ts +7 -0
- package/lib/src/activities/base/repo/migration/factory.js +21 -0
- package/lib/src/activities/base/repo/migration/types.d.ts +15 -0
- package/lib/src/activities/base/repo/migration/types.js +13 -0
- package/lib/src/activities/base/repo/migration/v0.d.ts +5 -0
- package/lib/src/activities/base/repo/migration/v0.js +14 -0
- package/lib/src/activities/base/repo/migration/v1.d.ts +5 -0
- package/lib/src/activities/base/repo/migration/v1.js +15 -0
- package/lib/src/activities/base/repo/migration/v2.d.ts +5 -0
- package/lib/src/activities/base/repo/migration/v2.js +7 -0
- package/lib/src/activities/base/repo/migration/v3.d.ts +5 -0
- package/lib/src/activities/base/repo/migration/v3.js +23 -0
- package/lib/src/activities/base/repo/types.d.ts +15 -0
- package/lib/src/activities/base/repo/types.js +1 -0
- package/lib/src/activities/base/utils/activity.d.ts +51 -0
- package/lib/src/activities/base/utils/activity.js +338 -0
- package/lib/src/activities/base/utils/activity.unit.test.d.ts +1 -0
- package/lib/src/activities/base/utils/activity.unit.test.js +210 -0
- package/lib/src/activities/base/utils/helpers.d.ts +4 -0
- package/lib/src/activities/base/utils/helpers.js +47 -0
- package/lib/src/activities/base/utils/helpers.unit.test.d.ts +1 -0
- package/lib/src/activities/base/utils/helpers.unit.test.js +19 -0
- package/lib/src/activities/base/utils/index.d.ts +2 -0
- package/lib/src/activities/base/utils/index.js +2 -0
- package/lib/src/activities/index.d.ts +6 -0
- package/lib/src/activities/index.js +6 -0
- package/lib/src/activities/list/index.d.ts +2 -0
- package/lib/src/activities/list/index.js +2 -0
- package/lib/src/activities/list/service.d.ts +60 -0
- package/lib/src/activities/list/service.js +484 -0
- package/lib/src/activities/list/service.unit.test.d.ts +1 -0
- package/lib/src/activities/list/service.unit.test.js +840 -0
- package/lib/src/activities/list/types.d.ts +94 -0
- package/lib/src/activities/list/types.js +1 -0
- package/lib/src/activities/list/utils.d.ts +5 -0
- package/lib/src/activities/list/utils.js +83 -0
- package/lib/src/activities/list/utils.unit.test.d.ts +1 -0
- package/lib/src/activities/list/utils.unit.test.js +104 -0
- package/lib/src/activities/page/index.d.ts +1 -0
- package/lib/src/activities/page/index.js +1 -0
- package/lib/src/activities/page/service.d.ts +59 -0
- package/lib/src/activities/page/service.js +434 -0
- package/lib/src/activities/page/service.unit.test.d.ts +1 -0
- package/lib/src/activities/page/service.unit.test.js +446 -0
- package/lib/src/activities/page/types.d.ts +41 -0
- package/lib/src/activities/page/types.js +1 -0
- package/lib/src/activities/ride/duration.d.ts +32 -0
- package/lib/src/activities/ride/duration.js +136 -0
- package/lib/src/activities/ride/duration.unit.test.d.ts +1 -0
- package/lib/src/activities/ride/duration.unit.test.js +48 -0
- package/lib/src/activities/ride/index.d.ts +1 -0
- package/lib/src/activities/ride/index.js +1 -0
- package/lib/src/activities/ride/service.d.ts +220 -0
- package/lib/src/activities/ride/service.js +1385 -0
- package/lib/src/activities/ride/service.unit.test.d.ts +1 -0
- package/lib/src/activities/ride/service.unit.test.js +922 -0
- package/lib/src/activities/ride/stats.d.ts +37 -0
- package/lib/src/activities/ride/stats.js +189 -0
- package/lib/src/activities/ride/stats.unit.test.d.ts +1 -0
- package/lib/src/activities/ride/stats.unit.test.js +90 -0
- package/lib/src/activities/ride/types.d.ts +54 -0
- package/lib/src/activities/ride/types.js +1 -0
- package/lib/src/activities/types.d.ts +3 -0
- package/lib/src/activities/types.js +3 -0
- package/lib/src/activities/upload/factory.d.ts +14 -0
- package/lib/src/activities/upload/factory.js +106 -0
- package/lib/src/activities/upload/factory.unit.test.d.ts +1 -0
- package/lib/src/activities/upload/factory.unit.test.js +157 -0
- package/lib/src/activities/upload/index.d.ts +4 -0
- package/lib/src/activities/upload/index.js +4 -0
- package/lib/src/activities/upload/intervals.d.ts +18 -0
- package/lib/src/activities/upload/intervals.js +141 -0
- package/lib/src/activities/upload/strava.d.ts +18 -0
- package/lib/src/activities/upload/strava.js +151 -0
- package/lib/src/activities/upload/strava.unit.test.d.ts +1 -0
- package/lib/src/activities/upload/strava.unit.test.js +187 -0
- package/lib/src/activities/upload/types.d.ts +25 -0
- package/lib/src/activities/upload/types.js +1 -0
- package/lib/src/api/appInfo/index.d.ts +17 -0
- package/lib/src/api/appInfo/index.js +1 -0
- package/lib/src/api/bindings/index.d.ts +46 -0
- package/lib/src/api/bindings/index.js +77 -0
- package/lib/src/api/bindings/types.d.ts +14 -0
- package/lib/src/api/bindings/types.js +1 -0
- package/lib/src/api/crypto/types.d.ts +46 -0
- package/lib/src/api/crypto/types.js +1 -0
- package/lib/src/api/download/index.d.ts +12 -0
- package/lib/src/api/download/index.js +1 -0
- package/lib/src/api/fetch/types.d.ts +16 -0
- package/lib/src/api/fetch/types.js +1 -0
- package/lib/src/api/fileAccess/types.d.ts +38 -0
- package/lib/src/api/fileAccess/types.js +1 -0
- package/lib/src/api/form/types.d.ts +6 -0
- package/lib/src/api/form/types.js +1 -0
- package/lib/src/api/fs/index.d.ts +26 -0
- package/lib/src/api/fs/index.js +1 -0
- package/lib/src/api/index.d.ts +5 -0
- package/lib/src/api/index.js +4 -0
- package/lib/src/api/logging/types.d.ts +8 -0
- package/lib/src/api/logging/types.js +1 -0
- package/lib/src/api/mapAvailability/types.d.ts +10 -0
- package/lib/src/api/mapAvailability/types.js +1 -0
- package/lib/src/api/mq/index.d.ts +9 -0
- package/lib/src/api/mq/index.js +1 -0
- package/lib/src/api/path/index.d.ts +11 -0
- package/lib/src/api/path/index.js +18 -0
- package/lib/src/api/repository/index.d.ts +8 -0
- package/lib/src/api/repository/index.js +3 -0
- package/lib/src/api/repository/json/index.d.ts +23 -0
- package/lib/src/api/repository/json/index.js +117 -0
- package/lib/src/api/repository/types.d.ts +35 -0
- package/lib/src/api/repository/types.js +1 -0
- package/lib/src/api/rest/RestApiClient.d.ts +7 -0
- package/lib/src/api/rest/RestApiClient.js +12 -0
- package/lib/src/api/rest/api.d.ts +15 -0
- package/lib/src/api/rest/api.js +71 -0
- package/lib/src/api/rest/external.d.ts +7 -0
- package/lib/src/api/rest/external.js +22 -0
- package/lib/src/api/rest/incyclist.d.ts +7 -0
- package/lib/src/api/rest/incyclist.js +33 -0
- package/lib/src/api/rest/incyclist.unit.test.d.ts +1 -0
- package/lib/src/api/rest/incyclist.unit.test.js +9 -0
- package/lib/src/api/rest/index.d.ts +3 -0
- package/lib/src/api/rest/index.js +3 -0
- package/lib/src/api/rest/types.d.ts +12 -0
- package/lib/src/api/rest/types.js +1 -0
- package/lib/src/api/secret/index.d.ts +6 -0
- package/lib/src/api/secret/index.js +1 -0
- package/lib/src/api/serial/types.d.ts +3 -0
- package/lib/src/api/serial/types.js +1 -0
- package/lib/src/api/types.d.ts +10 -0
- package/lib/src/api/types.js +1 -0
- package/lib/src/api/ui/index.d.ts +27 -0
- package/lib/src/api/ui/index.js +1 -0
- package/lib/src/api/video/index.d.ts +22 -0
- package/lib/src/api/video/index.js +1 -0
- package/lib/src/apps/base/api/base.d.ts +13 -0
- package/lib/src/apps/base/api/base.js +58 -0
- package/lib/src/apps/base/api/index.d.ts +4 -0
- package/lib/src/apps/base/api/index.js +4 -0
- package/lib/src/apps/base/api/intervals/api.d.ts +23 -0
- package/lib/src/apps/base/api/intervals/api.e2e.test.d.ts +1 -0
- package/lib/src/apps/base/api/intervals/api.e2e.test.js +77 -0
- package/lib/src/apps/base/api/intervals/api.js +127 -0
- package/lib/src/apps/base/api/intervals/api.unit.test.d.ts +1 -0
- package/lib/src/apps/base/api/intervals/api.unit.test.js +28 -0
- package/lib/src/apps/base/api/intervals/index.d.ts +2 -0
- package/lib/src/apps/base/api/intervals/index.js +2 -0
- package/lib/src/apps/base/api/intervals/types.d.ts +121 -0
- package/lib/src/apps/base/api/intervals/types.js +11 -0
- package/lib/src/apps/base/api/komoot/api.d.ts +21 -0
- package/lib/src/apps/base/api/komoot/api.e2e.test.d.ts +1 -0
- package/lib/src/apps/base/api/komoot/api.e2e.test.js +88 -0
- package/lib/src/apps/base/api/komoot/api.js +137 -0
- package/lib/src/apps/base/api/komoot/api.unit.test.d.ts +1 -0
- package/lib/src/apps/base/api/komoot/api.unit.test.js +178 -0
- package/lib/src/apps/base/api/komoot/index.d.ts +2 -0
- package/lib/src/apps/base/api/komoot/index.js +2 -0
- package/lib/src/apps/base/api/komoot/types.d.ts +94 -0
- package/lib/src/apps/base/api/komoot/types.js +1 -0
- package/lib/src/apps/base/api/strava/api.d.ts +41 -0
- package/lib/src/apps/base/api/strava/api.e2e.test.d.ts +1 -0
- package/lib/src/apps/base/api/strava/api.e2e.test.js +116 -0
- package/lib/src/apps/base/api/strava/api.js +224 -0
- package/lib/src/apps/base/api/strava/api.unit.test.d.ts +1 -0
- package/lib/src/apps/base/api/strava/api.unit.test.js +148 -0
- package/lib/src/apps/base/api/strava/index.d.ts +2 -0
- package/lib/src/apps/base/api/strava/index.js +2 -0
- package/lib/src/apps/base/api/strava/types.d.ts +140 -0
- package/lib/src/apps/base/api/strava/types.js +7 -0
- package/lib/src/apps/base/api/velohero/api.d.ts +12 -0
- package/lib/src/apps/base/api/velohero/api.e2e.test.d.ts +1 -0
- package/lib/src/apps/base/api/velohero/api.e2e.test.js +48 -0
- package/lib/src/apps/base/api/velohero/api.js +80 -0
- package/lib/src/apps/base/api/velohero/api.unit.test.d.ts +1 -0
- package/lib/src/apps/base/api/velohero/api.unit.test.js +123 -0
- package/lib/src/apps/base/api/velohero/index.d.ts +2 -0
- package/lib/src/apps/base/api/velohero/index.js +2 -0
- package/lib/src/apps/base/api/velohero/types.d.ts +14 -0
- package/lib/src/apps/base/api/velohero/types.js +1 -0
- package/lib/src/apps/base/app/index.d.ts +20 -0
- package/lib/src/apps/base/app/index.js +104 -0
- package/lib/src/apps/base/index.d.ts +3 -0
- package/lib/src/apps/base/index.js +3 -0
- package/lib/src/apps/base/types.d.ts +2 -0
- package/lib/src/apps/base/types.js +1 -0
- package/lib/src/apps/googleMaps/consts.d.ts +7 -0
- package/lib/src/apps/googleMaps/consts.js +7 -0
- package/lib/src/apps/googleMaps/index.d.ts +2 -0
- package/lib/src/apps/googleMaps/index.js +2 -0
- package/lib/src/apps/googleMaps/service.d.ts +26 -0
- package/lib/src/apps/googleMaps/service.js +168 -0
- package/lib/src/apps/googleMaps/service.unit.test.d.ts +1 -0
- package/lib/src/apps/googleMaps/service.unit.test.js +145 -0
- package/lib/src/apps/index.d.ts +4 -0
- package/lib/src/apps/index.js +4 -0
- package/lib/src/apps/intervals/IntervalsAppConnection.d.ts +23 -0
- package/lib/src/apps/intervals/IntervalsAppConnection.js +183 -0
- package/lib/src/apps/intervals/index.d.ts +0 -0
- package/lib/src/apps/intervals/index.js +0 -0
- package/lib/src/apps/intervals/types.d.ts +6 -0
- package/lib/src/apps/intervals/types.js +1 -0
- package/lib/src/apps/komoot/KomootAppConnection.d.ts +25 -0
- package/lib/src/apps/komoot/KomootAppConnection.js +245 -0
- package/lib/src/apps/komoot/index.d.ts +2 -0
- package/lib/src/apps/komoot/index.js +2 -0
- package/lib/src/apps/komoot/types.d.ts +10 -0
- package/lib/src/apps/komoot/types.js +1 -0
- package/lib/src/apps/service.d.ts +39 -0
- package/lib/src/apps/service.js +193 -0
- package/lib/src/apps/service.unit.test.d.ts +1 -0
- package/lib/src/apps/service.unit.test.js +47 -0
- package/lib/src/apps/strava/StravaAppConnection.d.ts +28 -0
- package/lib/src/apps/strava/StravaAppConnection.js +188 -0
- package/lib/src/apps/strava/StravaAppConnection.unit.test.d.ts +1 -0
- package/lib/src/apps/strava/StravaAppConnection.unit.test.js +214 -0
- package/lib/src/apps/strava/index.d.ts +2 -0
- package/lib/src/apps/strava/index.js +2 -0
- package/lib/src/apps/strava/types.d.ts +6 -0
- package/lib/src/apps/strava/types.js +1 -0
- package/lib/src/apps/types.d.ts +16 -0
- package/lib/src/apps/types.js +1 -0
- package/lib/src/appstate/index.d.ts +3 -0
- package/lib/src/appstate/index.js +3 -0
- package/lib/src/appstate/service.d.ts +17 -0
- package/lib/src/appstate/service.js +107 -0
- package/lib/src/appstate/toggle-sync.d.ts +22 -0
- package/lib/src/appstate/toggle-sync.js +170 -0
- package/lib/src/appstate/toggle-sync.unit.test.d.ts +1 -0
- package/lib/src/appstate/toggle-sync.unit.test.js +141 -0
- package/lib/src/appstate/types.d.ts +12 -0
- package/lib/src/appstate/types.js +1 -0
- package/lib/src/autoupdate/api.d.ts +23 -0
- package/lib/src/autoupdate/api.js +186 -0
- package/lib/src/autoupdate/api.unit.test.d.ts +1 -0
- package/lib/src/autoupdate/api.unit.test.js +129 -0
- package/lib/src/autoupdate/autoupdate.d.ts +6 -0
- package/lib/src/autoupdate/autoupdate.js +21 -0
- package/lib/src/autoupdate/autoupdate.unit.test.d.ts +1 -0
- package/lib/src/autoupdate/autoupdate.unit.test.js +61 -0
- package/lib/src/autoupdate/index.d.ts +2 -0
- package/lib/src/autoupdate/index.js +2 -0
- package/lib/src/avatars/index.d.ts +2 -0
- package/lib/src/avatars/index.js +2 -0
- package/lib/src/avatars/service.d.ts +17 -0
- package/lib/src/avatars/service.js +134 -0
- package/lib/src/avatars/types.d.ts +10 -0
- package/lib/src/avatars/types.js +1 -0
- package/lib/src/base/cardlist/index.d.ts +33 -0
- package/lib/src/base/cardlist/index.js +39 -0
- package/lib/src/base/cardlist/types.d.ts +4 -0
- package/lib/src/base/cardlist/types.js +1 -0
- package/lib/src/base/decorators/Injection.d.ts +2 -0
- package/lib/src/base/decorators/Injection.js +23 -0
- package/lib/src/base/decorators/index.d.ts +2 -0
- package/lib/src/base/decorators/index.js +2 -0
- package/lib/src/base/pages/index.d.ts +2 -0
- package/lib/src/base/pages/index.js +1 -0
- package/lib/src/base/pages/service.d.ts +23 -0
- package/lib/src/base/pages/service.js +122 -0
- package/lib/src/base/pages/types.d.ts +8 -0
- package/lib/src/base/pages/types.js +1 -0
- package/lib/src/base/service.d.ts +13 -0
- package/lib/src/base/service.js +32 -0
- package/lib/src/base/typedefs.d.ts +7 -0
- package/lib/src/base/typedefs.js +1 -0
- package/lib/src/base/types/index.d.ts +3 -0
- package/lib/src/base/types/index.js +3 -0
- package/lib/src/base/types/lists.d.ts +14 -0
- package/lib/src/base/types/lists.js +18 -0
- package/lib/src/base/types/observer.d.ts +20 -0
- package/lib/src/base/types/observer.js +75 -0
- package/lib/src/base/types/singleton.d.ts +1 -0
- package/lib/src/base/types/singleton.js +20 -0
- package/lib/src/base/types/singleton.unit.test.d.ts +1 -0
- package/lib/src/base/types/singleton.unit.test.js +160 -0
- package/lib/src/coaches/coach.d.ts +37 -0
- package/lib/src/coaches/coach.js +161 -0
- package/lib/src/coaches/index.d.ts +3 -0
- package/lib/src/coaches/index.js +3 -0
- package/lib/src/coaches/service.d.ts +41 -0
- package/lib/src/coaches/service.js +312 -0
- package/lib/src/coaches/service.unit.test.d.ts +1 -0
- package/lib/src/coaches/service.unit.test.js +117 -0
- package/lib/src/coaches/types.d.ts +25 -0
- package/lib/src/coaches/types.js +1 -0
- package/lib/src/devices/access/index.d.ts +2 -0
- package/lib/src/devices/access/index.js +2 -0
- package/lib/src/devices/access/model.d.ts +37 -0
- package/lib/src/devices/access/model.js +1 -0
- package/lib/src/devices/access/service.d.ts +45 -0
- package/lib/src/devices/access/service.js +521 -0
- package/lib/src/devices/access/service.unit.test.d.ts +1 -0
- package/lib/src/devices/access/service.unit.test.js +108 -0
- package/lib/src/devices/configuration/index.d.ts +2 -0
- package/lib/src/devices/configuration/index.js +2 -0
- package/lib/src/devices/configuration/model/add/index.d.ts +10 -0
- package/lib/src/devices/configuration/model/add/index.js +1 -0
- package/lib/src/devices/configuration/model/app/index.d.ts +22 -0
- package/lib/src/devices/configuration/model/app/index.js +1 -0
- package/lib/src/devices/configuration/model/exclusion/index.d.ts +19 -0
- package/lib/src/devices/configuration/model/exclusion/index.js +1 -0
- package/lib/src/devices/configuration/model/index.d.ts +5 -0
- package/lib/src/devices/configuration/model/index.js +5 -0
- package/lib/src/devices/configuration/model/repository/index.d.ts +36 -0
- package/lib/src/devices/configuration/model/repository/index.js +1 -0
- package/lib/src/devices/configuration/model/repository/legacy.d.ts +57 -0
- package/lib/src/devices/configuration/model/repository/legacy.js +1 -0
- package/lib/src/devices/configuration/model/service/index.d.ts +25 -0
- package/lib/src/devices/configuration/model/service/index.js +1 -0
- package/lib/src/devices/configuration/service-add-report.unit.test.d.ts +1 -0
- package/lib/src/devices/configuration/service-add-report.unit.test.js +105 -0
- package/lib/src/devices/configuration/service-characterization-add-autoselect.unit.test.d.ts +1 -0
- package/lib/src/devices/configuration/service-characterization-add-autoselect.unit.test.js +141 -0
- package/lib/src/devices/configuration/service-characterization-v8-read-paths.unit.test.d.ts +1 -0
- package/lib/src/devices/configuration/service-characterization-v8-read-paths.unit.test.js +83 -0
- package/lib/src/devices/configuration/service-disabled-redetect.unit.test.d.ts +1 -0
- package/lib/src/devices/configuration/service-disabled-redetect.unit.test.js +75 -0
- package/lib/src/devices/configuration/service-exclusions.unit.test.d.ts +1 -0
- package/lib/src/devices/configuration/service-exclusions.unit.test.js +236 -0
- package/lib/src/devices/configuration/service-unbuildable-devices.unit.test.d.ts +1 -0
- package/lib/src/devices/configuration/service-unbuildable-devices.unit.test.js +188 -0
- package/lib/src/devices/configuration/service.d.ts +127 -0
- package/lib/src/devices/configuration/service.js +1150 -0
- package/lib/src/devices/configuration/service.unit.test.d.ts +1 -0
- package/lib/src/devices/configuration/service.unit.test.js +1028 -0
- package/lib/src/devices/configuration/types.d.ts +2 -0
- package/lib/src/devices/configuration/types.js +1 -0
- package/lib/src/devices/index.d.ts +5 -0
- package/lib/src/devices/index.js +5 -0
- package/lib/src/devices/page/base/guidance/guidance-helper.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/guidance/guidance-helper.unit.test.js +486 -0
- package/lib/src/devices/page/base/guidance/guidance.d.ts +116 -0
- package/lib/src/devices/page/base/guidance/guidance.js +559 -0
- package/lib/src/devices/page/base/guidance/guidance.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/guidance/guidance.unit.test.js +436 -0
- package/lib/src/devices/page/base/guidance/index.d.ts +2 -0
- package/lib/src/devices/page/base/guidance/index.js +1 -0
- package/lib/src/devices/page/base/guidance/types.d.ts +47 -0
- package/lib/src/devices/page/base/guidance/types.js +1 -0
- package/lib/src/devices/page/base/logobserver.d.ts +8 -0
- package/lib/src/devices/page/base/logobserver.js +15 -0
- package/lib/src/devices/page/base/orchestrator.d.ts +11 -0
- package/lib/src/devices/page/base/orchestrator.js +1 -0
- package/lib/src/devices/page/base/service-guidance.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/service-guidance.unit.test.js +481 -0
- package/lib/src/devices/page/base/service-search.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/service-search.unit.test.js +180 -0
- package/lib/src/devices/page/base/service-tile-state.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/service-tile-state.unit.test.js +212 -0
- package/lib/src/devices/page/base/service-visit-exclusions.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/service-visit-exclusions.unit.test.js +96 -0
- package/lib/src/devices/page/base/service.d.ts +94 -0
- package/lib/src/devices/page/base/service.js +638 -0
- package/lib/src/devices/page/base/types.d.ts +171 -0
- package/lib/src/devices/page/base/types.js +1 -0
- package/lib/src/devices/page/base/visit-log-factory.d.ts +13 -0
- package/lib/src/devices/page/base/visit-log-factory.js +33 -0
- package/lib/src/devices/page/base/visit-log-factory.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/visit-log-factory.unit.test.js +87 -0
- package/lib/src/devices/page/base/visit-log.d.ts +28 -0
- package/lib/src/devices/page/base/visit-log.js +151 -0
- package/lib/src/devices/page/base/visit-log.unit.test.d.ts +1 -0
- package/lib/src/devices/page/base/visit-log.unit.test.js +314 -0
- package/lib/src/devices/page/desktop/matrix.d.ts +8 -0
- package/lib/src/devices/page/desktop/matrix.js +23 -0
- package/lib/src/devices/page/desktop/matrix.unit.test.d.ts +1 -0
- package/lib/src/devices/page/desktop/matrix.unit.test.js +7 -0
- package/lib/src/devices/page/desktop/orchestrator.d.ts +2 -0
- package/lib/src/devices/page/desktop/orchestrator.js +17 -0
- package/lib/src/devices/page/desktop/orchestrator.unit.test.d.ts +1 -0
- package/lib/src/devices/page/desktop/orchestrator.unit.test.js +40 -0
- package/lib/src/devices/page/desktop/service.d.ts +34 -0
- package/lib/src/devices/page/desktop/service.js +229 -0
- package/lib/src/devices/page/desktop/service.unit.test.d.ts +1 -0
- package/lib/src/devices/page/desktop/service.unit.test.js +393 -0
- package/lib/src/devices/page/desktop/types.d.ts +25 -0
- package/lib/src/devices/page/desktop/types.js +1 -0
- package/lib/src/devices/page/index.d.ts +7 -0
- package/lib/src/devices/page/index.js +13 -0
- package/lib/src/devices/page/index.unit.test.d.ts +1 -0
- package/lib/src/devices/page/index.unit.test.js +19 -0
- package/lib/src/devices/page/mobile/orchestrator.d.ts +2 -0
- package/lib/src/devices/page/mobile/orchestrator.js +2 -0
- package/lib/src/devices/page/mobile/service-characterization.unit.test.d.ts +1 -0
- package/lib/src/devices/page/mobile/service-characterization.unit.test.js +447 -0
- package/lib/src/devices/page/mobile/service-closed-page.unit.test.d.ts +1 -0
- package/lib/src/devices/page/mobile/service-closed-page.unit.test.js +103 -0
- package/lib/src/devices/page/mobile/service-ondelete.unit.test.d.ts +1 -0
- package/lib/src/devices/page/mobile/service-ondelete.unit.test.js +64 -0
- package/lib/src/devices/page/mobile/service-tile-unselect.unit.test.d.ts +1 -0
- package/lib/src/devices/page/mobile/service-tile-unselect.unit.test.js +90 -0
- package/lib/src/devices/page/mobile/service-visits.unit.test.d.ts +1 -0
- package/lib/src/devices/page/mobile/service-visits.unit.test.js +103 -0
- package/lib/src/devices/page/mobile/service.d.ts +26 -0
- package/lib/src/devices/page/mobile/service.js +171 -0
- package/lib/src/devices/page/mobile/statemachine.d.ts +52 -0
- package/lib/src/devices/page/mobile/statemachine.js +361 -0
- package/lib/src/devices/page/mobile/statemachine.unit.test.d.ts +1 -0
- package/lib/src/devices/page/mobile/statemachine.unit.test.js +156 -0
- package/lib/src/devices/page/types.d.ts +3 -0
- package/lib/src/devices/page/types.js +1 -0
- package/lib/src/devices/pairing/capability.d.ts +10 -0
- package/lib/src/devices/pairing/capability.js +1 -0
- package/lib/src/devices/pairing/guidance.d.ts +98 -0
- package/lib/src/devices/pairing/guidance.js +330 -0
- package/lib/src/devices/pairing/guidance.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/guidance.unit.test.js +444 -0
- package/lib/src/devices/pairing/helper.d.ts +28 -0
- package/lib/src/devices/pairing/helper.js +85 -0
- package/lib/src/devices/pairing/helper.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/helper.unit.test.js +62 -0
- package/lib/src/devices/pairing/index.d.ts +6 -0
- package/lib/src/devices/pairing/index.js +6 -0
- package/lib/src/devices/pairing/model.d.ts +124 -0
- package/lib/src/devices/pairing/model.js +1 -0
- package/lib/src/devices/pairing/service-attempts.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-attempts.unit.test.js +263 -0
- package/lib/src/devices/pairing/service-crash.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-crash.unit.test.js +55 -0
- package/lib/src/devices/pairing/service-detection-conflicts.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-detection-conflicts.unit.test.js +240 -0
- package/lib/src/devices/pairing/service-disable-on-unselect.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-disable-on-unselect.unit.test.js +62 -0
- package/lib/src/devices/pairing/service-exclusion-revert.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-exclusion-revert.unit.test.js +350 -0
- package/lib/src/devices/pairing/service-liveness.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-liveness.unit.test.js +167 -0
- package/lib/src/devices/pairing/service-pairing-state.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-pairing-state.unit.test.js +82 -0
- package/lib/src/devices/pairing/service-search.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service-search.unit.test.js +321 -0
- package/lib/src/devices/pairing/service.d.ts +242 -0
- package/lib/src/devices/pairing/service.js +2073 -0
- package/lib/src/devices/pairing/service.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/service.unit.test.js +1804 -0
- package/lib/src/devices/pairing/status.d.ts +42 -0
- package/lib/src/devices/pairing/status.js +90 -0
- package/lib/src/devices/pairing/status.unit.test.d.ts +1 -0
- package/lib/src/devices/pairing/status.unit.test.js +289 -0
- package/lib/src/devices/ride/cyclingMode.d.ts +4 -0
- package/lib/src/devices/ride/cyclingMode.js +28 -0
- package/lib/src/devices/ride/cyclingMode.unit.test.d.ts +1 -0
- package/lib/src/devices/ride/cyclingMode.unit.test.js +35 -0
- package/lib/src/devices/ride/index.d.ts +3 -0
- package/lib/src/devices/ride/index.js +2 -0
- package/lib/src/devices/ride/service-start-guard.unit.test.d.ts +1 -0
- package/lib/src/devices/ride/service-start-guard.unit.test.js +96 -0
- package/lib/src/devices/ride/service.d.ts +146 -0
- package/lib/src/devices/ride/service.js +1461 -0
- package/lib/src/devices/ride/service.unit.test.d.ts +1 -0
- package/lib/src/devices/ride/service.unit.test.js +394 -0
- package/lib/src/devices/ride/types.d.ts +54 -0
- package/lib/src/devices/ride/types.js +1 -0
- package/lib/src/devices/types.d.ts +6 -0
- package/lib/src/devices/types.js +1 -0
- package/lib/src/fileaccess/externalFiles.d.ts +19 -0
- package/lib/src/fileaccess/externalFiles.js +198 -0
- package/lib/src/fileaccess/externalFiles.unit.test.d.ts +1 -0
- package/lib/src/fileaccess/externalFiles.unit.test.js +164 -0
- package/lib/src/fileaccess/index.d.ts +4 -0
- package/lib/src/fileaccess/index.js +4 -0
- package/lib/src/fileaccess/loader.d.ts +2 -0
- package/lib/src/fileaccess/loader.js +34 -0
- package/lib/src/fileaccess/loader.unit.test.d.ts +1 -0
- package/lib/src/fileaccess/loader.unit.test.js +193 -0
- package/lib/src/fileaccess/service.d.ts +61 -0
- package/lib/src/fileaccess/service.js +535 -0
- package/lib/src/fileaccess/service.unit.test.d.ts +1 -0
- package/lib/src/fileaccess/service.unit.test.js +516 -0
- package/lib/src/fileaccess/types.d.ts +62 -0
- package/lib/src/fileaccess/types.js +1 -0
- package/lib/src/fileaccess/utils.d.ts +7 -0
- package/lib/src/fileaccess/utils.js +107 -0
- package/lib/src/fileaccess/utils.unit.test.d.ts +1 -0
- package/lib/src/fileaccess/utils.unit.test.js +130 -0
- package/lib/src/i18n/countries/countries.json +255 -0
- package/lib/src/i18n/countries/index.d.ts +1 -0
- package/lib/src/i18n/countries/index.js +1 -0
- package/lib/src/i18n/countries/model.d.ts +21 -0
- package/lib/src/i18n/countries/model.js +1 -0
- package/lib/src/i18n/countries/service.d.ts +18 -0
- package/lib/src/i18n/countries/service.js +103 -0
- package/lib/src/i18n/countries/service.unit.test.d.ts +1 -0
- package/lib/src/i18n/countries/service.unit.test.js +138 -0
- package/lib/src/i18n/index.d.ts +3 -0
- package/lib/src/i18n/index.js +3 -0
- package/lib/src/i18n/localization/index.d.ts +2 -0
- package/lib/src/i18n/localization/index.js +2 -0
- package/lib/src/i18n/localization/service.d.ts +17 -0
- package/lib/src/i18n/localization/service.js +125 -0
- package/lib/src/i18n/localization/service.unit.test.d.ts +1 -0
- package/lib/src/i18n/localization/service.unit.test.js +250 -0
- package/lib/src/i18n/localization/types.d.ts +3 -0
- package/lib/src/i18n/localization/types.js +1 -0
- package/lib/src/i18n/units/converter.d.ts +17 -0
- package/lib/src/i18n/units/converter.js +172 -0
- package/lib/src/i18n/units/converter.unit.test.d.ts +1 -0
- package/lib/src/i18n/units/converter.unit.test.js +41 -0
- package/lib/src/i18n/units/index.d.ts +2 -0
- package/lib/src/i18n/units/index.js +2 -0
- package/lib/src/i18n/units/types.d.ts +17 -0
- package/lib/src/i18n/units/types.js +1 -0
- package/lib/src/index.d.ts +24 -0
- package/lib/src/index.js +23 -0
- package/lib/src/maps/MapArea/MapArea.d.ts +34 -0
- package/lib/src/maps/MapArea/MapArea.js +395 -0
- package/lib/src/maps/MapArea/MapArea.unit.test.d.ts +1 -0
- package/lib/src/maps/MapArea/MapArea.unit.test.js +379 -0
- package/lib/src/maps/MapArea/consts.d.ts +11 -0
- package/lib/src/maps/MapArea/consts.js +8 -0
- package/lib/src/maps/MapArea/index.d.ts +3 -0
- package/lib/src/maps/MapArea/index.js +3 -0
- package/lib/src/maps/MapArea/options.d.ts +24 -0
- package/lib/src/maps/MapArea/options.js +409 -0
- package/lib/src/maps/MapArea/options.unit.test.d.ts +1 -0
- package/lib/src/maps/MapArea/options.unit.test.js +179 -0
- package/lib/src/maps/MapArea/service.d.ts +55 -0
- package/lib/src/maps/MapArea/service.js +293 -0
- package/lib/src/maps/MapArea/service.unit.test.d.ts +1 -0
- package/lib/src/maps/MapArea/service.unit.test.js +62 -0
- package/lib/src/maps/MapArea/types.d.ts +137 -0
- package/lib/src/maps/MapArea/types.js +1 -0
- package/lib/src/maps/MapArea/utils.d.ts +44 -0
- package/lib/src/maps/MapArea/utils.js +578 -0
- package/lib/src/maps/MapArea/utils.unit.test.d.ts +1 -0
- package/lib/src/maps/MapArea/utils.unit.test.js +259 -0
- package/lib/src/maps/index.d.ts +1 -0
- package/lib/src/maps/index.js +1 -0
- package/lib/src/monitoring/index.d.ts +1 -0
- package/lib/src/monitoring/index.js +1 -0
- package/lib/src/monitoring/online/index.d.ts +1 -0
- package/lib/src/monitoring/online/index.js +1 -0
- package/lib/src/monitoring/online/service.d.ts +19 -0
- package/lib/src/monitoring/online/service.js +113 -0
- package/lib/src/monitoring/online/service.unit.test.d.ts +1 -0
- package/lib/src/monitoring/online/service.unit.test.js +122 -0
- package/lib/src/ride/base/base.d.ts +49 -0
- package/lib/src/ride/base/base.js +229 -0
- package/lib/src/ride/base/base.unit.test.d.ts +1 -0
- package/lib/src/ride/base/base.unit.test.js +477 -0
- package/lib/src/ride/base/index.d.ts +1 -0
- package/lib/src/ride/base/index.js +1 -0
- package/lib/src/ride/base/types.d.ts +202 -0
- package/lib/src/ride/base/types.js +1 -0
- package/lib/src/ride/display/index.d.ts +1 -0
- package/lib/src/ride/display/index.js +1 -0
- package/lib/src/ride/display/service.d.ts +164 -0
- package/lib/src/ride/display/service.js +1296 -0
- package/lib/src/ride/display/service.unit.test.d.ts +1 -0
- package/lib/src/ride/display/service.unit.test.js +629 -0
- package/lib/src/ride/index.d.ts +4 -0
- package/lib/src/ride/index.js +4 -0
- package/lib/src/ride/page/index.d.ts +2 -0
- package/lib/src/ride/page/index.js +2 -0
- package/lib/src/ride/page/service.d.ts +190 -0
- package/lib/src/ride/page/service.js +1311 -0
- package/lib/src/ride/page/service.unit.test.d.ts +1 -0
- package/lib/src/ride/page/service.unit.test.js +2367 -0
- package/lib/src/ride/page/types.d.ts +227 -0
- package/lib/src/ride/page/types.js +1 -0
- package/lib/src/ride/route/FollowRouteDisplayService.d.ts +5 -0
- package/lib/src/ride/route/FollowRouteDisplayService.js +34 -0
- package/lib/src/ride/route/FollowRouteDisplayService.unit.test.d.ts +1 -0
- package/lib/src/ride/route/FollowRouteDisplayService.unit.test.js +251 -0
- package/lib/src/ride/route/FreeRideDisplayService.d.ts +90 -0
- package/lib/src/ride/route/FreeRideDisplayService.js +626 -0
- package/lib/src/ride/route/FreeRideDisplayService.unit.test.d.ts +1 -0
- package/lib/src/ride/route/FreeRideDisplayService.unit.test.js +1500 -0
- package/lib/src/ride/route/GpxDisplayService.d.ts +141 -0
- package/lib/src/ride/route/GpxDisplayService.js +665 -0
- package/lib/src/ride/route/GpxDisplayService.unit.test.d.ts +1 -0
- package/lib/src/ride/route/GpxDisplayService.unit.test.js +1519 -0
- package/lib/src/ride/route/RLVDisplayService.d.ts +107 -0
- package/lib/src/ride/route/RLVDisplayService.js +615 -0
- package/lib/src/ride/route/RLVDisplayService.unit.test.d.ts +1 -0
- package/lib/src/ride/route/RLVDisplayService.unit.test.js +1635 -0
- package/lib/src/ride/route/RouteDisplayService.d.ts +76 -0
- package/lib/src/ride/route/RouteDisplayService.js +419 -0
- package/lib/src/ride/route/RouteDisplayService.unit.test.d.ts +1 -0
- package/lib/src/ride/route/RouteDisplayService.unit.test.js +681 -0
- package/lib/src/ride/route/types.d.ts +29 -0
- package/lib/src/ride/route/types.js +1 -0
- package/lib/src/ride/types.d.ts +3 -0
- package/lib/src/ride/types.js +1 -0
- package/lib/src/ride/view-restriction/index.d.ts +2 -0
- package/lib/src/ride/view-restriction/index.js +2 -0
- package/lib/src/ride/view-restriction/service.d.ts +30 -0
- package/lib/src/ride/view-restriction/service.js +217 -0
- package/lib/src/ride/view-restriction/service.unit.test.d.ts +1 -0
- package/lib/src/ride/view-restriction/service.unit.test.js +265 -0
- package/lib/src/ride/view-restriction/types.d.ts +57 -0
- package/lib/src/ride/view-restriction/types.js +1 -0
- package/lib/src/ride/workout/WorkoutDisplayService.d.ts +15 -0
- package/lib/src/ride/workout/WorkoutDisplayService.js +98 -0
- package/lib/src/ride/workout/WorkoutDisplayService.unit.test.d.ts +1 -0
- package/lib/src/ride/workout/WorkoutDisplayService.unit.test.js +60 -0
- package/lib/src/routes/base/api/api.d.ts +23 -0
- package/lib/src/routes/base/api/api.e2e.test.d.ts +1 -0
- package/lib/src/routes/base/api/api.e2e.test.js +36 -0
- package/lib/src/routes/base/api/api.js +203 -0
- package/lib/src/routes/base/api/api.unit.test.d.ts +1 -0
- package/lib/src/routes/base/api/api.unit.test.js +239 -0
- package/lib/src/routes/base/api/consts.d.ts +9 -0
- package/lib/src/routes/base/api/consts.js +9 -0
- package/lib/src/routes/base/api/factory.d.ts +7 -0
- package/lib/src/routes/base/api/factory.js +86 -0
- package/lib/src/routes/base/api/factory.unit.test.d.ts +1 -0
- package/lib/src/routes/base/api/factory.unit.test.js +87 -0
- package/lib/src/routes/base/api/index.d.ts +2 -0
- package/lib/src/routes/base/api/index.js +2 -0
- package/lib/src/routes/base/api/types.d.ts +88 -0
- package/lib/src/routes/base/api/types.js +1 -0
- package/lib/src/routes/base/model/route.d.ts +21 -0
- package/lib/src/routes/base/model/route.js +120 -0
- package/lib/src/routes/base/model/route.unit.test.d.ts +1 -0
- package/lib/src/routes/base/model/route.unit.test.js +27 -0
- package/lib/src/routes/base/model/tacx.d.ts +92 -0
- package/lib/src/routes/base/model/tacx.js +28 -0
- package/lib/src/routes/base/model/types.d.ts +13 -0
- package/lib/src/routes/base/model/types.js +1 -0
- package/lib/src/routes/base/parsers/bikelab.d.ts +12 -0
- package/lib/src/routes/base/parsers/bikelab.js +103 -0
- package/lib/src/routes/base/parsers/bikelab.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/bikelab.unit.test.js +38 -0
- package/lib/src/routes/base/parsers/epm.d.ts +30 -0
- package/lib/src/routes/base/parsers/epm.js +243 -0
- package/lib/src/routes/base/parsers/epm.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/epm.unit.test.js +64 -0
- package/lib/src/routes/base/parsers/factory.d.ts +15 -0
- package/lib/src/routes/base/parsers/factory.js +50 -0
- package/lib/src/routes/base/parsers/factory.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/factory.unit.test.js +142 -0
- package/lib/src/routes/base/parsers/geometry.d.ts +31 -0
- package/lib/src/routes/base/parsers/geometry.js +127 -0
- package/lib/src/routes/base/parsers/geometry.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/geometry.unit.test.js +341 -0
- package/lib/src/routes/base/parsers/getUtf8Data.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/getUtf8Data.unit.test.js +45 -0
- package/lib/src/routes/base/parsers/gpx.d.ts +31 -0
- package/lib/src/routes/base/parsers/gpx.js +230 -0
- package/lib/src/routes/base/parsers/gpx.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/gpx.unit.test.js +63 -0
- package/lib/src/routes/base/parsers/gpxFast.d.ts +2 -0
- package/lib/src/routes/base/parsers/gpxFast.js +199 -0
- package/lib/src/routes/base/parsers/gpxFastEquivalence.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/gpxFastEquivalence.unit.test.js +106 -0
- package/lib/src/routes/base/parsers/incyclist.d.ts +17 -0
- package/lib/src/routes/base/parsers/incyclist.js +200 -0
- package/lib/src/routes/base/parsers/incyclist.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/incyclist.unit.test.js +188 -0
- package/lib/src/routes/base/parsers/incyclistGpxPathEncoding.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/incyclistGpxPathEncoding.unit.test.js +47 -0
- package/lib/src/routes/base/parsers/index.d.ts +9 -0
- package/lib/src/routes/base/parsers/index.js +50 -0
- package/lib/src/routes/base/parsers/kwt.d.ts +4 -0
- package/lib/src/routes/base/parsers/kwt.js +4 -0
- package/lib/src/routes/base/parsers/multixml.d.ts +15 -0
- package/lib/src/routes/base/parsers/multixml.js +42 -0
- package/lib/src/routes/base/parsers/multixml.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/multixml.unit.test.js +216 -0
- package/lib/src/routes/base/parsers/tacx/TacxParser.d.ts +35 -0
- package/lib/src/routes/base/parsers/tacx/TacxParser.js +323 -0
- package/lib/src/routes/base/parsers/tacx/TacxParser.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/tacx/TacxParser.unit.test.js +161 -0
- package/lib/src/routes/base/parsers/tacx/TacxReader.d.ts +12 -0
- package/lib/src/routes/base/parsers/tacx/TacxReader.js +79 -0
- package/lib/src/routes/base/parsers/tacx/TacxReader.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/tacx/TacxReader.unit.test.js +111 -0
- package/lib/src/routes/base/parsers/tacx/pgmf.d.ts +8 -0
- package/lib/src/routes/base/parsers/tacx/pgmf.js +65 -0
- package/lib/src/routes/base/parsers/tacx/pgmf.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/tacx/pgmf.unit.test.js +127 -0
- package/lib/src/routes/base/parsers/tacx/rlv.d.ts +10 -0
- package/lib/src/routes/base/parsers/tacx/rlv.js +80 -0
- package/lib/src/routes/base/parsers/tacx/rlv.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/tacx/rlv.unit.test.js +98 -0
- package/lib/src/routes/base/parsers/types.d.ts +29 -0
- package/lib/src/routes/base/parsers/types.js +1 -0
- package/lib/src/routes/base/parsers/utils.d.ts +30 -0
- package/lib/src/routes/base/parsers/utils.js +249 -0
- package/lib/src/routes/base/parsers/utils.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/utils.unit.test.js +202 -0
- package/lib/src/routes/base/parsers/xml.d.ts +37 -0
- package/lib/src/routes/base/parsers/xml.js +363 -0
- package/lib/src/routes/base/parsers/xml.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/xml.unit.test.js +60 -0
- package/lib/src/routes/base/parsers/xmlperf.unit.test.d.ts +1 -0
- package/lib/src/routes/base/parsers/xmlperf.unit.test.js +33 -0
- package/lib/src/routes/base/types/index.d.ts +128 -0
- package/lib/src/routes/base/types/index.js +2 -0
- package/lib/src/routes/base/utils/index.d.ts +2 -0
- package/lib/src/routes/base/utils/index.js +2 -0
- package/lib/src/routes/base/utils/localization.d.ts +4 -0
- package/lib/src/routes/base/utils/localization.js +35 -0
- package/lib/src/routes/base/utils/points.d.ts +24 -0
- package/lib/src/routes/base/utils/points.js +296 -0
- package/lib/src/routes/base/utils/points.unit.test.d.ts +1 -0
- package/lib/src/routes/base/utils/points.unit.test.js +30 -0
- package/lib/src/routes/base/utils/route.d.ts +44 -0
- package/lib/src/routes/base/utils/route.js +558 -0
- package/lib/src/routes/base/utils/route.unit.test.d.ts +1 -0
- package/lib/src/routes/base/utils/route.unit.test.js +187 -0
- package/lib/src/routes/base/utils/smoothing.d.ts +26 -0
- package/lib/src/routes/base/utils/smoothing.js +322 -0
- package/lib/src/routes/base/utils/smoothing.unit.test.d.ts +1 -0
- package/lib/src/routes/base/utils/smoothing.unit.test.js +412 -0
- package/lib/src/routes/download/service.d.ts +37 -0
- package/lib/src/routes/download/service.js +266 -0
- package/lib/src/routes/download/service.unit.test.d.ts +1 -0
- package/lib/src/routes/download/service.unit.test.js +88 -0
- package/lib/src/routes/download/types.d.ts +8 -0
- package/lib/src/routes/download/types.js +15 -0
- package/lib/src/routes/free-ride/index.d.ts +1 -0
- package/lib/src/routes/free-ride/index.js +1 -0
- package/lib/src/routes/free-ride/option-labels.d.ts +31 -0
- package/lib/src/routes/free-ride/option-labels.js +132 -0
- package/lib/src/routes/free-ride/option-labels.unit.test.d.ts +1 -0
- package/lib/src/routes/free-ride/option-labels.unit.test.js +77 -0
- package/lib/src/routes/free-ride/service.d.ts +82 -0
- package/lib/src/routes/free-ride/service.js +701 -0
- package/lib/src/routes/free-ride/service.unit.test.d.ts +1 -0
- package/lib/src/routes/free-ride/service.unit.test.js +203 -0
- package/lib/src/routes/index.d.ts +8 -0
- package/lib/src/routes/index.js +8 -0
- package/lib/src/routes/library/errors.d.ts +16 -0
- package/lib/src/routes/library/errors.js +54 -0
- package/lib/src/routes/library/index.d.ts +3 -0
- package/lib/src/routes/library/index.js +2 -0
- package/lib/src/routes/library/service.d.ts +81 -0
- package/lib/src/routes/library/service.js +1022 -0
- package/lib/src/routes/library/service.unit.test.d.ts +1 -0
- package/lib/src/routes/library/service.unit.test.js +1219 -0
- package/lib/src/routes/library/types.d.ts +117 -0
- package/lib/src/routes/library/types.js +1 -0
- package/lib/src/routes/list/RouteListObserver.d.ts +13 -0
- package/lib/src/routes/list/RouteListObserver.js +18 -0
- package/lib/src/routes/list/cards/ActiveImportCard.d.ts +32 -0
- package/lib/src/routes/list/cards/ActiveImportCard.js +84 -0
- package/lib/src/routes/list/cards/FreeRideCard.d.ts +40 -0
- package/lib/src/routes/list/cards/FreeRideCard.js +114 -0
- package/lib/src/routes/list/cards/RouteCard.d.ts +140 -0
- package/lib/src/routes/list/cards/RouteCard.js +1075 -0
- package/lib/src/routes/list/cards/RouteCard.unit.test.d.ts +1 -0
- package/lib/src/routes/list/cards/RouteCard.unit.test.js +429 -0
- package/lib/src/routes/list/cards/RouteCardSmoothing.unit.test.d.ts +1 -0
- package/lib/src/routes/list/cards/RouteCardSmoothing.unit.test.js +262 -0
- package/lib/src/routes/list/cards/RouteImportCard.d.ts +19 -0
- package/lib/src/routes/list/cards/RouteImportCard.js +36 -0
- package/lib/src/routes/list/cards/base.d.ts +24 -0
- package/lib/src/routes/list/cards/base.js +68 -0
- package/lib/src/routes/list/cards/types.d.ts +121 -0
- package/lib/src/routes/list/cards/types.js +1 -0
- package/lib/src/routes/list/detailsQueue.d.ts +16 -0
- package/lib/src/routes/list/detailsQueue.js +70 -0
- package/lib/src/routes/list/detailsQueue.unit.test.d.ts +1 -0
- package/lib/src/routes/list/detailsQueue.unit.test.js +125 -0
- package/lib/src/routes/list/index.d.ts +1 -0
- package/lib/src/routes/list/index.js +1 -0
- package/lib/src/routes/list/lists/alternatives.d.ts +5 -0
- package/lib/src/routes/list/lists/alternatives.js +38 -0
- package/lib/src/routes/list/lists/myroutes.d.ts +10 -0
- package/lib/src/routes/list/lists/myroutes.js +55 -0
- package/lib/src/routes/list/lists/selected.d.ts +7 -0
- package/lib/src/routes/list/lists/selected.js +35 -0
- package/lib/src/routes/list/lists/selected.unit.test.d.ts +1 -0
- package/lib/src/routes/list/lists/selected.unit.test.js +39 -0
- package/lib/src/routes/list/loaders/DBLoader.d.ts +22 -0
- package/lib/src/routes/list/loaders/DBLoader.js +46 -0
- package/lib/src/routes/list/loaders/LegacyDB.d.ts +17 -0
- package/lib/src/routes/list/loaders/LegacyDB.js +138 -0
- package/lib/src/routes/list/loaders/LegacyDB.unit.test.d.ts +1 -0
- package/lib/src/routes/list/loaders/LegacyDB.unit.test.js +32 -0
- package/lib/src/routes/list/loaders/StravaActivityLoader.d.ts +44 -0
- package/lib/src/routes/list/loaders/StravaActivityLoader.js +284 -0
- package/lib/src/routes/list/loaders/api.d.ts +31 -0
- package/lib/src/routes/list/loaders/api.e2e.test.d.ts +1 -0
- package/lib/src/routes/list/loaders/api.e2e.test.js +54 -0
- package/lib/src/routes/list/loaders/api.js +316 -0
- package/lib/src/routes/list/loaders/api.unit.test.d.ts +1 -0
- package/lib/src/routes/list/loaders/api.unit.test.js +407 -0
- package/lib/src/routes/list/loaders/db.d.ts +43 -0
- package/lib/src/routes/list/loaders/db.js +375 -0
- package/lib/src/routes/list/loaders/db.unit.test.d.ts +1 -0
- package/lib/src/routes/list/loaders/db.unit.test.js +511 -0
- package/lib/src/routes/list/loaders/types.d.ts +45 -0
- package/lib/src/routes/list/loaders/types.js +136 -0
- package/lib/src/routes/list/reimport.unit.test.d.ts +1 -0
- package/lib/src/routes/list/reimport.unit.test.js +88 -0
- package/lib/src/routes/list/rideRoute.unit.test.d.ts +1 -0
- package/lib/src/routes/list/rideRoute.unit.test.js +298 -0
- package/lib/src/routes/list/service.d.ts +242 -0
- package/lib/src/routes/list/service.js +1755 -0
- package/lib/src/routes/list/service.unit.test.d.ts +1 -0
- package/lib/src/routes/list/service.unit.test.js +988 -0
- package/lib/src/routes/list/types.d.ts +105 -0
- package/lib/src/routes/list/types.js +1 -0
- package/lib/src/routes/list/utils.d.ts +5 -0
- package/lib/src/routes/list/utils.js +36 -0
- package/lib/src/routes/list/utils.unit.test.d.ts +1 -0
- package/lib/src/routes/list/utils.unit.test.js +90 -0
- package/lib/src/routes/page/index.d.ts +1 -0
- package/lib/src/routes/page/index.js +1 -0
- package/lib/src/routes/page/service.d.ts +115 -0
- package/lib/src/routes/page/service.js +794 -0
- package/lib/src/routes/page/service.unit.test.d.ts +1 -0
- package/lib/src/routes/page/service.unit.test.js +727 -0
- package/lib/src/routes/page/types.d.ts +109 -0
- package/lib/src/routes/page/types.js +1 -0
- package/lib/src/routes/previews/index.d.ts +2 -0
- package/lib/src/routes/previews/index.js +1 -0
- package/lib/src/routes/previews/store.d.ts +46 -0
- package/lib/src/routes/previews/store.js +465 -0
- package/lib/src/routes/previews/store.unit.test.d.ts +1 -0
- package/lib/src/routes/previews/store.unit.test.js +407 -0
- package/lib/src/routes/previews/types.d.ts +9 -0
- package/lib/src/routes/previews/types.js +1 -0
- package/lib/src/routes/shapes/index.d.ts +3 -0
- package/lib/src/routes/shapes/index.js +2 -0
- package/lib/src/routes/shapes/store.d.ts +22 -0
- package/lib/src/routes/shapes/store.js +159 -0
- package/lib/src/routes/shapes/store.unit.test.d.ts +1 -0
- package/lib/src/routes/shapes/store.unit.test.js +185 -0
- package/lib/src/routes/shapes/types.d.ts +12 -0
- package/lib/src/routes/shapes/types.js +1 -0
- package/lib/src/routes/shapes/utils.d.ts +8 -0
- package/lib/src/routes/shapes/utils.js +82 -0
- package/lib/src/routes/shapes/utils.unit.test.d.ts +1 -0
- package/lib/src/routes/shapes/utils.unit.test.js +113 -0
- package/lib/src/routes/sync/factory.d.ts +14 -0
- package/lib/src/routes/sync/factory.js +119 -0
- package/lib/src/routes/sync/index.d.ts +2 -0
- package/lib/src/routes/sync/index.js +2 -0
- package/lib/src/routes/sync/komoot/provider.d.ts +51 -0
- package/lib/src/routes/sync/komoot/provider.js +366 -0
- package/lib/src/routes/sync/komoot/provider.unit.test.d.ts +1 -0
- package/lib/src/routes/sync/komoot/provider.unit.test.js +122 -0
- package/lib/src/routes/sync/types.d.ts +11 -0
- package/lib/src/routes/sync/types.js +1 -0
- package/lib/src/routes/types.d.ts +10 -0
- package/lib/src/routes/types.js +1 -0
- package/lib/src/routes/video-availability/journal.d.ts +32 -0
- package/lib/src/routes/video-availability/journal.js +210 -0
- package/lib/src/routes/video-availability/journal.unit.test.d.ts +1 -0
- package/lib/src/routes/video-availability/journal.unit.test.js +228 -0
- package/lib/src/routes/video-availability/pageActions.d.ts +37 -0
- package/lib/src/routes/video-availability/pageActions.js +266 -0
- package/lib/src/routes/video-availability/pageActions.unit.test.d.ts +1 -0
- package/lib/src/routes/video-availability/pageActions.unit.test.js +310 -0
- package/lib/src/routes/video-availability/service.d.ts +138 -0
- package/lib/src/routes/video-availability/service.js +877 -0
- package/lib/src/routes/video-availability/service.unit.test.d.ts +1 -0
- package/lib/src/routes/video-availability/service.unit.test.js +1099 -0
- package/lib/src/routes/video-availability/types.d.ts +40 -0
- package/lib/src/routes/video-availability/types.js +1 -0
- package/lib/src/services/index.d.ts +1 -0
- package/lib/src/services/index.js +1 -0
- package/lib/src/services/overpass/index.d.ts +1 -0
- package/lib/src/services/overpass/index.js +1 -0
- package/lib/src/services/overpass/overpass.d.ts +55 -0
- package/lib/src/services/overpass/overpass.js +368 -0
- package/lib/src/services/overpass/unit.test.d.ts +1 -0
- package/lib/src/services/overpass/unit.test.js +189 -0
- package/lib/src/settings/bindings/index.d.ts +1 -0
- package/lib/src/settings/bindings/index.js +1 -0
- package/lib/src/settings/bindings/json.d.ts +15 -0
- package/lib/src/settings/bindings/json.js +98 -0
- package/lib/src/settings/bindings/json.unit.test.d.ts +1 -0
- package/lib/src/settings/bindings/json.unit.test.js +67 -0
- package/lib/src/settings/bindings/types.d.ts +8 -0
- package/lib/src/settings/bindings/types.js +5 -0
- package/lib/src/settings/display/index.d.ts +3 -0
- package/lib/src/settings/display/index.js +3 -0
- package/lib/src/settings/display/ride/index.d.ts +1 -0
- package/lib/src/settings/display/ride/index.js +1 -0
- package/lib/src/settings/display/ride/service.d.ts +30 -0
- package/lib/src/settings/display/ride/service.js +176 -0
- package/lib/src/settings/display/ride/service.unit.test.d.ts +1 -0
- package/lib/src/settings/display/ride/service.unit.test.js +178 -0
- package/lib/src/settings/display/ride/types.d.ts +19 -0
- package/lib/src/settings/display/ride/types.js +1 -0
- package/lib/src/settings/display/support/index.d.ts +1 -0
- package/lib/src/settings/display/support/index.js +1 -0
- package/lib/src/settings/display/support/service.d.ts +17 -0
- package/lib/src/settings/display/support/service.js +111 -0
- package/lib/src/settings/display/support/types.d.ts +14 -0
- package/lib/src/settings/display/support/types.js +1 -0
- package/lib/src/settings/display/user/index.d.ts +2 -0
- package/lib/src/settings/display/user/index.js +2 -0
- package/lib/src/settings/display/user/service.d.ts +23 -0
- package/lib/src/settings/display/user/service.js +157 -0
- package/lib/src/settings/display/user/types.d.ts +22 -0
- package/lib/src/settings/display/user/types.js +1 -0
- package/lib/src/settings/index.d.ts +2 -0
- package/lib/src/settings/index.js +2 -0
- package/lib/src/settings/service/index.d.ts +1 -0
- package/lib/src/settings/service/index.js +1 -0
- package/lib/src/settings/service/mock.d.ts +13 -0
- package/lib/src/settings/service/mock.js +31 -0
- package/lib/src/settings/service/service.d.ts +48 -0
- package/lib/src/settings/service/service.js +228 -0
- package/lib/src/settings/service/services.unit.test.d.ts +1 -0
- package/lib/src/settings/service/services.unit.test.js +32 -0
- package/lib/src/settings/types.d.ts +3 -0
- package/lib/src/settings/types.js +1 -0
- package/lib/src/types.d.ts +10 -0
- package/lib/src/types.js +1 -0
- package/lib/src/ui/index.d.ts +1 -0
- package/lib/src/ui/index.js +1 -0
- package/lib/src/ui/service.d.ts +66 -0
- package/lib/src/ui/service.js +606 -0
- package/lib/src/ui/service.unit.test.d.ts +1 -0
- package/lib/src/ui/service.unit.test.js +400 -0
- package/lib/src/ui/types.d.ts +1 -0
- package/lib/src/ui/types.js +1 -0
- package/lib/src/utils/calc.d.ts +8 -0
- package/lib/src/utils/calc.js +34 -0
- package/lib/src/utils/clone.d.ts +1 -0
- package/lib/src/utils/clone.js +5 -0
- package/lib/src/utils/fileinfo.d.ts +2 -0
- package/lib/src/utils/fileinfo.js +9 -0
- package/lib/src/utils/formatting.d.ts +5 -0
- package/lib/src/utils/formatting.js +73 -0
- package/lib/src/utils/formatting.unit.test.d.ts +1 -0
- package/lib/src/utils/formatting.unit.test.js +93 -0
- package/lib/src/utils/geo.d.ts +15 -0
- package/lib/src/utils/geo.js +131 -0
- package/lib/src/utils/geo.unit.test.d.ts +1 -0
- package/lib/src/utils/geo.unit.test.js +105 -0
- package/lib/src/utils/index.d.ts +10 -0
- package/lib/src/utils/index.js +10 -0
- package/lib/src/utils/logging.d.ts +2 -0
- package/lib/src/utils/logging.js +18 -0
- package/lib/src/utils/math.d.ts +7 -0
- package/lib/src/utils/math.js +26 -0
- package/lib/src/utils/merge.d.ts +1 -0
- package/lib/src/utils/merge.js +26 -0
- package/lib/src/utils/nextTick.d.ts +1 -0
- package/lib/src/utils/nextTick.js +1 -0
- package/lib/src/utils/previews.e2e.test.d.ts +1 -0
- package/lib/src/utils/previews.e2e.test.js +126 -0
- package/lib/src/utils/settleWithLimit.d.ts +1 -0
- package/lib/src/utils/settleWithLimit.js +16 -0
- package/lib/src/utils/settleWithLimit.unit.test.d.ts +1 -0
- package/lib/src/utils/settleWithLimit.unit.test.js +51 -0
- package/lib/src/utils/sleep.d.ts +1 -0
- package/lib/src/utils/sleep.js +1 -0
- package/lib/src/utils/string.d.ts +3 -0
- package/lib/src/utils/string.js +22 -0
- package/lib/src/utils/time.d.ts +4 -0
- package/lib/src/utils/time.js +20 -0
- package/lib/src/utils/time.unit.test.d.ts +1 -0
- package/lib/src/utils/time.unit.test.js +28 -0
- package/lib/src/utils/valid.d.ts +1 -0
- package/lib/src/utils/valid.js +11 -0
- package/lib/src/utils/vector.d.ts +25 -0
- package/lib/src/utils/vector.js +200 -0
- package/lib/src/utils/vector.unit.test.d.ts +1 -0
- package/lib/src/utils/vector.unit.test.js +374 -0
- package/lib/src/utils/xml.d.ts +18 -0
- package/lib/src/utils/xml.js +105 -0
- package/lib/src/utils/xml.unit.test.d.ts +1 -0
- package/lib/src/utils/xml.unit.test.js +10 -0
- package/lib/src/video/Mp4BoxParser.d.ts +21 -0
- package/lib/src/video/Mp4BoxParser.js +293 -0
- package/lib/src/video/Mp4BoxParser.unit.test.d.ts +1 -0
- package/lib/src/video/Mp4BoxParser.unit.test.js +120 -0
- package/lib/src/video/VideoConversion.d.ts +24 -0
- package/lib/src/video/VideoConversion.js +176 -0
- package/lib/src/video/VideoConversion.unit.test.d.ts +1 -0
- package/lib/src/video/VideoConversion.unit.test.js +59 -0
- package/lib/src/video/VideoSyncHelper.d.ts +76 -0
- package/lib/src/video/VideoSyncHelper.js +661 -0
- package/lib/src/video/VideoSyncHelper.unit.test.d.ts +1 -0
- package/lib/src/video/VideoSyncHelper.unit.test.js +76 -0
- package/lib/src/video/audio.d.ts +4 -0
- package/lib/src/video/audio.js +10 -0
- package/lib/src/video/audio.unit.test.d.ts +1 -0
- package/lib/src/video/audio.unit.test.js +23 -0
- package/lib/src/video/index.d.ts +6 -0
- package/lib/src/video/index.js +6 -0
- package/lib/src/video/resolvePlaybackUrl.d.ts +1 -0
- package/lib/src/video/resolvePlaybackUrl.js +17 -0
- package/lib/src/video/resolvePlaybackUrl.unit.test.d.ts +1 -0
- package/lib/src/video/resolvePlaybackUrl.unit.test.js +30 -0
- package/lib/src/video/types.d.ts +44 -0
- package/lib/src/video/types.js +1 -0
- package/lib/src/workouts/base/api/api.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/api/api.unit.test.js +26 -0
- package/lib/src/workouts/base/api/consts.d.ts +9 -0
- package/lib/src/workouts/base/api/consts.js +9 -0
- package/lib/src/workouts/base/api/index.d.ts +17 -0
- package/lib/src/workouts/base/api/index.js +127 -0
- package/lib/src/workouts/base/graph/index.d.ts +2 -0
- package/lib/src/workouts/base/graph/index.js +2 -0
- package/lib/src/workouts/base/graph/series.d.ts +15 -0
- package/lib/src/workouts/base/graph/series.js +197 -0
- package/lib/src/workouts/base/graph/series.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/graph/series.unit.test.js +212 -0
- package/lib/src/workouts/base/graph/types.d.ts +11 -0
- package/lib/src/workouts/base/graph/types.js +1 -0
- package/lib/src/workouts/base/model/Segment.d.ts +18 -0
- package/lib/src/workouts/base/model/Segment.js +139 -0
- package/lib/src/workouts/base/model/Segment.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/model/Segment.unit.test.js +353 -0
- package/lib/src/workouts/base/model/Step.d.ts +35 -0
- package/lib/src/workouts/base/model/Step.js +158 -0
- package/lib/src/workouts/base/model/Step.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/model/Step.unit.test.js +287 -0
- package/lib/src/workouts/base/model/Workout.d.ts +31 -0
- package/lib/src/workouts/base/model/Workout.js +133 -0
- package/lib/src/workouts/base/model/Workout.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/model/Workout.unit.test.js +76 -0
- package/lib/src/workouts/base/model/index.d.ts +3 -0
- package/lib/src/workouts/base/model/index.js +3 -0
- package/lib/src/workouts/base/model/types.d.ts +65 -0
- package/lib/src/workouts/base/model/types.js +1 -0
- package/lib/src/workouts/base/parsers/factory.d.ts +11 -0
- package/lib/src/workouts/base/parsers/factory.js +87 -0
- package/lib/src/workouts/base/parsers/incyclist/Json.d.ts +12 -0
- package/lib/src/workouts/base/parsers/incyclist/Json.js +58 -0
- package/lib/src/workouts/base/parsers/incyclist/Json.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/parsers/incyclist/Json.unit.test.js +88 -0
- package/lib/src/workouts/base/parsers/index.d.ts +5 -0
- package/lib/src/workouts/base/parsers/index.js +35 -0
- package/lib/src/workouts/base/parsers/intervals/parser.d.ts +60 -0
- package/lib/src/workouts/base/parsers/intervals/parser.js +293 -0
- package/lib/src/workouts/base/parsers/intervals/parser.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/parsers/intervals/parser.unit.test.js +251 -0
- package/lib/src/workouts/base/parsers/intervals/types.d.ts +57 -0
- package/lib/src/workouts/base/parsers/intervals/types.js +6 -0
- package/lib/src/workouts/base/parsers/types.d.ts +8 -0
- package/lib/src/workouts/base/parsers/types.js +1 -0
- package/lib/src/workouts/base/parsers/zwo/zwo.d.ts +37 -0
- package/lib/src/workouts/base/parsers/zwo/zwo.js +247 -0
- package/lib/src/workouts/base/parsers/zwo/zwo.unit.test.d.ts +1 -0
- package/lib/src/workouts/base/parsers/zwo/zwo.unit.test.js +321 -0
- package/lib/src/workouts/calendar/index.d.ts +3 -0
- package/lib/src/workouts/calendar/index.js +3 -0
- package/lib/src/workouts/calendar/service.d.ts +51 -0
- package/lib/src/workouts/calendar/service.js +369 -0
- package/lib/src/workouts/calendar/service.unit.test.d.ts +1 -0
- package/lib/src/workouts/calendar/service.unit.test.js +60 -0
- package/lib/src/workouts/calendar/sync/factory.d.ts +10 -0
- package/lib/src/workouts/calendar/sync/factory.js +124 -0
- package/lib/src/workouts/calendar/sync/index.d.ts +2 -0
- package/lib/src/workouts/calendar/sync/index.js +2 -0
- package/lib/src/workouts/calendar/sync/intervals/provider.d.ts +22 -0
- package/lib/src/workouts/calendar/sync/intervals/provider.js +215 -0
- package/lib/src/workouts/calendar/sync/types.d.ts +10 -0
- package/lib/src/workouts/calendar/sync/types.js +1 -0
- package/lib/src/workouts/calendar/types.d.ts +15 -0
- package/lib/src/workouts/calendar/types.js +1 -0
- package/lib/src/workouts/index.d.ts +6 -0
- package/lib/src/workouts/index.js +6 -0
- package/lib/src/workouts/list/cards/ActiveImportCard.d.ts +27 -0
- package/lib/src/workouts/list/cards/ActiveImportCard.js +68 -0
- package/lib/src/workouts/list/cards/ActiveImportCard.unit.test.d.ts +1 -0
- package/lib/src/workouts/list/cards/ActiveImportCard.unit.test.js +58 -0
- package/lib/src/workouts/list/cards/ScheduledWorkoutCard.d.ts +13 -0
- package/lib/src/workouts/list/cards/ScheduledWorkoutCard.js +38 -0
- package/lib/src/workouts/list/cards/WorkoutCard.d.ts +46 -0
- package/lib/src/workouts/list/cards/WorkoutCard.js +293 -0
- package/lib/src/workouts/list/cards/WorkoutCard.unit.test.d.ts +1 -0
- package/lib/src/workouts/list/cards/WorkoutCard.unit.test.js +444 -0
- package/lib/src/workouts/list/cards/WorkoutCreateCard.d.ts +21 -0
- package/lib/src/workouts/list/cards/WorkoutCreateCard.js +96 -0
- package/lib/src/workouts/list/cards/WorkoutImportCard.d.ts +19 -0
- package/lib/src/workouts/list/cards/WorkoutImportCard.js +37 -0
- package/lib/src/workouts/list/cards/WorkoutImportCard.unit.test.d.ts +1 -0
- package/lib/src/workouts/list/cards/WorkoutImportCard.unit.test.js +16 -0
- package/lib/src/workouts/list/cards/base.d.ts +22 -0
- package/lib/src/workouts/list/cards/base.js +54 -0
- package/lib/src/workouts/list/cards/index.d.ts +3 -0
- package/lib/src/workouts/list/cards/index.js +3 -0
- package/lib/src/workouts/list/cards/types.d.ts +56 -0
- package/lib/src/workouts/list/cards/types.js +6 -0
- package/lib/src/workouts/list/index.d.ts +2 -0
- package/lib/src/workouts/list/index.js +2 -0
- package/lib/src/workouts/list/loaders/api.d.ts +11 -0
- package/lib/src/workouts/list/loaders/api.js +46 -0
- package/lib/src/workouts/list/loaders/api.unit.test.d.ts +1 -0
- package/lib/src/workouts/list/loaders/api.unit.test.js +32 -0
- package/lib/src/workouts/list/loaders/db.d.ts +27 -0
- package/lib/src/workouts/list/loaders/db.js +185 -0
- package/lib/src/workouts/list/loaders/db.unit.test.d.ts +1 -0
- package/lib/src/workouts/list/loaders/db.unit.test.js +199 -0
- package/lib/src/workouts/list/loaders/loader.d.ts +10 -0
- package/lib/src/workouts/list/loaders/loader.js +17 -0
- package/lib/src/workouts/list/service.d.ts +100 -0
- package/lib/src/workouts/list/service.js +714 -0
- package/lib/src/workouts/list/service.unit.test.d.ts +1 -0
- package/lib/src/workouts/list/service.unit.test.js +1081 -0
- package/lib/src/workouts/list/types.d.ts +12 -0
- package/lib/src/workouts/list/types.js +1 -0
- package/lib/src/workouts/page/index.d.ts +1 -0
- package/lib/src/workouts/page/index.js +1 -0
- package/lib/src/workouts/page/service.d.ts +64 -0
- package/lib/src/workouts/page/service.js +518 -0
- package/lib/src/workouts/page/service.unit.test.d.ts +1 -0
- package/lib/src/workouts/page/service.unit.test.js +717 -0
- package/lib/src/workouts/page/types.d.ts +99 -0
- package/lib/src/workouts/page/types.js +1 -0
- package/lib/src/workouts/ride/index.d.ts +2 -0
- package/lib/src/workouts/ride/index.js +2 -0
- package/lib/src/workouts/ride/service.d.ts +90 -0
- package/lib/src/workouts/ride/service.js +794 -0
- package/lib/src/workouts/ride/service.unit.test.d.ts +1 -0
- package/lib/src/workouts/ride/service.unit.test.js +1663 -0
- package/lib/src/workouts/ride/types.d.ts +45 -0
- package/lib/src/workouts/ride/types.js +1 -0
- package/lib/src/workouts/types.d.ts +7 -0
- package/lib/src/workouts/types.js +1 -0
- package/lib/types/devices/page/base/guidance/guidance.d.ts +116 -0
- package/lib/types/devices/page/base/guidance/index.d.ts +2 -0
- package/lib/types/devices/page/base/guidance/types.d.ts +47 -0
- package/lib/types/devices/pairing/helper.d.ts +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,877 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { getBindings } from "../../api/bindings";
|
|
36
|
+
import { Injectable, Singleton } from "../../base/decorators";
|
|
37
|
+
import { IncyclistService } from "../../base/service";
|
|
38
|
+
import { canonicalPath, isRemoteUrl } from "../../fileaccess/utils";
|
|
39
|
+
import { useFolderAccess } from "../../fileaccess/service";
|
|
40
|
+
import { useOnlineStatusMonitoring } from "../../monitoring";
|
|
41
|
+
import { getNextVideoId } from "../base/utils/route";
|
|
42
|
+
import { useRouteList } from "../list/service";
|
|
43
|
+
import { VideoDownloadJournal } from "./journal";
|
|
44
|
+
const AVAILABILITY_TTL_MS = 60_000;
|
|
45
|
+
const QUEUE_CONCURRENCY = 2;
|
|
46
|
+
const QUERY_TIMEOUT_MS = 4_000;
|
|
47
|
+
const POLL_INTERVAL_MS = 3_000;
|
|
48
|
+
const RIDE_LEFT_SETTLE_DELAY_MS = 2_000;
|
|
49
|
+
const STORAGE_MARGIN_BYTES = 500 * 1024 * 1024;
|
|
50
|
+
const MAX_CHAIN_LENGTH = 20;
|
|
51
|
+
const STATE_ORDER = [
|
|
52
|
+
'not-found', 'access-lost', 'not-enough-storage', 'download-failed', 'waiting-for-network',
|
|
53
|
+
'downloading', 'downloading-external', 'cancelled', 'not-downloaded', 'checking', 'ready', 'unknown'
|
|
54
|
+
];
|
|
55
|
+
const NOT_DOWNLOADED_STATES = new Set([
|
|
56
|
+
'not-downloaded', 'not-enough-storage', 'download-failed', 'cancelled'
|
|
57
|
+
]);
|
|
58
|
+
const OUT_OF_SPACE = [
|
|
59
|
+
{ domain: 'NSCocoaErrorDomain', code: 640 },
|
|
60
|
+
{ domain: 'NSPOSIXErrorDomain', code: 28 }
|
|
61
|
+
];
|
|
62
|
+
const DEVICE = 'device';
|
|
63
|
+
const START_REASONS = {
|
|
64
|
+
'not-downloaded': `This route's video isn't downloaded to this ${DEVICE} yet. Open the route under Routes to download it.`,
|
|
65
|
+
'cancelled': `This route's video isn't downloaded to this ${DEVICE} yet. Open the route under Routes to download it.`,
|
|
66
|
+
'download-failed': `This route's video isn't downloaded to this ${DEVICE} yet. Open the route under Routes to download it.`,
|
|
67
|
+
'downloading': `This route's video is still downloading from iCloud. Try again once it has finished — you can check under Routes.`,
|
|
68
|
+
'downloading-external': `This route's video is still downloading from iCloud. Try again once it has finished — you can check under Routes.`,
|
|
69
|
+
'waiting-for-network': `This route's video is waiting for an internet connection to finish downloading.`,
|
|
70
|
+
'not-enough-storage': `This route's video isn't downloaded, and there isn't enough free space on this ${DEVICE} for it.`,
|
|
71
|
+
'access-lost': 'Incyclist needs your OK to use the folder with this video. Open the route under Routes and tap Confirm Access.',
|
|
72
|
+
'not-found': `The video file can't be found. It may have been moved, renamed or deleted.`
|
|
73
|
+
};
|
|
74
|
+
const REASON_ICLOUD_UNAVAILABLE = `iCloud Drive isn't available. Check in the Settings app that you're signed in to iCloud.`;
|
|
75
|
+
const REASON_FALLBACK = 'Could not load video.';
|
|
76
|
+
let RouteVideoAvailabilityService = (() => {
|
|
77
|
+
let _classDecorators = [Singleton];
|
|
78
|
+
let _classDescriptor;
|
|
79
|
+
let _classExtraInitializers = [];
|
|
80
|
+
let _classThis;
|
|
81
|
+
let _classSuper = IncyclistService;
|
|
82
|
+
let _instanceExtraInitializers = [];
|
|
83
|
+
let _getBindings_decorators;
|
|
84
|
+
let _getFolderAccess_decorators;
|
|
85
|
+
let _getRouteList_decorators;
|
|
86
|
+
let _getOnlineStatus_decorators;
|
|
87
|
+
var RouteVideoAvailabilityService = class extends _classSuper {
|
|
88
|
+
static { _classThis = this; }
|
|
89
|
+
static {
|
|
90
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
91
|
+
_getBindings_decorators = [Injectable];
|
|
92
|
+
_getFolderAccess_decorators = [Injectable];
|
|
93
|
+
_getRouteList_decorators = [Injectable];
|
|
94
|
+
_getOnlineStatus_decorators = [Injectable];
|
|
95
|
+
__esDecorate(this, null, _getBindings_decorators, { kind: "method", name: "getBindings", static: false, private: false, access: { has: obj => "getBindings" in obj, get: obj => obj.getBindings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
96
|
+
__esDecorate(this, null, _getFolderAccess_decorators, { kind: "method", name: "getFolderAccess", static: false, private: false, access: { has: obj => "getFolderAccess" in obj, get: obj => obj.getFolderAccess }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
97
|
+
__esDecorate(this, null, _getRouteList_decorators, { kind: "method", name: "getRouteList", static: false, private: false, access: { has: obj => "getRouteList" in obj, get: obj => obj.getRouteList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
98
|
+
__esDecorate(this, null, _getOnlineStatus_decorators, { kind: "method", name: "getOnlineStatus", static: false, private: false, access: { has: obj => "getOnlineStatus" in obj, get: obj => obj.getOnlineStatus }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
99
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
100
|
+
RouteVideoAvailabilityService = _classThis = _classDescriptor.value;
|
|
101
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
102
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
103
|
+
}
|
|
104
|
+
journal = (__runInitializers(this, _instanceExtraInitializers), new VideoDownloadJournal());
|
|
105
|
+
files = {};
|
|
106
|
+
sessionChoices = {};
|
|
107
|
+
rows = {};
|
|
108
|
+
activeRidePaths = [];
|
|
109
|
+
rideRouteIds = [];
|
|
110
|
+
queue = [];
|
|
111
|
+
queued = new Set();
|
|
112
|
+
inFlight = 0;
|
|
113
|
+
queryDurations = [];
|
|
114
|
+
pollTimer;
|
|
115
|
+
journalStarted = false;
|
|
116
|
+
disposed = false;
|
|
117
|
+
constructor() {
|
|
118
|
+
super('RouteVideoAvailability');
|
|
119
|
+
this.journal.on('changed', () => this.onJournalChanged());
|
|
120
|
+
}
|
|
121
|
+
isSupported() {
|
|
122
|
+
try {
|
|
123
|
+
return !!this.getFileAccess()?.isSupported();
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
getStatus(routeId) {
|
|
130
|
+
if (!this.isSupported())
|
|
131
|
+
return this.emptyStatus(routeId);
|
|
132
|
+
this.startJournal();
|
|
133
|
+
const files = this.getVideoFiles(routeId);
|
|
134
|
+
if (!files.length)
|
|
135
|
+
return this.emptyStatus(routeId);
|
|
136
|
+
return this.aggregate(routeId, files.map(file => this.getFileState(file)));
|
|
137
|
+
}
|
|
138
|
+
async refresh(routeId) {
|
|
139
|
+
if (!this.isSupported())
|
|
140
|
+
return this.emptyStatus(routeId);
|
|
141
|
+
await this.journal.init();
|
|
142
|
+
const files = this.getVideoFiles(routeId);
|
|
143
|
+
if (!files.length)
|
|
144
|
+
return this.emptyStatus(routeId);
|
|
145
|
+
for (const file of files) {
|
|
146
|
+
if (file.isExternal)
|
|
147
|
+
await this.query(file.path, { force: true, probeAccess: true });
|
|
148
|
+
}
|
|
149
|
+
await this.reconcile(files.map(file => file.path));
|
|
150
|
+
const status = this.aggregate(routeId, files.map(file => this.getFileState(file)));
|
|
151
|
+
this.emitRouteUpdate(routeId);
|
|
152
|
+
return status;
|
|
153
|
+
}
|
|
154
|
+
getListPill(routeId) {
|
|
155
|
+
if (!this.isSupported())
|
|
156
|
+
return undefined;
|
|
157
|
+
this.startJournal();
|
|
158
|
+
const path = this.getOwnVideoPath(routeId);
|
|
159
|
+
if (!path)
|
|
160
|
+
return undefined;
|
|
161
|
+
const entry = this.journal.getEntry(path);
|
|
162
|
+
if (entry?.status === 'downloading' || entry?.status === 'stopping')
|
|
163
|
+
return 'downloading';
|
|
164
|
+
if (entry)
|
|
165
|
+
return undefined;
|
|
166
|
+
const external = this.isExternal(path);
|
|
167
|
+
const covered = this.getFolderAccess().isCovered(path);
|
|
168
|
+
if (!external || !covered)
|
|
169
|
+
return undefined;
|
|
170
|
+
const cached = this.getFresh(path);
|
|
171
|
+
if (!cached) {
|
|
172
|
+
this.enqueue(path, routeId);
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
if (cached.indeterminate || !cached.availability)
|
|
176
|
+
return undefined;
|
|
177
|
+
if (cached.availability.isDownloading)
|
|
178
|
+
return 'downloading';
|
|
179
|
+
return this.isNotDownloaded(cached.availability) ? 'in-icloud' : undefined;
|
|
180
|
+
}
|
|
181
|
+
needsConfirmation(routeId) {
|
|
182
|
+
if (!this.isSupported())
|
|
183
|
+
return false;
|
|
184
|
+
return !this.sessionChoices[routeId];
|
|
185
|
+
}
|
|
186
|
+
async download(routeId, choice) {
|
|
187
|
+
if (!this.isSupported())
|
|
188
|
+
return;
|
|
189
|
+
await this.journal.init();
|
|
190
|
+
this.sessionChoices[routeId] = choice;
|
|
191
|
+
for (const file of this.getVideoFiles(routeId)) {
|
|
192
|
+
if (file.isExternal)
|
|
193
|
+
await this.startFile(file, choice);
|
|
194
|
+
}
|
|
195
|
+
this.ensurePolling();
|
|
196
|
+
this.emitRouteUpdate(routeId);
|
|
197
|
+
this.emitRowsUpdate();
|
|
198
|
+
}
|
|
199
|
+
async stop(routeId) {
|
|
200
|
+
if (!this.isSupported())
|
|
201
|
+
return;
|
|
202
|
+
await this.journal.init();
|
|
203
|
+
for (const entry of this.journal.getForRoute(routeId)) {
|
|
204
|
+
if (entry.status !== 'downloading')
|
|
205
|
+
continue;
|
|
206
|
+
await this.journal.markStopping(entry.path);
|
|
207
|
+
delete this.rows[entry.path];
|
|
208
|
+
await this.tryEvict(entry.path);
|
|
209
|
+
}
|
|
210
|
+
this.ensurePolling();
|
|
211
|
+
this.emitRouteUpdate(routeId);
|
|
212
|
+
this.emitRowsUpdate();
|
|
213
|
+
}
|
|
214
|
+
async retry(routeId) {
|
|
215
|
+
if (!this.isSupported())
|
|
216
|
+
return;
|
|
217
|
+
await this.journal.init();
|
|
218
|
+
const remembered = this.sessionChoices[routeId]
|
|
219
|
+
?? this.journal.getForRoute(routeId)[0]?.choice
|
|
220
|
+
?? 'keep';
|
|
221
|
+
await this.download(routeId, remembered);
|
|
222
|
+
}
|
|
223
|
+
async setChoice(routeId, choice) {
|
|
224
|
+
if (!this.isSupported())
|
|
225
|
+
return;
|
|
226
|
+
await this.journal.init();
|
|
227
|
+
this.sessionChoices[routeId] = choice;
|
|
228
|
+
for (const entry of this.journal.getForRoute(routeId)) {
|
|
229
|
+
await this.journal.setChoice(entry.path, choice);
|
|
230
|
+
const row = this.rows[entry.path];
|
|
231
|
+
if (row)
|
|
232
|
+
row.choice = choice;
|
|
233
|
+
}
|
|
234
|
+
this.emitRouteUpdate(routeId);
|
|
235
|
+
this.emitRowsUpdate();
|
|
236
|
+
}
|
|
237
|
+
async remove(routeId) {
|
|
238
|
+
if (!this.isSupported())
|
|
239
|
+
return 'failed';
|
|
240
|
+
await this.journal.init();
|
|
241
|
+
const files = this.getVideoFiles(routeId).filter(f => f.isExternal);
|
|
242
|
+
if (!files.length)
|
|
243
|
+
return 'failed';
|
|
244
|
+
if (files.some(f => this.isActiveInRide(f.path)))
|
|
245
|
+
return 'in-use';
|
|
246
|
+
let removed = false;
|
|
247
|
+
for (const file of files) {
|
|
248
|
+
const ok = await this.evict(file.path);
|
|
249
|
+
if (!ok)
|
|
250
|
+
return 'failed';
|
|
251
|
+
removed = true;
|
|
252
|
+
await this.journal.discard(file.path);
|
|
253
|
+
delete this.rows[file.path];
|
|
254
|
+
await this.query(file.path, { force: true });
|
|
255
|
+
}
|
|
256
|
+
delete this.sessionChoices[routeId];
|
|
257
|
+
this.logEvent({ message: 'icloud video removed', routeId, files: files.length });
|
|
258
|
+
this.emitRouteUpdate(routeId);
|
|
259
|
+
this.emitRowsUpdate();
|
|
260
|
+
return removed ? 'removed' : 'failed';
|
|
261
|
+
}
|
|
262
|
+
getDownloadRows() {
|
|
263
|
+
if (!this.isSupported())
|
|
264
|
+
return [];
|
|
265
|
+
return Object.values(this.rows).sort((a, b) => (a.startedAt ?? 0) - (b.startedAt ?? 0));
|
|
266
|
+
}
|
|
267
|
+
getStartOverlayReason(routeId, opts) {
|
|
268
|
+
if (!this.isSupported())
|
|
269
|
+
return undefined;
|
|
270
|
+
const status = this.getStatus(routeId);
|
|
271
|
+
if (status.state === 'ready' || status.state === 'unknown')
|
|
272
|
+
return undefined;
|
|
273
|
+
return this.buildReason(status.state, status.transient, opts?.segment ?? status.affectedSegment);
|
|
274
|
+
}
|
|
275
|
+
invalidate() {
|
|
276
|
+
this.files = {};
|
|
277
|
+
}
|
|
278
|
+
async settle() {
|
|
279
|
+
if (!this.isSupported())
|
|
280
|
+
return;
|
|
281
|
+
await this.journal.init();
|
|
282
|
+
for (const entry of this.journal.getCleanupDue()) {
|
|
283
|
+
if (this.isActiveInRide(entry.path))
|
|
284
|
+
continue;
|
|
285
|
+
if (entry.status === 'stopping') {
|
|
286
|
+
const availability = await this.query(entry.path, { force: true });
|
|
287
|
+
if (availability?.isDownloading)
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
await this.tryEvict(entry.path);
|
|
291
|
+
}
|
|
292
|
+
this.emitRowsUpdate();
|
|
293
|
+
}
|
|
294
|
+
reset() {
|
|
295
|
+
super.reset();
|
|
296
|
+
this.disposed = true;
|
|
297
|
+
this.stopPolling();
|
|
298
|
+
this.journal.reset();
|
|
299
|
+
this.journal = new VideoDownloadJournal();
|
|
300
|
+
this.journal.on('changed', () => this.onJournalChanged());
|
|
301
|
+
this.files = {};
|
|
302
|
+
this.sessionChoices = {};
|
|
303
|
+
this.rows = {};
|
|
304
|
+
this.activeRidePaths = [];
|
|
305
|
+
this.rideRouteIds = [];
|
|
306
|
+
this.queue = [];
|
|
307
|
+
this.queued = new Set();
|
|
308
|
+
this.inFlight = 0;
|
|
309
|
+
this.queryDurations = [];
|
|
310
|
+
this.journalStarted = false;
|
|
311
|
+
}
|
|
312
|
+
async getPlayability(path) {
|
|
313
|
+
if (!this.isSupported())
|
|
314
|
+
return { playable: true, state: 'unknown' };
|
|
315
|
+
this.startJournal();
|
|
316
|
+
const state = this.getFileState(this.describeFile({ path, routeId: '' })).state;
|
|
317
|
+
return { playable: state === 'ready' || state === 'unknown', state };
|
|
318
|
+
}
|
|
319
|
+
onRideStarted(routeIds, activePaths) {
|
|
320
|
+
if (!this.isSupported())
|
|
321
|
+
return;
|
|
322
|
+
this.rideRouteIds = routeIds;
|
|
323
|
+
this.setActiveRidePaths(activePaths);
|
|
324
|
+
this.logEvent({ message: 'ride visit started', routeIds });
|
|
325
|
+
}
|
|
326
|
+
setActiveRidePaths(paths) {
|
|
327
|
+
if (!this.isSupported())
|
|
328
|
+
return;
|
|
329
|
+
this.activeRidePaths = paths;
|
|
330
|
+
}
|
|
331
|
+
async onRideLeft() {
|
|
332
|
+
if (!this.isSupported())
|
|
333
|
+
return;
|
|
334
|
+
await this.journal.init();
|
|
335
|
+
const dueAt = Date.now();
|
|
336
|
+
const routeIds = this.rideRouteIds;
|
|
337
|
+
for (const entry of this.journal.getAll()) {
|
|
338
|
+
if (entry.status !== 'awaiting-ride' || !routeIds.includes(entry.routeId))
|
|
339
|
+
continue;
|
|
340
|
+
await this.journal.markRemovalDue(entry.path, dueAt);
|
|
341
|
+
}
|
|
342
|
+
this.logEvent({ message: 'ride visit left', routeIds });
|
|
343
|
+
this.scheduleRideLeftSettle();
|
|
344
|
+
}
|
|
345
|
+
getRideRemovalNotice(routeIds) {
|
|
346
|
+
if (!this.isSupported())
|
|
347
|
+
return undefined;
|
|
348
|
+
let pending = false;
|
|
349
|
+
let kept = false;
|
|
350
|
+
for (const routeId of routeIds) {
|
|
351
|
+
for (const entry of this.journal.getForRoute(routeId)) {
|
|
352
|
+
if (entry.choice === 'this-ride')
|
|
353
|
+
pending = true;
|
|
354
|
+
if (entry.choice === 'keep')
|
|
355
|
+
kept = true;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return pending || kept ? { pending, kept } : undefined;
|
|
359
|
+
}
|
|
360
|
+
async onForeground() {
|
|
361
|
+
if (!this.isSupported())
|
|
362
|
+
return;
|
|
363
|
+
this.invalidate();
|
|
364
|
+
await this.reconcile();
|
|
365
|
+
await this.settle();
|
|
366
|
+
}
|
|
367
|
+
scheduleRideLeftSettle() {
|
|
368
|
+
if (this.disposed)
|
|
369
|
+
return;
|
|
370
|
+
const timer = setTimeout(() => {
|
|
371
|
+
if (this.disposed)
|
|
372
|
+
return;
|
|
373
|
+
this.settle().catch(err => this.logError(err, 'onRideLeftSettle'));
|
|
374
|
+
}, RIDE_LEFT_SETTLE_DELAY_MS);
|
|
375
|
+
timer?.unref?.();
|
|
376
|
+
}
|
|
377
|
+
async reconcile(paths) {
|
|
378
|
+
await this.journal.init();
|
|
379
|
+
const entries = this.journal.getAll().filter(entry => !paths || paths.includes(entry.path));
|
|
380
|
+
for (const entry of entries)
|
|
381
|
+
await this.reconcileEntry(entry);
|
|
382
|
+
}
|
|
383
|
+
async reconcileEntry(entry) {
|
|
384
|
+
const availability = await this.query(entry.path, { force: true });
|
|
385
|
+
if (!availability)
|
|
386
|
+
return;
|
|
387
|
+
if (!this.isNotDownloaded(availability) || availability.isDownloading || availability.downloadError)
|
|
388
|
+
return;
|
|
389
|
+
await this.journal.discard(entry.path);
|
|
390
|
+
delete this.rows[entry.path];
|
|
391
|
+
delete this.sessionChoices[entry.routeId];
|
|
392
|
+
this.logEvent({ message: 'icloud download reconciled', routeId: entry.routeId, reason: 'no-longer-local' });
|
|
393
|
+
this.emitRouteUpdate(entry.routeId);
|
|
394
|
+
}
|
|
395
|
+
getFileState(file) {
|
|
396
|
+
const base = { file, state: 'unknown' };
|
|
397
|
+
if (!file.isExternal)
|
|
398
|
+
return { ...base, state: 'ready' };
|
|
399
|
+
const cached = this.files[file.path];
|
|
400
|
+
const entry = this.journal.getEntry(file.path);
|
|
401
|
+
const overridden = this.getCachedOverrideState(base, cached, entry);
|
|
402
|
+
if (overridden)
|
|
403
|
+
return overridden;
|
|
404
|
+
const availability = cached?.availability;
|
|
405
|
+
const failure = availability?.downloadError ? this.mapDownloadError(availability.downloadError) : undefined;
|
|
406
|
+
const sizeBytes = this.getSize(availability);
|
|
407
|
+
const freeBytes = availability?.volumeFreeBytes;
|
|
408
|
+
const journalDriven = this.getJournalDrivenState(base, entry, failure, sizeBytes, freeBytes);
|
|
409
|
+
if (journalDriven)
|
|
410
|
+
return journalDriven;
|
|
411
|
+
if (!availability)
|
|
412
|
+
return { ...base, state: cached?.indeterminate ? 'unknown' : 'checking' };
|
|
413
|
+
return this.getAvailabilityDrivenState(base, availability, entry, failure, sizeBytes, freeBytes);
|
|
414
|
+
}
|
|
415
|
+
getCachedOverrideState(base, cached, entry) {
|
|
416
|
+
if (cached?.accessState === 'not-found')
|
|
417
|
+
return { ...base, state: 'not-found' };
|
|
418
|
+
if (cached?.accessState === 'access-lost')
|
|
419
|
+
return { ...base, state: 'access-lost', transient: cached.transient };
|
|
420
|
+
if (cached?.failed)
|
|
421
|
+
return { ...base, state: cached.failed, choice: entry?.choice };
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
424
|
+
getJournalDrivenState(base, entry, failure, sizeBytes, freeBytes) {
|
|
425
|
+
if (entry?.status === 'downloading') {
|
|
426
|
+
if (failure)
|
|
427
|
+
return { ...base, state: failure, choice: entry.choice, sizeBytes, freeBytes };
|
|
428
|
+
const state = this.isOffline() ? 'waiting-for-network' : 'downloading';
|
|
429
|
+
return { ...base, state, choice: entry.choice, sizeBytes, freeBytes, startedAt: entry.startedAt };
|
|
430
|
+
}
|
|
431
|
+
if (entry?.status === 'stopping')
|
|
432
|
+
return { ...base, state: 'cancelled', choice: entry.choice, sizeBytes, freeBytes };
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
getAvailabilityDrivenState(base, availability, entry, failure, sizeBytes, freeBytes) {
|
|
436
|
+
if (!this.isNotDownloaded(availability)) {
|
|
437
|
+
const thisRide = entry?.choice === 'this-ride'
|
|
438
|
+
&& (entry.status === 'awaiting-ride' || entry.status === 'removal-due');
|
|
439
|
+
return { ...base, state: 'ready', choice: thisRide ? 'this-ride' : entry?.choice, sizeBytes, freeBytes };
|
|
440
|
+
}
|
|
441
|
+
if (failure)
|
|
442
|
+
return { ...base, state: failure, sizeBytes, freeBytes };
|
|
443
|
+
if (availability.isDownloading)
|
|
444
|
+
return { ...base, state: 'downloading-external', sizeBytes, freeBytes };
|
|
445
|
+
if (!this.hasRoomFor(sizeBytes, freeBytes))
|
|
446
|
+
return { ...base, state: 'not-enough-storage', sizeBytes, freeBytes };
|
|
447
|
+
return { ...base, state: 'not-downloaded', sizeBytes, freeBytes };
|
|
448
|
+
}
|
|
449
|
+
aggregate(routeId, states) {
|
|
450
|
+
const worst = [...states].sort((a, b) => this.rank(a) - this.rank(b))[0];
|
|
451
|
+
const pending = states.filter(s => NOT_DOWNLOADED_STATES.has(s.state));
|
|
452
|
+
const pendingSize = pending.reduce((sum, s) => (s.sizeBytes === undefined ? sum : (sum ?? 0) + s.sizeBytes), undefined);
|
|
453
|
+
const sizeBytes = pending.length ? pendingSize : worst.sizeBytes;
|
|
454
|
+
const freeBytes = states.map(s => s.freeBytes).find(v => v !== undefined);
|
|
455
|
+
const startedAt = states.map(s => s.startedAt).filter((v) => v !== undefined).sort((a, b) => a - b)[0];
|
|
456
|
+
const status = {
|
|
457
|
+
routeId,
|
|
458
|
+
state: worst.state,
|
|
459
|
+
isICloud: states.some(s => s.file.isICloud),
|
|
460
|
+
fileCount: states.length,
|
|
461
|
+
notDownloadedCount: pending.length,
|
|
462
|
+
confirmedThisSession: !!this.sessionChoices[routeId],
|
|
463
|
+
sizeBytes,
|
|
464
|
+
freeBytes,
|
|
465
|
+
requiredBytes: sizeBytes === undefined ? undefined : sizeBytes + STORAGE_MARGIN_BYTES,
|
|
466
|
+
startedAt,
|
|
467
|
+
transient: worst.transient,
|
|
468
|
+
choice: worst.choice ?? this.sessionChoices[routeId],
|
|
469
|
+
thisRide: worst.state === 'ready' && worst.choice === 'this-ride' ? true : undefined
|
|
470
|
+
};
|
|
471
|
+
if (states.length > 1)
|
|
472
|
+
status.affectedSegment = worst.file.segment;
|
|
473
|
+
return status;
|
|
474
|
+
}
|
|
475
|
+
rank(state) {
|
|
476
|
+
const base = STATE_ORDER.indexOf(state.state) * 2;
|
|
477
|
+
if (state.state === 'access-lost')
|
|
478
|
+
return base + (state.transient ? 0 : 1);
|
|
479
|
+
if (state.state === 'ready')
|
|
480
|
+
return base + (state.choice === 'this-ride' ? 0 : 1);
|
|
481
|
+
return base;
|
|
482
|
+
}
|
|
483
|
+
emptyStatus(routeId) {
|
|
484
|
+
return {
|
|
485
|
+
routeId, state: 'unknown', isICloud: false,
|
|
486
|
+
fileCount: 0, notDownloadedCount: 0, confirmedThisSession: false
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
async startFile(file, choice) {
|
|
490
|
+
const availability = await this.query(file.path, { force: true, probeAccess: true });
|
|
491
|
+
if (!availability)
|
|
492
|
+
return;
|
|
493
|
+
if (!this.isNotDownloaded(availability))
|
|
494
|
+
return;
|
|
495
|
+
const sizeBytes = this.getSize(availability);
|
|
496
|
+
if (!this.hasRoomFor(sizeBytes, availability.volumeFreeBytes)) {
|
|
497
|
+
this.logEvent({
|
|
498
|
+
message: 'icloud download refused', routeId: file.routeId, reason: 'not-enough-storage',
|
|
499
|
+
sizeBytes, freeBytes: availability.volumeFreeBytes
|
|
500
|
+
});
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (availability.isDownloading) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
const eligible = !this.journal.getEntry(file.path)
|
|
507
|
+
|| this.journal.getEntry(file.path)?.status === 'stopping';
|
|
508
|
+
let effectiveChoice = choice;
|
|
509
|
+
if (eligible) {
|
|
510
|
+
const written = await this.journal.begin(file.path, file.routeId, choice);
|
|
511
|
+
if (!written)
|
|
512
|
+
effectiveChoice = 'keep';
|
|
513
|
+
}
|
|
514
|
+
try {
|
|
515
|
+
await this.getFileAccess()?.startDownload(file.path);
|
|
516
|
+
}
|
|
517
|
+
catch (err) {
|
|
518
|
+
await this.journal.discard(file.path);
|
|
519
|
+
this.files[file.path] = { checkedAt: Date.now(), failed: 'download-failed' };
|
|
520
|
+
this.logError(err, 'startDownload', { routeId: file.routeId });
|
|
521
|
+
this.setRow(file, 'download-failed', effectiveChoice, availability);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
this.logEvent({
|
|
525
|
+
message: 'icloud download started', routeId: file.routeId,
|
|
526
|
+
choice: effectiveChoice, sizeBytes, journalled: eligible
|
|
527
|
+
});
|
|
528
|
+
this.setRow(file, this.isOffline() ? 'waiting-for-network' : 'downloading', effectiveChoice, availability);
|
|
529
|
+
}
|
|
530
|
+
async pollOnce() {
|
|
531
|
+
if (!this.isSupported())
|
|
532
|
+
return;
|
|
533
|
+
await this.journal.init();
|
|
534
|
+
const running = this.journal.getAll().filter(e => e.status === 'downloading');
|
|
535
|
+
const touched = new Set();
|
|
536
|
+
for (const entry of running) {
|
|
537
|
+
const availability = await this.query(entry.path, { force: true });
|
|
538
|
+
if (!availability)
|
|
539
|
+
continue;
|
|
540
|
+
touched.add(entry.routeId);
|
|
541
|
+
await this.onDownloadProgress(entry, availability);
|
|
542
|
+
}
|
|
543
|
+
await this.settle();
|
|
544
|
+
for (const routeId of touched)
|
|
545
|
+
this.emitRouteUpdate(routeId);
|
|
546
|
+
this.emitRowsUpdate();
|
|
547
|
+
if (!this.hasActiveWork())
|
|
548
|
+
this.stopPolling();
|
|
549
|
+
}
|
|
550
|
+
async onDownloadProgress(entry, availability) {
|
|
551
|
+
const file = this.describeFile(entry);
|
|
552
|
+
if (!this.isNotDownloaded(availability)) {
|
|
553
|
+
if (entry.choice === 'this-ride')
|
|
554
|
+
await this.journal.markAwaitingRide(entry.path);
|
|
555
|
+
else
|
|
556
|
+
await this.journal.discard(entry.path);
|
|
557
|
+
this.logEvent({ message: 'icloud download finished', routeId: entry.routeId, choice: entry.choice });
|
|
558
|
+
this.setRow(file, 'ready', entry.choice, availability);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (availability.downloadError) {
|
|
562
|
+
const state = this.mapDownloadError(availability.downloadError);
|
|
563
|
+
await this.journal.discard(entry.path);
|
|
564
|
+
this.logEvent({
|
|
565
|
+
message: 'icloud download failed', routeId: entry.routeId, state,
|
|
566
|
+
domain: availability.downloadError.domain, code: availability.downloadError.code
|
|
567
|
+
});
|
|
568
|
+
this.setRow(file, state, entry.choice, availability);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
this.setRow(file, this.isOffline() ? 'waiting-for-network' : 'downloading', entry.choice, availability, entry.startedAt);
|
|
572
|
+
}
|
|
573
|
+
hasActiveWork() {
|
|
574
|
+
return this.journal.getAll().some(e => e.status === 'downloading')
|
|
575
|
+
|| this.journal.getAll().some(e => e.status === 'stopping' || e.status === 'removal-due');
|
|
576
|
+
}
|
|
577
|
+
ensurePolling() {
|
|
578
|
+
if (this.disposed || this.pollTimer || !this.hasActiveWork())
|
|
579
|
+
return;
|
|
580
|
+
this.pollTimer = setInterval(() => {
|
|
581
|
+
this.pollOnce().catch(err => this.logError(err, 'pollOnce'));
|
|
582
|
+
}, POLL_INTERVAL_MS);
|
|
583
|
+
}
|
|
584
|
+
stopPolling() {
|
|
585
|
+
if (!this.pollTimer)
|
|
586
|
+
return;
|
|
587
|
+
clearInterval(this.pollTimer);
|
|
588
|
+
this.pollTimer = undefined;
|
|
589
|
+
}
|
|
590
|
+
async tryEvict(path) {
|
|
591
|
+
if (this.isActiveInRide(path))
|
|
592
|
+
return;
|
|
593
|
+
const evicted = await this.evict(path);
|
|
594
|
+
if (!evicted) {
|
|
595
|
+
await this.journal.recordEvictAttempt(path);
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
const availability = await this.query(path, { force: true });
|
|
599
|
+
if (availability && !this.isNotDownloaded(availability)) {
|
|
600
|
+
await this.journal.recordEvictAttempt(path);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
const entry = this.journal.getEntry(path);
|
|
604
|
+
await this.journal.discard(path);
|
|
605
|
+
delete this.rows[path];
|
|
606
|
+
if (entry) {
|
|
607
|
+
this.logEvent({ message: 'icloud video evicted', routeId: entry.routeId, status: entry.status });
|
|
608
|
+
delete this.sessionChoices[entry.routeId];
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
async evict(path) {
|
|
612
|
+
try {
|
|
613
|
+
await this.getFileAccess()?.evict(path);
|
|
614
|
+
return true;
|
|
615
|
+
}
|
|
616
|
+
catch (err) {
|
|
617
|
+
this.logError(err, 'evict');
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
isActiveInRide(path) {
|
|
622
|
+
return this.activeRidePaths.includes(path);
|
|
623
|
+
}
|
|
624
|
+
async query(path, opts = {}) {
|
|
625
|
+
if (!opts.force) {
|
|
626
|
+
const fresh = this.getFresh(path);
|
|
627
|
+
if (fresh)
|
|
628
|
+
return fresh.availability;
|
|
629
|
+
}
|
|
630
|
+
const binding = this.getFileAccess();
|
|
631
|
+
if (!binding)
|
|
632
|
+
return undefined;
|
|
633
|
+
if (opts.probeAccess) {
|
|
634
|
+
const access = await this.getFolderAccess().getAccessState(path);
|
|
635
|
+
if (access.state === 'not-found' || access.state === 'access-lost') {
|
|
636
|
+
this.files[path] = {
|
|
637
|
+
checkedAt: Date.now(),
|
|
638
|
+
accessState: access.state,
|
|
639
|
+
transient: access.state === 'access-lost' ? access.transient : undefined
|
|
640
|
+
};
|
|
641
|
+
return undefined;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
const started = Date.now();
|
|
645
|
+
try {
|
|
646
|
+
const availability = await this.withTimeout(binding.getAvailability(path));
|
|
647
|
+
this.files[path] = { checkedAt: Date.now(), accessState: 'readable', availability };
|
|
648
|
+
return availability;
|
|
649
|
+
}
|
|
650
|
+
catch (err) {
|
|
651
|
+
this.files[path] = { checkedAt: Date.now(), indeterminate: true };
|
|
652
|
+
this.logError(err, 'getAvailability');
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
finally {
|
|
656
|
+
this.recordDuration(Date.now() - started);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
async withTimeout(promise) {
|
|
660
|
+
let timer;
|
|
661
|
+
try {
|
|
662
|
+
return await Promise.race([
|
|
663
|
+
promise,
|
|
664
|
+
new Promise((_resolve, reject) => {
|
|
665
|
+
timer = setTimeout(() => reject(new Error('availability query timed out')), QUERY_TIMEOUT_MS);
|
|
666
|
+
timer?.unref?.();
|
|
667
|
+
})
|
|
668
|
+
]);
|
|
669
|
+
}
|
|
670
|
+
finally {
|
|
671
|
+
if (timer)
|
|
672
|
+
clearTimeout(timer);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
getFresh(path) {
|
|
676
|
+
const cached = this.files[path];
|
|
677
|
+
if (!cached)
|
|
678
|
+
return undefined;
|
|
679
|
+
return (Date.now() - cached.checkedAt) < AVAILABILITY_TTL_MS ? cached : undefined;
|
|
680
|
+
}
|
|
681
|
+
enqueue(path, routeId) {
|
|
682
|
+
if (this.queued.has(path))
|
|
683
|
+
return;
|
|
684
|
+
this.queued.add(path);
|
|
685
|
+
this.queue.push({ path, routeId });
|
|
686
|
+
this.pump();
|
|
687
|
+
}
|
|
688
|
+
pump() {
|
|
689
|
+
while (this.inFlight < QUEUE_CONCURRENCY && this.queue.length > 0) {
|
|
690
|
+
const next = this.queue.shift();
|
|
691
|
+
if (!next)
|
|
692
|
+
return;
|
|
693
|
+
this.inFlight++;
|
|
694
|
+
this.query(next.path)
|
|
695
|
+
.then(() => this.emitRouteUpdate(next.routeId))
|
|
696
|
+
.catch(err => this.logError(err, 'queuedQuery'))
|
|
697
|
+
.finally(() => {
|
|
698
|
+
this.inFlight--;
|
|
699
|
+
this.queued.delete(next.path);
|
|
700
|
+
this.pump();
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
recordDuration(ms) {
|
|
705
|
+
this.queryDurations.push(ms);
|
|
706
|
+
if (this.queryDurations.length > 50)
|
|
707
|
+
this.queryDurations.shift();
|
|
708
|
+
}
|
|
709
|
+
startJournal() {
|
|
710
|
+
if (this.journalStarted)
|
|
711
|
+
return;
|
|
712
|
+
this.journalStarted = true;
|
|
713
|
+
this.subscribeToAccessChanges();
|
|
714
|
+
this.journal.init()
|
|
715
|
+
.then(() => this.settle())
|
|
716
|
+
.then(() => {
|
|
717
|
+
this.ensurePolling();
|
|
718
|
+
this.emit('route-video-update');
|
|
719
|
+
this.emitRowsUpdate();
|
|
720
|
+
})
|
|
721
|
+
.catch(err => this.logError(err, 'startJournal'));
|
|
722
|
+
}
|
|
723
|
+
onJournalChanged() {
|
|
724
|
+
this.emitRowsUpdate();
|
|
725
|
+
}
|
|
726
|
+
subscribeToAccessChanges() {
|
|
727
|
+
try {
|
|
728
|
+
this.getFolderAccess()?.on('access-changed', () => {
|
|
729
|
+
this.invalidate();
|
|
730
|
+
this.emit('route-video-update');
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
catch (err) {
|
|
734
|
+
this.logError(err, 'subscribeToAccessChanges');
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
getVideoFiles(routeId) {
|
|
738
|
+
const files = [];
|
|
739
|
+
const seen = new Set();
|
|
740
|
+
let current = routeId;
|
|
741
|
+
while (current && !seen.has(current) && files.length < MAX_CHAIN_LENGTH) {
|
|
742
|
+
seen.add(current);
|
|
743
|
+
const path = this.getOwnVideoPath(current);
|
|
744
|
+
if (path)
|
|
745
|
+
files.push(this.describeFile({ path, routeId: current }, files.length + 1));
|
|
746
|
+
current = this.getNext(current);
|
|
747
|
+
}
|
|
748
|
+
return files;
|
|
749
|
+
}
|
|
750
|
+
describeFile(entry, segment = 1) {
|
|
751
|
+
const location = this.classify(entry.path);
|
|
752
|
+
return {
|
|
753
|
+
path: entry.path,
|
|
754
|
+
routeId: entry.routeId,
|
|
755
|
+
segment,
|
|
756
|
+
isExternal: this.isExternal(entry.path),
|
|
757
|
+
isICloud: location === 'icloud'
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
getOwnVideoPath(routeId) {
|
|
761
|
+
const description = this.getDescription(routeId);
|
|
762
|
+
if (!description)
|
|
763
|
+
return undefined;
|
|
764
|
+
const url = description.videoUrl ?? description.originalVideoUrl;
|
|
765
|
+
if (!url || isRemoteUrl(url))
|
|
766
|
+
return undefined;
|
|
767
|
+
return canonicalPath(url);
|
|
768
|
+
}
|
|
769
|
+
getNext(routeId) {
|
|
770
|
+
try {
|
|
771
|
+
const route = this.getRouteList()?.getCard(routeId)?.getData();
|
|
772
|
+
const next = route ? getNextVideoId(route) : undefined;
|
|
773
|
+
return next ?? this.getDescription(routeId)?.next;
|
|
774
|
+
}
|
|
775
|
+
catch {
|
|
776
|
+
return this.getDescription(routeId)?.next;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
getDescription(routeId) {
|
|
780
|
+
if (!routeId)
|
|
781
|
+
return undefined;
|
|
782
|
+
try {
|
|
783
|
+
const routes = this.getRouteList()?.getAllRoutes() ?? [];
|
|
784
|
+
return routes.map(r => r?.description).find(d => d?.id === routeId);
|
|
785
|
+
}
|
|
786
|
+
catch (err) {
|
|
787
|
+
this.logError(err, 'getDescription');
|
|
788
|
+
return undefined;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
setRow(file, state, choice, availability, startedAt) {
|
|
792
|
+
const sizeBytes = this.getSize(availability);
|
|
793
|
+
this.rows[file.path] = {
|
|
794
|
+
routeId: file.routeId,
|
|
795
|
+
title: this.getDescription(file.routeId)?.title ?? '',
|
|
796
|
+
state, choice, sizeBytes,
|
|
797
|
+
requiredBytes: sizeBytes === undefined ? undefined : sizeBytes + STORAGE_MARGIN_BYTES,
|
|
798
|
+
freeBytes: availability?.volumeFreeBytes,
|
|
799
|
+
startedAt: startedAt ?? this.rows[file.path]?.startedAt ?? Date.now()
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
isNotDownloaded(availability) {
|
|
803
|
+
if (!availability)
|
|
804
|
+
return false;
|
|
805
|
+
if (!availability.isUbiquitous)
|
|
806
|
+
return false;
|
|
807
|
+
return availability.downloadStatus !== 'current' && availability.downloadStatus !== 'downloaded';
|
|
808
|
+
}
|
|
809
|
+
getSize(availability) {
|
|
810
|
+
return availability?.sizeBytes ? availability.sizeBytes : undefined;
|
|
811
|
+
}
|
|
812
|
+
hasRoomFor(sizeBytes, freeBytes) {
|
|
813
|
+
if (sizeBytes === undefined || freeBytes === undefined)
|
|
814
|
+
return true;
|
|
815
|
+
return freeBytes >= sizeBytes + STORAGE_MARGIN_BYTES;
|
|
816
|
+
}
|
|
817
|
+
mapDownloadError(error) {
|
|
818
|
+
const outOfSpace = OUT_OF_SPACE.some(e => e.domain === error.domain && e.code === error.code);
|
|
819
|
+
return outOfSpace ? 'not-enough-storage' : 'download-failed';
|
|
820
|
+
}
|
|
821
|
+
buildReason(state, transient, segment) {
|
|
822
|
+
if (state === 'access-lost' && transient)
|
|
823
|
+
return this.prefixSegment(REASON_ICLOUD_UNAVAILABLE, segment);
|
|
824
|
+
return this.prefixSegment(START_REASONS[state] ?? REASON_FALLBACK, segment);
|
|
825
|
+
}
|
|
826
|
+
prefixSegment(reason, segment) {
|
|
827
|
+
if (!segment || segment < 2)
|
|
828
|
+
return reason;
|
|
829
|
+
return `Part ${segment} of this route: ${reason.replace("This route's video", 'the video')}`;
|
|
830
|
+
}
|
|
831
|
+
isExternal(path) {
|
|
832
|
+
if (!path || isRemoteUrl(path))
|
|
833
|
+
return false;
|
|
834
|
+
return this.classify(path) !== 'app';
|
|
835
|
+
}
|
|
836
|
+
classify(path) {
|
|
837
|
+
try {
|
|
838
|
+
return this.getFileAccess()?.classifyLocation(path) ?? 'other';
|
|
839
|
+
}
|
|
840
|
+
catch {
|
|
841
|
+
return 'other';
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
isOffline() {
|
|
845
|
+
try {
|
|
846
|
+
return this.getOnlineStatus()?.onlineStatus === false;
|
|
847
|
+
}
|
|
848
|
+
catch {
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
emitRouteUpdate(routeId) {
|
|
853
|
+
this.emit('route-video-update', routeId);
|
|
854
|
+
}
|
|
855
|
+
emitRowsUpdate() {
|
|
856
|
+
this.emit('download-rows-update');
|
|
857
|
+
}
|
|
858
|
+
getFileAccess() {
|
|
859
|
+
return this.getBindings()?.fileAccess;
|
|
860
|
+
}
|
|
861
|
+
getBindings() {
|
|
862
|
+
return getBindings();
|
|
863
|
+
}
|
|
864
|
+
getFolderAccess() {
|
|
865
|
+
return useFolderAccess();
|
|
866
|
+
}
|
|
867
|
+
getRouteList() {
|
|
868
|
+
return useRouteList();
|
|
869
|
+
}
|
|
870
|
+
getOnlineStatus() {
|
|
871
|
+
return useOnlineStatusMonitoring();
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
return RouteVideoAvailabilityService = _classThis;
|
|
875
|
+
})();
|
|
876
|
+
export { RouteVideoAvailabilityService };
|
|
877
|
+
export const useRouteVideoAvailability = () => new RouteVideoAvailabilityService();
|