@opentripplanner/core-utils 15.0.0 → 16.0.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/index.js +3 -0
- package/esm/index.js.map +1 -1
- package/esm/itinerary.js +104 -78
- package/esm/itinerary.js.map +1 -1
- package/esm/map.js +2 -2
- package/esm/map.js.map +1 -1
- package/esm/query-gen.js +9 -5
- package/esm/query-gen.js.map +1 -1
- package/esm/route.js +26 -20
- package/esm/route.js.map +1 -1
- package/esm/storage.js +4 -1
- package/esm/storage.js.map +1 -1
- package/esm/time.js +6 -5
- package/esm/time.js.map +1 -1
- package/esm/ui.js +4 -2
- package/esm/ui.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib/itinerary.d.ts +20 -11
- package/lib/itinerary.d.ts.map +1 -1
- package/lib/itinerary.js +96 -85
- package/lib/itinerary.js.map +1 -1
- package/lib/map.d.ts +2 -2
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +1 -1
- package/lib/map.js.map +1 -1
- package/lib/query-gen.d.ts +1 -19
- package/lib/query-gen.d.ts.map +1 -1
- package/lib/query-gen.js +9 -5
- package/lib/query-gen.js.map +1 -1
- package/lib/route.d.ts +10 -8
- package/lib/route.d.ts.map +1 -1
- package/lib/route.js +22 -16
- package/lib/route.js.map +1 -1
- package/lib/storage.d.ts +1 -1
- package/lib/storage.d.ts.map +1 -1
- package/lib/storage.js +4 -1
- package/lib/storage.js.map +1 -1
- package/lib/time.d.ts +3 -1
- package/lib/time.d.ts.map +1 -1
- package/lib/time.js +5 -4
- package/lib/time.js.map +1 -1
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +4 -2
- package/lib/ui.js.map +1 -1
- package/package.json +9 -7
- package/src/__tests__/itinerary.ts +64 -6
- package/src/index.ts +3 -0
- package/src/itinerary.ts +145 -97
- package/src/map.ts +5 -3
- package/src/query-gen.ts +15 -9
- package/src/route.ts +65 -38
- package/src/storage.ts +8 -2
- package/src/time.ts +7 -6
- package/src/ui.ts +8 -6
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/lib/map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","names":["currentPositionToLocation","currentPosition","error","coords","console","warn","lat","latitude","lon","longitude","category","coordsToString","length","map","c","toFixed","join","stringToCoords","str","split","constructLocation","latlng","lng","matchLatLon","location1","location2","isBikeshareStation","place","place_id","lastIndexOf","isEScooterStation","isCarWalkTransition","isValidLat","Number","isFinite","isValidLng","isValidLatLng","arr","Array","isArray"],"sources":["../src/map.ts"],"sourcesContent":["import { LatLngArray, Location, UserPosition } from \"@opentripplanner/types\";\n\nexport function currentPositionToLocation(\n currentPosition: UserPosition\n): Location {\n if (currentPosition.error || !currentPosition.coords) {\n console.warn(\n \"Cannot construct location from current position due to geolocation error or missing coordinates.\"\n );\n return null;\n }\n return {\n lat: currentPosition.coords.latitude,\n lon: currentPosition.coords.longitude,\n category: \"CURRENT_LOCATION\"\n };\n}\n\n// TRICKY: This method is used in query.js and in the context of\n// otp-rr actions where the intl context is not available/does not apply.\nexport function coordsToString(coords: number[]): string {\n return coords.length
|
|
1
|
+
{"version":3,"file":"map.js","names":["currentPositionToLocation","currentPosition","error","coords","console","warn","lat","latitude","lon","longitude","category","coordsToString","length","map","c","toFixed","join","undefined","stringToCoords","str","split","constructLocation","latlng","lng","matchLatLon","location1","location2","isBikeshareStation","place","place_id","lastIndexOf","isEScooterStation","isCarWalkTransition","isValidLat","Number","isFinite","isValidLng","isValidLatLng","arr","Array","isArray"],"sources":["../src/map.ts"],"sourcesContent":["import { LatLngArray, Location, UserPosition } from \"@opentripplanner/types\";\n\nexport function currentPositionToLocation(\n currentPosition: UserPosition\n): Location | null {\n if (currentPosition.error || !currentPosition.coords) {\n console.warn(\n \"Cannot construct location from current position due to geolocation error or missing coordinates.\"\n );\n return null;\n }\n return {\n lat: currentPosition.coords.latitude,\n lon: currentPosition.coords.longitude,\n category: \"CURRENT_LOCATION\"\n };\n}\n\n// TRICKY: This method is used in query.js and in the context of\n// otp-rr actions where the intl context is not available/does not apply.\nexport function coordsToString(coords: number[]): string | undefined {\n return coords.length > 0\n ? coords.map(c => (+c).toFixed(5)).join(\", \")\n : undefined;\n}\n\nexport function stringToCoords(str: string): number[] {\n return (str && str.split(\",\").map(c => +c)) || [];\n}\n\nexport function constructLocation(latlng: {\n lat: number;\n lng: number;\n}): Location {\n return {\n lat: latlng.lat,\n lon: latlng.lng\n };\n}\n\nexport function matchLatLon(location1: Location, location2: Location): boolean {\n if (!location1 || !location2) return location1 === location2;\n return location1.lat === location2.lat && location1.lon === location2.lon;\n}\n\ntype TransitivePlaceRaw = {\n place_id: string;\n};\nexport function isBikeshareStation(place: TransitivePlaceRaw): boolean {\n return place.place_id.lastIndexOf(\"bicycle_rent_station\") !== -1;\n}\n\nexport function isEScooterStation(place: TransitivePlaceRaw): boolean {\n return place.place_id.lastIndexOf(\"escooter_rent_station\") !== -1;\n}\n\nexport function isCarWalkTransition(place: TransitivePlaceRaw): boolean {\n return place.place_id.lastIndexOf(\"itin_car_\") !== -1;\n}\n\nexport function isValidLat(lat: number): boolean {\n return Number.isFinite(lat) && lat >= -90 && lat <= 90;\n}\n\nexport function isValidLng(lng: number): boolean {\n return Number.isFinite(lng) && lng >= -180 && lng <= 180;\n}\n\nexport function isValidLatLng(arr: LatLngArray): boolean {\n return (\n Array.isArray(arr) &&\n arr.length === 2 &&\n isValidLat(arr[0]) &&\n isValidLng(arr[1])\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEO,SAASA,yBAAyBA,CACvCC,eAA6B,EACZ;EACjB,IAAIA,eAAe,CAACC,KAAK,IAAI,CAACD,eAAe,CAACE,MAAM,EAAE;IACpDC,OAAO,CAACC,IAAI,CACV,kGACF,CAAC;IACD,OAAO,IAAI;EACb;EACA,OAAO;IACLC,GAAG,EAAEL,eAAe,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K,CAACC,QAAQ,CAACC,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACvD;AAEO,SAASG,UAAUA,CAAC3B,GAAW,EAAW;EAC/C,OAAO4B,MAAM,CAACC,QAAQ,CAAC7B,GAAG,CAAC,IAAIA,GAAG,IAAI,CAAC,EAAE,IAAIA,GAAG,IAAI,EAAE;AACxD;AAEO,SAAS8B,UAAUA,CAACb,GAAW,EAAW;EAC/C,OAAOW,MAAM,CAACC,QAAQ,CAACZ,GAAG,CAAC,IAAIA,GAAG,IAAI,CAAC,GAAG,IAAIA,GAAG,IAAI,GAAG;AAC1D;AAEO,SAASc,aAAaA,CAACC,GAAgB,EAAW;EACvD,OACEC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,IAClBA,GAAG,CAAC1B,MAAM,KAAK,CAAC,IAChBqB,UAAU,CAACK,GAAG,CAAC,CAAC,CAAC,CAAC,IAClBF,UAAU,CAACE,GAAG,CAAC,CAAC,CAAC,CAAC;AAEtB","ignoreList":[]}
|
package/lib/query-gen.d.ts
CHANGED
|
@@ -45,25 +45,7 @@ export declare function extractAdditionalModes(modeSettings: ModeSetting[], enab
|
|
|
45
45
|
* This constant maps all the transport mode to a broader mode type,
|
|
46
46
|
* which is used to determine the valid combinations of modes used in query generation.
|
|
47
47
|
*/
|
|
48
|
-
export declare const SIMPLIFICATIONS:
|
|
49
|
-
AIRPLANE: string;
|
|
50
|
-
BICYCLE: string;
|
|
51
|
-
BUS: string;
|
|
52
|
-
CABLE_CAR: string;
|
|
53
|
-
CAR: string;
|
|
54
|
-
FERRY: string;
|
|
55
|
-
FLEX: string;
|
|
56
|
-
FUNICULAR: string;
|
|
57
|
-
GONDOLA: string;
|
|
58
|
-
RAIL: string;
|
|
59
|
-
MONORAIL: string;
|
|
60
|
-
SCOOTER: string;
|
|
61
|
-
SUBWAY: string;
|
|
62
|
-
TROLLEYBUS: string;
|
|
63
|
-
TRAM: string;
|
|
64
|
-
TRANSIT: string;
|
|
65
|
-
WALK: string;
|
|
66
|
-
};
|
|
48
|
+
export declare const SIMPLIFICATIONS: Record<string, string>;
|
|
67
49
|
export declare const TRANSIT_SUBMODES: string[];
|
|
68
50
|
export declare const TRANSIT_SUBMODES_AND_TRANSIT: string[];
|
|
69
51
|
/**
|
package/lib/query-gen.d.ts.map
CHANGED
|
@@ -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,wBAAwB,CAAC;AAIhC,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,YAAY,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc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AE,YAAY,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B,CAAC;AAEF,KAAK,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,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAkBlD,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,cAAc,EAAE,cAAc,EAC9B,SAAS,iCAAmB,GAC3B,YAAY,CA6Cd"}
|
package/lib/query-gen.js
CHANGED
|
@@ -149,17 +149,21 @@ function generateOtp2Query(otpQueryParams, planQuery = DefaultPlanQuery) {
|
|
|
149
149
|
|
|
150
150
|
// This extracts the values from the mode settings to key value pairs
|
|
151
151
|
const modeSettingValues = modeSettings.reduce((prev, cur) => {
|
|
152
|
-
if (cur.type === "SLIDER" && cur.inverseKey) {
|
|
152
|
+
if (cur.type === "SLIDER" && cur.inverseKey && cur.value) {
|
|
153
153
|
prev[cur.inverseKey] = cur.high - cur.value + cur.low;
|
|
154
|
+
} else if (cur.value) {
|
|
155
|
+
prev[cur.key] = cur.value;
|
|
154
156
|
}
|
|
155
|
-
prev[cur.key] = cur.value;
|
|
156
157
|
|
|
157
158
|
// If we assign a value on true, return the value (or null) instead of a boolean.
|
|
158
|
-
if (cur.type === "CHECKBOX" && cur.truthValue) {
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
if (cur.type === "CHECKBOX" && cur.truthValue && cur.falseValue) {
|
|
160
|
+
const newVal = cur.value === true ? cur.truthValue : cur.falseValue;
|
|
161
|
+
if (newVal) {
|
|
162
|
+
prev[cur.key] = newVal;
|
|
163
|
+
}
|
|
161
164
|
}
|
|
162
165
|
return prev;
|
|
166
|
+
// eslint-disable-next-line prettier/prettier -- old eslint doesn't know satisfies
|
|
163
167
|
}, {});
|
|
164
168
|
const {
|
|
165
169
|
bikeReluctance,
|
package/lib/query-gen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-gen.js","names":["_graphql","require","DefaultPlanQuery","kind","definitions","operation","name","value","variableDefinitions","variable","type","directives","selectionSet","selections","arguments","block","alias","typeCondition","loc","start","end","source","body","locationOffset","line","column","extractAdditionalModes","modeSettings","enabledModes","reduce","prev","cur","map","m","mode","includes","applicableMode","addTransportMode","newTransportModes","Array","isArray","_cur$options$find","transportMode","options","find","o","combinations","array","length","fill","e1","i","filter","e2","j","SIMPLIFICATIONS","exports","AIRPLANE","BICYCLE","BUS","CABLE_CAR","CAR","FERRY","FLEX","FUNICULAR","GONDOLA","RAIL","MONORAIL","SCOOTER","SUBWAY","TROLLEYBUS","TRAM","TRANSIT","WALK","VALID_COMBOS","BANNED_TOGETHER","TRANSIT_SUBMODES","Object","keys","TRANSIT_SUBMODES_AND_TRANSIT","isCombinationValid","combo","queryTransitSubmodes","simplifiedModes","from","Set","c","qualifier","vc","every","generateCombinations","params","completeModeList","modes","generateOtp2Query","otpQueryParams","planQuery","to","otherOtpQueryParams","modeSettingValues","inverseKey","high","low","key","truthValue","_cur$falseValue","falseValue","bikeReluctance","carReluctance","walkReluctance","walkSpeed","wheelchair","query","print","variables","fromPlace","lat","lon","toPlace"],"sources":["../src/query-gen.ts"],"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 unpreferred?: InputPreferred;\n};\n\ntype GraphQLQuery = {\n query: string;\n variables: Record<string, unknown>;\n};\n\n/**\n * Mode Settings can contain additional modes to add to the query,\n * this function extracts those additional modes from the settings\n * and returns them in an array.\n * @param modeSettings List of mode settings with values populated\n * @returns Additional transport modes to add to query\n */\nexport function extractAdditionalModes(\n modeSettings: ModeSetting[],\n enabledModes: TransportMode[]\n): TransportMode[] {\n return modeSettings.reduce<TransportMode[]>((prev, cur) => {\n // First, ensure that the mode associated with this setting is even enabled\n if (!enabledModes.map(m => m.mode).includes(cur.applicableMode)) {\n return prev;\n }\n\n // In checkboxes, mode must be enabled and have a transport mode in it\n if (\n (cur.type === \"CHECKBOX\" || cur.type === \"SUBMODE\") &&\n cur.addTransportMode &&\n cur.value\n ) {\n const newTransportModes = Array.isArray(cur.addTransportMode)\n ? cur.addTransportMode\n : [cur.addTransportMode];\n return [...prev, ...newTransportModes];\n }\n if (cur.type === \"DROPDOWN\") {\n const transportMode = cur.options.find(o => o.value === cur.value)\n ?.addTransportMode;\n if (transportMode) {\n return [...prev, transportMode];\n }\n }\n return prev;\n }, []);\n}\n\n/**\n * Generates every possible mathematical subset of the input TransportModes.\n * Uses code from:\n * https://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array\n * @param array Array of input transport modes\n * @returns 2D array representing every possible subset of transport modes from input\n */\nfunction combinations(array: TransportMode[]): TransportMode[][] {\n if (!array) return [];\n return (\n // eslint-disable-next-line no-bitwise\n new Array(1 << array.length)\n .fill(null)\n // eslint-disable-next-line no-bitwise\n .map((e1, i) => array.filter((e2, j) => i & (1 << j)))\n );\n}\n\n/**\n * This constant maps all the transport mode to a broader mode type,\n * which is used to determine the valid combinations of modes used in query generation.\n */\nexport const SIMPLIFICATIONS = {\n AIRPLANE: \"TRANSIT\",\n BICYCLE: \"PERSONAL\",\n BUS: \"TRANSIT\",\n CABLE_CAR: \"TRANSIT\",\n CAR: \"CAR\",\n FERRY: \"TRANSIT\",\n FLEX: \"SHARED\", // TODO: this allows FLEX+WALK. Is this reasonable?\n FUNICULAR: \"TRANSIT\",\n GONDOLA: \"TRANSIT\",\n RAIL: \"TRANSIT\",\n MONORAIL: \"TRANSIT\",\n SCOOTER: \"PERSONAL\",\n SUBWAY: \"TRANSIT\",\n TROLLEYBUS: \"TRANSIT\",\n TRAM: \"TRANSIT\",\n TRANSIT: \"TRANSIT\",\n WALK: \"WALK\"\n};\n\n// Inclusion of \"TRANSIT\" alone automatically implies \"WALK\" in OTP\nconst VALID_COMBOS = [\n [\"WALK\"],\n [\"PERSONAL\"],\n [\"TRANSIT\", \"SHARED\"],\n [\"WALK\", \"SHARED\"],\n [\"TRANSIT\"],\n [\"TRANSIT\", \"PERSONAL\"],\n [\"TRANSIT\", \"CAR\"]\n];\n\nconst BANNED_TOGETHER = [\"SCOOTER\", \"BICYCLE\", \"CAR\"];\n\nexport const TRANSIT_SUBMODES = Object.keys(SIMPLIFICATIONS).filter(\n mode => SIMPLIFICATIONS[mode] === \"TRANSIT\" && mode !== \"TRANSIT\"\n);\nexport const TRANSIT_SUBMODES_AND_TRANSIT = Object.keys(SIMPLIFICATIONS).filter(\n mode => SIMPLIFICATIONS[mode] === \"TRANSIT\"\n);\n\nfunction isCombinationValid(\n combo: TransportMode[],\n queryTransitSubmodes: string[]\n): boolean {\n if (combo.length === 0) return false;\n\n // All current qualifiers currently simplify to \"SHARED\"\n const simplifiedModes = Array.from(\n new Set(combo.map(c => (c.qualifier ? \"SHARED\" : SIMPLIFICATIONS[c.mode])))\n );\n\n // Ensure that if we have one transit mode, then we include ALL transit modes\n if (simplifiedModes.includes(\"TRANSIT\")) {\n // Don't allow TRANSIT along with any other submodes\n if (queryTransitSubmodes.length && combo.find(c => c.mode === \"TRANSIT\")) {\n return false;\n }\n\n if (\n combo.reduce((prev, cur) => {\n if (queryTransitSubmodes.includes(cur.mode)) {\n return prev - 1;\n }\n return prev;\n }, queryTransitSubmodes.length) !== 0\n ) {\n return false;\n }\n // Continue to the other checks\n }\n\n // OTP doesn't support multiple non-walk modes\n if (BANNED_TOGETHER.filter(m => combo.find(c => c.mode === m)).length > 1) {\n return false;\n }\n\n return !!VALID_COMBOS.find(\n vc =>\n simplifiedModes.length === vc.length &&\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 otpQueryParams: OTPQueryParams,\n planQuery = DefaultPlanQuery\n): GraphQLQuery {\n const { from, modeSettings, to, ...otherOtpQueryParams } = otpQueryParams;\n\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 walkReluctance,\n walkSpeed,\n wheelchair\n } = modeSettingValues;\n\n return {\n query: print(planQuery),\n variables: {\n ...otherOtpQueryParams,\n bikeReluctance,\n carReluctance,\n fromPlace: `${from.name}::${from.lat},${from.lon}`,\n toPlace: `${to.name}::${to.lat},${to.lon}`,\n walkReluctance,\n walkSpeed,\n wheelchair\n }\n };\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAAgC,IAAAC,gBAAA,KAAAC,IAAA,cAAAC,WAAA,KAAAD,IAAA,yBAAAE,SAAA,WAAAC,IAAA,IAAAH,IAAA,UAAAI,KAAA,YAAAC,mBAAA,KAAAL,IAAA,wBAAAM,QAAA,IAAAN,IAAA,cAAAG,IAAA,IAAAH,IAAA,UAAAI,KAAA,kBAAAG,IAAA,IAAAP,IAAA,eAAAG,IAAA,IAAAH,IAAA,UAAAI,KAAA,iBAAAI,UAAA,UAAAR,IAAA,wBAAAM,QAAA,IAAAN,IAAA,cAAAG,IAAA,IAAAH,IAAA,UAAAI,KAAA,gBAAAG,IAAA,IAAAP,IAAA,eAAAG,IAAA,IAAAH,IAAA,UAAAI,KAAA,qBAAAI,UAAA,UAAAR,IAAA,wBAAAM,QAAA,IAAAN,IAAA,cAAAG,IAAA,IAAAH,IAAA,UAAAI,KAAA,wBAAAG,IAAA,IAAAP,IAAA,eAAAG,IAAA,IAAAH,IAAA,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CAAC,GACXxE,GAAG,CAACxB,KAAK,KAAK,IAAI,GAAGwB,GAAG,CAACyE,UAAU,IAAAC,eAAA,GAAG1E,GAAG,CAAC2E,UAAU,cAAAD,eAAA,cAAAA,eAAA,GAAI,IAAI;IAChE;IACA,OAAO3E,IAAI;EACb,CAAC,EAAE,CAAC,CAAC,CAAsB;EAE3B,MAAM;IACJ6E,cAAc;IACdC,aAAa;IACbC,cAAc;IACdC,SAAS;IACTC;EACF,CAAC,GAAGZ,iBAAiB;EAErB,OAAO;IACLa,KAAK,EAAE,IAAAC,cAAK,EAACjB,SAAS,CAAC;IACvBkB,SAAS,EAAE;MACT,GAAGhB,mBAAmB;MACtBS,cAAc;MACdC,aAAa;MACbO,SAAS,EAAE,GAAG/B,IAAI,CAAC9E,IAAI,KAAK8E,IAAI,CAACgC,GAAG,IAAIhC,IAAI,CAACiC,GAAG,EAAE;MAClDC,OAAO,EAAE,GAAGrB,EAAE,CAAC3F,IAAI,KAAK2F,EAAE,CAACmB,GAAG,IAAInB,EAAE,CAACoB,GAAG,EAAE;MAC1CR,cAAc;MACdC,SAAS;MACTC;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"query-gen.js","names":["_graphql","require","DefaultPlanQuery","kind","definitions","operation","name","value","variableDefinitions","variable","type","directives","selectionSet","selections","arguments","block","alias","typeCondition","loc","start","end","source","body","locationOffset","line","column","extractAdditionalModes","modeSettings","enabledModes","reduce","prev","cur","map","m","mode","includes","applicableMode","addTransportMode","newTransportModes","Array","isArray","_cur$options$find","transportMode","options","find","o","combinations","array","length","fill","e1","i","filter","e2","j","SIMPLIFICATIONS","exports","AIRPLANE","BICYCLE","BUS","CABLE_CAR","CAR","FERRY","FLEX","FUNICULAR","GONDOLA","RAIL","MONORAIL","SCOOTER","SUBWAY","TROLLEYBUS","TRAM","TRANSIT","WALK","VALID_COMBOS","BANNED_TOGETHER","TRANSIT_SUBMODES","Object","keys","TRANSIT_SUBMODES_AND_TRANSIT","isCombinationValid","combo","queryTransitSubmodes","simplifiedModes","from","Set","c","qualifier","vc","every","generateCombinations","params","completeModeList","modes","generateOtp2Query","otpQueryParams","planQuery","to","otherOtpQueryParams","modeSettingValues","inverseKey","high","low","key","truthValue","falseValue","newVal","bikeReluctance","carReluctance","walkReluctance","walkSpeed","wheelchair","query","print","variables","fromPlace","lat","lon","toPlace"],"sources":["../src/query-gen.ts"],"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 unpreferred?: InputPreferred;\n};\n\ntype GraphQLQuery = {\n query: string;\n variables: Record<string, unknown>;\n};\n\n/**\n * Mode Settings can contain additional modes to add to the query,\n * this function extracts those additional modes from the settings\n * and returns them in an array.\n * @param modeSettings List of mode settings with values populated\n * @returns Additional transport modes to add to query\n */\nexport function extractAdditionalModes(\n modeSettings: ModeSetting[],\n enabledModes: TransportMode[]\n): TransportMode[] {\n return modeSettings.reduce<TransportMode[]>((prev, cur) => {\n // First, ensure that the mode associated with this setting is even enabled\n if (!enabledModes.map(m => m.mode).includes(cur.applicableMode)) {\n return prev;\n }\n\n // In checkboxes, mode must be enabled and have a transport mode in it\n if (\n (cur.type === \"CHECKBOX\" || cur.type === \"SUBMODE\") &&\n cur.addTransportMode &&\n cur.value\n ) {\n const newTransportModes = Array.isArray(cur.addTransportMode)\n ? cur.addTransportMode\n : [cur.addTransportMode];\n return [...prev, ...newTransportModes];\n }\n if (cur.type === \"DROPDOWN\") {\n const transportMode = cur.options.find(o => o.value === cur.value)\n ?.addTransportMode;\n if (transportMode) {\n return [...prev, transportMode];\n }\n }\n return prev;\n }, []);\n}\n\n/**\n * Generates every possible mathematical subset of the input TransportModes.\n * Uses code from:\n * https://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array\n * @param array Array of input transport modes\n * @returns 2D array representing every possible subset of transport modes from input\n */\nfunction combinations(array: TransportMode[]): TransportMode[][] {\n if (!array) return [];\n return (\n // eslint-disable-next-line no-bitwise\n new Array(1 << array.length)\n .fill(null)\n // eslint-disable-next-line no-bitwise\n .map((e1, i) => array.filter((e2, j) => i & (1 << j)))\n );\n}\n\n/**\n * This constant maps all the transport mode to a broader mode type,\n * which is used to determine the valid combinations of modes used in query generation.\n */\nexport const SIMPLIFICATIONS: Record<string, string> = {\n AIRPLANE: \"TRANSIT\",\n BICYCLE: \"PERSONAL\",\n BUS: \"TRANSIT\",\n CABLE_CAR: \"TRANSIT\",\n CAR: \"CAR\",\n FERRY: \"TRANSIT\",\n FLEX: \"SHARED\", // TODO: this allows FLEX+WALK. Is this reasonable?\n FUNICULAR: \"TRANSIT\",\n GONDOLA: \"TRANSIT\",\n RAIL: \"TRANSIT\",\n MONORAIL: \"TRANSIT\",\n SCOOTER: \"PERSONAL\",\n SUBWAY: \"TRANSIT\",\n TROLLEYBUS: \"TRANSIT\",\n TRAM: \"TRANSIT\",\n TRANSIT: \"TRANSIT\",\n WALK: \"WALK\"\n};\n\n// Inclusion of \"TRANSIT\" alone automatically implies \"WALK\" in OTP\nconst VALID_COMBOS: string[][] = [\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.length === vc.length &&\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 otpQueryParams: OTPQueryParams,\n planQuery = DefaultPlanQuery\n): GraphQLQuery {\n const { from, modeSettings, to, ...otherOtpQueryParams } = otpQueryParams;\n\n // This extracts the values from the mode settings to key value pairs\n const modeSettingValues = modeSettings.reduce<\n Record<string, string | number | boolean>\n >((prev, cur) => {\n if (cur.type === \"SLIDER\" && cur.inverseKey && cur.value) {\n prev[cur.inverseKey] = cur.high - cur.value + cur.low;\n } else if (cur.value) {\n prev[cur.key] = cur.value;\n }\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 && cur.falseValue) {\n const newVal = cur.value === true ? cur.truthValue : cur.falseValue;\n if (newVal) {\n prev[cur.key] = newVal;\n }\n }\n return prev;\n // eslint-disable-next-line prettier/prettier -- old eslint doesn't know satisfies\n }, {}) satisfies ModeSettingValues;\n\n const {\n bikeReluctance,\n carReluctance,\n walkReluctance,\n walkSpeed,\n wheelchair\n } = modeSettingValues;\n\n return {\n query: print(planQuery),\n variables: {\n ...otherOtpQueryParams,\n bikeReluctance,\n carReluctance,\n fromPlace: `${from.name}::${from.lat},${from.lon}`,\n toPlace: `${to.name}::${to.lat},${to.lon}`,\n walkReluctance,\n walkSpeed,\n wheelchair\n }\n };\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAAgC,IAAAC,gBAAA,KAAAC,IAAA,cAAAC,WAAA,KAAAD,IAAA,yBAAAE,SAAA,WAAAC,IAAA,IAAAH,IAAA,UAAAI,KAAA,YAAAC,mBAAA,KAAAL,IAAA,wBAAAM,QAAA,IAAAN,IAAA,cAAAG,IAAA,IAAAH,IAAA,UAAAI,KAAA,kB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@ -11,7 +11,7 @@ import { Leg, Route, TransitOperator } from "@opentripplanner/types";
|
|
|
11
11
|
* @return {object} The transitOperator if a match was found or null if no match
|
|
12
12
|
* was found
|
|
13
13
|
*/
|
|
14
|
-
export declare function getTransitOperatorFromFeedIdAndAgencyId(feedId: string, agencyId: string | number, transitOperators: TransitOperator[]): TransitOperator;
|
|
14
|
+
export declare function getTransitOperatorFromFeedIdAndAgencyId(feedId: string, agencyId: string | number, transitOperators: TransitOperator[]): TransitOperator | null;
|
|
15
15
|
/**
|
|
16
16
|
* Looks up an operator from the provided leg.
|
|
17
17
|
*
|
|
@@ -20,7 +20,7 @@ export declare function getTransitOperatorFromFeedIdAndAgencyId(feedId: string,
|
|
|
20
20
|
* @param {object} transitOperators transitOperators from config.
|
|
21
21
|
* @return {object} the operator if one was found or null if no match was found
|
|
22
22
|
*/
|
|
23
|
-
export declare function getTransitOperatorFromLeg(leg: Leg, transitOperators: TransitOperator[]): TransitOperator;
|
|
23
|
+
export declare function getTransitOperatorFromLeg(leg: Leg, transitOperators: TransitOperator[]): TransitOperator | null;
|
|
24
24
|
/**
|
|
25
25
|
* Looks up an operator from the provided configuration given an OTP route.
|
|
26
26
|
* NOTE: this assumes the use of the OTP Route model or a modified OTP
|
|
@@ -31,7 +31,7 @@ export declare function getTransitOperatorFromLeg(leg: Leg, transitOperators: Tr
|
|
|
31
31
|
* @param {array} transitOperators transitOperators from config
|
|
32
32
|
* @return {object} the operator if one was found or null if no match was found
|
|
33
33
|
*/
|
|
34
|
-
export declare function getTransitOperatorFromOtpRoute(route: Route, transitOperators: TransitOperator[]): TransitOperator;
|
|
34
|
+
export declare function getTransitOperatorFromOtpRoute(route: Route, transitOperators: TransitOperator[]): TransitOperator | null;
|
|
35
35
|
/**
|
|
36
36
|
* Calculates the sort comparator value given two routes based off of the
|
|
37
37
|
* route's agency and provided transitOperators config data.
|
|
@@ -67,7 +67,8 @@ export declare function alphabeticShortNameComparator(a: Route, b: Route): numbe
|
|
|
67
67
|
* @param {function} [objGetterFn] An optional function to obtain the
|
|
68
68
|
* comparison value from the comparator function arguments
|
|
69
69
|
*/
|
|
70
|
-
export declare function makeNumericValueComparator(
|
|
70
|
+
export declare function makeNumericValueComparator(): (a: number, b: number) => number;
|
|
71
|
+
export declare function makeNumericValueComparator<T>(objGetterFn: (item: T) => number | null | undefined): (a: T, b: T) => number;
|
|
71
72
|
/**
|
|
72
73
|
* Create a comparator function that compares string values. The comparison
|
|
73
74
|
* values feed to the sort comparator function are assumed to be objects that
|
|
@@ -78,7 +79,8 @@ export declare function makeNumericValueComparator(objGetterFn?: (item: Route) =
|
|
|
78
79
|
* @param {function} [objGetterFn] An optional function to obtain the
|
|
79
80
|
* comparison value from the comparator function arguments
|
|
80
81
|
*/
|
|
81
|
-
export declare function makeStringValueComparator(
|
|
82
|
+
export declare function makeStringValueComparator(): (a: string, b: string) => number;
|
|
83
|
+
export declare function makeStringValueComparator<T>(objGetterFn: (item: T) => string | null | undefined): (a: T, b: T) => number;
|
|
82
84
|
/**
|
|
83
85
|
* OTP1 sets the routeSortOrder to -999 by default. If we're encountering that value in OTP1,
|
|
84
86
|
* assume that it actually means that the route sortOrder is not set in the GTFS. If we encounter
|
|
@@ -88,7 +90,7 @@ export declare function makeStringValueComparator(objGetterFn?: (item: Route) =>
|
|
|
88
90
|
* Also see https://github.com/opentripplanner/otp-react-redux/issues/122
|
|
89
91
|
* This was updated in OTP2 TO be empty by default. https://docs.opentripplanner.org/en/v2.3.0/OTP2-MigrationGuide/#:~:text=the%20Alerts-,Changes%20to%20the%20Index%20API,-Error%20handling%20is
|
|
90
92
|
*/
|
|
91
|
-
export declare function getRouteSortOrderValue(route: Route): number;
|
|
93
|
+
export declare function getRouteSortOrderValue(route: Route): number | null;
|
|
92
94
|
/**
|
|
93
95
|
* Create a multi-criteria sort comparator function composed of other sort
|
|
94
96
|
* comparator functions. Each comparator function will be ran in the order given
|
|
@@ -96,7 +98,7 @@ export declare function getRouteSortOrderValue(route: Route): number;
|
|
|
96
98
|
* returned. If all comparison functions return equivalence, then the values
|
|
97
99
|
* are assumed to be equivalent.
|
|
98
100
|
*/
|
|
99
|
-
export declare function makeMultiCriteriaSort(...criteria: ((a:
|
|
101
|
+
export declare function makeMultiCriteriaSort<T = unknown>(...criteria: ((a: T, b: T) => number)[]): (a: T, b: T) => number;
|
|
100
102
|
/**
|
|
101
103
|
* Creates a sort comparator function to compares routes for the purposes of
|
|
102
104
|
* sorting and displaying in a user interface. This takes in a single optional
|
|
@@ -128,7 +130,7 @@ export declare function makeMultiCriteriaSort(...criteria: ((a: unknown, b: unkn
|
|
|
128
130
|
* those with shortNames.
|
|
129
131
|
* 7. longName as string.
|
|
130
132
|
*/
|
|
131
|
-
export declare function makeRouteComparator(transitOperators: TransitOperator[]): (a:
|
|
133
|
+
export declare function makeRouteComparator(transitOperators: TransitOperator[]): (a: Route, b: Route) => number;
|
|
132
134
|
/**
|
|
133
135
|
* Tests if a pair of colors is readable. If it is, that readable color is returned.
|
|
134
136
|
* If it is not, a more appropriate alternative is returned.
|
package/lib/route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../src/route.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../src/route.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,KAAK,EAEL,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,gBAAgB,EAAE,eAAe,EAAE,GAClC,eAAe,GAAG,IAAI,CAQxB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,eAAe,EAAE,GAClC,eAAe,GAAG,IAAI,CAQxB;AAED;;;;;;;;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GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,EAAE,IAE/B,GAAG,CAAC,EAAE,GAAG,CAAC,KAAG,MAAM,CAW5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,eAAe,EAAE,GAClC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,KAAK,MAAM,CAUhC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,EACvB,iBAAiB,CAAC,EAAE,MAAM,GACzB,MAAM,CA2BR"}
|
package/lib/route.js
CHANGED
|
@@ -129,7 +129,7 @@ function makeTransitOperatorComparator(transitOperators) {
|
|
|
129
129
|
return (a, b) => {
|
|
130
130
|
const aVal = getTransitOperatorComparatorValue(a, transitOperators);
|
|
131
131
|
const bVal = getTransitOperatorComparatorValue(b, transitOperators);
|
|
132
|
-
if (typeof aVal === "string") {
|
|
132
|
+
if (typeof aVal === "string" && typeof bVal === "string") {
|
|
133
133
|
// happens when transitOperators is undefined. Both aVal are guaranteed to
|
|
134
134
|
// be strings. Make a string comparison.
|
|
135
135
|
if (aVal < bVal) return -1;
|
|
@@ -146,19 +146,19 @@ function makeTransitOperatorComparator(transitOperators) {
|
|
|
146
146
|
* Gets the desired sort values according to an optional getter function. If the
|
|
147
147
|
* getter function is not defined, the original sort values are returned.
|
|
148
148
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
let bVal;
|
|
149
|
+
|
|
150
|
+
function getSortValues(a, b, getterFn) {
|
|
152
151
|
if (typeof getterFn === "function") {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
bVal = b;
|
|
152
|
+
return {
|
|
153
|
+
aVal: getterFn(a),
|
|
154
|
+
bVal: getterFn(b)
|
|
155
|
+
};
|
|
158
156
|
}
|
|
157
|
+
|
|
158
|
+
// When no getter is provided, TValue is inferred as T via overload.
|
|
159
159
|
return {
|
|
160
|
-
aVal,
|
|
161
|
-
bVal
|
|
160
|
+
aVal: a,
|
|
161
|
+
bVal: b
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -175,7 +175,11 @@ const modeComparatorValue = {
|
|
|
175
175
|
CABLE_CAR: 6,
|
|
176
176
|
FUNICULAR: 7,
|
|
177
177
|
BUS: 8
|
|
178
|
+
// eslint-disable-next-line prettier/prettier
|
|
178
179
|
};
|
|
180
|
+
function isSupportedTransitMode(mode) {
|
|
181
|
+
return mode in modeComparatorValue;
|
|
182
|
+
}
|
|
179
183
|
|
|
180
184
|
// Lookup that maps route types to the OTP mode sort values.
|
|
181
185
|
// Note: JSDoc format not used to avoid bug in documentationjs.
|
|
@@ -214,10 +218,10 @@ function getRouteTypeComparatorValue(route) {
|
|
|
214
218
|
// string-based modes, but the long route response returns the
|
|
215
219
|
// integer route type. This attempts to account for both of those cases.
|
|
216
220
|
if (!route) throw new Error(`Route is undefined. ${route}`);
|
|
217
|
-
if (
|
|
221
|
+
if (route.mode && isSupportedTransitMode(route.mode)) {
|
|
218
222
|
return modeComparatorValue[route.mode];
|
|
219
223
|
}
|
|
220
|
-
if (typeof routeTypeComparatorValue[route.type] !== "undefined") {
|
|
224
|
+
if (route.type && typeof routeTypeComparatorValue[route.type] !== "undefined") {
|
|
221
225
|
return routeTypeComparatorValue[route.type];
|
|
222
226
|
}
|
|
223
227
|
// Default the comparator value to a large number (placing the route at the
|
|
@@ -293,12 +297,13 @@ const isNullOrNaN = val => {
|
|
|
293
297
|
* @param {function} [objGetterFn] An optional function to obtain the
|
|
294
298
|
* comparison value from the comparator function arguments
|
|
295
299
|
*/
|
|
300
|
+
|
|
296
301
|
function makeNumericValueComparator(objGetterFn) {
|
|
297
302
|
return (a, b) => {
|
|
298
303
|
const {
|
|
299
304
|
aVal,
|
|
300
305
|
bVal
|
|
301
|
-
} = getSortValues(
|
|
306
|
+
} = typeof objGetterFn === "function" ? getSortValues(a, b, objGetterFn) : getSortValues(a, b);
|
|
302
307
|
|
|
303
308
|
// if both values aren't valid numbers, use the next sort criteria
|
|
304
309
|
if (isNullOrNaN(aVal) && isNullOrNaN(bVal)) {
|
|
@@ -311,7 +316,6 @@ function makeNumericValueComparator(objGetterFn) {
|
|
|
311
316
|
if (isNullOrNaN(bVal)) return -1;
|
|
312
317
|
|
|
313
318
|
// a and b are valid numbers, return the sort value
|
|
314
|
-
// @ts-expect-error We know from the checks above that both aVal and bVal are valid numbers.
|
|
315
319
|
return aVal - bVal;
|
|
316
320
|
};
|
|
317
321
|
}
|
|
@@ -326,12 +330,14 @@ function makeNumericValueComparator(objGetterFn) {
|
|
|
326
330
|
* @param {function} [objGetterFn] An optional function to obtain the
|
|
327
331
|
* comparison value from the comparator function arguments
|
|
328
332
|
*/
|
|
333
|
+
|
|
329
334
|
function makeStringValueComparator(objGetterFn) {
|
|
330
335
|
return (a, b) => {
|
|
331
336
|
const {
|
|
332
337
|
aVal,
|
|
333
338
|
bVal
|
|
334
|
-
} = getSortValues(
|
|
339
|
+
} = typeof objGetterFn === "function" ? getSortValues(a, b, objGetterFn) : getSortValues(a, b);
|
|
340
|
+
|
|
335
341
|
// both a and b are uncomparable strings, return equivalent value
|
|
336
342
|
if (!aVal && !bVal) return 0;
|
|
337
343
|
// a is not a comparable string, b gets priority
|
package/lib/route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","names":["_chromaJs","_interopRequireDefault","require","getTransitOperatorFromFeedIdAndAgencyId","feedId","agencyId","transitOperators","find","transitOperator","getTransitOperatorFromLeg","leg","routeId","split","getTransitOperatorFromOtpRoute","route","id","agency","END_OF_LIST_COMPARATOR_VALUE","getTransitOperatorComparatorValue","length","name","agencyName","order","makeTransitOperatorComparator","a","b","aVal","bVal","getSortValues","getterFn","modeComparatorValue","SUBWAY","TRAM","TROLLEYBUS","RAIL","GONDOLA","FERRY","CABLE_CAR","FUNICULAR","BUS","routeTypeComparatorValue","getRouteTypeComparatorValue","Error","mode","type","console","warn","routeTypeComparator","startsWithAlphabeticCharacter","val","firstCharCode","charCodeAt","alphabeticShortNameComparator","aStartsWithAlphabeticCharacter","shortName","bStartsWithAlphabeticCharacter","isNullOrNaN","isNaN","makeNumericValueComparator","objGetterFn","makeStringValueComparator","getRouteSortOrderValue","isOTP1","sortOrder","undefined","makeMultiCriteriaSort","criteria","i","curCriteriaComparatorValue","makeRouteComparator","obj","parseInt","longName","getMostReadableTextColor","backgroundColor","proposedTextColor","startsWith","fgLuminance","chroma","luminance","bgLuminance","Math","abs"],"sources":["../src/route.ts"],"sourcesContent":["import { Leg, Route, TransitOperator } from \"@opentripplanner/types\";\nimport chroma from \"chroma-js\";\n/**\n * Returns the transit operator (if an exact match is found) from the transit\n * operators config value. It is critical to use both the feedId and agencyId in\n * this method because it is possible in OTP for there to be a duplicate\n * agencyId in separate feeds.\n *\n * @param {string} feedId The feedId that this transit agency belongs to\n * @param {string} agencyId The agencyId of the transit agency\n * @param {array} transitOperators The transitOperators list from the config\n * @return {object} The transitOperator if a match was found or null if no match\n * was found\n */\nexport function getTransitOperatorFromFeedIdAndAgencyId(\n feedId: string,\n agencyId: string | number,\n transitOperators: TransitOperator[]\n): TransitOperator {\n return (\n transitOperators.find(\n transitOperator =>\n transitOperator.feedId === feedId &&\n transitOperator.agencyId === agencyId\n ) || null\n );\n}\n\n/**\n * Looks up an operator from the provided leg.\n *\n * @param {object} leg The Itinerary Leg from which to find the transit\n * operator\n * @param {object} transitOperators transitOperators from config.\n * @return {object} the operator if one was found or null if no match was found\n */\nexport function getTransitOperatorFromLeg(\n leg: Leg,\n transitOperators: TransitOperator[]\n): TransitOperator {\n if (!leg.routeId || !leg.agencyId) return null;\n const feedId = leg.routeId.split(\":\")[0];\n return getTransitOperatorFromFeedIdAndAgencyId(\n feedId,\n leg.agencyId,\n transitOperators\n );\n}\n\n/**\n * Looks up an operator from the provided configuration given an OTP route.\n * NOTE: this assumes the use of the OTP Route model or a modified OTP\n * RouteShort model (such as the one found in the IBI fork of OTP) that also\n * returns the agencyId.\n *\n * @param {object} route Either an OTP Route or RouteShort model\n * @param {array} transitOperators transitOperators from config\n * @return {object} the operator if one was found or null if no match was found\n */\nexport function getTransitOperatorFromOtpRoute(\n route: Route,\n transitOperators: TransitOperator[]\n): TransitOperator {\n if (!route.id) return null;\n const feedId = route.id.split(\":\")[0];\n let agencyId: string | number;\n if (route.agency) {\n // This is returned in OTP2\n agencyId = route.agency.id;\n } else if (route.agencyId) {\n // This is returned in OTP1\n agencyId = route.agencyId;\n } else {\n return null;\n }\n return getTransitOperatorFromFeedIdAndAgencyId(\n feedId,\n agencyId,\n transitOperators\n );\n}\n\n// The functions below are for enhanced route sorting functions for the route\n// viewer on OTP-react-redux.\n// They address route ordering issues discussed in\n// https://github.com/opentripplanner/otp-react-redux/pull/123 and\n// https://github.com/opentripplanner/otp-react-redux/pull/124.\n\n/**\n * A large comparator value that can safely be used in mathematical sort\n * comparisons to place things at the end of lists\n */\nconst END_OF_LIST_COMPARATOR_VALUE = 999999999999;\n\n/**\n * Returns a transit operator comparator value given a route and an optional\n * transitOperators config value. This function will do its best to handle all\n * kinds of input data as certain deployments of an implementing webapp may have\n * incomplete data and certain versions of OTP might not have a modified\n * implementation of the RouteShort model.\n *\n * @param {object} route Either an OTP Route or RouteShort model\n * @param {array} transitOperators transitOperators from config\n * @return {mixed} this could return a string value (the route's agency name) if\n * the transitOperators value is not defined. Otherwise an integer will be\n * returned.\n */\nfunction getTransitOperatorComparatorValue(\n route: Route,\n transitOperators: TransitOperator[]\n): number | string {\n // if the transitOperators is undefined or has zero length, use the route's\n // agency name as the comparator value\n if (!transitOperators || transitOperators.length === 0) {\n // OTP2 Route\n if (route.agency) return route.agency.name;\n // OTP1 Route\n if (route.agencyName) return route.agencyName;\n // shouldn't happen as agency names will be defined\n return \"zzz\";\n }\n\n // find operator associated with route\n const transitOperator = getTransitOperatorFromOtpRoute(\n route,\n transitOperators\n );\n\n // if transit operator not found, return infinity\n if (!transitOperator) return END_OF_LIST_COMPARATOR_VALUE;\n\n // return the transit operator's sort value or END_OF_LIST_COMPARATOR_VALUE if\n // the sort value is not a number\n return typeof transitOperator.order === \"number\"\n ? transitOperator.order\n : END_OF_LIST_COMPARATOR_VALUE;\n}\n\n/**\n * Calculates the sort comparator value given two routes based off of the\n * route's agency and provided transitOperators config data.\n */\nexport function makeTransitOperatorComparator(\n transitOperators: TransitOperator[]\n) {\n return (a: Route, b: Route) => {\n const aVal = getTransitOperatorComparatorValue(a, transitOperators);\n const bVal = getTransitOperatorComparatorValue(b, transitOperators);\n if (typeof aVal === \"string\") {\n // happens when transitOperators is undefined. Both aVal are guaranteed to\n // be strings. Make a string comparison.\n if (aVal < bVal) return -1;\n if (aVal > bVal) return 1;\n return 0;\n }\n // @ts-expect-error transitOperators are defined and therefore a numeric value is guaranteed\n // to be returned\n return aVal - bVal;\n };\n}\n\n/**\n * Gets the desired sort values according to an optional getter function. If the\n * getter function is not defined, the original sort values are returned.\n */\nfunction getSortValues(\n getterFn: (item: unknown) => unknown,\n a: unknown,\n b: unknown\n) {\n let aVal: unknown;\n let bVal: unknown;\n if (typeof getterFn === \"function\") {\n aVal = getterFn(a);\n bVal = getterFn(b);\n } else {\n aVal = a;\n bVal = b;\n }\n return { aVal, bVal };\n}\n\n// Lookup for the sort values associated with various OTP modes.\n// Note: JSDoc format not used to avoid bug in documentationjs.\n// https://github.com/documentationjs/documentation/issues/372\nconst modeComparatorValue = {\n SUBWAY: 1,\n TRAM: 2,\n TROLLEYBUS: 9,\n RAIL: 3,\n GONDOLA: 4,\n FERRY: 5,\n CABLE_CAR: 6,\n FUNICULAR: 7,\n BUS: 8\n};\n\n// Lookup that maps route types to the OTP mode sort values.\n// Note: JSDoc format not used to avoid bug in documentationjs.\n// https://github.com/documentationjs/documentation/issues/372\nconst routeTypeComparatorValue = {\n 0: modeComparatorValue.TRAM, // - Tram, Streetcar, Light rail.\n 1: modeComparatorValue.SUBWAY, // - Subway, Metro.\n 2: modeComparatorValue.RAIL, // - Rail. Used for intercity or long-distance travel.\n 3: modeComparatorValue.BUS, // - Bus.\n 4: modeComparatorValue.FERRY, // - Ferry.\n 5: modeComparatorValue.CABLE_CAR, // - Cable tram.\n 6: modeComparatorValue.GONDOLA, // - Gondola, etc.\n 7: modeComparatorValue.FUNICULAR, // - Funicular.\n // TODO: 11 and 12 are not a part of OTP as of 2019-02-14, but for now just\n // associate them with bus/rail.\n 11: modeComparatorValue.BUS, // - Trolleybus.\n 12: modeComparatorValue.RAIL, // - Monorail.\n 13: modeComparatorValue.TROLLEYBUS\n};\n\n// Gets a comparator value for a given route's type (OTP mode).\n// Note: JSDoc format not used to avoid bug in documentationjs.\n// ttps://github.com/documentationjs/documentation/issues/372\nfunction getRouteTypeComparatorValue(route: Route): number {\n // For some strange reason, the short route response in OTP returns the\n // string-based modes, but the long route response returns the\n // integer route type. This attempts to account for both of those cases.\n if (!route) throw new Error(`Route is undefined. ${route}`);\n if (typeof modeComparatorValue[route.mode] !== \"undefined\") {\n return modeComparatorValue[route.mode];\n }\n if (typeof routeTypeComparatorValue[route.type] !== \"undefined\") {\n return routeTypeComparatorValue[route.type];\n }\n // Default the comparator value to a large number (placing the route at the\n // end of the list).\n // eslint-disable-next-line no-console\n console.warn(\"no mode/route type found for route\", route);\n return END_OF_LIST_COMPARATOR_VALUE;\n}\n\n/**\n * Calculates the sort comparator value given two routes based off of route type\n * (OTP mode).\n */\nexport function routeTypeComparator(a: Route, b: Route): number {\n return getRouteTypeComparatorValue(a) - getRouteTypeComparatorValue(b);\n}\n\n/**\n * Determines whether a value is a string that starts with an alphabetic\n * ascii character.\n */\nfunction startsWithAlphabeticCharacter(val: unknown): boolean {\n if (typeof val === \"string\" && val.length > 0) {\n const firstCharCode = val.charCodeAt(0);\n return (\n (firstCharCode >= 65 && firstCharCode <= 90) ||\n (firstCharCode >= 97 && firstCharCode <= 122)\n );\n }\n return false;\n}\n\n/**\n * Sorts routes based off of whether the shortName begins with an alphabetic\n * character. Routes with shortn that do start with an alphabetic character will\n * be prioritized over those that don't.\n */\nexport function alphabeticShortNameComparator(a: Route, b: Route): number {\n const aStartsWithAlphabeticCharacter = startsWithAlphabeticCharacter(\n a.shortName\n );\n const bStartsWithAlphabeticCharacter = startsWithAlphabeticCharacter(\n b.shortName\n );\n\n if (aStartsWithAlphabeticCharacter && bStartsWithAlphabeticCharacter) {\n // both start with an alphabetic character, return equivalence\n return 0;\n }\n // a does start with an alphabetic character, but b does not. Prioritize a\n if (aStartsWithAlphabeticCharacter) return -1;\n // b does start with an alphabetic character, but a does not. Prioritize b\n if (bStartsWithAlphabeticCharacter) return 1;\n // neither route has a shortName that starts with an alphabetic character.\n // Return equivalence\n return 0;\n}\n\nconst isNullOrNaN = (val: any): boolean => {\n // isNaN(null) returns false so we have to check for null explicitly.\n // Note: Using the global version of isNaN (the Number version behaves differently.\n // eslint-disable-next-line no-restricted-globals\n if (typeof val === null || isNaN(val)) return true;\n\n return typeof val !== \"number\";\n};\n/**\n * Checks whether an appropriate comparison of numeric values can be made for\n * sorting purposes. If both values are not valid numbers according to the\n * isNaN check, then this function returns undefined which indicates that a\n * secondary sorting criteria should be used instead. If one value is valid and\n * the other is not, then the valid value will be given sorting priority. If\n * both values are valid numbers, the difference is obtained as the sort value.\n *\n * An optional argument can be provided which will be used to obtain the\n * comparison value from the comparison function arguments.\n *\n * IMPORTANT: the comparison values must be numeric values or at least be\n * attempted to be converted to numeric values! If one of the arguments is\n * something crazy like an empty string, unexpected behavior will occur because\n * JavaScript.\n *\n * @param {function} [objGetterFn] An optional function to obtain the\n * comparison value from the comparator function arguments\n */\nexport function makeNumericValueComparator(\n objGetterFn?: (item: Route) => number\n) {\n return (a: number, b: number): number | null => {\n const { aVal, bVal } = getSortValues(objGetterFn, a, b);\n\n // if both values aren't valid numbers, use the next sort criteria\n if (isNullOrNaN(aVal) && isNullOrNaN(bVal)) {\n return 0;\n }\n // b is a valid number, b gets priority\n if (isNullOrNaN(aVal)) return 1;\n\n // a is a valid number, a gets priority\n if (isNullOrNaN(bVal)) return -1;\n\n // a and b are valid numbers, return the sort value\n // @ts-expect-error We know from the checks above that both aVal and bVal are valid numbers.\n return aVal - bVal;\n };\n}\n\n/**\n * Create a comparator function that compares string values. The comparison\n * values feed to the sort comparator function are assumed to be objects that\n * will have either undefined, null or string values at the given key. If one\n * object has undefined, null or an empty string, but the other does have a\n * string with length > 0, then that string will get priority.\n *\n * @param {function} [objGetterFn] An optional function to obtain the\n * comparison value from the comparator function arguments\n */\nexport function makeStringValueComparator(\n objGetterFn?: (item: Route) => string\n) {\n return (a: string, b: string): number => {\n const { aVal, bVal } = getSortValues(objGetterFn, a, b);\n // both a and b are uncomparable strings, return equivalent value\n if (!aVal && !bVal) return 0;\n // a is not a comparable string, b gets priority\n if (!aVal) return 1;\n // b is not a comparable string, a gets priority\n if (!bVal) return -1;\n // a and b are comparable strings, return the sort value\n if (aVal < bVal) return -1;\n if (aVal > bVal) return 1;\n return 0;\n };\n}\n\n/**\n * OTP1 sets the routeSortOrder to -999 by default. If we're encountering that value in OTP1,\n * assume that it actually means that the route sortOrder is not set in the GTFS. If we encounter\n * it in OTP2, it's a valid value, so we should return it.\n *\n * See https://github.com/opentripplanner/OpenTripPlanner/issues/2938\n * Also see https://github.com/opentripplanner/otp-react-redux/issues/122\n * This was updated in OTP2 TO be empty by default. https://docs.opentripplanner.org/en/v2.3.0/OTP2-MigrationGuide/#:~:text=the%20Alerts-,Changes%20to%20the%20Index%20API,-Error%20handling%20is\n */\nexport function getRouteSortOrderValue(route: Route): number {\n const isOTP1 = !!route.agencyId;\n const { sortOrder } = route;\n\n if ((isOTP1 && sortOrder === -999) || sortOrder === undefined) {\n return null;\n }\n\n return sortOrder;\n}\n\n/**\n * Create a multi-criteria sort comparator function composed of other sort\n * comparator functions. Each comparator function will be ran in the order given\n * until a non-zero comparison value is obtained which is then immediately\n * returned. If all comparison functions return equivalence, then the values\n * are assumed to be equivalent.\n */\nexport function makeMultiCriteriaSort(\n ...criteria: ((a: unknown, b: unknown) => number)[]\n) {\n return (a: number, b: number): number => {\n for (let i = 0; i < criteria.length; i++) {\n const curCriteriaComparatorValue = criteria[i](a, b);\n // if the comparison objects are not equivalent, return the value obtained\n // in this current criteria comparison\n if (curCriteriaComparatorValue !== 0) {\n return curCriteriaComparatorValue;\n }\n }\n return 0;\n };\n}\n\n/**\n * Creates a sort comparator function to compares routes for the purposes of\n * sorting and displaying in a user interface. This takes in a single optional\n * argument which should be a list of transitOperators as defined in the config\n * file. Due to GTFS feeds having varying levels of data quality, a multi-\n * criteria sort is needed to account for various differences. The criteria\n * included here are each applied to the routes in the order listed. If a given\n * sort criterion yields equivalence (e.g., two routes have the short name\n * \"20\"), the comparator falls back onto the next sort criterion (e.g., long\n * name). The sort operates on the following values (in order):\n *\n * 1. Transit Operator. The transit operator will be attempted to be obtained\n * for each route. If no argument is provided when creating this comparator\n * function, then routes will be sorted by their agency's name. If an\n * argument is provided and a match is found based off of the route's feed_id\n * and agency_id and a transitOperator's feed_id and agency_id, then the\n * field transitOperator.order will be used as the comparator value as long\n * as it is numeric. If it is not numeric, a value is returned indicating\n * that this transit operator should be placed at the end of the list.\n * 2. sortOrder. Routes that do not have a valid sortOrder will be placed\n * beneath those that do.\n * 3. route type (OTP mode). See routeTypeComparator code for prioritization of\n * route types.\n * 4. shortNames that begin with alphabetic characters. shortNames that do not\n * start with alphabetic characters will be place beneath those that do.\n * 5. shortName as integer. shortNames that cannot be parsed as integers will\n * be placed beneath those that are valid.\n * 6. shortName as string. Routes without shortNames will be placed beneath\n * those with shortNames.\n * 7. longName as string.\n */\nexport function makeRouteComparator(\n transitOperators: TransitOperator[]\n): (a: number, b: number) => number {\n return makeMultiCriteriaSort(\n makeTransitOperatorComparator(transitOperators),\n makeNumericValueComparator(obj => getRouteSortOrderValue(obj)),\n routeTypeComparator,\n alphabeticShortNameComparator,\n makeNumericValueComparator(obj => parseInt(obj.shortName, 10)),\n makeStringValueComparator(obj => obj.shortName),\n makeStringValueComparator(obj => obj.longName)\n );\n}\n\n/**\n * Tests if a pair of colors is readable. If it is, that readable color is returned.\n * If it is not, a more appropriate alternative is returned.\n *\n * Uses algorithm based on combined luminance. Values have been derived from\n * looking at real agency color pairings. These pairings are difficult to\n * generate for, as some colors see both white and black used by different agencies.\n *\n * This method therefore can accept multiple colors (including black and white) for the same background color.\n *\n * @param backgroundColor A hex string, usually the \"routeColor\"\n * @param proposedTextColor A hex string, usually the \"routeTextColor\"\n */\nexport function getMostReadableTextColor(\n backgroundColor: string,\n proposedTextColor?: string\n): string {\n // Sometimes input will defy the method signature. Therefore we need extra fallbacks\n if (!backgroundColor) backgroundColor = \"#333333\";\n if (!proposedTextColor) proposedTextColor = \"#ffffff\";\n\n if (!backgroundColor.startsWith(\"#\")) {\n backgroundColor = `#${backgroundColor}`;\n }\n if (!proposedTextColor.startsWith(\"#\")) {\n proposedTextColor = `#${proposedTextColor}`;\n }\n\n // Check if proposed color is readable\n // Luminance thresholds have been selected based on actual transit agency colors\n const fgLuminance = chroma(proposedTextColor).luminance();\n const bgLuminance = chroma(backgroundColor).luminance();\n if (\n bgLuminance + fgLuminance < 1.41 &&\n bgLuminance + fgLuminance > 0.25 &&\n Math.abs(bgLuminance - fgLuminance) > 0.2\n ) {\n return proposedTextColor;\n }\n\n // Return black or white based on luminance of background color\n // When generating colors, white is preferred.\n return chroma(backgroundColor).luminance() < 0.4 ? \"#ffffff\" : \"#000000\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AACA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uCAAuCA,CACrDC,MAAc,EACdC,QAAyB,EACzBC,gBAAmC,EAClB;EACjB,OACEA,gBAAgB,CAACC,IAAI,CACnBC,eAAe,IACbA,eAAe,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M,0BAA0B,CAACY,GAAG,IAAIC,QAAQ,CAACD,GAAG,CAAChB,SAAS,EAAE,EAAE,CAAC,CAAC,EAC9DM,yBAAyB,CAACU,GAAG,IAAIA,GAAG,CAAChB,SAAS,CAAC,EAC/CM,yBAAyB,CAACU,GAAG,IAAIA,GAAG,CAACE,QAAQ,CAC/C,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACtCC,eAAuB,EACvBC,iBAA0B,EAClB;EACR;EACA,IAAI,CAACD,eAAe,EAAEA,eAAe,GAAG,SAAS;EACjD,IAAI,CAACC,iBAAiB,EAAEA,iBAAiB,GAAG,SAAS;EAErD,IAAI,CAACD,eAAe,CAACE,UAAU,CAAC,GAAG,CAAC,EAAE;IACpCF,eAAe,GAAG,IAAIA,eAAe,EAAE;EACzC;EACA,IAAI,CAACC,iBAAiB,CAACC,UAAU,CAAC,GAAG,CAAC,EAAE;IACtCD,iBAAiB,GAAG,IAAIA,iBAAiB,EAAE;EAC7C;;EAEA;EACA;EACA,MAAME,WAAW,GAAG,IAAAC,iBAAM,EAACH,iBAAiB,CAAC,CAACI,SAAS,CAAC,CAAC;EACzD,MAAMC,WAAW,GAAG,IAAAF,iBAAM,EAACJ,eAAe,CAAC,CAACK,SAAS,CAAC,CAAC;EACvD,IACEC,WAAW,GAAGH,WAAW,GAAG,IAAI,IAChCG,WAAW,GAAGH,WAAW,GAAG,IAAI,IAChCI,IAAI,CAACC,GAAG,CAACF,WAAW,GAAGH,WAAW,CAAC,GAAG,GAAG,EACzC;IACA,OAAOF,iBAAiB;EAC1B;;EAEA;EACA;EACA,OAAO,IAAAG,iBAAM,EAACJ,eAAe,CAAC,CAACK,SAAS,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,GAAG,SAAS;AAC1E","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"route.js","names":["_chromaJs","_interopRequireDefault","require","getTransitOperatorFromFeedIdAndAgencyId","feedId","agencyId","transitOperators","find","transitOperator","getTransitOperatorFromLeg","leg","routeId","split","getTransitOperatorFromOtpRoute","route","id","agency","END_OF_LIST_COMPARATOR_VALUE","getTransitOperatorComparatorValue","length","name","agencyName","order","makeTransitOperatorComparator","a","b","aVal","bVal","getSortValues","getterFn","modeComparatorValue","SUBWAY","TRAM","TROLLEYBUS","RAIL","GONDOLA","FERRY","CABLE_CAR","FUNICULAR","BUS","isSupportedTransitMode","mode","routeTypeComparatorValue","getRouteTypeComparatorValue","Error","type","console","warn","routeTypeComparator","startsWithAlphabeticCharacter","val","firstCharCode","charCodeAt","alphabeticShortNameComparator","aStartsWithAlphabeticCharacter","shortName","bStartsWithAlphabeticCharacter","isNullOrNaN","isNaN","makeNumericValueComparator","objGetterFn","makeStringValueComparator","getRouteSortOrderValue","isOTP1","sortOrder","undefined","makeMultiCriteriaSort","criteria","i","curCriteriaComparatorValue","makeRouteComparator","obj","parseInt","longName","getMostReadableTextColor","backgroundColor","proposedTextColor","startsWith","fgLuminance","chroma","luminance","bgLuminance","Math","abs"],"sources":["../src/route.ts"],"sourcesContent":["import {\n Leg,\n Route,\n TransitMode,\n TransitOperator\n} from \"@opentripplanner/types\";\nimport chroma from \"chroma-js\";\n/**\n * Returns the transit operator (if an exact match is found) from the transit\n * operators config value. It is critical to use both the feedId and agencyId in\n * this method because it is possible in OTP for there to be a duplicate\n * agencyId in separate feeds.\n *\n * @param {string} feedId The feedId that this transit agency belongs to\n * @param {string} agencyId The agencyId of the transit agency\n * @param {array} transitOperators The transitOperators list from the config\n * @return {object} The transitOperator if a match was found or null if no match\n * was found\n */\nexport function getTransitOperatorFromFeedIdAndAgencyId(\n feedId: string,\n agencyId: string | number,\n transitOperators: TransitOperator[]\n): TransitOperator | null {\n return (\n transitOperators.find(\n transitOperator =>\n transitOperator.feedId === feedId &&\n transitOperator.agencyId === agencyId\n ) || null\n );\n}\n\n/**\n * Looks up an operator from the provided leg.\n *\n * @param {object} leg The Itinerary Leg from which to find the transit\n * operator\n * @param {object} transitOperators transitOperators from config.\n * @return {object} the operator if one was found or null if no match was found\n */\nexport function getTransitOperatorFromLeg(\n leg: Leg,\n transitOperators: TransitOperator[]\n): TransitOperator | null {\n if (!leg.routeId || !leg.agencyId) return null;\n const feedId = leg.routeId.split(\":\")[0];\n return getTransitOperatorFromFeedIdAndAgencyId(\n feedId,\n leg.agencyId,\n transitOperators\n );\n}\n\n/**\n * Looks up an operator from the provided configuration given an OTP route.\n * NOTE: this assumes the use of the OTP Route model or a modified OTP\n * RouteShort model (such as the one found in the IBI fork of OTP) that also\n * returns the agencyId.\n *\n * @param {object} route Either an OTP Route or RouteShort model\n * @param {array} transitOperators transitOperators from config\n * @return {object} the operator if one was found or null if no match was found\n */\nexport function getTransitOperatorFromOtpRoute(\n route: Route,\n transitOperators: TransitOperator[]\n): TransitOperator | null {\n if (!route.id) return null;\n const feedId = route.id.split(\":\")[0];\n let agencyId: string | number;\n if (route.agency) {\n // This is returned in OTP2\n agencyId = route.agency.id;\n } else if (route.agencyId) {\n // This is returned in OTP1\n agencyId = route.agencyId;\n } else {\n return null;\n }\n return getTransitOperatorFromFeedIdAndAgencyId(\n feedId,\n agencyId,\n transitOperators\n );\n}\n\n// The functions below are for enhanced route sorting functions for the route\n// viewer on OTP-react-redux.\n// They address route ordering issues discussed in\n// https://github.com/opentripplanner/otp-react-redux/pull/123 and\n// https://github.com/opentripplanner/otp-react-redux/pull/124.\n\n/**\n * A large comparator value that can safely be used in mathematical sort\n * comparisons to place things at the end of lists\n */\nconst END_OF_LIST_COMPARATOR_VALUE = 999999999999;\n\n/**\n * Returns a transit operator comparator value given a route and an optional\n * transitOperators config value. This function will do its best to handle all\n * kinds of input data as certain deployments of an implementing webapp may have\n * incomplete data and certain versions of OTP might not have a modified\n * implementation of the RouteShort model.\n *\n * @param {object} route Either an OTP Route or RouteShort model\n * @param {array} transitOperators transitOperators from config\n * @return {mixed} this could return a string value (the route's agency name) if\n * the transitOperators value is not defined. Otherwise an integer will be\n * returned.\n */\nfunction getTransitOperatorComparatorValue(\n route: Route,\n transitOperators: TransitOperator[]\n): number | string | undefined {\n // if the transitOperators is undefined or has zero length, use the route's\n // agency name as the comparator value\n if (!transitOperators || transitOperators.length === 0) {\n // OTP2 Route\n if (route.agency) return route.agency.name;\n // OTP1 Route\n if (route.agencyName) return route.agencyName;\n // shouldn't happen as agency names will be defined\n return \"zzz\";\n }\n\n // find operator associated with route\n const transitOperator = getTransitOperatorFromOtpRoute(\n route,\n transitOperators\n );\n\n // if transit operator not found, return infinity\n if (!transitOperator) return END_OF_LIST_COMPARATOR_VALUE;\n\n // return the transit operator's sort value or END_OF_LIST_COMPARATOR_VALUE if\n // the sort value is not a number\n return typeof transitOperator.order === \"number\"\n ? transitOperator.order\n : END_OF_LIST_COMPARATOR_VALUE;\n}\n\n/**\n * Calculates the sort comparator value given two routes based off of the\n * route's agency and provided transitOperators config data.\n */\nexport function makeTransitOperatorComparator(\n transitOperators: TransitOperator[]\n) {\n return (a: Route, b: Route) => {\n const aVal = getTransitOperatorComparatorValue(a, transitOperators);\n const bVal = getTransitOperatorComparatorValue(b, transitOperators);\n if (typeof aVal === \"string\" && typeof bVal === \"string\") {\n // happens when transitOperators is undefined. Both aVal are guaranteed to\n // be strings. Make a string comparison.\n if (aVal < bVal) return -1;\n if (aVal > bVal) return 1;\n return 0;\n }\n // @ts-expect-error transitOperators are defined and therefore a numeric value is guaranteed\n // to be returned\n return aVal - bVal;\n };\n}\n\n/**\n * Gets the desired sort values according to an optional getter function. If the\n * getter function is not defined, the original sort values are returned.\n */\nfunction getSortValues<T>(a: T, b: T): { aVal: T; bVal: T };\nfunction getSortValues<T, TValue>(\n a: T,\n b: T,\n getterFn: (item: T) => TValue\n): { aVal: TValue; bVal: TValue };\nfunction getSortValues<T, TValue>(a: T, b: T, getterFn?: (item: T) => TValue) {\n if (typeof getterFn === \"function\") {\n return { aVal: getterFn(a), bVal: getterFn(b) };\n }\n\n // When no getter is provided, TValue is inferred as T via overload.\n return { aVal: (a as unknown) as TValue, bVal: (b as unknown) as TValue };\n}\n\n// Lookup for the sort values associated with various OTP modes.\n// Note: JSDoc format not used to avoid bug in documentationjs.\n// https://github.com/documentationjs/documentation/issues/372\nconst modeComparatorValue = {\n SUBWAY: 1,\n TRAM: 2,\n TROLLEYBUS: 9,\n RAIL: 3,\n GONDOLA: 4,\n FERRY: 5,\n CABLE_CAR: 6,\n FUNICULAR: 7,\n BUS: 8\n// eslint-disable-next-line prettier/prettier\n} as const satisfies Partial<Record<TransitMode, number>>;\n\ntype SupportedTransitMode = keyof typeof modeComparatorValue;\n\nfunction isSupportedTransitMode(mode: TransitMode): mode is SupportedTransitMode {\n return mode in modeComparatorValue;\n}\n\n// Lookup that maps route types to the OTP mode sort values.\n// Note: JSDoc format not used to avoid bug in documentationjs.\n// https://github.com/documentationjs/documentation/issues/372\nconst routeTypeComparatorValue: Record<number, number> = {\n 0: modeComparatorValue.TRAM, // - Tram, Streetcar, Light rail.\n 1: modeComparatorValue.SUBWAY, // - Subway, Metro.\n 2: modeComparatorValue.RAIL, // - Rail. Used for intercity or long-distance travel.\n 3: modeComparatorValue.BUS, // - Bus.\n 4: modeComparatorValue.FERRY, // - Ferry.\n 5: modeComparatorValue.CABLE_CAR, // - Cable tram.\n 6: modeComparatorValue.GONDOLA, // - Gondola, etc.\n 7: modeComparatorValue.FUNICULAR, // - Funicular.\n // TODO: 11 and 12 are not a part of OTP as of 2019-02-14, but for now just\n // associate them with bus/rail.\n 11: modeComparatorValue.BUS, // - Trolleybus.\n 12: modeComparatorValue.RAIL, // - Monorail.\n 13: modeComparatorValue.TROLLEYBUS\n};\n\n// Gets a comparator value for a given route's type (OTP mode).\n// Note: JSDoc format not used to avoid bug in documentationjs.\n// ttps://github.com/documentationjs/documentation/issues/372\nfunction getRouteTypeComparatorValue(route: Route): number {\n // For some strange reason, the short route response in OTP returns the\n // string-based modes, but the long route response returns the\n // integer route type. This attempts to account for both of those cases.\n if (!route) throw new Error(`Route is undefined. ${route}`);\n if (route.mode && isSupportedTransitMode(route.mode)) {\n return modeComparatorValue[route.mode];\n }\n if (\n route.type &&\n typeof routeTypeComparatorValue[route.type] !== \"undefined\"\n ) {\n return routeTypeComparatorValue[route.type];\n }\n // Default the comparator value to a large number (placing the route at the\n // end of the list).\n // eslint-disable-next-line no-console\n console.warn(\"no mode/route type found for route\", route);\n return END_OF_LIST_COMPARATOR_VALUE;\n}\n\n/**\n * Calculates the sort comparator value given two routes based off of route type\n * (OTP mode).\n */\nexport function routeTypeComparator(a: Route, b: Route): number {\n return getRouteTypeComparatorValue(a) - getRouteTypeComparatorValue(b);\n}\n\n/**\n * Determines whether a value is a string that starts with an alphabetic\n * ascii character.\n */\nfunction startsWithAlphabeticCharacter(val: unknown): boolean {\n if (typeof val === \"string\" && val.length > 0) {\n const firstCharCode = val.charCodeAt(0);\n return (\n (firstCharCode >= 65 && firstCharCode <= 90) ||\n (firstCharCode >= 97 && firstCharCode <= 122)\n );\n }\n return false;\n}\n\n/**\n * Sorts routes based off of whether the shortName begins with an alphabetic\n * character. Routes with shortn that do start with an alphabetic character will\n * be prioritized over those that don't.\n */\nexport function alphabeticShortNameComparator(a: Route, b: Route): number {\n const aStartsWithAlphabeticCharacter = startsWithAlphabeticCharacter(\n a.shortName\n );\n const bStartsWithAlphabeticCharacter = startsWithAlphabeticCharacter(\n b.shortName\n );\n\n if (aStartsWithAlphabeticCharacter && bStartsWithAlphabeticCharacter) {\n // both start with an alphabetic character, return equivalence\n return 0;\n }\n // a does start with an alphabetic character, but b does not. Prioritize a\n if (aStartsWithAlphabeticCharacter) return -1;\n // b does start with an alphabetic character, but a does not. Prioritize b\n if (bStartsWithAlphabeticCharacter) return 1;\n // neither route has a shortName that starts with an alphabetic character.\n // Return equivalence\n return 0;\n}\n\nconst isNullOrNaN = (val: any): boolean => {\n // isNaN(null) returns false so we have to check for null explicitly.\n // Note: Using the global version of isNaN (the Number version behaves differently.\n // eslint-disable-next-line no-restricted-globals\n if (typeof val === null || isNaN(val)) return true;\n\n return typeof val !== \"number\";\n};\n/**\n * Checks whether an appropriate comparison of numeric values can be made for\n * sorting purposes. If both values are not valid numbers according to the\n * isNaN check, then this function returns undefined which indicates that a\n * secondary sorting criteria should be used instead. If one value is valid and\n * the other is not, then the valid value will be given sorting priority. If\n * both values are valid numbers, the difference is obtained as the sort value.\n *\n * An optional argument can be provided which will be used to obtain the\n * comparison value from the comparison function arguments.\n *\n * IMPORTANT: the comparison values must be numeric values or at least be\n * attempted to be converted to numeric values! If one of the arguments is\n * something crazy like an empty string, unexpected behavior will occur because\n * JavaScript.\n *\n * @param {function} [objGetterFn] An optional function to obtain the\n * comparison value from the comparator function arguments\n */\nexport function makeNumericValueComparator(): (a: number, b: number) => number;\nexport function makeNumericValueComparator<T>(\n objGetterFn: (item: T) => number | null | undefined\n): (a: T, b: T) => number;\nexport function makeNumericValueComparator<T>(\n objGetterFn?: (item: T) => number | null | undefined\n) {\n return (a: T, b: T): number => {\n const { aVal, bVal } =\n typeof objGetterFn === \"function\"\n ? getSortValues(a, b, objGetterFn)\n : getSortValues(a, b);\n\n // if both values aren't valid numbers, use the next sort criteria\n if (isNullOrNaN(aVal) && isNullOrNaN(bVal)) {\n return 0;\n }\n // b is a valid number, b gets priority\n if (isNullOrNaN(aVal)) return 1;\n\n // a is a valid number, a gets priority\n if (isNullOrNaN(bVal)) return -1;\n\n // a and b are valid numbers, return the sort value\n return (aVal as number) - (bVal as number);\n };\n}\n\n/**\n * Create a comparator function that compares string values. The comparison\n * values feed to the sort comparator function are assumed to be objects that\n * will have either undefined, null or string values at the given key. If one\n * object has undefined, null or an empty string, but the other does have a\n * string with length > 0, then that string will get priority.\n *\n * @param {function} [objGetterFn] An optional function to obtain the\n * comparison value from the comparator function arguments\n */\nexport function makeStringValueComparator(): (a: string, b: string) => number;\nexport function makeStringValueComparator<T>(\n objGetterFn: (item: T) => string | null | undefined\n): (a: T, b: T) => number;\nexport function makeStringValueComparator<T>(\n objGetterFn?: (item: T) => string | null | undefined\n) {\n return (a: T, b: T): number => {\n const { aVal, bVal } =\n typeof objGetterFn === \"function\"\n ? getSortValues(a, b, objGetterFn)\n : getSortValues(a, b);\n\n // both a and b are uncomparable strings, return equivalent value\n if (!aVal && !bVal) return 0;\n // a is not a comparable string, b gets priority\n if (!aVal) return 1;\n // b is not a comparable string, a gets priority\n if (!bVal) return -1;\n // a and b are comparable strings, return the sort value\n if (aVal < bVal) return -1;\n if (aVal > bVal) return 1;\n return 0;\n };\n}\n\n/**\n * OTP1 sets the routeSortOrder to -999 by default. If we're encountering that value in OTP1,\n * assume that it actually means that the route sortOrder is not set in the GTFS. If we encounter\n * it in OTP2, it's a valid value, so we should return it.\n *\n * See https://github.com/opentripplanner/OpenTripPlanner/issues/2938\n * Also see https://github.com/opentripplanner/otp-react-redux/issues/122\n * This was updated in OTP2 TO be empty by default. https://docs.opentripplanner.org/en/v2.3.0/OTP2-MigrationGuide/#:~:text=the%20Alerts-,Changes%20to%20the%20Index%20API,-Error%20handling%20is\n */\nexport function getRouteSortOrderValue(route: Route): number | null {\n const isOTP1 = !!route.agencyId;\n const { sortOrder } = route;\n\n if ((isOTP1 && sortOrder === -999) || sortOrder === undefined) {\n return null;\n }\n\n return sortOrder;\n}\n\n/**\n * Create a multi-criteria sort comparator function composed of other sort\n * comparator functions. Each comparator function will be ran in the order given\n * until a non-zero comparison value is obtained which is then immediately\n * returned. If all comparison functions return equivalence, then the values\n * are assumed to be equivalent.\n */\nexport function makeMultiCriteriaSort<T = unknown>(\n ...criteria: ((a: T, b: T) => number)[]\n) {\n return (a: T, b: T): number => {\n for (let i = 0; i < criteria.length; i++) {\n const curCriteriaComparatorValue = criteria[i](a, b);\n // if the comparison objects are not equivalent, return the value obtained\n // in this current criteria comparison\n if (curCriteriaComparatorValue !== 0) {\n return curCriteriaComparatorValue;\n }\n }\n return 0;\n };\n}\n\n/**\n * Creates a sort comparator function to compares routes for the purposes of\n * sorting and displaying in a user interface. This takes in a single optional\n * argument which should be a list of transitOperators as defined in the config\n * file. Due to GTFS feeds having varying levels of data quality, a multi-\n * criteria sort is needed to account for various differences. The criteria\n * included here are each applied to the routes in the order listed. If a given\n * sort criterion yields equivalence (e.g., two routes have the short name\n * \"20\"), the comparator falls back onto the next sort criterion (e.g., long\n * name). The sort operates on the following values (in order):\n *\n * 1. Transit Operator. The transit operator will be attempted to be obtained\n * for each route. If no argument is provided when creating this comparator\n * function, then routes will be sorted by their agency's name. If an\n * argument is provided and a match is found based off of the route's feed_id\n * and agency_id and a transitOperator's feed_id and agency_id, then the\n * field transitOperator.order will be used as the comparator value as long\n * as it is numeric. If it is not numeric, a value is returned indicating\n * that this transit operator should be placed at the end of the list.\n * 2. sortOrder. Routes that do not have a valid sortOrder will be placed\n * beneath those that do.\n * 3. route type (OTP mode). See routeTypeComparator code for prioritization of\n * route types.\n * 4. shortNames that begin with alphabetic characters. shortNames that do not\n * start with alphabetic characters will be place beneath those that do.\n * 5. shortName as integer. shortNames that cannot be parsed as integers will\n * be placed beneath those that are valid.\n * 6. shortName as string. Routes without shortNames will be placed beneath\n * those with shortNames.\n * 7. longName as string.\n */\nexport function makeRouteComparator(\n transitOperators: TransitOperator[]\n): (a: Route, b: Route) => number {\n return makeMultiCriteriaSort(\n makeTransitOperatorComparator(transitOperators),\n makeNumericValueComparator(obj => getRouteSortOrderValue(obj)),\n routeTypeComparator,\n alphabeticShortNameComparator,\n makeNumericValueComparator(obj => parseInt(obj.shortName, 10)),\n makeStringValueComparator(obj => obj.shortName),\n makeStringValueComparator(obj => obj.longName)\n );\n}\n\n/**\n * Tests if a pair of colors is readable. If it is, that readable color is returned.\n * If it is not, a more appropriate alternative is returned.\n *\n * Uses algorithm based on combined luminance. Values have been derived from\n * looking at real agency color pairings. These pairings are difficult to\n * generate for, as some colors see both white and black used by different agencies.\n *\n * This method therefore can accept multiple colors (including black and white) for the same background color.\n *\n * @param backgroundColor A hex string, usually the \"routeColor\"\n * @param proposedTextColor A hex string, usually the \"routeTextColor\"\n */\nexport function getMostReadableTextColor(\n backgroundColor: string,\n proposedTextColor?: string\n): string {\n // Sometimes input will defy the method signature. Therefore we need extra fallbacks\n if (!backgroundColor) backgroundColor = \"#333333\";\n if (!proposedTextColor) proposedTextColor = \"#ffffff\";\n\n if (!backgroundColor.startsWith(\"#\")) {\n backgroundColor = `#${backgroundColor}`;\n }\n if (!proposedTextColor.startsWith(\"#\")) {\n proposedTextColor = `#${proposedTextColor}`;\n }\n\n // Check if proposed color is readable\n // Luminance thresholds have been selected based on actual transit agency colors\n const fgLuminance = chroma(proposedTextColor).luminance();\n const bgLuminance = chroma(backgroundColor).luminance();\n if (\n bgLuminance + fgLuminance < 1.41 &&\n bgLuminance + fgLuminance > 0.25 &&\n Math.abs(bgLuminance - fgLuminance) > 0.2\n ) {\n return proposedTextColor;\n }\n\n // Return black or white based on luminance of background color\n // When generating colors, white is preferred.\n return chroma(backgroundColor).luminance() < 0.4 ? \"#ffffff\" : \"#000000\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uCAAuCA,CACrDC,MAAc,EACdC,QAAyB,EACzBC,gBAAmC,EACX;EACxB,OACEA,gBAAgB,CAACC,IAAI,CACnBC,eAAe,IACbA,eAAe,CAACJ,MAAM,KAAKA,MAAM,IACjCI,eAAe,CAACH,QAAQ,KAAKA,QACjC,CAAC,IAAI,IAAI;AAEb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,yBAAyBA,CACvCC,GAAQ,EACRJ,gBAAmC,EACX;EACxB,IAAI,CAACI,GAAG,CAACC,OAAO,IAAI,CAACD,GAAG,CAACL,QAAQ,EAAE,OAAO,IAAI;EAC9C,MAAMD,MAAM,GAAGM,GAAG,CAACC,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC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9DM,yBAAyB,CAACU,GAAG,IAAIA,GAAG,CAAChB,SAAS,CAAC,EAC/CM,yBAAyB,CAACU,GAAG,IAAIA,GAAG,CAACE,QAAQ,CAC/C,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACtCC,eAAuB,EACvBC,iBAA0B,EAClB;EACR;EACA,IAAI,CAACD,eAAe,EAAEA,eAAe,GAAG,SAAS;EACjD,IAAI,CAACC,iBAAiB,EAAEA,iBAAiB,GAAG,SAAS;EAErD,IAAI,CAACD,eAAe,CAACE,UAAU,CAAC,GAAG,CAAC,EAAE;IACpCF,eAAe,GAAG,IAAIA,eAAe,EAAE;EACzC;EACA,IAAI,CAACC,iBAAiB,CAACC,UAAU,CAAC,GAAG,CAAC,EAAE;IACtCD,iBAAiB,GAAG,IAAIA,iBAAiB,EAAE;EAC7C;;EAEA;EACA;EACA,MAAME,WAAW,GAAG,IAAAC,iBAAM,EAACH,iBAAiB,CAAC,CAACI,SAAS,CAAC,CAAC;EACzD,MAAMC,WAAW,GAAG,IAAAF,iBAAM,EAACJ,eAAe,CAAC,CAACK,SAAS,CAAC,CAAC;EACvD,IACEC,WAAW,GAAGH,WAAW,GAAG,IAAI,IAChCG,WAAW,GAAGH,WAAW,GAAG,IAAI,IAChCI,IAAI,CAACC,GAAG,CAACF,WAAW,GAAGH,WAAW,CAAC,GAAG,GAAG,EACzC;IACA,OAAOF,iBAAiB;EAC1B;;EAEA;EACA;EACA,OAAO,IAAAG,iBAAM,EAACJ,eAAe,CAAC,CAACK,SAAS,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,GAAG,SAAS;AAC1E","ignoreList":[]}
|
package/lib/storage.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function storeItem(key: string, object: unknown): void;
|
|
|
6
6
|
* Retrieve a javascript object at the specified key. If not found, defaults to
|
|
7
7
|
* null or, the optionally provided notFoundValue.
|
|
8
8
|
*/
|
|
9
|
-
export declare function getItem(key: string, notFoundValue?:
|
|
9
|
+
export declare function getItem<T>(key: string, notFoundValue?: T | null): T | null;
|
|
10
10
|
/**
|
|
11
11
|
* Remove item at specified key.
|
|
12
12
|
*/
|