@digitransit-search-util/digitransit-search-util-execute-search-immidiate 1.1.2 → 1.2.0

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 (2) hide show
  1. package/index.js +49 -0
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -221,6 +221,7 @@ const routeLayers = [
221
221
  'route-AIRPLANE',
222
222
  ];
223
223
  const locationLayers = ['favouritePlace', 'venue', 'address', 'street'];
224
+ const parkingLayers = ['carpark', 'bikepark'];
224
225
  /**
225
226
  * Executes the search
226
227
  *
@@ -242,6 +243,7 @@ export function getSearchResults(
242
243
  getFavouriteLocations: locations,
243
244
  getOldSearches: prevSearches,
244
245
  getFavouriteStops: stops,
246
+ parkingAreaSources,
245
247
  getLanguage,
246
248
  getStopAndStationsQuery,
247
249
  getFavouriteBikeRentalStationsQuery,
@@ -307,6 +309,7 @@ export function getSearchResults(
307
309
  searchComponents.push(getBackSuggestion());
308
310
  }
309
311
  }
312
+
310
313
  if (allSources || sources.includes('Datasource')) {
311
314
  const geocodingLayers = ['station', 'venue', 'address', 'street'];
312
315
  const feedis = feedIDs.map(v => `gtfs${v}`);
@@ -333,6 +336,8 @@ export function getSearchResults(
333
336
  'futureRoute',
334
337
  'ownLocations',
335
338
  'bikeRentalStation',
339
+ 'bikepark',
340
+ 'carpark',
336
341
  'stop',
337
342
  'back',
338
343
  ];
@@ -340,6 +345,47 @@ export function getSearchResults(
340
345
  searchComponents.push(getOldSearches(locationHistory, input, dropLayers));
341
346
  }
342
347
  }
348
+ if (allTargets || targets.includes('ParkingAreas')) {
349
+ if (allSources || sources.includes('Datasource')) {
350
+ const searchParams =
351
+ geocodingSize && geocodingSize !== 10 ? { size: geocodingSize } : {};
352
+ const geocodingLayers = ['carpark', 'bikepark'];
353
+ const feedIds = parkingAreaSources ? parkingAreaSources.join(',') : null;
354
+ searchComponents.push(
355
+ getGeocodingResults(
356
+ input,
357
+ searchParams,
358
+ language,
359
+ focusPoint,
360
+ feedIds,
361
+ URL_PELIAS,
362
+ minimalRegexp,
363
+ geocodingLayers,
364
+ ).then(results => {
365
+ if (filterResults) {
366
+ return filterResults(results, mode);
367
+ }
368
+ return results;
369
+ }),
370
+ );
371
+ }
372
+ if (allSources || sources.includes('History')) {
373
+ const history = prevSearches(context);
374
+ const dropLayers = [
375
+ 'currentPosition',
376
+ 'selectFromMap',
377
+ 'futureRoute',
378
+ 'ownLocations',
379
+ 'favouritePlace',
380
+ 'bikestation',
381
+ 'bikeRentalStation',
382
+ 'back',
383
+ ];
384
+ dropLayers.push(...routeLayers);
385
+ dropLayers.push(...locationLayers);
386
+ searchComponents.push(getOldSearches(history, input, dropLayers));
387
+ }
388
+ }
343
389
 
344
390
  if (allTargets || targets.includes('Stops')) {
345
391
  if (sources.includes('Favourite')) {
@@ -415,6 +461,7 @@ export function getSearchResults(
415
461
  ];
416
462
  dropLayers.push(...routeLayers);
417
463
  dropLayers.push(...locationLayers);
464
+ dropLayers.push(...parkingLayers);
418
465
  if (transportMode) {
419
466
  if (transportMode !== 'route-CITYBIKE') {
420
467
  dropLayers.push('bikeRentalStation');
@@ -459,6 +506,8 @@ export function getSearchResults(
459
506
  'favouritePlace',
460
507
  'stop',
461
508
  'station',
509
+ 'bikepark',
510
+ 'carpark',
462
511
  'ownLocations',
463
512
  'back',
464
513
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitransit-search-util/digitransit-search-util-execute-search-immidiate",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "digitransit-search-util execute-search-immidiate module",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -28,5 +28,5 @@
28
28
  "@digitransit-search-util/digitransit-search-util-uniq-by-label": "0.1.1",
29
29
  "lodash": "4.17.21"
30
30
  },
31
- "gitHead": "0c3901e4be1733df892f22c266432e442a00fd95"
31
+ "gitHead": "fa12b5718e3edc5e0824e08f3750068cb70ae3e2"
32
32
  }