@wemap/routers 11.8.4 → 11.8.5
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/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/remote/idfm/IdfmRemoteRouter.ts +17 -2
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"directory": "packages/routers"
|
|
13
13
|
},
|
|
14
14
|
"name": "@wemap/routers",
|
|
15
|
-
"version": "11.8.
|
|
15
|
+
"version": "11.8.5",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
18
18
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
},
|
|
53
53
|
"./helpers/*": "./helpers/*"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b811f47998e121da18d85857c9a1ddd1ae25c53b"
|
|
56
56
|
}
|
|
@@ -54,6 +54,9 @@ type IdfmJson = {
|
|
|
54
54
|
}[],
|
|
55
55
|
context: {
|
|
56
56
|
timezone: string
|
|
57
|
+
};
|
|
58
|
+
error: {
|
|
59
|
+
message?: string;
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
|
|
@@ -172,7 +175,7 @@ class IdfmRemoteRouter extends RemoteRouter {
|
|
|
172
175
|
}));
|
|
173
176
|
|
|
174
177
|
|
|
175
|
-
const jsonResponse = await res.json().catch(() => {
|
|
178
|
+
const jsonResponse: IdfmJson = await res.json().catch(() => {
|
|
176
179
|
throw new RemoteRouterServerUnreachable(this.rname, url);
|
|
177
180
|
});
|
|
178
181
|
|
|
@@ -188,7 +191,19 @@ class IdfmRemoteRouter extends RemoteRouter {
|
|
|
188
191
|
});
|
|
189
192
|
}
|
|
190
193
|
|
|
191
|
-
|
|
194
|
+
const routerResponse = this.createRouterResponseFromJson(jsonResponse, waypoints[0], waypoints[1]);
|
|
195
|
+
|
|
196
|
+
const sameModeFound = routerResponse.itineraries.some((itinerary) => itinerary.legs.every((leg) => leg.mode === mode));
|
|
197
|
+
if (!sameModeFound) {
|
|
198
|
+
return new RouterResponse({
|
|
199
|
+
routerName: this.rname,
|
|
200
|
+
from: waypoints[0],
|
|
201
|
+
to: waypoints[1],
|
|
202
|
+
error: 'Selected mode of transport was not found for this itinerary.'
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return routerResponse;
|
|
192
207
|
}
|
|
193
208
|
|
|
194
209
|
getURL(endpointUrl: string, mode: RoutingMode, waypoints: Coordinates[], options: RemoteRouterOptions) {
|