@opentripplanner/core-utils 12.0.0-alpha.9 → 12.0.0

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 (74) hide show
  1. package/esm/__tests__/__mocks__/bike-rental-itinerary.json +863 -0
  2. package/esm/__tests__/__mocks__/config.json +54 -0
  3. package/esm/__tests__/__mocks__/fare-products-itinerary.json +1299 -0
  4. package/esm/__tests__/__mocks__/routes.json +107 -0
  5. package/esm/__tests__/__mocks__/tnc-itinerary.json +1726 -0
  6. package/esm/bike-rental-itinerary.json +863 -0
  7. package/esm/config.json +54 -0
  8. package/esm/fare-products-itinerary.json +1299 -0
  9. package/esm/index.js +2 -0
  10. package/esm/index.js.map +1 -1
  11. package/esm/itinerary.js +45 -18
  12. package/esm/itinerary.js.map +1 -1
  13. package/esm/otpSchema.json +13373 -0
  14. package/esm/planQuery.graphql +281 -0
  15. package/esm/profile.js +1 -1
  16. package/esm/profile.js.map +1 -1
  17. package/esm/query-gen.js +7 -5
  18. package/esm/query-gen.js.map +1 -1
  19. package/esm/query.js +1 -5
  20. package/esm/query.js.map +1 -1
  21. package/esm/routes.json +107 -0
  22. package/esm/storage.js +2 -6
  23. package/esm/storage.js.map +1 -1
  24. package/esm/suspense.js +13 -0
  25. package/esm/suspense.js.map +1 -0
  26. package/esm/tnc-itinerary.json +1726 -0
  27. package/lib/__tests__/__mocks__/bike-rental-itinerary.json +863 -0
  28. package/lib/__tests__/__mocks__/config.json +54 -0
  29. package/lib/__tests__/__mocks__/fare-products-itinerary.json +1299 -0
  30. package/lib/__tests__/__mocks__/routes.json +107 -0
  31. package/lib/__tests__/__mocks__/tnc-itinerary.json +1726 -0
  32. package/lib/index.d.ts +2 -0
  33. package/lib/index.d.ts.map +1 -1
  34. package/lib/index.js +10 -0
  35. package/lib/index.js.map +1 -1
  36. package/lib/itinerary.d.ts +12 -3
  37. package/lib/itinerary.d.ts.map +1 -1
  38. package/lib/itinerary.js +58 -19
  39. package/lib/itinerary.js.map +1 -1
  40. package/lib/otpSchema.json +13373 -0
  41. package/lib/planQuery.graphql +281 -0
  42. package/lib/profile.js +1 -1
  43. package/lib/profile.js.map +1 -1
  44. package/lib/query-gen.d.ts +2 -1
  45. package/lib/query-gen.d.ts.map +1 -1
  46. package/lib/query-gen.js +7 -5
  47. package/lib/query-gen.js.map +1 -1
  48. package/lib/query.js +1 -5
  49. package/lib/query.js.map +1 -1
  50. package/lib/storage.d.ts.map +1 -1
  51. package/lib/storage.js +2 -6
  52. package/lib/storage.js.map +1 -1
  53. package/lib/suspense.d.ts +8 -0
  54. package/lib/suspense.d.ts.map +1 -0
  55. package/lib/suspense.js +26 -0
  56. package/lib/suspense.js.map +1 -0
  57. package/package.json +3 -3
  58. package/src/__tests__/itinerary.ts +36 -1
  59. package/src/core-utils.story.tsx +1 -1
  60. package/src/index.ts +2 -0
  61. package/src/itinerary.ts +66 -21
  62. package/src/otpSchema.json +0 -12
  63. package/src/planQuery.graphql +27 -0
  64. package/src/profile.js +1 -1
  65. package/src/query-gen.ts +7 -4
  66. package/src/query.js +1 -4
  67. package/src/storage.ts +5 -9
  68. package/src/suspense.tsx +19 -0
  69. package/tsconfig.json +1 -2
  70. package/tsconfig.tsbuildinfo +1 -1
  71. package/lib/core-utils.story.d.ts +0 -22
  72. package/lib/core-utils.story.d.ts.map +0 -1
  73. package/lib/core-utils.story.js +0 -69
  74. package/lib/core-utils.story.js.map +0 -1
@@ -0,0 +1,281 @@
1
+ query Plan(
2
+ $arriveBy: Boolean
3
+ $banned: InputBanned
4
+ $bikeReluctance: Float
5
+ $carReluctance: Float
6
+ $date: String
7
+ $fromPlace: String!
8
+ $modes: [TransportMode]
9
+ $numItineraries: Int
10
+ $preferred: InputPreferred
11
+ $time: String
12
+ $toPlace: String!
13
+ $unpreferred: InputUnpreferred
14
+ $walkReluctance: Float
15
+ $walkSpeed: Float
16
+ $wheelchair: Boolean
17
+ ) {
18
+ plan(
19
+ arriveBy: $arriveBy
20
+ banned: $banned
21
+ bikeReluctance: $bikeReluctance
22
+ carReluctance: $carReluctance
23
+ date: $date
24
+ fromPlace: $fromPlace
25
+ # Currently only supporting EN locale, used for times and text
26
+ locale: "en"
27
+ numItineraries: $numItineraries
28
+ preferred: $preferred
29
+ time: $time
30
+ toPlace: $toPlace
31
+ transportModes: $modes
32
+ unpreferred: $unpreferred
33
+ walkReluctance: $walkReluctance
34
+ walkSpeed: $walkSpeed
35
+ wheelchair: $wheelchair
36
+ ) {
37
+ itineraries {
38
+ accessibilityScore
39
+ duration
40
+ endTime
41
+ legs {
42
+ accessibilityScore
43
+ agency {
44
+ alerts {
45
+ alertDescriptionText
46
+ alertHeaderText
47
+ alertUrl
48
+ effectiveStartDate
49
+ id
50
+ }
51
+ gtfsId
52
+ id: gtfsId
53
+ name
54
+ timezone
55
+ url
56
+ }
57
+ alerts {
58
+ alertDescriptionText
59
+ alertHeaderText
60
+ alertUrl
61
+ effectiveStartDate
62
+ id
63
+ }
64
+ arrivalDelay
65
+ departureDelay
66
+ distance
67
+ dropOffBookingInfo {
68
+ contactInfo {
69
+ bookingUrl
70
+ infoUrl
71
+ phoneNumber
72
+ }
73
+ earliestBookingTime {
74
+ daysPrior
75
+ time
76
+ }
77
+ latestBookingTime {
78
+ daysPrior
79
+ time
80
+ }
81
+ message
82
+ }
83
+ dropoffType
84
+ duration
85
+ endTime
86
+ fareProducts {
87
+ id
88
+ product {
89
+ __typename
90
+ id
91
+ medium {
92
+ id
93
+ name
94
+ }
95
+ name
96
+ riderCategory {
97
+ id
98
+ name
99
+ }
100
+ ... on DefaultFareProduct {
101
+ price {
102
+ amount
103
+ currency {
104
+ code
105
+ digits
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ from {
112
+ lat
113
+ lon
114
+ name
115
+ rentalVehicle {
116
+ id
117
+ network
118
+ }
119
+ stop {
120
+ alerts {
121
+ alertDescriptionText
122
+ alertHeaderText
123
+ alertUrl
124
+ effectiveStartDate
125
+ id
126
+ }
127
+ code
128
+ gtfsId
129
+ id
130
+ lat
131
+ lon
132
+ }
133
+ vertexType
134
+ }
135
+ headsign
136
+ interlineWithPreviousLeg
137
+ intermediateStops {
138
+ lat
139
+ locationType
140
+ lon
141
+ name
142
+ stopCode: code
143
+ stopId: id
144
+ }
145
+ legGeometry {
146
+ length
147
+ points
148
+ }
149
+ mode
150
+ pickupBookingInfo {
151
+ contactInfo {
152
+ bookingUrl
153
+ infoUrl
154
+ phoneNumber
155
+ }
156
+ earliestBookingTime {
157
+ daysPrior
158
+ time
159
+ }
160
+ latestBookingTime {
161
+ daysPrior
162
+ time
163
+ }
164
+ message
165
+ }
166
+ pickupType
167
+ realTime
168
+ realtimeState
169
+ rentedBike
170
+ rideHailingEstimate {
171
+ arrival
172
+ maxPrice {
173
+ amount
174
+ currency {
175
+ code
176
+ }
177
+ }
178
+ minPrice {
179
+ amount
180
+ currency {
181
+ code
182
+ }
183
+ }
184
+ provider {
185
+ id
186
+ }
187
+ }
188
+ route {
189
+ alerts {
190
+ alertDescriptionText
191
+ alertHeaderText
192
+ alertUrl
193
+ effectiveStartDate
194
+ id
195
+ }
196
+ color
197
+ gtfsId
198
+ id: gtfsId
199
+ longName
200
+ shortName
201
+ textColor
202
+ type
203
+ }
204
+ startTime
205
+ steps {
206
+ absoluteDirection
207
+ alerts {
208
+ alertDescriptionText
209
+ alertHeaderText
210
+ alertUrl
211
+ effectiveStartDate
212
+ id
213
+ }
214
+ area
215
+ distance
216
+ elevationProfile {
217
+ distance
218
+ elevation
219
+ }
220
+ lat
221
+ lon
222
+ relativeDirection
223
+ stayOn
224
+ streetName
225
+ }
226
+ to {
227
+ lat
228
+ lon
229
+ name
230
+ rentalVehicle {
231
+ id
232
+ network
233
+ }
234
+ stop {
235
+ alerts {
236
+ alertDescriptionText
237
+ alertHeaderText
238
+ alertUrl
239
+ effectiveStartDate
240
+ id
241
+ }
242
+ code
243
+ gtfsId
244
+ id
245
+ lat
246
+ lon
247
+ }
248
+ vertexType
249
+ }
250
+ transitLeg
251
+ trip {
252
+ arrivalStoptime {
253
+ stop {
254
+ gtfsId
255
+ id
256
+ }
257
+ stopPosition
258
+ }
259
+ departureStoptime {
260
+ stop {
261
+ gtfsId
262
+ id
263
+ }
264
+ stopPosition
265
+ }
266
+ gtfsId
267
+ id
268
+ }
269
+ }
270
+ startTime
271
+ transfers: numberOfTransfers
272
+ waitingTime
273
+ walkTime
274
+ }
275
+ routingErrors {
276
+ code
277
+ description
278
+ inputField
279
+ }
280
+ }
281
+ }
package/esm/profile.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export function filterProfileOptions(response) {
2
- // Filter out similar options. TODO: handle on server??
2
+ // Filter out similar options. TODO: handle on server?
3
3
  var optStrs = [];
4
4
  var filteredIndices = [];
5
5
  var filteredProfile = response.otp.profile.filter(function (option, i) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/profile.js"],"names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","waitStats","egress","profileOptionsToItineraries","options"],"mappings":"AAAA,OAAO,SAASA,oBAAT,CAA8BC,QAA9B,EAAwC;AAC7C;AACA,MAAMC,OAAO,GAAG,EAAhB;AACA,MAAMC,eAAe,GAAG,EAAxB;AAEA,MAAMC,eAAe,GAAGH,QAAQ,CAACI,GAAT,CAAaC,OAAb,CAAqBC,MAArB,CAA4B,UAACC,MAAD,EAASC,CAAT,EAAe;AACjE,QAAIC,MAAM,GAAGF,MAAM,CAACG,MAAP,CAAcC,GAAd,CAAkB,UAAAC,CAAC;AAAA,aAAIA,CA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nB,OAAO,CAAC2C;AADZ,SANS;AASb1C,QAAAA,MAAM,EAAED,OAAO,CAACC,MATH;AAUbc,QAAAA,QAAQ,EAAEf,OAAO,CAAC4C,SAAR,CAAkBC,GAVf;AAWbC,QAAAA,WAAW,EAAE9C,OAAO,CAAC+C,SAAR,CAAkBF;AAXlB,OAAf;AAaAtB,MAAAA,IAAI,CAACG,WAAL,IAAoB1B,OAAO,CAAC+C,SAAR,CAAkBF,GAAtC;AACD,KAfD;AAgBD,GAlHuC,CAoHxC;;;AACA,MAAIrD,MAAM,CAACwD,MAAP,IAAiBxD,MAAM,CAACwD,MAAP,CAAcrB,MAAd,GAAuB,CAA5C,EAA+C;AAC7C;AACA,QAAMd,MAAM,GAAGrB,MAAM,CAACQ,OAAP,GACXR,MAAM,CAACQ,OAAP,CAAeR,MAAM,CAACQ,OAAP,CAAe2B,MAAf,GAAwB,CAAvC,EAA0CgB,MAD/B,GAEX,IAFJ;AAIApB,IAAAA,IAAI,CAACC,IAAL,CAAUnB,IAAV,CACEO,WAAW,CAACpB,MAAM,CAACwD,MAAP,CAAc,CAAd,CAAD,EAAmBnC,MAAnB,EAA2BS,KAAK,IAAIA,KAAK,CAACF,EAAN,CAASD,IAA7C,CADb;AAGA,QAAI3B,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBlD,IAAjB,KAA0B,MAA9B,EACEyB,IAAI,CAACE,QAAL,IAAiBjC,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBhC,IAAlC;AACH;;AAED,SAAOO,IAAP;AACD;AAED;;;AAEA,OAAO,SAAS0B,2BAAT,CAAqCC,OAArC,EAA8C5B,KAA9C,EAAqD;AAC1D,SAAO4B,OAAO,CAACtD,GAAR,CAAY,UAAAJ,MAAM;AAAA,WAAI6B,iBAAiB,CAAC7B,MAAD,EAAS8B,KAAT,CAArB;AAAA,GAAlB,CAAP;AACD","sourcesContent":["export function filterProfileOptions(response) {\n // Filter out similar options. TODO: handle on server??\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str?.split(\",\")[0];\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"file":"profile.js"}
1
+ {"version":3,"sources":["../src/profile.js"],"names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","waitStats","egress","profileOptionsToItineraries","options"],"mappings":"AAAA,OAAO,SAASA,oBAAT,CAA8BC,QAA9B,EAAwC;AAC7C;AACA,MAAMC,OAAO,GAAG,EAAhB;AACA,MAAMC,eAAe,GAAG,EAAxB;AAEA,MAAMC,eAAe,GAAGH,QAAQ,CAACI,GAAT,CAAaC,OAAb,CAAqBC,MAArB,CAA4B,UAACC,MAAD,EAASC,CAAT,EAAe;AACjE,QAAIC,MAAM,GAAGF,MAAM,CAACG,MAAP,CAAcC,GAAd,CAAkB,UAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,IAAN;AAAA,KAAnB,EAA+BC,IAA/B,CAAoC,GAApC,CAAb;;AACA,QAAIP,MAAM,CAACQ,OAAX,EAAoB;AAClBN,MAAAA,MAAM,kBAAWF,MAAM,CAACQ,OAAP,CACdJ,GADc,CACV,UAAAI,OAAO,EAAI;AACd,eAAOA,OAAO,CAACC,MAAR,CAAeL,GAAf,CAAmB,UAAAM,KAAK;AAAA,iBAAIA,KAAK,CAACC,EAAV;AAAA,SAAxB,EAAsCJ,IAAtC,CAA2C,GAA3C,CAAP;AACD,OAHc,EAIdA,IAJc,CAIT,GAJS,CAAX,CAAN;AAKD;;AACD,QAAIb,OAAO,CAACkB,OAAR,CAAgBV,MAAhB,MAA4B,CAAC,CAAjC,EAAoC,OAAO,KAAP;AACpCR,IAAAA,OAAO,CAACmB,IAAR,CAAaX,MAAb;AACAP,IAAAA,eAAe,CAACkB,IAAhB,CAAqBZ,CAArB;AACA,WAAO,IAAP;AACD,GAbuB,CAAxB;AAeA,MAAMa,gBAAgB,GAAGrB,QAAQ,CAACI,GAAT,CAAakB,QAAb,CAAsBhB,MAAtB,CACvB,UAACiB,OAAD,EAAUf,CAAV;AAAA,WAAgBN,eAAe,CAACiB,OAAhB,CAAwBX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AAGA,QAAI3B,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBlD,IAAjB,KAA0B,MAA9B,EACEyB,IAAI,CAACE,QAAL,IAAiBjC,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBhC,IAAlC;AACH;;AAED,SAAOO,IAAP;AACD;AAED;;;AAEA,OAAO,SAAS0B,2BAAT,CAAqCC,OAArC,EAA8C5B,KAA9C,EAAqD;AAC1D,SAAO4B,OAAO,CAACtD,GAAR,CAAY,UAAAJ,MAAM;AAAA,WAAI6B,iBAAiB,CAAC7B,MAAD,EAAS8B,KAAT,CAArB;AAAA,GAAlB,CAAP;AACD","sourcesContent":["export function filterProfileOptions(response) {\n // Filter out similar options. TODO: handle on server?\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str?.split(\",\")[0];\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"file":"profile.js"}
package/esm/query-gen.js CHANGED
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
7
 
8
8
  import { print } from "graphql";
9
- var DefaultPlanQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "Plan" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "arriveBy" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "banned" } }, type: { kind: "NamedType", name: { kind: "Name", value: "InputBanned" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "bikeReluctance" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "carReluctance" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "date" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "fromPlace" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "modes" } }, type: { kind: "ListType", type: { kind: "NamedType", name: { kind: "Name", value: "TransportMode" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "numItineraries" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "preferred" } }, type: { kind: "NamedType", name: { kind: "Name", value: "InputPreferred" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "time" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "toPlace" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "unpreferred" } }, type: { kind: "NamedType", name: { kind: "Name", value: "InputUnpreferred" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "walkReluctance" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "walkSpeed" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "wheelchair" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "plan" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "arriveBy" }, value: { kind: "Variable", name: { kind: "Name", value: "arriveBy" } } }, { kind: "Argument", name: { kind: "Name", value: "banned" }, value: { kind: "Variable", name: { kind: "Name", value: "banned" } } }, { kind: "Argument", name: { kind: "Name", value: "bikeReluctance" }, value: { kind: "Variable", name: { kind: "Name", value: "bikeReluctance" } } }, { kind: "Argument", name: { kind: "Name", value: "carReluctance" }, value: { kind: "Variable", name: { kind: "Name", value: "carReluctance" } } }, { kind: "Argument", name: { kind: "Name", value: "date" }, value: { kind: "Variable", name: { kind: "Name", value: "date" } } }, { kind: "Argument", name: { kind: "Name", value: "fromPlace" }, value: { kind: "Variable", name: { kind: "Name", value: "fromPlace" } } }, { kind: "Argument", name: { kind: "Name", value: "locale" }, value: { kind: "StringValue", value: "en", block: false } }, { kind: "Argument", name: { kind: "Name", value: "numItineraries" }, value: { kind: "Variable", name: { kind: "Name", value: "numItineraries" } } }, { kind: "Argument", name: { kind: "Name", value: "preferred" }, value: { kind: "Variable", name: { kind: "Name", value: "preferred" } } }, { kind: "Argument", name: { kind: "Name", value: "time" }, value: { kind: "Variable", name: { kind: "Name", value: "time" } } }, { kind: "Argument", name: { kind: "Name", value: "toPlace" }, value: { kind: "Variable", name: { kind: "Name", value: "toPlace" } } }, { kind: "Argument", name: { kind: "Name", value: "transportModes" }, value: { kind: "Variable", name: { kind: "Name", value: "modes" } } }, { kind: "Argument", name: { kind: "Name", value: "unpreferred" }, value: { kind: "Variable", name: { kind: "Name", value: "unpreferred" } } }, { kind: "Argument", name: { kind: "Name", value: "walkReluctance" }, value: { kind: "Variable", name: { kind: "Name", value: "walkReluctance" } } }, { kind: "Argument", name: { kind: "Name", value: "walkSpeed" }, value: { kind: "Variable", name: { kind: "Name", value: "walkSpeed" } } }, { kind: "Argument", name: { kind: "Name", value: "wheelchair" }, value: { kind: "Variable", name: { kind: "Name", value: "wheelchair" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "itineraries" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "accessibilityScore" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "duration" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "endTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "legs" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "accessibilityScore" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "agency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "id" }, name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "timezone" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "arrivalDelay" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "departureDelay" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "distance" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "dropoffType" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "duration" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "endTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "fareProducts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "product" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "medium" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "riderCategory" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DefaultFareProduct" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "price" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "amount" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "currency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "digits" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "from" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rentalVehicle" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "network" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "vertexType" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "headsign" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "interlineWithPreviousLeg" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "intermediateStops" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locationType" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "stopCode" }, name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "stopId" }, name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "legGeometry" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "length" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "points" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "mode" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "pickupBookingInfo" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "earliestBookingTime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "daysPrior" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "pickupType" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "realTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "realtimeState" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rentedBike" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rideHailingEstimate" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "arrival" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "maxPrice" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "amount" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "currency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "minPrice" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "amount" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "currency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "provider" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "route" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "color" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "id" }, name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "longName" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "shortName" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "textColor" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "startTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "steps" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "absoluteDirection" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "area" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "distance" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "elevationProfile" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "distance" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "elevation" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "relativeDirection" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "stayOn" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "streetName" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "to" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rentalVehicle" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "network" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "vertexType" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "transitLeg" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "trip" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "arrivalStoptime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stopPosition" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "departureStoptime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stopPosition" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "startTime" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "transfers" }, name: { kind: "Name", value: "numberOfTransfers" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "waitingTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "walkTime" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "routingErrors" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "description" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "inputField" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 4950, source: { body: "query Plan(\n $arriveBy: Boolean\n $banned: InputBanned\n $bikeReluctance: Float\n $carReluctance: Float\n $date: String\n $fromPlace: String!\n $modes: [TransportMode]\n $numItineraries: Int\n $preferred: InputPreferred\n $time: String\n $toPlace: String!\n $unpreferred: InputUnpreferred\n $walkReluctance: Float\n $walkSpeed: Float\n $wheelchair: Boolean\n) {\n plan(\n arriveBy: $arriveBy\n banned: $banned\n bikeReluctance: $bikeReluctance\n carReluctance: $carReluctance\n date: $date\n fromPlace: $fromPlace\n # Currently only supporting EN locale, used for times and text\n locale: \"en\"\n numItineraries: $numItineraries\n preferred: $preferred\n time: $time\n toPlace: $toPlace\n transportModes: $modes\n unpreferred: $unpreferred\n walkReluctance: $walkReluctance\n walkSpeed: $walkSpeed\n wheelchair: $wheelchair\n ) {\n itineraries {\n accessibilityScore\n duration\n endTime\n legs {\n accessibilityScore\n agency {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n gtfsId\n id: gtfsId\n name\n timezone\n url\n }\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n arrivalDelay\n departureDelay\n distance\n dropoffType\n duration\n endTime\n fareProducts {\n id\n product {\n __typename\n id\n medium {\n id\n name\n }\n name\n riderCategory {\n id\n name\n }\n ... on DefaultFareProduct {\n price {\n amount\n currency {\n code\n digits\n }\n }\n }\n }\n }\n from {\n lat\n lon\n name\n rentalVehicle {\n id\n network\n }\n stop {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n code\n gtfsId\n id\n lat\n lon\n }\n vertexType\n }\n headsign\n interlineWithPreviousLeg\n intermediateStops {\n lat\n locationType\n lon\n name\n stopCode: code\n stopId: id\n }\n legGeometry {\n length\n points\n }\n mode\n pickupBookingInfo {\n earliestBookingTime {\n daysPrior\n }\n }\n pickupType\n realTime\n realtimeState\n rentedBike\n rideHailingEstimate {\n arrival\n maxPrice {\n amount\n currency {\n code\n }\n }\n minPrice {\n amount\n currency {\n code\n }\n }\n provider {\n id\n }\n }\n route {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n color\n gtfsId\n id: gtfsId\n longName\n shortName\n textColor\n type\n }\n startTime\n steps {\n absoluteDirection\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n area\n distance\n elevationProfile {\n distance\n elevation\n }\n lat\n lon\n relativeDirection\n stayOn\n streetName\n }\n to {\n lat\n lon\n name\n rentalVehicle {\n id\n network\n }\n stop {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n code\n gtfsId\n id\n lat\n lon\n }\n vertexType\n }\n transitLeg\n trip {\n arrivalStoptime {\n stop {\n gtfsId\n id\n }\n stopPosition\n }\n departureStoptime {\n stop {\n gtfsId\n id\n }\n stopPosition\n }\n gtfsId\n id\n }\n }\n startTime\n transfers: numberOfTransfers\n waitingTime\n walkTime\n }\n routingErrors {\n code\n description\n inputField\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
9
+ var DefaultPlanQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "Plan" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "arriveBy" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "banned" } }, type: { kind: "NamedType", name: { kind: "Name", value: "InputBanned" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "bikeReluctance" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "carReluctance" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "date" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "fromPlace" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "modes" } }, type: { kind: "ListType", type: { kind: "NamedType", name: { kind: "Name", value: "TransportMode" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "numItineraries" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "preferred" } }, type: { kind: "NamedType", name: { kind: "Name", value: "InputPreferred" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "time" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "toPlace" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "unpreferred" } }, type: { kind: "NamedType", name: { kind: "Name", value: "InputUnpreferred" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "walkReluctance" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "walkSpeed" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Float" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "wheelchair" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "plan" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "arriveBy" }, value: { kind: "Variable", name: { kind: "Name", value: "arriveBy" } } }, { kind: "Argument", name: { kind: "Name", value: "banned" }, value: { kind: "Variable", name: { kind: "Name", value: "banned" } } }, { kind: "Argument", name: { kind: "Name", value: "bikeReluctance" }, value: { kind: "Variable", name: { kind: "Name", value: "bikeReluctance" } } }, { kind: "Argument", name: { kind: "Name", value: "carReluctance" }, value: { kind: "Variable", name: { kind: "Name", value: "carReluctance" } } }, { kind: "Argument", name: { kind: "Name", value: "date" }, value: { kind: "Variable", name: { kind: "Name", value: "date" } } }, { kind: "Argument", name: { kind: "Name", value: "fromPlace" }, value: { kind: "Variable", name: { kind: "Name", value: "fromPlace" } } }, { kind: "Argument", name: { kind: "Name", value: "locale" }, value: { kind: "StringValue", value: "en", block: false } }, { kind: "Argument", name: { kind: "Name", value: "numItineraries" }, value: { kind: "Variable", name: { kind: "Name", value: "numItineraries" } } }, { kind: "Argument", name: { kind: "Name", value: "preferred" }, value: { kind: "Variable", name: { kind: "Name", value: "preferred" } } }, { kind: "Argument", name: { kind: "Name", value: "time" }, value: { kind: "Variable", name: { kind: "Name", value: "time" } } }, { kind: "Argument", name: { kind: "Name", value: "toPlace" }, value: { kind: "Variable", name: { kind: "Name", value: "toPlace" } } }, { kind: "Argument", name: { kind: "Name", value: "transportModes" }, value: { kind: "Variable", name: { kind: "Name", value: "modes" } } }, { kind: "Argument", name: { kind: "Name", value: "unpreferred" }, value: { kind: "Variable", name: { kind: "Name", value: "unpreferred" } } }, { kind: "Argument", name: { kind: "Name", value: "walkReluctance" }, value: { kind: "Variable", name: { kind: "Name", value: "walkReluctance" } } }, { kind: "Argument", name: { kind: "Name", value: "walkSpeed" }, value: { kind: "Variable", name: { kind: "Name", value: "walkSpeed" } } }, { kind: "Argument", name: { kind: "Name", value: "wheelchair" }, value: { kind: "Variable", name: { kind: "Name", value: "wheelchair" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "itineraries" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "accessibilityScore" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "duration" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "endTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "legs" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "accessibilityScore" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "agency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "id" }, name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "timezone" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "arrivalDelay" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "departureDelay" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "distance" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "dropOffBookingInfo" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "contactInfo" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "bookingUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "infoUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "phoneNumber" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "earliestBookingTime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "daysPrior" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "time" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "latestBookingTime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "daysPrior" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "time" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "message" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dropoffType" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "duration" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "endTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "fareProducts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "product" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "medium" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "riderCategory" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DefaultFareProduct" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "price" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "amount" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "currency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "digits" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "from" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rentalVehicle" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "network" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "vertexType" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "headsign" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "interlineWithPreviousLeg" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "intermediateStops" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locationType" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "stopCode" }, name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "stopId" }, name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "legGeometry" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "length" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "points" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "mode" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "pickupBookingInfo" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "contactInfo" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "bookingUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "infoUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "phoneNumber" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "earliestBookingTime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "daysPrior" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "time" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "latestBookingTime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "daysPrior" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "time" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "message" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "pickupType" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "realTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "realtimeState" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rentedBike" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rideHailingEstimate" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "arrival" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "maxPrice" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "amount" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "currency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "minPrice" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "amount" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "currency" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "provider" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "route" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "color" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "id" }, name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "longName" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "shortName" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "textColor" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "startTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "steps" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "absoluteDirection" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "area" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "distance" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "elevationProfile" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "distance" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "elevation" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "relativeDirection" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "stayOn" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "streetName" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "to" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "rentalVehicle" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "network" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alerts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "alertDescriptionText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertHeaderText" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alertUrl" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "effectiveStartDate" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lon" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "vertexType" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "transitLeg" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "trip" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "arrivalStoptime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stopPosition" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "departureStoptime" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "stop" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "stopPosition" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "gtfsId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "startTime" }, arguments: [], directives: [] }, { kind: "Field", alias: { kind: "Name", value: "transfers" }, name: { kind: "Name", value: "numberOfTransfers" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "waitingTime" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "walkTime" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "routingErrors" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "description" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "inputField" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 5493, source: { body: "query Plan(\n $arriveBy: Boolean\n $banned: InputBanned\n $bikeReluctance: Float\n $carReluctance: Float\n $date: String\n $fromPlace: String!\n $modes: [TransportMode]\n $numItineraries: Int\n $preferred: InputPreferred\n $time: String\n $toPlace: String!\n $unpreferred: InputUnpreferred\n $walkReluctance: Float\n $walkSpeed: Float\n $wheelchair: Boolean\n) {\n plan(\n arriveBy: $arriveBy\n banned: $banned\n bikeReluctance: $bikeReluctance\n carReluctance: $carReluctance\n date: $date\n fromPlace: $fromPlace\n # Currently only supporting EN locale, used for times and text\n locale: \"en\"\n numItineraries: $numItineraries\n preferred: $preferred\n time: $time\n toPlace: $toPlace\n transportModes: $modes\n unpreferred: $unpreferred\n walkReluctance: $walkReluctance\n walkSpeed: $walkSpeed\n wheelchair: $wheelchair\n ) {\n itineraries {\n accessibilityScore\n duration\n endTime\n legs {\n accessibilityScore\n agency {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n gtfsId\n id: gtfsId\n name\n timezone\n url\n }\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n arrivalDelay\n departureDelay\n distance\n dropOffBookingInfo {\n contactInfo {\n bookingUrl\n infoUrl\n phoneNumber\n }\n earliestBookingTime {\n daysPrior\n time\n }\n latestBookingTime {\n daysPrior\n time\n }\n message\n }\n dropoffType\n duration\n endTime\n fareProducts {\n id\n product {\n __typename\n id\n medium {\n id\n name\n }\n name\n riderCategory {\n id\n name\n }\n ... on DefaultFareProduct {\n price {\n amount\n currency {\n code\n digits\n }\n }\n }\n }\n }\n from {\n lat\n lon\n name\n rentalVehicle {\n id\n network\n }\n stop {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n code\n gtfsId\n id\n lat\n lon\n }\n vertexType\n }\n headsign\n interlineWithPreviousLeg\n intermediateStops {\n lat\n locationType\n lon\n name\n stopCode: code\n stopId: id\n }\n legGeometry {\n length\n points\n }\n mode\n pickupBookingInfo {\n contactInfo {\n bookingUrl\n infoUrl\n phoneNumber\n }\n earliestBookingTime {\n daysPrior\n time\n }\n latestBookingTime {\n daysPrior\n time\n }\n message\n }\n pickupType\n realTime\n realtimeState\n rentedBike\n rideHailingEstimate {\n arrival\n maxPrice {\n amount\n currency {\n code\n }\n }\n minPrice {\n amount\n currency {\n code\n }\n }\n provider {\n id\n }\n }\n route {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n color\n gtfsId\n id: gtfsId\n longName\n shortName\n textColor\n type\n }\n startTime\n steps {\n absoluteDirection\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n area\n distance\n elevationProfile {\n distance\n elevation\n }\n lat\n lon\n relativeDirection\n stayOn\n streetName\n }\n to {\n lat\n lon\n name\n rentalVehicle {\n id\n network\n }\n stop {\n alerts {\n alertDescriptionText\n alertHeaderText\n alertUrl\n effectiveStartDate\n id\n }\n code\n gtfsId\n id\n lat\n lon\n }\n vertexType\n }\n transitLeg\n trip {\n arrivalStoptime {\n stop {\n gtfsId\n id\n }\n stopPosition\n }\n departureStoptime {\n stop {\n gtfsId\n id\n }\n stopPosition\n }\n gtfsId\n id\n }\n }\n startTime\n transfers: numberOfTransfers\n waitingTime\n walkTime\n }\n routingErrors {\n code\n description\n inputField\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
10
10
 
11
11
  /**
12
12
  * Mode Settings can contain additional modes to add to the query,
@@ -22,7 +22,7 @@ export function extractAdditionalModes(modeSettings, enabledModes) {
22
22
  return m.mode;
23
23
  }).includes(cur.applicableMode)) {
24
24
  return prev;
25
- } // In checkboxes (or submode checkboxes), mode must be enabled and have a transport mode in it
25
+ } // In checkboxes, mode must be enabled and have a transport mode in it
26
26
 
27
27
 
28
28
  if ((cur.type === "CHECKBOX" || cur.type === "SUBMODE") && cur.addTransportMode && cur.value) {
@@ -185,7 +185,8 @@ export function generateOtp2Query(_ref) {
185
185
  numItineraries = _ref.numItineraries,
186
186
  preferred = _ref.preferred,
187
187
  time = _ref.time,
188
- to = _ref.to;
188
+ to = _ref.to,
189
+ unpreferred = _ref.unpreferred;
189
190
  var planQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DefaultPlanQuery;
190
191
  // This extracts the values from the mode settings to key value pairs
191
192
  var modeSettingValues = modeSettings.reduce(function (prev, cur) {
@@ -216,12 +217,13 @@ export function generateOtp2Query(_ref) {
216
217
  bikeReluctance: bikeReluctance,
217
218
  carReluctance: carReluctance,
218
219
  date: date,
219
- fromPlace: "".concat(from.name, "::").concat(from.lat, ",").concat(from.lon, "}"),
220
+ fromPlace: "".concat(from.name, "::").concat(from.lat, ",").concat(from.lon),
220
221
  modes: modes,
221
222
  numItineraries: numItineraries,
222
223
  preferred: preferred,
223
224
  time: time,
224
- toPlace: "".concat(to.name, "::").concat(to.lat, ",").concat(to.lon, "}"),
225
+ toPlace: "".concat(to.name, "::").concat(to.lat, ",").concat(to.lon),
226
+ unpreferred: unpreferred,
225
227
  walkReluctance: walkReluctance,
226
228
  walkSpeed: walkSpeed,
227
229
  wheelchair: wheelchair
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/query-gen.ts"],"names":["print","extractAdditionalModes","modeSettings","enabledModes","reduce","prev","cur","map","m","mode","includes","applicableMode","type","addTransportMode","value","newTransportModes","Array","isArray","transportMode","options","find","o","combinations","array","length","fill","e1","i","filter","e2","j","SIMPLIFICATIONS","AIRPLANE","BICYCLE","BUS","CABLE_CAR","CAR","FERRY","FLEX","FUNICULAR","GONDOLA","RAIL","MONORAIL","SCOOTER","SUBWAY","TROLLEYBUS","TRAM","TRANSIT","WALK","VALID_COMBOS","BANNED_TOGETHER","TRANSIT_SUBMODES","Object","keys","TRANSIT_SUBMODES_AND_TRANSIT","isCombinationValid","combo","queryTransitSubmodes","simplifiedModes","from","Set","c","qualifier","vc","every","generateCombinations","params","completeModeList","modes","generateOtp2Query","arriveBy","banned","date","numItineraries","preferred","time","to","planQuery","DefaultPlanQuery","modeSettingValues","inverseKey","high","low","key","truthValue","falseValue","bikeReluctance","carReluctance","walkSpeed","walkReluctance","wheelchair","query","variables","fromPlace","name","lat","lon","toPlace"],"mappings":";;;;;;;AACA,SAASA,KAAT,QAAsB,SAAtB;;;AAyCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAT,CACLC,YADK,EAELC,YAFK,EAGY;AACjB,SAAOD,YAAY,CAACE,MAAb,CAAqC,UAACC,IAAD,EAAOC,GAAP,EAAe;AACzD;AACA,QAAI,CAACH,YAAY,CAACI,GAAb,CAAiB,UAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,IAAN;AAAA,KAAlB,EAA8BC,QAA9B,CAAuCJ,GAAG,CAACK,cAA3C,CAAL,EAAiE;AAC/D,aAAON,IAAP;AACD,KAJwD,CAMzD;;;AACA,QACE,CAACC,GAAG,CAACM,IAAJ,KAAa,UAAb,IAA2BN,GAAG,CAACM,IAAJ,KAAa,SAAzC,KACAN,GAAG,CAACO,gBADJ,IAEAP,GAAG,CAACQ,KAHN,EAIE;AACA,UAAMC,iBAAiB,GAAGC,KAAK,CAACC,OAAN,CAAcX,GAAG,CAACO,gBAAlB,IACtBP,GAAG,CAACO,gBADkB,GAEtB,CAACP,GAAG,CAACO,gBAAL,CAFJ;AAGA,0CAAWR,IAAX,sBAAoBU,iBAApB;AACD;;AACD,QAAIT,GAAG,CAACM,IAAJ,KAAa,UAAjB,EAA6B;AAAA;;AAC3B,UAAMM,aAAa,wBAAGZ,GAAG,CAACa,OAAJ,CAAYC,IAAZ,CAAiB,UAAAC,CAAC;AAAA,eAAIA,CAAC,CAACP,KAAF,KAAYR,GAAG,CAACQ,KAApB;AAAA,OAAlB,CAAH,sDAAG,kBAClBD,gBADJ;;AAEA,UAAIK,aAAJ,EAAmB;AACjB,4CAAWb,IAAX,IAAiBa,aAAjB;AACD;AACF;;AACD,WAAOb,IAAP;AACD,GAzBM,EAyBJ,EAzBI,CAAP;AA0BD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SA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yal/lonlat\";\nimport { print } from \"graphql\";\nimport {\n ModeSetting,\n ModeSettingValues,\n TransportMode\n} from \"@opentripplanner/types\";\n\nimport DefaultPlanQuery from \"./planQuery.graphql\";\n\ntype InputBanned = {\n routes?: string;\n agencies?: string;\n trips?: string;\n stops?: string;\n stopsHard?: string;\n};\n\ntype InputPreferred = {\n routes?: string;\n agencies?: string;\n unpreferredCost?: string;\n};\n\ntype OTPQueryParams = {\n arriveBy: boolean;\n date?: string;\n from: LonLatOutput & { name?: string };\n modes: TransportMode[];\n modeSettings: ModeSetting[];\n time?: string;\n numItineraries?: number;\n to: LonLatOutput & { name?: string };\n banned?: InputBanned;\n preferred?: InputPreferred;\n};\n\ntype GraphQLQuery = {\n query: string;\n variables: Record<string, unknown>;\n};\n\n/**\n * Mode Settings can contain additional modes to add to the query,\n * this function extracts those additional modes from the settings\n * and returns them in an array.\n * @param modeSettings List of mode settings with values populated\n * @returns Additional transport modes to add to query\n */\nexport function extractAdditionalModes(\n modeSettings: ModeSetting[],\n enabledModes: TransportMode[]\n): TransportMode[] {\n return modeSettings.reduce<TransportMode[]>((prev, cur) => {\n // First, ensure that the mode associated with this setting is even enabled\n if (!enabledModes.map(m => m.mode).includes(cur.applicableMode)) {\n return prev;\n }\n\n // In checkboxes (or submode checkboxes), mode must be enabled and have a transport mode in it\n if (\n (cur.type === \"CHECKBOX\" || cur.type === \"SUBMODE\") &&\n cur.addTransportMode &&\n cur.value\n ) {\n const newTransportModes = Array.isArray(cur.addTransportMode)\n ? cur.addTransportMode\n : [cur.addTransportMode];\n return [...prev, ...newTransportModes];\n }\n if (cur.type === \"DROPDOWN\") {\n const transportMode = cur.options.find(o => o.value === cur.value)\n ?.addTransportMode;\n if (transportMode) {\n return [...prev, transportMode];\n }\n }\n return prev;\n }, []);\n}\n\n/**\n * Generates every possible mathematical subset of the input TransportModes.\n * Uses code from:\n * https://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array\n * @param array Array of input transport modes\n * @returns 2D array representing every possible subset of transport modes from input\n */\nfunction combinations(array: TransportMode[]): TransportMode[][] {\n if (!array) return [];\n return (\n // eslint-disable-next-line no-bitwise\n new Array(1 << array.length)\n .fill(null)\n // eslint-disable-next-line no-bitwise\n .map((e1, i) => array.filter((e2, j) => i & (1 << j)))\n );\n}\n\n/**\n * This constant maps all the transport mode to a broader mode type,\n * which is used to determine the valid combinations of modes used in query generation.\n */\nexport const SIMPLIFICATIONS = {\n AIRPLANE: \"TRANSIT\",\n BICYCLE: \"PERSONAL\",\n BUS: \"TRANSIT\",\n CABLE_CAR: \"TRANSIT\",\n CAR: \"CAR\",\n FERRY: \"TRANSIT\",\n FLEX: \"SHARED\", // TODO: this allows FLEX+WALK. Is this reasonable?\n FUNICULAR: \"TRANSIT\",\n GONDOLA: \"TRANSIT\",\n RAIL: \"TRANSIT\",\n MONORAIL: \"TRANSIT\",\n SCOOTER: \"PERSONAL\",\n SUBWAY: \"TRANSIT\",\n TROLLEYBUS: \"TRANSIT\",\n TRAM: \"TRANSIT\",\n TRANSIT: \"TRANSIT\",\n WALK: \"WALK\"\n};\n\n// Inclusion of \"TRANSIT\" alone automatically implies \"WALK\" in OTP\nconst VALID_COMBOS = [\n [\"WALK\"],\n [\"PERSONAL\"],\n [\"TRANSIT\", \"SHARED\"],\n [\"WALK\", \"SHARED\"],\n [\"TRANSIT\"],\n [\"TRANSIT\", \"PERSONAL\"],\n [\"TRANSIT\", \"CAR\"]\n];\n\nconst BANNED_TOGETHER = [\"SCOOTER\", \"BICYCLE\", \"CAR\"];\n\nexport const TRANSIT_SUBMODES = Object.keys(SIMPLIFICATIONS).filter(\n mode => SIMPLIFICATIONS[mode] === \"TRANSIT\" && mode !== \"TRANSIT\"\n);\nexport const TRANSIT_SUBMODES_AND_TRANSIT = Object.keys(SIMPLIFICATIONS).filter(\n mode => SIMPLIFICATIONS[mode] === \"TRANSIT\"\n);\n\nfunction isCombinationValid(\n combo: TransportMode[],\n queryTransitSubmodes: string[]\n): boolean {\n if (combo.length === 0) return false;\n\n // All current qualifiers currently simplify to \"SHARED\"\n const simplifiedModes = Array.from(\n new Set(combo.map(c => (c.qualifier ? \"SHARED\" : SIMPLIFICATIONS[c.mode])))\n );\n\n // Ensure that if we have one transit mode, then we include ALL transit modes\n if (simplifiedModes.includes(\"TRANSIT\")) {\n // Don't allow TRANSIT along with any other submodes\n if (queryTransitSubmodes.length && combo.find(c => c.mode === \"TRANSIT\")) {\n return false;\n }\n\n if (\n combo.reduce((prev, cur) => {\n if (queryTransitSubmodes.includes(cur.mode)) {\n return prev - 1;\n }\n return prev;\n }, queryTransitSubmodes.length) !== 0\n ) {\n return false;\n }\n // Continue to the other checks\n }\n\n // OTP doesn't support multiple non-walk modes\n if (BANNED_TOGETHER.filter(m => combo.find(c => c.mode === m)).length > 1) {\n return false;\n }\n\n return !!VALID_COMBOS.find(\n vc =>\n simplifiedModes.every(m => vc.includes(m)) &&\n vc.every(m => simplifiedModes.includes(m))\n );\n}\n\n/**\n * Generates a list of queries for OTP to get a comprehensive\n * set of results based on the modes input.\n * @param params OTP Query Params\n * @returns Set of parameters to generate queries\n */\nexport function generateCombinations(params: OTPQueryParams): OTPQueryParams[] {\n const completeModeList = [\n ...extractAdditionalModes(params.modeSettings, params.modes),\n ...params.modes\n ];\n\n // List of the transit *submodes* that are included in the input params\n const queryTransitSubmodes = completeModeList\n .filter(mode => TRANSIT_SUBMODES.includes(mode.mode))\n .map(mode => mode.mode);\n\n return combinations(completeModeList)\n .filter(combo => isCombinationValid(combo, queryTransitSubmodes))\n .map(combo => ({ ...params, modes: combo }));\n}\n\n/**\n * Generates a query for OTP GraphQL API based on parameters.\n * @param param0 OTP2 Parameters for the query\n * @param planQuery Override the default query for OTP\n * @returns A fully formed query+variables ready to be sent to GraphQL backend\n */\nexport function generateOtp2Query(\n {\n arriveBy,\n banned,\n date,\n from,\n modes,\n modeSettings,\n numItineraries,\n preferred,\n time,\n to\n }: OTPQueryParams,\n planQuery = DefaultPlanQuery\n): GraphQLQuery {\n // This extracts the values from the mode settings to key value pairs\n const modeSettingValues = modeSettings.reduce((prev, cur) => {\n if (cur.type === \"SLIDER\" && cur.inverseKey) {\n prev[cur.inverseKey] = cur.high - cur.value + cur.low;\n }\n prev[cur.key] = cur.value;\n\n // If we assign a value on true, return the value (or null) instead of a boolean.\n if (cur.type === \"CHECKBOX\" && cur.truthValue) {\n prev[cur.key] =\n cur.value === true ? cur.truthValue : cur.falseValue ?? null;\n }\n return prev;\n }, {}) as ModeSettingValues;\n\n const {\n bikeReluctance,\n carReluctance,\n walkSpeed,\n walkReluctance,\n wheelchair\n } = modeSettingValues;\n\n return {\n query: print(planQuery),\n variables: {\n arriveBy,\n banned,\n bikeReluctance,\n carReluctance,\n date,\n fromPlace: `${from.name}::${from.lat},${from.lon}}`,\n modes,\n numItineraries,\n preferred,\n time,\n toPlace: `${to.name}::${to.lat},${to.lon}}`,\n walkReluctance,\n walkSpeed,\n wheelchair\n }\n };\n}\n"],"file":"query-gen.js"}
1
+ {"version":3,"sources":["../src/query-gen.ts"],"names":["print","extractAdditionalModes","modeSettings","enabledModes","reduce","prev","cur","map","m","mode","includes","applicableMode","type","addTransportMode","value","newTransportModes","Array","isArray","transportMode","options","find","o","combinations","array","length","fill","e1","i","filter","e2","j","SIMPLIFICATIONS","AIRPLANE","BICYCLE","BUS","CABLE_CAR","CAR","FERRY","FLEX","FUNICULAR","GONDOLA","RAIL","MONORAIL","SCOOTER","SUBWAY","TROLLEYBUS","TRAM","TRANSIT","WALK","VALID_COMBOS","BANNED_TOGETHER","TRANSIT_SUBMODES","Object","keys","TRANSIT_SUBMODES_AND_TRANSIT","isCombinationValid","combo","queryTransitSubmodes","simplifiedModes","from","Set","c","qualifier","vc","every","generateCombinations","params","completeModeList","modes","generateOtp2Query","arriveBy","banned","date","numItineraries","preferred","time","to","unpreferred","planQuery","DefaultPlanQuery","modeSettingValues","inverseKey","high","low","key","truthValue","falseValue","bikeReluctance","carReluctance","walkSpeed","walkReluctance","wheelchair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cesContent":["import { LonLatOutput } from \"@conveyal/lonlat\";\nimport { print } from \"graphql\";\nimport {\n ModeSetting,\n ModeSettingValues,\n TransportMode\n} from \"@opentripplanner/types\";\n\nimport DefaultPlanQuery from \"./planQuery.graphql\";\n\ntype InputBanned = {\n routes?: string;\n agencies?: string;\n trips?: string;\n stops?: string;\n stopsHard?: string;\n};\n\ntype InputPreferred = {\n routes?: string;\n agencies?: string;\n unpreferredCost?: string;\n};\n\ntype OTPQueryParams = {\n arriveBy: boolean;\n date?: string;\n from: LonLatOutput & { name?: string };\n modes: TransportMode[];\n modeSettings: ModeSetting[];\n time?: string;\n numItineraries?: number;\n to: LonLatOutput & { name?: string };\n banned?: InputBanned;\n preferred?: InputPreferred;\n unpreferred?: InputPreferred;\n};\n\ntype GraphQLQuery = {\n query: string;\n variables: Record<string, unknown>;\n};\n\n/**\n * Mode Settings can contain additional modes to add to the query,\n * this function extracts those additional modes from the settings\n * and returns them in an array.\n * @param modeSettings List of mode settings with values populated\n * @returns Additional transport modes to add to query\n */\nexport function extractAdditionalModes(\n modeSettings: ModeSetting[],\n enabledModes: TransportMode[]\n): TransportMode[] {\n return modeSettings.reduce<TransportMode[]>((prev, cur) => {\n // First, ensure that the mode associated with this setting is even enabled\n if (!enabledModes.map(m => m.mode).includes(cur.applicableMode)) {\n return prev;\n }\n\n // In checkboxes, mode must be enabled and have a transport mode in it\n if (\n (cur.type === \"CHECKBOX\" || cur.type === \"SUBMODE\") &&\n cur.addTransportMode &&\n cur.value\n ) {\n const newTransportModes = Array.isArray(cur.addTransportMode)\n ? cur.addTransportMode\n : [cur.addTransportMode];\n return [...prev, ...newTransportModes];\n }\n if (cur.type === \"DROPDOWN\") {\n const transportMode = cur.options.find(o => o.value === cur.value)\n ?.addTransportMode;\n if (transportMode) {\n return [...prev, transportMode];\n }\n }\n return prev;\n }, []);\n}\n\n/**\n * Generates every possible mathematical subset of the input TransportModes.\n * Uses code from:\n * https://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array\n * @param array Array of input transport modes\n * @returns 2D array representing every possible subset of transport modes from input\n */\nfunction combinations(array: TransportMode[]): TransportMode[][] {\n if (!array) return [];\n return (\n // eslint-disable-next-line no-bitwise\n new Array(1 << array.length)\n .fill(null)\n // eslint-disable-next-line no-bitwise\n .map((e1, i) => array.filter((e2, j) => i & (1 << j)))\n );\n}\n\n/**\n * This constant maps all the transport mode to a broader mode type,\n * which is used to determine the valid combinations of modes used in query generation.\n */\nexport const SIMPLIFICATIONS = {\n AIRPLANE: \"TRANSIT\",\n BICYCLE: \"PERSONAL\",\n BUS: \"TRANSIT\",\n CABLE_CAR: \"TRANSIT\",\n CAR: \"CAR\",\n FERRY: \"TRANSIT\",\n FLEX: \"SHARED\", // TODO: this allows FLEX+WALK. Is this reasonable?\n FUNICULAR: \"TRANSIT\",\n GONDOLA: \"TRANSIT\",\n RAIL: \"TRANSIT\",\n MONORAIL: \"TRANSIT\",\n SCOOTER: \"PERSONAL\",\n SUBWAY: \"TRANSIT\",\n TROLLEYBUS: \"TRANSIT\",\n TRAM: \"TRANSIT\",\n TRANSIT: \"TRANSIT\",\n WALK: \"WALK\"\n};\n\n// Inclusion of \"TRANSIT\" alone automatically implies \"WALK\" in OTP\nconst VALID_COMBOS = [\n [\"WALK\"],\n [\"PERSONAL\"],\n [\"TRANSIT\", \"SHARED\"],\n [\"WALK\", \"SHARED\"],\n [\"TRANSIT\"],\n [\"TRANSIT\", \"PERSONAL\"],\n [\"TRANSIT\", \"CAR\"]\n];\n\nconst BANNED_TOGETHER = [\"SCOOTER\", \"BICYCLE\", \"CAR\"];\n\nexport const TRANSIT_SUBMODES = Object.keys(SIMPLIFICATIONS).filter(\n mode => SIMPLIFICATIONS[mode] === \"TRANSIT\" && mode !== \"TRANSIT\"\n);\nexport const TRANSIT_SUBMODES_AND_TRANSIT = Object.keys(SIMPLIFICATIONS).filter(\n mode => SIMPLIFICATIONS[mode] === \"TRANSIT\"\n);\n\nfunction isCombinationValid(\n combo: TransportMode[],\n queryTransitSubmodes: string[]\n): boolean {\n if (combo.length === 0) return false;\n\n // All current qualifiers currently simplify to \"SHARED\"\n const simplifiedModes = Array.from(\n new Set(combo.map(c => (c.qualifier ? \"SHARED\" : SIMPLIFICATIONS[c.mode])))\n );\n\n // Ensure that if we have one transit mode, then we include ALL transit modes\n if (simplifiedModes.includes(\"TRANSIT\")) {\n // Don't allow TRANSIT along with any other submodes\n if (queryTransitSubmodes.length && combo.find(c => c.mode === \"TRANSIT\")) {\n return false;\n }\n\n if (\n combo.reduce((prev, cur) => {\n if (queryTransitSubmodes.includes(cur.mode)) {\n return prev - 1;\n }\n return prev;\n }, queryTransitSubmodes.length) !== 0\n ) {\n return false;\n }\n // Continue to the other checks\n }\n\n // OTP doesn't support multiple non-walk modes\n if (BANNED_TOGETHER.filter(m => combo.find(c => c.mode === m)).length > 1) {\n return false;\n }\n\n return !!VALID_COMBOS.find(\n vc =>\n simplifiedModes.every(m => vc.includes(m)) &&\n vc.every(m => simplifiedModes.includes(m))\n );\n}\n\n/**\n * Generates a list of queries for OTP to get a comprehensive\n * set of results based on the modes input.\n * @param params OTP Query Params\n * @returns Set of parameters to generate queries\n */\nexport function generateCombinations(params: OTPQueryParams): OTPQueryParams[] {\n const completeModeList = [\n ...extractAdditionalModes(params.modeSettings, params.modes),\n ...params.modes\n ];\n\n // List of the transit *submodes* that are included in the input params\n const queryTransitSubmodes = completeModeList\n .filter(mode => TRANSIT_SUBMODES.includes(mode.mode))\n .map(mode => mode.mode);\n\n return combinations(completeModeList)\n .filter(combo => isCombinationValid(combo, queryTransitSubmodes))\n .map(combo => ({ ...params, modes: combo }));\n}\n\n/**\n * Generates a query for OTP GraphQL API based on parameters.\n * @param param0 OTP2 Parameters for the query\n * @param planQuery Override the default query for OTP\n * @returns A fully formed query+variables ready to be sent to GraphQL backend\n */\nexport function generateOtp2Query(\n {\n arriveBy,\n banned,\n date,\n from,\n modes,\n modeSettings,\n numItineraries,\n preferred,\n time,\n to,\n unpreferred\n }: OTPQueryParams,\n planQuery = DefaultPlanQuery\n): GraphQLQuery {\n // This extracts the values from the mode settings to key value pairs\n const modeSettingValues = modeSettings.reduce((prev, cur) => {\n if (cur.type === \"SLIDER\" && cur.inverseKey) {\n prev[cur.inverseKey] = cur.high - cur.value + cur.low;\n }\n prev[cur.key] = cur.value;\n\n // If we assign a value on true, return the value (or null) instead of a boolean.\n if (cur.type === \"CHECKBOX\" && cur.truthValue) {\n prev[cur.key] =\n cur.value === true ? cur.truthValue : cur.falseValue ?? null;\n }\n return prev;\n }, {}) as ModeSettingValues;\n\n const {\n bikeReluctance,\n carReluctance,\n walkSpeed,\n walkReluctance,\n wheelchair\n } = modeSettingValues;\n\n return {\n query: print(planQuery),\n variables: {\n arriveBy,\n banned,\n bikeReluctance,\n carReluctance,\n date,\n fromPlace: `${from.name}::${from.lat},${from.lon}`,\n modes,\n numItineraries,\n preferred,\n time,\n toPlace: `${to.name}::${to.lat},${to.lon}`,\n unpreferred,\n walkReluctance,\n walkSpeed,\n wheelchair\n }\n };\n}\n"],"file":"query-gen.js"}