gtfs 3.1.4 → 3.2.3
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.
- package/@types/index.d.ts +269 -0
- package/@types/tests.ts +26 -0
- package/@types/tsconfig.json +17 -0
- package/CHANGELOG.md +35 -0
- package/README.md +54 -22
- package/docs/images/node-gtfs-logo.svg +18 -0
- package/lib/db.js +63 -14
- package/lib/export.js +1 -4
- package/lib/gtfs/agencies.js +7 -2
- package/lib/gtfs/attributions.js +7 -2
- package/lib/gtfs/calendar-dates.js +7 -2
- package/lib/gtfs/calendars.js +7 -2
- package/lib/gtfs/fare-attributes.js +7 -2
- package/lib/gtfs/fare-rules.js +7 -2
- package/lib/gtfs/feed-info.js +7 -2
- package/lib/gtfs/frequencies.js +7 -2
- package/lib/gtfs/levels.js +7 -2
- package/lib/gtfs/pathways.js +7 -2
- package/lib/gtfs/routes.js +7 -2
- package/lib/gtfs/shapes.js +16 -11
- package/lib/gtfs/stop-times.js +7 -2
- package/lib/gtfs/stops.js +11 -6
- package/lib/gtfs/transfers.js +7 -2
- package/lib/gtfs/translations.js +7 -2
- package/lib/gtfs/trips.js +7 -2
- package/lib/gtfs-ride/board-alights.js +7 -2
- package/lib/gtfs-ride/ride-feed-infos.js +7 -2
- package/lib/gtfs-ride/rider-trips.js +7 -2
- package/lib/gtfs-ride/riderships.js +7 -2
- package/lib/gtfs-ride/trip-capacities.js +7 -2
- package/lib/import.js +5 -4
- package/lib/non-standard/directions.js +7 -2
- package/lib/non-standard/stop-attributes.js +7 -2
- package/lib/non-standard/timetable-notes-references.js +3 -2
- package/lib/non-standard/timetable-notes.js +7 -2
- package/lib/non-standard/timetable-pages.js +7 -2
- package/lib/non-standard/timetable-stop-order.js +3 -2
- package/lib/non-standard/timetables.js +7 -2
- package/lib/utils.js +4 -1
- package/models/gtfs/agency.js +4 -0
- package/models/gtfs/attributions.js +3 -0
- package/models/gtfs/calendar-dates.js +1 -0
- package/models/gtfs/feed-info.js +3 -0
- package/models/gtfs/levels.js +1 -0
- package/models/gtfs/pathways.js +2 -0
- package/models/gtfs/routes.js +5 -0
- package/models/gtfs/stop-times.js +1 -0
- package/models/gtfs/stops.js +3 -0
- package/models/gtfs/trips.js +2 -0
- package/models/non-standard/stop-attributes.js +1 -0
- package/models/non-standard/timetable-notes.js +1 -0
- package/models/non-standard/timetable-pages.js +1 -0
- package/models/non-standard/timetables.js +2 -0
- package/package.json +20 -15
- package/test/mocha/export-gtfs.js +11 -4
- package/test/mocha/get-agencies.js +9 -3
- package/test/mocha/get-attributions.js +9 -3
- package/test/mocha/get-board-alights.js +9 -3
- package/test/mocha/get-calendar-dates.js +9 -3
- package/test/mocha/get-calendars.js +9 -3
- package/test/mocha/get-db.js +62 -3
- package/test/mocha/get-directions.js +9 -3
- package/test/mocha/get-fare-attributes.js +9 -3
- package/test/mocha/get-fare-rules.js +9 -3
- package/test/mocha/get-feed-info.js +9 -3
- package/test/mocha/get-frequencies.js +9 -3
- package/test/mocha/get-levels.js +3 -3
- package/test/mocha/get-pathways.js +9 -3
- package/test/mocha/get-ride-feed-infos.js +9 -3
- package/test/mocha/get-rider-trips.js +9 -3
- package/test/mocha/get-riderships.js +9 -3
- package/test/mocha/get-routes.js +3 -3
- package/test/mocha/get-shapes-as-geojson.js +9 -3
- package/test/mocha/get-shapes.js +3 -3
- package/test/mocha/get-stop-attributes.js +9 -3
- package/test/mocha/get-stops-as-geojson.js +9 -3
- package/test/mocha/get-stops.js +3 -3
- package/test/mocha/get-stoptimes.js +9 -3
- package/test/mocha/get-timetable-pages.js +9 -3
- package/test/mocha/get-timetable-stop-orders.js +9 -3
- package/test/mocha/get-timetables.js +9 -3
- package/test/mocha/get-transfers.js +9 -3
- package/test/mocha/get-translations.js +9 -3
- package/test/mocha/get-trip-capacities.js +9 -3
- package/test/mocha/get-trips.js +3 -3
- package/test/mocha/import-gtfs.js +4 -4
- package/.prettierrc.js +0 -4
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getRiderTrips,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getRiderTrips():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getRiderTrips():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no rider trips (GTFS-ride)', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getRiderships,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getRiderships():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getRiderships():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no riderships (GTFS-ride)', async () => {
|
package/test/mocha/get-routes.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import { importGtfs, getRoutes } from '../../index.js';
|
|
6
|
+
import { openDb, getDb, closeDb, importGtfs, getRoutes } from '../../index.js';
|
|
8
7
|
|
|
9
8
|
describe('getRoutes():', () => {
|
|
10
9
|
before(async () => {
|
|
@@ -13,7 +12,8 @@ describe('getRoutes():', () => {
|
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
after(async () => {
|
|
16
|
-
|
|
15
|
+
const db = getDb(config);
|
|
16
|
+
await closeDb(db);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('should return empty array if no routes for given agency exist', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getShapesAsGeoJSON,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getShapesAsGeoJSON():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getShapesAsGeoJSON():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return geojson with an empty features array if no shapes exist', async () => {
|
package/test/mocha/get-shapes.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import { importGtfs, getShapes } from '../../index.js';
|
|
6
|
+
import { openDb, getDb, closeDb, importGtfs, getShapes } from '../../index.js';
|
|
8
7
|
|
|
9
8
|
describe('getShapes():', () => {
|
|
10
9
|
before(async () => {
|
|
@@ -13,7 +12,8 @@ describe('getShapes():', () => {
|
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
after(async () => {
|
|
16
|
-
|
|
15
|
+
const db = getDb(config);
|
|
16
|
+
await closeDb(db);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('should return an empty array if no shapes exist', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getStopAttributes,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getStopAttributes():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getStopAttributes():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no stop attributes', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getStopsAsGeoJSON,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getStopsAsGeoJSON(): ', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getStopsAsGeoJSON(): ', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return geojson with an empty features array if no stops exist', async () => {
|
package/test/mocha/get-stops.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import { importGtfs, getStops } from '../../index.js';
|
|
6
|
+
import { openDb, getDb, closeDb, importGtfs, getStops } from '../../index.js';
|
|
8
7
|
|
|
9
8
|
describe('getStops():', () => {
|
|
10
9
|
before(async () => {
|
|
@@ -13,7 +12,8 @@ describe('getStops():', () => {
|
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
after(async () => {
|
|
16
|
-
|
|
15
|
+
const db = getDb(config);
|
|
16
|
+
await closeDb(db);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('should return an empty array if no stops exist', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getStoptimes,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getStoptimes():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getStoptimes():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return an empty array if no stoptimes exist for given agency', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getTimetablePages,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getTimetablePages():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getTimetablePages():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no timetable pages (GTFS-to-HTML timetables)', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getTimetableStopOrders,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getTimetableStopOrders():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getTimetableStopOrders():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no timetable stop orders (GTFS-to-HTML timetables)', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getTimetables,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getTimetables():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getTimetables():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no timetables (GTFS-to-HTML timetables)', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getTransfers,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getTransfers():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getTransfers():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no transfers', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getTranslations,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getTranslations():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getTranslations():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no translations', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getTripCapacities,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getTripCapacities():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getTripCapacities():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no trip capacities (GTFS-ride)', async () => {
|
package/test/mocha/get-trips.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import { importGtfs, getTrips } from '../../index.js';
|
|
6
|
+
import { openDb, getDb, closeDb, importGtfs, getTrips } from '../../index.js';
|
|
8
7
|
|
|
9
8
|
describe('getTrips():', () => {
|
|
10
9
|
before(async () => {
|
|
@@ -13,7 +12,8 @@ describe('getTrips():', () => {
|
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
after(async () => {
|
|
16
|
-
|
|
15
|
+
const db = getDb(config);
|
|
16
|
+
await closeDb(db);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('should return empty array if no trips exist', async () => {
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
import { createReadStream, existsSync } from 'node:fs';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import parse from 'csv-parse';
|
|
7
|
+
import { parse } from 'csv-parse';
|
|
8
8
|
import should from 'should';
|
|
9
9
|
|
|
10
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
11
10
|
import { unzip } from '../../lib/file-utils.js';
|
|
12
11
|
import config from '../test-config.js';
|
|
13
|
-
import { importGtfs, getRoutes } from '../../index.js';
|
|
12
|
+
import { openDb, getDb, closeDb, importGtfs, getRoutes } from '../../index.js';
|
|
14
13
|
import models from '../../models/models.js';
|
|
15
14
|
|
|
16
15
|
let db;
|
|
@@ -36,7 +35,8 @@ describe('importGtfs():', function () {
|
|
|
36
35
|
});
|
|
37
36
|
|
|
38
37
|
after(async () => {
|
|
39
|
-
|
|
38
|
+
const db = getDb(config);
|
|
39
|
+
await closeDb(db);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
this.timeout(10000);
|
package/.prettierrc.js
DELETED