incyclist-services 1.7.66 → 1.7.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/lib/cjs/activities/base/utils/activity.js +13 -1
  2. package/lib/cjs/services/overpass/overpass.js +165 -13
  3. package/lib/esm/activities/base/utils/activity.js +13 -1
  4. package/lib/esm/package.json +1 -1
  5. package/lib/esm/services/overpass/overpass.js +165 -13
  6. package/lib/esm/src/services/overpass/overpass.js +3 -0
  7. package/lib/types/activities/base/utils/activity.d.ts +1 -0
  8. package/lib/types/services/overpass/overpass.d.ts +25 -0
  9. package/package.json +1 -1
  10. package/lib/cjs/api/form/index.js +0 -2
  11. package/lib/cjs/package.json +0 -68
  12. package/lib/cjs/src/activities/active-rides/index.js +0 -18
  13. package/lib/cjs/src/activities/active-rides/mq.js +0 -190
  14. package/lib/cjs/src/activities/active-rides/service.js +0 -874
  15. package/lib/cjs/src/activities/active-rides/sessions.js +0 -0
  16. package/lib/cjs/src/activities/active-rides/types.js +0 -2
  17. package/lib/cjs/src/activities/base/api/active-rides/api.js +0 -121
  18. package/lib/cjs/src/activities/base/api/active-rides/index.js +0 -18
  19. package/lib/cjs/src/activities/base/api/active-rides/types.js +0 -2
  20. package/lib/cjs/src/activities/base/api/fitconvert/consts.js +0 -5
  21. package/lib/cjs/src/activities/base/api/fitconvert/fitconvert.js +0 -97
  22. package/lib/cjs/src/activities/base/api/fitconvert/index.js +0 -17
  23. package/lib/cjs/src/activities/base/api/index.js +0 -17
  24. package/lib/cjs/src/activities/base/convert/converter.js +0 -21
  25. package/lib/cjs/src/activities/base/convert/factory.js +0 -75
  26. package/lib/cjs/src/activities/base/convert/fit/index.js +0 -18
  27. package/lib/cjs/src/activities/base/convert/fit/local-fit.js +0 -240
  28. package/lib/cjs/src/activities/base/convert/fit/remote-fit.js +0 -55
  29. package/lib/cjs/src/activities/base/convert/index.js +0 -20
  30. package/lib/cjs/src/activities/base/convert/tcx/index.js +0 -17
  31. package/lib/cjs/src/activities/base/convert/tcx/tcx.js +0 -210
  32. package/lib/cjs/src/activities/base/convert/tcx/types.js +0 -2
  33. package/lib/cjs/src/activities/base/convert/types.js +0 -9
  34. package/lib/cjs/src/activities/base/index.js +0 -21
  35. package/lib/cjs/src/activities/base/model/index.js +0 -9
  36. package/lib/cjs/src/activities/base/repo/db.js +0 -521
  37. package/lib/cjs/src/activities/base/repo/index.js +0 -18
  38. package/lib/cjs/src/activities/base/repo/migration/factory.js +0 -25
  39. package/lib/cjs/src/activities/base/repo/migration/types.js +0 -17
  40. package/lib/cjs/src/activities/base/repo/migration/v0.js +0 -18
  41. package/lib/cjs/src/activities/base/repo/migration/v1.js +0 -19
  42. package/lib/cjs/src/activities/base/repo/migration/v2.js +0 -11
  43. package/lib/cjs/src/activities/base/repo/migration/v3.js +0 -27
  44. package/lib/cjs/src/activities/base/repo/types.js +0 -2
  45. package/lib/cjs/src/activities/base/utils/activity.js +0 -327
  46. package/lib/cjs/src/activities/base/utils/helpers.js +0 -66
  47. package/lib/cjs/src/activities/base/utils/index.js +0 -18
  48. package/lib/cjs/src/activities/index.js +0 -22
  49. package/lib/cjs/src/activities/list/index.js +0 -18
  50. package/lib/cjs/src/activities/list/service.js +0 -463
  51. package/lib/cjs/src/activities/list/types.js +0 -2
  52. package/lib/cjs/src/activities/list/utils.js +0 -88
  53. package/lib/cjs/src/activities/page/index.js +0 -17
  54. package/lib/cjs/src/activities/page/service.js +0 -177
  55. package/lib/cjs/src/activities/page/types.js +0 -2
  56. package/lib/cjs/src/activities/ride/duration.js +0 -140
  57. package/lib/cjs/src/activities/ride/index.js +0 -17
  58. package/lib/cjs/src/activities/ride/service.js +0 -1331
  59. package/lib/cjs/src/activities/ride/stats.js +0 -197
  60. package/lib/cjs/src/activities/ride/types.js +0 -2
  61. package/lib/cjs/src/activities/types.js +0 -18
  62. package/lib/cjs/src/activities/upload/factory.js +0 -93
  63. package/lib/cjs/src/activities/upload/index.js +0 -21
  64. package/lib/cjs/src/activities/upload/intervals.js +0 -144
  65. package/lib/cjs/src/activities/upload/strava.js +0 -154
  66. package/lib/cjs/src/activities/upload/types.js +0 -2
  67. package/lib/cjs/src/activities/upload/velohero.js +0 -136
  68. package/lib/cjs/src/api/appInfo/index.js +0 -2
  69. package/lib/cjs/src/api/bindings/index.js +0 -78
  70. package/lib/cjs/src/api/bindings/types.js +0 -2
  71. package/lib/cjs/src/api/crypto/types.js +0 -2
  72. package/lib/cjs/src/api/download/index.js +0 -2
  73. package/lib/cjs/src/api/form/types.js +0 -2
  74. package/lib/cjs/src/api/fs/index.js +0 -2
  75. package/lib/cjs/src/api/index.js +0 -20
  76. package/lib/cjs/src/api/logging/types.js +0 -2
  77. package/lib/cjs/src/api/mq/index.js +0 -2
  78. package/lib/cjs/src/api/path/index.js +0 -21
  79. package/lib/cjs/src/api/repository/index.js +0 -21
  80. package/lib/cjs/src/api/repository/json/index.js +0 -121
  81. package/lib/cjs/src/api/repository/types.js +0 -2
  82. package/lib/cjs/src/api/rest/RestApiClient.js +0 -16
  83. package/lib/cjs/src/api/rest/api.js +0 -74
  84. package/lib/cjs/src/api/rest/incyclist.js +0 -37
  85. package/lib/cjs/src/api/rest/index.js +0 -19
  86. package/lib/cjs/src/api/rest/types.js +0 -2
  87. package/lib/cjs/src/api/secret/index.js +0 -2
  88. package/lib/cjs/src/api/serial/types.js +0 -2
  89. package/lib/cjs/src/api/types.js +0 -2
  90. package/lib/cjs/src/api/ui/index.js +0 -2
  91. package/lib/cjs/src/api/video/index.js +0 -2
  92. package/lib/cjs/src/apps/base/api/base.js +0 -62
  93. package/lib/cjs/src/apps/base/api/index.js +0 -20
  94. package/lib/cjs/src/apps/base/api/intervals/api.js +0 -131
  95. package/lib/cjs/src/apps/base/api/intervals/index.js +0 -18
  96. package/lib/cjs/src/apps/base/api/intervals/types.js +0 -15
  97. package/lib/cjs/src/apps/base/api/komoot/api.js +0 -141
  98. package/lib/cjs/src/apps/base/api/komoot/index.js +0 -18
  99. package/lib/cjs/src/apps/base/api/komoot/types.js +0 -2
  100. package/lib/cjs/src/apps/base/api/strava/api.js +0 -221
  101. package/lib/cjs/src/apps/base/api/strava/index.js +0 -18
  102. package/lib/cjs/src/apps/base/api/strava/types.js +0 -11
  103. package/lib/cjs/src/apps/base/api/velohero/api.js +0 -84
  104. package/lib/cjs/src/apps/base/api/velohero/index.js +0 -18
  105. package/lib/cjs/src/apps/base/api/velohero/types.js +0 -2
  106. package/lib/cjs/src/apps/base/app/index.js +0 -107
  107. package/lib/cjs/src/apps/base/index.js +0 -19
  108. package/lib/cjs/src/apps/base/types.js +0 -2
  109. package/lib/cjs/src/apps/googleMaps/index.js +0 -17
  110. package/lib/cjs/src/apps/googleMaps/service.js +0 -125
  111. package/lib/cjs/src/apps/index.js +0 -21
  112. package/lib/cjs/src/apps/intervals/IntervalsAppConnection.js +0 -186
  113. package/lib/cjs/src/apps/intervals/index.js +0 -0
  114. package/lib/cjs/src/apps/intervals/types.js +0 -2
  115. package/lib/cjs/src/apps/komoot/KomootAppConnection.js +0 -248
  116. package/lib/cjs/src/apps/komoot/index.js +0 -18
  117. package/lib/cjs/src/apps/komoot/types.js +0 -2
  118. package/lib/cjs/src/apps/service.js +0 -193
  119. package/lib/cjs/src/apps/strava/StravaAppConnection.js +0 -193
  120. package/lib/cjs/src/apps/strava/index.js +0 -18
  121. package/lib/cjs/src/apps/strava/types.js +0 -2
  122. package/lib/cjs/src/apps/types.js +0 -2
  123. package/lib/cjs/src/apps/velohero/VeloHeroAppConnection.js +0 -232
  124. package/lib/cjs/src/apps/velohero/index.js +0 -18
  125. package/lib/cjs/src/apps/velohero/types.js +0 -2
  126. package/lib/cjs/src/appstate/index.js +0 -18
  127. package/lib/cjs/src/appstate/service.js +0 -111
  128. package/lib/cjs/src/appstate/types.js +0 -2
  129. package/lib/cjs/src/autoupdate/api.js +0 -179
  130. package/lib/cjs/src/autoupdate/autoupdate.js +0 -28
  131. package/lib/cjs/src/autoupdate/index.js +0 -18
  132. package/lib/cjs/src/avatars/index.js +0 -18
  133. package/lib/cjs/src/avatars/service.js +0 -138
  134. package/lib/cjs/src/avatars/types.js +0 -2
  135. package/lib/cjs/src/base/cardlist/index.js +0 -43
  136. package/lib/cjs/src/base/cardlist/types.js +0 -2
  137. package/lib/cjs/src/base/decorators/Injection.js +0 -28
  138. package/lib/cjs/src/base/decorators/index.js +0 -18
  139. package/lib/cjs/src/base/pages/index.js +0 -17
  140. package/lib/cjs/src/base/pages/service.js +0 -127
  141. package/lib/cjs/src/base/pages/types.js +0 -2
  142. package/lib/cjs/src/base/service.js +0 -36
  143. package/lib/cjs/src/base/typedefs.js +0 -2
  144. package/lib/cjs/src/base/types/index.js +0 -19
  145. package/lib/cjs/src/base/types/lists.js +0 -22
  146. package/lib/cjs/src/base/types/observer.js +0 -80
  147. package/lib/cjs/src/base/types/singleton.js +0 -23
  148. package/lib/cjs/src/coaches/coach.js +0 -165
  149. package/lib/cjs/src/coaches/index.js +0 -19
  150. package/lib/cjs/src/coaches/service.js +0 -298
  151. package/lib/cjs/src/coaches/types.js +0 -2
  152. package/lib/cjs/src/devices/access/index.js +0 -18
  153. package/lib/cjs/src/devices/access/model.js +0 -2
  154. package/lib/cjs/src/devices/access/service.js +0 -519
  155. package/lib/cjs/src/devices/configuration/index.js +0 -18
  156. package/lib/cjs/src/devices/configuration/model/app/index.js +0 -2
  157. package/lib/cjs/src/devices/configuration/model/index.js +0 -19
  158. package/lib/cjs/src/devices/configuration/model/repository/index.js +0 -17
  159. package/lib/cjs/src/devices/configuration/model/repository/legacy.js +0 -2
  160. package/lib/cjs/src/devices/configuration/model/service/index.js +0 -2
  161. package/lib/cjs/src/devices/configuration/service.js +0 -1004
  162. package/lib/cjs/src/devices/configuration/types.js +0 -2
  163. package/lib/cjs/src/devices/index.js +0 -21
  164. package/lib/cjs/src/devices/page/index.js +0 -17
  165. package/lib/cjs/src/devices/page/logobserver.js +0 -19
  166. package/lib/cjs/src/devices/page/service.js +0 -426
  167. package/lib/cjs/src/devices/page/statemachine.js +0 -338
  168. package/lib/cjs/src/devices/page/types.js +0 -2
  169. package/lib/cjs/src/devices/pairing/index.js +0 -18
  170. package/lib/cjs/src/devices/pairing/model.js +0 -2
  171. package/lib/cjs/src/devices/pairing/service.js +0 -1509
  172. package/lib/cjs/src/devices/ride/index.js +0 -17
  173. package/lib/cjs/src/devices/ride/service.js +0 -1402
  174. package/lib/cjs/src/devices/ride/types.js +0 -2
  175. package/lib/cjs/src/devices/types.js +0 -2
  176. package/lib/cjs/src/i18n/countries/countries.json +0 -255
  177. package/lib/cjs/src/i18n/countries/index.js +0 -17
  178. package/lib/cjs/src/i18n/countries/model.js +0 -2
  179. package/lib/cjs/src/i18n/countries/service.js +0 -125
  180. package/lib/cjs/src/i18n/index.js +0 -19
  181. package/lib/cjs/src/i18n/localization/index.js +0 -18
  182. package/lib/cjs/src/i18n/localization/service.js +0 -129
  183. package/lib/cjs/src/i18n/localization/types.js +0 -2
  184. package/lib/cjs/src/i18n/units/converter.js +0 -177
  185. package/lib/cjs/src/i18n/units/index.js +0 -18
  186. package/lib/cjs/src/i18n/units/types.js +0 -2
  187. package/lib/cjs/src/index.js +0 -40
  188. package/lib/cjs/src/maps/MapArea/MapArea.js +0 -403
  189. package/lib/cjs/src/maps/MapArea/consts.js +0 -11
  190. package/lib/cjs/src/maps/MapArea/index.js +0 -19
  191. package/lib/cjs/src/maps/MapArea/options.js +0 -417
  192. package/lib/cjs/src/maps/MapArea/service.js +0 -298
  193. package/lib/cjs/src/maps/MapArea/types.js +0 -2
  194. package/lib/cjs/src/maps/MapArea/utils.js +0 -601
  195. package/lib/cjs/src/maps/index.js +0 -17
  196. package/lib/cjs/src/monitoring/index.js +0 -17
  197. package/lib/cjs/src/monitoring/online/index.js +0 -17
  198. package/lib/cjs/src/monitoring/online/service.js +0 -117
  199. package/lib/cjs/src/ride/base/base.js +0 -231
  200. package/lib/cjs/src/ride/base/index.js +0 -17
  201. package/lib/cjs/src/ride/base/types.js +0 -2
  202. package/lib/cjs/src/ride/display/index.js +0 -17
  203. package/lib/cjs/src/ride/display/service.js +0 -1139
  204. package/lib/cjs/src/ride/index.js +0 -19
  205. package/lib/cjs/src/ride/page/index.js +0 -17
  206. package/lib/cjs/src/ride/page/service.js +0 -380
  207. package/lib/cjs/src/ride/page/types.js +0 -2
  208. package/lib/cjs/src/ride/route/FollowRouteDisplayService.js +0 -36
  209. package/lib/cjs/src/ride/route/FreeRideDisplayService.js +0 -602
  210. package/lib/cjs/src/ride/route/GpxDisplayService.js +0 -322
  211. package/lib/cjs/src/ride/route/RLVDisplayService.js +0 -591
  212. package/lib/cjs/src/ride/route/RouteDisplayService.js +0 -419
  213. package/lib/cjs/src/ride/route/types.js +0 -2
  214. package/lib/cjs/src/ride/types.js +0 -2
  215. package/lib/cjs/src/ride/workout/WorkoutDisplayService.js +0 -97
  216. package/lib/cjs/src/routes/base/api/consts.js +0 -12
  217. package/lib/cjs/src/routes/base/api/index.js +0 -158
  218. package/lib/cjs/src/routes/base/api/types.js +0 -2
  219. package/lib/cjs/src/routes/base/model/route.js +0 -120
  220. package/lib/cjs/src/routes/base/model/tacx.js +0 -31
  221. package/lib/cjs/src/routes/base/model/types.js +0 -2
  222. package/lib/cjs/src/routes/base/parsers/bikelab.js +0 -107
  223. package/lib/cjs/src/routes/base/parsers/epm.js +0 -247
  224. package/lib/cjs/src/routes/base/parsers/factory.js +0 -54
  225. package/lib/cjs/src/routes/base/parsers/geometry.js +0 -133
  226. package/lib/cjs/src/routes/base/parsers/gpx.js +0 -220
  227. package/lib/cjs/src/routes/base/parsers/incyclist.js +0 -194
  228. package/lib/cjs/src/routes/base/parsers/index.js +0 -69
  229. package/lib/cjs/src/routes/base/parsers/kwt.js +0 -8
  230. package/lib/cjs/src/routes/base/parsers/multixml.js +0 -46
  231. package/lib/cjs/src/routes/base/parsers/tacx/TacxParser.js +0 -332
  232. package/lib/cjs/src/routes/base/parsers/tacx/TacxReader.js +0 -83
  233. package/lib/cjs/src/routes/base/parsers/tacx/pgmf.js +0 -69
  234. package/lib/cjs/src/routes/base/parsers/tacx/rlv.js +0 -84
  235. package/lib/cjs/src/routes/base/parsers/types.js +0 -2
  236. package/lib/cjs/src/routes/base/parsers/utils.js +0 -245
  237. package/lib/cjs/src/routes/base/parsers/xml.js +0 -358
  238. package/lib/cjs/src/routes/base/types/index.js +0 -3
  239. package/lib/cjs/src/routes/base/utils/index.js +0 -17
  240. package/lib/cjs/src/routes/base/utils/localization.js +0 -40
  241. package/lib/cjs/src/routes/base/utils/points.js +0 -304
  242. package/lib/cjs/src/routes/base/utils/route.js +0 -585
  243. package/lib/cjs/src/routes/download/service.js +0 -260
  244. package/lib/cjs/src/routes/download/types.js +0 -19
  245. package/lib/cjs/src/routes/free-ride/index.js +0 -17
  246. package/lib/cjs/src/routes/free-ride/service.js +0 -552
  247. package/lib/cjs/src/routes/index.js +0 -21
  248. package/lib/cjs/src/routes/library/service.js +0 -639
  249. package/lib/cjs/src/routes/library/types.js +0 -2
  250. package/lib/cjs/src/routes/list/RouteListObserver.js +0 -22
  251. package/lib/cjs/src/routes/list/cards/ActiveImportCard.js +0 -88
  252. package/lib/cjs/src/routes/list/cards/FreeRideCard.js +0 -118
  253. package/lib/cjs/src/routes/list/cards/RouteCard.js +0 -917
  254. package/lib/cjs/src/routes/list/cards/RouteImportCard.js +0 -40
  255. package/lib/cjs/src/routes/list/cards/base.js +0 -72
  256. package/lib/cjs/src/routes/list/cards/types.js +0 -2
  257. package/lib/cjs/src/routes/list/index.js +0 -17
  258. package/lib/cjs/src/routes/list/lists/alternatives.js +0 -42
  259. package/lib/cjs/src/routes/list/lists/myroutes.js +0 -59
  260. package/lib/cjs/src/routes/list/lists/selected.js +0 -39
  261. package/lib/cjs/src/routes/list/loaders/DBLoader.js +0 -51
  262. package/lib/cjs/src/routes/list/loaders/LegacyDB.js +0 -141
  263. package/lib/cjs/src/routes/list/loaders/StravaActivityLoader.js +0 -287
  264. package/lib/cjs/src/routes/list/loaders/api.js +0 -224
  265. package/lib/cjs/src/routes/list/loaders/db.js +0 -343
  266. package/lib/cjs/src/routes/list/loaders/types.js +0 -118
  267. package/lib/cjs/src/routes/list/service.js +0 -1367
  268. package/lib/cjs/src/routes/list/types.js +0 -2
  269. package/lib/cjs/src/routes/list/utils.js +0 -42
  270. package/lib/cjs/src/routes/page/index.js +0 -17
  271. package/lib/cjs/src/routes/page/service.js +0 -461
  272. package/lib/cjs/src/routes/page/types.js +0 -2
  273. package/lib/cjs/src/routes/sync/factory.js +0 -122
  274. package/lib/cjs/src/routes/sync/index.js +0 -18
  275. package/lib/cjs/src/routes/sync/komoot/provider.js +0 -365
  276. package/lib/cjs/src/routes/sync/types.js +0 -2
  277. package/lib/cjs/src/routes/types.js +0 -2
  278. package/lib/cjs/src/services/index.js +0 -17
  279. package/lib/cjs/src/services/overpass/index.js +0 -17
  280. package/lib/cjs/src/services/overpass/overpass.js +0 -216
  281. package/lib/cjs/src/settings/bindings/index.js +0 -17
  282. package/lib/cjs/src/settings/bindings/json.js +0 -104
  283. package/lib/cjs/src/settings/bindings/types.js +0 -9
  284. package/lib/cjs/src/settings/display/index.js +0 -18
  285. package/lib/cjs/src/settings/display/support/index.js +0 -17
  286. package/lib/cjs/src/settings/display/support/service.js +0 -115
  287. package/lib/cjs/src/settings/display/support/types.js +0 -2
  288. package/lib/cjs/src/settings/display/user/index.js +0 -18
  289. package/lib/cjs/src/settings/display/user/service.js +0 -161
  290. package/lib/cjs/src/settings/display/user/types.js +0 -2
  291. package/lib/cjs/src/settings/index.js +0 -18
  292. package/lib/cjs/src/settings/service/index.js +0 -17
  293. package/lib/cjs/src/settings/service/mock.js +0 -36
  294. package/lib/cjs/src/settings/service/service.js +0 -237
  295. package/lib/cjs/src/settings/types.js +0 -2
  296. package/lib/cjs/src/types.js +0 -2
  297. package/lib/cjs/src/ui/index.js +0 -17
  298. package/lib/cjs/src/ui/service.js +0 -508
  299. package/lib/cjs/src/ui/types.js +0 -2
  300. package/lib/cjs/src/utils/calc.js +0 -39
  301. package/lib/cjs/src/utils/clone.js +0 -8
  302. package/lib/cjs/src/utils/fileinfo.js +0 -13
  303. package/lib/cjs/src/utils/formatting.js +0 -81
  304. package/lib/cjs/src/utils/geo.js +0 -141
  305. package/lib/cjs/src/utils/index.js +0 -49
  306. package/lib/cjs/src/utils/logging.js +0 -21
  307. package/lib/cjs/src/utils/math.js +0 -36
  308. package/lib/cjs/src/utils/merge.js +0 -29
  309. package/lib/cjs/src/utils/nextTick.js +0 -5
  310. package/lib/cjs/src/utils/sleep.js +0 -5
  311. package/lib/cjs/src/utils/string.js +0 -8
  312. package/lib/cjs/src/utils/time.js +0 -27
  313. package/lib/cjs/src/utils/valid.js +0 -14
  314. package/lib/cjs/src/utils/vector.js +0 -204
  315. package/lib/cjs/src/utils/xml.js +0 -112
  316. package/lib/cjs/src/video/VideoConversion.js +0 -170
  317. package/lib/cjs/src/video/VideoSyncHelper.js +0 -665
  318. package/lib/cjs/src/video/index.js +0 -19
  319. package/lib/cjs/src/video/types.js +0 -2
  320. package/lib/cjs/src/workouts/base/api/consts.js +0 -12
  321. package/lib/cjs/src/workouts/base/api/index.js +0 -130
  322. package/lib/cjs/src/workouts/base/model/Segment.js +0 -141
  323. package/lib/cjs/src/workouts/base/model/Step.js +0 -165
  324. package/lib/cjs/src/workouts/base/model/Workout.js +0 -114
  325. package/lib/cjs/src/workouts/base/model/index.js +0 -20
  326. package/lib/cjs/src/workouts/base/model/types.js +0 -2
  327. package/lib/cjs/src/workouts/base/parsers/factory.js +0 -90
  328. package/lib/cjs/src/workouts/base/parsers/incyclist/Json.js +0 -62
  329. package/lib/cjs/src/workouts/base/parsers/index.js +0 -39
  330. package/lib/cjs/src/workouts/base/parsers/intervals/parser.js +0 -297
  331. package/lib/cjs/src/workouts/base/parsers/intervals/types.js +0 -9
  332. package/lib/cjs/src/workouts/base/parsers/types.js +0 -2
  333. package/lib/cjs/src/workouts/base/parsers/zwo/zwo.js +0 -254
  334. package/lib/cjs/src/workouts/calendar/index.js +0 -19
  335. package/lib/cjs/src/workouts/calendar/service.js +0 -359
  336. package/lib/cjs/src/workouts/calendar/sync/factory.js +0 -127
  337. package/lib/cjs/src/workouts/calendar/sync/index.js +0 -18
  338. package/lib/cjs/src/workouts/calendar/sync/intervals/provider.js +0 -211
  339. package/lib/cjs/src/workouts/calendar/sync/types.js +0 -2
  340. package/lib/cjs/src/workouts/calendar/types.js +0 -2
  341. package/lib/cjs/src/workouts/index.js +0 -19
  342. package/lib/cjs/src/workouts/list/cards/ActiveImportCard.js +0 -72
  343. package/lib/cjs/src/workouts/list/cards/ScheduledWorkoutCard.js +0 -42
  344. package/lib/cjs/src/workouts/list/cards/WorkoutCard.js +0 -287
  345. package/lib/cjs/src/workouts/list/cards/WorkoutCreateCard.js +0 -99
  346. package/lib/cjs/src/workouts/list/cards/WorkoutImportCard.js +0 -41
  347. package/lib/cjs/src/workouts/list/cards/base.js +0 -58
  348. package/lib/cjs/src/workouts/list/cards/index.js +0 -20
  349. package/lib/cjs/src/workouts/list/cards/types.js +0 -9
  350. package/lib/cjs/src/workouts/list/index.js +0 -18
  351. package/lib/cjs/src/workouts/list/loaders/api.js +0 -50
  352. package/lib/cjs/src/workouts/list/loaders/db.js +0 -188
  353. package/lib/cjs/src/workouts/list/loaders/loader.js +0 -21
  354. package/lib/cjs/src/workouts/list/service.js +0 -663
  355. package/lib/cjs/src/workouts/list/types.js +0 -2
  356. package/lib/cjs/src/workouts/ride/index.js +0 -18
  357. package/lib/cjs/src/workouts/ride/service.js +0 -613
  358. package/lib/cjs/src/workouts/ride/types.js +0 -2
  359. package/lib/esm/api/form/index.js +0 -1
  360. package/lib/types/api/form/index.d.ts +0 -6
@@ -181,7 +181,7 @@ let Activity = (() => {
181
181
  try {
182
182
  const converter = this.getActivityConverter();
183
183
  const data = await converter.convert(this.details, format);
184
- const fileName = this.details.fileName.replace('.json', `.${format}`);
184
+ const fileName = await this.getExportFileName(format);
185
185
  await fs.writeFile(fileName, Buffer.from(data));
186
186
  this.details[`${format}FileName`] = fileName;
187
187
  await this.save(true);
@@ -197,6 +197,18 @@ let Activity = (() => {
197
197
  }
198
198
  return success;
199
199
  }
200
+ async getExportFileName(format) {
201
+ let fileName = this.details.fileName.replace('json', format);
202
+ if (fileName.startsWith('mmkv:/')) {
203
+ const fs = this.getBindings().fs;
204
+ const appDir = this.getBindings().appInfo.getAppDir();
205
+ const activitiesDir = this.getBindings().path.join(appDir, 'activities');
206
+ await fs.ensureDir(activitiesDir);
207
+ const baseName = fileName.split('/').pop();
208
+ fileName = this.getBindings().path.join(activitiesDir, baseName);
209
+ }
210
+ return fileName;
211
+ }
200
212
  async upload(connectedApp, observer) {
201
213
  let success = false;
202
214
  let error;
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
8
+ };
2
9
  var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
10
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
11
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
@@ -26,13 +33,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
26
33
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
34
  done = true;
28
35
  };
29
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
- var useValue = arguments.length > 2;
31
- for (var i = 0; i < initializers.length; i++) {
32
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
- }
34
- return useValue ? value : void 0;
35
- };
36
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
@@ -43,6 +43,9 @@ const types_1 = require("../../base/types");
43
43
  const sleep_1 = require("../../utils/sleep");
44
44
  const base_1 = require("../../apps/base/api/base");
45
45
  const gd_eventlog_1 = require("gd-eventlog");
46
+ const decorators_1 = require("../../base/decorators");
47
+ const api_1 = require("../../api");
48
+ const settings_1 = require("../../settings");
46
49
  const OVERPASS_URL_ALT1 = 'https://overpass.kumi.systems/api/interpreter';
47
50
  const OVERPASS_URL_ALT2 = 'https://lz4.overpass-api.de/api/interpreter';
48
51
  const OVERPASS_URL_ALT3 = 'https://z.overpass-api.de/api/interpreter';
@@ -53,16 +56,23 @@ let OverpassApi = (() => {
53
56
  let _classExtraInitializers = [];
54
57
  let _classThis;
55
58
  let _classSuper = base_1.AppApiBase;
59
+ let _instanceExtraInitializers = [];
60
+ let _getUserSettings_decorators;
61
+ let _getBindings_decorators;
56
62
  var OverpassApi = class extends _classSuper {
57
63
  static { _classThis = this; }
58
64
  static {
59
65
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
66
+ _getUserSettings_decorators = [decorators_1.Injectable];
67
+ _getBindings_decorators = [decorators_1.Injectable];
68
+ __esDecorate(this, null, _getUserSettings_decorators, { kind: "method", name: "getUserSettings", static: false, private: false, access: { has: obj => "getUserSettings" in obj, get: obj => obj.getUserSettings }, metadata: _metadata }, null, _instanceExtraInitializers);
69
+ __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);
60
70
  __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
61
71
  OverpassApi = _classThis = _classDescriptor.value;
62
72
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
63
73
  __runInitializers(_classThis, _classExtraInitializers);
64
74
  }
65
- url;
75
+ url = __runInitializers(this, _instanceExtraInitializers);
66
76
  mirrors = [];
67
77
  logger;
68
78
  constructor(props) {
@@ -76,6 +86,70 @@ let OverpassApi = (() => {
76
86
  }
77
87
  }
78
88
  }
89
+ getOverpassHeaders() {
90
+ const version = this.getAppVersion();
91
+ const userId = this.getUserId();
92
+ let userAgent = `Incyclist/${version}`;
93
+ if (userId) {
94
+ try {
95
+ const crypto = this.getBindings()?.crypto;
96
+ const hashedId = crypto ? crypto.createHash('sha256').update('OAPI:' + userId).digest('hex').substring(0, 8) : undefined;
97
+ if (hashedId) {
98
+ userAgent += ` (${hashedId})`;
99
+ }
100
+ }
101
+ catch (err) {
102
+ this.logger.logEvent({ message: 'failed to hash userId', error: err.message });
103
+ }
104
+ }
105
+ return {
106
+ 'User-Agent': userAgent,
107
+ 'Referer': 'https://incyclist.com'
108
+ };
109
+ }
110
+ async post(url, data, conf) {
111
+ try {
112
+ const https = require('https');
113
+ return await this.postViaNodeHttps(https, url, data);
114
+ }
115
+ catch {
116
+ const cfg = conf ?? {};
117
+ const config = {
118
+ ...cfg,
119
+ headers: this.getOverpassHeaders()
120
+ };
121
+ return await super.post(url, data, config);
122
+ }
123
+ }
124
+ async postViaNodeHttps(https, url, data) {
125
+ return new Promise((resolve, reject) => {
126
+ const reqUrl = new URL(url);
127
+ const headers = this.getOverpassHeaders();
128
+ const queryData = typeof data === 'string' ? data : JSON.stringify(data);
129
+ const options = {
130
+ method: 'POST',
131
+ headers: {
132
+ ...headers,
133
+ 'Content-Length': Buffer.byteLength(queryData)
134
+ }
135
+ };
136
+ const req = https.request(reqUrl, options, (res) => {
137
+ let body = '';
138
+ res.on('data', (chunk) => body += chunk);
139
+ res.on('end', () => {
140
+ resolve({
141
+ data: body,
142
+ status: res.statusCode,
143
+ statusText: res.statusMessage,
144
+ headers: res.headers
145
+ });
146
+ });
147
+ });
148
+ req.on('error', reject);
149
+ req.write(queryData);
150
+ req.end();
151
+ });
152
+ }
79
153
  async query(queryOL, timeout) {
80
154
  const ts = Date.now();
81
155
  this.logger.logEvent({ message: 'query', queryOL, queryId: ts, timeout });
@@ -96,24 +170,102 @@ let OverpassApi = (() => {
96
170
  getBaseUrl() {
97
171
  return '';
98
172
  }
173
+ extractErrorInfo(err, mirror) {
174
+ return {
175
+ mirror,
176
+ status: err?.response?.status,
177
+ statusText: err?.response?.statusText,
178
+ error: err?.message ?? 'overpass query failed'
179
+ };
180
+ }
181
+ logUnexpectedErrors(fn, errors) {
182
+ const unexpectedErrors = errors.filter(e => {
183
+ const status = e.status;
184
+ if (!status || status === 408 || status === 504)
185
+ return false;
186
+ return status >= 406 && status < 500;
187
+ });
188
+ if (unexpectedErrors.length > 0 && unexpectedErrors.length === errors.length) {
189
+ unexpectedErrors.forEach(err => {
190
+ this.logger.logEvent({
191
+ message: 'error',
192
+ fn,
193
+ mirror: err.mirror,
194
+ status: err.status,
195
+ statusText: err.statusText,
196
+ error: err.error ?? 'all mirrors failed with 4xx error'
197
+ });
198
+ });
199
+ }
200
+ }
99
201
  async bulkQuery(query, timeout) {
202
+ const errors = [];
100
203
  const promises = [];
101
204
  this.mirrors.forEach(mirror => {
102
- promises.push(this.post(mirror, query).then((res) => res?.data));
205
+ promises.push(this.post(mirror, query)
206
+ .then((res) => res?.data)
207
+ .catch(err => {
208
+ errors.push(this.extractErrorInfo(err, mirror));
209
+ throw err;
210
+ }));
103
211
  });
104
212
  if (timeout !== undefined && timeout !== null) {
105
213
  promises.push((0, sleep_1.sleep)(timeout).then(() => 'timeout'));
106
214
  }
107
- const res = await (0, promise_any_1.default)(promises);
108
- if (res === 'timeout') {
109
- return undefined;
215
+ try {
216
+ const res = await (0, promise_any_1.default)(promises);
217
+ if (res === 'timeout') {
218
+ return undefined;
219
+ }
220
+ return res;
221
+ }
222
+ catch (err) {
223
+ this.logUnexpectedErrors('bulkQuery', errors);
224
+ throw err;
110
225
  }
111
- return res;
226
+ }
227
+ async sequentialQuery(query, timeout) {
228
+ const startTime = Date.now();
229
+ const errors = [];
230
+ let lastError;
231
+ for (const mirror of this.mirrors) {
232
+ if (timeout !== undefined && timeout !== null) {
233
+ const elapsed = Date.now() - startTime;
234
+ if (elapsed >= timeout) {
235
+ return undefined;
236
+ }
237
+ }
238
+ try {
239
+ const res = await this.post(mirror, query);
240
+ return res?.data;
241
+ }
242
+ catch (err) {
243
+ lastError = err;
244
+ errors.push(this.extractErrorInfo(err, mirror));
245
+ if (mirror !== this.mirrors[this.mirrors.length - 1]) {
246
+ await (0, sleep_1.sleep)(100);
247
+ }
248
+ }
249
+ }
250
+ this.logUnexpectedErrors('sequentialQuery', errors);
251
+ throw lastError;
112
252
  }
113
253
  reset() {
114
254
  this.mirrors = [OVERPASS_URL_ALT1, OVERPASS_URL_ALT2, OVERPASS_URL_ALT3];
115
255
  this.url = this.mirrors[0];
116
256
  }
257
+ getAppVersion() {
258
+ return this.getBindings()?.appInfo?.getAppVersion() ?? '';
259
+ }
260
+ getUserId() {
261
+ return this.getUserSettings().getValue('uuid', '');
262
+ }
263
+ getUserSettings() {
264
+ return (0, settings_1.useUserSettings)();
265
+ }
266
+ getBindings() {
267
+ return (0, api_1.getBindings)();
268
+ }
117
269
  };
118
270
  return OverpassApi = _classThis;
119
271
  })();
@@ -178,7 +178,7 @@ let Activity = (() => {
178
178
  try {
179
179
  const converter = this.getActivityConverter();
180
180
  const data = await converter.convert(this.details, format);
181
- const fileName = this.details.fileName.replace('.json', `.${format}`);
181
+ const fileName = await this.getExportFileName(format);
182
182
  await fs.writeFile(fileName, Buffer.from(data));
183
183
  this.details[`${format}FileName`] = fileName;
184
184
  await this.save(true);
@@ -194,6 +194,18 @@ let Activity = (() => {
194
194
  }
195
195
  return success;
196
196
  }
197
+ async getExportFileName(format) {
198
+ let fileName = this.details.fileName.replace('json', format);
199
+ if (fileName.startsWith('mmkv:/')) {
200
+ const fs = this.getBindings().fs;
201
+ const appDir = this.getBindings().appInfo.getAppDir();
202
+ const activitiesDir = this.getBindings().path.join(appDir, 'activities');
203
+ await fs.ensureDir(activitiesDir);
204
+ const baseName = fileName.split('/').pop();
205
+ fileName = this.getBindings().path.join(activitiesDir, baseName);
206
+ }
207
+ return fileName;
208
+ }
197
209
  async upload(connectedApp, observer) {
198
210
  let success = false;
199
211
  let error;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.7.66",
3
+ "version": "1.7.65",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },
@@ -1,3 +1,10 @@
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
+ };
1
8
  var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
9
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
10
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
@@ -25,18 +32,14 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
25
32
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
33
  done = true;
27
34
  };
28
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
- var useValue = arguments.length > 2;
30
- for (var i = 0; i < initializers.length; i++) {
31
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
- }
33
- return useValue ? value : void 0;
34
- };
35
35
  import any from 'promise.any';
36
36
  import { Singleton } from '../../base/types';
37
37
  import { sleep } from '../../utils/sleep';
38
38
  import { AppApiBase } from '../../apps/base/api/base';
39
39
  import { EventLogger } from 'gd-eventlog';
40
+ import { Injectable } from '../../base/decorators';
41
+ import { getBindings } from '../../api';
42
+ import { useUserSettings } from '../../settings';
40
43
  const OVERPASS_URL_ALT1 = 'https://overpass.kumi.systems/api/interpreter';
41
44
  const OVERPASS_URL_ALT2 = 'https://lz4.overpass-api.de/api/interpreter';
42
45
  const OVERPASS_URL_ALT3 = 'https://z.overpass-api.de/api/interpreter';
@@ -47,16 +50,23 @@ let OverpassApi = (() => {
47
50
  let _classExtraInitializers = [];
48
51
  let _classThis;
49
52
  let _classSuper = AppApiBase;
53
+ let _instanceExtraInitializers = [];
54
+ let _getUserSettings_decorators;
55
+ let _getBindings_decorators;
50
56
  var OverpassApi = class extends _classSuper {
51
57
  static { _classThis = this; }
52
58
  static {
53
59
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
60
+ _getUserSettings_decorators = [Injectable];
61
+ _getBindings_decorators = [Injectable];
62
+ __esDecorate(this, null, _getUserSettings_decorators, { kind: "method", name: "getUserSettings", static: false, private: false, access: { has: obj => "getUserSettings" in obj, get: obj => obj.getUserSettings }, metadata: _metadata }, null, _instanceExtraInitializers);
63
+ __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);
54
64
  __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
55
65
  OverpassApi = _classThis = _classDescriptor.value;
56
66
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
57
67
  __runInitializers(_classThis, _classExtraInitializers);
58
68
  }
59
- url;
69
+ url = __runInitializers(this, _instanceExtraInitializers);
60
70
  mirrors = [];
61
71
  logger;
62
72
  constructor(props) {
@@ -70,6 +80,70 @@ let OverpassApi = (() => {
70
80
  }
71
81
  }
72
82
  }
83
+ getOverpassHeaders() {
84
+ const version = this.getAppVersion();
85
+ const userId = this.getUserId();
86
+ let userAgent = `Incyclist/${version}`;
87
+ if (userId) {
88
+ try {
89
+ const crypto = this.getBindings()?.crypto;
90
+ const hashedId = crypto ? crypto.createHash('sha256').update('OAPI:' + userId).digest('hex').substring(0, 8) : undefined;
91
+ if (hashedId) {
92
+ userAgent += ` (${hashedId})`;
93
+ }
94
+ }
95
+ catch (err) {
96
+ this.logger.logEvent({ message: 'failed to hash userId', error: err.message });
97
+ }
98
+ }
99
+ return {
100
+ 'User-Agent': userAgent,
101
+ 'Referer': 'https://incyclist.com'
102
+ };
103
+ }
104
+ async post(url, data, conf) {
105
+ try {
106
+ const https = require('https');
107
+ return await this.postViaNodeHttps(https, url, data);
108
+ }
109
+ catch {
110
+ const cfg = conf ?? {};
111
+ const config = {
112
+ ...cfg,
113
+ headers: this.getOverpassHeaders()
114
+ };
115
+ return await super.post(url, data, config);
116
+ }
117
+ }
118
+ async postViaNodeHttps(https, url, data) {
119
+ return new Promise((resolve, reject) => {
120
+ const reqUrl = new URL(url);
121
+ const headers = this.getOverpassHeaders();
122
+ const queryData = typeof data === 'string' ? data : JSON.stringify(data);
123
+ const options = {
124
+ method: 'POST',
125
+ headers: {
126
+ ...headers,
127
+ 'Content-Length': Buffer.byteLength(queryData)
128
+ }
129
+ };
130
+ const req = https.request(reqUrl, options, (res) => {
131
+ let body = '';
132
+ res.on('data', (chunk) => body += chunk);
133
+ res.on('end', () => {
134
+ resolve({
135
+ data: body,
136
+ status: res.statusCode,
137
+ statusText: res.statusMessage,
138
+ headers: res.headers
139
+ });
140
+ });
141
+ });
142
+ req.on('error', reject);
143
+ req.write(queryData);
144
+ req.end();
145
+ });
146
+ }
73
147
  async query(queryOL, timeout) {
74
148
  const ts = Date.now();
75
149
  this.logger.logEvent({ message: 'query', queryOL, queryId: ts, timeout });
@@ -90,24 +164,102 @@ let OverpassApi = (() => {
90
164
  getBaseUrl() {
91
165
  return '';
92
166
  }
167
+ extractErrorInfo(err, mirror) {
168
+ return {
169
+ mirror,
170
+ status: err?.response?.status,
171
+ statusText: err?.response?.statusText,
172
+ error: err?.message ?? 'overpass query failed'
173
+ };
174
+ }
175
+ logUnexpectedErrors(fn, errors) {
176
+ const unexpectedErrors = errors.filter(e => {
177
+ const status = e.status;
178
+ if (!status || status === 408 || status === 504)
179
+ return false;
180
+ return status >= 406 && status < 500;
181
+ });
182
+ if (unexpectedErrors.length > 0 && unexpectedErrors.length === errors.length) {
183
+ unexpectedErrors.forEach(err => {
184
+ this.logger.logEvent({
185
+ message: 'error',
186
+ fn,
187
+ mirror: err.mirror,
188
+ status: err.status,
189
+ statusText: err.statusText,
190
+ error: err.error ?? 'all mirrors failed with 4xx error'
191
+ });
192
+ });
193
+ }
194
+ }
93
195
  async bulkQuery(query, timeout) {
196
+ const errors = [];
94
197
  const promises = [];
95
198
  this.mirrors.forEach(mirror => {
96
- promises.push(this.post(mirror, query).then((res) => res?.data));
199
+ promises.push(this.post(mirror, query)
200
+ .then((res) => res?.data)
201
+ .catch(err => {
202
+ errors.push(this.extractErrorInfo(err, mirror));
203
+ throw err;
204
+ }));
97
205
  });
98
206
  if (timeout !== undefined && timeout !== null) {
99
207
  promises.push(sleep(timeout).then(() => 'timeout'));
100
208
  }
101
- const res = await any(promises);
102
- if (res === 'timeout') {
103
- return undefined;
209
+ try {
210
+ const res = await any(promises);
211
+ if (res === 'timeout') {
212
+ return undefined;
213
+ }
214
+ return res;
215
+ }
216
+ catch (err) {
217
+ this.logUnexpectedErrors('bulkQuery', errors);
218
+ throw err;
104
219
  }
105
- return res;
220
+ }
221
+ async sequentialQuery(query, timeout) {
222
+ const startTime = Date.now();
223
+ const errors = [];
224
+ let lastError;
225
+ for (const mirror of this.mirrors) {
226
+ if (timeout !== undefined && timeout !== null) {
227
+ const elapsed = Date.now() - startTime;
228
+ if (elapsed >= timeout) {
229
+ return undefined;
230
+ }
231
+ }
232
+ try {
233
+ const res = await this.post(mirror, query);
234
+ return res?.data;
235
+ }
236
+ catch (err) {
237
+ lastError = err;
238
+ errors.push(this.extractErrorInfo(err, mirror));
239
+ if (mirror !== this.mirrors[this.mirrors.length - 1]) {
240
+ await sleep(100);
241
+ }
242
+ }
243
+ }
244
+ this.logUnexpectedErrors('sequentialQuery', errors);
245
+ throw lastError;
106
246
  }
107
247
  reset() {
108
248
  this.mirrors = [OVERPASS_URL_ALT1, OVERPASS_URL_ALT2, OVERPASS_URL_ALT3];
109
249
  this.url = this.mirrors[0];
110
250
  }
251
+ getAppVersion() {
252
+ return this.getBindings()?.appInfo?.getAppVersion() ?? '';
253
+ }
254
+ getUserId() {
255
+ return this.getUserSettings().getValue('uuid', '');
256
+ }
257
+ getUserSettings() {
258
+ return useUserSettings();
259
+ }
260
+ getBindings() {
261
+ return getBindings();
262
+ }
111
263
  };
112
264
  return OverpassApi = _classThis;
113
265
  })();
@@ -110,6 +110,7 @@ let OverpassApi = (() => {
110
110
  }
111
111
  async query(queryOL, timeout) {
112
112
  const ts = Date.now();
113
+ console.log('# [overpass] query', queryOL);
113
114
  this.logger.logEvent({ message: 'query', queryOL, queryId: ts, timeout });
114
115
  const res = await this.bulkQuery(queryOL, timeout);
115
116
  this.logger.logEvent({ message: 'query result', queryId: ts, hasData: res !== undefined, duration: Date.now() - ts });
@@ -130,9 +131,11 @@ let OverpassApi = (() => {
130
131
  }
131
132
  async postWithErrorTracking(mirror, query) {
132
133
  try {
134
+ console.log('# [overpass] query', mirror);
133
135
  return await this.postToOverpass(mirror, query);
134
136
  }
135
137
  catch (err) {
138
+ console.log('# [overpass] ERROR', mirror, err);
136
139
  const status = err?.response?.status;
137
140
  const statusText = err?.response?.statusText;
138
141
  if (status && status !== 408 && status !== 504) {
@@ -30,6 +30,7 @@ export declare class Activity implements ActivityInfo {
30
30
  markExporting(type: string, exporting: boolean): void;
31
31
  isExporting(type: string): boolean;
32
32
  export(type: string, observer?: Observer): Promise<boolean>;
33
+ protected getExportFileName(format: string): Promise<string>;
33
34
  upload(connectedApp: string, observer?: Observer): Promise<boolean>;
34
35
  markUploading(connectedApp: string, uploading: boolean): void;
35
36
  isUploading(connectedApp: string): boolean;
@@ -1,5 +1,7 @@
1
1
  import { AppApiBase } from '../../apps/base/api/base';
2
2
  import { EventLogger } from 'gd-eventlog';
3
+ import { UserSettingsService } from '../../settings';
4
+ import { AxiosResponse } from 'axios';
3
5
  export declare const OVERPASS_URL_DEFAULT = "https://overpass.kumi.systems/api/interpreter";
4
6
  export declare class OverpassApi extends AppApiBase {
5
7
  protected url: string;
@@ -8,11 +10,34 @@ export declare class OverpassApi extends AppApiBase {
8
10
  constructor(props?: {
9
11
  url: string;
10
12
  });
13
+ protected getOverpassHeaders(): {
14
+ 'User-Agent': string;
15
+ Referer: string;
16
+ };
17
+ protected post(url: string, data?: object | string, conf?: object): Promise<AxiosResponse>;
18
+ protected postViaNodeHttps(https: any, url: string, data?: object | string): Promise<any>;
11
19
  query(queryOL: string, timeout?: number): Promise<JSON | string | undefined>;
12
20
  singleQuery(queryOL: string): Promise<JSON | string>;
13
21
  rotateUrl(): void;
14
22
  protected getBaseUrl(): string;
23
+ protected extractErrorInfo(err: any, mirror: string): {
24
+ mirror: string;
25
+ status?: number;
26
+ statusText?: string;
27
+ error: string;
28
+ };
29
+ protected logUnexpectedErrors(fn: string, errors: Array<{
30
+ mirror: string;
31
+ status?: number;
32
+ statusText?: string;
33
+ error: string;
34
+ }>): void;
15
35
  protected bulkQuery(query: string, timeout?: number): Promise<JSON | string | undefined>;
36
+ protected sequentialQuery(query: string, timeout?: number): Promise<JSON | string | undefined>;
16
37
  reset(): void;
38
+ protected getAppVersion(): string;
39
+ protected getUserId(): string;
40
+ protected getUserSettings(): UserSettingsService;
41
+ protected getBindings(): import("../../api").IncyclistBindings;
17
42
  }
18
43
  export declare const useOverpassApi: () => OverpassApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.7.66",
3
+ "version": "1.7.67",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });