@opentripplanner/core-utils 8.2.2 → 8.2.4

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.
@@ -1,4 +1,4 @@
1
- query PlanQuery(
1
+ query Plan(
2
2
  $fromPlace: String!
3
3
  $toPlace: String!
4
4
  $modes: [TransportMode]
@@ -16,159 +16,168 @@ query PlanQuery(
16
16
  $numItineraries: Int
17
17
  ) {
18
18
  plan(
19
- fromPlace: $fromPlace
20
- toPlace: $toPlace
21
- transportModes: $modes
22
- # Currently only supporting EN locale, used for times and text
23
- locale: "en"
24
- time: $time
25
- date: $date
26
- wheelchair: $wheelchair
19
+ arriveBy: $arriveBy
20
+ banned: $banned
27
21
  bikeReluctance: $bikeReluctance
28
22
  carReluctance: $carReluctance
29
- walkReluctance: $walkReluctance
30
- arriveBy: $arriveBy
23
+ date: $date
24
+ fromPlace: $fromPlace
31
25
  intermediatePlaces: $intermediatePlaces
26
+ # Currently only supporting EN locale, used for times and text
27
+ locale: "en"
28
+ numItineraries: $numItineraries
32
29
  preferred: $preferred
30
+ time: $time
31
+ toPlace: $toPlace
32
+ transportModes: $modes
33
33
  unpreferred: $unpreferred
34
- banned: $banned
35
- numItineraries: $numItineraries
34
+ walkReluctance: $walkReluctance
35
+ wheelchair: $wheelchair
36
36
  ) {
37
- routingErrors {
38
- code
39
- inputField
40
- description
41
- }
42
37
  itineraries {
38
+ accessibilityScore
43
39
  duration
44
40
  endTime
45
- startTime
46
- waitingTime
47
- walkTime
48
- legs {
49
- pickupType
50
- dropoffType
51
- pickupBookingInfo {
52
- earliestBookingTime {
53
- daysPrior
41
+ legs {
42
+ accessibilityScore
43
+ agency {
44
+ alerts {
45
+ alertDescriptionText
46
+ alertHeaderText
47
+ alertUrl
48
+ effectiveStartDate
49
+ id
54
50
  }
51
+ id
52
+ name
53
+ timezone
54
+ url
55
55
  }
56
- rentedBike
57
- interlineWithPreviousLeg
58
- departureDelay
59
56
  arrivalDelay
57
+ departureDelay
60
58
  distance
59
+ dropoffType
61
60
  duration
62
61
  endTime
63
- mode
64
- realTime
65
- realtimeState
66
- startTime
67
- transitLeg
68
- trip {
69
- id
70
- gtfsId
71
- tripHeadsign
72
- }
73
- agency {
62
+ from {
63
+ lat
64
+ lon
74
65
  name
75
- id
76
- timezone
77
- url
78
- alerts {
79
- alertHeaderText
80
- alertDescriptionText
81
- alertUrl
82
- effectiveStartDate
66
+ rentalVehicle {
67
+ id
68
+ network
83
69
  }
70
+ stop {
71
+ alerts {
72
+ alertDescriptionText
73
+ alertHeaderText
74
+ alertUrl
75
+ effectiveStartDate
76
+ id
77
+ }
78
+ code
79
+ gtfsId
80
+ id
81
+ }
82
+ vertexType
84
83
  }
85
- legGeometry {
86
- length
87
- points
88
- }
84
+ interlineWithPreviousLeg
89
85
  intermediateStops {
90
86
  lat
87
+ locationType
91
88
  lon
92
89
  name
93
90
  stopCode: code
94
91
  stopId: id
95
- locationType
96
92
  }
93
+ legGeometry {
94
+ length
95
+ points
96
+ }
97
+ mode
98
+ pickupBookingInfo {
99
+ earliestBookingTime {
100
+ daysPrior
101
+ }
102
+ }
103
+ pickupType
104
+ realTime
105
+ realtimeState
106
+ rentedBike
97
107
  route {
98
- shortName
99
- longName
108
+ alerts {
109
+ alertDescriptionText
110
+ alertHeaderText
111
+ alertUrl
112
+ effectiveStartDate
113
+ id
114
+ }
100
115
  color
101
- textColor
102
116
  id
117
+ longName
118
+ shortName
119
+ textColor
103
120
  type
121
+ }
122
+ startTime
123
+ steps {
124
+ absoluteDirection
104
125
  alerts {
105
- alertHeaderText
106
126
  alertDescriptionText
127
+ alertHeaderText
107
128
  alertUrl
108
129
  effectiveStartDate
130
+ id
131
+ }
132
+ area
133
+ distance
134
+ elevationProfile {
135
+ distance
136
+ elevation
109
137
  }
110
- }
111
- from {
112
138
  lat
113
139
  lon
114
- name
115
- vertexType
116
- rentalVehicle {
117
- network
118
- }
119
- stop {
120
- id
121
- code
122
- gtfsId
123
- alerts {
124
- alertHeaderText
125
- alertDescriptionText
126
- alertUrl
127
- effectiveStartDate
128
- }
129
- }
140
+ relativeDirection
141
+ stayOn
142
+ streetName
130
143
  }
131
144
  to {
132
145
  lat
133
146
  lon
134
147
  name
135
- vertexType
136
148
  rentalVehicle {
149
+ id
137
150
  network
138
151
  }
139
152
  stop {
140
- id
141
- code
142
- gtfsId
143
153
  alerts {
144
- alertHeaderText
145
154
  alertDescriptionText
155
+ alertHeaderText
146
156
  alertUrl
147
157
  effectiveStartDate
158
+ id
148
159
  }
160
+ code
161
+ gtfsId
162
+ id
149
163
  }
164
+ vertexType
150
165
  }
151
- steps {
152
- distance
153
- lat
154
- lon
155
- relativeDirection
156
- absoluteDirection
157
- stayOn
158
- streetName
159
- area
160
- alerts {
161
- alertHeaderText
162
- alertDescriptionText
163
- alertUrl
164
- effectiveStartDate
165
- }
166
- elevationProfile {
167
- distance
168
- elevation
169
- }
166
+ transitLeg
167
+ trip {
168
+ gtfsId
169
+ id
170
+ tripHeadsign
170
171
  }
171
172
  }
173
+ startTime
174
+ waitingTime
175
+ walkTime
176
+ }
177
+ routingErrors {
178
+ code
179
+ description
180
+ inputField
172
181
  }
173
182
  }
174
183
  }
package/src/query-gen.ts CHANGED
@@ -58,7 +58,11 @@ export function extractAdditionalModes(
58
58
  }
59
59
 
60
60
  // In checkboxes, mode must be enabled and have a transport mode in it
61
- if (cur.type === "CHECKBOX" && cur.addTransportMode && cur.value) {
61
+ if (
62
+ (cur.type === "CHECKBOX" || cur.type === "SUBMODE") &&
63
+ cur.addTransportMode &&
64
+ cur.value
65
+ ) {
62
66
  return [...prev, cur.addTransportMode];
63
67
  }
64
68
  if (cur.type === "DROPDOWN") {
@@ -123,7 +127,7 @@ const VALID_COMBOS = [
123
127
  ["TRANSIT", "CAR"]
124
128
  ];
125
129
 
126
- const BANNED_TOGETHER = ["SCOOTER", "BICYCLE"];
130
+ const BANNED_TOGETHER = ["SCOOTER", "BICYCLE", "CAR"];
127
131
 
128
132
  export const TRANSIT_SUBMODES = Object.keys(SIMPLIFICATIONS).filter(
129
133
  mode => SIMPLIFICATIONS[mode] === "TRANSIT" && mode !== "TRANSIT"
@@ -164,7 +168,9 @@ function isCombinationValid(
164
168
  }
165
169
 
166
170
  // OTP doesn't support multiple non-walk modes
167
- if (BANNED_TOGETHER.every(m => combo.find(c => c.mode === m))) return false;
171
+ if (BANNED_TOGETHER.filter(m => combo.find(c => c.mode === m)).length > 1) {
172
+ return false;
173
+ }
168
174
 
169
175
  return !!VALID_COMBOS.find(
170
176
  vc =>