@opentripplanner/types 9.0.0-alpha.2 → 9.0.0-alpha.4

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/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkuBU,QAAA,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACjB,CAAC"}
1
+ {"version":3,"file":"index.js","names":["ModeSettingTypes","exports","CHECKBOX","DROPDOWN","SLIDER"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * This file contains type definitions for types\n * used across more than one package in this repo.\n */\n\nimport React, { FunctionComponent, ReactElement } from \"react\";\nimport { IntlShape } from \"react-intl\";\nimport { StyledIcon } from \"@styled-icons/styled-icon\";\nimport { ConfiguredModes } from \"./deprecated\";\n\ntype ZeroOrOne = 0 | 1;\n\n/**\n * Shape for a transportation company.\n */\nexport type Company = {\n id: string;\n label: string;\n /** a comma-separated string listing the modes offered by this company */\n modes: string;\n /**\n * tells OTP UI to ignore the API provided station names\n * and instead use generic ones.\n */\n overridePlaceNames?: boolean;\n};\n\n/**\n * Describes some options to help display data about a transit agency that is\n * configured in an opentripplanner instance.\n */\nexport type TransitOperator = {\n agencyId: string;\n defaultRouteColor?: string;\n defaultRouteTextColor?: string;\n feedId: string;\n logo?: string;\n longNameSplitter?: string;\n name?: string;\n order?: number;\n};\n\n/**\n * Describes a map entity to be rendered.\n */\nexport type LayerEntity = {\n id: string;\n lat: number;\n lon: number;\n};\n\nexport type SymbolComponentBaseProps = {\n entity: LayerEntity;\n zoom: number;\n};\n\n/**\n * The symbol-representing component to draw; with the signature\n * ({ entity: object; zoom: number }) => Element\n * where entity must have an id attribute and contain coordinates information for placement on the map.\n */\nexport type SymbolComponent = React.ComponentType<SymbolComponentBaseProps>;\n\n/**\n * Defines which symbol to render based on a zoom level; and optionally by entity type.\n * (Only one symbol is rendered for any zoom level.)\n */\nexport type ZoomBasedSymbol = {\n /**\n * A function with the signature (entity: object) => string\n * that determines the type of an entity.\n * symbolByType and getType must be either be both specified or both omitted.\n */\n getType?: (entity: LayerEntity) => string;\n /**\n * The zoom level beginning at which the marker is drawn;\n * unless another marker with a higher minZoom is met.\n */\n minZoom: number;\n /**\n * The symbol-representing component to draw; with the signature\n * ({ entity: object; zoom: number }) => Element\n * where entity must have an id attribute and contain coordinates information for placement on the map.\n */\n symbol: SymbolComponent;\n /**\n * The symbol-representing component to draw for each entity type;\n * with the same signature as symbol. If a type returned by getType() is not listed;\n * then the component defined in the 'symbol' attribute will be rendered by default.\n * symbolByType and getType must be either be both specified or both omitted.\n */\n symbolByType?: {\n [name: string]: SymbolComponent;\n };\n};\n\n/**\n * Describes the objects from the real-time vehicle service.\n */\nexport type TransitVehicle = {\n routeColor?: string;\n routeLongName?: string;\n routeShortName?: string;\n routeType?: string;\n\n lastUpdated?: number;\n reportDate?: string;\n seconds?: number;\n status?: string;\n\n blockId?: string;\n stopId?: string;\n stopSequence?: number;\n tripId?: string;\n vehicleId?: string;\n\n heading?: number;\n lat?: number;\n lon?: number;\n};\n\nexport type OTPTransitVehicle = TransitVehicle & {\n label?: string;\n nextStopName?: string;\n speed?: number;\n stopStatus?: string; // TODO: Make enum\n};\n\nexport type VehicleRentalMapOverlaySymbol =\n | {\n dockStrokeColor?: string;\n fillColor?: string;\n minZoom: number;\n pixels?: number;\n type: string;\n }\n | ZoomBasedSymbol;\n\nexport type UnitSystem = \"metric\" | \"imperial\";\n\n/**\n * Represents the expected configuration of the webapp.\n *\n * Note: this is an incomplete type mapping.\n */\nexport type Config = {\n companies?: Company[];\n dateTime: {\n timeFormat?: string;\n dateFormat?: string;\n /** @deprecated */\n longDateFormat?: string;\n };\n formatDuration?: (\n duration: number,\n intl: IntlShape,\n includeSeconds: boolean\n ) => string;\n homeTimezone: string;\n /** @deprecated */\n modes?: ConfiguredModes;\n // TODO: add full typing\n map?: {\n overlays?: {\n /**\n * The applicable companies this overlay covers. Only applicable in\n * certain vehicle rental overlays.\n */\n companies?: string[];\n name: string;\n /**\n * The applicable map symbols. Only applicable in vehicle rental\n * overlays.\n */\n mapSymbols?: VehicleRentalMapOverlaySymbol[];\n /**\n * Only used during park and ride queries. This will filter out P&Rs\n * that are further than the specified number of meters from a transit\n * stop.\n */\n maxTransitDistance?: number;\n /**\n * The applicable modes this overlay covers. Only applicable in certain\n * vehicle rental overlays.\n */\n modes?: string[];\n /**\n * The type of overlay. Currently valid values include:\n *\n * \"bike-rental\"; \"car-rental\"; \"micromobility-rental\"; \"park-and-ride\";\n * \"stops\"; \"tile\"\n */\n type: string;\n }[];\n };\n transitOperators?: TransitOperator[];\n /**\n * The preferred unit system to use, either metric or imperial.\n * The default is 'imperial' so that existing visuals with distances in feet/miles don't break.\n */\n units?: UnitSystem;\n};\n\nexport type EncodedPolyline = {\n length: number;\n points: string;\n};\n\nexport type ElevationProfileComponent = {\n distance: number;\n elevation: number;\n};\n\nexport type ElevationData = {\n first: number;\n second: number;\n}[];\n\nexport type AlertEffect =\n | \"ACCESSIBILITY_ISSUE\"\n | \"ADDITIONAL_SERVICE\"\n | \"DETOUR\"\n | \"MODIFIED_SERVICE\"\n | \"NO_EFFECT\"\n | \"NO_SERVICE\"\n | \"OTHER_EFFECT\"\n | \"REDUCED_SERVICE\"\n | \"SIGNIFICANT_DELAYS\"\n | \"STOP_MOVED\"\n | \"UNKNOWN_EFFECT\";\n\nexport type Alert = {\n alertDescriptionText?: string;\n alertEffect?: AlertEffect;\n alertHeaderText?: string;\n alertUrl?: string;\n effectiveStartDate?: number;\n entities?: { stop?: { gtfsId?: string } }[];\n /** Returned by OTP2 graphql queries, but not by OTP1 */\n id?: string;\n};\n\n/**\n * Represents steps in a leg in an itinerary of an OTP plan response. These are\n * only for non-transit modes.\n * See documentation here: http://otp-docs.ibi-transit.com/api/json_WalkStep.html\n */\nexport type Step = {\n absoluteDirection?: string;\n alerts?: Alert[];\n area: boolean;\n bogusName: boolean;\n distance: number;\n elevation?: ElevationData;\n elevationProfile?: ElevationProfileComponent[];\n lat: number;\n lon: number;\n relativeDirection: string;\n stayOn: boolean;\n streetName: string;\n};\n\n/**\n * Describe an origin, destination, or intermediate location in an itinerary.\n */\nexport type Place = {\n address?: string;\n arrival?: number;\n bikeShareId?: string;\n departure?: number;\n lat: number;\n lon: number;\n name: string;\n networks?: string[];\n rentalVehicle?: { network: string };\n vehicleRentalStation?: { rentalNetwork: { networkId: string } };\n stop?: Stop;\n /**\n * @deprecated Only for OTP1 support, removal is immenent\n */\n stopCode?: string;\n /**\n * @deprecated Only for OTP1 support, removal is immenent\n */\n stopId?: string;\n /**\n * @deprecated Only for OTP1 support, removal is immenent\n */\n stopIndex?: number;\n /**\n * @deprecated Only for OTP1 support, removal is immenent\n */\n stopSequence?: number;\n vertexType: string;\n zoneId?: string;\n};\n\n/**\n * Holds contact info and lead time for flex transit bookings.\n * The information is optional and is for reminding the end-user\n * of any advance reservations required prior to travel.\n */\nexport type FlexBookingInfo = {\n contactInfo?: {\n phoneNumber?: string;\n bookingUrl?: string;\n infoUrl?: string;\n };\n latestBookingTime?: {\n daysPrior: number;\n };\n message?: string;\n};\n\n/** Dropoff-specific flex booking information */\ntype FlexDropOffBookingInfo = {\n dropOffMessage?: string;\n} & FlexBookingInfo;\n\n/** Pickup-specific flex booking information */\ntype FlexPickupBookingInfo = {\n pickupMessage?: string;\n} & FlexBookingInfo;\n\n/** Basic transit route attributes */\ninterface BasicRouteInfo {\n color?: string;\n id: string;\n longName?: string;\n shortName: string;\n textColor?: string;\n // TS TODO: route type enum\n type?: number;\n}\n\n/** Transit route attributes from itinerary legs */\nexport type LegRoute = BasicRouteInfo & {\n alerts?: Alert[];\n};\n\n/**\n * Represents a leg in an itinerary of an OTP plan response. Each leg represents\n * a portion of the overall itinerary that is done until either reaching the\n * destination or transitioning to another mode of travel. See OTP webservice\n * documentation here:\n * http://otp-docs.ibi-transit.com/api/json_Leg.html\n */\nexport type Leg = {\n accessibilityScore?: number;\n agencyBrandingUrl?: string;\n agencyId?: string;\n agencyName?: string;\n agencyTimeZoneOffset: number;\n agencyUrl?: string;\n alerts?: Alert[];\n boardRule?: string;\n alightRule?: string;\n arrivalDelay: number;\n averageWait?: number;\n departureDelay: number;\n distance: number;\n dropOffBookingInfo?: FlexDropOffBookingInfo;\n duration: number;\n endTime: number;\n fareProducts?: { id: string; product: FareProduct }[];\n from: Place;\n headsign?: string;\n id?: string;\n interlineWithPreviousLeg: boolean;\n intermediateStops: Place[];\n interStopGeometry?: EncodedPolyline[];\n legGeometry: EncodedPolyline;\n mode: string;\n pathway: boolean;\n pickupBookingInfo?: FlexPickupBookingInfo;\n rideHailingEstimate?: {\n provider: {\n id: string;\n };\n arrival: string;\n minPrice: TemporaryTNCPriceType;\n maxPrice: TemporaryTNCPriceType;\n productName?: string;\n };\n realTime: boolean;\n realtimeState?: \"ADDED\" | \"CANCELED\" | \"MODIFIED\" | \"SCHEDULED\" | \"UPDATED\";\n rentedBike: boolean;\n rentedCar: boolean;\n rentedVehicle: boolean;\n route?: string | LegRoute;\n routeColor?: string;\n routeId?: string;\n routeLongName?: string;\n routeShortName?: string;\n routeTextColor?: string;\n routeType?: number;\n serviceDate?: string;\n startTime: number | string;\n steps: Step[];\n // Abridged version of what OTP returns\n stopCalls?: {\n stopLocation?: {\n __typename: \"Stop\" | \"Location\" | \"LocationGroup\";\n };\n }[];\n to: Place;\n transitLeg: boolean;\n trip?: {\n arrivalStoptime?: TripStopTime;\n departureStoptime?: TripStopTime;\n gtfsId?: string;\n id: string;\n tripHeadsign?: string;\n tripShortName?: string;\n };\n tripBlockId?: string;\n tripId?: string;\n walkingBike?: boolean;\n};\n\ntype TripStopTime = {\n stopPosition: number;\n stop: {\n gtfsId: string;\n id: string;\n };\n};\n\ntype TemporaryTNCPriceType = {\n currency: {\n code: string;\n };\n amount: number;\n};\n\nexport type Currency = {\n code: string;\n digits: number;\n};\n\n/**\n * Describes the cost of an itinerary leg.\n */\nexport type Money = {\n amount: number;\n currency: {\n code: string;\n digits: number;\n };\n};\n\n/**\n * Represents an itinerary of an OTP plan response. See detailed documentation\n * in OTP webservice documentation here:\n * http://otp-docs.ibi-transit.com/api/json_Itinerary.html\n */\nexport type Itinerary = {\n co2?: number;\n co2VsBaseline?: number;\n duration: number;\n elevationGained: number;\n elevationLost: number;\n endTime: number;\n legs: Leg[];\n startTime: number;\n tooSloped?: boolean;\n transfers: number;\n transitTime: number;\n waitingTime: number;\n walkDistance: number;\n walkLimitExceeded: boolean;\n walkTime: number;\n};\n\n/**\n * In many places all we need from the Itinerary is the legs,\n * this type makes all the other types optional except legs.\n */\nexport type ItineraryOnlyLegsRequired = Partial<Itinerary> &\n Pick<Itinerary, \"legs\">;\n\nexport type ElevationProfile = {\n maxElev: number;\n minElev: number;\n points: [number, number][];\n traversed: number;\n gain: number;\n loss: number;\n};\n\n/**\n * Used to model a location that is used in planning a trip.\n */\nexport type Location = {\n lat: number;\n lon: number;\n name?: string;\n /**\n * This is only used location that a user has saved. Can be either:\n * One of: 'home', 'work', 'stop' or 'recent'\n */\n type?: \"home\" | \"work\" | \"stop\" | \"recent\" | string;\n category?: string;\n\n /**\n * This represents the last time that this location was selected in a\n * search\n */\n timestamp?: number;\n\n /* Sometimes used for displaying subinfo */\n main?: string;\n secondary?: string;\n};\n\n/**\n * Alias for a commonly used basic type\n */\nexport type LatLngArray = [number, number];\n\n/**\n * Describes a transit stop entity to be rendered on the map.\n */\nexport type StopLayerStop = LayerEntity & {\n name: string;\n};\n\nexport type StopEventHandler = (stop: Stop | { stopId: string }) => void;\n\n/**\n * This models data about a stop and it's associated routes that is obtained\n * from a transit index API.\n */\nexport type Stop = {\n /**\n * The stop code if the stop has one\n */\n code?: string;\n color?: string;\n dist?: number;\n geometries?: { geoJson?: GeoJSON.GeometryObject };\n gtfsId: string;\n id: string;\n lat?: number;\n lon?: number;\n name: string;\n routes?: Route[];\n};\n\nexport type Agency = {\n id: string;\n name?: string;\n url?: string;\n timezone?: string;\n lang?: string;\n phone?: string;\n fareUrl?: string;\n};\n\n/**\n * Transit modes that correspond with OTP GraphQL `TransitMode`.\n */\nexport type TransitMode =\n | \"AIRPLANE\"\n | \"BUS\"\n | \"CABLE_CAR\"\n | \"CARPOOL\"\n | \"COACH\"\n | \"FERRY\"\n | \"FUNICULAR\"\n | \"GONDOLA\"\n | \"MONORAIL\"\n | \"RAIL\"\n | \"SNOW_AND_ICE\"\n | \"SUBWAY\"\n | \"TAXI\"\n | \"TRAM\"\n | \"TROLLEYBUS\";\n\nexport type Route = BasicRouteInfo & {\n agency: Agency;\n agencyId?: string | number;\n agencyName?: string | number;\n // TODO: Add support for enum values, see /packages/core-utils/src/otpSchema.json#L1289\n bikesAllowed?: ZeroOrOne;\n eligibilityRestricted?: ZeroOrOne;\n mode?: TransitMode;\n routeBikesAllowed?: ZeroOrOne;\n sortOrder: number;\n sortOrderSet: boolean;\n};\n\nexport type TransitivePlace = {\n place_lat?: number;\n place_lon?: number;\n place_name?: string;\n placeId?: string;\n type: string;\n};\nexport type TransitiveSegment = {\n arc?: boolean;\n from?: TransitivePlace;\n patterns?: {\n pattern_id: string;\n from_stop_index: number;\n to_stop_index: number;\n }[];\n streetEdges?: number[];\n to?: TransitivePlace;\n type: string;\n};\nexport type TransitiveJourney = {\n journey_id: string;\n journey_name: string;\n segments: TransitiveSegment[];\n};\nexport type TransitivePattern = {\n pattern_id: string;\n pattern_name: string;\n route_id: string;\n stops: {\n geometry?: string;\n stop_id: string;\n }[];\n};\nexport type TransitiveRoute = {\n agency_id: string;\n route_color?: string;\n route_id: string;\n route_long_name: string;\n route_short_name: string;\n route_text_color?: string;\n route_type: number;\n};\nexport type TransitiveStop = {\n stop_id: string;\n stop_name?: string;\n stop_lat: number;\n stop_lon: number;\n};\n\nexport type TransitiveStreetEdge = {\n edge_id: number;\n geometry: EncodedPolyline;\n};\n\nexport type TransitiveData = {\n journeys: TransitiveJourney[];\n patterns: TransitivePattern[];\n places: TransitivePlace[];\n routes: TransitiveRoute[];\n stops: TransitiveStop[];\n streetEdges: TransitiveStreetEdge[];\n};\n\nexport type Station = {\n bikesAvailable?: number;\n id: string;\n isFloatingBike?: boolean;\n isFloatingCar?: boolean;\n isFloatingVehicle?: boolean;\n name?: string;\n networks: string[];\n spacesAvailable?: number;\n x: number;\n y: number;\n};\n\nexport type TileLayerStation = {\n bikesAvailable?: number;\n id: string;\n isFloatingBike?: boolean;\n isFloatingCar?: boolean;\n isFloatingVehicle?: boolean;\n lat: number;\n lon: number;\n name?: string;\n network?: string;\n spacesAvailable?: number;\n vehiclesAvailable?: number;\n};\n\n/**\n * Depending on the geocoder that is used, more properties than just the `label`\n * property might be provided by the geocoder. For example, with the Pelias\n * geocoder, properties such as `id`, `layer`, `source` are also included.\n */\nexport type GeocodedFeature = {\n geometry: {\n coordinates: LatLngArray;\n type: string;\n };\n properties: {\n label: string;\n layer?: string;\n source?: string;\n };\n};\n\nexport type TncFare = {\n currencyCode: string | null;\n maxTNCFare: number;\n minTNCFare: number;\n};\n\nexport type UserPosition = {\n coords?: {\n latitude: number;\n longitude: number;\n };\n error?: { message: string } | string;\n fetching?: boolean;\n};\n\n/**\n * Describes a user location such as \"home\", \"work\" etc.\n */\nexport interface UserLocation extends Location {\n icon?: string;\n id?: string;\n}\n\n/**\n * Associates a location with a type string.\n */\nexport interface UserLocationAndType {\n location: UserLocation;\n type: string;\n}\n\n/**\n * Parameters for \"clear location\" event handlers.\n */\nexport interface ClearLocationArg {\n locationType: string;\n}\n\n/**\n * Parameters for location actions/event handlers.\n */\nexport interface MapLocationActionArg {\n location: UserLocation;\n locationType: string;\n reverseGeocode?: boolean;\n}\n\n/**\n * Supports leg icons for itinerary body and printable itinerary.\n */\nexport type LegIconComponent = FunctionComponent<{\n leg: Leg;\n title?: string;\n width?: string;\n}>;\n\nexport type ConfiguredCompany = {\n /**\n * The id of the company. This is typically in all-caps.\n */\n id: string;\n /**\n * A human readable text value that can be displayed to users.\n */\n label: string;\n /**\n * A comma-separated list of applicable modes of travel that the company\n * offers.\n */\n modes: string;\n};\n\n/**\n * Supports displaying accessibility ratings as a set of thresholds\n * associated with an icon or text.\n */\nexport type GradationMap = Record<\n number,\n { color: string; icon?: ReactElement; text?: string }\n>;\n\nexport const ModeSettingTypes = {\n CHECKBOX: \"CHECKBOX\",\n DROPDOWN: \"DROPDOWN\",\n SLIDER: \"SLIDER\"\n};\n\nexport type DropdownOptions = {\n default?: string;\n label: string;\n options: {\n text: string;\n value: string;\n addTransportMode?: TransportMode;\n }[];\n type: \"DROPDOWN\";\n value?: string;\n};\n\nexport type SliderOptions = {\n default?: number;\n high: number;\n inverseKey?: string;\n label: string;\n labelHigh: string;\n labelLow: string;\n low: number;\n step: number;\n type: \"SLIDER\";\n value?: number;\n};\n\nexport type CheckboxOptions = {\n // This transport mode should match an OTP transport mode\n addTransportMode?: TransportMode | TransportMode[];\n default?: boolean;\n label: string;\n type: \"CHECKBOX\";\n truthValue?: boolean | string | number;\n falseValue?: boolean | string | number;\n value?: boolean;\n};\n\nexport type TransitSubmodeCheckboxOption = {\n // This transport mode should match an OTP transport mode\n addTransportMode: TransportMode;\n default?: boolean;\n label: string;\n // We might want to specify a secondary, \"override\" mode to this checkbox.\n // This can be used to generate a list of banned routes that have a matching mode.\n overrideMode?: string;\n type: \"SUBMODE\";\n value?: boolean;\n};\n\nexport type ModeSettingBase = {\n applicableMode: string;\n iconName?: string;\n icon?: JSX.Element;\n key: string;\n};\n\nexport type ModeSetting = (\n | CheckboxOptions\n | SliderOptions\n | DropdownOptions\n | TransitSubmodeCheckboxOption\n) &\n ModeSettingBase;\nexport type ModeSettingValues = Record<string, number | string | boolean>;\n\nexport type PlanModesInput = {\n direct?: string[];\n directOnly?: boolean;\n transit?: PlanTransitModesInput;\n transitOnly?: boolean;\n};\n\nexport type PlanTransitModesInput = {\n access?: string[];\n egress?: string[];\n transfer?: string[];\n transit?: PlanTransitModePreferenceInput[];\n};\n\nexport type PlanTransitModePreferenceInput = {\n cost?: { reluctance: number };\n mode: string;\n replacement?: { requirement?: string };\n};\n\n/**\n * A mode selected by the UI, with an optional PlanConnection input for a query.\n */\nexport type TransportMode = { input?: PlanModesInput; mode: string };\n\n/**\n * This is a combination of transportation modes,\n * with a label to describe them. These are designed\n * to appear in the mode selector as discrete options.\n */\nexport type ModeButtonDefinition = {\n enabled?: boolean; // User has enabled this mode\n Icon: StyledIcon | React.ComponentType; // From iconName (below)\n iconName: string; // From config\n key: string; // From config\n label: string; // From config\n modes?: TransportMode[]; // This comes from config\n modeSettings?: ModeSetting[]; // From OTP definitions + config\n};\n\n/**\n * Definition for a fare product used to pay the fare for a leg in a transit journey\n */\nexport type FareProduct = {\n __typename: string;\n id: string;\n medium?: {\n id: string;\n name: string;\n };\n name: string;\n // Fare products may not have a price if they don't implement a FareProduct subclass.\n price?: Money;\n riderCategory?: {\n id: string;\n name: string;\n };\n};\n\n/**\n * This fare product is designed to represent the fare product applied to a leg.\n */\nexport type AppliedFareProduct = FareProduct & {\n legPrice: Money;\n};\n\nexport type FareProductSelector = {\n mediumId?: string;\n riderCategoryId?: string;\n};\n\nexport type MediumRiderWhitelist = { medium: string; rider: string }[];\n\n/**\n * Options for units of mass (used in CO₂ calculation config)\n */\nexport type MassUnitOption = \"ounce\" | \"kilogram\" | \"pound\" | \"gram\";\n\n/**\n * Options for Heading for PrintableItinerary and ItineraryBody\n */\nexport type HeadingAs = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"span\" | \"div\";\n\n/**\n * Options for Heading for PrintableItinerary\n */\nexport type LegHeadingConfig = {\n titleHeading?: HeadingAs;\n legHeading?: HeadingAs;\n};\n\n/**\n * LegHeadingProp type for headingAs\n */\nexport type LegHeadingProp = {\n headingAs?: HeadingAs;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;;AASA;AACA;AACA;;AAaA;AACA;AACA;AACA;;AAYA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AA8BA;AACA;AACA;;AA0CA;AACA;AACA;AACA;AACA;;AAkGA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;;AAiCA;AACA;AACA;AACA;AACA;;AAaA;;AAKA;;AAKA;;AAWA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8FA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAuBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AACA;;AA2BA;AACA;AACA;;AAyHA;AACA;AACA;AACA;AACA;;AA4BA;AACA;AACA;;AAMA;AACA;AACA;;AAMA;AACA;AACA;;AAKA;AACA;AACA;;AAOA;AACA;AACA;;AAuBA;AACA;AACA;AACA;;AAMO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9BE,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE;AACV,CAAC;;AAsFD;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;;AAiBA;AACA;AACA;;AAYA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA","ignoreList":[]}
package/lib/otp2/index.js CHANGED
@@ -1,18 +1,17 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _rentalVehicleTypes = require("./rentalVehicleTypes");
7
+ Object.keys(_rentalVehicleTypes).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _rentalVehicleTypes[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _rentalVehicleTypes[key];
7
14
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./rentalVehicleTypes"), exports);
15
+ });
16
+ });
18
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/otp2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
1
+ {"version":3,"file":"index.js","names":["_rentalVehicleTypes","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../src/otp2/index.ts"],"sourcesContent":["export * from \"./rentalVehicleTypes\";\n"],"mappings":";;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,mBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,mBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,mBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
- // OTP2 RENTAL VEHICLE TYPES
3
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  //# sourceMappingURL=rentalVehicleTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rentalVehicleTypes.js","sourceRoot":"","sources":["../../src/otp2/rentalVehicleTypes.ts"],"names":[],"mappings":";AAAA,4BAA4B"}
1
+ {"version":3,"file":"rentalVehicleTypes.js","names":[],"sources":["../../src/otp2/rentalVehicleTypes.ts"],"sourcesContent":["// OTP2 RENTAL VEHICLE TYPES\n\nexport type VehicleRentalStation = {\n availableVehicles?: RentalVehicleEntityCounts;\n availableSpaces?: RentalVehicleEntityCounts;\n allowDropoff?: boolean;\n allowPickup?: boolean;\n id: string;\n name?: string;\n rentalNetwork: VehicleRentalNetwork;\n realtime?: boolean;\n lon?: number;\n lat?: number;\n};\n\nexport type RentalVehicle = {\n allowPickupNow?: boolean;\n availableUntil?: string;\n fuel?: RentalVehicleFuel;\n id: string;\n lat?: number;\n lon?: number;\n name: string;\n operative?: boolean;\n rentalNetwork: VehicleRentalNetwork;\n rentalUris?: VehicleRentalUris;\n vehicleId?: string;\n vehicleType?: RentalVehicleType;\n};\n\ntype RentalVehicleFuel = {\n percent?: number;\n range?: number;\n};\n\ntype VehicleRentalUris = {\n android?: string;\n ios?: string;\n web?: string;\n};\n\nexport type FormFactor =\n | \"BICYCLE\"\n | \"CAR\"\n | \"CARGO_BICYCLE\"\n | \"MOPED\"\n | \"OTHER\"\n | \"SCOOTER\"\n | \"SCOOTER_SEATED\"\n | \"SCOOTER_STANDING\";\n\ntype PropulsionType =\n | \"COMBUSTION\"\n | \"COMBUSTION_DIESEL\"\n | \"ELECTRIC\"\n | \"ELECTRIC_ASSIST\"\n | \"HUMAN\"\n | \"HYBRID\"\n | \"HYDROGEN_FUEL_CELL\"\n | \"PLUG_IN_HYBRID\";\n\ntype RentalVehicleType = {\n formFactor?: FormFactor;\n propulsionType?: PropulsionType;\n};\n\ntype RentalVehicleTypeCount = {\n count?: number;\n vehicleType: RentalVehicleType;\n};\n\ntype RentalVehicleEntityCounts = {\n byType: RentalVehicleTypeCount[];\n total: number;\n};\n\ntype VehicleRentalNetwork = {\n networkId: string;\n url?: string;\n};\n"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentripplanner/types",
3
- "version": "9.0.0-alpha.2",
3
+ "version": "9.0.0-alpha.4",
4
4
  "description": "TypeScript types used across multiple OTP-UI packages",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -25,10 +25,16 @@
25
25
  "import": "./lib/otp2/index.js"
26
26
  }
27
27
  },
28
- "repository": "https://github.com/opentripplanner/otp-ui.git",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/opentripplanner/otp-ui.git"
31
+ },
29
32
  "author": "Binh Dam",
30
33
  "license": "MIT",
31
34
  "private": false,
35
+ "dependencies": {
36
+ "@types/geojson": "^7946.0.16"
37
+ },
32
38
  "scripts": {
33
39
  "tsc": "tsc"
34
40
  }
package/src/index.ts CHANGED
@@ -16,7 +16,7 @@ type ZeroOrOne = 0 | 1;
16
16
  export type Company = {
17
17
  id: string;
18
18
  label: string;
19
- /** a comma-separated string listing the modes that this company has */
19
+ /** a comma-separated string listing the modes offered by this company */
20
20
  modes: string;
21
21
  /**
22
22
  * tells OTP UI to ignore the API provided station names
@@ -216,11 +216,26 @@ export type ElevationData = {
216
216
  second: number;
217
217
  }[];
218
218
 
219
+ export type AlertEffect =
220
+ | "ACCESSIBILITY_ISSUE"
221
+ | "ADDITIONAL_SERVICE"
222
+ | "DETOUR"
223
+ | "MODIFIED_SERVICE"
224
+ | "NO_EFFECT"
225
+ | "NO_SERVICE"
226
+ | "OTHER_EFFECT"
227
+ | "REDUCED_SERVICE"
228
+ | "SIGNIFICANT_DELAYS"
229
+ | "STOP_MOVED"
230
+ | "UNKNOWN_EFFECT";
231
+
219
232
  export type Alert = {
220
- alertHeaderText?: string;
221
233
  alertDescriptionText?: string;
234
+ alertEffect?: AlertEffect;
235
+ alertHeaderText?: string;
222
236
  alertUrl?: string;
223
237
  effectiveStartDate?: number;
238
+ entities?: { stop?: { gtfsId?: string } }[];
224
239
  /** Returned by OTP2 graphql queries, but not by OTP1 */
225
240
  id?: string;
226
241
  };
@@ -368,6 +383,7 @@ export type Leg = {
368
383
  productName?: string;
369
384
  };
370
385
  realTime: boolean;
386
+ realtimeState?: "ADDED" | "CANCELED" | "MODIFIED" | "SCHEDULED" | "UPDATED";
371
387
  rentedBike: boolean;
372
388
  rentedCar: boolean;
373
389
  rentedVehicle: boolean;
@@ -395,6 +411,7 @@ export type Leg = {
395
411
  gtfsId?: string;
396
412
  id: string;
397
413
  tripHeadsign?: string;
414
+ tripShortName?: string;
398
415
  };
399
416
  tripBlockId?: string;
400
417
  tripId?: string;
@@ -465,7 +482,7 @@ export type ItineraryOnlyLegsRequired = Partial<Itinerary> &
465
482
  export type ElevationProfile = {
466
483
  maxElev: number;
467
484
  minElev: number;
468
- points: number[];
485
+ points: [number, number][];
469
486
  traversed: number;
470
487
  gain: number;
471
488
  loss: number;
@@ -539,14 +556,35 @@ export type Agency = {
539
556
  phone?: string;
540
557
  fareUrl?: string;
541
558
  };
559
+
560
+ /**
561
+ * Transit modes that correspond with OTP GraphQL `TransitMode`.
562
+ */
563
+ export type TransitMode =
564
+ | "AIRPLANE"
565
+ | "BUS"
566
+ | "CABLE_CAR"
567
+ | "CARPOOL"
568
+ | "COACH"
569
+ | "FERRY"
570
+ | "FUNICULAR"
571
+ | "GONDOLA"
572
+ | "MONORAIL"
573
+ | "RAIL"
574
+ | "SNOW_AND_ICE"
575
+ | "SUBWAY"
576
+ | "TAXI"
577
+ | "TRAM"
578
+ | "TROLLEYBUS";
579
+
542
580
  export type Route = BasicRouteInfo & {
543
581
  agency: Agency;
544
582
  agencyId?: string | number;
545
583
  agencyName?: string | number;
546
- // TODO: Add support for enum values, see /packages/core-utils/src/otpSchema.json#L1289.
584
+ // TODO: Add support for enum values, see /packages/core-utils/src/otpSchema.json#L1289
547
585
  bikesAllowed?: ZeroOrOne;
548
586
  eligibilityRestricted?: ZeroOrOne;
549
- mode?: string;
587
+ mode?: TransitMode;
550
588
  routeBikesAllowed?: ZeroOrOne;
551
589
  sortOrder: number;
552
590
  sortOrderSet: boolean;
@@ -559,21 +597,22 @@ export type TransitivePlace = {
559
597
  placeId?: string;
560
598
  type: string;
561
599
  };
600
+ export type TransitiveSegment = {
601
+ arc?: boolean;
602
+ from?: TransitivePlace;
603
+ patterns?: {
604
+ pattern_id: string;
605
+ from_stop_index: number;
606
+ to_stop_index: number;
607
+ }[];
608
+ streetEdges?: number[];
609
+ to?: TransitivePlace;
610
+ type: string;
611
+ };
562
612
  export type TransitiveJourney = {
563
613
  journey_id: string;
564
614
  journey_name: string;
565
- segments: {
566
- arc?: boolean;
567
- from: TransitivePlace;
568
- patterns?: {
569
- pattern_id: string;
570
- from_stop_index: number;
571
- to_stop_index: number;
572
- }[];
573
- streetEdges: number[];
574
- to: TransitivePlace;
575
- type: string;
576
- }[];
615
+ segments: TransitiveSegment[];
577
616
  };
578
617
  export type TransitivePattern = {
579
618
  pattern_id: string;
@@ -595,7 +634,7 @@ export type TransitiveRoute = {
595
634
  };
596
635
  export type TransitiveStop = {
597
636
  stop_id: string;
598
- stop_name: string;
637
+ stop_name?: string;
599
638
  stop_lat: number;
600
639
  stop_lon: number;
601
640
  };
@@ -659,7 +698,7 @@ export type GeocodedFeature = {
659
698
  };
660
699
 
661
700
  export type TncFare = {
662
- currencyCode: string;
701
+ currencyCode: string | null;
663
702
  maxTNCFare: number;
664
703
  minTNCFare: number;
665
704
  };
@@ -809,15 +848,31 @@ export type ModeSetting = (
809
848
  ModeSettingBase;
810
849
  export type ModeSettingValues = Record<string, number | string | boolean>;
811
850
 
812
- /**
813
- * TransportModes correspond with the OTP GraphQL TransportMode.
814
- * Could be anything from walk, bike (qualifier: rent) to transit, tram, or bus.
815
- */
816
- export type TransportMode = {
851
+ export type PlanModesInput = {
852
+ direct?: string[];
853
+ directOnly?: boolean;
854
+ transit?: PlanTransitModesInput;
855
+ transitOnly?: boolean;
856
+ };
857
+
858
+ export type PlanTransitModesInput = {
859
+ access?: string[];
860
+ egress?: string[];
861
+ transfer?: string[];
862
+ transit?: PlanTransitModePreferenceInput[];
863
+ };
864
+
865
+ export type PlanTransitModePreferenceInput = {
866
+ cost?: { reluctance: number };
817
867
  mode: string;
818
- qualifier?: string;
868
+ replacement?: { requirement?: string };
819
869
  };
820
870
 
871
+ /**
872
+ * A mode selected by the UI, with an optional PlanConnection input for a query.
873
+ */
874
+ export type TransportMode = { input?: PlanModesInput; mode: string };
875
+
821
876
  /**
822
877
  * This is a combination of transportation modes,
823
878
  * with a label to describe them. These are designed
@@ -864,7 +919,29 @@ export type FareProductSelector = {
864
919
  riderCategoryId?: string;
865
920
  };
866
921
 
922
+ export type MediumRiderWhitelist = { medium: string; rider: string }[];
923
+
867
924
  /**
868
925
  * Options for units of mass (used in CO₂ calculation config)
869
926
  */
870
927
  export type MassUnitOption = "ounce" | "kilogram" | "pound" | "gram";
928
+
929
+ /**
930
+ * Options for Heading for PrintableItinerary and ItineraryBody
931
+ */
932
+ export type HeadingAs = "h1" | "h2" | "h3" | "h4" | "span" | "div";
933
+
934
+ /**
935
+ * Options for Heading for PrintableItinerary
936
+ */
937
+ export type LegHeadingConfig = {
938
+ titleHeading?: HeadingAs;
939
+ legHeading?: HeadingAs;
940
+ };
941
+
942
+ /**
943
+ * LegHeadingProp type for headingAs
944
+ */
945
+ export type LegHeadingProp = {
946
+ headingAs?: HeadingAs;
947
+ };