db-stations@5, db-stations-autocomplete@4
This commit is contained in:
parent
04543f0146
commit
2ef8bbe6df
4 changed files with 9 additions and 10 deletions
|
@ -2,8 +2,7 @@ import {createRequire} from 'node:module'
|
||||||
const require = createRequire(import.meta.url)
|
const require = createRequire(import.meta.url)
|
||||||
|
|
||||||
import {statSync} from 'node:fs'
|
import {statSync} from 'node:fs'
|
||||||
import _dbStations from 'db-stations'
|
import {readFullStations} from 'db-stations'
|
||||||
const {full: readRawStations} = _dbStations
|
|
||||||
|
|
||||||
// We don't have access to the publish date+time of the npm package,
|
// 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.
|
// 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 timeModified = statSync(require.resolve('db-stations/full.ndjson')).ctime
|
||||||
|
|
||||||
const pStations = new Promise((resolve, reject) => {
|
const pStations = new Promise((resolve, reject) => {
|
||||||
let raw = readRawStations()
|
let raw = readFullStations()
|
||||||
raw.once('error', reject)
|
raw.once('error', reject)
|
||||||
|
|
||||||
let data = Object.create(null)
|
let data = Object.create(null)
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
"cached-hafas-client": "^5.0.1",
|
"cached-hafas-client": "^5.0.1",
|
||||||
"cli-native": "^1.0.0",
|
"cli-native": "^1.0.0",
|
||||||
"db-hafas": "^6.0.0",
|
"db-hafas": "^6.0.0",
|
||||||
"db-stations": "^3.0.0",
|
"db-stations": "^5.0.0",
|
||||||
"db-stations-autocomplete": "^2.2.0",
|
"db-stations-autocomplete": "^4.0.0",
|
||||||
"etag": "^1.8.1",
|
"etag": "^1.8.1",
|
||||||
"hafas-client-health-check": "^2.1.1",
|
"hafas-client-health-check": "^2.1.1",
|
||||||
"hafas-rest-api": "^5.1.0",
|
"hafas-rest-api": "^5.1.0",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import computeEtag from 'etag'
|
import computeEtag from 'etag'
|
||||||
import serveBuffer from 'serve-buffer'
|
import serveBuffer from 'serve-buffer'
|
||||||
import autocomplete from 'db-stations-autocomplete'
|
import {autocomplete} from 'db-stations-autocomplete'
|
||||||
import _cliNative from 'cli-native'
|
import _cliNative from 'cli-native'
|
||||||
const {to: parse} = _cliNative
|
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'
|
import {pStations} from '../lib/db-stations.js'
|
||||||
|
|
||||||
const JSON_MIME = 'application/json'
|
const JSON_MIME = 'application/json'
|
||||||
|
|
|
@ -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 FRANKFURT_MAIN_HBF = '8000105'
|
||||||
|
|
||||||
{
|
{
|
||||||
const {headers, data} = await fetchWithTestApi({}, {}, '/stations?query=frankf', {
|
const {headers, data} = await fetchWithTestApi({}, {}, '/stations?query=frankfurt%20ha', {
|
||||||
headers: {
|
headers: {
|
||||||
'accept': 'application/json',
|
'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: {
|
headers: {
|
||||||
'accept': 'application/x-ndjson',
|
'accept': 'application/x-ndjson',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue