@opentripplanner/core-utils 13.0.0-alpha.1 → 13.0.0-alpha.3
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/LICENSE +21 -0
- package/README.md +3 -0
- package/esm/graphql.d.js.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/itinerary.js +78 -115
- package/esm/itinerary.js.map +1 -1
- package/esm/map.js +3 -3
- package/esm/map.js.map +1 -1
- package/esm/profile.js +17 -18
- package/esm/profile.js.map +1 -1
- package/esm/query-gen.js +35 -45
- package/esm/query-gen.js.map +1 -1
- package/esm/query.js +135 -191
- package/esm/query.js.map +1 -1
- package/esm/route.js +74 -97
- package/esm/route.js.map +1 -1
- package/esm/storage.js +4 -5
- package/esm/storage.js.map +1 -1
- package/esm/suspense.js +1 -3
- package/esm/suspense.js.map +1 -1
- package/esm/time.js +13 -17
- package/esm/time.js.map +1 -1
- package/esm/ui.js +0 -5
- package/esm/ui.js.map +1 -1
- package/lib/graphql.d.js.map +1 -1
- package/lib/index.js +3 -19
- package/lib/index.js.map +1 -1
- package/lib/itinerary.js +114 -199
- package/lib/itinerary.js.map +1 -1
- package/lib/map.d.ts +1 -1
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +9 -20
- package/lib/map.js.map +1 -1
- package/lib/profile.js +17 -19
- package/lib/profile.js.map +1 -1
- package/lib/query-gen.d.ts +4 -4
- package/lib/query-gen.d.ts.map +1 -1
- package/lib/query-gen.js +34 -45
- package/lib/query-gen.js.map +1 -1
- package/lib/query-params.jsx +893 -0
- package/lib/query.js +66 -118
- package/lib/query.js.map +1 -1
- package/lib/route.js +73 -101
- package/lib/route.js.map +1 -1
- package/lib/storage.js +6 -11
- package/lib/storage.js.map +1 -1
- package/lib/suspense.d.ts +1 -1
- package/lib/suspense.d.ts.map +1 -1
- package/lib/suspense.js +3 -9
- package/lib/suspense.js.map +1 -1
- package/lib/time.js +19 -38
- package/lib/time.js.map +1 -1
- package/lib/ui.js +1 -8
- package/lib/ui.js.map +1 -1
- package/package.json +7 -8
- package/src/query-params.jsx +893 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/esm/query-params.js +0 -786
- package/esm/query-params.js.map +0 -1
- package/lib/query-params.js +0 -756
- package/lib/query-params.js.map +0 -1
- /package/{src/query-params.js → esm/query-params.jsx} +0 -0
package/lib/itinerary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/itinerary.ts"],"names":["transitModes","getTransitModes","config","modes","map","tm","mode","isTransitLeg","leg","transitLeg","isTransit","includes","isReservationRequired","boardRule","alightRule","isCoordinationRequired","containsGeometry","place","stop","geometries","undefined","endsWithGeometry","to","startsWithGeometry","from","legContainsGeometry","isAdvanceBookingRequired","info","latestBookingTime","daysPrior","legDropoffRequiresAdvanceBooking","dropOffBookingInfo","isFlex","pickupBookingInfo","isRideshareLeg","rideHailingEstimate","provider","id","isWalk","isBicycle","isBicycleRent","isCar","startsWith","isMicromobility","isAccessMode","hasTransit","modesStr","split","some","hasCar","hasBike","hasMicromobility","hasHail","indexOf","hasRental","getMapColor","get","toSentenceCase","str","String","charAt","toUpperCase","substr","toLowerCase","getCompanyFromLeg","rentedBike","rentedCar","rentedVehicle","networks","rentalVehicle","network","getItineraryBounds","itinerary","coords","legs","forEach","legCoords","polyline","toGeoJSON","legGeometry","points","coordinates","c","getLegBounds","length","push","lat","lon","legLocationAtDistance","distance","line","pt","units","geometry","e","legElevationAtDistance","traversed","unshift","i","start","elevDistanceSpan","console","warn","pct","elevSpan","mapOldElevationComponentToNew","oldElev","first","elevation","second","getElevationProfile","steps","unitConversion","minElev","maxElev","gain","loss","previous","step","stepElevationProfile","elevationProfile","Array","isArray","elev","diff","convertedElevation","getTextWidth","text","font","canvas","document","createElement","context","getContext","metrics","measureText","width","getCompanyForNetwork","networkString","companies","company","find","co","getCompaniesLabelFromNetworks","filter","label","join","getTNCLocation","type","location","toFixed","calculatePhysicalActivity","walkDuration","bikeDuration","duration","caloriesBurned","calculateTncFares","reduce","maxTNCFare","minTNCFare","minPrice","maxPrice","currencyCode","currency","code","amount","CARBON_INTENSITY_DEFAULTS","walk","bicycle","car","tram","trolleybus","subway","rail","bus","ferry","cable_car","gondola","funicular","transit","leg_switch","airplane","micromobility","calculateEmissions","carbonIntensity","carbonIntensityWithDefaults","totalCarbon","total","getDisplayedStopId","placeOrStop","stopId","stopCode","getLegCost","mediumId","riderCategoryId","fareProducts","price","relevantFareProducts","product","riderCategory","medium","totalCostProduct","fp","name","transferFareProduct","transferAmount","productUseId","getItineraryCost","legCosts","cost","prev","cur","p","productUse","pickupDropoffTypeToOtp1","otp2Type","convertGraphQLResponseToLegacy","agencyBrandingUrl","agency","url","agencyId","agencyName","agencyUrl","dropoffType","pickupType","gtfsId","route","shortName","routeColor","color","routeId","routeLongName","longName","routeShortName","routeTextColor","textColor","tripHeadsign","trip","tripId","getLegRouteShortName","getLegRouteLongName","getLegRouteName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAiBA;;AAEA;AACO,MAAMA,YAAY,GAAG,CAC1B,MAD0B,EAE1B,YAF0B,EAG1B,KAH0B,EAI1B,QAJ0B,EAK1B,OAL0B,EAM1B,MAN0B,EAO1B,SAP0B,CAArB;AAUP;AACA;AACA;AACA;;;;AAEO,SAASC,eAAT,CAAyBC,MAAzB,EAAmD;AACxD,MAAI,CAACA,MAAD,IAAW,CAACA,MAAM,CAACC,KAAnB,IAA4B,CAACD,MAAM,CAACC,KAAP,CAAaH,YAA9C,EACE,OAAOA,YAAP;AAEF,SAAOE,MAAM,CAACC,KAAP,CAAaH,YAAb,CAA0BI,GAA1B,CAA8BC,EAAE,IACrC,OAAOA,EAAP,KAAc,QAAd,GAAyBA,EAAE,CAACC,IAA5B,GAAmCD,EAD9B,CAAP;AAGD;;AAEM,SAASE,YAAT,CAAsBC,GAAtB,EAAyC;AAC9C,SAAOA,GAAG,CA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A,QAAQ,kBAAEvL,GAAG,CAACc,EAAJ,CAAOJ,IAAT,iDAAE,aAAakJ,IAFrB;AAGF0B,MAAAA,MAAM,mBAAEtL,GAAG,CAACc,EAAJ,CAAOJ,IAAT,kDAAE,cAAa+M;AAHnB,KAtB4D;AA2BhEW,IAAAA,YAAY,eAAEpO,GAAG,CAACqO,IAAN,8CAAE,UAAUD,YA3BwC;AA4BhEE,IAAAA,MAAM,gBAAEtO,GAAG,CAACqO,IAAN,+CAAE,WAAUZ;AA5B8C,GAApB;AAAA,CAAvC;AA+BP;;;;;AACO,MAAMc,oBAAoB,GAC/BvO,GADkC,IAEhB;AAClB,QAAM;AAAE0N,IAAAA,KAAF;AAASO,IAAAA;AAAT,MAA4BjO,GAAlC,CADkB,CAElB;;AACA,SAAO,OAAO0N,KAAP,KAAiB,QAAjB,GACHA,KADG,aACHA,KADG,uBACHA,KAAK,CAAEC,SADJ,GAEHM,cAAc,IAAKP,KAFvB;AAGD,CARM;AAUP;;;;;AACO,MAAMc,mBAAmB,GAC9BxO,GADiC,IAEf;AAClB,QAAM;AAAE0N,IAAAA,KAAF;AAASK,IAAAA;AAAT,MAA2B/N,GAAjC,CADkB,CAElB;;AACA,SAAO,OAAO0N,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,aAA4BA,KAA5B,uBAA4BA,KAAK,CAAEM,QAAnC,GAA8CD,aAArD;AACD,CANM;AAQP;AACA;AACA;AACA;;;;;AACO,MAAMU,eAAe,GAC1BzO,GAD6B,IAElB;AACX,SAAOuO,oBAAoB,CAACvO,GAAD,CAApB,IAA6BwO,mBAAmB,CAACxO,GAAD,CAAvD;AACD,CAJM","sourcesContent":["import polyline from \"@mapbox/polyline\";\nimport {\n Company,\n Config,\n ElevationProfile,\n ElevationProfileComponent,\n FlexBookingInfo,\n ItineraryOnlyLegsRequired,\n LatLngArray,\n Leg,\n MassUnitOption,\n Money,\n Place,\n Step,\n Stop,\n TncFare\n} from \"@opentripplanner/types\";\nimport turfAlong from \"@turf/along\";\n\n// All OTP transit modes\nexport const transitModes = [\n \"TRAM\",\n \"TROLLEYBUS\",\n \"BUS\",\n \"SUBWAY\",\n \"FERRY\",\n \"RAIL\",\n \"GONDOLA\"\n];\n\n/**\n * @param {config} config OTP-RR configuration object\n * @return {Array} List of all transit modes defined in config; otherwise default mode list\n */\n\nexport function getTransitModes(config: Config): string[] {\n if (!config || !config.modes || !config.modes.transitModes)\n return transitModes;\n\n return config.modes.transitModes.map(tm =>\n typeof tm !== \"string\" ? tm.mode : tm\n );\n}\n\nexport function isTransitLeg(leg: Leg): boolean {\n return leg.transitLeg;\n}\n\nexport function isTransit(mode: string): boolean {\n return transitModes.includes(mode) || mode === \"TRANSIT\";\n}\n\n/**\n * Returns true if the leg pickup rules enabled which require\n * calling ahead for the service to run. \"mustPhone\" is the only\n * property which encodes this info.\n */\nexport function isReservationRequired(leg: Leg): boolean {\n return leg?.boardRule === \"mustPhone\" || leg?.alightRule === \"mustPhone\";\n}\n/**\n * Returns true if a user must ask the driver to let the user off\n * or if the user must flag the driver down for pickup.\n * \"coordinateWithDriver\" in board/alight rule encodes this info.\n */\nexport function isCoordinationRequired(leg: Leg): boolean {\n return (\n leg?.boardRule === \"coordinateWithDriver\" ||\n leg?.alightRule === \"coordinateWithDriver\"\n );\n}\n\nexport function containsGeometry(place: Place): boolean {\n return (\n place?.stop?.geometries !== null && place?.stop?.geometries !== undefined\n );\n}\nexport function endsWithGeometry(leg: Leg): boolean {\n return containsGeometry(leg?.to);\n}\nexport function startsWithGeometry(leg: Leg): boolean {\n return containsGeometry(leg?.from);\n}\nexport function legContainsGeometry(leg: Leg): boolean {\n return endsWithGeometry(leg) || startsWithGeometry(leg);\n}\nexport function isAdvanceBookingRequired(info: FlexBookingInfo): boolean {\n return info?.latestBookingTime?.daysPrior > 0;\n}\nexport function legDropoffRequiresAdvanceBooking(leg: Leg): boolean {\n return isAdvanceBookingRequired(leg?.dropOffBookingInfo);\n}\n\n/**\n * The two rules checked by the above two functions are the only values\n * returned by OTP when a leg is a flex leg.\n */\nexport function isFlex(leg: Leg): boolean {\n return (\n isReservationRequired(leg) ||\n isCoordinationRequired(leg) ||\n legDropoffRequiresAdvanceBooking(leg) ||\n isAdvanceBookingRequired(leg?.pickupBookingInfo) ||\n legContainsGeometry(leg)\n );\n}\n\n// alpha-only comment\nexport function isRideshareLeg(leg: Leg): boolean {\n return !!leg.rideHailingEstimate?.provider?.id;\n}\n\nexport function isWalk(mode: string): boolean {\n if (!mode) return false;\n\n return mode === \"WALK\";\n}\n\nexport function isBicycle(mode: string): boolean {\n if (!mode) return false;\n\n return mode === \"BICYCLE\";\n}\n\nexport function isBicycleRent(mode: string): boolean {\n if (!mode) return false;\n\n return mode === \"BICYCLE_RENT\";\n}\n\nexport function isCar(mode: string): boolean {\n if (!mode) return false;\n return mode.startsWith(\"CAR\");\n}\n\nexport function isMicromobility(mode: string): boolean {\n if (!mode) return false;\n return mode.startsWith(\"MICROMOBILITY\") || mode.startsWith(\"SCOOTER\");\n}\n\nexport function isAccessMode(mode: string): boolean {\n return (\n isWalk(mode) ||\n isBicycle(mode) ||\n isBicycleRent(mode) ||\n isCar(mode) ||\n isMicromobility(mode)\n );\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are transit modes\n */\nexport function hasTransit(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => isTransit(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are car-based modes\n */\nexport function hasCar(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => isCar(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are bicycle-based modes\n */\nexport function hasBike(modesStr: string): boolean {\n return modesStr\n .split(\",\")\n .some(mode => isBicycle(mode) || isBicycleRent(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are micromobility-based modes\n */\nexport function hasMicromobility(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => isMicromobility(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a hailing mode\n */\nexport function hasHail(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_HAIL\") > -1);\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a rental mode\n */\nexport function hasRental(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_RENT\") > -1);\n}\n\nexport function getMapColor(mode: string): string {\n mode = mode || this.get(\"mode\");\n if (mode === \"WALK\") return \"#444\";\n if (mode === \"BICYCLE\") return \"#0073e5\";\n if (mode === \"SUBWAY\") return \"#e60000\";\n if (mode === \"RAIL\") return \"#b00\";\n if (mode === \"BUS\") return \"#080\";\n if (mode === \"TROLLEYBUS\") return \"#080\";\n if (mode === \"TRAM\") return \"#800\";\n if (mode === \"FERRY\") return \"#008\";\n if (mode === \"CAR\") return \"#444\";\n if (mode === \"MICROMOBILITY\" || mode === \"SCOOTER\") return \"#f5a729\";\n return \"#aaa\";\n}\n\nexport function toSentenceCase(str: string): string {\n if (str == null) {\n return \"\";\n }\n str = String(str);\n return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();\n}\n\n/**\n * Derive the company string based on mode and network associated with leg.\n */\nexport function getCompanyFromLeg(leg: Leg): string {\n if (!leg) return null;\n const {\n from,\n mode,\n rentedBike,\n rentedCar,\n rentedVehicle,\n rideHailingEstimate\n } = leg;\n if (mode === \"CAR\" && rentedCar) {\n return from.networks[0];\n }\n if (mode === \"CAR\" && rideHailingEstimate) {\n return rideHailingEstimate.provider.id;\n }\n if (mode === \"BICYCLE\" && rentedBike && from.networks) {\n return from.networks[0];\n }\n if (from.rentalVehicle) {\n return from.rentalVehicle.network;\n }\n if (\n (mode === \"MICROMOBILITY\" || mode === \"SCOOTER\") &&\n rentedVehicle &&\n from.networks\n ) {\n return from.networks[0];\n }\n return null;\n}\n\nexport function getItineraryBounds(\n itinerary: ItineraryOnlyLegsRequired\n): LatLngArray[] {\n let coords = [];\n itinerary.legs.forEach(leg => {\n const legCoords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map((c: number[]) => [c[1], c[0]]);\n coords = [...coords, ...legCoords];\n });\n return coords;\n}\n\n/**\n * Return a coords object that encloses the given leg's geometry.\n */\nexport function getLegBounds(leg: Leg): number[][] {\n const coords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map(c => [c[1], c[0]]);\n\n // in certain cases, there might be zero-length coordinates in the leg\n // geometry. In these cases, build us an array of coordinates using the from\n // and to data of the leg.\n if (coords.length === 0) {\n coords.push([leg.from.lat, leg.from.lon], [leg.to.lat, leg.to.lon]);\n }\n return coords;\n}\n\n/* Returns an interpolated lat-lon at a specified distance along a leg */\n\nexport function legLocationAtDistance(leg: Leg, distance: number): number[] {\n if (!leg.legGeometry) return null;\n\n try {\n const line = polyline.toGeoJSON(leg.legGeometry.points);\n const pt = turfAlong(line, distance, { units: \"meters\" });\n if (pt && pt.geometry && pt.geometry.coordinates) {\n return [pt.geometry.coordinates[1], pt.geometry.coordinates[0]];\n }\n } catch (e) {\n // FIXME handle error!\n }\n\n return null;\n}\n\n/* Returns an interpolated elevation at a specified distance along a leg */\n\nexport function legElevationAtDistance(\n points: number[][],\n distance: number\n): number {\n // Iterate through the combined elevation profile\n let traversed = 0;\n // If first point distance is not zero, insert starting point at zero with\n // null elevation. Encountering this value should trigger the warning below.\n if (points[0][0] > 0) {\n points.unshift([0, null]);\n }\n for (let i = 1; i < points.length; i++) {\n const start = points[i - 1];\n const elevDistanceSpan = points[i][0] - start[0];\n if (distance >= traversed && distance <= traversed + elevDistanceSpan) {\n // Distance falls within this point and the previous one;\n // compute & return interpolated elevation value\n if (start[1] === null) {\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n }\n const pct = (distance - traversed) / elevDistanceSpan;\n const elevSpan = points[i][1] - start[1];\n return start[1] + elevSpan * pct;\n }\n traversed += elevDistanceSpan;\n }\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n}\n\nexport function mapOldElevationComponentToNew(oldElev: {\n first: number;\n second: number;\n}): ElevationProfileComponent {\n return {\n distance: oldElev.first,\n elevation: oldElev.second\n };\n}\n\n// Iterate through the steps, building the array of elevation points and\n// keeping track of the minimum and maximum elevations reached\nexport function getElevationProfile(\n steps: Step[],\n unitConversion = 1\n): ElevationProfile {\n let minElev = 100000;\n let maxElev = -100000;\n let traversed = 0;\n let gain = 0;\n let loss = 0;\n let previous: ElevationProfileComponent | null = null;\n const points = [];\n steps.forEach(step => {\n // Support for old REST response data (in step.elevation)\n const stepElevationProfile =\n step.elevationProfile ||\n (Array.isArray(step.elevation) &&\n step.elevation?.map<ElevationProfileComponent>(\n mapOldElevationComponentToNew\n ));\n\n if (!stepElevationProfile || stepElevationProfile.length === 0) {\n traversed += step.distance;\n return;\n }\n for (let i = 0; i < stepElevationProfile.length; i++) {\n const elev = stepElevationProfile[i];\n if (previous) {\n const diff = (elev.elevation - previous.elevation) * unitConversion;\n if (diff > 0) gain += diff;\n else loss += diff;\n }\n if (i === 0 && elev.distance !== 0) {\n // console.warn(`No elevation data available for step ${stepIndex}-${i} at beginning of segment`, elev)\n }\n const convertedElevation = elev.elevation * unitConversion;\n if (convertedElevation < minElev) minElev = convertedElevation;\n if (convertedElevation > maxElev) maxElev = convertedElevation;\n points.push([traversed + elev.distance, elev.elevation]);\n // Insert \"filler\" point if the last point in elevation profile does not\n // reach the full distance of the step.\n if (\n i === stepElevationProfile.length - 1 &&\n elev.distance !== step.distance\n ) {\n // points.push([traversed + step.distance, elev.second])\n }\n previous = elev;\n }\n traversed += step.distance;\n });\n return { maxElev, minElev, points, traversed, gain, loss };\n}\n\n/**\n * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n *\n * @param {string} text The text to be rendered.\n * @param {string} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n *\n * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n */\nexport function getTextWidth(text: string, font = \"22px Arial\"): number {\n // Create custom type for function including reused canvas object\n type GetTextWidth = typeof getTextWidth & { canvas: HTMLCanvasElement };\n\n // reuse canvas object for better performance\n const canvas =\n (getTextWidth as GetTextWidth).canvas ||\n ((getTextWidth as GetTextWidth).canvas = document.createElement(\"canvas\"));\n const context = canvas.getContext(\"2d\");\n context.font = font;\n const metrics = context.measureText(text);\n return metrics.width;\n}\n\n/**\n * Get the configured company object for the given network string if the company\n * has been defined in the provided companies array config.\n */\nexport function getCompanyForNetwork(\n networkString: string,\n companies: Company[] = []\n): Company {\n const company = companies.find(co => co.id === networkString);\n if (!company) {\n console.warn(\n `No company found in config.yml that matches rented vehicle network: ${networkString}`,\n companies\n );\n }\n return company;\n}\n\n/**\n * Get a string label to display from a list of vehicle rental networks.\n *\n * @param {Array<string>} networks A list of network ids.\n * @param {Array<object>} [companies=[]] An optional list of the companies config.\n * @return {string} A label for use in presentation on a website.\n */\nexport function getCompaniesLabelFromNetworks(\n networks: string[] | string,\n companies: Company[] = []\n): string {\n return (Array.isArray(networks) ? networks : [networks])\n .map(network => getCompanyForNetwork(network, companies))\n .filter(co => !!co)\n .map(co => co.label)\n .join(\"/\");\n}\n\nexport function getTNCLocation(leg: Leg, type: string): string {\n const location = leg[type];\n return `${location.lat.toFixed(5)},${location.lon.toFixed(5)}`;\n}\n\nexport function calculatePhysicalActivity(\n itinerary: ItineraryOnlyLegsRequired\n): {\n bikeDuration: number;\n caloriesBurned: number;\n walkDuration: number;\n} {\n let walkDuration = 0;\n let bikeDuration = 0;\n itinerary.legs.forEach(leg => {\n if (leg.mode.startsWith(\"WALK\")) walkDuration += leg.duration;\n if (leg.mode.startsWith(\"BICYCLE\")) bikeDuration += leg.duration;\n });\n const caloriesBurned =\n (walkDuration / 3600) * 280 + (bikeDuration / 3600) * 290;\n return {\n bikeDuration,\n caloriesBurned,\n walkDuration\n };\n}\n\n/**\n * For an itinerary, calculates the TNC fares and returns an object with\n * these values and currency info.\n * It is assumed that the same currency is used for all TNC legs.\n */\nexport function calculateTncFares(\n itinerary: ItineraryOnlyLegsRequired\n): TncFare {\n return itinerary.legs\n .filter(leg => leg.mode === \"CAR\" && leg.rideHailingEstimate)\n .reduce(\n ({ maxTNCFare, minTNCFare }, { rideHailingEstimate }) => {\n const { minPrice, maxPrice } = rideHailingEstimate;\n return {\n // Assumes a single currency for entire itinerary.\n currencyCode: minPrice.currency.code,\n maxTNCFare: maxTNCFare + maxPrice.amount,\n minTNCFare: minTNCFare + minPrice.amount\n };\n },\n {\n currencyCode: null,\n maxTNCFare: 0,\n minTNCFare: 0\n }\n );\n}\n\n/**\n * Sources:\n * - https://www.itf-oecd.org/sites/default/files/docs/environmental-performance-new-mobility.pdf\n * - https://www.thrustcarbon.com/insights/how-to-calculate-emissions-from-a-ferry-journey\n * - https://www.itf-oecd.org/sites/default/files/life-cycle-assessment-calculations-2020.xlsx\n * Other values extrapolated.\n */\nconst CARBON_INTENSITY_DEFAULTS = {\n walk: 0.026,\n bicycle: 0.017,\n car: 0.162,\n tram: 0.066,\n trolleybus: 0.066,\n subway: 0.066,\n rail: 0.066,\n bus: 0.09,\n ferry: 0.082,\n cable_car: 0.021,\n gondola: 0.021,\n funicular: 0.066,\n transit: 0.066,\n leg_switch: 0,\n airplane: 0.382,\n micromobility: 0.095\n};\n\n/**\n * @param {itinerary} itinerary OTP trip itinierary, only legs is required.\n * @param {carbonIntensity} carbonIntensity carbon intensity by mode in grams/meter\n * @param {units} units units to be used in return value\n * @return Amount of carbon in chosen unit\n */\nexport function calculateEmissions(\n // This type makes all the properties from Itinerary optional except legs.\n itinerary: ItineraryOnlyLegsRequired,\n carbonIntensity: Record<string, number> = {},\n units?: MassUnitOption\n): number {\n // Apply defaults for any values that we don't have.\n const carbonIntensityWithDefaults = {\n ...CARBON_INTENSITY_DEFAULTS,\n ...carbonIntensity\n };\n\n // Distance is in meters, totalCarbon is in grams\n const totalCarbon =\n itinerary?.legs?.reduce((total, leg) => {\n return (\n (leg.distance * carbonIntensityWithDefaults[leg.mode.toLowerCase()] ||\n 0) + total\n );\n }, 0) || 0;\n\n switch (units) {\n case \"ounce\":\n return totalCarbon / 28.35;\n case \"kilogram\":\n return totalCarbon / 1000;\n case \"pound\":\n return totalCarbon / 454;\n case \"gram\":\n default:\n return totalCarbon;\n }\n}\n\n/**\n * Returns the user-facing stop id to display for a stop or place, using the following priority:\n * 1. stop code,\n * 2. stop id without the agency id portion, if stop id contains an agency portion,\n * 3. stop id, whether null or not (this is the fallback case).\n */\nexport function getDisplayedStopId(placeOrStop: Place | Stop): string {\n let stopId;\n let stopCode;\n if (\"stopId\" in placeOrStop) {\n ({ stopCode, stopId } = placeOrStop);\n } else if (\"id\" in placeOrStop) {\n ({ code: stopCode, id: stopId } = placeOrStop);\n }\n return stopCode || stopId?.split(\":\")[1] || stopId;\n}\n\n/**\n * Extracts useful data from the fare products on a leg, such as the leg cost and transfer info.\n * @param leg Leg with fare products (must have used getLegsWithFares)\n * @param category Rider category\n * @param container Fare container (cash, electronic)\n * @returns Object containing price as well as the transfer discount amount, if a transfer was used.\n */\nexport function getLegCost(\n leg: Leg,\n mediumId: string | null,\n riderCategoryId: string | null\n): {\n price?: Money;\n transferAmount?: Money | undefined;\n productUseId?: string;\n} {\n if (!leg.fareProducts) return { price: undefined };\n const relevantFareProducts = leg.fareProducts.filter(({ product }) => {\n // riderCategory and medium can be specifically defined as null to handle\n // generic GTFS based fares from OTP when there is no fare model\n return (\n (product.riderCategory === null ? null : product.riderCategory.id) ===\n riderCategoryId &&\n (product.medium === null ? null : product.medium.id) === mediumId\n );\n });\n\n // Custom fare models return \"rideCost\", generic GTFS fares return \"regular\"\n const totalCostProduct = relevantFareProducts.find(\n fp => fp.product.name === \"rideCost\" || fp.product.name === \"regular\"\n );\n const transferFareProduct = relevantFareProducts.find(\n fp => fp.product.name === \"transfer\"\n );\n\n return {\n price: totalCostProduct?.product.price,\n transferAmount: transferFareProduct?.product.price,\n productUseId: totalCostProduct?.id\n };\n}\n\n/**\n * Returns the total itinerary cost for a given set of legs.\n * @param legs Itinerary legs with fare products (must have used getLegsWithFares)\n * @param category Rider category (youth, regular, senior)\n * @param container Fare container (cash, electronic)\n * @returns Money object for the total itinerary cost.\n */\nexport function getItineraryCost(\n legs: Leg[],\n mediumId: string | null,\n riderCategoryId: string | null\n): Money | undefined {\n const legCosts = legs\n // Only legs with fares (no walking legs)\n .filter(leg => leg.fareProducts?.length > 0)\n // Get the leg cost object of each leg\n .map(leg => getLegCost(leg, mediumId, riderCategoryId))\n .filter(cost => cost.price !== undefined)\n // Filter out duplicate use IDs\n // One fare product can be used on multiple legs,\n // and we don't want to count it more than once.\n .reduce<{ productUseId: string; price: Money }[]>((prev, cur) => {\n if (!prev.some(p => p.productUseId === cur.productUseId)) {\n prev.push({ productUseId: cur.productUseId, price: cur.price });\n }\n return prev;\n }, [])\n .map(productUse => productUse.price);\n\n if (legCosts.length === 0) return undefined;\n // Calculate the total\n return legCosts.reduce<Money>(\n (prev, cur) => ({\n amount: prev.amount + cur?.amount || 0,\n currency: prev.currency ?? cur?.currency\n }),\n { amount: 0, currency: null }\n );\n}\n\nconst pickupDropoffTypeToOtp1 = otp2Type => {\n switch (otp2Type) {\n case \"COORDINATE_WITH_DRIVER\":\n return \"coordinateWithDriver\";\n case \"CALL_AGENCY\":\n return \"mustPhone\";\n case \"SCHEDULED\":\n return \"scheduled\";\n case \"NONE\":\n return \"none\";\n default:\n return null;\n }\n};\n\nexport const convertGraphQLResponseToLegacy = (leg: any): any => ({\n ...leg,\n agencyBrandingUrl: leg.agency?.url,\n agencyId: leg.agency?.id,\n agencyName: leg.agency?.name,\n agencyUrl: leg.agency?.url,\n alightRule: pickupDropoffTypeToOtp1(leg.dropoffType),\n boardRule: pickupDropoffTypeToOtp1(leg.pickupType),\n dropOffBookingInfo: {\n latestBookingTime: leg.dropOffBookingInfo\n },\n from: {\n ...leg.from,\n stopCode: leg.from.stop?.code,\n stopId: leg.from.stop?.gtfsId\n },\n route: leg.route?.shortName,\n routeColor: leg.route?.color,\n routeId: leg.route?.gtfsId,\n routeLongName: leg.route?.longName,\n routeShortName: leg.route?.shortName,\n routeTextColor: leg.route?.textColor,\n to: {\n ...leg.to,\n stopCode: leg.to.stop?.code,\n stopId: leg.to.stop?.gtfsId\n },\n tripHeadsign: leg.trip?.tripHeadsign,\n tripId: leg.trip?.gtfsId\n});\n\n/** Extracts the route number for a leg returned from OTP1 or OTP2. */\nexport const getLegRouteShortName = (\n leg: Pick<Leg, \"route\" | \"routeShortName\">\n): string | null => {\n const { route, routeShortName } = leg;\n // typeof route === \"object\" denotes newer OTP2 responses. routeShortName and route as string is OTP1.\n return typeof route === \"object\"\n ? route?.shortName\n : routeShortName || (route as string);\n};\n\n/** Extract the route long name for a leg returned from OTP1 or OTP2. */\nexport const getLegRouteLongName = (\n leg: Pick<Leg, \"route\" | \"routeLongName\">\n): string | null => {\n const { route, routeLongName } = leg;\n // typeof route === \"object\" denotes newer OTP2 responses. routeLongName is OTP1.\n return typeof route === \"object\" ? route?.longName : routeLongName;\n};\n\n/**\n * Returns the route short name, or the route long name if no short name is provided.\n * This is happens with Seattle area streetcars and ferries.\n */\nexport const getLegRouteName = (\n leg: Pick<Leg, \"route\" | \"routeLongName\" | \"routeShortName\">\n): string => {\n return getLegRouteShortName(leg) || getLegRouteLongName(leg);\n};\n"],"file":"itinerary.js"}
|
|
1
|
+
{"version":3,"file":"itinerary.js","names":["_polyline","_interopRequireDefault","require","_along","transitModes","exports","getTransitModes","config","modes","map","tm","mode","isTransitLeg","leg","transitLeg","isTransit","includes","isReservationRequired","boardRule","alightRule","isCoordinationRequired","containsGeometry","place","_place$stop","_place$stop2","stop","geometries","undefined","endsWithGeometry","to","startsWithGeometry","from","legContainsGeometry","isAdvanceBookingRequired","info","_info$latestBookingTi","latestBookingTime","daysPrior","legDropoffRequiresAdvanceBooking","dropOffBookingInfo","isFlex","pickupBookingInfo","isRideshareLeg","_leg$rideHailingEstim","rideHailingEstimate","provider","id","isWalk","isBicycle","isBicycleRent","isCar","startsWith","isMicromobility","isAccessMode","hasTransit","modesStr","split","some","hasCar","hasBike","hasMicromobility","hasHail","indexOf","hasRental","getMapColor","get","toSentenceCase","str","String","charAt","toUpperCase","substr","toLowerCase","getCompanyFromLeg","rentedBike","rentedCar","rentedVehicle","networks","rentalVehicle","network","getItineraryBounds","itinerary","coords","legs","forEach","legCoords","polyline","toGeoJSON","legGeometry","points","coordinates","c","getLegBounds","length","push","lat","lon","legLocationAtDistance","distance","line","pt","turfAlong","units","geometry","e","legElevationAtDistance","traversed","unshift","i","start","elevDistanceSpan","console","warn","pct","elevSpan","mapOldElevationComponentToNew","oldElev","first","elevation","second","getElevationProfile","steps","unitConversion","minElev","maxElev","gain","loss","previous","step","_step$elevation","stepElevationProfile","elevationProfile","Array","isArray","elev","diff","convertedElevation","getTextWidth","text","font","canvas","document","createElement","context","getContext","metrics","measureText","width","getCompanyForNetwork","networkString","companies","company","find","co","getCompaniesLabelFromNetworks","filter","label","join","getTNCLocation","type","location","toFixed","calculatePhysicalActivity","walkDuration","bikeDuration","duration","caloriesBurned","calculateTncFares","reduce","maxTNCFare","minTNCFare","minPrice","maxPrice","currencyCode","currency","code","amount","CARBON_INTENSITY_DEFAULTS","walk","bicycle","car","tram","trolleybus","subway","rail","bus","ferry","cable_car","gondola","funicular","transit","leg_switch","airplane","micromobility","calculateEmissions","carbonIntensity","_itinerary$legs","carbonIntensityWithDefaults","totalCarbon","total","getDisplayedStopId","placeOrStop","_stopId","stopId","stopCode","getLegCost","mediumId","riderCategoryId","fareProducts","price","relevantFareProducts","product","riderCategory","medium","totalCostProduct","fp","name","transferFareProduct","transferAmount","productUseId","getItineraryCost","legCosts","_leg$fareProducts","cost","prev","cur","p","productUse","_prev$currency","pickupDropoffTypeToOtp1","otp2Type","convertGraphQLResponseToLegacy","_leg$agency","_leg$agency2","_leg$agency3","_leg$agency4","_leg$from$stop","_leg$from$stop2","_leg$route","_leg$route2","_leg$route3","_leg$route4","_leg$route5","_leg$route6","_leg$to$stop","_leg$to$stop2","_leg$trip","_leg$trip2","agencyBrandingUrl","agency","url","agencyId","agencyName","agencyUrl","dropoffType","pickupType","gtfsId","route","shortName","routeColor","color","routeId","routeLongName","longName","routeShortName","routeTextColor","textColor","tripHeadsign","trip","tripId","getLegRouteShortName","getLegRouteLongName","getLegRouteName"],"sources":["../src/itinerary.ts"],"sourcesContent":["import polyline from \"@mapbox/polyline\";\nimport {\n Company,\n Config,\n ElevationProfile,\n ElevationProfileComponent,\n FlexBookingInfo,\n ItineraryOnlyLegsRequired,\n LatLngArray,\n Leg,\n MassUnitOption,\n Money,\n Place,\n Step,\n Stop,\n TncFare\n} from \"@opentripplanner/types\";\nimport turfAlong from \"@turf/along\";\n\n// All OTP transit modes\nexport const transitModes = [\n \"TRAM\",\n \"TROLLEYBUS\",\n \"BUS\",\n \"SUBWAY\",\n \"FERRY\",\n \"RAIL\",\n \"GONDOLA\"\n];\n\n/**\n * @param {config} config OTP-RR configuration object\n * @return {Array} List of all transit modes defined in config; otherwise default mode list\n */\n\nexport function getTransitModes(config: Config): string[] {\n if (!config || !config.modes || !config.modes.transitModes)\n return transitModes;\n\n return config.modes.transitModes.map(tm =>\n typeof tm !== \"string\" ? tm.mode : tm\n );\n}\n\nexport function isTransitLeg(leg: Leg): boolean {\n return leg.transitLeg;\n}\n\nexport function isTransit(mode: string): boolean {\n return transitModes.includes(mode) || mode === \"TRANSIT\";\n}\n\n/**\n * Returns true if the leg pickup rules enabled which require\n * calling ahead for the service to run. \"mustPhone\" is the only\n * property which encodes this info.\n */\nexport function isReservationRequired(leg: Leg): boolean {\n return leg?.boardRule === \"mustPhone\" || leg?.alightRule === \"mustPhone\";\n}\n/**\n * Returns true if a user must ask the driver to let the user off\n * or if the user must flag the driver down for pickup.\n * \"coordinateWithDriver\" in board/alight rule encodes this info.\n */\nexport function isCoordinationRequired(leg: Leg): boolean {\n return (\n leg?.boardRule === \"coordinateWithDriver\" ||\n leg?.alightRule === \"coordinateWithDriver\"\n );\n}\n\nexport function containsGeometry(place: Place): boolean {\n return (\n place?.stop?.geometries !== null && place?.stop?.geometries !== undefined\n );\n}\nexport function endsWithGeometry(leg: Leg): boolean {\n return containsGeometry(leg?.to);\n}\nexport function startsWithGeometry(leg: Leg): boolean {\n return containsGeometry(leg?.from);\n}\nexport function legContainsGeometry(leg: Leg): boolean {\n return endsWithGeometry(leg) || startsWithGeometry(leg);\n}\nexport function isAdvanceBookingRequired(info: FlexBookingInfo): boolean {\n return info?.latestBookingTime?.daysPrior > 0;\n}\nexport function legDropoffRequiresAdvanceBooking(leg: Leg): boolean {\n return isAdvanceBookingRequired(leg?.dropOffBookingInfo);\n}\n\n/**\n * The two rules checked by the above two functions are the only values\n * returned by OTP when a leg is a flex leg.\n */\nexport function isFlex(leg: Leg): boolean {\n return (\n isReservationRequired(leg) ||\n isCoordinationRequired(leg) ||\n legDropoffRequiresAdvanceBooking(leg) ||\n isAdvanceBookingRequired(leg?.pickupBookingInfo) ||\n legContainsGeometry(leg)\n );\n}\n\n// alpha-only comment\nexport function isRideshareLeg(leg: Leg): boolean {\n return !!leg.rideHailingEstimate?.provider?.id;\n}\n\nexport function isWalk(mode: string): boolean {\n if (!mode) return false;\n\n return mode === \"WALK\";\n}\n\nexport function isBicycle(mode: string): boolean {\n if (!mode) return false;\n\n return mode === \"BICYCLE\";\n}\n\nexport function isBicycleRent(mode: string): boolean {\n if (!mode) return false;\n\n return mode === \"BICYCLE_RENT\";\n}\n\nexport function isCar(mode: string): boolean {\n if (!mode) return false;\n return mode.startsWith(\"CAR\");\n}\n\nexport function isMicromobility(mode: string): boolean {\n if (!mode) return false;\n return mode.startsWith(\"MICROMOBILITY\") || mode.startsWith(\"SCOOTER\");\n}\n\nexport function isAccessMode(mode: string): boolean {\n return (\n isWalk(mode) ||\n isBicycle(mode) ||\n isBicycleRent(mode) ||\n isCar(mode) ||\n isMicromobility(mode)\n );\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are transit modes\n */\nexport function hasTransit(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => isTransit(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are car-based modes\n */\nexport function hasCar(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => isCar(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are bicycle-based modes\n */\nexport function hasBike(modesStr: string): boolean {\n return modesStr\n .split(\",\")\n .some(mode => isBicycle(mode) || isBicycleRent(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are micromobility-based modes\n */\nexport function hasMicromobility(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => isMicromobility(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a hailing mode\n */\nexport function hasHail(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_HAIL\") > -1);\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a rental mode\n */\nexport function hasRental(modesStr: string): boolean {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_RENT\") > -1);\n}\n\nexport function getMapColor(mode: string): string {\n mode = mode || this.get(\"mode\");\n if (mode === \"WALK\") return \"#444\";\n if (mode === \"BICYCLE\") return \"#0073e5\";\n if (mode === \"SUBWAY\") return \"#e60000\";\n if (mode === \"RAIL\") return \"#b00\";\n if (mode === \"BUS\") return \"#080\";\n if (mode === \"TROLLEYBUS\") return \"#080\";\n if (mode === \"TRAM\") return \"#800\";\n if (mode === \"FERRY\") return \"#008\";\n if (mode === \"CAR\") return \"#444\";\n if (mode === \"MICROMOBILITY\" || mode === \"SCOOTER\") return \"#f5a729\";\n return \"#aaa\";\n}\n\nexport function toSentenceCase(str: string): string {\n if (str == null) {\n return \"\";\n }\n str = String(str);\n return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();\n}\n\n/**\n * Derive the company string based on mode and network associated with leg.\n */\nexport function getCompanyFromLeg(leg: Leg): string {\n if (!leg) return null;\n const {\n from,\n mode,\n rentedBike,\n rentedCar,\n rentedVehicle,\n rideHailingEstimate\n } = leg;\n if (mode === \"CAR\" && rentedCar) {\n return from.networks[0];\n }\n if (mode === \"CAR\" && rideHailingEstimate) {\n return rideHailingEstimate.provider.id;\n }\n if (mode === \"BICYCLE\" && rentedBike && from.networks) {\n return from.networks[0];\n }\n if (from.rentalVehicle) {\n return from.rentalVehicle.network;\n }\n if (\n (mode === \"MICROMOBILITY\" || mode === \"SCOOTER\") &&\n rentedVehicle &&\n from.networks\n ) {\n return from.networks[0];\n }\n return null;\n}\n\nexport function getItineraryBounds(\n itinerary: ItineraryOnlyLegsRequired\n): LatLngArray[] {\n let coords = [];\n itinerary.legs.forEach(leg => {\n const legCoords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map((c: number[]) => [c[1], c[0]]);\n coords = [...coords, ...legCoords];\n });\n return coords;\n}\n\n/**\n * Return a coords object that encloses the given leg's geometry.\n */\nexport function getLegBounds(leg: Leg): number[][] {\n const coords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map(c => [c[1], c[0]]);\n\n // in certain cases, there might be zero-length coordinates in the leg\n // geometry. In these cases, build us an array of coordinates using the from\n // and to data of the leg.\n if (coords.length === 0) {\n coords.push([leg.from.lat, leg.from.lon], [leg.to.lat, leg.to.lon]);\n }\n return coords;\n}\n\n/* Returns an interpolated lat-lon at a specified distance along a leg */\n\nexport function legLocationAtDistance(leg: Leg, distance: number): number[] {\n if (!leg.legGeometry) return null;\n\n try {\n const line = polyline.toGeoJSON(leg.legGeometry.points);\n const pt = turfAlong(line, distance, { units: \"meters\" });\n if (pt && pt.geometry && pt.geometry.coordinates) {\n return [pt.geometry.coordinates[1], pt.geometry.coordinates[0]];\n }\n } catch (e) {\n // FIXME handle error!\n }\n\n return null;\n}\n\n/* Returns an interpolated elevation at a specified distance along a leg */\n\nexport function legElevationAtDistance(\n points: number[][],\n distance: number\n): number {\n // Iterate through the combined elevation profile\n let traversed = 0;\n // If first point distance is not zero, insert starting point at zero with\n // null elevation. Encountering this value should trigger the warning below.\n if (points[0][0] > 0) {\n points.unshift([0, null]);\n }\n for (let i = 1; i < points.length; i++) {\n const start = points[i - 1];\n const elevDistanceSpan = points[i][0] - start[0];\n if (distance >= traversed && distance <= traversed + elevDistanceSpan) {\n // Distance falls within this point and the previous one;\n // compute & return interpolated elevation value\n if (start[1] === null) {\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n }\n const pct = (distance - traversed) / elevDistanceSpan;\n const elevSpan = points[i][1] - start[1];\n return start[1] + elevSpan * pct;\n }\n traversed += elevDistanceSpan;\n }\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n}\n\nexport function mapOldElevationComponentToNew(oldElev: {\n first: number;\n second: number;\n}): ElevationProfileComponent {\n return {\n distance: oldElev.first,\n elevation: oldElev.second\n };\n}\n\n// Iterate through the steps, building the array of elevation points and\n// keeping track of the minimum and maximum elevations reached\nexport function getElevationProfile(\n steps: Step[],\n unitConversion = 1\n): ElevationProfile {\n let minElev = 100000;\n let maxElev = -100000;\n let traversed = 0;\n let gain = 0;\n let loss = 0;\n let previous: ElevationProfileComponent | null = null;\n const points = [];\n steps.forEach(step => {\n // Support for old REST response data (in step.elevation)\n const stepElevationProfile =\n step.elevationProfile ||\n (Array.isArray(step.elevation) &&\n step.elevation?.map<ElevationProfileComponent>(\n mapOldElevationComponentToNew\n ));\n\n if (!stepElevationProfile || stepElevationProfile.length === 0) {\n traversed += step.distance;\n return;\n }\n for (let i = 0; i < stepElevationProfile.length; i++) {\n const elev = stepElevationProfile[i];\n if (previous) {\n const diff = (elev.elevation - previous.elevation) * unitConversion;\n if (diff > 0) gain += diff;\n else loss += diff;\n }\n if (i === 0 && elev.distance !== 0) {\n // console.warn(`No elevation data available for step ${stepIndex}-${i} at beginning of segment`, elev)\n }\n const convertedElevation = elev.elevation * unitConversion;\n if (convertedElevation < minElev) minElev = convertedElevation;\n if (convertedElevation > maxElev) maxElev = convertedElevation;\n points.push([traversed + elev.distance, elev.elevation]);\n // Insert \"filler\" point if the last point in elevation profile does not\n // reach the full distance of the step.\n if (\n i === stepElevationProfile.length - 1 &&\n elev.distance !== step.distance\n ) {\n // points.push([traversed + step.distance, elev.second])\n }\n previous = elev;\n }\n traversed += step.distance;\n });\n return { maxElev, minElev, points, traversed, gain, loss };\n}\n\n/**\n * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n *\n * @param {string} text The text to be rendered.\n * @param {string} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n *\n * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n */\nexport function getTextWidth(text: string, font = \"22px Arial\"): number {\n // Create custom type for function including reused canvas object\n type GetTextWidth = typeof getTextWidth & { canvas: HTMLCanvasElement };\n\n // reuse canvas object for better performance\n const canvas =\n (getTextWidth as GetTextWidth).canvas ||\n ((getTextWidth as GetTextWidth).canvas = document.createElement(\"canvas\"));\n const context = canvas.getContext(\"2d\");\n context.font = font;\n const metrics = context.measureText(text);\n return metrics.width;\n}\n\n/**\n * Get the configured company object for the given network string if the company\n * has been defined in the provided companies array config.\n */\nexport function getCompanyForNetwork(\n networkString: string,\n companies: Company[] = []\n): Company {\n const company = companies.find(co => co.id === networkString);\n if (!company) {\n console.warn(\n `No company found in config.yml that matches rented vehicle network: ${networkString}`,\n companies\n );\n }\n return company;\n}\n\n/**\n * Get a string label to display from a list of vehicle rental networks.\n *\n * @param {Array<string>} networks A list of network ids.\n * @param {Array<object>} [companies=[]] An optional list of the companies config.\n * @return {string} A label for use in presentation on a website.\n */\nexport function getCompaniesLabelFromNetworks(\n networks: string[] | string,\n companies: Company[] = []\n): string {\n return (Array.isArray(networks) ? networks : [networks])\n .map(network => getCompanyForNetwork(network, companies))\n .filter(co => !!co)\n .map(co => co.label)\n .join(\"/\");\n}\n\nexport function getTNCLocation(leg: Leg, type: string): string {\n const location = leg[type];\n return `${location.lat.toFixed(5)},${location.lon.toFixed(5)}`;\n}\n\nexport function calculatePhysicalActivity(\n itinerary: ItineraryOnlyLegsRequired\n): {\n bikeDuration: number;\n caloriesBurned: number;\n walkDuration: number;\n} {\n let walkDuration = 0;\n let bikeDuration = 0;\n itinerary.legs.forEach(leg => {\n if (leg.mode.startsWith(\"WALK\")) walkDuration += leg.duration;\n if (leg.mode.startsWith(\"BICYCLE\")) bikeDuration += leg.duration;\n });\n const caloriesBurned =\n (walkDuration / 3600) * 280 + (bikeDuration / 3600) * 290;\n return {\n bikeDuration,\n caloriesBurned,\n walkDuration\n };\n}\n\n/**\n * For an itinerary, calculates the TNC fares and returns an object with\n * these values and currency info.\n * It is assumed that the same currency is used for all TNC legs.\n */\nexport function calculateTncFares(\n itinerary: ItineraryOnlyLegsRequired\n): TncFare {\n return itinerary.legs\n .filter(leg => leg.mode === \"CAR\" && leg.rideHailingEstimate)\n .reduce(\n ({ maxTNCFare, minTNCFare }, { rideHailingEstimate }) => {\n const { minPrice, maxPrice } = rideHailingEstimate;\n return {\n // Assumes a single currency for entire itinerary.\n currencyCode: minPrice.currency.code,\n maxTNCFare: maxTNCFare + maxPrice.amount,\n minTNCFare: minTNCFare + minPrice.amount\n };\n },\n {\n currencyCode: null,\n maxTNCFare: 0,\n minTNCFare: 0\n }\n );\n}\n\n/**\n * Sources:\n * - https://www.itf-oecd.org/sites/default/files/docs/environmental-performance-new-mobility.pdf\n * - https://www.thrustcarbon.com/insights/how-to-calculate-emissions-from-a-ferry-journey\n * - https://www.itf-oecd.org/sites/default/files/life-cycle-assessment-calculations-2020.xlsx\n * Other values extrapolated.\n */\nconst CARBON_INTENSITY_DEFAULTS = {\n walk: 0.026,\n bicycle: 0.017,\n car: 0.162,\n tram: 0.066,\n trolleybus: 0.066,\n subway: 0.066,\n rail: 0.066,\n bus: 0.09,\n ferry: 0.082,\n cable_car: 0.021,\n gondola: 0.021,\n funicular: 0.066,\n transit: 0.066,\n leg_switch: 0,\n airplane: 0.382,\n micromobility: 0.095\n};\n\n/**\n * @param {itinerary} itinerary OTP trip itinierary, only legs is required.\n * @param {carbonIntensity} carbonIntensity carbon intensity by mode in grams/meter\n * @param {units} units units to be used in return value\n * @return Amount of carbon in chosen unit\n */\nexport function calculateEmissions(\n // This type makes all the properties from Itinerary optional except legs.\n itinerary: ItineraryOnlyLegsRequired,\n carbonIntensity: Record<string, number> = {},\n units?: MassUnitOption\n): number {\n // Apply defaults for any values that we don't have.\n const carbonIntensityWithDefaults = {\n ...CARBON_INTENSITY_DEFAULTS,\n ...carbonIntensity\n };\n\n // Distance is in meters, totalCarbon is in grams\n const totalCarbon =\n itinerary?.legs?.reduce((total, leg) => {\n return (\n (leg.distance * carbonIntensityWithDefaults[leg.mode.toLowerCase()] ||\n 0) + total\n );\n }, 0) || 0;\n\n switch (units) {\n case \"ounce\":\n return totalCarbon / 28.35;\n case \"kilogram\":\n return totalCarbon / 1000;\n case \"pound\":\n return totalCarbon / 454;\n case \"gram\":\n default:\n return totalCarbon;\n }\n}\n\n/**\n * Returns the user-facing stop id to display for a stop or place, using the following priority:\n * 1. stop code,\n * 2. stop id without the agency id portion, if stop id contains an agency portion,\n * 3. stop id, whether null or not (this is the fallback case).\n */\nexport function getDisplayedStopId(placeOrStop: Place | Stop): string {\n let stopId;\n let stopCode;\n if (\"stopId\" in placeOrStop) {\n ({ stopCode, stopId } = placeOrStop);\n } else if (\"id\" in placeOrStop) {\n ({ code: stopCode, id: stopId } = placeOrStop);\n }\n return stopCode || stopId?.split(\":\")[1] || stopId;\n}\n\n/**\n * Extracts useful data from the fare products on a leg, such as the leg cost and transfer info.\n * @param leg Leg with fare products (must have used getLegsWithFares)\n * @param category Rider category\n * @param container Fare container (cash, electronic)\n * @returns Object containing price as well as the transfer discount amount, if a transfer was used.\n */\nexport function getLegCost(\n leg: Leg,\n mediumId: string | null,\n riderCategoryId: string | null\n): {\n price?: Money;\n transferAmount?: Money | undefined;\n productUseId?: string;\n} {\n if (!leg.fareProducts) return { price: undefined };\n const relevantFareProducts = leg.fareProducts.filter(({ product }) => {\n // riderCategory and medium can be specifically defined as null to handle\n // generic GTFS based fares from OTP when there is no fare model\n return (\n (product.riderCategory === null ? null : product.riderCategory.id) ===\n riderCategoryId &&\n (product.medium === null ? null : product.medium.id) === mediumId\n );\n });\n\n // Custom fare models return \"rideCost\", generic GTFS fares return \"regular\"\n const totalCostProduct = relevantFareProducts.find(\n fp => fp.product.name === \"rideCost\" || fp.product.name === \"regular\"\n );\n const transferFareProduct = relevantFareProducts.find(\n fp => fp.product.name === \"transfer\"\n );\n\n return {\n price: totalCostProduct?.product.price,\n transferAmount: transferFareProduct?.product.price,\n productUseId: totalCostProduct?.id\n };\n}\n\n/**\n * Returns the total itinerary cost for a given set of legs.\n * @param legs Itinerary legs with fare products (must have used getLegsWithFares)\n * @param category Rider category (youth, regular, senior)\n * @param container Fare container (cash, electronic)\n * @returns Money object for the total itinerary cost.\n */\nexport function getItineraryCost(\n legs: Leg[],\n mediumId: string | null,\n riderCategoryId: string | null\n): Money | undefined {\n const legCosts = legs\n // Only legs with fares (no walking legs)\n .filter(leg => leg.fareProducts?.length > 0)\n // Get the leg cost object of each leg\n .map(leg => getLegCost(leg, mediumId, riderCategoryId))\n .filter(cost => cost.price !== undefined)\n // Filter out duplicate use IDs\n // One fare product can be used on multiple legs,\n // and we don't want to count it more than once.\n .reduce<{ productUseId: string; price: Money }[]>((prev, cur) => {\n if (!prev.some(p => p.productUseId === cur.productUseId)) {\n prev.push({ productUseId: cur.productUseId, price: cur.price });\n }\n return prev;\n }, [])\n .map(productUse => productUse.price);\n\n if (legCosts.length === 0) return undefined;\n // Calculate the total\n return legCosts.reduce<Money>(\n (prev, cur) => ({\n amount: prev.amount + cur?.amount || 0,\n currency: prev.currency ?? cur?.currency\n }),\n { amount: 0, currency: null }\n );\n}\n\nconst pickupDropoffTypeToOtp1 = otp2Type => {\n switch (otp2Type) {\n case \"COORDINATE_WITH_DRIVER\":\n return \"coordinateWithDriver\";\n case \"CALL_AGENCY\":\n return \"mustPhone\";\n case \"SCHEDULED\":\n return \"scheduled\";\n case \"NONE\":\n return \"none\";\n default:\n return null;\n }\n};\n\nexport const convertGraphQLResponseToLegacy = (leg: any): any => ({\n ...leg,\n agencyBrandingUrl: leg.agency?.url,\n agencyId: leg.agency?.id,\n agencyName: leg.agency?.name,\n agencyUrl: leg.agency?.url,\n alightRule: pickupDropoffTypeToOtp1(leg.dropoffType),\n boardRule: pickupDropoffTypeToOtp1(leg.pickupType),\n dropOffBookingInfo: {\n latestBookingTime: leg.dropOffBookingInfo\n },\n from: {\n ...leg.from,\n stopCode: leg.from.stop?.code,\n stopId: leg.from.stop?.gtfsId\n },\n route: leg.route?.shortName,\n routeColor: leg.route?.color,\n routeId: leg.route?.gtfsId,\n routeLongName: leg.route?.longName,\n routeShortName: leg.route?.shortName,\n routeTextColor: leg.route?.textColor,\n to: {\n ...leg.to,\n stopCode: leg.to.stop?.code,\n stopId: leg.to.stop?.gtfsId\n },\n tripHeadsign: leg.trip?.tripHeadsign,\n tripId: leg.trip?.gtfsId\n});\n\n/** Extracts the route number for a leg returned from OTP1 or OTP2. */\nexport const getLegRouteShortName = (\n leg: Pick<Leg, \"route\" | \"routeShortName\">\n): string | null => {\n const { route, routeShortName } = leg;\n // typeof route === \"object\" denotes newer OTP2 responses. routeShortName and route as string is OTP1.\n return typeof route === \"object\"\n ? route?.shortName\n : routeShortName || (route as string);\n};\n\n/** Extract the route long name for a leg returned from OTP1 or OTP2. */\nexport const getLegRouteLongName = (\n leg: Pick<Leg, \"route\" | \"routeLongName\">\n): string | null => {\n const { route, routeLongName } = leg;\n // typeof route === \"object\" denotes newer OTP2 responses. routeLongName is OTP1.\n return typeof route === \"object\" ? route?.longName : routeLongName;\n};\n\n/**\n * Returns the route short name, or the route long name if no short name is provided.\n * This is happens with Seattle area streetcars and ferries.\n */\nexport const getLegRouteName = (\n leg: Pick<Leg, \"route\" | \"routeLongName\" | \"routeShortName\">\n): string => {\n return getLegRouteShortName(leg) || getLegRouteLongName(leg);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAiBA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA;AACO,MAAME,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,CAC1B,MAAM,EACN,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,SAAS,CACV;;AAED;AACA;AACA;AACA;;AAEO,SAASE,eAAeA,CAACC,MAAc,EAAY;EACxD,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,KAAK,IAAI,CAACD,MAAM,CAACC,KAAK,CAACJ,YAAY,EACxD,OAAOA,YAAY;EAErB,OAAOG,MAAM,CAACC,KAAK,CAACJ,YAAY,CAACK,GAAG,CAACC,EAAE,IACrC,OAAOA,EAAE,KAAK,QAAQ,GAAGA,EAAE,CAACC,IAAI,GAAGD,EACrC,CAAC;AACH;AAEO,SAASE,YAAYA,CAACC,GAAQ,EAAW;EAC9C,OAAOA,GAAG,CAACC,UAAU;AACvB;AAEO,SAASC,SAASA,CAACJ,IAAY,EAAW;EAC/C,OAAOP,YAAY,CAACY,QAAQ,CAACL,IAAI,CAAC,IAAIA,IAAI,KAAK,SAAS;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASM,qBAAqBA,CAACJ,GAAQ,EAAW;EACvD,OAAO,CAAAA,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEK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]}
|
package/lib/map.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function constructLocation(latlng: {
|
|
|
7
7
|
lng: number;
|
|
8
8
|
}): Location;
|
|
9
9
|
export declare function matchLatLon(location1: Location, location2: Location): boolean;
|
|
10
|
-
|
|
10
|
+
type TransitivePlaceRaw = {
|
|
11
11
|
place_id: string;
|
|
12
12
|
};
|
|
13
13
|
export declare function isBikeshareStation(place: TransitivePlaceRaw): boolean;
|
package/lib/map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7E,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,YAAY,GAC5B,QAAQ,CAYV;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAEvD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,QAAQ,CAKX;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,GAAG,OAAO,CAG7E;AAED,
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7E,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,YAAY,GAC5B,QAAQ,CAYV;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAEvD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,QAAQ,CAKX;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,GAAG,OAAO,CAG7E;AAED,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAErE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAEpE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAEtE;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAOvD"}
|
package/lib/map.js
CHANGED
|
@@ -3,73 +3,62 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.currentPositionToLocation = currentPositionToLocation;
|
|
7
|
-
exports.coordsToString = coordsToString;
|
|
8
|
-
exports.stringToCoords = stringToCoords;
|
|
9
6
|
exports.constructLocation = constructLocation;
|
|
10
|
-
exports.
|
|
7
|
+
exports.coordsToString = coordsToString;
|
|
8
|
+
exports.currentPositionToLocation = currentPositionToLocation;
|
|
11
9
|
exports.isBikeshareStation = isBikeshareStation;
|
|
12
|
-
exports.isEScooterStation = isEScooterStation;
|
|
13
10
|
exports.isCarWalkTransition = isCarWalkTransition;
|
|
11
|
+
exports.isEScooterStation = isEScooterStation;
|
|
14
12
|
exports.isValidLat = isValidLat;
|
|
15
|
-
exports.isValidLng = isValidLng;
|
|
16
13
|
exports.isValidLatLng = isValidLatLng;
|
|
17
|
-
|
|
14
|
+
exports.isValidLng = isValidLng;
|
|
15
|
+
exports.matchLatLon = matchLatLon;
|
|
16
|
+
exports.stringToCoords = stringToCoords;
|
|
18
17
|
function currentPositionToLocation(currentPosition) {
|
|
19
18
|
if (currentPosition.error || !currentPosition.coords) {
|
|
20
19
|
console.warn("Cannot construct location from current position due to geolocation error or missing coordinates.");
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
return {
|
|
25
23
|
lat: currentPosition.coords.latitude,
|
|
26
24
|
lon: currentPosition.coords.longitude,
|
|
27
25
|
category: "CURRENT_LOCATION"
|
|
28
26
|
};
|
|
29
|
-
}
|
|
30
|
-
// otp-rr actions where the intl context is not available/does not apply.
|
|
31
|
-
|
|
27
|
+
}
|
|
32
28
|
|
|
29
|
+
// TRICKY: This method is used in query.js and in the context of
|
|
30
|
+
// otp-rr actions where the intl context is not available/does not apply.
|
|
33
31
|
function coordsToString(coords) {
|
|
34
32
|
return coords.length && coords.map(c => (+c).toFixed(5)).join(", ");
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
function stringToCoords(str) {
|
|
38
35
|
return str && str.split(",").map(c => +c) || [];
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
function constructLocation(latlng) {
|
|
42
38
|
return {
|
|
43
39
|
lat: latlng.lat,
|
|
44
40
|
lon: latlng.lng
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
|
-
|
|
48
43
|
function matchLatLon(location1, location2) {
|
|
49
44
|
if (!location1 || !location2) return location1 === location2;
|
|
50
45
|
return location1.lat === location2.lat && location1.lon === location2.lon;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
47
|
function isBikeshareStation(place) {
|
|
54
48
|
return place.place_id.lastIndexOf("bicycle_rent_station") !== -1;
|
|
55
49
|
}
|
|
56
|
-
|
|
57
50
|
function isEScooterStation(place) {
|
|
58
51
|
return place.place_id.lastIndexOf("escooter_rent_station") !== -1;
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
function isCarWalkTransition(place) {
|
|
62
54
|
return place.place_id.lastIndexOf("itin_car_") !== -1;
|
|
63
55
|
}
|
|
64
|
-
|
|
65
56
|
function isValidLat(lat) {
|
|
66
57
|
return Number.isFinite(lat) && lat >= -90 && lat <= 90;
|
|
67
58
|
}
|
|
68
|
-
|
|
69
59
|
function isValidLng(lng) {
|
|
70
60
|
return Number.isFinite(lng) && lng >= -180 && lng <= 180;
|
|
71
61
|
}
|
|
72
|
-
|
|
73
62
|
function isValidLatLng(arr) {
|
|
74
63
|
return Array.isArray(arr) && arr.length === 2 && isValidLat(arr[0]) && isValidLng(arr[1]);
|
|
75
64
|
}
|
package/lib/map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 && coords.map(c => (+c).toFixed(5)).join(\", \");\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,EACnB;EACV,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,CAACE,MAAM,CAACI,QAAQ;IACpCC,GAAG,EAAEP,eAAe,CAACE,MAAM,CAACM,SAAS;IACrCC,QAAQ,EAAE;EACZ,CAAC;AACH;;AAEA;AACA;AACO,SAASC,cAAcA,CAACR,MAAgB,EAAU;EACvD,OAAOA,MAAM,CAACS,MAAM,IAAIT,MAAM,CAACU,GAAG,CAACC,CAAC,IAAI,CAAC,CAACA,CAAC,EAAEC,O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,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,CAACzB,MAAM,KAAK,CAAC,IAChBoB,UAAU,CAACK,GAAG,CAAC,CAAC,CAAC,CAAC,IAClBF,UAAU,CAACE,GAAG,CAAC,CAAC,CAAC,CAAC;AAEtB","ignoreList":[]}
|
package/lib/profile.js
CHANGED
|
@@ -5,20 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.filterProfileOptions = filterProfileOptions;
|
|
7
7
|
exports.profileOptionsToItineraries = profileOptionsToItineraries;
|
|
8
|
-
|
|
9
8
|
function filterProfileOptions(response) {
|
|
10
9
|
// Filter out similar options. TODO: handle on server??
|
|
11
10
|
const optStrs = [];
|
|
12
11
|
const filteredIndices = [];
|
|
13
12
|
const filteredProfile = response.otp.profile.filter((option, i) => {
|
|
14
13
|
let optStr = option.access.map(a => a.mode).join("/");
|
|
15
|
-
|
|
16
14
|
if (option.transit) {
|
|
17
15
|
optStr += ` to ${option.transit.map(transit => {
|
|
18
16
|
return transit.routes.map(route => route.id).join("/");
|
|
19
17
|
}).join(",")}`;
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
if (optStrs.indexOf(optStr) !== -1) return false;
|
|
23
20
|
optStrs.push(optStr);
|
|
24
21
|
filteredIndices.push(i);
|
|
@@ -29,11 +26,9 @@ function filterProfileOptions(response) {
|
|
|
29
26
|
response.otp.journeys = filteredJourneys;
|
|
30
27
|
return response;
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
function locationString(str) {
|
|
34
30
|
return str === null || str === void 0 ? void 0 : str.split(",")[0];
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
function accessToLeg(access, origin, destination) {
|
|
38
33
|
return {
|
|
39
34
|
mode: access.mode,
|
|
@@ -46,8 +41,9 @@ function accessToLeg(access, origin, destination) {
|
|
|
46
41
|
name: locationString(destination)
|
|
47
42
|
}
|
|
48
43
|
};
|
|
49
|
-
}
|
|
44
|
+
}
|
|
50
45
|
|
|
46
|
+
// helper functions for profileOptionsToItineraries:
|
|
51
47
|
|
|
52
48
|
function optionToItinerary(option, query) {
|
|
53
49
|
const itin = {
|
|
@@ -55,8 +51,9 @@ function optionToItinerary(option, query) {
|
|
|
55
51
|
legs: [],
|
|
56
52
|
walkTime: 0,
|
|
57
53
|
waitingTime: 0
|
|
58
|
-
};
|
|
54
|
+
};
|
|
59
55
|
|
|
56
|
+
// access leg
|
|
60
57
|
if (option.access && option.access.length > 0) {
|
|
61
58
|
if (option.access[0].mode === "BICYCLE_RENT") {
|
|
62
59
|
let status = "WALK_ON";
|
|
@@ -73,7 +70,6 @@ function optionToItinerary(option, query) {
|
|
|
73
70
|
status = "WALK_OFF";
|
|
74
71
|
offStationName = edge.bikeRentalOffStation.name;
|
|
75
72
|
}
|
|
76
|
-
|
|
77
73
|
if (status === "WALK_ON") {
|
|
78
74
|
walkOnEdges.push(edge);
|
|
79
75
|
walkOnTime += edge.distance;
|
|
@@ -82,16 +78,17 @@ function optionToItinerary(option, query) {
|
|
|
82
78
|
} else if (status === "WALK_OFF") {
|
|
83
79
|
walkOffEdges.push(edge);
|
|
84
80
|
walkOffTime += edge.distance;
|
|
85
|
-
}
|
|
86
|
-
|
|
81
|
+
}
|
|
87
82
|
|
|
83
|
+
// check if we're picking up the bike
|
|
88
84
|
if (edge.bikeRentalOnStation) {
|
|
89
85
|
status = "BIKE";
|
|
90
86
|
onStationName = edge.bikeRentalOnStation.name;
|
|
91
87
|
}
|
|
92
88
|
});
|
|
93
|
-
itin.walkTime += walkOnTime + walkOffTime;
|
|
89
|
+
itin.walkTime += walkOnTime + walkOffTime;
|
|
94
90
|
|
|
91
|
+
// create the 'on' walk leg
|
|
95
92
|
itin.legs.push({
|
|
96
93
|
mode: "WALK",
|
|
97
94
|
duration: walkOnTime,
|
|
@@ -102,8 +99,9 @@ function optionToItinerary(option, query) {
|
|
|
102
99
|
to: {
|
|
103
100
|
name: onStationName
|
|
104
101
|
}
|
|
105
|
-
});
|
|
102
|
+
});
|
|
106
103
|
|
|
104
|
+
// create the bike leg
|
|
107
105
|
itin.legs.push({
|
|
108
106
|
mode: "BICYCLE_RENT",
|
|
109
107
|
duration: option.time - walkOnTime - walkOffTime,
|
|
@@ -114,8 +112,9 @@ function optionToItinerary(option, query) {
|
|
|
114
112
|
to: {
|
|
115
113
|
name: offStationName
|
|
116
114
|
}
|
|
117
|
-
});
|
|
115
|
+
});
|
|
118
116
|
|
|
117
|
+
// create the 'off' walk leg
|
|
119
118
|
itin.legs.push({
|
|
120
119
|
mode: "WALK",
|
|
121
120
|
duration: walkOffTime,
|
|
@@ -131,9 +130,9 @@ function optionToItinerary(option, query) {
|
|
|
131
130
|
itin.legs.push(accessToLeg(option.access[0], query && query.from.name, option.transit ? null : query && query.to.name));
|
|
132
131
|
if (option.access[0].mode === "WALK") itin.walkTime += option.access[0].time;
|
|
133
132
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
133
|
+
}
|
|
136
134
|
|
|
135
|
+
// transit legs
|
|
137
136
|
if (option.transit) {
|
|
138
137
|
option.transit.forEach(transit => {
|
|
139
138
|
itin.legs.push({
|
|
@@ -151,20 +150,19 @@ function optionToItinerary(option, query) {
|
|
|
151
150
|
});
|
|
152
151
|
itin.waitingTime += transit.waitStats.avg;
|
|
153
152
|
});
|
|
154
|
-
}
|
|
155
|
-
|
|
153
|
+
}
|
|
156
154
|
|
|
155
|
+
// egress leg
|
|
157
156
|
if (option.egress && option.egress.length > 0) {
|
|
158
157
|
// find the origin name, for transit trips
|
|
159
158
|
const origin = option.transit ? option.transit[option.transit.length - 1].toName : null;
|
|
160
159
|
itin.legs.push(accessToLeg(option.egress[0], origin, query && query.to.name));
|
|
161
160
|
if (option.egress[0].mode === "WALK") itin.walkTime += option.egress[0].time;
|
|
162
161
|
}
|
|
163
|
-
|
|
164
162
|
return itin;
|
|
165
163
|
}
|
|
166
|
-
/** profileOptionsToItineraries * */
|
|
167
164
|
|
|
165
|
+
/** profileOptionsToItineraries * */
|
|
168
166
|
|
|
169
167
|
function profileOptionsToItineraries(options, query) {
|
|
170
168
|
return options.map(option => optionToItinerary(option, query));
|
package/lib/profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/profile.js"],"names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","waitStats","egress","profileOptionsToItineraries","options"],"mappings":";;;;;;;;AAAO,SAASA,oBAAT,CAA8BC,QAA9B,EAAwC;AAC7C;AACA,QAAMC,OAAO,GAAG,EAAhB;AACA,QAAMC,eAAe,GAAG,EAAxB;AAEA,QAAMC,eAAe,GAAGH,QAAQ,CAACI,GAAT,CAAaC,OAAb,CAAqBC,MAArB,CAA4B,CAACC,MAAD,EAASC,CAAT,KAAe;AACjE,QAAIC,MAAM,GAAGF,MAAM,CAACG,MAAP,CAAcC,GAAd,CAAkBC,CAAC,IAAIA,CAAC,CAACC,IAAzB,EAA+BC,IAA/B,CAAoC,GAApC,CAAb;;AACA,QAAIP,MAAM,CAACQ,OAAX,EAAoB;AAClBN,MAAAA,MAAM,IAAK,OAAMF,MAAM,CAACQ,OAAP,CACdJ,GADc,CACVI,OAAO,IAAI;AACd,eAAOA,OAAO,CAACC,MAAR,CAAeL,GAAf,CAAmBM,KAAK,IAAIA,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lHuC,CAoHxC;;;AACA,MAAIrD,MAAM,CAACwD,MAAP,IAAiBxD,MAAM,CAACwD,MAAP,CAAcrB,MAAd,GAAuB,CAA5C,EAA+C;AAC7C;AACA,UAAMd,MAAM,GAAGrB,MAAM,CAACQ,OAAP,GACXR,MAAM,CAACQ,OAAP,CAAeR,MAAM,CAACQ,OAAP,CAAe2B,MAAf,GAAwB,CAAvC,EAA0CgB,MAD/B,GAEX,IAFJ;AAIApB,IAAAA,IAAI,CAACC,IAAL,CAAUnB,IAAV,CACEO,WAAW,CAACpB,MAAM,CAACwD,MAAP,CAAc,CAAd,CAAD,EAAmBnC,MAAnB,EAA2BS,KAAK,IAAIA,KAAK,CAACF,EAAN,CAASD,IAA7C,CADb;AAGA,QAAI3B,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBlD,IAAjB,KAA0B,MAA9B,EACEyB,IAAI,CAACE,QAAL,IAAiBjC,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBhC,IAAlC;AACH;;AAED,SAAOO,IAAP;AACD;AAED;;;AAEO,SAAS0B,2BAAT,CAAqCC,OAArC,EAA8C5B,KAA9C,EAAqD;AAC1D,SAAO4B,OAAO,CAACtD,GAAR,CAAYJ,MAAM,IAAI6B,iBAAiB,CAAC7B,MAAD,EAAS8B,KAAT,CAAvC,CAAP;AACD","sourcesContent":["export function filterProfileOptions(response) {\n // Filter out similar options. TODO: handle on server??\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str?.split(\",\")[0];\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"file":"profile.js"}
|
|
1
|
+
{"version":3,"file":"profile.js","names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","waitStats","egress","profileOptionsToItineraries","options"],"sources":["../src/profile.js"],"sourcesContent":["export function filterProfileOptions(response) {\n // Filter out similar options. TODO: handle on server??\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str?.split(\",\")[0];\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"mappings":";;;;;;;AAAO,SAASA,oBAAoBA,CAACC,QAAQ,EAAE;EAC7C;EACA,MAAMC,OAAO,GAAG,EAAE;EAClB,MAAMC,eAAe,GAAG,EAAE;EAE1B,MAAMC,eAAe,GAAGH,QAAQ,CAACI,GAAG,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,MAAM,EAAEC,CAAC,KAAK;IACjE,IAAIC,MAAM,GAAGF,MAAM,CAACG,MAAM,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;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B,MAAM,CAACwD,MAAM,CAAC,CAAC,CAAC,EAAEnC,MAAM,EAAES,KAAK,IAAIA,KAAK,CAACF,EAAE,CAACD,IAAI,CAC9D,CAAC;IACD,IAAI3B,MAAM,CAACwD,MAAM,CAAC,CAAC,CAAC,CAAClD,IAAI,KAAK,MAAM,EAClCyB,IAAI,CAACE,QAAQ,IAAIjC,MAAM,CAACwD,MAAM,CAAC,CAAC,CAAC,CAAChC,IAAI;EAC1C;EAEA,OAAOO,IAAI;AACb;;AAEA;;AAEO,SAAS0B,2BAA2BA,CAACC,OAAO,EAAE5B,KAAK,EAAE;EAC1D,OAAO4B,OAAO,CAACtD,GAAG,CAACJ,MAAM,IAAI6B,iBAAiB,CAAC7B,MAAM,EAAE8B,KAAK,CAAC,CAAC;AAChE","ignoreList":[]}
|
package/lib/query-gen.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { LonLatOutput } from "@conveyal/lonlat";
|
|
2
2
|
import { ModeSetting, TransportMode } from "@opentripplanner/types";
|
|
3
|
-
|
|
3
|
+
type InputBanned = {
|
|
4
4
|
routes?: string;
|
|
5
5
|
agencies?: string;
|
|
6
6
|
trips?: string;
|
|
7
7
|
stops?: string;
|
|
8
8
|
stopsHard?: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type InputPreferred = {
|
|
11
11
|
routes?: string;
|
|
12
12
|
agencies?: string;
|
|
13
13
|
unpreferredCost?: string;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
type OTPQueryParams = {
|
|
16
16
|
arriveBy: boolean;
|
|
17
17
|
date?: string;
|
|
18
18
|
from: LonLatOutput & {
|
|
@@ -29,7 +29,7 @@ declare type OTPQueryParams = {
|
|
|
29
29
|
preferred?: InputPreferred;
|
|
30
30
|
unpreferred?: InputPreferred;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
type GraphQLQuery = {
|
|
33
33
|
query: string;
|
|
34
34
|
variables: Record<string, unknown>;
|
|
35
35
|
};
|
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,
|
|
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,C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