Skip to content

Claude/create gtfs sqljs module 011 c up nn k ltuvz d dz xyz fy rm - #5

Merged
chtitux merged 3 commits into
mainfrom
claude/create-gtfs-sqljs-module-011CUpNnKLtuvzDDzXYZFyRm
Nov 5, 2025
Merged

chtitux merged 3 commits into
mainfrom
claude/create-gtfs-sqljs-module-011CUpNnKLtuvzDDzXYZFyRm

Conversation

@chtitux

@chtitux chtitux commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

No description provided.

- Add Documentation & Demo section with link to live site
- Include description encouraging users to try the interactive demo
Major API improvement: Add flexible parameter object-based query methods
that allow combining multiple filters instead of requiring separate methods
for each parameter combination.

New methods:
- getStops(filters?) - Filter by stopId, stopCode, name, tripId, limit
- getRoutes(filters?) - Filter by routeId, agencyId, limit
- getTrips(filters?) - Filter by tripId, routeId, date, directionId, limit
- getStopTimes(filters?) - Filter by tripId, stopId, routeId, date, directionId, limit

Benefits:
- More flexible and composable API
- Easier to add new filter options without API changes
- Cleaner code with fewer method overloads
- Better TypeScript support with exported filter types

All existing methods remain available for backward compatibility.

Updated:
- Query methods in src/queries/ with flexible filter implementations
- Main GtfsSqlJs class with new public API methods
- README.md with comprehensive documentation of new API
- Website documentation highlighting the flexible approach
- Exported filter types (StopFilters, RouteFilters, TripFilters, StopTimeFilters)

All 77 tests pass successfully.
The demo was failing because the ZIP loader tried to use Node.js fs module
for relative paths like './car-jaune.zip' even in browser environments.

Changes:
- Detect browser vs Node.js environment using process.versions.node check
- In browser: use fetch() for both absolute URLs and relative paths
- In Node.js: use fs for file paths, fetch for URLs
- Properly handle relative URLs in browser (e.g., ./car-jaune.zip)

This fixes the error:
'Cannot read properties of undefined (reading readFile)'

All 77 tests still pass.
@chtitux
chtitux merged commit 44e9e5a into main Nov 5, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants