gtfs 3.1.4 → 3.2.0

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 (73) hide show
  1. package/@types/index.d.ts +269 -0
  2. package/@types/tests.ts +26 -0
  3. package/@types/tsconfig.json +17 -0
  4. package/CHANGELOG.md +12 -0
  5. package/README.md +54 -22
  6. package/docs/images/node-gtfs-logo.svg +18 -0
  7. package/lib/db.js +62 -13
  8. package/lib/export.js +1 -4
  9. package/lib/gtfs/agencies.js +7 -2
  10. package/lib/gtfs/attributions.js +7 -2
  11. package/lib/gtfs/calendar-dates.js +7 -2
  12. package/lib/gtfs/calendars.js +7 -2
  13. package/lib/gtfs/fare-attributes.js +7 -2
  14. package/lib/gtfs/fare-rules.js +7 -2
  15. package/lib/gtfs/feed-info.js +7 -2
  16. package/lib/gtfs/frequencies.js +7 -2
  17. package/lib/gtfs/levels.js +7 -2
  18. package/lib/gtfs/pathways.js +7 -2
  19. package/lib/gtfs/routes.js +7 -2
  20. package/lib/gtfs/shapes.js +16 -11
  21. package/lib/gtfs/stop-times.js +7 -2
  22. package/lib/gtfs/stops.js +11 -6
  23. package/lib/gtfs/transfers.js +7 -2
  24. package/lib/gtfs/translations.js +7 -2
  25. package/lib/gtfs/trips.js +7 -2
  26. package/lib/gtfs-ride/board-alights.js +7 -2
  27. package/lib/gtfs-ride/ride-feed-infos.js +7 -2
  28. package/lib/gtfs-ride/rider-trips.js +7 -2
  29. package/lib/gtfs-ride/riderships.js +7 -2
  30. package/lib/gtfs-ride/trip-capacities.js +7 -2
  31. package/lib/import.js +3 -3
  32. package/lib/non-standard/directions.js +7 -2
  33. package/lib/non-standard/stop-attributes.js +7 -2
  34. package/lib/non-standard/timetable-notes-references.js +3 -2
  35. package/lib/non-standard/timetable-notes.js +7 -2
  36. package/lib/non-standard/timetable-pages.js +7 -2
  37. package/lib/non-standard/timetable-stop-order.js +3 -2
  38. package/lib/non-standard/timetables.js +7 -2
  39. package/lib/utils.js +4 -1
  40. package/package.json +14 -10
  41. package/test/mocha/export-gtfs.js +11 -4
  42. package/test/mocha/get-agencies.js +9 -3
  43. package/test/mocha/get-attributions.js +9 -3
  44. package/test/mocha/get-board-alights.js +9 -3
  45. package/test/mocha/get-calendar-dates.js +9 -3
  46. package/test/mocha/get-calendars.js +9 -3
  47. package/test/mocha/get-db.js +62 -3
  48. package/test/mocha/get-directions.js +9 -3
  49. package/test/mocha/get-fare-attributes.js +9 -3
  50. package/test/mocha/get-fare-rules.js +9 -3
  51. package/test/mocha/get-feed-info.js +9 -3
  52. package/test/mocha/get-frequencies.js +9 -3
  53. package/test/mocha/get-levels.js +3 -3
  54. package/test/mocha/get-pathways.js +9 -3
  55. package/test/mocha/get-ride-feed-infos.js +9 -3
  56. package/test/mocha/get-rider-trips.js +9 -3
  57. package/test/mocha/get-riderships.js +9 -3
  58. package/test/mocha/get-routes.js +3 -3
  59. package/test/mocha/get-shapes-as-geojson.js +9 -3
  60. package/test/mocha/get-shapes.js +3 -3
  61. package/test/mocha/get-stop-attributes.js +9 -3
  62. package/test/mocha/get-stops-as-geojson.js +9 -3
  63. package/test/mocha/get-stops.js +3 -3
  64. package/test/mocha/get-stoptimes.js +9 -3
  65. package/test/mocha/get-timetable-pages.js +9 -3
  66. package/test/mocha/get-timetable-stop-orders.js +9 -3
  67. package/test/mocha/get-timetables.js +9 -3
  68. package/test/mocha/get-transfers.js +9 -3
  69. package/test/mocha/get-translations.js +9 -3
  70. package/test/mocha/get-trip-capacities.js +9 -3
  71. package/test/mocha/get-trips.js +3 -3
  72. package/test/mocha/import-gtfs.js +4 -4
  73. 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 { importGtfs, getTimetableStopOrders } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getTimetables } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getTransfers } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getTranslations } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getTripCapacities } from '../../index.js';
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
- await closeDb();
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 () => {
@@ -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
- await closeDb();
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
- await closeDb();
38
+ const db = getDb(config);
39
+ await closeDb(db);
40
40
  });
41
41
 
42
42
  this.timeout(10000);
package/.prettierrc.js DELETED
@@ -1,4 +0,0 @@
1
- export default config = {
2
- singleQuote: true,
3
- arrowParens: 'avoid',
4
- };