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