@opentripplanner/core-utils 8.2.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +144 -123
- package/src/query-gen.ts +36 -1
- package/tsconfig.tsbuildinfo +1 -1
package/src/planQuery.graphql
CHANGED
|
@@ -1,146 +1,167 @@
|
|
|
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
|
+
rentedBike
|
|
50
|
+
interlineWithPreviousLeg
|
|
51
|
+
departureDelay
|
|
52
|
+
arrivalDelay
|
|
53
|
+
distance
|
|
54
|
+
duration
|
|
55
|
+
endTime
|
|
56
|
+
mode
|
|
57
|
+
realTime
|
|
58
|
+
realtimeState
|
|
59
|
+
startTime
|
|
60
|
+
transitLeg
|
|
61
|
+
trip {
|
|
62
|
+
id
|
|
63
|
+
gtfsId
|
|
64
|
+
tripHeadsign
|
|
65
|
+
}
|
|
66
|
+
agency {
|
|
67
|
+
name
|
|
68
|
+
id
|
|
69
|
+
timezone
|
|
70
|
+
url
|
|
71
|
+
alerts {
|
|
60
72
|
alertHeaderText
|
|
61
73
|
alertDescriptionText
|
|
62
74
|
alertUrl
|
|
63
75
|
effectiveStartDate
|
|
64
76
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
}
|
|
78
|
+
legGeometry {
|
|
79
|
+
length
|
|
80
|
+
points
|
|
81
|
+
}
|
|
82
|
+
intermediateStops {
|
|
83
|
+
lat
|
|
84
|
+
lon
|
|
85
|
+
name
|
|
86
|
+
stopCode: code
|
|
87
|
+
stopId: id
|
|
88
|
+
locationType
|
|
89
|
+
}
|
|
90
|
+
route {
|
|
91
|
+
shortName
|
|
92
|
+
longName
|
|
93
|
+
color
|
|
94
|
+
textColor
|
|
95
|
+
id
|
|
96
|
+
type
|
|
97
|
+
alerts {
|
|
85
98
|
alertHeaderText
|
|
86
99
|
alertDescriptionText
|
|
87
100
|
alertUrl
|
|
88
101
|
effectiveStartDate
|
|
89
102
|
}
|
|
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
|
-
|
|
103
|
+
}
|
|
104
|
+
from {
|
|
105
|
+
lat
|
|
106
|
+
lon
|
|
107
|
+
name
|
|
108
|
+
vertexType
|
|
109
|
+
rentalVehicle {
|
|
110
|
+
network
|
|
111
|
+
}
|
|
112
|
+
stop {
|
|
113
|
+
id
|
|
114
|
+
code
|
|
115
|
+
gtfsId
|
|
116
|
+
alerts {
|
|
117
|
+
alertHeaderText
|
|
118
|
+
alertDescriptionText
|
|
119
|
+
alertUrl
|
|
120
|
+
effectiveStartDate
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
to {
|
|
125
|
+
lat
|
|
126
|
+
lon
|
|
127
|
+
name
|
|
128
|
+
vertexType
|
|
129
|
+
rentalVehicle {
|
|
130
|
+
network
|
|
131
|
+
}
|
|
132
|
+
stop {
|
|
133
|
+
id
|
|
134
|
+
code
|
|
135
|
+
gtfsId
|
|
136
|
+
alerts {
|
|
137
|
+
alertHeaderText
|
|
138
|
+
alertDescriptionText
|
|
139
|
+
alertUrl
|
|
140
|
+
effectiveStartDate
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
steps {
|
|
145
|
+
distance
|
|
146
|
+
lat
|
|
147
|
+
lon
|
|
127
148
|
relativeDirection
|
|
128
149
|
absoluteDirection
|
|
129
150
|
stayOn
|
|
130
151
|
streetName
|
|
131
152
|
area
|
|
132
|
-
alerts{
|
|
153
|
+
alerts {
|
|
133
154
|
alertHeaderText
|
|
134
155
|
alertDescriptionText
|
|
135
156
|
alertUrl
|
|
136
157
|
effectiveStartDate
|
|
137
158
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
159
|
+
elevationProfile {
|
|
160
|
+
distance
|
|
161
|
+
elevation
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
146
167
|
}
|
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
|