From 2ef8bbe6df924db67349f1af88999a52f3b21c89 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 21 Dec 2022 14:47:36 +0100 Subject: [PATCH] db-stations@5, db-stations-autocomplete@4 --- lib/db-stations.js | 5 ++--- package.json | 4 ++-- routes/stations.js | 4 ++-- test/index.js | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/db-stations.js b/lib/db-stations.js index 9773a6c..9e795e6 100644 --- a/lib/db-stations.js +++ b/lib/db-stations.js @@ -2,8 +2,7 @@ import {createRequire} from 'node:module' const require = createRequire(import.meta.url) import {statSync} from 'node:fs' -import _dbStations from 'db-stations' -const {full: readRawStations} = _dbStations +import {readFullStations} from 'db-stations' // We don't have access to the publish date+time of the npm package, // so we use the ctime of db-stations/full.ndjson as an approximation. @@ -12,7 +11,7 @@ const {full: readRawStations} = _dbStations const timeModified = statSync(require.resolve('db-stations/full.ndjson')).ctime const pStations = new Promise((resolve, reject) => { - let raw = readRawStations() + let raw = readFullStations() raw.once('error', reject) let data = Object.create(null) diff --git a/package.json b/package.json index 90034a2..579e369 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "cached-hafas-client": "^5.0.1", "cli-native": "^1.0.0", "db-hafas": "^6.0.0", - "db-stations": "^3.0.0", - "db-stations-autocomplete": "^2.2.0", + "db-stations": "^5.0.0", + "db-stations-autocomplete": "^4.0.0", "etag": "^1.8.1", "hafas-client-health-check": "^2.1.1", "hafas-rest-api": "^5.1.0", diff --git a/routes/stations.js b/routes/stations.js index 3a9eda7..54ec91e 100644 --- a/routes/stations.js +++ b/routes/stations.js @@ -1,9 +1,9 @@ import computeEtag from 'etag' import serveBuffer from 'serve-buffer' -import autocomplete from 'db-stations-autocomplete' +import {autocomplete} from 'db-stations-autocomplete' import _cliNative from 'cli-native' const {to: parse} = _cliNative -import createFilter from 'db-stations/create-filter.js' +import {createFilter} from 'db-stations/create-filter.js' import {pStations} from '../lib/db-stations.js' const JSON_MIME = 'application/json' diff --git a/test/index.js b/test/index.js index b6da33c..b4f7087 100644 --- a/test/index.js +++ b/test/index.js @@ -75,11 +75,11 @@ tape.test('/stations works', async (t) => { } }) -tape.test('/stations?query=frankf works', async (t) => { +tape.test('/stations?query=frankfurt%20ha works', async (t) => { const FRANKFURT_MAIN_HBF = '8000105' { - const {headers, data} = await fetchWithTestApi({}, {}, '/stations?query=frankf', { + const {headers, data} = await fetchWithTestApi({}, {}, '/stations?query=frankfurt%20ha', { headers: { 'accept': 'application/json', }, @@ -92,7 +92,7 @@ tape.test('/stations?query=frankf works', async (t) => { } { - const {headers, data} = await fetchWithTestApi({}, {}, '/stations?query=frankf', { + const {headers, data} = await fetchWithTestApi({}, {}, '/stations?query=frankfurt%20ha', { headers: { 'accept': 'application/x-ndjson', },