db-stations@5, db-stations-autocomplete@4

This commit is contained in:
Jannis R 2022-12-21 14:47:36 +01:00
parent 04543f0146
commit 2ef8bbe6df
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
4 changed files with 9 additions and 10 deletions

View file

@ -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)

View file

@ -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",

View file

@ -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'

View file

@ -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',
},