gtfs 3.1.3 → 3.2.2
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/.eslintrc.json +14 -19
- package/.husky/pre-commit +4 -0
- package/@types/index.d.ts +269 -0
- package/@types/tests.ts +26 -0
- package/@types/tsconfig.json +17 -0
- package/CHANGELOG.md +181 -0
- package/README.md +168 -149
- package/bin/gtfs-export.js +4 -5
- package/bin/gtfs-import.js +6 -7
- package/config-sample-full.json +2 -7
- package/docs/images/node-gtfs-logo.svg +18 -0
- package/lib/db.js +64 -13
- package/lib/export.js +27 -13
- package/lib/file-utils.js +26 -9
- package/lib/geojson-utils.js +51 -38
- package/lib/gtfs/agencies.js +15 -4
- package/lib/gtfs/attributions.js +15 -4
- package/lib/gtfs/calendar-dates.js +15 -4
- package/lib/gtfs/calendars.js +15 -4
- package/lib/gtfs/fare-attributes.js +15 -4
- package/lib/gtfs/fare-rules.js +15 -4
- package/lib/gtfs/feed-info.js +15 -4
- package/lib/gtfs/frequencies.js +15 -4
- package/lib/gtfs/levels.js +15 -4
- package/lib/gtfs/pathways.js +15 -4
- package/lib/gtfs/routes.js +22 -6
- package/lib/gtfs/shapes.js +59 -23
- package/lib/gtfs/stop-times.js +15 -4
- package/lib/gtfs/stops.js +57 -23
- package/lib/gtfs/transfers.js +15 -4
- package/lib/gtfs/translations.js +15 -4
- package/lib/gtfs/trips.js +15 -4
- package/lib/gtfs-ride/board-alights.js +15 -4
- package/lib/gtfs-ride/ride-feed-infos.js +15 -4
- package/lib/gtfs-ride/rider-trips.js +15 -4
- package/lib/gtfs-ride/riderships.js +15 -4
- package/lib/gtfs-ride/trip-capacities.js +15 -4
- package/lib/import.js +201 -126
- package/lib/log-utils.js +8 -4
- package/lib/non-standard/directions.js +15 -4
- package/lib/non-standard/stop-attributes.js +15 -4
- package/lib/non-standard/timetable-notes-references.js +15 -4
- package/lib/non-standard/timetable-notes.js +15 -4
- package/lib/non-standard/timetable-pages.js +15 -4
- package/lib/non-standard/timetable-stop-order.js +15 -4
- package/lib/non-standard/timetables.js +15 -4
- package/lib/utils.js +26 -12
- package/models/gtfs/agency.js +11 -11
- package/models/gtfs/attributions.js +14 -14
- package/models/gtfs/calendar-dates.js +7 -7
- package/models/gtfs/calendar.js +12 -12
- package/models/gtfs/fare-attributes.js +9 -9
- package/models/gtfs/fare-rules.js +8 -8
- package/models/gtfs/feed-info.js +12 -12
- package/models/gtfs/frequencies.js +10 -10
- package/models/gtfs/levels.js +5 -5
- package/models/gtfs/pathways.js +14 -14
- package/models/gtfs/routes.js +14 -14
- package/models/gtfs/shapes.js +8 -8
- package/models/gtfs/stop-times.js +17 -17
- package/models/gtfs/stops.js +17 -17
- package/models/gtfs/transfers.js +7 -7
- package/models/gtfs/translations.js +10 -10
- package/models/gtfs/trips.js +12 -12
- package/models/gtfs-ride/board-alight.js +24 -24
- package/models/gtfs-ride/ride-feed-info.js +8 -8
- package/models/gtfs-ride/rider-trip.js +21 -21
- package/models/gtfs-ride/ridership.js +23 -23
- package/models/gtfs-ride/trip-capacity.js +10 -10
- package/models/models.js +1 -1
- package/models/non-standard/directions.js +6 -6
- package/models/non-standard/stop-attributes.js +5 -5
- package/models/non-standard/timetable-notes-references.js +9 -9
- package/models/non-standard/timetable-notes.js +5 -5
- package/models/non-standard/timetable-pages.js +5 -5
- package/models/non-standard/timetable-stop-order.js +6 -6
- package/models/non-standard/timetables.js +27 -27
- package/package.json +23 -11
- package/test/mocha/export-gtfs.js +74 -44
- package/test/mocha/get-agencies.js +20 -14
- package/test/mocha/get-attributions.js +10 -4
- package/test/mocha/get-board-alights.js +10 -4
- package/test/mocha/get-calendar-dates.js +31 -24
- package/test/mocha/get-calendars.js +17 -11
- package/test/mocha/get-db.js +71 -5
- package/test/mocha/get-directions.js +10 -4
- package/test/mocha/get-fare-attributes.js +12 -6
- package/test/mocha/get-fare-rules.js +17 -13
- package/test/mocha/get-feed-info.js +10 -4
- package/test/mocha/get-frequencies.js +10 -4
- package/test/mocha/get-levels.js +4 -4
- package/test/mocha/get-pathways.js +10 -4
- package/test/mocha/get-ride-feed-infos.js +9 -3
- package/test/mocha/get-rider-trips.js +10 -4
- package/test/mocha/get-riderships.js +10 -4
- package/test/mocha/get-routes.js +12 -16
- package/test/mocha/get-shapes-as-geojson.js +12 -6
- package/test/mocha/get-shapes.js +31 -39
- package/test/mocha/get-stop-attributes.js +10 -4
- package/test/mocha/get-stops-as-geojson.js +11 -5
- package/test/mocha/get-stops.js +62 -51
- package/test/mocha/get-stoptimes.js +18 -10
- package/test/mocha/get-timetable-pages.js +10 -4
- package/test/mocha/get-timetable-stop-orders.js +10 -4
- package/test/mocha/get-timetables.js +10 -4
- package/test/mocha/get-transfers.js +10 -4
- package/test/mocha/get-translations.js +10 -4
- package/test/mocha/get-trip-capacities.js +10 -4
- package/test/mocha/get-trips.js +6 -6
- package/test/mocha/import-gtfs.js +63 -46
- package/test/test-config.js +9 -4
|
@@ -2,18 +2,29 @@ import sqlString from 'sqlstring-sqlite';
|
|
|
2
2
|
|
|
3
3
|
import { getDb } from '../db.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatOrderByClause,
|
|
7
|
+
formatSelectClause,
|
|
8
|
+
formatWhereClauses,
|
|
9
|
+
} from '../utils.js';
|
|
6
10
|
import directions from '../../models/non-standard/directions.js';
|
|
7
11
|
|
|
8
12
|
/*
|
|
9
13
|
* Returns an array of all directions that match the query parameters.
|
|
10
14
|
*/
|
|
11
|
-
export async function getDirections(
|
|
12
|
-
|
|
15
|
+
export async function getDirections(
|
|
16
|
+
query = {},
|
|
17
|
+
fields = [],
|
|
18
|
+
orderBy = [],
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const db = options.db ?? (await getDb());
|
|
13
22
|
const tableName = sqlString.escapeId(directions.filenameBase);
|
|
14
23
|
const selectClause = formatSelectClause(fields);
|
|
15
24
|
const whereClause = formatWhereClauses(query);
|
|
16
25
|
const orderByClause = formatOrderByClause(orderBy);
|
|
17
26
|
|
|
18
|
-
return db.all(
|
|
27
|
+
return db.all(
|
|
28
|
+
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`
|
|
29
|
+
);
|
|
19
30
|
}
|
|
@@ -2,18 +2,29 @@ import sqlString from 'sqlstring-sqlite';
|
|
|
2
2
|
|
|
3
3
|
import { getDb } from '../db.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatOrderByClause,
|
|
7
|
+
formatSelectClause,
|
|
8
|
+
formatWhereClauses,
|
|
9
|
+
} from '../utils.js';
|
|
6
10
|
import stopAttributes from '../../models/non-standard/stop-attributes.js';
|
|
7
11
|
|
|
8
12
|
/*
|
|
9
13
|
* Returns an array of all stop attributes that match the query parameters.
|
|
10
14
|
*/
|
|
11
|
-
export async function getStopAttributes(
|
|
12
|
-
|
|
15
|
+
export async function getStopAttributes(
|
|
16
|
+
query = {},
|
|
17
|
+
fields = [],
|
|
18
|
+
orderBy = [],
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const db = options.db ?? (await getDb());
|
|
13
22
|
const tableName = sqlString.escapeId(stopAttributes.filenameBase);
|
|
14
23
|
const selectClause = formatSelectClause(fields);
|
|
15
24
|
const whereClause = formatWhereClauses(query);
|
|
16
25
|
const orderByClause = formatOrderByClause(orderBy);
|
|
17
26
|
|
|
18
|
-
return db.all(
|
|
27
|
+
return db.all(
|
|
28
|
+
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`
|
|
29
|
+
);
|
|
19
30
|
}
|
|
@@ -2,18 +2,29 @@ import sqlString from 'sqlstring-sqlite';
|
|
|
2
2
|
|
|
3
3
|
import { getDb } from '../db.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatOrderByClause,
|
|
7
|
+
formatSelectClause,
|
|
8
|
+
formatWhereClauses,
|
|
9
|
+
} from '../utils.js';
|
|
6
10
|
import timetableNotesReferences from '../../models/non-standard/timetable-notes-references.js';
|
|
7
11
|
|
|
8
12
|
/*
|
|
9
13
|
* Returns an array of all timetable notes references that match the query parameters.
|
|
10
14
|
*/
|
|
11
|
-
export async function getTimetableNotesReferences(
|
|
12
|
-
|
|
15
|
+
export async function getTimetableNotesReferences(
|
|
16
|
+
query = {},
|
|
17
|
+
fields = [],
|
|
18
|
+
orderBy = [],
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const db = options.db ?? (await getDb());
|
|
13
22
|
const tableName = sqlString.escapeId(timetableNotesReferences.filenameBase);
|
|
14
23
|
const selectClause = formatSelectClause(fields);
|
|
15
24
|
const whereClause = formatWhereClauses(query);
|
|
16
25
|
const orderByClause = formatOrderByClause(orderBy);
|
|
17
26
|
|
|
18
|
-
return db.all(
|
|
27
|
+
return db.all(
|
|
28
|
+
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`
|
|
29
|
+
);
|
|
19
30
|
}
|
|
@@ -2,18 +2,29 @@ import sqlString from 'sqlstring-sqlite';
|
|
|
2
2
|
|
|
3
3
|
import { getDb } from '../db.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatOrderByClause,
|
|
7
|
+
formatSelectClause,
|
|
8
|
+
formatWhereClauses,
|
|
9
|
+
} from '../utils.js';
|
|
6
10
|
import timetableNotes from '../../models/non-standard/timetable-notes.js';
|
|
7
11
|
|
|
8
12
|
/*
|
|
9
13
|
* Returns an array of all timetable notes that match the query parameters.
|
|
10
14
|
*/
|
|
11
|
-
export async function getTimetableNotes(
|
|
12
|
-
|
|
15
|
+
export async function getTimetableNotes(
|
|
16
|
+
query = {},
|
|
17
|
+
fields = [],
|
|
18
|
+
orderBy = [],
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const db = options.db ?? (await getDb());
|
|
13
22
|
const tableName = sqlString.escapeId(timetableNotes.filenameBase);
|
|
14
23
|
const selectClause = formatSelectClause(fields);
|
|
15
24
|
const whereClause = formatWhereClauses(query);
|
|
16
25
|
const orderByClause = formatOrderByClause(orderBy);
|
|
17
26
|
|
|
18
|
-
return db.all(
|
|
27
|
+
return db.all(
|
|
28
|
+
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`
|
|
29
|
+
);
|
|
19
30
|
}
|
|
@@ -2,18 +2,29 @@ import sqlString from 'sqlstring-sqlite';
|
|
|
2
2
|
|
|
3
3
|
import { getDb } from '../db.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatOrderByClause,
|
|
7
|
+
formatSelectClause,
|
|
8
|
+
formatWhereClauses,
|
|
9
|
+
} from '../utils.js';
|
|
6
10
|
import timetablePages from '../../models/non-standard/timetable-pages.js';
|
|
7
11
|
|
|
8
12
|
/*
|
|
9
13
|
* Returns an array of all timetable pages that match the query parameters.
|
|
10
14
|
*/
|
|
11
|
-
export async function getTimetablePages(
|
|
12
|
-
|
|
15
|
+
export async function getTimetablePages(
|
|
16
|
+
query = {},
|
|
17
|
+
fields = [],
|
|
18
|
+
orderBy = [],
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const db = options.db ?? (await getDb());
|
|
13
22
|
const tableName = sqlString.escapeId(timetablePages.filenameBase);
|
|
14
23
|
const selectClause = formatSelectClause(fields);
|
|
15
24
|
const whereClause = formatWhereClauses(query);
|
|
16
25
|
const orderByClause = formatOrderByClause(orderBy);
|
|
17
26
|
|
|
18
|
-
return db.all(
|
|
27
|
+
return db.all(
|
|
28
|
+
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`
|
|
29
|
+
);
|
|
19
30
|
}
|
|
@@ -2,18 +2,29 @@ import sqlString from 'sqlstring-sqlite';
|
|
|
2
2
|
|
|
3
3
|
import { getDb } from '../db.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatOrderByClause,
|
|
7
|
+
formatSelectClause,
|
|
8
|
+
formatWhereClauses,
|
|
9
|
+
} from '../utils.js';
|
|
6
10
|
import timetableStopOrder from '../../models/non-standard/timetable-stop-order.js';
|
|
7
11
|
|
|
8
12
|
/*
|
|
9
13
|
* Returns an array of all timetable stop orders that match the query parameters.
|
|
10
14
|
*/
|
|
11
|
-
export async function getTimetableStopOrders(
|
|
12
|
-
|
|
15
|
+
export async function getTimetableStopOrders(
|
|
16
|
+
query = {},
|
|
17
|
+
fields = [],
|
|
18
|
+
orderBy = [],
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const db = options.db ?? (await getDb());
|
|
13
22
|
const tableName = sqlString.escapeId(timetableStopOrder.filenameBase);
|
|
14
23
|
const selectClause = formatSelectClause(fields);
|
|
15
24
|
const whereClause = formatWhereClauses(query);
|
|
16
25
|
const orderByClause = formatOrderByClause(orderBy);
|
|
17
26
|
|
|
18
|
-
return db.all(
|
|
27
|
+
return db.all(
|
|
28
|
+
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`
|
|
29
|
+
);
|
|
19
30
|
}
|
|
@@ -2,18 +2,29 @@ import sqlString from 'sqlstring-sqlite';
|
|
|
2
2
|
|
|
3
3
|
import { getDb } from '../db.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatOrderByClause,
|
|
7
|
+
formatSelectClause,
|
|
8
|
+
formatWhereClauses,
|
|
9
|
+
} from '../utils.js';
|
|
6
10
|
import timetables from '../../models/non-standard/timetables.js';
|
|
7
11
|
|
|
8
12
|
/*
|
|
9
13
|
* Returns an array of all timetables that match the query parameters.
|
|
10
14
|
*/
|
|
11
|
-
export async function getTimetables(
|
|
12
|
-
|
|
15
|
+
export async function getTimetables(
|
|
16
|
+
query = {},
|
|
17
|
+
fields = [],
|
|
18
|
+
orderBy = [],
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const db = options.db ?? (await getDb());
|
|
13
22
|
const tableName = sqlString.escapeId(timetables.filenameBase);
|
|
14
23
|
const selectClause = formatSelectClause(fields);
|
|
15
24
|
const whereClause = formatWhereClauses(query);
|
|
16
25
|
const orderByClause = formatOrderByClause(orderBy);
|
|
17
26
|
|
|
18
|
-
return db.all(
|
|
27
|
+
return db.all(
|
|
28
|
+
`${selectClause} FROM ${tableName} ${whereClause} ${orderByClause};`
|
|
29
|
+
);
|
|
19
30
|
}
|
package/lib/utils.js
CHANGED
|
@@ -10,7 +10,9 @@ export function validateConfigForImport(config) {
|
|
|
10
10
|
|
|
11
11
|
for (const [index, agency] of config.agencies.entries()) {
|
|
12
12
|
if (!agency.path && !agency.url) {
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error(
|
|
14
|
+
`No Agency \`url\` or \`path\` specified in config for agency index ${index}.`
|
|
15
|
+
);
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -22,33 +24,41 @@ export function validateConfigForImport(config) {
|
|
|
22
24
|
*/
|
|
23
25
|
export function setDefaultConfig(initialConfig) {
|
|
24
26
|
const defaults = {
|
|
25
|
-
sqlitePath: ':memory:'
|
|
27
|
+
sqlitePath: ':memory:',
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
...defaults,
|
|
32
|
+
...initialConfig,
|
|
33
|
+
};
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
/*
|
|
32
37
|
* Calculate seconds from midnight for HH:mm:ss
|
|
33
38
|
*/
|
|
34
39
|
export function calculateSecondsFromMidnight(time) {
|
|
35
|
-
const split = time.split(':').map(d => Number.parseInt(d, 10));
|
|
40
|
+
const split = time.split(':').map((d) => Number.parseInt(d, 10));
|
|
36
41
|
if (split.length !== 3) {
|
|
37
42
|
return null;
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
return
|
|
45
|
+
return split[0] * 3600 + split[1] * 60 + split[2];
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
export function formatSelectClause(fields) {
|
|
44
|
-
const selectItem =
|
|
49
|
+
const selectItem =
|
|
50
|
+
fields.length > 0
|
|
51
|
+
? fields.map((fieldName) => sqlString.escapeId(fieldName)).join(', ')
|
|
52
|
+
: '*';
|
|
45
53
|
|
|
46
54
|
return `SELECT ${selectItem}`;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
export function formatWhereClause(key, value) {
|
|
50
58
|
if (Array.isArray(value)) {
|
|
51
|
-
return `${sqlString.escapeId(key)} IN (${value
|
|
59
|
+
return `${sqlString.escapeId(key)} IN (${value
|
|
60
|
+
.map((v) => sqlString.escape(v))
|
|
61
|
+
.join(', ')})`;
|
|
52
62
|
}
|
|
53
63
|
|
|
54
64
|
if (value === null) {
|
|
@@ -63,7 +73,9 @@ export function formatWhereClauses(query) {
|
|
|
63
73
|
return '';
|
|
64
74
|
}
|
|
65
75
|
|
|
66
|
-
const whereClauses = Object.entries(query).map(([key, value]) =>
|
|
76
|
+
const whereClauses = Object.entries(query).map(([key, value]) =>
|
|
77
|
+
formatWhereClause(key, value)
|
|
78
|
+
);
|
|
67
79
|
return `WHERE ${whereClauses.join(' AND ')}`;
|
|
68
80
|
}
|
|
69
81
|
|
|
@@ -73,10 +85,12 @@ export function formatOrderByClause(orderBy) {
|
|
|
73
85
|
if (orderBy.length > 0) {
|
|
74
86
|
orderByClause += 'ORDER BY ';
|
|
75
87
|
|
|
76
|
-
orderByClause += orderBy
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
orderByClause += orderBy
|
|
89
|
+
.map(([key, value]) => {
|
|
90
|
+
const direction = value === 'DESC' ? 'DESC' : 'ASC';
|
|
91
|
+
return `${sqlString.escapeId(key)} ${direction}`;
|
|
92
|
+
})
|
|
93
|
+
.join(', ');
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
return orderByClause;
|
package/models/gtfs/agency.js
CHANGED
|
@@ -4,44 +4,44 @@ const model = {
|
|
|
4
4
|
{
|
|
5
5
|
name: 'id',
|
|
6
6
|
type: 'integer',
|
|
7
|
-
primary: true
|
|
7
|
+
primary: true,
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
name: 'agency_id',
|
|
11
|
-
type: 'varchar(255)'
|
|
11
|
+
type: 'varchar(255)',
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
name: 'agency_name',
|
|
15
15
|
type: 'varchar(255)',
|
|
16
|
-
required: true
|
|
16
|
+
required: true,
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
name: 'agency_url',
|
|
20
20
|
type: 'varchar(2047)',
|
|
21
|
-
required: true
|
|
21
|
+
required: true,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
name: 'agency_timezone',
|
|
25
25
|
type: 'varchar(255)',
|
|
26
|
-
required: true
|
|
26
|
+
required: true,
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
name: 'agency_lang',
|
|
30
|
-
type: 'varchar(255)'
|
|
30
|
+
type: 'varchar(255)',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
name: 'agency_phone',
|
|
34
|
-
type: 'varchar(64)'
|
|
34
|
+
type: 'varchar(64)',
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: 'agency_fare_url',
|
|
38
|
-
type: 'varchar(2047)'
|
|
38
|
+
type: 'varchar(2047)',
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
name: 'agency_email',
|
|
42
|
-
type: 'varchar(255)'
|
|
43
|
-
}
|
|
44
|
-
]
|
|
42
|
+
type: 'varchar(255)',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export default model;
|
|
@@ -4,60 +4,60 @@ const model = {
|
|
|
4
4
|
{
|
|
5
5
|
name: 'id',
|
|
6
6
|
type: 'integer',
|
|
7
|
-
primary: true
|
|
7
|
+
primary: true,
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
name: 'attribution_id',
|
|
11
|
-
type: 'varchar(255)'
|
|
11
|
+
type: 'varchar(255)',
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
name: 'agency_id',
|
|
15
|
-
type: 'varchar(255)'
|
|
15
|
+
type: 'varchar(255)',
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
name: 'route_id',
|
|
19
|
-
type: 'varchar(255)'
|
|
19
|
+
type: 'varchar(255)',
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
name: 'trip_id',
|
|
23
|
-
type: 'varchar(255)'
|
|
23
|
+
type: 'varchar(255)',
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
name: 'organization_name',
|
|
27
27
|
type: 'varchar(255)',
|
|
28
|
-
required: true
|
|
28
|
+
required: true,
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
name: 'is_producer',
|
|
32
32
|
type: 'integer',
|
|
33
33
|
min: 0,
|
|
34
|
-
max: 1
|
|
34
|
+
max: 1,
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: 'is_operator',
|
|
38
38
|
type: 'integer',
|
|
39
39
|
min: 0,
|
|
40
|
-
max: 1
|
|
40
|
+
max: 1,
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
name: 'is_authority',
|
|
44
44
|
type: 'integer',
|
|
45
45
|
min: 0,
|
|
46
|
-
max: 1
|
|
46
|
+
max: 1,
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
name: 'attribution_url',
|
|
50
|
-
type: 'varchar(2047)'
|
|
50
|
+
type: 'varchar(2047)',
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
name: 'attribution_email',
|
|
54
|
-
type: 'varchar(255)'
|
|
54
|
+
type: 'varchar(255)',
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
name: 'attribution_phone',
|
|
58
|
-
type: 'varchar(255)'
|
|
59
|
-
}
|
|
60
|
-
]
|
|
58
|
+
type: 'varchar(255)',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
export default model;
|
|
@@ -4,19 +4,19 @@ const model = {
|
|
|
4
4
|
{
|
|
5
5
|
name: 'id',
|
|
6
6
|
type: 'integer',
|
|
7
|
-
primary: true
|
|
7
|
+
primary: true,
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
name: 'service_id',
|
|
11
11
|
type: 'varchar(255)',
|
|
12
12
|
required: true,
|
|
13
|
-
index: true
|
|
13
|
+
index: true,
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
name: 'date',
|
|
17
17
|
type: 'integer',
|
|
18
18
|
required: true,
|
|
19
|
-
index: true
|
|
19
|
+
index: true,
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
name: 'exception_type',
|
|
@@ -24,13 +24,13 @@ const model = {
|
|
|
24
24
|
required: true,
|
|
25
25
|
min: 1,
|
|
26
26
|
max: 2,
|
|
27
|
-
index: true
|
|
27
|
+
index: true,
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
name: 'holiday_name',
|
|
31
|
-
type: 'varchar(255)'
|
|
32
|
-
}
|
|
33
|
-
]
|
|
31
|
+
type: 'varchar(255)',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export default model;
|
package/models/gtfs/calendar.js
CHANGED
|
@@ -5,70 +5,70 @@ const model = {
|
|
|
5
5
|
name: 'service_id',
|
|
6
6
|
type: 'varchar(255)',
|
|
7
7
|
required: true,
|
|
8
|
-
primary: true
|
|
8
|
+
primary: true,
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
name: 'monday',
|
|
12
12
|
type: 'integer',
|
|
13
13
|
required: true,
|
|
14
14
|
min: 0,
|
|
15
|
-
max: 1
|
|
15
|
+
max: 1,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
name: 'tuesday',
|
|
19
19
|
type: 'integer',
|
|
20
20
|
required: true,
|
|
21
21
|
min: 0,
|
|
22
|
-
max: 1
|
|
22
|
+
max: 1,
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: 'wednesday',
|
|
26
26
|
type: 'integer',
|
|
27
27
|
required: true,
|
|
28
28
|
min: 0,
|
|
29
|
-
max: 1
|
|
29
|
+
max: 1,
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
name: 'thursday',
|
|
33
33
|
type: 'integer',
|
|
34
34
|
required: true,
|
|
35
35
|
min: 0,
|
|
36
|
-
max: 1
|
|
36
|
+
max: 1,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
name: 'friday',
|
|
40
40
|
type: 'integer',
|
|
41
41
|
required: true,
|
|
42
42
|
min: 0,
|
|
43
|
-
max: 1
|
|
43
|
+
max: 1,
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
name: 'saturday',
|
|
47
47
|
type: 'integer',
|
|
48
48
|
required: true,
|
|
49
49
|
min: 0,
|
|
50
|
-
max: 1
|
|
50
|
+
max: 1,
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
name: 'sunday',
|
|
54
54
|
type: 'integer',
|
|
55
55
|
required: true,
|
|
56
56
|
min: 0,
|
|
57
|
-
max: 1
|
|
57
|
+
max: 1,
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
name: 'start_date',
|
|
61
61
|
type: 'integer',
|
|
62
62
|
required: true,
|
|
63
|
-
index: true
|
|
63
|
+
index: true,
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
name: 'end_date',
|
|
67
67
|
type: 'integer',
|
|
68
68
|
required: true,
|
|
69
|
-
index: true
|
|
70
|
-
}
|
|
71
|
-
]
|
|
69
|
+
index: true,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
export default model;
|
|
@@ -5,41 +5,41 @@ const model = {
|
|
|
5
5
|
name: 'fare_id',
|
|
6
6
|
type: 'varchar(255)',
|
|
7
7
|
required: true,
|
|
8
|
-
primary: true
|
|
8
|
+
primary: true,
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
name: 'price',
|
|
12
12
|
type: 'real',
|
|
13
|
-
required: true
|
|
13
|
+
required: true,
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
name: 'currency_type',
|
|
17
17
|
type: 'varchar(255)',
|
|
18
|
-
required: true
|
|
18
|
+
required: true,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
name: 'payment_method',
|
|
22
22
|
type: 'integer',
|
|
23
23
|
required: true,
|
|
24
24
|
min: 0,
|
|
25
|
-
max: 1
|
|
25
|
+
max: 1,
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
name: 'transfers',
|
|
29
29
|
type: 'integer',
|
|
30
30
|
min: 0,
|
|
31
|
-
max: 2
|
|
31
|
+
max: 2,
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
name: 'agency_id',
|
|
35
|
-
type: 'varchar(255)'
|
|
35
|
+
type: 'varchar(255)',
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
name: 'transfer_duration',
|
|
39
39
|
type: 'integer',
|
|
40
|
-
min: 0
|
|
41
|
-
}
|
|
42
|
-
]
|
|
40
|
+
min: 0,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export default model;
|
|
@@ -4,32 +4,32 @@ const model = {
|
|
|
4
4
|
{
|
|
5
5
|
name: 'id',
|
|
6
6
|
type: 'integer',
|
|
7
|
-
primary: true
|
|
7
|
+
primary: true,
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
name: 'fare_id',
|
|
11
11
|
type: 'varchar(255)',
|
|
12
12
|
required: true,
|
|
13
|
-
index: true
|
|
13
|
+
index: true,
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
name: 'route_id',
|
|
17
17
|
type: 'varchar(255)',
|
|
18
|
-
index: true
|
|
18
|
+
index: true,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
name: 'origin_id',
|
|
22
|
-
type: 'varchar(255)'
|
|
22
|
+
type: 'varchar(255)',
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: 'destination_id',
|
|
26
|
-
type: 'varchar(255)'
|
|
26
|
+
type: 'varchar(255)',
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
name: 'contains_id',
|
|
30
|
-
type: 'varchar(255)'
|
|
31
|
-
}
|
|
32
|
-
]
|
|
30
|
+
type: 'varchar(255)',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export default model;
|