gtfs 4.7.0 → 4.7.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.
@@ -5,21 +5,17 @@ on: [push, pull_request]
5
5
  jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
-
9
8
  strategy:
10
9
  matrix:
11
- node-version: [18.x, 20.x]
12
-
10
+ node: [ 18, 20 ]
11
+ name: Use Node.js ${{ matrix.node }}
13
12
  steps:
14
- - uses: actions/checkout@v3
15
- - name: Use Node.js ${{ matrix.node-version }}
16
- uses: actions/setup-node@v3
13
+ - uses: actions/checkout@v4
14
+ - name: Setup node
15
+ uses: actions/setup-node@v4
17
16
  with:
18
- node-version: ${{ matrix.node-version }}
19
- - name: npm install and test
20
- run: |
21
- npm install -g npm@9
22
- npm ci
23
- npm test
17
+ node-version: ${{ matrix.node }}
18
+ - run: npm ci
19
+ - run: npm test
24
20
  env:
25
21
  CI: true
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.7.2] - 2024-03-05
9
+
10
+ ### Updated
11
+
12
+ - Show info about ignoreDuplicates option when primary key constraint issue happens
13
+ - Dependency updates
14
+
15
+ ## [4.7.1] - 2024-02-18
16
+
17
+ ### Updated
18
+
19
+ - Support null arrival and departure in StopTimeUpdate
20
+
8
21
  ## [4.7.0] - 2024-02-09
9
22
 
10
23
  ### Added
package/lib/import.js CHANGED
@@ -78,7 +78,9 @@ function getDescendantProp(obj, desc, defaultvalue) {
78
78
  const arr = desc.split('.');
79
79
  while (arr.length) {
80
80
  const nextKey = arr.shift();
81
- if (nextKey.includes('[')) {
81
+ if (obj == null) {
82
+ return defaultvalue;
83
+ } else if (nextKey.includes('[')) {
82
84
  const arrayKey = nextKey.match(/(\w*)\[(\d+)\]/);
83
85
  if (obj[arrayKey[1]] === undefined) {
84
86
  return defaultvalue;
@@ -507,6 +509,13 @@ const importLines = (task, lines, model, totalLineCount) => {
507
509
  .join(', ')}) VALUES ${placeholders.join(',')}`,
508
510
  ).run(...values);
509
511
  } catch (error) {
512
+ if (error.code === 'SQLITE_CONSTRAINT_PRIMARYKEY') {
513
+ const primaryColumns = model.schema.filter((column) => column.primary);
514
+ task.warn(
515
+ `Duplicate values for primary key (${primaryColumns.map((column) => column.name).join(', ')}) found in ${model.filenameBase}.txt. Set the \`ignoreDuplicates\` option to true in config.json to ignore this error`,
516
+ );
517
+ }
518
+
510
519
  task.warn(
511
520
  `Check ${model.filenameBase}.txt for invalid data between lines ${
512
521
  totalLineCount - linesToImportCount
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtfs",
3
- "version": "4.7.0",
3
+ "version": "4.7.2",
4
4
  "description": "Import GTFS transit data into SQLite and query routes, stops, times, fares and more",
5
5
  "keywords": [
6
6
  "transit",
@@ -59,7 +59,8 @@
59
59
  "Ali Zarghami <alizarghami@gmail.com>",
60
60
  "David Abell",
61
61
  "Matthias Feist <matze@matf.de>",
62
- "Oliv4945"
62
+ "Oliv4945",
63
+ "Kyle Ramey"
63
64
  ],
64
65
  "type": "module",
65
66
  "main": "index.js",
@@ -74,9 +75,9 @@
74
75
  },
75
76
  "dependencies": {
76
77
  "@turf/helpers": "^6.5.0",
77
- "better-sqlite3": "^9.4.0",
78
- "csv-parse": "^5.5.3",
79
- "csv-stringify": "^6.4.5",
78
+ "better-sqlite3": "^9.4.3",
79
+ "csv-parse": "^5.5.5",
80
+ "csv-stringify": "^6.4.6",
80
81
  "gtfs-realtime-bindings": "^1.1.1",
81
82
  "lodash-es": "^4.17.21",
82
83
  "long": "^5.2.3",
@@ -92,10 +93,10 @@
92
93
  "tmp-promise": "^3.0.3",
93
94
  "untildify": "^5.0.0",
94
95
  "yargs": "^17.7.2",
95
- "yoctocolors": "^1.0.0"
96
+ "yoctocolors": "^2.0.0"
96
97
  },
97
98
  "devDependencies": {
98
- "husky": "^9.0.10",
99
+ "husky": "^9.0.11",
99
100
  "lint-staged": "^15.2.2",
100
101
  "mocha": "^10.3.0",
101
102
  "prettier": "^3.2.5",