@tmlmobilidade/import-gtfs 20251010.2303.18 → 20251012.2109.36

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.
@@ -76,7 +76,7 @@ export async function processCalendarFile(context, config) {
76
76
  }
77
77
  //
78
78
  // Save the valid operational dates for this service_id
79
- context.gtfs.calendar_dates.set(validatedData.service_id, Array.from(validOperationalDates));
79
+ context.gtfs.calendar_dates[validatedData.service_id] = Array.from(validOperationalDates);
80
80
  context.counters.calendar_dates += validOperationalDates.size;
81
81
  //
82
82
  };
@@ -39,7 +39,7 @@ export async function processCalendarDatesFile(context, config) {
39
39
  //
40
40
  // If we're here, it means the service_id is valid between the given dates.
41
41
  // Get the previously saved calendars and check if it exists for this service_id.
42
- const savedCalendar = context.gtfs.calendar_dates.get(validatedData.service_id);
42
+ const savedCalendar = context.gtfs.calendar_dates[validatedData.service_id];
43
43
  if (savedCalendar) {
44
44
  // Create a new Set to avoid duplicated dates
45
45
  const updatedCalendar = new Set(savedCalendar);
@@ -54,13 +54,13 @@ export async function processCalendarDatesFile(context, config) {
54
54
  context.counters.calendar_dates--;
55
55
  }
56
56
  // Update the service_id with the new dates
57
- context.gtfs.calendar_dates.set(validatedData.service_id, Array.from(updatedCalendar));
57
+ context.gtfs.calendar_dates[validatedData.service_id] = Array.from(updatedCalendar);
58
58
  }
59
59
  else {
60
60
  // If this is the first time we're seeing this service_id, then it is only necessary
61
61
  // to initiate a new dates array if it is a service addition
62
62
  if (validatedData.exception_type === 1) {
63
- context.gtfs.calendar_dates.set(validatedData.service_id, [validatedData.date]);
63
+ context.gtfs.calendar_dates[validatedData.service_id] = [validatedData.date];
64
64
  context.counters.calendar_dates++;
65
65
  }
66
66
  }
@@ -18,7 +18,7 @@ export async function processTripsFile(context) {
18
18
  const validatedData = validateGtfsTripExtended(data);
19
19
  // For each trip, check if the associated service_id was saved
20
20
  // in the previous step or not. Include it if yes, skip otherwise.
21
- if (!context.gtfs.calendar_dates.has(validatedData.service_id))
21
+ if (!context.gtfs.calendar_dates[validatedData.service_id])
22
22
  return;
23
23
  // Save the exported row
24
24
  context.gtfs.trips.write(validatedData);
@@ -17,7 +17,7 @@ export interface ImportGtfsToDatabaseConfig {
17
17
  * with a SQLiteWriter instance for that entity.
18
18
  */
19
19
  export interface GtfsSQLTables {
20
- calendar_dates: Map<string, OperationalDate[]>;
20
+ calendar_dates: Record<string, OperationalDate[]>;
21
21
  routes: SQLiteTableInstance<GTFS_Route_Extended>;
22
22
  shapes: SQLiteTableInstance<GTFS_Shape>;
23
23
  stop_times: SQLiteTableInstance<GTFS_StopTime>;
@@ -6,8 +6,8 @@ import { SQLiteDatabase } from '@tmlmobilidade/connectors';
6
6
  */
7
7
  export function initGtfsSqlTables() {
8
8
  //
9
- const calendarDatesMap = new Map();
10
- const database = new SQLiteDatabase();
9
+ const calendarDatesMap = {};
10
+ const database = new SQLiteDatabase({ memory: true });
11
11
  const tripsTable = database.registerTable('trips', {
12
12
  batch_size: 10000,
13
13
  columns: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/import-gtfs",
3
- "version": "20251010.2303.18",
3
+ "version": "20251012.2109.36",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",