lt-public-transport-sdk 1.0.0 → 1.2.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/LICENSE +21 -21
- package/README.md +495 -283
- package/dist/config.d.ts +41 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +34 -0
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +12 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/gtfs/index.d.ts +2 -2
- package/dist/gtfs/index.d.ts.map +1 -1
- package/dist/gtfs/index.js +2 -2
- package/dist/gtfs/index.js.map +1 -1
- package/dist/gtfs/parser.d.ts +49 -2
- package/dist/gtfs/parser.d.ts.map +1 -1
- package/dist/gtfs/parser.js +328 -2
- package/dist/gtfs/parser.js.map +1 -1
- package/dist/gtfs/sync.d.ts +26 -2
- package/dist/gtfs/sync.d.ts.map +1 -1
- package/dist/gtfs/sync.js +205 -12
- package/dist/gtfs/sync.js.map +1 -1
- package/dist/index.d.ts +151 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +254 -36
- package/dist/index.js.map +1 -1
- package/dist/parsers/gps-lite.d.ts +34 -36
- package/dist/parsers/gps-lite.d.ts.map +1 -1
- package/dist/parsers/gps-lite.js +77 -69
- package/dist/parsers/gps-lite.js.map +1 -1
- package/dist/parsers/index.d.ts +2 -1
- package/dist/parsers/index.d.ts.map +1 -1
- package/dist/parsers/index.js +4 -1
- package/dist/parsers/index.js.map +1 -1
- package/dist/schemas.d.ts +242 -13
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +183 -33
- package/dist/schemas.js.map +1 -1
- package/dist/types.d.ts +106 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/scripts/test-city-specific.d.ts +0 -2
- package/dist/scripts/test-city-specific.d.ts.map +0 -1
- package/dist/scripts/test-city-specific.js +0 -264
- package/dist/scripts/test-city-specific.js.map +0 -1
- package/dist/scripts/test-config-options.d.ts +0 -2
- package/dist/scripts/test-config-options.d.ts.map +0 -1
- package/dist/scripts/test-config-options.js +0 -166
- package/dist/scripts/test-config-options.js.map +0 -1
- package/dist/scripts/test-data-quality.d.ts +0 -2
- package/dist/scripts/test-data-quality.d.ts.map +0 -1
- package/dist/scripts/test-data-quality.js +0 -204
- package/dist/scripts/test-data-quality.js.map +0 -1
- package/dist/scripts/test-error-handling.d.ts +0 -2
- package/dist/scripts/test-error-handling.d.ts.map +0 -1
- package/dist/scripts/test-error-handling.js +0 -146
- package/dist/scripts/test-error-handling.js.map +0 -1
- package/dist/scripts/test-live.d.ts +0 -2
- package/dist/scripts/test-live.d.ts.map +0 -1
- package/dist/scripts/test-live.js +0 -121
- package/dist/scripts/test-live.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { tmpdir } from 'node:os';
|
|
26
26
|
import { join } from 'node:path';
|
|
27
|
-
import { CITY_CONFIGS,
|
|
27
|
+
import { CITY_CONFIGS, ALL_CITY_IDS } from './config.js';
|
|
28
28
|
import { TransportNetworkError, GpsNotAvailableError, SyncRequiredError, InvalidCityError, } from './errors.js';
|
|
29
29
|
import { parseGpsFullStream } from './parsers/gps-full.js';
|
|
30
|
-
import { parseGpsLiteStream,
|
|
31
|
-
import { syncGtfs, loadGtfsCache, loadCachedRoutes, loadCachedStops } from './gtfs/sync.js';
|
|
30
|
+
import { parseGpsLiteStream, getLiteFormatDescriptor } from './parsers/gps-lite.js';
|
|
31
|
+
import { syncGtfs, loadGtfsCache, loadCachedRoutes, loadCachedStops, loadCachedTrips, loadCachedShapes, loadCachedCalendar, loadCachedCalendarDates, loadCachedAgencies, loadCachedStopTimes, } from './gtfs/sync.js';
|
|
32
32
|
import { enrichVehicles, buildRouteCache } from './enrichment/route-matcher.js';
|
|
33
33
|
import { clientConfigSchema } from './schemas.js';
|
|
34
34
|
// =============================================================================
|
|
@@ -72,6 +72,13 @@ export class LtTransport {
|
|
|
72
72
|
autoEnrich;
|
|
73
73
|
filterInvalidCoords;
|
|
74
74
|
filterStale;
|
|
75
|
+
/**
|
|
76
|
+
* Effective city configurations (built-in + custom + overrides merged).
|
|
77
|
+
* This is the source of truth for city configs in this instance.
|
|
78
|
+
*/
|
|
79
|
+
effectiveCityConfigs;
|
|
80
|
+
/** Sorted list of all effective city IDs */
|
|
81
|
+
effectiveCityIds;
|
|
75
82
|
/** In-memory route cache for fast enrichment */
|
|
76
83
|
routeCaches = new Map();
|
|
77
84
|
/** Last sync timestamps for throttling */
|
|
@@ -80,9 +87,11 @@ export class LtTransport {
|
|
|
80
87
|
* Create a new LtTransport client.
|
|
81
88
|
*
|
|
82
89
|
* @param config - Client configuration options
|
|
90
|
+
* @throws {ZodError} If config validation fails (includes helpful error messages)
|
|
83
91
|
*/
|
|
84
92
|
constructor(config = {}) {
|
|
85
|
-
// Validate config with Zod schema for runtime safety
|
|
93
|
+
// Validate entire config with Zod schema for runtime safety
|
|
94
|
+
// This validates customCities and cityOverrides structure and values
|
|
86
95
|
const validated = clientConfigSchema.parse({
|
|
87
96
|
cacheDir: config.cacheDir,
|
|
88
97
|
requestTimeout: config.requestTimeout ?? DEFAULT_TIMEOUT,
|
|
@@ -91,6 +100,8 @@ export class LtTransport {
|
|
|
91
100
|
autoEnrich: config.autoEnrich ?? true,
|
|
92
101
|
filterInvalidCoords: config.filterInvalidCoords ?? true,
|
|
93
102
|
filterStale: config.filterStale ?? false,
|
|
103
|
+
customCities: config.customCities,
|
|
104
|
+
cityOverrides: config.cityOverrides,
|
|
94
105
|
});
|
|
95
106
|
this.cacheDir = validated.cacheDir ?? getDefaultCacheDir();
|
|
96
107
|
this.requestTimeout = validated.requestTimeout;
|
|
@@ -99,6 +110,58 @@ export class LtTransport {
|
|
|
99
110
|
this.autoEnrich = validated.autoEnrich;
|
|
100
111
|
this.filterInvalidCoords = validated.filterInvalidCoords;
|
|
101
112
|
this.filterStale = validated.filterStale;
|
|
113
|
+
// Build effective city configurations by merging:
|
|
114
|
+
// 1. Built-in CITY_CONFIGS
|
|
115
|
+
// 2. Custom cities from config.customCities
|
|
116
|
+
// 3. Overrides from config.cityOverrides
|
|
117
|
+
this.effectiveCityConfigs = this.buildEffectiveCityConfigs(validated.customCities, validated.cityOverrides);
|
|
118
|
+
// Build sorted list of city IDs
|
|
119
|
+
this.effectiveCityIds = Array.from(this.effectiveCityConfigs.keys()).sort();
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Build effective city configurations by merging built-in, custom, and overrides.
|
|
123
|
+
*/
|
|
124
|
+
buildEffectiveCityConfigs(customCities, cityOverrides) {
|
|
125
|
+
const configs = new Map();
|
|
126
|
+
// Step 1: Add all built-in cities
|
|
127
|
+
for (const cityId of ALL_CITY_IDS) {
|
|
128
|
+
configs.set(cityId, CITY_CONFIGS[cityId]);
|
|
129
|
+
}
|
|
130
|
+
// Step 2: Apply overrides to built-in cities
|
|
131
|
+
if (cityOverrides) {
|
|
132
|
+
for (const [cityId, override] of Object.entries(cityOverrides)) {
|
|
133
|
+
const existing = configs.get(cityId);
|
|
134
|
+
if (existing !== undefined) {
|
|
135
|
+
configs.set(cityId, this.mergeCityConfig(existing, override));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Step 3: Add custom cities (can override built-in if same ID)
|
|
140
|
+
if (customCities) {
|
|
141
|
+
for (const [cityId, cityConfig] of Object.entries(customCities)) {
|
|
142
|
+
configs.set(cityId, cityConfig);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return configs;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Deep merge a city config with partial overrides.
|
|
149
|
+
*/
|
|
150
|
+
mergeCityConfig(base, override) {
|
|
151
|
+
return {
|
|
152
|
+
id: override.id ?? base.id,
|
|
153
|
+
tier: override.tier ?? base.tier,
|
|
154
|
+
gps: override.gps ? { ...base.gps, ...override.gps } : base.gps,
|
|
155
|
+
gtfs: override.gtfs ? { ...base.gtfs, ...override.gtfs } : base.gtfs,
|
|
156
|
+
liteFormat: override.liteFormat ?? base.liteFormat,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get effective city config for a city ID.
|
|
161
|
+
* Checks the merged config map which includes built-in, custom, and overridden configs.
|
|
162
|
+
*/
|
|
163
|
+
getEffectiveCityConfig(cityId) {
|
|
164
|
+
return this.effectiveCityConfigs.get(cityId);
|
|
102
165
|
}
|
|
103
166
|
// ===========================================================================
|
|
104
167
|
// Public API
|
|
@@ -106,13 +169,14 @@ export class LtTransport {
|
|
|
106
169
|
/**
|
|
107
170
|
* Get real-time vehicle positions for a city.
|
|
108
171
|
*
|
|
109
|
-
* For silver-tier cities
|
|
110
|
-
*
|
|
172
|
+
* For silver-tier cities, vehicles will be enriched with GTFS data
|
|
173
|
+
* if `sync()` has been called and `autoEnrich` is enabled.
|
|
111
174
|
*
|
|
112
|
-
* @param city - City identifier
|
|
175
|
+
* @param city - City identifier (built-in or custom)
|
|
113
176
|
* @returns Array of vehicle positions
|
|
114
|
-
* @throws {GpsNotAvailableError} If city
|
|
177
|
+
* @throws {GpsNotAvailableError} If city has no GPS data (bronze tier)
|
|
115
178
|
* @throws {TransportNetworkError} If network request fails
|
|
179
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
116
180
|
*
|
|
117
181
|
* @example
|
|
118
182
|
* ```typescript
|
|
@@ -121,8 +185,10 @@ export class LtTransport {
|
|
|
121
185
|
* ```
|
|
122
186
|
*/
|
|
123
187
|
async getVehicles(city) {
|
|
124
|
-
this.
|
|
125
|
-
|
|
188
|
+
const config = this.getEffectiveCityConfig(city);
|
|
189
|
+
if (!config) {
|
|
190
|
+
throw new InvalidCityError(city);
|
|
191
|
+
}
|
|
126
192
|
if (!config.gps.enabled || config.gps.url === null) {
|
|
127
193
|
throw new GpsNotAvailableError(city);
|
|
128
194
|
}
|
|
@@ -131,26 +197,36 @@ export class LtTransport {
|
|
|
131
197
|
// Parse based on format
|
|
132
198
|
let vehicles;
|
|
133
199
|
if (config.gps.format === 'full') {
|
|
200
|
+
// Gold tier: header-based CSV with rich metadata
|
|
134
201
|
vehicles = parseGpsFullStream(text, city, {
|
|
135
202
|
staleThresholdMs: this.staleThresholdMs,
|
|
136
203
|
filterStale: this.filterStale,
|
|
137
204
|
filterInvalidCoords: this.filterInvalidCoords,
|
|
138
205
|
});
|
|
139
206
|
}
|
|
140
|
-
else if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
207
|
+
else if (config.gps.format === 'lite') {
|
|
208
|
+
// Silver tier: headerless CSV using format descriptor
|
|
209
|
+
const liteFormat = getLiteFormatDescriptor(city, config);
|
|
210
|
+
if (!liteFormat) {
|
|
211
|
+
// No format descriptor available - can't parse
|
|
212
|
+
console.warn(`No lite format descriptor for city: ${city}. Add liteFormat to city config.`);
|
|
213
|
+
vehicles = [];
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
vehicles = parseGpsLiteStream(text, city, liteFormat, {
|
|
217
|
+
filterInvalidCoords: this.filterInvalidCoords,
|
|
218
|
+
});
|
|
219
|
+
// Enrich silver-tier cities with GTFS data
|
|
220
|
+
if (this.autoEnrich) {
|
|
221
|
+
const routeCache = await this.getRouteCache(city);
|
|
222
|
+
if (routeCache) {
|
|
223
|
+
vehicles = enrichVehicles(vehicles, routeCache);
|
|
224
|
+
}
|
|
149
225
|
}
|
|
150
226
|
}
|
|
151
227
|
}
|
|
152
228
|
else {
|
|
153
|
-
// Unknown format
|
|
229
|
+
// Unknown format (bronze tier or misconfigured)
|
|
154
230
|
vehicles = [];
|
|
155
231
|
}
|
|
156
232
|
return vehicles;
|
|
@@ -163,10 +239,11 @@ export class LtTransport {
|
|
|
163
239
|
*
|
|
164
240
|
* Throttled to minimum 60 seconds between calls for same city.
|
|
165
241
|
*
|
|
166
|
-
* @param city - City to sync
|
|
242
|
+
* @param city - City to sync (built-in or custom)
|
|
167
243
|
* @param force - Force re-download even if cache is current
|
|
168
244
|
* @returns Sync result with counts and status
|
|
169
245
|
* @throws {GtfsSyncError} If sync fails
|
|
246
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
170
247
|
*
|
|
171
248
|
* @example
|
|
172
249
|
* ```typescript
|
|
@@ -175,7 +252,10 @@ export class LtTransport {
|
|
|
175
252
|
* ```
|
|
176
253
|
*/
|
|
177
254
|
async sync(city, force = false) {
|
|
178
|
-
this.
|
|
255
|
+
const config = this.getEffectiveCityConfig(city);
|
|
256
|
+
if (!config) {
|
|
257
|
+
throw new InvalidCityError(city);
|
|
258
|
+
}
|
|
179
259
|
// Throttle sync calls (60s minimum between calls)
|
|
180
260
|
const lastSync = this.lastSyncTimes.get(city);
|
|
181
261
|
const now = Date.now();
|
|
@@ -184,7 +264,7 @@ export class LtTransport {
|
|
|
184
264
|
const cache = await loadGtfsCache(city, this.cacheDir);
|
|
185
265
|
if (cache) {
|
|
186
266
|
return {
|
|
187
|
-
city,
|
|
267
|
+
city: city,
|
|
188
268
|
status: 'up-to-date',
|
|
189
269
|
routeCount: cache.meta.routeCount,
|
|
190
270
|
stopCount: cache.meta.stopCount,
|
|
@@ -212,6 +292,7 @@ export class LtTransport {
|
|
|
212
292
|
* @param city - City to get stops for
|
|
213
293
|
* @returns Array of stops
|
|
214
294
|
* @throws {SyncRequiredError} If GTFS data not synced
|
|
295
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
215
296
|
*
|
|
216
297
|
* @example
|
|
217
298
|
* ```typescript
|
|
@@ -221,7 +302,10 @@ export class LtTransport {
|
|
|
221
302
|
* ```
|
|
222
303
|
*/
|
|
223
304
|
async getStops(city) {
|
|
224
|
-
this.
|
|
305
|
+
const config = this.getEffectiveCityConfig(city);
|
|
306
|
+
if (!config) {
|
|
307
|
+
throw new InvalidCityError(city);
|
|
308
|
+
}
|
|
225
309
|
const stops = await loadCachedStops(this.cacheDir, city);
|
|
226
310
|
if (!stops) {
|
|
227
311
|
throw new SyncRequiredError(city);
|
|
@@ -236,6 +320,7 @@ export class LtTransport {
|
|
|
236
320
|
* @param city - City to get routes for
|
|
237
321
|
* @returns Array of routes
|
|
238
322
|
* @throws {SyncRequiredError} If GTFS data not synced
|
|
323
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
239
324
|
*
|
|
240
325
|
* @example
|
|
241
326
|
* ```typescript
|
|
@@ -245,7 +330,10 @@ export class LtTransport {
|
|
|
245
330
|
* ```
|
|
246
331
|
*/
|
|
247
332
|
async getRoutes(city) {
|
|
248
|
-
this.
|
|
333
|
+
const config = this.getEffectiveCityConfig(city);
|
|
334
|
+
if (!config) {
|
|
335
|
+
throw new InvalidCityError(city);
|
|
336
|
+
}
|
|
249
337
|
const routeCache = await this.getRouteCache(city);
|
|
250
338
|
if (!routeCache) {
|
|
251
339
|
throw new SyncRequiredError(city);
|
|
@@ -262,29 +350,159 @@ export class LtTransport {
|
|
|
262
350
|
return routes;
|
|
263
351
|
}
|
|
264
352
|
/**
|
|
265
|
-
* Get list of all
|
|
353
|
+
* Get list of all available city IDs.
|
|
354
|
+
* Includes built-in cities and any custom cities added via config.
|
|
266
355
|
*/
|
|
267
356
|
getCities() {
|
|
268
|
-
return
|
|
357
|
+
return this.effectiveCityIds;
|
|
269
358
|
}
|
|
270
359
|
/**
|
|
271
360
|
* Get configuration for a specific city.
|
|
361
|
+
* Returns effective config (with any overrides applied).
|
|
362
|
+
*
|
|
363
|
+
* @throws {InvalidCityError} If city is not found
|
|
272
364
|
*/
|
|
273
365
|
getCityConfig(city) {
|
|
274
|
-
this.
|
|
275
|
-
|
|
366
|
+
const config = this.getEffectiveCityConfig(city);
|
|
367
|
+
if (!config) {
|
|
368
|
+
throw new InvalidCityError(city);
|
|
369
|
+
}
|
|
370
|
+
return config;
|
|
276
371
|
}
|
|
277
|
-
// ===========================================================================
|
|
278
|
-
// Private Helpers
|
|
279
|
-
// ===========================================================================
|
|
280
372
|
/**
|
|
281
|
-
*
|
|
373
|
+
* Get trip data for a city.
|
|
374
|
+
*
|
|
375
|
+
* Requires prior `sync()` call to download GTFS data.
|
|
376
|
+
*
|
|
377
|
+
* @param city - City to get trips for
|
|
378
|
+
* @returns Array of trips
|
|
379
|
+
* @throws {SyncRequiredError} If GTFS data not synced
|
|
380
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
282
381
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
382
|
+
async getTrips(city) {
|
|
383
|
+
const config = this.getEffectiveCityConfig(city);
|
|
384
|
+
if (!config) {
|
|
285
385
|
throw new InvalidCityError(city);
|
|
286
386
|
}
|
|
387
|
+
const trips = await loadCachedTrips(this.cacheDir, city);
|
|
388
|
+
if (!trips) {
|
|
389
|
+
throw new SyncRequiredError(city);
|
|
390
|
+
}
|
|
391
|
+
return Array.from(trips.values());
|
|
287
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Get shape data for a city (geographic paths for routes).
|
|
395
|
+
*
|
|
396
|
+
* Requires prior `sync()` call to download GTFS data.
|
|
397
|
+
* Returns a Map where keys are shape IDs and values are arrays of points.
|
|
398
|
+
*
|
|
399
|
+
* @param city - City to get shapes for
|
|
400
|
+
* @returns Map from shape ID to array of ShapePoint
|
|
401
|
+
* @throws {SyncRequiredError} If GTFS data not synced
|
|
402
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
403
|
+
*/
|
|
404
|
+
async getShapes(city) {
|
|
405
|
+
const config = this.getEffectiveCityConfig(city);
|
|
406
|
+
if (!config) {
|
|
407
|
+
throw new InvalidCityError(city);
|
|
408
|
+
}
|
|
409
|
+
const shapes = await loadCachedShapes(this.cacheDir, city);
|
|
410
|
+
if (!shapes) {
|
|
411
|
+
throw new SyncRequiredError(city);
|
|
412
|
+
}
|
|
413
|
+
return shapes;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Get service calendar data for a city.
|
|
417
|
+
*
|
|
418
|
+
* Requires prior `sync()` call to download GTFS data.
|
|
419
|
+
*
|
|
420
|
+
* @param city - City to get calendar for
|
|
421
|
+
* @returns Array of Calendar entries
|
|
422
|
+
* @throws {SyncRequiredError} If GTFS data not synced
|
|
423
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
424
|
+
*/
|
|
425
|
+
async getCalendar(city) {
|
|
426
|
+
const config = this.getEffectiveCityConfig(city);
|
|
427
|
+
if (!config) {
|
|
428
|
+
throw new InvalidCityError(city);
|
|
429
|
+
}
|
|
430
|
+
const calendar = await loadCachedCalendar(this.cacheDir, city);
|
|
431
|
+
if (!calendar) {
|
|
432
|
+
throw new SyncRequiredError(city);
|
|
433
|
+
}
|
|
434
|
+
return Array.from(calendar.values());
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Get calendar date exceptions for a city.
|
|
438
|
+
*
|
|
439
|
+
* Requires prior `sync()` call to download GTFS data.
|
|
440
|
+
*
|
|
441
|
+
* @param city - City to get calendar dates for
|
|
442
|
+
* @returns Array of CalendarDate exceptions
|
|
443
|
+
* @throws {SyncRequiredError} If GTFS data not synced
|
|
444
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
445
|
+
*/
|
|
446
|
+
async getCalendarDates(city) {
|
|
447
|
+
const config = this.getEffectiveCityConfig(city);
|
|
448
|
+
if (!config) {
|
|
449
|
+
throw new InvalidCityError(city);
|
|
450
|
+
}
|
|
451
|
+
const calendarDates = await loadCachedCalendarDates(this.cacheDir, city);
|
|
452
|
+
if (!calendarDates) {
|
|
453
|
+
throw new SyncRequiredError(city);
|
|
454
|
+
}
|
|
455
|
+
return calendarDates;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Get agency information for a city.
|
|
459
|
+
*
|
|
460
|
+
* Requires prior `sync()` call to download GTFS data.
|
|
461
|
+
*
|
|
462
|
+
* @param city - City to get agencies for
|
|
463
|
+
* @returns Array of Agency objects
|
|
464
|
+
* @throws {SyncRequiredError} If GTFS data not synced
|
|
465
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
466
|
+
*/
|
|
467
|
+
async getAgencies(city) {
|
|
468
|
+
const config = this.getEffectiveCityConfig(city);
|
|
469
|
+
if (!config) {
|
|
470
|
+
throw new InvalidCityError(city);
|
|
471
|
+
}
|
|
472
|
+
const agencies = await loadCachedAgencies(this.cacheDir, city);
|
|
473
|
+
if (!agencies) {
|
|
474
|
+
throw new SyncRequiredError(city);
|
|
475
|
+
}
|
|
476
|
+
return agencies;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Get stop times (schedule) data for a city.
|
|
480
|
+
*
|
|
481
|
+
* **Warning**: This dataset is large (~25MB for Vilnius) and will consume
|
|
482
|
+
* significant memory (~150-200MB) when loaded.
|
|
483
|
+
*
|
|
484
|
+
* Requires prior `sync()` call to download GTFS data.
|
|
485
|
+
* Returns a Map where keys are trip IDs and values are arrays of stop times.
|
|
486
|
+
*
|
|
487
|
+
* @param city - City to get schedule for
|
|
488
|
+
* @returns Map from trip ID to array of StopTime
|
|
489
|
+
* @throws {SyncRequiredError} If GTFS data not synced
|
|
490
|
+
* @throws {InvalidCityError} If city is not recognized
|
|
491
|
+
*/
|
|
492
|
+
async getSchedule(city) {
|
|
493
|
+
const config = this.getEffectiveCityConfig(city);
|
|
494
|
+
if (!config) {
|
|
495
|
+
throw new InvalidCityError(city);
|
|
496
|
+
}
|
|
497
|
+
const stopTimes = await loadCachedStopTimes(this.cacheDir, city);
|
|
498
|
+
if (!stopTimes) {
|
|
499
|
+
throw new SyncRequiredError(city);
|
|
500
|
+
}
|
|
501
|
+
return stopTimes;
|
|
502
|
+
}
|
|
503
|
+
// ===========================================================================
|
|
504
|
+
// Private Helpers
|
|
505
|
+
// ===========================================================================
|
|
288
506
|
/**
|
|
289
507
|
* Fetch text content from URL.
|
|
290
508
|
*/
|
|
@@ -334,7 +552,7 @@ export class LtTransport {
|
|
|
334
552
|
}
|
|
335
553
|
export { GTFS_ROUTE_TYPE_MAP, LT_TRANSPORT_TYPE_MAP } from './types.js';
|
|
336
554
|
// Config
|
|
337
|
-
export { CITY_CONFIGS, ALL_CITY_IDS, getCityConfig, getCitiesByTier, hasGpsData, hasGtfsData } from './config.js';
|
|
555
|
+
export { CITY_CONFIGS, ALL_CITY_IDS, getCityConfig, getCitiesByTier, hasGpsData, hasGtfsData, LITE_FORMAT_DESCRIPTORS } from './config.js';
|
|
338
556
|
// Errors
|
|
339
557
|
export { TransportError, TransportNetworkError, GpsNotAvailableError, SyncRequiredError, GtfsSyncError, ParseError, InvalidCityError, isTransportError, isNetworkError, } from './errors.js';
|
|
340
558
|
// Utilities
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAmB,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAsDlD,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9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W,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,iBAAiB;QACjB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAc,CAAC,CAAC;QAErE,IAAI,MAAM,EAAE,CAAC;YACX,iFAAiF;YACjF,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAuBD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExE,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG3I,SAAS;AACT,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,YAAY;AACZ,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EACzB,WAAW,GACZ,MAAM,kBAAkB,CAAC"}
|
|
@@ -2,37 +2,16 @@
|
|
|
2
2
|
* GPS Lite Format Parser for silver-tier cities
|
|
3
3
|
* @module parsers/gps-lite
|
|
4
4
|
*
|
|
5
|
-
* Handles the "lite" GPS format used by silver-tier cities
|
|
6
|
-
* These streams have no header row and
|
|
5
|
+
* Handles the "lite" GPS format used by silver-tier cities.
|
|
6
|
+
* These streams have no header row and use a data-driven format descriptor
|
|
7
|
+
* to parse columns at specified indices.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
*/
|
|
12
|
-
import type { CityId, Vehicle } from '../types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Panevėžys format (9 columns, no header):
|
|
15
|
-
* [0] type - Always "2" (bus?)
|
|
16
|
-
* [1] route - Route name (often empty)
|
|
17
|
-
* [2] longitude - Integer format (÷1,000,000)
|
|
18
|
-
* [3] latitude - Integer format (÷1,000,000)
|
|
19
|
-
* [4] speed - Speed or delay?
|
|
20
|
-
* [5] azimuth - Bearing in degrees
|
|
21
|
-
* [6] (empty) - Unknown
|
|
22
|
-
* [7] vehicleId - Vehicle identifier
|
|
23
|
-
* [8] (empty) - Unknown
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Tauragė format (8 columns, no header):
|
|
27
|
-
* [0] type - Always "2" (bus?)
|
|
28
|
-
* [1] route - Route name (S11, S19) - ALPHANUMERIC!
|
|
29
|
-
* [2] longitude - Integer format (÷1,000,000)
|
|
30
|
-
* [3] latitude - Integer format (÷1,000,000)
|
|
31
|
-
* [4] speed - Speed in km/h
|
|
32
|
-
* [5] azimuth - Bearing in degrees
|
|
33
|
-
* [6] vehicleId - Vehicle identifier
|
|
34
|
-
* [7] (empty) - Unknown
|
|
9
|
+
* This design allows users to:
|
|
10
|
+
* - Add new cities without SDK updates
|
|
11
|
+
* - Override formats when cities change their data structure
|
|
35
12
|
*/
|
|
13
|
+
import type { Vehicle } from '../types.js';
|
|
14
|
+
import type { LiteFormatDescriptor, CityConfig } from '../config.js';
|
|
36
15
|
/**
|
|
37
16
|
* Options for GPS lite format parsing.
|
|
38
17
|
*/
|
|
@@ -41,20 +20,39 @@ export interface GpsLiteParseOptions {
|
|
|
41
20
|
filterInvalidCoords?: boolean;
|
|
42
21
|
}
|
|
43
22
|
/**
|
|
44
|
-
*
|
|
23
|
+
* Get the lite format descriptor for a city.
|
|
24
|
+
* Checks city config first, then falls back to built-in descriptors.
|
|
25
|
+
*
|
|
26
|
+
* @param cityId - The city identifier
|
|
27
|
+
* @param cityConfig - Optional city config with custom liteFormat
|
|
28
|
+
* @returns The format descriptor, or undefined if not found
|
|
45
29
|
*/
|
|
46
|
-
export
|
|
30
|
+
export declare function getLiteFormatDescriptor(cityId: string, cityConfig?: CityConfig): LiteFormatDescriptor | undefined;
|
|
47
31
|
/**
|
|
48
|
-
* Check if a city uses lite GPS format.
|
|
32
|
+
* Check if a city uses lite GPS format based on its config.
|
|
33
|
+
*
|
|
34
|
+
* @param cityConfig - The city configuration
|
|
35
|
+
* @returns True if the city uses lite format
|
|
49
36
|
*/
|
|
50
|
-
export declare function
|
|
37
|
+
export declare function isLiteFormat(cityConfig: CityConfig): boolean;
|
|
51
38
|
/**
|
|
52
|
-
* Parse GPS lite format stream
|
|
39
|
+
* Parse GPS lite format stream using a format descriptor.
|
|
53
40
|
*
|
|
54
41
|
* @param text - Raw text content from gps.txt
|
|
55
|
-
* @param
|
|
42
|
+
* @param cityId - City identifier for vehicle ID prefixing
|
|
43
|
+
* @param format - Format descriptor defining column indices
|
|
56
44
|
* @param options - Parse options
|
|
57
45
|
* @returns Array of normalized Vehicle objects
|
|
58
46
|
*/
|
|
59
|
-
export declare function parseGpsLiteStream(text: string,
|
|
47
|
+
export declare function parseGpsLiteStream(text: string, cityId: string, format: LiteFormatDescriptor, options?: GpsLiteParseOptions): Vehicle[];
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Use isLiteFormat(cityConfig) instead.
|
|
50
|
+
* Legacy type for cities that use lite GPS format.
|
|
51
|
+
*/
|
|
52
|
+
export type LiteCityId = 'panevezys' | 'taurage';
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use isLiteFormat(cityConfig) instead.
|
|
55
|
+
* Check if a city uses lite GPS format.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isLiteCity(cityId: string): cityId is LiteCityId;
|
|
60
58
|
//# sourceMappingURL=gps-lite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gps-lite.d.ts","sourceRoot":"","sources":["../../src/parsers/gps-lite.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gps-lite.d.ts","sourceRoot":"","sources":["../../src/parsers/gps-lite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAarE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAMD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,GACtB,oBAAoB,GAAG,SAAS,CAQlC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAE5D;AAMD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE,mBAAwB,GAChC,OAAO,EAAE,CA8BX;AAkFD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAEjD;;;GAGG;AAEH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,UAAU,CAE/D"}
|