@opentripplanner/types 7.0.0-alpha.9 → 8.0.0
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/esm/deprecated.js +1 -1
- package/esm/deprecated.js.map +1 -1
- package/esm/index.js +24 -0
- package/esm/index.js.map +1 -1
- package/lib/deprecated.d.ts +4 -4
- package/lib/deprecated.d.ts.map +1 -1
- package/lib/deprecated.js +1 -0
- package/lib/deprecated.js.map +1 -1
- package/lib/index.d.ts +116 -78
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -140
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +65 -20
- package/tsconfig.tsbuildinfo +1 -1
package/lib/index.js
CHANGED
|
@@ -1,147 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ModeSettingTypes = void 0;
|
|
7
|
-
|
|
8
2
|
/**
|
|
9
3
|
* This file contains type definitions for types
|
|
10
4
|
* used across more than one package in this repo.
|
|
11
5
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Describes some options to help display data about a transit agency that is
|
|
19
|
-
* configured in an opentripplanner instance.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Describes a map entity to be rendered.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The symbol-representing component to draw; with the signature
|
|
28
|
-
* ({ entity: object; zoom: number }) => Element
|
|
29
|
-
* where entity must have an id attribute and contain coordinates information for placement on the map.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Defines which symbol to render based on a zoom level; and optionally by entity type.
|
|
34
|
-
* (Only one symbol is rendered for any zoom level.)
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Describes the objects from the real-time vehicle service.
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Represents the expected configuration of the webapp.
|
|
43
|
-
*
|
|
44
|
-
* Note: this is an incomplete type mapping.
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Represents steps in a leg in an itinerary of an OTP plan response. These are
|
|
49
|
-
* only for non-transit modes.
|
|
50
|
-
* See documentation here: http://otp-docs.ibi-transit.com/api/json_WalkStep.html
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Describe an origin, destination, or intermediate location in an itinerary.
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Holds contact info and lead time for flex transit bookings.
|
|
59
|
-
* The information is optional and is for reminding the end-user
|
|
60
|
-
* of any advance reservations required prior to travel.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
/** Dropoff-specific flex booking information */
|
|
64
|
-
|
|
65
|
-
/** Pickup-specific flex booking information */
|
|
66
|
-
|
|
67
|
-
/** Basic transit route attributes */
|
|
68
|
-
|
|
69
|
-
/** Transit route attributes from itinerary legs */
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Represents a leg in an itinerary of an OTP plan response. Each leg represents
|
|
73
|
-
* a portion of the overall itinerary that is done until either reaching the
|
|
74
|
-
* destination or transitioning to another mode of travel. See OTP webservice
|
|
75
|
-
* documentation here:
|
|
76
|
-
* http://otp-docs.ibi-transit.com/api/json_Leg.html
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Describes the cost of an itinerary leg.
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Represents an itinerary of an OTP plan response. See detailed documentation
|
|
85
|
-
* in OTP webservice documentation here:
|
|
86
|
-
* http://otp-docs.ibi-transit.com/api/json_Itinerary.html
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* In many places all we need from the Itinerary is the legs,
|
|
91
|
-
* this type makes all the other types optional except legs.
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Used to model a location that is used in planning a trip.
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Alias for a commonly used basic type
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Describes a transit stop entity to be rendered on the map.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* This models data about a stop and it's associated routes that is obtained
|
|
108
|
-
* from a transit index API.
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Depending on the geocoder that is used, more properties than just the `label`
|
|
113
|
-
* property might be provided by the geocoder. For example, with the Pelias
|
|
114
|
-
* geocoder, properties such as `id`, `layer`, `source` are also included.
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Describes a user location such as "home", "work" etc.
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Associates a location with a type string.
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Parameters for "clear location" event handlers.
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Parameters for location actions/event handlers.
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Supports leg icons for itinerary body and printable itinerary.
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Supports displaying accessibility ratings as a set of thresholds
|
|
139
|
-
* associated with an icon or text.
|
|
140
|
-
*/
|
|
141
|
-
const ModeSettingTypes = {
|
|
142
|
-
CHECKBOX: "CHECKBOX",
|
|
143
|
-
DROPDOWN: "DROPDOWN",
|
|
144
|
-
SLIDER: "SLIDER"
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ModeSettingTypes = void 0;
|
|
8
|
+
exports.ModeSettingTypes = {
|
|
9
|
+
CHECKBOX: "CHECKBOX",
|
|
10
|
+
DROPDOWN: "DROPDOWN",
|
|
11
|
+
SLIDER: "SLIDER"
|
|
145
12
|
};
|
|
146
|
-
exports.ModeSettingTypes = ModeSettingTypes;
|
|
147
13
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["ModeSettingTypes","CHECKBOX","DROPDOWN","SLIDER"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAaA;AACA;AACA;AACA;;AAYA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AA8BA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;;AAoEA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;;AAWA;;AAKA;;AAKA;;AAWA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgFA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAuBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAmHA;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,GAAG;AAC9BC,EAAAA,QAAQ,EAAE,UADoB;AAE9BC,EAAAA,QAAQ,EAAE,UAFoB;AAG9BC,EAAAA,MAAM,EAAE;AAHsB,CAAzB","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 { 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 that this company has */\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 routeShortName?: string;\n routeLongName?: string;\n routeType?: string;\n routeColor?: string;\n\n status?: string;\n reportDate?: string;\n seconds?: number;\n\n stopSequence?: number;\n stopId?: string;\n vehicleId?: string;\n tripId?: string;\n blockId?: string;\n\n lat?: number;\n lon?: number;\n heading?: 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\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 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\nexport type EncodedPolyline = {\n length: number;\n points: string;\n};\n\nexport type ElevationData = {\n first: number;\n second: number;\n}[];\n\nexport type Alert = {\n alertHeaderText?: string;\n alertDescriptionText?: string;\n alertUrl?: string;\n effectiveStartDate?: number;\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 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 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 };\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 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 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 to: Place;\n transitLeg: boolean;\n trip?: {\n arrivalStoptime?: TripStopTime;\n departureStoptime?: TripStopTime;\n gtfsId?: string;\n id: string;\n tripHeadsign?: 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\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[];\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\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.Polygon };\n id: string;\n lat?: number;\n lon?: number;\n name: string;\n routes?: Route[];\n gtfsId: string;\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};\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?: string;\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 TransitiveJourney = {\n journey_id: string;\n journey_name: string;\n segments: {\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 }[];\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 // TS TODO coordinate type\n x: number;\n y: 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;\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 id?: string;\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 addTransportMode?: TransportMode;\n default?: boolean;\n falseValue?: boolean | string | number;\n id?: string;\n label: string;\n truthValue?: boolean | string | number;\n type: \"CHECKBOX\";\n value?: boolean;\n};\n\nexport type TransitSubmodeCheckboxOption = {\n addTransportMode: TransportMode;\n default?: boolean;\n label: string;\n type: \"SUBMODE\";\n value?: boolean;\n};\n\nexport type ModeSettingBase = {\n applicableMode: string;\n iconName?: string;\n icon?: JSX.Element;\n id?: string;\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\n/**\n * TransportModes correspond with the OTP GraphQL TransportMode.\n * Could be anything from walk, bike (qualifier: rent) to transit, tram, or bus.\n */\nexport type TransportMode = {\n mode: string;\n qualifier?: string;\n};\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 id: string;\n medium?: {\n id: string;\n name: string;\n };\n name: string;\n price: Money;\n riderCategory?: {\n id: string;\n name: string;\n };\n};\n\nexport type FareProductSelector = {\n riderCategoryId: string;\n mediumId: string;\n};\n\n/**\n * Options for units of mass (used in CO₂ calculation config)\n */\nexport type MassUnitOption = \"ounce\" | \"kilogram\" | \"pound\" | \"gram\";\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAktBU,QAAA,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "TypeScript types used across multiple OTP-UI packages",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"tsc": "tsc"
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { FunctionComponent, ReactElement } from "react";
|
|
7
|
+
import { IntlShape } from "react-intl";
|
|
7
8
|
import { StyledIcon } from "@styled-icons/styled-icon";
|
|
8
9
|
import { ConfiguredModes } from "./deprecated";
|
|
9
10
|
|
|
@@ -97,24 +98,25 @@ export type ZoomBasedSymbol = {
|
|
|
97
98
|
* Describes the objects from the real-time vehicle service.
|
|
98
99
|
*/
|
|
99
100
|
export type TransitVehicle = {
|
|
100
|
-
|
|
101
|
+
routeColor?: string;
|
|
101
102
|
routeLongName?: string;
|
|
103
|
+
routeShortName?: string;
|
|
102
104
|
routeType?: string;
|
|
103
|
-
routeColor?: string;
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
lastUpdated?: number;
|
|
106
107
|
reportDate?: string;
|
|
107
108
|
seconds?: number;
|
|
109
|
+
status?: string;
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
blockId?: string;
|
|
110
112
|
stopId?: string;
|
|
111
|
-
|
|
113
|
+
stopSequence?: number;
|
|
112
114
|
tripId?: string;
|
|
113
|
-
|
|
115
|
+
vehicleId?: string;
|
|
114
116
|
|
|
117
|
+
heading?: number;
|
|
115
118
|
lat?: number;
|
|
116
119
|
lon?: number;
|
|
117
|
-
heading?: number;
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
export type OTPTransitVehicle = TransitVehicle & {
|
|
@@ -147,6 +149,11 @@ export type Config = {
|
|
|
147
149
|
/** @deprecated */
|
|
148
150
|
longDateFormat?: string;
|
|
149
151
|
};
|
|
152
|
+
formatDuration?: (
|
|
153
|
+
duration: number,
|
|
154
|
+
intl: IntlShape,
|
|
155
|
+
includeSeconds: boolean
|
|
156
|
+
) => string;
|
|
150
157
|
homeTimezone: string;
|
|
151
158
|
/** @deprecated */
|
|
152
159
|
modes?: ConfiguredModes;
|
|
@@ -192,6 +199,11 @@ export type EncodedPolyline = {
|
|
|
192
199
|
points: string;
|
|
193
200
|
};
|
|
194
201
|
|
|
202
|
+
export type ElevationProfileComponent = {
|
|
203
|
+
distance: number;
|
|
204
|
+
elevation: number;
|
|
205
|
+
};
|
|
206
|
+
|
|
195
207
|
export type ElevationData = {
|
|
196
208
|
first: number;
|
|
197
209
|
second: number;
|
|
@@ -217,7 +229,8 @@ export type Step = {
|
|
|
217
229
|
area: boolean;
|
|
218
230
|
bogusName: boolean;
|
|
219
231
|
distance: number;
|
|
220
|
-
elevation
|
|
232
|
+
elevation?: ElevationData;
|
|
233
|
+
elevationProfile?: ElevationProfileComponent[];
|
|
221
234
|
lat: number;
|
|
222
235
|
lon: number;
|
|
223
236
|
relativeDirection: string;
|
|
@@ -238,6 +251,7 @@ export type Place = {
|
|
|
238
251
|
name: string;
|
|
239
252
|
networks?: string[];
|
|
240
253
|
rentalVehicle?: { network: string };
|
|
254
|
+
vehicleRentalStation?: { rentalNetwork: { networkId: string } };
|
|
241
255
|
stop?: Stop;
|
|
242
256
|
/**
|
|
243
257
|
* @deprecated Only for OTP1 support, removal is immenent
|
|
@@ -386,6 +400,11 @@ type TemporaryTNCPriceType = {
|
|
|
386
400
|
amount: number;
|
|
387
401
|
};
|
|
388
402
|
|
|
403
|
+
export type Currency = {
|
|
404
|
+
code: string;
|
|
405
|
+
digits: number;
|
|
406
|
+
};
|
|
407
|
+
|
|
389
408
|
/**
|
|
390
409
|
* Describes the cost of an itinerary leg.
|
|
391
410
|
*/
|
|
@@ -473,6 +492,8 @@ export type StopLayerStop = LayerEntity & {
|
|
|
473
492
|
name: string;
|
|
474
493
|
};
|
|
475
494
|
|
|
495
|
+
export type StopEventHandler = (stop: Stop | { stopId: string }) => void;
|
|
496
|
+
|
|
476
497
|
/**
|
|
477
498
|
* This models data about a stop and it's associated routes that is obtained
|
|
478
499
|
* from a transit index API.
|
|
@@ -484,13 +505,13 @@ export type Stop = {
|
|
|
484
505
|
code?: string;
|
|
485
506
|
color?: string;
|
|
486
507
|
dist?: number;
|
|
487
|
-
geometries?: { geoJson?: GeoJSON.
|
|
508
|
+
geometries?: { geoJson?: GeoJSON.GeometryObject };
|
|
509
|
+
gtfsId: string;
|
|
488
510
|
id: string;
|
|
489
511
|
lat?: number;
|
|
490
512
|
lon?: number;
|
|
491
513
|
name: string;
|
|
492
514
|
routes?: Route[];
|
|
493
|
-
gtfsId: string;
|
|
494
515
|
};
|
|
495
516
|
|
|
496
517
|
export type Agency = {
|
|
@@ -586,11 +607,24 @@ export type Station = {
|
|
|
586
607
|
name?: string;
|
|
587
608
|
networks: string[];
|
|
588
609
|
spacesAvailable?: number;
|
|
589
|
-
// TS TODO coordinate type
|
|
590
610
|
x: number;
|
|
591
611
|
y: number;
|
|
592
612
|
};
|
|
593
613
|
|
|
614
|
+
export type TileLayerStation = {
|
|
615
|
+
bikesAvailable?: number;
|
|
616
|
+
id: string;
|
|
617
|
+
isFloatingBike?: boolean;
|
|
618
|
+
isFloatingCar?: boolean;
|
|
619
|
+
isFloatingVehicle?: boolean;
|
|
620
|
+
lat: number;
|
|
621
|
+
lon: number;
|
|
622
|
+
name?: string;
|
|
623
|
+
network?: string;
|
|
624
|
+
spacesAvailable?: number;
|
|
625
|
+
vehiclesAvailable?: number;
|
|
626
|
+
};
|
|
627
|
+
|
|
594
628
|
/**
|
|
595
629
|
* Depending on the geocoder that is used, more properties than just the `label`
|
|
596
630
|
* property might be provided by the geocoder. For example, with the Pelias
|
|
@@ -710,7 +744,6 @@ export type DropdownOptions = {
|
|
|
710
744
|
export type SliderOptions = {
|
|
711
745
|
default?: number;
|
|
712
746
|
high: number;
|
|
713
|
-
id?: string;
|
|
714
747
|
inverseKey?: string;
|
|
715
748
|
label: string;
|
|
716
749
|
labelHigh: string;
|
|
@@ -722,20 +755,24 @@ export type SliderOptions = {
|
|
|
722
755
|
};
|
|
723
756
|
|
|
724
757
|
export type CheckboxOptions = {
|
|
725
|
-
|
|
758
|
+
// This transport mode should match an OTP transport mode
|
|
759
|
+
addTransportMode?: TransportMode | TransportMode[];
|
|
726
760
|
default?: boolean;
|
|
727
|
-
falseValue?: boolean | string | number;
|
|
728
|
-
id?: string;
|
|
729
761
|
label: string;
|
|
730
|
-
truthValue?: boolean | string | number;
|
|
731
762
|
type: "CHECKBOX";
|
|
763
|
+
truthValue?: boolean | string | number;
|
|
764
|
+
falseValue?: boolean | string | number;
|
|
732
765
|
value?: boolean;
|
|
733
766
|
};
|
|
734
767
|
|
|
735
768
|
export type TransitSubmodeCheckboxOption = {
|
|
769
|
+
// This transport mode should match an OTP transport mode
|
|
736
770
|
addTransportMode: TransportMode;
|
|
737
771
|
default?: boolean;
|
|
738
772
|
label: string;
|
|
773
|
+
// We might want to specify a secondary, "override" mode to this checkbox.
|
|
774
|
+
// This can be used to generate a list of banned routes that have a matching mode.
|
|
775
|
+
overrideMode?: string;
|
|
739
776
|
type: "SUBMODE";
|
|
740
777
|
value?: boolean;
|
|
741
778
|
};
|
|
@@ -744,7 +781,6 @@ export type ModeSettingBase = {
|
|
|
744
781
|
applicableMode: string;
|
|
745
782
|
iconName?: string;
|
|
746
783
|
icon?: JSX.Element;
|
|
747
|
-
id?: string;
|
|
748
784
|
key: string;
|
|
749
785
|
};
|
|
750
786
|
|
|
@@ -785,22 +821,31 @@ export type ModeButtonDefinition = {
|
|
|
785
821
|
* Definition for a fare product used to pay the fare for a leg in a transit journey
|
|
786
822
|
*/
|
|
787
823
|
export type FareProduct = {
|
|
824
|
+
__typename: string;
|
|
788
825
|
id: string;
|
|
789
826
|
medium?: {
|
|
790
827
|
id: string;
|
|
791
828
|
name: string;
|
|
792
829
|
};
|
|
793
830
|
name: string;
|
|
794
|
-
price
|
|
831
|
+
// Fare products may not have a price if they don't implement a FareProduct subclass.
|
|
832
|
+
price?: Money;
|
|
795
833
|
riderCategory?: {
|
|
796
834
|
id: string;
|
|
797
835
|
name: string;
|
|
798
836
|
};
|
|
799
837
|
};
|
|
800
838
|
|
|
839
|
+
/**
|
|
840
|
+
* This fare product is designed to represent the fare product applied to a leg.
|
|
841
|
+
*/
|
|
842
|
+
export type AppliedFareProduct = FareProduct & {
|
|
843
|
+
legPrice: Money;
|
|
844
|
+
};
|
|
845
|
+
|
|
801
846
|
export type FareProductSelector = {
|
|
802
|
-
|
|
803
|
-
|
|
847
|
+
mediumId?: string;
|
|
848
|
+
riderCategoryId?: string;
|
|
804
849
|
};
|
|
805
850
|
|
|
806
851
|
/**
|