@stiava/cta 1.0.0 → 1.0.1

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.
@@ -17,3 +17,7 @@ export type CTATrainStopRaw = {
17
17
  location_type: string;
18
18
  parent_station: string;
19
19
  };
20
+ export declare class CTASystemGuide {
21
+ static getTrainLines(): string[];
22
+ static readInTrainStationsByRoute(line: 'blue' | 'red' | 'brown' | 'yellow' | 'orange' | 'pink' | 'green'): unknown[];
23
+ }
package/dist/index.cjs CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
32
  CTABusService: () => CTABusService,
33
+ CTASystemGuide: () => CTASystemGuide,
33
34
  CTATrainService: () => CTATrainService
34
35
  });
35
36
  module.exports = __toCommonJS(index_exports);
@@ -147,8 +148,34 @@ var CTABusService = class {
147
148
 
148
149
  // cta_system_data.ts
149
150
  var Papa = __toESM(require("papaparse"), 1);
151
+ var CTASystemGuide = class {
152
+ static getTrainLines() {
153
+ return ["Red", "Green", "Pink", "Blue", "Purple", "Orange", "Brown"];
154
+ }
155
+ static readInTrainStationsByRoute(line) {
156
+ const result = Papa.parse(`./public/trains/${line}_stations.csv`, {
157
+ header: true,
158
+ dynamicTyping: true,
159
+ skipEmptyLines: true,
160
+ transform(value, field) {
161
+ switch (field) {
162
+ case "parking_capacity":
163
+ return value === "" ? null : Number(value);
164
+ case "platforms":
165
+ return value.split(",").map((v) => v.trim()).filter(Boolean);
166
+ case "connected_buses":
167
+ return value === "true";
168
+ default:
169
+ return value;
170
+ }
171
+ }
172
+ });
173
+ return result.data;
174
+ }
175
+ };
150
176
  // Annotate the CommonJS export names for ESM import in node:
151
177
  0 && (module.exports = {
152
178
  CTABusService,
179
+ CTASystemGuide,
153
180
  CTATrainService
154
181
  });
package/dist/index.js CHANGED
@@ -111,7 +111,33 @@ var CTABusService = class {
111
111
 
112
112
  // cta_system_data.ts
113
113
  import * as Papa from "papaparse";
114
+ var CTASystemGuide = class {
115
+ static getTrainLines() {
116
+ return ["Red", "Green", "Pink", "Blue", "Purple", "Orange", "Brown"];
117
+ }
118
+ static readInTrainStationsByRoute(line) {
119
+ const result = Papa.parse(`./public/trains/${line}_stations.csv`, {
120
+ header: true,
121
+ dynamicTyping: true,
122
+ skipEmptyLines: true,
123
+ transform(value, field) {
124
+ switch (field) {
125
+ case "parking_capacity":
126
+ return value === "" ? null : Number(value);
127
+ case "platforms":
128
+ return value.split(",").map((v) => v.trim()).filter(Boolean);
129
+ case "connected_buses":
130
+ return value === "true";
131
+ default:
132
+ return value;
133
+ }
134
+ }
135
+ });
136
+ return result.data;
137
+ }
138
+ };
114
139
  export {
115
140
  CTABusService,
141
+ CTASystemGuide,
116
142
  CTATrainService
117
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stiava/cta",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A NodeJS package for interacting with the CTA Bus and Train apis",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,4 +30,4 @@
30
30
  "dependencies": {
31
31
  "papaparse": "^5.5.4"
32
32
  }
33
- }
33
+ }