@opentripplanner/core-utils 8.2.0 → 8.2.2

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,146 +1,174 @@
1
1
  query PlanQuery(
2
- $fromPlace: String!,
3
- $toPlace: String!,
4
- $modes: [TransportMode],
5
- $time: String,
6
- $date: String,
7
- $wheelchair: Boolean,
8
- $bikeReluctance: Float,
9
- $carReluctance: Float,
10
- $walkReluctance: Float,
11
- $arriveBy: Boolean,
12
- $intermediatePlaces: [InputCoordinates],
13
- $preferred: InputPreferred,
14
- $unpreferred: InputUnpreferred,
15
- $banned: InputBanned,
2
+ $fromPlace: String!
3
+ $toPlace: String!
4
+ $modes: [TransportMode]
5
+ $time: String
6
+ $date: String
7
+ $wheelchair: Boolean
8
+ $bikeReluctance: Float
9
+ $carReluctance: Float
10
+ $walkReluctance: Float
11
+ $arriveBy: Boolean
12
+ $intermediatePlaces: [InputCoordinates]
13
+ $preferred: InputPreferred
14
+ $unpreferred: InputUnpreferred
15
+ $banned: InputBanned
16
+ $numItineraries: Int
16
17
  ) {
17
- plan(
18
- fromPlace: $fromPlace
19
- toPlace: $toPlace
20
- transportModes: $modes
21
- # Currently only supporting EN locale, used for times and text
22
- locale: "en",
23
- time: $time,
24
- date: $date,
25
- wheelchair: $wheelchair,
26
- bikeReluctance: $bikeReluctance,
27
- carReluctance: $carReluctance,
28
- walkReluctance: $walkReluctance,
29
- arriveBy: $arriveBy,
30
- intermediatePlaces: $intermediatePlaces,
31
- preferred: $preferred,
32
- unpreferred: $unpreferred,
33
- banned: $banned,
34
- ) {
35
- itineraries {
36
- duration
37
- endTime
38
- startTime
39
- waitingTime
40
- walkTime
41
- legs {
42
- distance
43
- duration
44
- endTime
45
- mode
46
- realTime
47
- realtimeState
48
- startTime
49
- transitLeg
50
- trip {
51
- id
52
- gtfsId
53
- }
54
- agency {
55
- name
56
- id
57
- timezone
58
- url
59
- alerts {
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
27
+ bikeReluctance: $bikeReluctance
28
+ carReluctance: $carReluctance
29
+ walkReluctance: $walkReluctance
30
+ arriveBy: $arriveBy
31
+ intermediatePlaces: $intermediatePlaces
32
+ preferred: $preferred
33
+ unpreferred: $unpreferred
34
+ banned: $banned
35
+ numItineraries: $numItineraries
36
+ ) {
37
+ routingErrors {
38
+ code
39
+ inputField
40
+ description
41
+ }
42
+ itineraries {
43
+ duration
44
+ endTime
45
+ startTime
46
+ waitingTime
47
+ walkTime
48
+ legs {
49
+ pickupType
50
+ dropoffType
51
+ pickupBookingInfo {
52
+ earliestBookingTime {
53
+ daysPrior
54
+ }
55
+ }
56
+ rentedBike
57
+ interlineWithPreviousLeg
58
+ departureDelay
59
+ arrivalDelay
60
+ distance
61
+ duration
62
+ endTime
63
+ mode
64
+ realTime
65
+ realtimeState
66
+ startTime
67
+ transitLeg
68
+ trip {
69
+ id
70
+ gtfsId
71
+ tripHeadsign
72
+ }
73
+ agency {
74
+ name
75
+ id
76
+ timezone
77
+ url
78
+ alerts {
60
79
  alertHeaderText
61
80
  alertDescriptionText
62
81
  alertUrl
63
82
  effectiveStartDate
64
83
  }
65
- }
66
- legGeometry {
67
- length
68
- points
69
- }
70
- intermediateStops {
71
- lat
72
- lon
73
- name
74
- stopCode: code
75
- stopId: id
76
- locationType
77
- }
78
- route {
79
- shortName
80
- color
81
- textColor
82
- id
83
- type
84
- alerts {
84
+ }
85
+ legGeometry {
86
+ length
87
+ points
88
+ }
89
+ intermediateStops {
90
+ lat
91
+ lon
92
+ name
93
+ stopCode: code
94
+ stopId: id
95
+ locationType
96
+ }
97
+ route {
98
+ shortName
99
+ longName
100
+ color
101
+ textColor
102
+ id
103
+ type
104
+ alerts {
85
105
  alertHeaderText
86
106
  alertDescriptionText
87
107
  alertUrl
88
108
  effectiveStartDate
89
109
  }
90
- }
91
- from {
92
- lat
93
- lon
94
- name
95
- vertexType
96
- stop {
97
- id
98
- code
99
- alerts {
100
- alertHeaderText
101
- alertDescriptionText
102
- alertUrl
103
- effectiveStartDate
104
- }
105
- }
106
- }
107
- to {
108
- lat
109
- lon
110
- name
111
- vertexType
112
- stop {
113
- id
114
- code
115
- alerts {
116
- alertHeaderText
117
- alertDescriptionText
118
- alertUrl
119
- effectiveStartDate
120
- }
121
- }
122
- }
123
- steps {
124
- distance
125
- lat
126
- lon
110
+ }
111
+ from {
112
+ lat
113
+ 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
+ }
130
+ }
131
+ to {
132
+ lat
133
+ lon
134
+ name
135
+ vertexType
136
+ rentalVehicle {
137
+ network
138
+ }
139
+ stop {
140
+ id
141
+ code
142
+ gtfsId
143
+ alerts {
144
+ alertHeaderText
145
+ alertDescriptionText
146
+ alertUrl
147
+ effectiveStartDate
148
+ }
149
+ }
150
+ }
151
+ steps {
152
+ distance
153
+ lat
154
+ lon
127
155
  relativeDirection
128
156
  absoluteDirection
129
157
  stayOn
130
158
  streetName
131
159
  area
132
- alerts{
160
+ alerts {
133
161
  alertHeaderText
134
162
  alertDescriptionText
135
163
  alertUrl
136
164
  effectiveStartDate
137
165
  }
138
- elevationProfile {
139
- distance
140
- elevation
141
- }
142
- }
143
- }
144
- }
145
- }
166
+ elevationProfile {
167
+ distance
168
+ elevation
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
146
174
  }
package/src/query-gen.ts CHANGED
@@ -8,11 +8,31 @@ import {
8
8
 
9
9
  import PlanQuery from "./planQuery.graphql";
10
10
 
11
+ type InputBanned = {
12
+ routes?: string;
13
+ agencies?: string;
14
+ trips?: string;
15
+ stops?: string;
16
+ stopsHard?: string;
17
+ };
18
+
19
+ type InputPreferred = {
20
+ routes?: string;
21
+ agencies?: string;
22
+ unpreferredCost?: string;
23
+ };
24
+
11
25
  type OTPQueryParams = {
26
+ arriveBy: boolean;
27
+ date?: string;
12
28
  from: LonLatOutput & { name?: string };
13
29
  modes: TransportMode[];
14
30
  modeSettings: ModeSetting[];
31
+ time?: string;
32
+ numItineraries?: number;
15
33
  to: LonLatOutput & { name?: string };
34
+ banned?: InputBanned;
35
+ preferred?: InputPreferred;
16
36
  };
17
37
 
18
38
  type GraphQLQuery = {
@@ -176,13 +196,22 @@ export function generateCombinations(params: OTPQueryParams): OTPQueryParams[] {
176
196
  }
177
197
 
178
198
  export function generateOtp2Query({
199
+ arriveBy,
200
+ banned,
201
+ date,
179
202
  from,
180
- modeSettings,
181
203
  modes,
204
+ modeSettings,
205
+ numItineraries,
206
+ preferred,
207
+ time,
182
208
  to
183
209
  }: OTPQueryParams): GraphQLQuery {
184
210
  // This extracts the values from the mode settings to key value pairs
185
211
  const modeSettingValues = modeSettings.reduce((prev, cur) => {
212
+ if (cur.type === "SLIDER" && cur.inverseKey) {
213
+ prev[cur.inverseKey] = cur.high - cur.value + cur.low;
214
+ }
186
215
  prev[cur.key] = cur.value;
187
216
  return prev;
188
217
  }, {}) as ModeSettingValues;
@@ -197,10 +226,16 @@ export function generateOtp2Query({
197
226
  return {
198
227
  query: print(PlanQuery),
199
228
  variables: {
229
+ arriveBy,
230
+ banned,
200
231
  bikeReluctance,
201
232
  carReluctance,
233
+ date,
202
234
  fromPlace: `${from.name}::${from.lat},${from.lon}}`,
203
235
  modes,
236
+ numItineraries,
237
+ preferred,
238
+ time,
204
239
  toPlace: `${to.name}::${to.lat},${to.lon}}`,
205
240
  walkReluctance,
206
241
  wheelchair