gtfs 4.13.0 → 4.13.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.
@@ -213,8 +213,6 @@ var model3 = {
213
213
  {
214
214
  name: "attribution_id",
215
215
  type: "text",
216
- primary: true,
217
- required: true,
218
216
  prefix: true
219
217
  },
220
218
  {
@@ -381,7 +379,7 @@ var model5 = {
381
379
  },
382
380
  {
383
381
  name: "date",
384
- type: "integer",
382
+ type: "date",
385
383
  required: true,
386
384
  primary: true
387
385
  },
@@ -465,13 +463,13 @@ var model6 = {
465
463
  },
466
464
  {
467
465
  name: "start_date",
468
- type: "integer",
466
+ type: "date",
469
467
  required: true,
470
468
  index: true
471
469
  },
472
470
  {
473
471
  name: "end_date",
474
- type: "integer",
472
+ type: "date",
475
473
  required: true,
476
474
  index: true
477
475
  }
@@ -767,11 +765,11 @@ var model13 = {
767
765
  },
768
766
  {
769
767
  name: "feed_start_date",
770
- type: "integer"
768
+ type: "date"
771
769
  },
772
770
  {
773
771
  name: "feed_end_date",
774
- type: "integer"
772
+ type: "date"
775
773
  },
776
774
  {
777
775
  name: "feed_version",
@@ -1624,11 +1622,11 @@ var model31 = {
1624
1622
  },
1625
1623
  {
1626
1624
  name: "start_date",
1627
- type: "integer"
1625
+ type: "date"
1628
1626
  },
1629
1627
  {
1630
1628
  name: "end_date",
1631
- type: "integer"
1629
+ type: "date"
1632
1630
  },
1633
1631
  {
1634
1632
  name: "monday",
@@ -2133,7 +2131,7 @@ var model41 = {
2133
2131
  },
2134
2132
  {
2135
2133
  name: "service_date",
2136
- type: "integer",
2134
+ type: "date",
2137
2135
  index: true
2138
2136
  },
2139
2137
  {
@@ -2215,7 +2213,7 @@ var model42 = {
2215
2213
  },
2216
2214
  {
2217
2215
  name: "service_date",
2218
- type: "integer",
2216
+ type: "date",
2219
2217
  index: true
2220
2218
  },
2221
2219
  {
@@ -2299,12 +2297,12 @@ var model43 = {
2299
2297
  },
2300
2298
  {
2301
2299
  name: "ridership_start_date",
2302
- type: "integer",
2300
+ type: "date",
2303
2301
  index: true
2304
2302
  },
2305
2303
  {
2306
2304
  name: "ridership_end_date",
2307
- type: "integer",
2305
+ type: "date",
2308
2306
  index: true
2309
2307
  },
2310
2308
  {
@@ -2427,7 +2425,7 @@ var model44 = {
2427
2425
  },
2428
2426
  {
2429
2427
  name: "service_date",
2430
- type: "integer",
2428
+ type: "date",
2431
2429
  index: true
2432
2430
  },
2433
2431
  {
@@ -2474,17 +2472,17 @@ var model45 = {
2474
2472
  },
2475
2473
  {
2476
2474
  name: "ride_start_date",
2477
- type: "integer",
2475
+ type: "date",
2478
2476
  index: true
2479
2477
  },
2480
2478
  {
2481
2479
  name: "ride_end_date",
2482
- type: "integer",
2480
+ type: "date",
2483
2481
  index: true
2484
2482
  },
2485
2483
  {
2486
2484
  name: "gtfs_feed_date",
2487
- type: "integer",
2485
+ type: "date",
2488
2486
  index: true
2489
2487
  },
2490
2488
  {
@@ -3274,40 +3272,6 @@ var models_default = models;
3274
3272
  // src/lib/db.ts
3275
3273
  import Database from "better-sqlite3";
3276
3274
  import untildify2 from "untildify";
3277
-
3278
- // src/lib/utils.ts
3279
- import sqlString from "sqlstring-sqlite";
3280
- import Long from "long";
3281
- function validateConfigForImport(config) {
3282
- if (!config.agencies || config.agencies.length === 0) {
3283
- throw new Error("No `agencies` specified in config");
3284
- }
3285
- for (const [index, agency] of config.agencies.entries()) {
3286
- if (!agency.path && !agency.url) {
3287
- throw new Error(
3288
- `No Agency \`url\` or \`path\` specified in config for agency index ${index}.`
3289
- );
3290
- }
3291
- }
3292
- return config;
3293
- }
3294
- function setDefaultConfig(initialConfig) {
3295
- const defaults = {
3296
- sqlitePath: ":memory:",
3297
- ignoreDuplicates: false,
3298
- gtfsRealtimeExpirationSeconds: 0
3299
- };
3300
- return {
3301
- ...defaults,
3302
- ...initialConfig
3303
- };
3304
- }
3305
- function convertLongTimeToDate(longDate) {
3306
- const { high, low, unsigned } = longDate;
3307
- return new Date(new Long(low, high, unsigned).toInt() * 1e3).toISOString();
3308
- }
3309
-
3310
- // src/lib/db.ts
3311
3275
  var dbs = {};
3312
3276
  function setupDb(sqlitePath) {
3313
3277
  const db = new Database(untildify2(sqlitePath));
@@ -3319,7 +3283,7 @@ function setupDb(sqlitePath) {
3319
3283
  }
3320
3284
  function openDb(config = null) {
3321
3285
  if (config) {
3322
- const { sqlitePath, db } = setDefaultConfig(config);
3286
+ const { sqlitePath = ":memory:", db } = config;
3323
3287
  if (db) {
3324
3288
  return db;
3325
3289
  }
@@ -3328,6 +3292,9 @@ function openDb(config = null) {
3328
3292
  }
3329
3293
  return setupDb(sqlitePath);
3330
3294
  }
3295
+ if (Object.keys(dbs).length === 0) {
3296
+ return setupDb(":memory:");
3297
+ }
3331
3298
  if (Object.keys(dbs).length === 1) {
3332
3299
  const filename = Object.keys(dbs)[0];
3333
3300
  return dbs[filename];
@@ -3352,6 +3319,38 @@ import {
3352
3319
  } from "lodash-es";
3353
3320
  import { feature, featureCollection } from "@turf/helpers";
3354
3321
 
3322
+ // src/lib/utils.ts
3323
+ import sqlString from "sqlstring-sqlite";
3324
+ import Long from "long";
3325
+ function validateConfigForImport(config) {
3326
+ if (!config.agencies || config.agencies.length === 0) {
3327
+ throw new Error("No `agencies` specified in config");
3328
+ }
3329
+ for (const [index, agency] of config.agencies.entries()) {
3330
+ if (!agency.path && !agency.url) {
3331
+ throw new Error(
3332
+ `No Agency \`url\` or \`path\` specified in config for agency index ${index}.`
3333
+ );
3334
+ }
3335
+ }
3336
+ return config;
3337
+ }
3338
+ function setDefaultConfig(initialConfig) {
3339
+ const defaults = {
3340
+ sqlitePath: ":memory:",
3341
+ ignoreDuplicates: false,
3342
+ gtfsRealtimeExpirationSeconds: 0
3343
+ };
3344
+ return {
3345
+ ...defaults,
3346
+ ...initialConfig
3347
+ };
3348
+ }
3349
+ function convertLongTimeToDate(longDate) {
3350
+ const { high, low, unsigned } = longDate;
3351
+ return new Date(new Long(low, high, unsigned).toInt() * 1e3).toISOString();
3352
+ }
3353
+
3355
3354
  // src/lib/import.ts
3356
3355
  var downloadGtfsRealtimeData = async (url, task) => {
3357
3356
  const response = await fetch(url, {
@@ -3448,8 +3447,7 @@ var updateRealtimeData = async (task) => {
3448
3447
  return;
3449
3448
  }
3450
3449
  const db = openDb({
3451
- sqlitePath: task.sqlitePath,
3452
- agencies: []
3450
+ sqlitePath: task.sqlitePath
3453
3451
  });
3454
3452
  const vehiclePositionsModel = models_default.find(
3455
3453
  (x) => x.filenameBase === "vehicle_positions"