gtfs 4.12.0 → 4.13.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.
- package/README.md +27 -5
- package/dist/bin/gtfs-export.d.ts +1 -0
- package/dist/bin/gtfs-export.js +3646 -0
- package/dist/bin/gtfs-export.js.map +1 -0
- package/dist/bin/gtfs-import.d.ts +1 -0
- package/dist/bin/gtfs-import.js +4146 -0
- package/dist/bin/gtfs-import.js.map +1 -0
- package/dist/bin/gtfsrealtime-update.d.ts +1 -0
- package/dist/bin/gtfsrealtime-update.js +3802 -0
- package/dist/bin/gtfsrealtime-update.js.map +1 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.js +5205 -0
- package/dist/index.js.map +1 -0
- package/package.json +26 -12
- package/.eslintrc.json +0 -28
- package/.github/workflows/nodejs.yml +0 -21
- package/.husky/pre-commit +0 -4
- package/@types/index.d.ts +0 -606
- package/@types/tests.ts +0 -31
- package/@types/tsconfig.json +0 -17
- package/CHANGELOG.md +0 -905
- package/bin/gtfs-export.js +0 -42
- package/bin/gtfs-import.js +0 -52
- package/bin/gtfsrealtime-update.js +0 -35
- package/config-sample-full.json +0 -20
- package/config-sample-rtupdates.json +0 -16
- package/config-sample.json +0 -8
- package/docs/images/node-gtfs-logo.svg +0 -18
- package/index.js +0 -1
- package/lib/advancedQuery.js +0 -36
- package/lib/db.js +0 -92
- package/lib/export.js +0 -141
- package/lib/file-utils.js +0 -103
- package/lib/geojson-utils.js +0 -138
- package/lib/gtfs/agencies.js +0 -32
- package/lib/gtfs/areas.js +0 -27
- package/lib/gtfs/attributions.js +0 -32
- package/lib/gtfs/booking-rules.js +0 -32
- package/lib/gtfs/calendar-dates.js +0 -32
- package/lib/gtfs/calendars.js +0 -32
- package/lib/gtfs/fare-attributes.js +0 -32
- package/lib/gtfs/fare-leg-rules.js +0 -32
- package/lib/gtfs/fare-media.js +0 -32
- package/lib/gtfs/fare-products.js +0 -32
- package/lib/gtfs/fare-rules.js +0 -32
- package/lib/gtfs/fare-transfer-rules.js +0 -32
- package/lib/gtfs/feed-info.js +0 -32
- package/lib/gtfs/frequencies.js +0 -32
- package/lib/gtfs/levels.js +0 -27
- package/lib/gtfs/location-group-stops.js +0 -32
- package/lib/gtfs/location-groups.js +0 -32
- package/lib/gtfs/locations.js +0 -32
- package/lib/gtfs/networks.js +0 -32
- package/lib/gtfs/pathways.js +0 -32
- package/lib/gtfs/route-networks.js +0 -32
- package/lib/gtfs/routes.js +0 -72
- package/lib/gtfs/shapes.js +0 -119
- package/lib/gtfs/stop-areas.js +0 -32
- package/lib/gtfs/stop-times.js +0 -32
- package/lib/gtfs/stops.js +0 -136
- package/lib/gtfs/timeframes.js +0 -32
- package/lib/gtfs/transfers.js +0 -32
- package/lib/gtfs/translations.js +0 -32
- package/lib/gtfs/trips.js +0 -27
- package/lib/gtfs-plus/calendar-attributes.js +0 -32
- package/lib/gtfs-plus/directions.js +0 -32
- package/lib/gtfs-plus/route-attributes.js +0 -32
- package/lib/gtfs-plus/stop-attributes.js +0 -32
- package/lib/gtfs-realtime/service-alerts.js +0 -34
- package/lib/gtfs-realtime/stop-time-updates.js +0 -32
- package/lib/gtfs-realtime/trip-updates.js +0 -32
- package/lib/gtfs-realtime/vehicle-positions.js +0 -32
- package/lib/gtfs-ride/board-alights.js +0 -32
- package/lib/gtfs-ride/ride-feed-infos.js +0 -32
- package/lib/gtfs-ride/rider-trips.js +0 -32
- package/lib/gtfs-ride/riderships.js +0 -32
- package/lib/gtfs-ride/trip-capacities.js +0 -32
- package/lib/gtfs.js +0 -261
- package/lib/import.js +0 -803
- package/lib/log-utils.js +0 -73
- package/lib/non-standard/timetable-notes-references.js +0 -32
- package/lib/non-standard/timetable-notes.js +0 -32
- package/lib/non-standard/timetable-pages.js +0 -32
- package/lib/non-standard/timetable-stop-order.js +0 -32
- package/lib/non-standard/timetables.js +0 -32
- package/lib/non-standard/trips-dated-vehicle-journey.js +0 -32
- package/lib/ods/deadhead-times.js +0 -32
- package/lib/ods/deadheads.js +0 -32
- package/lib/ods/ops-locations.js +0 -32
- package/lib/ods/run-events.js +0 -32
- package/lib/ods/runs-pieces.js +0 -32
- package/lib/utils.js +0 -178
- package/models/gtfs/agency.js +0 -49
- package/models/gtfs/areas.js +0 -19
- package/models/gtfs/attributions.js +0 -68
- package/models/gtfs/booking-rules.js +0 -92
- package/models/gtfs/calendar-dates.js +0 -34
- package/models/gtfs/calendar.js +0 -76
- package/models/gtfs/fare-attributes.js +0 -48
- package/models/gtfs/fare-leg-rules.js +0 -55
- package/models/gtfs/fare-media.js +0 -26
- package/models/gtfs/fare-products.js +0 -35
- package/models/gtfs/fare-rules.js +0 -34
- package/models/gtfs/fare-transfer-rules.js +0 -56
- package/models/gtfs/feed-info.js +0 -50
- package/models/gtfs/frequencies.js +0 -46
- package/models/gtfs/levels.js +0 -25
- package/models/gtfs/location-group-stops.js +0 -22
- package/models/gtfs/location-groups.js +0 -19
- package/models/gtfs/locations.js +0 -12
- package/models/gtfs/networks.js +0 -20
- package/models/gtfs/pathways.js +0 -74
- package/models/gtfs/route-networks.js +0 -21
- package/models/gtfs/routes.js +0 -79
- package/models/gtfs/shapes.js +0 -41
- package/models/gtfs/stop-areas.js +0 -20
- package/models/gtfs/stop-times.js +0 -120
- package/models/gtfs/stops.js +0 -85
- package/models/gtfs/timeframes.js +0 -29
- package/models/gtfs/transfers.js +0 -56
- package/models/gtfs/translations.js +0 -48
- package/models/gtfs/trips.js +0 -70
- package/models/gtfs-plus/calendar-attributes.js +0 -22
- package/models/gtfs-plus/directions.js +0 -29
- package/models/gtfs-plus/route-attributes.js +0 -34
- package/models/gtfs-plus/stop-attributes.js +0 -35
- package/models/gtfs-realtime/service-alert-targets.js +0 -37
- package/models/gtfs-realtime/service-alerts.js +0 -60
- package/models/gtfs-realtime/stop-time-updates.js +0 -85
- package/models/gtfs-realtime/trip-updates.js +0 -75
- package/models/gtfs-realtime/vehicle-positions.js +0 -135
- package/models/gtfs-ride/board-alight.js +0 -132
- package/models/gtfs-ride/ride-feed-info.js +0 -40
- package/models/gtfs-ride/rider-trip.js +0 -113
- package/models/gtfs-ride/ridership.js +0 -127
- package/models/gtfs-ride/trip-capacity.js +0 -51
- package/models/models.js +0 -120
- package/models/non-standard/timetable-notes-references.js +0 -50
- package/models/non-standard/timetable-notes.js +0 -24
- package/models/non-standard/timetable-pages.js +0 -23
- package/models/non-standard/timetable-stop-order.js +0 -32
- package/models/non-standard/timetables.js +0 -144
- package/models/non-standard/trips-dated-vehicle-journey.js +0 -34
- package/models/ods/deadhead-times.js +0 -65
- package/models/ods/deadheads.js +0 -60
- package/models/ods/ops-locations.js +0 -46
- package/models/ods/run-events.js +0 -70
- package/models/ods/runs-pieces.js +0 -59
- package/test/fixture/caltrain_20160406.zip +0 -0
- package/test/mocha/advanced-query.js +0 -74
- package/test/mocha/delete-db.js +0 -62
- package/test/mocha/export-gtfs.js +0 -147
- package/test/mocha/fare-transfer-rules.js +0 -32
- package/test/mocha/get-agencies.js +0 -90
- package/test/mocha/get-areas.js +0 -27
- package/test/mocha/get-attributions.js +0 -27
- package/test/mocha/get-board-alights.js +0 -28
- package/test/mocha/get-booking-rules.js +0 -28
- package/test/mocha/get-calendar-attributes.js +0 -33
- package/test/mocha/get-calendar-dates.js +0 -107
- package/test/mocha/get-calendars.js +0 -94
- package/test/mocha/get-directions.js +0 -28
- package/test/mocha/get-fare-attributes.js +0 -51
- package/test/mocha/get-fare-leg-rules.js +0 -27
- package/test/mocha/get-fare-media.js +0 -27
- package/test/mocha/get-fare-products.js +0 -27
- package/test/mocha/get-fare-rules.js +0 -50
- package/test/mocha/get-feed-info.js +0 -28
- package/test/mocha/get-frequencies.js +0 -28
- package/test/mocha/get-levels.js +0 -28
- package/test/mocha/get-location-group-stops.js +0 -33
- package/test/mocha/get-location-groups.js +0 -28
- package/test/mocha/get-locations.js +0 -69
- package/test/mocha/get-networks.js +0 -28
- package/test/mocha/get-pathways.js +0 -28
- package/test/mocha/get-ride-feed-infos.js +0 -24
- package/test/mocha/get-rider-trips.js +0 -28
- package/test/mocha/get-riderships.js +0 -28
- package/test/mocha/get-route-attributes.js +0 -33
- package/test/mocha/get-route-networks.js +0 -28
- package/test/mocha/get-routes.js +0 -143
- package/test/mocha/get-shapes-as-geojson.js +0 -92
- package/test/mocha/get-shapes.js +0 -240
- package/test/mocha/get-stop-attributes.js +0 -28
- package/test/mocha/get-stops-as-geojson.js +0 -87
- package/test/mocha/get-stops.js +0 -343
- package/test/mocha/get-stoptimes.js +0 -67
- package/test/mocha/get-timeframes.js +0 -28
- package/test/mocha/get-timetable-pages.js +0 -28
- package/test/mocha/get-timetable-stop-orders.js +0 -33
- package/test/mocha/get-timetables.js +0 -28
- package/test/mocha/get-transfers.js +0 -28
- package/test/mocha/get-translations.js +0 -28
- package/test/mocha/get-trip-capacities.js +0 -28
- package/test/mocha/get-trips.js +0 -53
- package/test/mocha/import-gtfs.js +0 -173
- package/test/mocha/open-db.js +0 -149
- package/test/mocha/raw-query.js +0 -34
- package/test/test-config.js +0 -12
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import directions from '../../models/gtfs-plus/directions.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all directions that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getDirections(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(directions.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import routeAttributes from '../../models/gtfs-plus/route-attributes.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all route_attributes that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getRouteAttributes(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(routeAttributes.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import stopAttributes from '../../models/gtfs-plus/stop-attributes.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all stop attributes that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getStopAttributes(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(stopAttributes.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import serviceAlerts from '../../models/gtfs-realtime/service-alerts.js';
|
|
11
|
-
import serviceAlertTargets from '../../models/gtfs-realtime/service-alert-targets.js';
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
* Returns an array of all service alerts that match the query parameters.
|
|
15
|
-
*/
|
|
16
|
-
export function getServiceAlerts(
|
|
17
|
-
query = {},
|
|
18
|
-
fields = [],
|
|
19
|
-
orderBy = [],
|
|
20
|
-
options = {},
|
|
21
|
-
) {
|
|
22
|
-
const db = options.db ?? openDb();
|
|
23
|
-
const tableName = sqlString.escapeId(serviceAlerts.filenameBase);
|
|
24
|
-
const joinTable = sqlString.escapeId(serviceAlertTargets.filenameBase);
|
|
25
|
-
const selectClause = formatSelectClause(fields);
|
|
26
|
-
const whereClause = formatWhereClauses(query);
|
|
27
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
28
|
-
|
|
29
|
-
return db
|
|
30
|
-
.prepare(
|
|
31
|
-
`${selectClause} FROM ${tableName} INNER JOIN ${joinTable} ON ${tableName}.id=${joinTable}.alert_id ${whereClause} ${orderByClause};`,
|
|
32
|
-
)
|
|
33
|
-
.all();
|
|
34
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import stopTimeUpdates from '../../models/gtfs-realtime/stop-time-updates.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all stop time updates that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getStopTimeUpdates(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(stopTimeUpdates.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import tripUpdates from '../../models/gtfs-realtime/trip-updates.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all trip updates that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getTripUpdates(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(tripUpdates.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import vehiclePositions from '../../models/gtfs-realtime/vehicle-positions.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all vehicle positions that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getVehiclePositions(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(vehiclePositions.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import boardAlights from '../../models/gtfs-ride/board-alight.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all board-alights that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getBoardAlights(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(boardAlights.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import rideFeedInfo from '../../models/gtfs-ride/ride-feed-info.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all ride-feed-info that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getRideFeedInfos(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(rideFeedInfo.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import riderTrip from '../../models/gtfs-ride/rider-trip.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all rider trips that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getRiderTrips(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(riderTrip.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import riderships from '../../models/gtfs-ride/ridership.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all riderships that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getRiderships(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(riderships.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sqlString from 'sqlstring-sqlite';
|
|
2
|
-
|
|
3
|
-
import { openDb } from '../db.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
formatOrderByClause,
|
|
7
|
-
formatSelectClause,
|
|
8
|
-
formatWhereClauses,
|
|
9
|
-
} from '../utils.js';
|
|
10
|
-
import tripCapacity from '../../models/gtfs-ride/trip-capacity.js';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Returns an array of all trip-capacities that match the query parameters.
|
|
14
|
-
*/
|
|
15
|
-
export function getTripCapacities(
|
|
16
|
-
query = {},
|
|
17
|
-
fields = [],
|
|
18
|
-
orderBy = [],
|
|
19
|
-
options = {},
|
|
20
|
-
) {
|
|
21
|
-
const db = options.db ?? openDb();
|
|
22
|
-
const tableName = sqlString.escapeId(tripCapacity.filenameBase);
|
|
23
|
-
const selectClause = formatSelectClause(fields);
|
|
24
|
-
const whereClause = formatWhereClauses(query);
|
|
25
|
-
const orderByClause = formatOrderByClause(orderBy);
|
|
26
|
-
|
|
27
|
-
return db
|
|
28
|
-
.prepare(
|
|
29
|
-
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`,
|
|
30
|
-
)
|
|
31
|
-
.all();
|
|
32
|
-
}
|
package/lib/gtfs.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
// GTFS import script
|
|
2
|
-
import { importGtfs, updateGtfsRealtime } from './import.js';
|
|
3
|
-
|
|
4
|
-
// GTFS export script
|
|
5
|
-
import exportGtfs from './export.js';
|
|
6
|
-
|
|
7
|
-
// Standard GTFS Filenames
|
|
8
|
-
import { getAgencies } from './gtfs/agencies.js';
|
|
9
|
-
import { getAreas } from './gtfs/areas.js';
|
|
10
|
-
import { getAttributions } from './gtfs/attributions.js';
|
|
11
|
-
import { getBookingRules } from './gtfs/booking-rules.js';
|
|
12
|
-
import { getCalendarDates } from './gtfs/calendar-dates.js';
|
|
13
|
-
import { getCalendars } from './gtfs/calendars.js';
|
|
14
|
-
import { getFareAttributes } from './gtfs/fare-attributes.js';
|
|
15
|
-
import { getFareLegRules } from './gtfs/fare-leg-rules.js';
|
|
16
|
-
import { getFareMedia } from './gtfs/fare-media.js';
|
|
17
|
-
import { getFareProducts } from './gtfs/fare-products.js';
|
|
18
|
-
import { getFareRules } from './gtfs/fare-rules.js';
|
|
19
|
-
import { getFareTransferRules } from './gtfs/fare-transfer-rules.js';
|
|
20
|
-
import { getFeedInfo } from './gtfs/feed-info.js';
|
|
21
|
-
import { getFrequencies } from './gtfs/frequencies.js';
|
|
22
|
-
import { getLevels } from './gtfs/levels.js';
|
|
23
|
-
import { getLocationGroups } from './gtfs/location-groups.js';
|
|
24
|
-
import { getLocationGroupStops } from './gtfs/location-group-stops.js';
|
|
25
|
-
import { getLocations } from './gtfs/locations.js';
|
|
26
|
-
import { getNetworks } from './gtfs/networks.js';
|
|
27
|
-
import { getPathways } from './gtfs/pathways.js';
|
|
28
|
-
import { getRouteNetworks } from './gtfs/route-networks.js';
|
|
29
|
-
import { getRoutes } from './gtfs/routes.js';
|
|
30
|
-
import { getShapes, getShapesAsGeoJSON } from './gtfs/shapes.js';
|
|
31
|
-
import { getStopAreas } from './gtfs/stop-areas.js';
|
|
32
|
-
import { getStops, getStopsAsGeoJSON } from './gtfs/stops.js';
|
|
33
|
-
import { getStoptimes } from './gtfs/stop-times.js';
|
|
34
|
-
import { getTimeframes } from './gtfs/timeframes.js';
|
|
35
|
-
import { getTransfers } from './gtfs/transfers.js';
|
|
36
|
-
import { getTranslations } from './gtfs/translations.js';
|
|
37
|
-
import { getTrips } from './gtfs/trips.js';
|
|
38
|
-
|
|
39
|
-
// GTFS Plus Filenames
|
|
40
|
-
import { getCalendarAttributes } from './gtfs-plus/calendar-attributes.js';
|
|
41
|
-
import { getDirections } from './gtfs-plus/directions.js';
|
|
42
|
-
import { getRouteAttributes } from './gtfs-plus/route-attributes.js';
|
|
43
|
-
import { getStopAttributes } from './gtfs-plus/stop-attributes.js';
|
|
44
|
-
|
|
45
|
-
// Non-standard GTFS Filenames
|
|
46
|
-
import { getTimetables } from './non-standard/timetables.js';
|
|
47
|
-
import { getTimetableStopOrders } from './non-standard/timetable-stop-order.js';
|
|
48
|
-
import { getTimetablePages } from './non-standard/timetable-pages.js';
|
|
49
|
-
import { getTimetableNotes } from './non-standard/timetable-notes.js';
|
|
50
|
-
import { getTimetableNotesReferences } from './non-standard/timetable-notes-references.js';
|
|
51
|
-
import { getTripsDatedVehicleJourneys } from './non-standard/trips-dated-vehicle-journey.js';
|
|
52
|
-
|
|
53
|
-
// GTFS-ride Filenames
|
|
54
|
-
import { getBoardAlights } from './gtfs-ride/board-alights.js';
|
|
55
|
-
import { getRideFeedInfos } from './gtfs-ride/ride-feed-infos.js';
|
|
56
|
-
import { getRiderTrips } from './gtfs-ride/rider-trips.js';
|
|
57
|
-
import { getRiderships } from './gtfs-ride/riderships.js';
|
|
58
|
-
import { getTripCapacities } from './gtfs-ride/trip-capacities.js';
|
|
59
|
-
|
|
60
|
-
// GTFS-Realtime Filenames
|
|
61
|
-
import { getStopTimeUpdates } from './gtfs-realtime/stop-time-updates.js';
|
|
62
|
-
import { getTripUpdates } from './gtfs-realtime/trip-updates.js';
|
|
63
|
-
import { getVehiclePositions } from './gtfs-realtime/vehicle-positions.js';
|
|
64
|
-
import { getServiceAlerts } from './gtfs-realtime/service-alerts.js';
|
|
65
|
-
|
|
66
|
-
// ODS Filenames
|
|
67
|
-
import { getDeadheads } from './ods/deadheads.js';
|
|
68
|
-
import { getDeadheadTimes } from './ods/deadhead-times.js';
|
|
69
|
-
import { getOpsLocations } from './ods/ops-locations.js';
|
|
70
|
-
import { getRunEvents } from './ods/run-events.js';
|
|
71
|
-
import { getRunsPieces } from './ods/runs-pieces.js';
|
|
72
|
-
|
|
73
|
-
// Expose database connection
|
|
74
|
-
import { deleteDb, openDb, closeDb } from './db.js';
|
|
75
|
-
|
|
76
|
-
// Advanced Query
|
|
77
|
-
import { advancedQuery } from './advancedQuery.js';
|
|
78
|
-
|
|
79
|
-
const _importGtfs = importGtfs;
|
|
80
|
-
export { _importGtfs as importGtfs };
|
|
81
|
-
const _exportGtfs = exportGtfs;
|
|
82
|
-
export { _exportGtfs as exportGtfs };
|
|
83
|
-
|
|
84
|
-
const _getAgencies = getAgencies;
|
|
85
|
-
export { _getAgencies as getAgencies };
|
|
86
|
-
|
|
87
|
-
const _getAreas = getAreas;
|
|
88
|
-
export { _getAreas as getAreas };
|
|
89
|
-
|
|
90
|
-
const _getAttributions = getAttributions;
|
|
91
|
-
export { _getAttributions as getAttributions };
|
|
92
|
-
|
|
93
|
-
const _getBookingRules = getBookingRules;
|
|
94
|
-
export { _getBookingRules as getBookingRules };
|
|
95
|
-
|
|
96
|
-
const _getCalendarDates = getCalendarDates;
|
|
97
|
-
export { _getCalendarDates as getCalendarDates };
|
|
98
|
-
|
|
99
|
-
const _getCalendars = getCalendars;
|
|
100
|
-
export { _getCalendars as getCalendars };
|
|
101
|
-
|
|
102
|
-
const _getFareAttributes = getFareAttributes;
|
|
103
|
-
export { _getFareAttributes as getFareAttributes };
|
|
104
|
-
|
|
105
|
-
const _getFareLegRules = getFareLegRules;
|
|
106
|
-
export { _getFareLegRules as getFareLegRules };
|
|
107
|
-
|
|
108
|
-
const _getFareMedia = getFareMedia;
|
|
109
|
-
export { _getFareMedia as getFareMedia };
|
|
110
|
-
|
|
111
|
-
const _getFareProducts = getFareProducts;
|
|
112
|
-
export { _getFareProducts as getFareProducts };
|
|
113
|
-
|
|
114
|
-
const _getFareRules = getFareRules;
|
|
115
|
-
export { _getFareRules as getFareRules };
|
|
116
|
-
|
|
117
|
-
const _getFareTransferRules = getFareTransferRules;
|
|
118
|
-
export { _getFareTransferRules as getFareTransferRules };
|
|
119
|
-
|
|
120
|
-
const _getFeedInfo = getFeedInfo;
|
|
121
|
-
export { _getFeedInfo as getFeedInfo };
|
|
122
|
-
|
|
123
|
-
const _getFrequencies = getFrequencies;
|
|
124
|
-
export { _getFrequencies as getFrequencies };
|
|
125
|
-
|
|
126
|
-
const _getLevels = getLevels;
|
|
127
|
-
export { _getLevels as getLevels };
|
|
128
|
-
|
|
129
|
-
const _getLocationGroups = getLocationGroups;
|
|
130
|
-
export { _getLocationGroups as getLocationGroups };
|
|
131
|
-
|
|
132
|
-
const _getLocationGroupStops = getLocationGroupStops;
|
|
133
|
-
export { _getLocationGroupStops as getLocationGroupStops };
|
|
134
|
-
|
|
135
|
-
const _getLocations = getLocations;
|
|
136
|
-
export { _getLocations as getLocations };
|
|
137
|
-
|
|
138
|
-
const _getNetworks = getNetworks;
|
|
139
|
-
export { _getNetworks as getNetworks };
|
|
140
|
-
|
|
141
|
-
const _getPathways = getPathways;
|
|
142
|
-
export { _getPathways as getPathways };
|
|
143
|
-
|
|
144
|
-
const _getRouteNetworks = getRouteNetworks;
|
|
145
|
-
export { _getRouteNetworks as getRouteNetworks };
|
|
146
|
-
|
|
147
|
-
const _getRoutes = getRoutes;
|
|
148
|
-
export { _getRoutes as getRoutes };
|
|
149
|
-
|
|
150
|
-
const _getShapes = getShapes;
|
|
151
|
-
export { _getShapes as getShapes };
|
|
152
|
-
const _getShapesAsGeoJSON = getShapesAsGeoJSON;
|
|
153
|
-
export { _getShapesAsGeoJSON as getShapesAsGeoJSON };
|
|
154
|
-
|
|
155
|
-
const _getStopAreas = getStopAreas;
|
|
156
|
-
export { _getStopAreas as getStopAreas };
|
|
157
|
-
|
|
158
|
-
const _getStops = getStops;
|
|
159
|
-
export { _getStops as getStops };
|
|
160
|
-
const _getStopsAsGeoJSON = getStopsAsGeoJSON;
|
|
161
|
-
export { _getStopsAsGeoJSON as getStopsAsGeoJSON };
|
|
162
|
-
|
|
163
|
-
const _getStoptimes = getStoptimes;
|
|
164
|
-
export { _getStoptimes as getStoptimes };
|
|
165
|
-
|
|
166
|
-
const _getTimeframes = getTimeframes;
|
|
167
|
-
export { _getTimeframes as getTimeframes };
|
|
168
|
-
|
|
169
|
-
const _getTransfers = getTransfers;
|
|
170
|
-
export { _getTransfers as getTransfers };
|
|
171
|
-
|
|
172
|
-
const _getTrips = getTrips;
|
|
173
|
-
export { _getTrips as getTrips };
|
|
174
|
-
|
|
175
|
-
const _getTranslations = getTranslations;
|
|
176
|
-
export { _getTranslations as getTranslations };
|
|
177
|
-
|
|
178
|
-
const _getCalendarAttributes = getCalendarAttributes;
|
|
179
|
-
export { _getCalendarAttributes as getCalendarAttributes };
|
|
180
|
-
|
|
181
|
-
const _getDirections = getDirections;
|
|
182
|
-
export { _getDirections as getDirections };
|
|
183
|
-
|
|
184
|
-
const _getRouteAttributes = getRouteAttributes;
|
|
185
|
-
export { _getRouteAttributes as getRouteAttributes };
|
|
186
|
-
|
|
187
|
-
const _getStopAttributes = getStopAttributes;
|
|
188
|
-
export { _getStopAttributes as getStopAttributes };
|
|
189
|
-
|
|
190
|
-
const _getTimetables = getTimetables;
|
|
191
|
-
export { _getTimetables as getTimetables };
|
|
192
|
-
|
|
193
|
-
const _getTimetableStopOrders = getTimetableStopOrders;
|
|
194
|
-
export { _getTimetableStopOrders as getTimetableStopOrders };
|
|
195
|
-
|
|
196
|
-
const _getTimetablePages = getTimetablePages;
|
|
197
|
-
export { _getTimetablePages as getTimetablePages };
|
|
198
|
-
|
|
199
|
-
const _getTimetableNotes = getTimetableNotes;
|
|
200
|
-
export { _getTimetableNotes as getTimetableNotes };
|
|
201
|
-
|
|
202
|
-
const _getTimetableNotesReferences = getTimetableNotesReferences;
|
|
203
|
-
export { _getTimetableNotesReferences as getTimetableNotesReferences };
|
|
204
|
-
|
|
205
|
-
const _getTripsDatedVehicleJourneys = getTripsDatedVehicleJourneys;
|
|
206
|
-
export { _getTripsDatedVehicleJourneys as getTripsDatedVehicleJourneys };
|
|
207
|
-
|
|
208
|
-
const _getBoardAlights = getBoardAlights;
|
|
209
|
-
export { _getBoardAlights as getBoardAlights };
|
|
210
|
-
|
|
211
|
-
const _getRideFeedInfos = getRideFeedInfos;
|
|
212
|
-
export { _getRideFeedInfos as getRideFeedInfos };
|
|
213
|
-
|
|
214
|
-
const _getRiderTrips = getRiderTrips;
|
|
215
|
-
export { _getRiderTrips as getRiderTrips };
|
|
216
|
-
|
|
217
|
-
const _getRiderships = getRiderships;
|
|
218
|
-
export { _getRiderships as getRiderships };
|
|
219
|
-
|
|
220
|
-
const _getTripCapacities = getTripCapacities;
|
|
221
|
-
export { _getTripCapacities as getTripCapacities };
|
|
222
|
-
|
|
223
|
-
const _updateGtfsRealtime = updateGtfsRealtime;
|
|
224
|
-
export { _updateGtfsRealtime as updateGtfsRealtime };
|
|
225
|
-
|
|
226
|
-
const _getStopTimeUpdates = getStopTimeUpdates;
|
|
227
|
-
export { _getStopTimeUpdates as getStopTimeUpdates };
|
|
228
|
-
|
|
229
|
-
const _getTripUpdates = getTripUpdates;
|
|
230
|
-
export { _getTripUpdates as getTripUpdates };
|
|
231
|
-
|
|
232
|
-
const _getVehiclePositions = getVehiclePositions;
|
|
233
|
-
export { _getVehiclePositions as getVehiclePositions };
|
|
234
|
-
|
|
235
|
-
const _getServiceAlerts = getServiceAlerts;
|
|
236
|
-
export { _getServiceAlerts as getServiceAlerts };
|
|
237
|
-
|
|
238
|
-
const _getDeadheads = getDeadheads;
|
|
239
|
-
export { _getDeadheads as getDeadheads };
|
|
240
|
-
|
|
241
|
-
const _getDeadheadTimes = getDeadheadTimes;
|
|
242
|
-
export { _getDeadheadTimes as getDeadheadTimes };
|
|
243
|
-
|
|
244
|
-
const _getOpsLocations = getOpsLocations;
|
|
245
|
-
export { _getOpsLocations as getOpsLocations };
|
|
246
|
-
|
|
247
|
-
const _getRunEvents = getRunEvents;
|
|
248
|
-
export { _getRunEvents as getRunEvents };
|
|
249
|
-
|
|
250
|
-
const _getRunsPieces = getRunsPieces;
|
|
251
|
-
export { _getRunsPieces as getRunsPieces };
|
|
252
|
-
|
|
253
|
-
const _openDb = openDb;
|
|
254
|
-
export { _openDb as openDb };
|
|
255
|
-
const _closeDb = closeDb;
|
|
256
|
-
export { _closeDb as closeDb };
|
|
257
|
-
const _deleteDb = deleteDb;
|
|
258
|
-
export { _deleteDb as deleteDb };
|
|
259
|
-
|
|
260
|
-
const _advancedQuery = advancedQuery;
|
|
261
|
-
export { _advancedQuery as advancedQuery };
|