corequery-gtfs 0.1.4 → 0.2.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.
Files changed (57) hide show
  1. package/dist/corequery-types.d.ts +71 -1
  2. package/dist/corequery-types.js +2 -1
  3. package/dist/corequery-types.js.map +1 -1
  4. package/dist/corequeryify/corequery-intrasource-id.d.ts +7 -0
  5. package/dist/corequeryify/corequery-intrasource-id.js +24 -0
  6. package/dist/corequeryify/corequery-intrasource-id.js.map +1 -0
  7. package/dist/corequeryify/service-conversion-iterator.d.ts +11 -0
  8. package/dist/corequeryify/service-conversion-iterator.js +41 -0
  9. package/dist/corequeryify/service-conversion-iterator.js.map +1 -0
  10. package/dist/corequeryify/service-converter.d.ts +32 -0
  11. package/dist/corequeryify/service-converter.js +206 -0
  12. package/dist/corequeryify/service-converter.js.map +1 -0
  13. package/dist/data/gtfs-feed.d.ts +4 -1
  14. package/dist/data/gtfs-feed.js +11 -7
  15. package/dist/data/gtfs-feed.js.map +1 -1
  16. package/dist/data/gtfs-realtime-data.d.ts +1 -0
  17. package/dist/data/gtfs-realtime-data.js +5 -0
  18. package/dist/data/gtfs-realtime-data.js.map +1 -1
  19. package/dist/data/gtfs-scheduled-trip.d.ts +1 -0
  20. package/dist/data/gtfs-scheduled-trip.js +6 -0
  21. package/dist/data/gtfs-scheduled-trip.js.map +1 -1
  22. package/dist/data/gtfs-stop-time.d.ts +1 -1
  23. package/dist/data/gtfs-stop-time.js +1 -1
  24. package/dist/data/gtfs-updated-trip.d.ts +5 -0
  25. package/dist/data/gtfs-updated-trip.js +33 -0
  26. package/dist/data/gtfs-updated-trip.js.map +1 -1
  27. package/dist/departures/departures-block-iterator.d.ts +2 -2
  28. package/dist/departures/departures-block-iterator.js.map +1 -1
  29. package/dist/departures/departures-iterator.d.ts +4 -3
  30. package/dist/departures/departures-iterator.js +9 -1
  31. package/dist/departures/departures-iterator.js.map +1 -1
  32. package/dist/departures/gtfs-scheduled-movements-index.d.ts +1 -0
  33. package/dist/departures/gtfs-scheduled-movements-index.js +3 -1
  34. package/dist/departures/gtfs-scheduled-movements-index.js.map +1 -1
  35. package/dist/departures/multifeed-departures-iterator.d.ts +3 -3
  36. package/dist/departures/multifeed-departures-iterator.js +3 -3
  37. package/dist/departures/multifeed-departures-iterator.js.map +1 -1
  38. package/dist/departures/realtime-departures-block-iterator.js +1 -1
  39. package/dist/departures/realtime-departures-block-iterator.js.map +1 -1
  40. package/dist/departures/realtime-departures-block.d.ts +1 -0
  41. package/dist/departures/realtime-departures-block.js +3 -1
  42. package/dist/departures/realtime-departures-block.js.map +1 -1
  43. package/dist/departures/scheduled-departures-block-iterator.js +1 -1
  44. package/dist/departures/scheduled-departures-block-iterator.js.map +1 -1
  45. package/dist/departures/scheduled-departures-iterator.d.ts +2 -2
  46. package/dist/departures/scheduled-departures-iterator.js.map +1 -1
  47. package/dist/departures/zipper-departures-iterator.d.ts +2 -2
  48. package/dist/departures/zipper-departures-iterator.js.map +1 -1
  49. package/dist/gtfs-service-source.d.ts +24 -0
  50. package/dist/gtfs-service-source.js +59 -0
  51. package/dist/gtfs-service-source.js.map +1 -0
  52. package/dist/gtfs-system.js +4 -1
  53. package/dist/gtfs-system.js.map +1 -1
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/index.js.map +1 -1
  57. package/package.json +2 -2
@@ -1,2 +1,72 @@
1
+ export type ServiceSource<CorequeryDepartureClass, CorequeryServiceClass> = {
2
+ readonly sourceId: string;
3
+ getService: (intrasourceId: string) => Promise<CorequeryServiceClass | null>;
4
+ getDeparturesIterator: (stopId: number, instant: Temporal.Instant, direction: DeparturesIterationDirection) => DeparturesIterator<CorequeryDepartureClass>;
5
+ };
6
+ export type DeparturesIterator<CorequeryDepartureClass> = {
7
+ peek: () => Promise<CorequeryDepartureClass | null>;
8
+ take: () => Promise<CorequeryDepartureClass>;
9
+ };
10
+ export type DepartureFields<CorequeryServiceClass> = {
11
+ readonly service: CorequeryServiceClass;
12
+ readonly movementIndex: number;
13
+ };
14
+ export type ServiceFields<CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryServiceConnectionClass> = {
15
+ readonly sourceId: string;
16
+ readonly intrasourceId: string;
17
+ readonly lineIds: readonly number[];
18
+ readonly tags: CorequeryTagsClass;
19
+ readonly color: Color | null;
20
+ readonly liveDataType: ServiceLiveDataType;
21
+ readonly movements: readonly CorequeryServiceMovementClasses<CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass>[];
22
+ readonly isCancelled: boolean;
23
+ readonly connections: readonly CorequeryServiceConnectionClass[];
24
+ };
25
+ type CorequeryServiceMovementClasses<CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass> = CorequeryServiceOriginatingMovementClass | CorequeryServiceRegularMovementClass | CorequeryServiceTerminatingMovementClass | CorequeryServicePassingMovementClass;
26
+ export type ServiceOriginatingMovementFields = {
27
+ readonly stopId: number;
28
+ readonly originalPositionId: number | null;
29
+ readonly updatedPositionId: number | null;
30
+ readonly departureTimeType: ServiceTimeType;
31
+ readonly departureTime: Temporal.Instant;
32
+ readonly formerDepartureTime: Temporal.Instant | null;
33
+ };
34
+ export type ServiceRegularMovementFields = {
35
+ readonly stopId: number;
36
+ readonly originalPositionId: number | null;
37
+ readonly updatedPositionId: number | null;
38
+ readonly arrivalTimeType: ServiceTimeType;
39
+ readonly arrivalTime: Temporal.Instant;
40
+ readonly formerArrivalTime: Temporal.Instant | null;
41
+ readonly departureTimeType: ServiceTimeType;
42
+ readonly departureTime: Temporal.Instant;
43
+ readonly formerDepartureTime: Temporal.Instant | null;
44
+ readonly picksUp: boolean;
45
+ readonly dropsOff: boolean;
46
+ };
47
+ export type ServiceTerminatingMovementFields = {
48
+ readonly stopId: number;
49
+ readonly originalPositionId: number | null;
50
+ readonly updatedPositionId: number | null;
51
+ readonly arrivalTimeType: ServiceTimeType;
52
+ readonly arrivalTime: Temporal.Instant;
53
+ readonly formerArrivalTime: Temporal.Instant | null;
54
+ };
55
+ export type ServicePassingMovementFields = {
56
+ readonly stopId: number;
57
+ };
58
+ export type ServiceConnectionFields = {
59
+ readonly type: ServiceConnectionType;
60
+ readonly direction: ServiceConnectionDirection;
61
+ readonly otherServiceSourceId: string;
62
+ readonly otherServiceIntrasourceId: string;
63
+ readonly movementIndex: number;
64
+ readonly otherServiceMovementIndex: number;
65
+ };
66
+ export type DeparturesIterationDirection = "forwards" | "backwards";
1
67
  export type Color = "red" | "yellow" | "green" | "cyan" | "blue" | "pink" | "purple" | "gray";
2
- export type DeparturesSearchDirection = "forwards" | "backwards";
68
+ type ServiceLiveDataType = "scheduled" | "updated" | "added";
69
+ type ServiceTimeType = "scheduled-time" | "provided-live-time" | "interpolated-live-time";
70
+ type ServiceConnectionType = "entire-vehicle-forms-service" | "other";
71
+ type ServiceConnectionDirection = "from-other" | "to-other" | "bidirectional";
72
+ export {};
@@ -1,3 +1,4 @@
1
- // Because we don't want to depend on CoreQuery.
1
+ // Because we don't want to depend on CoreQuery. (Just because I'm scared of
2
+ // npm's peer dependency system and don't understand how it works!)
2
3
  export {};
3
4
  //# sourceMappingURL=corequery-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"corequery-types.js","sourceRoot":"","sources":["../src/corequery-types.ts"],"names":[],"mappings":"AAAA,gDAAgD"}
1
+ {"version":3,"file":"corequery-types.js","sourceRoot":"","sources":["../src/corequery-types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,mEAAmE"}
@@ -0,0 +1,7 @@
1
+ export declare class CorequeryIntrasourceId {
2
+ readonly gtfsTripId: string;
3
+ readonly serviceDay: Temporal.PlainDate;
4
+ constructor(gtfsTripId: string, serviceDay: Temporal.PlainDate);
5
+ toString(): string;
6
+ static parse(input: string): CorequeryIntrasourceId | null;
7
+ }
@@ -0,0 +1,24 @@
1
+ export class CorequeryIntrasourceId {
2
+ gtfsTripId;
3
+ serviceDay;
4
+ constructor(gtfsTripId, serviceDay) {
5
+ this.gtfsTripId = gtfsTripId;
6
+ this.serviceDay = serviceDay;
7
+ }
8
+ toString() {
9
+ return `${this.serviceDay.toString()}|${this.gtfsTripId}`;
10
+ }
11
+ static parse(input) {
12
+ const [serviceDayString, gtfsTripId] = input.split("|");
13
+ if (serviceDayString == null || gtfsTripId == null)
14
+ return null;
15
+ try {
16
+ const serviceDay = Temporal.PlainDate.from(serviceDayString);
17
+ return new CorequeryIntrasourceId(gtfsTripId, serviceDay);
18
+ }
19
+ catch {
20
+ return null;
21
+ }
22
+ }
23
+ }
24
+ //# sourceMappingURL=corequery-intrasource-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"corequery-intrasource-id.js","sourceRoot":"","sources":["../../src/corequeryify/corequery-intrasource-id.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,sBAAsB;IAEtB;IACA;IAFX,YACW,UAAkB,EAClB,UAA8B;QAD9B,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAoB;IACtC,CAAC;IAEJ,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,KAAa;QACxB,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxD,IAAI,gBAAgB,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QAEhE,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC7D,OAAO,IAAI,sBAAsB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC5D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { DeparturesIterator } from "../departures/departures-iterator.js";
2
+ import type { ServiceConverter } from "./service-converter.js";
3
+ export declare class ServiceConversionIterator<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryServiceConnectionClass> {
4
+ private readonly _iterator;
5
+ private readonly _converter;
6
+ private readonly _timezone;
7
+ private _convertedNextDeparture;
8
+ constructor(_iterator: DeparturesIterator, _converter: ServiceConverter<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryServiceConnectionClass>, _timezone: string);
9
+ peek(): Promise<CorequeryDepartureClass | null>;
10
+ take(): Promise<CorequeryDepartureClass>;
11
+ }
@@ -0,0 +1,41 @@
1
+ export class ServiceConversionIterator {
2
+ _iterator;
3
+ _converter;
4
+ _timezone;
5
+ _convertedNextDeparture;
6
+ constructor(
7
+ // TODO: There's two things called DeparturesIterator in this repo, which
8
+ // isn't ideal.
9
+ _iterator, _converter,
10
+ // TODO: The need to pass around timezone here (and everywhere), I think
11
+ // hints at that it should be a property of the DeparturesIteratorResult.
12
+ _timezone) {
13
+ this._iterator = _iterator;
14
+ this._converter = _converter;
15
+ this._timezone = _timezone;
16
+ this._convertedNextDeparture = null;
17
+ }
18
+ peek() {
19
+ if (this._convertedNextDeparture != null) {
20
+ return Promise.resolve(this._convertedNextDeparture);
21
+ }
22
+ const value = this._iterator.peek();
23
+ if (value == null) {
24
+ return Promise.resolve(null);
25
+ }
26
+ const result = this._converter.convertDeparture(value, this._timezone);
27
+ this._convertedNextDeparture = result;
28
+ return Promise.resolve(result);
29
+ }
30
+ take() {
31
+ if (this._convertedNextDeparture != null) {
32
+ const result = this._convertedNextDeparture;
33
+ this._convertedNextDeparture = null;
34
+ return Promise.resolve(result);
35
+ }
36
+ const value = this._iterator.take();
37
+ const result = this._converter.convertDeparture(value, this._timezone);
38
+ return Promise.resolve(result);
39
+ }
40
+ }
41
+ //# sourceMappingURL=service-conversion-iterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-conversion-iterator.js","sourceRoot":"","sources":["../../src/corequeryify/service-conversion-iterator.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,yBAAyB;IAejB;IAEA;IAaA;IApBX,uBAAuB,CAAiC;IAEhE;IACE,yEAAyE;IACzE,eAAe;IACE,SAA6B,EAE7B,UAShB;IAED,wEAAwE;IACxE,yEAAyE;IACxD,SAAiB;QAfjB,cAAS,GAAT,SAAS,CAAoB;QAE7B,eAAU,GAAV,UAAU,CAS1B;QAIgB,cAAS,GAAT,SAAS,CAAQ;QAElC,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,uBAAuB,IAAI,IAAI,EAAE,CAAC;YACzC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,CAAC,uBAAuB,GAAG,MAAM,CAAC;QACtC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,uBAAuB,IAAI,IAAI,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,uBAAuB,CAAC;YAC5C,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;YACpC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACvE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ import type { DepartureFields, ServiceFields, ServiceOriginatingMovementFields, ServicePassingMovementFields, ServiceRegularMovementFields, ServiceTerminatingMovementFields, ServiceConnectionFields } from "../corequery-types.js";
2
+ import { GtfsScheduledTrip } from "../data/gtfs-scheduled-trip.js";
3
+ import type { DeparturesIteratorResult } from "../departures/departures-iterator.js";
4
+ import { GtfsUpdatedTrip } from "../data/gtfs-updated-trip.js";
5
+ export type ServiceConverterFields<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryServiceConnectionClass> = {
6
+ readonly sourceId: string;
7
+ buildDeparture: (fields: DepartureFields<CorequeryServiceClass>) => CorequeryDepartureClass;
8
+ buildService: (fields: ServiceFields<CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryServiceConnectionClass>) => CorequeryServiceClass;
9
+ buildTags: (tags: Set<number>) => CorequeryTagsClass;
10
+ buildServiceOriginatingMovement: (fields: ServiceOriginatingMovementFields) => CorequeryServiceOriginatingMovementClass;
11
+ buildServiceRegularMovement: (fields: ServiceRegularMovementFields) => CorequeryServiceRegularMovementClass;
12
+ buildServiceTerminatingMovement: (fields: ServiceTerminatingMovementFields) => CorequeryServiceTerminatingMovementClass;
13
+ buildServicePassingMovement: (fields: ServicePassingMovementFields) => CorequeryServicePassingMovementClass;
14
+ buildServiceConnection: (fields: ServiceConnectionFields) => CorequeryServiceConnectionClass;
15
+ };
16
+ export declare class ServiceConverter<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryServiceConnectionClass> {
17
+ private readonly _sourceId;
18
+ private readonly _buildDeparture;
19
+ private readonly _buildService;
20
+ private readonly _buildTags;
21
+ private readonly _buildServiceOriginatingMovement;
22
+ private readonly _buildServiceRegularMovement;
23
+ private readonly _buildServiceTerminatingMovement;
24
+ private readonly _buildServicePassingMovement;
25
+ private readonly _buildServiceConnection;
26
+ constructor(fields: ServiceConverterFields<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryServiceConnectionClass>);
27
+ convertDeparture(result: DeparturesIteratorResult, timezone: string): CorequeryDepartureClass;
28
+ convertScheduledTrip(trip: GtfsScheduledTrip, serviceDay: Temporal.PlainDate, timezone: string): CorequeryServiceClass;
29
+ convertUpdatedTrip(trip: GtfsUpdatedTrip): CorequeryServiceClass;
30
+ private _convertScheduledTripMovement;
31
+ private _convertUpdatedTripMovement;
32
+ }
@@ -0,0 +1,206 @@
1
+ import { assertNever } from "@dan-schel/js-utils";
2
+ import { GtfsScheduledTrip } from "../data/gtfs-scheduled-trip.js";
3
+ import { GtfsUpdatedTrip } from "../data/gtfs-updated-trip.js";
4
+ import { CorequeryIntrasourceId } from "./corequery-intrasource-id.js";
5
+ export class ServiceConverter {
6
+ _sourceId;
7
+ _buildDeparture;
8
+ _buildService;
9
+ _buildTags;
10
+ _buildServiceOriginatingMovement;
11
+ _buildServiceRegularMovement;
12
+ _buildServiceTerminatingMovement;
13
+ _buildServicePassingMovement;
14
+ _buildServiceConnection;
15
+ constructor(fields) {
16
+ this._sourceId = fields.sourceId;
17
+ this._buildDeparture = fields.buildDeparture;
18
+ this._buildService = fields.buildService;
19
+ this._buildTags = fields.buildTags;
20
+ this._buildServiceOriginatingMovement =
21
+ fields.buildServiceOriginatingMovement;
22
+ this._buildServiceRegularMovement = fields.buildServiceRegularMovement;
23
+ this._buildServiceTerminatingMovement =
24
+ fields.buildServiceTerminatingMovement;
25
+ this._buildServicePassingMovement = fields.buildServicePassingMovement;
26
+ this._buildServiceConnection = fields.buildServiceConnection;
27
+ }
28
+ convertDeparture(result, timezone) {
29
+ if (result.trip instanceof GtfsScheduledTrip) {
30
+ const service = this.convertScheduledTrip(result.trip, result.serviceDay, timezone);
31
+ return this._buildDeparture({
32
+ service,
33
+ movementIndex: result.movementIndex,
34
+ });
35
+ }
36
+ else if (result.trip instanceof GtfsUpdatedTrip) {
37
+ const service = this.convertUpdatedTrip(result.trip);
38
+ return this._buildDeparture({
39
+ service,
40
+ movementIndex: result.movementIndex,
41
+ });
42
+ }
43
+ else {
44
+ assertNever(result.trip);
45
+ }
46
+ }
47
+ convertScheduledTrip(trip, serviceDay, timezone) {
48
+ const id = new CorequeryIntrasourceId(trip.gtfsTripId, serviceDay);
49
+ return this._buildService({
50
+ sourceId: this._sourceId,
51
+ intrasourceId: id.toString(),
52
+ lineIds: trip.lineIds,
53
+ tags: this._buildTags(new Set(trip.serviceTags)),
54
+ color: trip.color,
55
+ liveDataType: "scheduled",
56
+ movements: trip.movements.map((m) => this._convertScheduledTripMovement(m, serviceDay, timezone)),
57
+ isCancelled: false,
58
+ // TODO: This is the part where we check if the connections are still
59
+ // running, though it'd be great if that wasn't the converter's job. Maybe
60
+ // we should pass in another param for `upheldConnections` or something.
61
+ // In the service source after we call GtfsFeed#getTrip maybe we should
62
+ // call a second GtfsFeed#getUpheldConnectionsForTrip method so that the
63
+ // GtfsFeed can decide looking at the schedule and realtime data together
64
+ // which connections are running, and then it can model that however it
65
+ // wants. (Probably remove the `nextTrip` and `previousTrip` properties
66
+ // from trips, and just store transfers in an array in the feed, or in the
67
+ // scheduled/realtime data?)
68
+ connections: [], // TODO: Not implemented!
69
+ });
70
+ }
71
+ convertUpdatedTrip(trip) {
72
+ const id = new CorequeryIntrasourceId(trip.gtfsTripId, trip.serviceDay);
73
+ return this._buildService({
74
+ sourceId: this._sourceId,
75
+ intrasourceId: id.toString(),
76
+ lineIds: trip.lineIds,
77
+ tags: this._buildTags(new Set(trip.serviceTags)),
78
+ color: trip.color,
79
+ liveDataType: "updated",
80
+ movements: trip.movements.map((m) => this._convertUpdatedTripMovement(m)),
81
+ isCancelled: trip.isCancelled,
82
+ connections: [], // TODO: Not implemented!
83
+ });
84
+ }
85
+ _convertScheduledTripMovement(movement, serviceDay, timezone) {
86
+ if (movement.type === "originating") {
87
+ return this._buildServiceOriginatingMovement({
88
+ stopId: movement.stopId,
89
+ originalPositionId: movement.positionId,
90
+ updatedPositionId: null,
91
+ departureTimeType: "scheduled-time",
92
+ departureTime: movement.departureTime.toInstant(serviceDay, timezone),
93
+ formerDepartureTime: null,
94
+ });
95
+ }
96
+ else if (movement.type === "regular") {
97
+ return this._buildServiceRegularMovement({
98
+ stopId: movement.stopId,
99
+ originalPositionId: movement.positionId,
100
+ updatedPositionId: null,
101
+ arrivalTimeType: "scheduled-time",
102
+ arrivalTime: movement.arrivalTime.toInstant(serviceDay, timezone),
103
+ formerArrivalTime: null,
104
+ departureTimeType: "scheduled-time",
105
+ departureTime: movement.departureTime.toInstant(serviceDay, timezone),
106
+ formerDepartureTime: null,
107
+ picksUp: movement.picksUp,
108
+ dropsOff: movement.dropsOff,
109
+ });
110
+ }
111
+ else if (movement.type === "terminating") {
112
+ return this._buildServiceTerminatingMovement({
113
+ stopId: movement.stopId,
114
+ originalPositionId: movement.positionId,
115
+ updatedPositionId: null,
116
+ arrivalTimeType: "scheduled-time",
117
+ arrivalTime: movement.arrivalTime.toInstant(serviceDay, timezone),
118
+ formerArrivalTime: null,
119
+ });
120
+ }
121
+ else if (movement.type === "passing") {
122
+ return this._buildServicePassingMovement({
123
+ stopId: movement.stopId,
124
+ });
125
+ }
126
+ else {
127
+ assertNever(movement);
128
+ }
129
+ }
130
+ _convertUpdatedTripMovement(movement) {
131
+ if (movement.type === "originating") {
132
+ return this._buildServiceOriginatingMovement({
133
+ stopId: movement.stopId,
134
+ originalPositionId: movement.originalPositionId,
135
+ updatedPositionId: movement.updatedPositionId,
136
+ // TODO: Probably move this logic into the GtfsUpdatedTripMovement
137
+ // classes themselves. I was hesitant at first because I didn't want
138
+ // them to be concerned with Corequery's data format, but given that
139
+ // this whole is meant to serve as a plugin to Corequery, it's probably
140
+ // ok. (And we already do it with `Color` anyway!)
141
+ //
142
+ // When we start doing interpolation, I'll forget to update here, and
143
+ // then the `departureTimeType` will be wrong!
144
+ //
145
+ // Note: If pushing things like `departureTimeType` into the
146
+ // GtfsUpdatedTripMovement classes, why draw the line there? Why not
147
+ // have a method on the movement classes to convert themselves into
148
+ // Corequery's data format? Genuinely, is there an argument to be made?
149
+ // Maybe the whole corequeryify folder should be removed?
150
+ departureTimeType: movement.realtimeDepartureTime !== null
151
+ ? "provided-live-time"
152
+ : "scheduled-time",
153
+ departureTime: movement.realtimeDepartureTime ?? movement.scheduledDepartureTime,
154
+ formerDepartureTime: movement.realtimeDepartureTime !== null
155
+ ? movement.scheduledDepartureTime
156
+ : null,
157
+ });
158
+ }
159
+ else if (movement.type === "regular") {
160
+ return this._buildServiceRegularMovement({
161
+ stopId: movement.stopId,
162
+ originalPositionId: movement.originalPositionId,
163
+ updatedPositionId: movement.updatedPositionId,
164
+ arrivalTimeType: movement.realtimeArrivalTime !== null
165
+ ? "provided-live-time"
166
+ : "scheduled-time",
167
+ arrivalTime: movement.realtimeArrivalTime ?? movement.scheduledArrivalTime,
168
+ formerArrivalTime: movement.realtimeArrivalTime !== null
169
+ ? movement.scheduledArrivalTime
170
+ : null,
171
+ departureTimeType: movement.realtimeDepartureTime !== null
172
+ ? "provided-live-time"
173
+ : "scheduled-time",
174
+ departureTime: movement.realtimeDepartureTime ?? movement.scheduledDepartureTime,
175
+ formerDepartureTime: movement.realtimeDepartureTime !== null
176
+ ? movement.scheduledDepartureTime
177
+ : null,
178
+ picksUp: movement.picksUp,
179
+ dropsOff: movement.dropsOff,
180
+ });
181
+ }
182
+ else if (movement.type === "terminating") {
183
+ return this._buildServiceTerminatingMovement({
184
+ stopId: movement.stopId,
185
+ originalPositionId: movement.originalPositionId,
186
+ updatedPositionId: movement.updatedPositionId,
187
+ arrivalTimeType: movement.realtimeArrivalTime !== null
188
+ ? "provided-live-time"
189
+ : "scheduled-time",
190
+ arrivalTime: movement.realtimeArrivalTime ?? movement.scheduledArrivalTime,
191
+ formerArrivalTime: movement.realtimeArrivalTime !== null
192
+ ? movement.scheduledArrivalTime
193
+ : null,
194
+ });
195
+ }
196
+ else if (movement.type === "passing") {
197
+ return this._buildServicePassingMovement({
198
+ stopId: movement.stopId,
199
+ });
200
+ }
201
+ else {
202
+ assertNever(movement);
203
+ }
204
+ }
205
+ }
206
+ //# sourceMappingURL=service-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-converter.js","sourceRoot":"","sources":["../../src/corequeryify/service-converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAUlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAsDvE,MAAM,OAAO,gBAAgB;IAUV,SAAS,CAAS;IAElB,eAAe,CAEH;IA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AAQ;aAC5B,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YAC3C,OAAO,IAAI,CAAC,gCAAgC,CAAC;gBAC3C,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;gBAC/C,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;gBAE7C,eAAe,EACb,QAAQ,CAAC,mBAAmB,KAAK,IAAI;oBACnC,CAAC,CAAC,oBAAoB;oBACtB,CAAC,CAAC,gBAAgB;gBACtB,WAAW,EACT,QAAQ,CAAC,mBAAmB,IAAI,QAAQ,CAAC,oBAAoB;gBAC/D,iBAAiB,EACf,QAAQ,CAAC,mBAAmB,KAAK,IAAI;oBACnC,CAAC,CAAC,QAAQ,CAAC,oBAAoB;oBAC/B,CAAC,CAAC,IAAI;aACX,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,4BAA4B,CAAC;gBACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,QAAQ,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
@@ -3,6 +3,8 @@ import { GtfsScheduledMovementsIndex } from "../departures/gtfs-scheduled-moveme
3
3
  import { ZipperDeparturesIterator } from "../departures/zipper-departures-iterator.js";
4
4
  import type { GtfsRealtimeData } from "./gtfs-realtime-data.js";
5
5
  import type { GtfsScheduleData } from "./gtfs-schedule-data.js";
6
+ import type { GtfsScheduledTrip } from "./gtfs-scheduled-trip.js";
7
+ import type { GtfsUpdatedTrip } from "./gtfs-updated-trip.js";
6
8
  export declare class GtfsFeed {
7
9
  readonly corequeryDataSourceId: string;
8
10
  readonly scheduleData: GtfsScheduleData;
@@ -12,5 +14,6 @@ export declare class GtfsFeed {
12
14
  constructor(corequeryDataSourceId: string, scheduleData: GtfsScheduleData, realtimeData: GtfsRealtimeData, timezoneData: TimezoneData, scheduledMovementsIndex: GtfsScheduledMovementsIndex);
13
15
  static fromNewScheduleData(corequeryDataSourceId: string, scheduleData: GtfsScheduleData, realtimeData: GtfsRealtimeData, timezoneData: TimezoneData): GtfsFeed;
14
16
  withUpdatedRealtimeData(realtimeData: GtfsRealtimeData): GtfsFeed;
15
- createCorequeryDepartureIterator(stopId: number): ZipperDeparturesIterator;
17
+ getTrip(gtfsTripId: string, serviceDay: Temporal.PlainDate): GtfsScheduledTrip | GtfsUpdatedTrip | null;
18
+ createDepartureIterator(stopId: number): ZipperDeparturesIterator;
16
19
  }
@@ -20,13 +20,17 @@ export class GtfsFeed {
20
20
  withUpdatedRealtimeData(realtimeData) {
21
21
  return new GtfsFeed(this.corequeryDataSourceId, this.scheduleData, realtimeData, this.timezoneData, this.scheduledMovementsIndex);
22
22
  }
23
- createCorequeryDepartureIterator(stopId) {
24
- // TODO: Should be the corequery departure iterator (once the design of that
25
- // is finalised).
26
- //
27
- // TODO: Maybe the MultifeedDeparturesIterator shouldn't operate on the GTFS
28
- // level, but instead on CoreQuery departures? Why attach a subfeed ID, when
29
- // we could just go straight to attaching the corequery data source ID?
23
+ getTrip(gtfsTripId, serviceDay) {
24
+ const realtimeTrip = this.realtimeData.getTrip(gtfsTripId, serviceDay);
25
+ if (realtimeTrip != null)
26
+ return realtimeTrip;
27
+ const scheduledTrip = this.scheduleData.getTrip(gtfsTripId);
28
+ if (scheduledTrip != null && scheduledTrip.calendar.occursOn(serviceDay)) {
29
+ return scheduledTrip;
30
+ }
31
+ return null;
32
+ }
33
+ createDepartureIterator(stopId) {
30
34
  return ZipperDeparturesIterator.forFeed(stopId, this.scheduledMovementsIndex, this.realtimeData, this.timezoneData);
31
35
  }
32
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gtfs-feed.js","sourceRoot":"","sources":["../../src/data/gtfs-feed.ts"],"names":[],"mappings":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AU,CAAC,EAAE,CAAC;YACzE,OAAO,aAAa,CAAC;QACvB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uBAAuB,CAAC,MAAc;QACpC,OAAO,wBAAwB,CAAC,OAAO,CACrC,MAAM,EACN,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,YAAY,CAClB,CAAC;IACJ,CAAC;CACF"}
@@ -5,5 +5,6 @@ export declare class GtfsRealtimeData {
5
5
  static readonly empty: GtfsRealtimeData;
6
6
  constructor(_updatedTrips: readonly GtfsUpdatedTrip[]);
7
7
  allTrips(): readonly GtfsUpdatedTrip[];
8
+ getTrip(gtfsTripId: string, serviceDay: Temporal.PlainDate): GtfsUpdatedTrip | null;
8
9
  getForScheduledTrip(gtfsTripId: string, serviceDay: Temporal.PlainDate): GtfsUpdatedTrip | null;
9
10
  }
@@ -10,6 +10,11 @@ export class GtfsRealtimeData {
10
10
  allTrips() {
11
11
  return this._updatedTrips;
12
12
  }
13
+ getTrip(gtfsTripId, serviceDay) {
14
+ // Right now all realtime trips are updated trips. When we have added trips
15
+ // in the future, then this needs to be modified to return those too.
16
+ return this.getForScheduledTrip(gtfsTripId, serviceDay);
17
+ }
13
18
  getForScheduledTrip(gtfsTripId, serviceDay) {
14
19
  const trip = this._tripsByScheduledTripId.get(gtfsTripId);
15
20
  if (trip == null || !trip.serviceDay.equals(serviceDay))
@@ -1 +1 @@
1
- {"version":3,"file":"gtfs-realtime-data.js","sourceRoot":"","sources":["../../src/data/gtfs-realtime-data.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAgB;IAKE;IAJZ,uBAAuB,CAA+B;IAEvE,MAAM,CAAU,KAAK,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAEjD,YAA6B,aAAyC;QAAzC,kBAAa,GAAb,aAAa,CAA4B;QACpE,IAAI,CAAC,uBAAuB,GAAG,IAAI,GAAG,CACpC,aAAa,CAAC,GAAG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uB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1D,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC"}
@@ -29,6 +29,7 @@ export declare class GtfsScheduledTrip {
29
29
  get origination(): GtfsScheduledTripOriginatingMovement;
30
30
  get termination(): GtfsScheduledTripTerminatingMovement;
31
31
  get finalTermination(): GtfsScheduledTripTerminatingMovement;
32
+ requireMovementIndex(movement: GtfsScheduledTripMovement): number;
32
33
  static simple({ gtfsTripId, originStopId, originGtfsStopId, originationTime, terminusStopId, terminationTime, terminusGtfsStopId, }: {
33
34
  gtfsTripId: string;
34
35
  originStopId: number;
@@ -60,6 +60,12 @@ export class GtfsScheduledTrip {
60
60
  return this.termination;
61
61
  return this.nextTrip.finalTermination;
62
62
  }
63
+ requireMovementIndex(movement) {
64
+ const index = this.movements.indexOf(movement);
65
+ if (index === -1)
66
+ throw new Error("Movement not found in trip.");
67
+ return index;
68
+ }
63
69
  static simple({ gtfsTripId, originStopId, originGtfsStopId = `stop-${originStopId}`, originationTime, terminusStopId, terminationTime, terminusGtfsStopId = `stop-${terminusStopId}`, }) {
64
70
  return new GtfsScheduledTrip({
65
71
  gtfsTripId,
@@ -1 +1 @@
1
- {"version":3,"file":"gtfs-scheduled-trip.js","sourceRoot":"","sources":["../../src/data/gtfs-scheduled-trip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EACL,oCAAoC,EACpC,oCAAoC,GAErC,MAAM,oCAAoC,CAAC;AAuB5C,MAAM,OAAO,iBAAiB;IACnB,UAAU,CAAS;IACnB,WAAW,CAAS;IACpB,QAAQ,CAAe;IACvB,SAAS,CAAuC;IAChD,OAAO,CAAoB;I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are class GtfsStopTime {
28
28
  isAfter(other: GtfsStopTime): boolean;
29
29
  isAfterOrEqual(other: GtfsStopTime): boolean;
30
30
  toInstant(serviceDay: Temporal.PlainDate, timezone: string): Temporal.Instant;
31
- asString(): string;
31
+ toString(): string;
32
32
  plus({ hours, minutes, seconds, }: {
33
33
  hours?: number;
34
34
  minutes?: number;
@@ -71,7 +71,7 @@ export class GtfsStopTime {
71
71
  // 11am AEST becomes 1am UTC.
72
72
  return midnightUtc.add({ seconds: this.secondsSinceMidnight - offset });
73
73
  }
74
- asString() {
74
+ toString() {
75
75
  const h = Math.floor(this.secondsSinceMidnight / 3600);
76
76
  const m = Math.floor((this.secondsSinceMidnight % 3600) / 60);
77
77
  const s = this.secondsSinceMidnight % 60;
@@ -1,5 +1,6 @@
1
1
  import type { GtfsScheduledTrip } from "./gtfs-scheduled-trip.js";
2
2
  import type { GtfsUpdatedTripMovement, GtfsUpdatedTripOriginatingMovement, GtfsUpdatedTripTerminatingMovement } from "./gtfs-updated-trip-movements.js";
3
+ import type { Color } from "../corequery-types.js";
3
4
  type GtfsUpdatedTripFields = {
4
5
  readonly scheduledTrip: GtfsScheduledTrip;
5
6
  readonly serviceDay: Temporal.PlainDate;
@@ -16,6 +17,10 @@ export declare class GtfsUpdatedTrip {
16
17
  get gtfsTripId(): string;
17
18
  get origination(): GtfsUpdatedTripOriginatingMovement;
18
19
  get termination(): GtfsUpdatedTripTerminatingMovement;
20
+ requireMovementIndex(movement: GtfsUpdatedTripMovement): number;
21
+ get lineIds(): readonly number[];
22
+ get serviceTags(): readonly number[];
23
+ get color(): Color | null;
19
24
  static unmodified(trip: GtfsScheduledTrip, serviceDay: Temporal.PlainDate, timezone: string): GtfsUpdatedTrip;
20
25
  }
21
26
  export {};