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

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 +53 -3
  2. package/package.json +3 -3
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,49 @@ 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 = geocodingSearchParams;
351
+ if (geocodingSize && geocodingSize !== 10) {
352
+ searchParams.size = geocodingSize;
353
+ }
354
+ const geocodingLayers = ['carpark', 'bikepark'];
355
+ const feedIds = parkingAreaSources ? parkingAreaSources.join(',') : null;
356
+ searchComponents.push(
357
+ getGeocodingResults(
358
+ input,
359
+ searchParams,
360
+ language,
361
+ focusPoint,
362
+ feedIds,
363
+ URL_PELIAS,
364
+ minimalRegexp,
365
+ geocodingLayers,
366
+ ).then(results => {
367
+ if (filterResults) {
368
+ return filterResults(results, mode);
369
+ }
370
+ return results;
371
+ }),
372
+ );
373
+ }
374
+ if (allSources || sources.includes('History')) {
375
+ const history = prevSearches(context);
376
+ const dropLayers = [
377
+ 'currentPosition',
378
+ 'selectFromMap',
379
+ 'futureRoute',
380
+ 'ownLocations',
381
+ 'favouritePlace',
382
+ 'bikestation',
383
+ 'bikeRentalStation',
384
+ 'back',
385
+ ];
386
+ dropLayers.push(...routeLayers);
387
+ dropLayers.push(...locationLayers);
388
+ searchComponents.push(getOldSearches(history, input, dropLayers));
389
+ }
390
+ }
343
391
 
344
392
  if (allTargets || targets.includes('Stops')) {
345
393
  if (sources.includes('Favourite')) {
@@ -415,6 +463,7 @@ export function getSearchResults(
415
463
  ];
416
464
  dropLayers.push(...routeLayers);
417
465
  dropLayers.push(...locationLayers);
466
+ dropLayers.push(...parkingLayers);
418
467
  if (transportMode) {
419
468
  if (transportMode !== 'route-CITYBIKE') {
420
469
  dropLayers.push('bikeRentalStation');
@@ -459,6 +508,8 @@ export function getSearchResults(
459
508
  'favouritePlace',
460
509
  'stop',
461
510
  'station',
511
+ 'bikepark',
512
+ 'carpark',
462
513
  'ownLocations',
463
514
  'back',
464
515
  ];
@@ -486,9 +537,8 @@ export function getSearchResults(
486
537
  }
487
538
  if (allSources || sources.includes('Datasource')) {
488
539
  const geocodingLayers = ['bikestation'];
489
- const searchParams = {
490
- size: geocodingSize,
491
- };
540
+ const searchParams =
541
+ geocodingSize && geocodingSize !== 10 ? { size: geocodingSize } : {};
492
542
  searchComponents.push(
493
543
  getGeocodingResults(
494
544
  input,
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.2",
4
4
  "description": "digitransit-search-util execute-search-immidiate module",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -25,8 +25,8 @@
25
25
  "@digitransit-search-util/digitransit-search-util-get-geocoding-results": "0.0.5",
26
26
  "@digitransit-search-util/digitransit-search-util-get-json": "0.0.4",
27
27
  "@digitransit-search-util/digitransit-search-util-helpers": "1.0.3",
28
- "@digitransit-search-util/digitransit-search-util-uniq-by-label": "0.1.1",
28
+ "@digitransit-search-util/digitransit-search-util-uniq-by-label": "^1.0.0",
29
29
  "lodash": "4.17.21"
30
30
  },
31
- "gitHead": "0c3901e4be1733df892f22c266432e442a00fd95"
31
+ "gitHead": "7329304ce6d60ed6a3cf52735c873d2a354043b0"
32
32
  }