gtfs 4.19.2 → 4.19.3

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Tt as formatError, st as exportGtfs, xt as getConfig } from "../src-CdVKeHzG.js";
2
+ import { Tt as formatError, st as exportGtfs, xt as getConfig } from "../src-gj91FR8c.js";
3
3
  import yargs from "yargs";
4
4
  import { hideBin } from "yargs/helpers";
5
5
  import PrettyError from "pretty-error";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Tt as formatError, ct as importGtfs, ft as openDb, ut as closeDb, xt as getConfig } from "../src-CdVKeHzG.js";
2
+ import { Tt as formatError, ct as importGtfs, ft as openDb, ut as closeDb, xt as getConfig } from "../src-gj91FR8c.js";
3
3
  import yargs from "yargs";
4
4
  import { hideBin } from "yargs/helpers";
5
5
  import PrettyError from "pretty-error";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Tt as formatError, lt as updateGtfsRealtime, xt as getConfig } from "../src-CdVKeHzG.js";
2
+ import { Tt as formatError, lt as updateGtfsRealtime, xt as getConfig } from "../src-gj91FR8c.js";
3
3
  import yargs from "yargs";
4
4
  import { hideBin } from "yargs/helpers";
5
5
  import PrettyError from "pretty-error";
package/dist/index.d.ts CHANGED
@@ -1224,20 +1224,20 @@ declare function getVehiclePositions<Fields extends keyof VehiclePosition>(query
1224
1224
  //#region src/lib/gtfs-realtime/service-alerts.d.ts
1225
1225
  declare function getServiceAlerts<Fields extends keyof ServiceAlert>(query?: SqlWhere, fields?: Fields[], orderBy?: SqlOrderBy, options?: QueryOptions): {
1226
1226
  informed_entities: ServiceAlertInformedEntity[];
1227
+ start_time: string | null;
1228
+ end_time: string | null;
1227
1229
  id: string;
1230
+ created_timestamp: UnixTimestamp;
1231
+ expiration_timestamp: UnixTimestamp;
1228
1232
  active_period: string | null;
1229
1233
  cause: string | null;
1230
1234
  effect: string | null;
1231
1235
  url: string | null;
1232
- start_time: string | null;
1233
- end_time: string | null;
1234
1236
  header_text: string;
1235
1237
  description_text: string;
1236
1238
  tts_header_text: string | null;
1237
1239
  tts_description_text: string | null;
1238
1240
  severity_level: string | null;
1239
- created_timestamp: UnixTimestamp;
1240
- expiration_timestamp: UnixTimestamp;
1241
1241
  }[];
1242
1242
  //#endregion
1243
1243
  //#region src/lib/gtfs-realtime/service-alert-informed-entities.d.ts
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as getCalendars, A as getStopsAsGeoJSON, B as getNetworks, C as getCalendarAttributes, Ct as untildify, D as getTimeframes, E as getTransfers, F as getRouteAttributes, G as getFrequencies, H as getLocationGroupStops, I as getRoutes, J as getFareRules, K as getFeedInfo, L as getRouteNetworks, M as getStopAreas, N as getShapes, O as getStoptimes, P as getShapesAsGeoJSON, Q as getFareAttributes, R as getRiderCategories, S as getDirections, St as prepDirectory, T as getTranslations, U as getLocationGroups, V as getLocations, W as getLevels, X as getFareMedia, Y as getFareProducts, Z as getFareLegRules, _ as getTimetableNotesReferences, _t as formatGtfsError, a as getDeadheads, at as getAgencies, b as getTimetableStopOrders, bt as generateFolderName, c as getVehiclePositions, ct as importGtfs, d as getTripCapacities, dt as deleteDb, et as getServiceIdsByDate, f as getRidership, ft as openDb, g as getTripsDatedVehicleJourneys, gt as GtfsWarningCode, h as getBoardAlights, ht as GtfsErrorCode, i as getDeadheadTimes, it as getAreas, j as getStopAttributes, k as getStops, l as getTripUpdates, lt as updateGtfsRealtime, m as getRideFeedInfo, mt as GtfsErrorCategory, n as getRunEvents, nt as getBookingRules, o as getServiceAlertInformedEntities, ot as advancedQuery, p as getRiderTrips, pt as GtfsError, q as getFareTransferRules, r as getOpsLocations, rt as getAttributions, s as getServiceAlerts, st as exportGtfs, t as getRunsPieces, tt as getCalendarDates, u as getStopTimeUpdates, ut as closeDb, v as getTimetableNotes, vt as isGtfsError, w as getTrips, wt as unzip, x as getTimetables, y as getTimetablePages, yt as isGtfsValidationError, z as getPathways } from "./src-CdVKeHzG.js";
1
+ import { $ as getCalendars, A as getStopsAsGeoJSON, B as getNetworks, C as getCalendarAttributes, Ct as untildify, D as getTimeframes, E as getTransfers, F as getRouteAttributes, G as getFrequencies, H as getLocationGroupStops, I as getRoutes, J as getFareRules, K as getFeedInfo, L as getRouteNetworks, M as getStopAreas, N as getShapes, O as getStoptimes, P as getShapesAsGeoJSON, Q as getFareAttributes, R as getRiderCategories, S as getDirections, St as prepDirectory, T as getTranslations, U as getLocationGroups, V as getLocations, W as getLevels, X as getFareMedia, Y as getFareProducts, Z as getFareLegRules, _ as getTimetableNotesReferences, _t as formatGtfsError, a as getDeadheads, at as getAgencies, b as getTimetableStopOrders, bt as generateFolderName, c as getVehiclePositions, ct as importGtfs, d as getTripCapacities, dt as deleteDb, et as getServiceIdsByDate, f as getRidership, ft as openDb, g as getTripsDatedVehicleJourneys, gt as GtfsWarningCode, h as getBoardAlights, ht as GtfsErrorCode, i as getDeadheadTimes, it as getAreas, j as getStopAttributes, k as getStops, l as getTripUpdates, lt as updateGtfsRealtime, m as getRideFeedInfo, mt as GtfsErrorCategory, n as getRunEvents, nt as getBookingRules, o as getServiceAlertInformedEntities, ot as advancedQuery, p as getRiderTrips, pt as GtfsError, q as getFareTransferRules, r as getOpsLocations, rt as getAttributions, s as getServiceAlerts, st as exportGtfs, t as getRunsPieces, tt as getCalendarDates, u as getStopTimeUpdates, ut as closeDb, v as getTimetableNotes, vt as isGtfsError, w as getTrips, wt as unzip, x as getTimetables, y as getTimetablePages, yt as isGtfsValidationError, z as getPathways } from "./src-gj91FR8c.js";
2
2
 
3
3
  export { GtfsError, GtfsErrorCategory, GtfsErrorCode, GtfsWarningCode, advancedQuery, closeDb, deleteDb, exportGtfs, formatGtfsError, generateFolderName, getAgencies, getAreas, getAttributions, getBoardAlights, getBookingRules, getCalendarAttributes, getCalendarDates, getCalendars, getDeadheadTimes, getDeadheads, getDirections, getFareAttributes, getFareLegRules, getFareMedia, getFareProducts, getFareRules, getFareTransferRules, getFeedInfo, getFrequencies, getLevels, getLocationGroupStops, getLocationGroups, getLocations, getNetworks, getOpsLocations, getPathways, getRideFeedInfo, getRiderCategories, getRiderTrips, getRidership, getRouteAttributes, getRouteNetworks, getRoutes, getRunEvents, getRunsPieces, getServiceAlertInformedEntities, getServiceAlerts, getServiceIdsByDate, getShapes, getShapesAsGeoJSON, getStopAreas, getStopAttributes, getStopTimeUpdates, getStops, getStopsAsGeoJSON, getStoptimes, getTimeframes, getTimetableNotes, getTimetableNotesReferences, getTimetablePages, getTimetableStopOrders, getTimetables, getTransfers, getTranslations, getTripCapacities, getTripUpdates, getTrips, getTripsDatedVehicleJourneys, getVehiclePositions, importGtfs, isGtfsError, isGtfsValidationError, openDb, prepDirectory, untildify, unzip, updateGtfsRealtime };
@@ -9,7 +9,7 @@ import mapSeries from "promise-map-series";
9
9
  import fs from "fs";
10
10
  import Database$1 from "better-sqlite3";
11
11
  import { homedir } from "node:os";
12
- import { cloneDeep, compact, filter, get, groupBy, last, noop, omit, omitBy, orderBy, pick, snakeCase, sortBy, without } from "lodash-es";
12
+ import { compact, filter, get, groupBy, last, noop, omit, omitBy, orderBy, pick, snakeCase, sortBy, without } from "lodash-es";
13
13
  import sanitize from "sanitize-filename";
14
14
  import StreamZip from "node-stream-zip";
15
15
  import { clearLine, cursorTo } from "node:readline";
@@ -296,7 +296,10 @@ function openDb(config = null) {
296
296
  return setupDb(sqlitePath);
297
297
  }
298
298
  if (Object.keys(dbs).length === 0) return setupDb(":memory:");
299
- if (Object.keys(dbs).length === 1) return dbs[Object.keys(dbs)[0]];
299
+ if (Object.keys(dbs).length === 1) {
300
+ const filename = Object.keys(dbs)[0];
301
+ return dbs[filename];
302
+ }
300
303
  if (Object.keys(dbs).length > 1) throw new GtfsError("Multiple databases open, please specify which one to use.", {
301
304
  code: "GTFS_DB_OPERATION_FAILED",
302
305
  category: "database",
@@ -390,17 +393,16 @@ function consolidateShapes(shapeGroups) {
390
393
  for (const segments of segmentsArray) {
391
394
  consolidatedLineStrings.push([]);
392
395
  for (const segment of segments) {
393
- const key1 = segment.flat().join(",");
394
- const key2 = segment.reverse().flat().join(",");
396
+ const [[x1, y1], [x2, y2]] = segment;
397
+ const key = x1 < x2 || x1 === x2 && y1 <= y2 ? `${x1},${y1},${x2},${y2}` : `${x2},${y2},${x1},${y1}`;
395
398
  const currentLine = last(consolidatedLineStrings);
396
- if (!currentLine || keys.has(key1) || keys.has(key2)) {
399
+ if (!currentLine || keys.has(key)) {
397
400
  consolidatedLineStrings.push([]);
398
401
  continue;
399
402
  }
400
403
  if (currentLine.length === 0) currentLine.push(segment[0]);
401
404
  currentLine.push(segment[1]);
402
- keys.add(key1);
403
- keys.add(key2);
405
+ keys.add(key);
404
406
  }
405
407
  }
406
408
  return filter(consolidatedLineStrings, isValidLineString);
@@ -422,7 +424,7 @@ function formatHexColor(color) {
422
424
  * @returns {Record<string, unknown>} Formatted properties object
423
425
  */
424
426
  function formatProperties(properties) {
425
- const formattedProperties = cloneDeep(omitBy(properties, (value) => value == null));
427
+ const formattedProperties = omitBy(properties, (value) => value == null);
426
428
  const formattedRouteColor = formatHexColor(properties.route_color);
427
429
  const formattedRouteTextColor = formatHexColor(properties.route_text_color);
428
430
  if (formattedRouteColor) formattedProperties.route_color = formattedRouteColor;
@@ -2473,4 +2475,4 @@ function getRunsPieces(query = {}, fields = [], orderBy = [], options = {}) {
2473
2475
 
2474
2476
  //#endregion
2475
2477
  export { getCalendars as $, getStopsAsGeoJSON as A, getNetworks as B, getCalendarAttributes as C, untildify as Ct, getTimeframes as D, getTransfers as E, getRouteAttributes as F, getFrequencies as G, getLocationGroupStops as H, getRoutes as I, getFareRules as J, getFeedInfo as K, getRouteNetworks as L, getStopAreas as M, getShapes as N, getStoptimes as O, getShapesAsGeoJSON as P, getFareAttributes as Q, getRiderCategories as R, getDirections as S, prepDirectory as St, getTranslations as T, formatError as Tt, getLocationGroups as U, getLocations as V, getLevels as W, getFareMedia as X, getFareProducts as Y, getFareLegRules as Z, getTimetableNotesReferences as _, formatGtfsError as _t, getDeadheads as a, getAgencies as at, getTimetableStopOrders as b, generateFolderName as bt, getVehiclePositions as c, importGtfs as ct, getTripCapacities as d, deleteDb as dt, getServiceIdsByDate as et, getRidership as f, openDb as ft, getTripsDatedVehicleJourneys as g, GtfsWarningCode as gt, getBoardAlights as h, GtfsErrorCode as ht, getDeadheadTimes as i, getAreas as it, getStopAttributes as j, getStops as k, getTripUpdates as l, updateGtfsRealtime as lt, getRideFeedInfo as m, GtfsErrorCategory as mt, getRunEvents as n, getBookingRules as nt, getServiceAlertInformedEntities as o, advancedQuery as ot, getRiderTrips as p, GtfsError as pt, getFareTransferRules as q, getOpsLocations as r, getAttributions as rt, getServiceAlerts as s, exportGtfs as st, getRunsPieces as t, getCalendarDates as tt, getStopTimeUpdates as u, closeDb as ut, getTimetableNotes as v, isGtfsError as vt, getTrips as w, unzip as wt, getTimetables as x, getConfig as xt, getTimetablePages as y, isGtfsValidationError as yt, getPathways as z };
2476
- //# sourceMappingURL=src-CdVKeHzG.js.map
2478
+ //# sourceMappingURL=src-gj91FR8c.js.map