@opentripplanner/core-utils 11.2.2 → 11.2.3-mobility-profile

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.
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const query_1 = require("../query");
27
+ const query_params_1 = __importStar(require("../query-params"));
28
+ const query_gen_1 = require("../query-gen");
29
+ const customWalkDistanceOptions = [
30
+ {
31
+ text: "200 m",
32
+ value: 200
33
+ },
34
+ {
35
+ text: "500 m",
36
+ value: 500
37
+ }
38
+ ];
39
+ function modeStrToTransportMode(m) {
40
+ const splitVals = m.split("_");
41
+ return {
42
+ mode: splitVals[0],
43
+ qualifier: (splitVals === null || splitVals === void 0 ? void 0 : splitVals[1]) || null
44
+ };
45
+ }
46
+ const mockLatLon = {
47
+ lat: 1,
48
+ lon: 2
49
+ };
50
+ function expectModes(modes, expectedModes) {
51
+ const generatedModesList = (0, query_gen_1.generateCombinations)({
52
+ modes: modes.map(modeStrToTransportMode),
53
+ to: mockLatLon,
54
+ from: mockLatLon,
55
+ modeSettings: []
56
+ });
57
+ const expandedExpectedModesList = expectedModes.map(em => ({
58
+ modes: em.map(modeStrToTransportMode),
59
+ to: mockLatLon,
60
+ from: mockLatLon,
61
+ modeSettings: []
62
+ }));
63
+ return it(modes.join(" "), () => expect(generatedModesList.length === expandedExpectedModesList.length) &&
64
+ expect(new Set(generatedModesList)).toEqual(new Set(expandedExpectedModesList)));
65
+ }
66
+ describe("extract-modes", () => {
67
+ const mode = {
68
+ mode: "UNICYCLE"
69
+ };
70
+ const testTransportMode = {
71
+ mode: "testMode"
72
+ };
73
+ const checkboxModeSetting = {
74
+ type: "CHECKBOX",
75
+ icon: null,
76
+ label: "test",
77
+ applicableMode: testTransportMode.mode,
78
+ key: "test",
79
+ value: true,
80
+ addTransportMode: mode
81
+ };
82
+ const dropdownModeSetting = {
83
+ type: "DROPDOWN",
84
+ label: "test",
85
+ applicableMode: testTransportMode.mode,
86
+ key: "test",
87
+ options: [{ text: "testop", value: "1", addTransportMode: mode }],
88
+ value: "1"
89
+ };
90
+ it("a checkbox setting", () => {
91
+ expect((0, query_gen_1.extractAdditionalModes)([checkboxModeSetting], [testTransportMode])).toEqual([mode]);
92
+ });
93
+ it("a dropdown setting", () => {
94
+ expect((0, query_gen_1.extractAdditionalModes)([dropdownModeSetting], [testTransportMode])).toEqual([mode]);
95
+ });
96
+ it("a disabled mode setting", () => {
97
+ expect((0, query_gen_1.extractAdditionalModes)([{ ...checkboxModeSetting, value: false }], [testTransportMode])).toEqual([]);
98
+ });
99
+ it("a setting from a disabled mode", () => {
100
+ expect((0, query_gen_1.extractAdditionalModes)([{ ...checkboxModeSetting }], [])).toEqual([]);
101
+ });
102
+ });
103
+ describe("query-gen", () => {
104
+ describe("generateCombinations", () => {
105
+ expectModes(["WALK"], [["WALK"]]);
106
+ expectModes(["WALK", "TRANSIT"], [["WALK"], ["TRANSIT"]]);
107
+ expectModes(["WALK", "TRANSIT", "BICYCLE"], [["WALK"], ["TRANSIT"], ["BICYCLE"], ["TRANSIT", "BICYCLE"]]);
108
+ expectModes(["WALK", "TRANSIT", "CAR"], [["WALK"], ["TRANSIT"], ["TRANSIT", "CAR"]]);
109
+ expectModes(["TRANSIT", "CAR"], [["TRANSIT"], ["TRANSIT", "CAR"]]);
110
+ expectModes(["CAR"], []);
111
+ expectModes(["WALK", "TRANSIT", "BICYCLE", "CAR"], [
112
+ ["WALK"],
113
+ ["TRANSIT"],
114
+ ["TRANSIT", "BICYCLE"],
115
+ ["BICYCLE"],
116
+ ["TRANSIT", "CAR"]
117
+ ]);
118
+ expectModes(["BICYCLE_RENT", "TRANSIT", "WALK"], [
119
+ ["TRANSIT"],
120
+ ["BICYCLE_RENT", "TRANSIT"],
121
+ ["BICYCLE_RENT", "WALK"],
122
+ ["WALK"]
123
+ ]);
124
+ expectModes(["BICYCLE_RENT", "BICYCLE", "TRANSIT", "WALK"], [
125
+ ["TRANSIT"],
126
+ ["BICYCLE_RENT", "TRANSIT"],
127
+ ["BICYCLE", "TRANSIT"],
128
+ ["BICYCLE_RENT", "WALK"],
129
+ ["BICYCLE"],
130
+ ["WALK"]
131
+ ]);
132
+ expectModes(["SCOOTER_RENT", "BICYCLE_RENT", "TRANSIT", "WALK"], [
133
+ ["TRANSIT"],
134
+ ["BICYCLE_RENT", "TRANSIT"],
135
+ ["BICYCLE_RENT", "WALK"],
136
+ ["SCOOTER_RENT", "TRANSIT"],
137
+ ["SCOOTER_RENT", "WALK"],
138
+ ["WALK"]
139
+ ]);
140
+ expectModes(["FLEX", "TRANSIT", "WALK"], [["TRANSIT"], ["FLEX", "TRANSIT"], ["FLEX", "WALK"], ["WALK"]]);
141
+ expectModes(["FLEX", "SCOOTER_RENT", "TRANSIT", "WALK"], [
142
+ ["TRANSIT"],
143
+ ["FLEX", "TRANSIT"],
144
+ ["WALK"],
145
+ ["FLEX", "WALK"],
146
+ ["FLEX", "SCOOTER_RENT", "WALK"],
147
+ ["FLEX", "SCOOTER_RENT", "TRANSIT"],
148
+ ["SCOOTER_RENT", "WALK"],
149
+ ["SCOOTER_RENT", "TRANSIT"]
150
+ ]);
151
+ expectModes(["FLEX", "SCOOTER_RENT", "TRANSIT"], [
152
+ ["TRANSIT"],
153
+ ["FLEX", "TRANSIT"],
154
+ ["FLEX", "SCOOTER_RENT", "TRANSIT"],
155
+ ["SCOOTER_RENT", "TRANSIT"]
156
+ ]);
157
+ expectModes(
158
+ // Transit is required to enable other transit submodes
159
+ ["BUS", "RAIL", "GONDOLA", "TRAM", "TRANSIT"], [["BUS", "RAIL", "GONDOLA", "TRAM"]]);
160
+ expectModes(
161
+ // Transit is required to enable other transit submodes
162
+ ["TRANSIT"], [["TRANSIT"]]);
163
+ });
164
+ });
165
+ describe("query-params", () => {
166
+ describe("getCustomQueryParams", () => {
167
+ it("should return the original unmodified queryParams if no customizations", () => {
168
+ expect((0, query_params_1.getCustomQueryParams)()).toEqual(query_params_1.default);
169
+ });
170
+ it("should return queryParams with customizations", () => {
171
+ const customizations = {
172
+ maxWalkDistance: {
173
+ label: "Max Walk Distance In Meters",
174
+ options: customWalkDistanceOptions
175
+ }
176
+ };
177
+ expect((0, query_params_1.getCustomQueryParams)(customizations)).toMatchSnapshot();
178
+ });
179
+ it("should ignore unknown query params", () => {
180
+ const customizations = {
181
+ unknownQueryParameter: {
182
+ label: "Unknown query parameter",
183
+ options: customWalkDistanceOptions
184
+ }
185
+ };
186
+ expect((0, query_params_1.getCustomQueryParams)(customizations)).toEqual(query_params_1.default);
187
+ });
188
+ });
189
+ });
190
+ describe("flex-reducer", () => {
191
+ it("should not touch a query that doesn't include flex modes", () => {
192
+ expect((0, query_1.reduceOtpFlexModes)(["WALK", "TRANSIT", "BIKE"])).toStrictEqual([
193
+ "WALK",
194
+ "TRANSIT",
195
+ "BIKE"
196
+ ]);
197
+ });
198
+ it("should modify a query that includes some flex modes", () => {
199
+ expect((0, query_1.reduceOtpFlexModes)(["WALK", "TRANSIT", "BIKE", "FLEX_DIRECT"])).toStrictEqual(["WALK", "TRANSIT", "BIKE", "FLEX"]);
200
+ });
201
+ it("should modify a query that includes all flex modes", () => {
202
+ expect((0, query_1.reduceOtpFlexModes)([
203
+ "WALK",
204
+ "TRANSIT",
205
+ "BIKE",
206
+ "FLEX_DIRECT",
207
+ "FLEX_ACCESS",
208
+ "FLEX_EGRESS"
209
+ ])).toStrictEqual(["WALK", "TRANSIT", "BIKE", "FLEX"]);
210
+ expect((0, query_1.reduceOtpFlexModes)([
211
+ "FLEX_DIRECT",
212
+ "BIKE",
213
+ "FLEX_ACCESS",
214
+ "WALK",
215
+ "FLEX_EGRESS",
216
+ "TRANSIT"
217
+ ])).toStrictEqual(["FLEX", "BIKE", "WALK", "TRANSIT"]);
218
+ });
219
+ it("should modify a query that includes only flex modes", () => {
220
+ expect((0, query_1.reduceOtpFlexModes)(["FLEX_DIRECT", "FLEX_ACCESS", "FLEX_EGRESS"])).toStrictEqual(["FLEX"]);
221
+ });
222
+ it("should modify a query that includes duplicate flex modes", () => {
223
+ expect((0, query_1.reduceOtpFlexModes)([
224
+ "FLEX_DIRECT",
225
+ "FLEX_DIRECT",
226
+ "FLEX_ACCESS",
227
+ "FLEX_EGRESS"
228
+ ])).toStrictEqual(["FLEX"]);
229
+ });
230
+ });
231
+ //# sourceMappingURL=query-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-params.js","sourceRoot":"","sources":["../../src/__tests__/query-params.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oCAA8C;AAC9C,gEAAoE;AACpE,4CAA4E;AAE5E,MAAM,yBAAyB,GAAG;IAChC;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,GAAG;KACX;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,GAAG;KACX;CACF,CAAC;AAEF,SAAS,sBAAsB,CAAC,CAAC;IAC/B,MAA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AAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,CACJ,IAAA,0BAAkB,EAAC,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAClE,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,CACJ,IAAA,0BAAkB,EAAC;YACjB,aAAa;YACb,aAAa;YACb,aAAa;YACb,aAAa;SACd,CAAC,CACH,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -18,6 +18,7 @@ declare type OTPQueryParams = {
18
18
  from: LonLatOutput & {
19
19
  name?: string;
20
20
  };
21
+ mobilityProfile?: string;
21
22
  modes: TransportMode[];
22
23
  modeSettings: ModeSetting[];
23
24
  time?: string;
@@ -77,6 +78,6 @@ export declare function generateCombinations(params: OTPQueryParams): OTPQueryPa
77
78
  * @param planQuery Override the default query for OTP
78
79
  * @returns A fully formed query+variables ready to be sent to GraphQL backend
79
80
  */
80
- export declare function generateOtp2Query({ arriveBy, banned, date, from, modes, modeSettings, numItineraries, preferred, time, to }: OTPQueryParams, planQuery?: import("graphql").DocumentNode): GraphQLQuery;
81
+ export declare function generateOtp2Query({ arriveBy, banned, date, from, mobilityProfile, modes, modeSettings, numItineraries, preferred, time, to }: OTPQueryParams, planQuery?: import("graphql").DocumentNode): GraphQLQuery;
81
82
  export {};
82
83
  //# sourceMappingURL=query-gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-gen.d.ts","sourceRoot":"","sources":["../src/query-gen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,WAAW,EAEX,aAAa,EACd,MAAM,w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xB,EAAE,EAAE,YAAY,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B,CAAC;AAEF,aAAK,YAAY,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,WAAW,EAAE,EAC3B,YAAY,EAAE,aAAa,EAAE,GAC5B,aAAa,EAAE,CA2BjB;AAoBD;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiB3B,CAAC;AAeF,eAAO,MAAM,gBAAgB,UAE5B,CAAC;AACF,eAAO,MAAM,4BAA4B,UAExC,CAAC;AA6CF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,EAAE,CAc7E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,EACE,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,eAAe,EACf,KAAK,EACL,YAAY,EACZ,cAAc,EACd,SAAS,EACT,IAAI,EACJ,EAAE,EACH,EAAE,cAAc,EACjB,SAAS,iCAAmB,GAC3B,YAAY,CA4Cd"}
package/lib/query-gen.js CHANGED
@@ -10,7 +10,7 @@ exports.TRANSIT_SUBMODES_AND_TRANSIT = exports.TRANSIT_SUBMODES = exports.SIMPLI
10
10
 
11
11
  var _graphql = require("graphql");
12
12
 
13
- 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 } } } };
13
+ 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: "mobilityProfile" } }, 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: "mobilityProfile" }, value: { kind: "Variable", name: { kind: "Name", value: "mobilityProfile" } } }, { 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: "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: "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: 4951, source: { body: "query Plan(\n $arriveBy: Boolean\n $banned: InputBanned\n $bikeReluctance: Float\n $carReluctance: Float\n $date: String\n $fromPlace: String!\n $mobilityProfile: 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 mobilityProfile: $mobilityProfile\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 }\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 }\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 } } } };
14
14
 
15
15
  /**
16
16
  * Mode Settings can contain additional modes to add to the query,
@@ -154,6 +154,7 @@ function generateOtp2Query({
154
154
  banned,
155
155
  date,
156
156
  from,
157
+ mobilityProfile,
157
158
  modes,
158
159
  modeSettings,
159
160
  numItineraries,
@@ -193,6 +194,7 @@ function generateOtp2Query({
193
194
  carReluctance,
194
195
  date,
195
196
  fromPlace: `${from.name}::${from.lat},${from.lon}}`,
197
+ mobilityProfile,
196
198
  modes,
197
199
  numItineraries,
198
200
  preferred,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/query-gen.ts"],"names":["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","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;;;;AAyCA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,YADK,EAELC,YAFK,EAGY;AACjB,SAAOD,YAAY,CAACE,MAAb,CAAqC,CAACC,IAAD,EAAOC,GAAP,KAAe;AACzD;AACA,QAAI,CAACH,YAAY,CAACI,GAAb,CAAiBC,CAAC,IAAIA,CAAC,CAACC,IAAxB,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,KACA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D;AACD;;AACD5E,IAAAA,IAAI,CAACC,GAAG,CAAC4E,GAAL,CAAJ,GAAgB5E,GAAG,CAACQ,KAApB,CAJ2D,CAM3D;;AACA,QAAIR,GAAG,CAACM,IAAJ,KAAa,UAAb,IAA2BN,GAAG,CAAC6E,UAAnC,EAA+C;AAAA;;AAC7C9E,MAAAA,IAAI,CAACC,GAAG,CAAC4E,GAAL,CAAJ,GACE5E,GAAG,CAACQ,KAAJ,KAAc,IAAd,GAAqBR,GAAG,CAAC6E,UAAzB,sBAAsC7E,GAAG,CAAC8E,UAA1C,6DAAwD,IAD1D;AAED;;AACD,WAAO/E,IAAP;AACD,GAZyB,EAYvB,EAZuB,CAA1B;AAcA,QAAM;AACJgF,IAAAA,cADI;AAEJC,IAAAA,aAFI;AAGJC,IAAAA,SAHI;AAIJC,IAAAA,cAJI;AAKJC,IAAAA;AALI,MAMFX,iBANJ;AAQA,SAAO;AACLY,IAAAA,KAAK,EAAE,oBAAMd,SAAN,CADF;AAELe,IAAAA,SAAS,EAAE;AACTtB,MAAAA,QADS;AAETC,MAAAA,MAFS;AAGTe,MAAAA,cAHS;AAITC,MAAAA,aAJS;AAKTf,MAAAA,IALS;AAMTqB,MAAAA,SAAS,EAAG,GAAElC,IAAI,CAACmC,IAAK,KAAInC,IAAI,CAACoC,GAAI,IAAGpC,IAAI,CAACqC,GAAI,GANxC;AAOT5B,MAAAA,KAPS;AAQTK,MAAAA,cARS;AASTC,MAAAA,SATS;AAUTC,MAAAA,IAVS;AAWTsB,MAAAA,OAAO,EAAG,GAAErB,EAAE,CAACkB,IAAK,KAAIlB,EAAE,CAACmB,GAAI,IAAGnB,EAAE,CAACoB,GAAI,GAXhC;AAYTP,MAAAA,cAZS;AAaTD,MAAAA,SAbS;AAcTE,MAAAA;AAdS;AAFN,GAAP;AAmBD","sourcesContent":["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};\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 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":["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","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","mobilityProfile","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;;;;AA0CA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,Y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I,GANxC;AAOTxB,MAAAA,eAPS;AAQTL,MAAAA,KARS;AASTM,MAAAA,cATS;AAUTC,MAAAA,SAVS;AAWTC,MAAAA,IAXS;AAYTsB,MAAAA,OAAO,EAAG,GAAErB,EAAE,CAACkB,IAAK,KAAIlB,EAAE,CAACmB,GAAI,IAAGnB,EAAE,CAACoB,GAAI,GAZhC;AAaTP,MAAAA,cAbS;AAcTD,MAAAA,SAdS;AAeTE,MAAAA;AAfS;AAFN,GAAP;AAoBD","sourcesContent":["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 mobilityProfile?: 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, 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 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 mobilityProfile,\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 mobilityProfile,\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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentripplanner/core-utils",
3
- "version": "11.2.2",
3
+ "version": "11.2.3-mobility-profile",
4
4
  "description": "Core functionality that is shared among numerous UI components",
5
5
  "engines": {
6
6
  "node": ">=13"
package/src/itinerary.ts CHANGED
@@ -410,10 +410,10 @@ export function getCompanyForNetwork(
410
410
  * @return {string} A label for use in presentation on a website.
411
411
  */
412
412
  export function getCompaniesLabelFromNetworks(
413
- networks: string[],
413
+ networks: string[] | string,
414
414
  companies: Company[] = []
415
415
  ): string {
416
- return networks
416
+ return (Array.isArray(networks) ? networks : [networks])
417
417
  .map(network => getCompanyForNetwork(network, companies))
418
418
  .filter(co => !!co)
419
419
  .map(co => co.label)
@@ -7662,6 +7662,16 @@
7662
7662
  "ofType": null
7663
7663
  },
7664
7664
  "defaultValue": null
7665
+ },
7666
+ {
7667
+ "name": "mobilityProfile",
7668
+ "description": "Preferences for routing based on mobility profile",
7669
+ "type": {
7670
+ "kind": "SCALAR",
7671
+ "name": "String",
7672
+ "ofType": null
7673
+ },
7674
+ "defaultValue": null
7665
7675
  }
7666
7676
  ],
7667
7677
  "type": {
@@ -5,6 +5,7 @@ query Plan(
5
5
  $carReluctance: Float
6
6
  $date: String
7
7
  $fromPlace: String!
8
+ $mobilityProfile: String
8
9
  $modes: [TransportMode]
9
10
  $numItineraries: Int
10
11
  $preferred: InputPreferred
@@ -24,6 +25,7 @@ query Plan(
24
25
  fromPlace: $fromPlace
25
26
  # Currently only supporting EN locale, used for times and text
26
27
  locale: "en"
28
+ mobilityProfile: $mobilityProfile
27
29
  numItineraries: $numItineraries
28
30
  preferred: $preferred
29
31
  time: $time
package/src/query-gen.ts CHANGED
@@ -26,6 +26,7 @@ type OTPQueryParams = {
26
26
  arriveBy: boolean;
27
27
  date?: string;
28
28
  from: LonLatOutput & { name?: string };
29
+ mobilityProfile?: string;
29
30
  modes: TransportMode[];
30
31
  modeSettings: ModeSetting[];
31
32
  time?: string;
@@ -217,6 +218,7 @@ export function generateOtp2Query(
217
218
  banned,
218
219
  date,
219
220
  from,
221
+ mobilityProfile,
220
222
  modes,
221
223
  modeSettings,
222
224
  numItineraries,
@@ -258,6 +260,7 @@ export function generateOtp2Query(
258
260
  carReluctance,
259
261
  date,
260
262
  fromPlace: `${from.name}::${from.lat},${from.lon}}`,
263
+ mobilityProfile,
261
264
  modes,
262
265
  numItineraries,
263
266
  preferred,