incyclist-services 1.7.75 → 1.7.76

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.
@@ -46,10 +46,10 @@ const gd_eventlog_1 = require("gd-eventlog");
46
46
  const decorators_1 = require("../../base/decorators");
47
47
  const api_1 = require("../../api");
48
48
  const settings_1 = require("../../settings");
49
+ const OVERPASS_URL_PRIMARY = 'https://overpass-api.de/api/interpreter';
49
50
  const OVERPASS_URL_ALT1 = 'https://overpass.kumi.systems/api/interpreter';
50
- const OVERPASS_URL_ALT2 = 'https://lz4.overpass-api.de/api/interpreter';
51
- const OVERPASS_URL_ALT3 = 'https://z.overpass-api.de/api/interpreter';
52
- exports.OVERPASS_URL_DEFAULT = OVERPASS_URL_ALT1;
51
+ const OVERPASS_URL_ALT2 = 'https://overpass.openstreetmap.fr/api/interpreter';
52
+ exports.OVERPASS_URL_DEFAULT = OVERPASS_URL_PRIMARY;
53
53
  let OverpassApi = (() => {
54
54
  let _classDecorators = [types_1.Singleton];
55
55
  let _classDescriptor;
@@ -77,7 +77,7 @@ let OverpassApi = (() => {
77
77
  logger;
78
78
  constructor(props) {
79
79
  super();
80
- this.mirrors = [OVERPASS_URL_ALT1, OVERPASS_URL_ALT2, OVERPASS_URL_ALT3];
80
+ this.mirrors = [OVERPASS_URL_PRIMARY, OVERPASS_URL_ALT1, OVERPASS_URL_ALT2];
81
81
  this.url = props?.url ?? this.mirrors[0];
82
82
  this.logger = new gd_eventlog_1.EventLogger('Overpass');
83
83
  if (props?.url) {
@@ -110,11 +110,7 @@ let OverpassApi = (() => {
110
110
  async post(url, data, conf) {
111
111
  const fetchBinding = this.getBindings()?.fetch;
112
112
  if (fetchBinding) {
113
- try {
114
- return await this.postViaFetchBinding(fetchBinding, url, data);
115
- }
116
- catch {
117
- }
113
+ return await this.postViaFetchBinding(fetchBinding, url, data);
118
114
  }
119
115
  try {
120
116
  const https = require('https');
@@ -132,19 +128,25 @@ let OverpassApi = (() => {
132
128
  async postViaFetchBinding(fetchBinding, url, data) {
133
129
  const headers = this.getOverpassHeaders();
134
130
  const body = typeof data === 'string' ? data : JSON.stringify(data);
135
- const res = await fetchBinding.fetch(url, {
136
- method: 'POST',
137
- headers,
138
- body,
139
- referrerPolicy: 'unsafe-url'
140
- });
141
- return {
142
- data: res.data,
143
- status: res.status,
144
- statusText: res.statusText,
145
- headers: res.headers,
146
- config: {}
147
- };
131
+ try {
132
+ const res = await fetchBinding.fetch(url, {
133
+ method: 'POST',
134
+ headers,
135
+ body,
136
+ referrerPolicy: 'unsafe-url'
137
+ });
138
+ return {
139
+ data: res.data,
140
+ status: res.status,
141
+ statusText: res.statusText,
142
+ headers: res.headers,
143
+ config: {}
144
+ };
145
+ }
146
+ catch (err) {
147
+ this.logger.logEvent({ message: 'fetch error', url, data, error: err.message });
148
+ throw err;
149
+ }
148
150
  }
149
151
  async postViaNodeHttps(https, url, data) {
150
152
  return new Promise((resolve, reject) => {
@@ -287,7 +289,7 @@ let OverpassApi = (() => {
287
289
  throw lastError;
288
290
  }
289
291
  reset() {
290
- this.mirrors = [OVERPASS_URL_ALT1, OVERPASS_URL_ALT2, OVERPASS_URL_ALT3];
292
+ this.mirrors = [OVERPASS_URL_PRIMARY, OVERPASS_URL_ALT1, OVERPASS_URL_ALT2];
291
293
  this.url = this.mirrors[0];
292
294
  }
293
295
  getAppVersion() {
@@ -40,10 +40,10 @@ import { EventLogger } from 'gd-eventlog';
40
40
  import { Injectable } from '../../base/decorators';
41
41
  import { getBindings } from '../../api';
42
42
  import { useUserSettings } from '../../settings';
43
+ const OVERPASS_URL_PRIMARY = 'https://overpass-api.de/api/interpreter';
43
44
  const OVERPASS_URL_ALT1 = 'https://overpass.kumi.systems/api/interpreter';
44
- const OVERPASS_URL_ALT2 = 'https://lz4.overpass-api.de/api/interpreter';
45
- const OVERPASS_URL_ALT3 = 'https://z.overpass-api.de/api/interpreter';
46
- export const OVERPASS_URL_DEFAULT = OVERPASS_URL_ALT1;
45
+ const OVERPASS_URL_ALT2 = 'https://overpass.openstreetmap.fr/api/interpreter';
46
+ export const OVERPASS_URL_DEFAULT = OVERPASS_URL_PRIMARY;
47
47
  let OverpassApi = (() => {
48
48
  let _classDecorators = [Singleton];
49
49
  let _classDescriptor;
@@ -71,7 +71,7 @@ let OverpassApi = (() => {
71
71
  logger;
72
72
  constructor(props) {
73
73
  super();
74
- this.mirrors = [OVERPASS_URL_ALT1, OVERPASS_URL_ALT2, OVERPASS_URL_ALT3];
74
+ this.mirrors = [OVERPASS_URL_PRIMARY, OVERPASS_URL_ALT1, OVERPASS_URL_ALT2];
75
75
  this.url = props?.url ?? this.mirrors[0];
76
76
  this.logger = new EventLogger('Overpass');
77
77
  if (props?.url) {
@@ -104,11 +104,7 @@ let OverpassApi = (() => {
104
104
  async post(url, data, conf) {
105
105
  const fetchBinding = this.getBindings()?.fetch;
106
106
  if (fetchBinding) {
107
- try {
108
- return await this.postViaFetchBinding(fetchBinding, url, data);
109
- }
110
- catch {
111
- }
107
+ return await this.postViaFetchBinding(fetchBinding, url, data);
112
108
  }
113
109
  try {
114
110
  const https = require('https');
@@ -126,19 +122,25 @@ let OverpassApi = (() => {
126
122
  async postViaFetchBinding(fetchBinding, url, data) {
127
123
  const headers = this.getOverpassHeaders();
128
124
  const body = typeof data === 'string' ? data : JSON.stringify(data);
129
- const res = await fetchBinding.fetch(url, {
130
- method: 'POST',
131
- headers,
132
- body,
133
- referrerPolicy: 'unsafe-url'
134
- });
135
- return {
136
- data: res.data,
137
- status: res.status,
138
- statusText: res.statusText,
139
- headers: res.headers,
140
- config: {}
141
- };
125
+ try {
126
+ const res = await fetchBinding.fetch(url, {
127
+ method: 'POST',
128
+ headers,
129
+ body,
130
+ referrerPolicy: 'unsafe-url'
131
+ });
132
+ return {
133
+ data: res.data,
134
+ status: res.status,
135
+ statusText: res.statusText,
136
+ headers: res.headers,
137
+ config: {}
138
+ };
139
+ }
140
+ catch (err) {
141
+ this.logger.logEvent({ message: 'fetch error', url, data, error: err.message });
142
+ throw err;
143
+ }
142
144
  }
143
145
  async postViaNodeHttps(https, url, data) {
144
146
  return new Promise((resolve, reject) => {
@@ -281,7 +283,7 @@ let OverpassApi = (() => {
281
283
  throw lastError;
282
284
  }
283
285
  reset() {
284
- this.mirrors = [OVERPASS_URL_ALT1, OVERPASS_URL_ALT2, OVERPASS_URL_ALT3];
286
+ this.mirrors = [OVERPASS_URL_PRIMARY, OVERPASS_URL_ALT1, OVERPASS_URL_ALT2];
285
287
  this.url = this.mirrors[0];
286
288
  }
287
289
  getAppVersion() {
@@ -1,4 +1,4 @@
1
- export type FeatureToggle = 'NEW_SEARCH_UI' | 'CONTROLLERS' | 'MOBILE_WORKOUTS';
1
+ export type FeatureToggle = 'NEW_SEARCH_UI' | 'CONTROLLERS' | 'MOBILE_WORKOUTS' | 'WEBBLE_WINDOWS';
2
2
  export type Interfaces = 'ant' | 'ble' | 'serial' | 'wifi' | 'tcpip';
3
3
  export type BLEFeatures = {
4
4
  services: Array<string>;
@@ -3,7 +3,7 @@ import { EventLogger } from 'gd-eventlog';
3
3
  import { UserSettingsService } from '../../settings';
4
4
  import { AxiosResponse } from 'axios';
5
5
  import type { IFetchBinding } from '../../api/fetch/types';
6
- export declare const OVERPASS_URL_DEFAULT = "https://overpass.kumi.systems/api/interpreter";
6
+ export declare const OVERPASS_URL_DEFAULT = "https://overpass-api.de/api/interpreter";
7
7
  export declare class OverpassApi extends AppApiBase {
8
8
  protected url: string;
9
9
  protected mirrors: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.7.75",
3
+ "version": "1.7.76",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },