Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentripplanner/core-utils

Package Overview
Dependencies
Maintainers
3
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentripplanner/core-utils - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

248

lib/types.js

@@ -7,3 +7,3 @@ "use strict";

exports.createChainableTypeChecker = createChainableTypeChecker;
exports.latlngType = exports.timeOptionsType = exports.itineraryType = exports.legType = exports.stepsType = exports.customIconsType = exports.configType = void 0;
exports.latlngType = exports.transitIndexStopWithRoutes = exports.timeOptionsType = exports.itineraryType = exports.fareType = exports.legType = exports.stepsType = exports.configType = exports.languageConfigType = exports.transitOperatorType = void 0;

@@ -18,19 +18,157 @@ var _propTypes = _interopRequireDefault(require("prop-types"));

const configType = _propTypes.default.shape({});
/**
* Describes some options to help display data about a transit agency that is
* configured in an opentripplanner instance.
*/
const transitOperatorType = _propTypes.default.shape({
defaultRouteColor: _propTypes.default.string,
defaultRouteTextColor: _propTypes.default.string,
id: _propTypes.default.string.isRequired,
logo: _propTypes.default.string.isRequired,
longNameSplitter: _propTypes.default.string,
name: _propTypes.default.string,
order: _propTypes.default.number
});
exports.transitOperatorType = transitOperatorType;
const languageConfigType = _propTypes.default.shape({
stopViewer: _propTypes.default.string
});
/**
* Represents the expected configuration of the webapp
*/
exports.languageConfigType = languageConfigType;
const configType = _propTypes.default.shape({
companies: _propTypes.default.arrayOf(_propTypes.default.shape({
id: _propTypes.default.string.isRequired,
label: _propTypes.default.string.isRequired,
/* a comma-separated string listing the modes that this company has */
modes: _propTypes.default.string.isRequired
}).isRequired),
dateTime: _propTypes.default.shape({
timeFormat: _propTypes.default.string,
dateFormat: _propTypes.default.string,
longDateFormat: _propTypes.default.string
}),
transitOperators: _propTypes.default.arrayOf(transitOperatorType)
});
exports.configType = configType;
const customIconsType = _propTypes.default.shape({});
const feedScopedIdType = _propTypes.default.shape({
agencyId: _propTypes.default.string,
id: _propTypes.default.string
});
exports.customIconsType = customIconsType;
const encodedPolylineType = _propTypes.default.shape({
length: _propTypes.default.number.isRequired,
points: _propTypes.default.string.isRequired
});
const stepsType = _propTypes.default.arrayOf(_propTypes.default.shape({}));
const elevationData = _propTypes.default.arrayOf(_propTypes.default.shape({
first: _propTypes.default.number.isRequired,
second: _propTypes.default.number.isRequired
}).isRequired);
const alertType = _propTypes.default.shape({
alertHeaderText: _propTypes.default.string,
alertDescriptionText: _propTypes.default.string,
alertUrl: _propTypes.default.string,
effectiveStartDate: _propTypes.default.number
});
/**
* Represents steps in a leg in an itinerary of an OTP plan response. These are
* only for non-transit modes.
* See documentation here: http://otp-docs.ibi-transit.com/api/json_WalkStep.html
*/
const stepsType = _propTypes.default.arrayOf(_propTypes.default.shape({
absoluteDirection: _propTypes.default.string.isRequired,
alerts: _propTypes.default.arrayOf(alertType),
area: _propTypes.default.bool.isRequired,
bogusName: _propTypes.default.bool.isRequired,
distance: _propTypes.default.number.isRequired,
elevation: elevationData.isRequired,
lat: _propTypes.default.number.isRequired,
lon: _propTypes.default.number.isRequired,
relativeDirection: _propTypes.default.string.isRequired,
stayOn: _propTypes.default.bool.isRequired,
streetName: _propTypes.default.string.isRequired
}));
exports.stepsType = stepsType;
const placeType = _propTypes.default.shape({
arrival: _propTypes.default.number,
departure: _propTypes.default.number,
lat: _propTypes.default.number.isRequired,
lon: _propTypes.default.number.isRequired,
name: _propTypes.default.string.isRequired,
networks: _propTypes.default.arrayOf(_propTypes.default.string.isRequired),
stopCode: _propTypes.default.string,
stopId: _propTypes.default.string,
stopIndex: _propTypes.default.number,
stopSequence: _propTypes.default.number,
vertexType: _propTypes.default.string.isRequired,
zoneId: _propTypes.default.string
});
/**
* Represents a leg in an itinerary of an OTP plan response. Each leg represents
* a portion of the overall itinerary that is done until either reaching the
* destination or transitioning to another mode of travel. See OTP webservice
* documentation here:
* http://otp-docs.ibi-transit.com/api/json_Leg.html
*/
const legType = _propTypes.default.shape({
agencyId: _propTypes.default.string,
agencyName: _propTypes.default.string,
agencyTimeZoneOffset: _propTypes.default.number.isRequired,
agencyUrl: _propTypes.default.string,
alerts: _propTypes.default.arrayOf(alertType),
arrivalDelay: _propTypes.default.number.isRequired,
departureDelay: _propTypes.default.number.isRequired,
distance: _propTypes.default.number.isRequired,
duration: _propTypes.default.number.isRequired,
hailedCar: _propTypes.default.string,
endTime: _propTypes.default.number.isRequired,
from: placeType.isRequired,
hailedCar: _propTypes.default.bool.isRequired,
headsign: _propTypes.default.string,
interlineWithPreviousLeg: _propTypes.default.bool.isRequired,
intermediateStops: _propTypes.default.arrayOf(placeType).isRequired,
interStopGeometry: _propTypes.default.arrayOf(encodedPolylineType),
legGeometry: encodedPolylineType.isRequired,
mode: _propTypes.default.string.isRequired,
steps: stepsType.isRequired
pathway: _propTypes.default.bool.isRequired,
realTime: _propTypes.default.bool.isRequired,
rentedBike: _propTypes.default.bool.isRequired,
rentedCar: _propTypes.default.bool.isRequired,
rentedVehicle: _propTypes.default.bool.isRequired,
route: _propTypes.default.string,
routeId: _propTypes.default.string,
routeType: _propTypes.default.number,
serviceDate: _propTypes.default.string,
startTime: _propTypes.default.number.isRequired,
steps: stepsType.isRequired,
tncData: _propTypes.default.shape({
company: _propTypes.default.string.isRequired,
currency: _propTypes.default.string.isRequired,
displayName: _propTypes.default.string.isRequired,
estimatedArrival: _propTypes.default.number.isRequired,
maxCost: _propTypes.default.number.isRequired,
minCost: _propTypes.default.number.isRequired,
productId: _propTypes.default.string.isRequired,
travelDuration: _propTypes.default.number.isRequired
}),
to: placeType.isRequired,
transitLeg: _propTypes.default.bool.isRequired,
tripBlockId: _propTypes.default.string,
tripId: _propTypes.default.string
});

@@ -40,10 +178,100 @@

const moneyType = _propTypes.default.shape({
cents: _propTypes.default.number.isRequired,
currency: _propTypes.default.shape({
defaultFractionDigits: _propTypes.default.number.isRequired,
currencyCode: _propTypes.default.string.isRequired,
symbol: _propTypes.default.string.isRequired,
currency: _propTypes.default.string.isRequired
}).isRequired
});
/**
* Represents the fare component of an itinerary of an OTP plan response. See
* detailed documentation in OTP webservice documentation here:
* http://otp-docs.ibi-transit.com/api/json_Fare.html
*
* NOTE: so far the fare includes ONLY a fare encountered on public transit and
* not any bike rental or TNC rental fees.
*/
const fareType = _propTypes.default.shape({
details: _propTypes.default.objectOf(_propTypes.default.shape({
fareId: feedScopedIdType.isRequired,
price: moneyType.isRequired,
routes: _propTypes.default.arrayOf(feedScopedIdType).isRequired
}).isRequired),
fare: _propTypes.default.objectOf(moneyType)
});
/**
* Represents an itinerary of an OTP plan response. See detailed documentation
* in OTP webservice documentation here:
* http://otp-docs.ibi-transit.com/api/json_Itinerary.html
*/
exports.fareType = fareType;
const itineraryType = _propTypes.default.shape({
legs: _propTypes.default.arrayOf(legType).isRequired
duration: _propTypes.default.number.isRequired,
elevationGained: _propTypes.default.number.isRequired,
elevationLost: _propTypes.default.number.isRequired,
endTime: _propTypes.default.number.isRequired,
fare: fareType,
legs: _propTypes.default.arrayOf(legType).isRequired,
startTime: _propTypes.default.number.isRequired,
tooSloped: _propTypes.default.bool,
transfers: _propTypes.default.number.isRequired,
transitTime: _propTypes.default.number.isRequired,
waitingTime: _propTypes.default.number.isRequired,
walkDistance: _propTypes.default.number.isRequired,
walkLimitExceeded: _propTypes.default.bool.isRequired,
walkTime: _propTypes.default.number.isRequired
});
/**
* Used to help display the time of day within the context of a particular itinerary.
*/
exports.itineraryType = itineraryType;
const timeOptionsType = _propTypes.default.shape({});
const timeOptionsType = _propTypes.default.shape({
/**
* A format string template to be used to display a date using moment.js
*/
format: _propTypes.default.string,
/*
* The timezone offset in milliseconds if any should be added. This is
* typically calculated using the itinerary.js#getTimeZoneOffset function.
*/
offset: _propTypes.default.number
});
/**
* This models data about a stop and it's associated routes that is obtained
* from a transit index API.
*/
exports.timeOptionsType = timeOptionsType;
const transitIndexStopWithRoutes = _propTypes.default.shape({
/**
* The stop code if the stop has one
*/
code: _propTypes.default.string,
/**
* The distance from the user to the stop in meters
*/
dist: _propTypes.default.number,
lat: _propTypes.default.number,
lon: _propTypes.default.number,
name: _propTypes.default.string,
routes: _propTypes.default.arrayOf(_propTypes.default.shape({
longName: _propTypes.default.string,
shortName: _propTypes.default.string
}))
});
/**
* Utility function to help create chained validators

@@ -55,3 +283,3 @@ * per https://www.ian-thomas.net/custom-proptype-validation-with-react/

exports.timeOptionsType = timeOptionsType;
exports.transitIndexStopWithRoutes = transitIndexStopWithRoutes;

@@ -58,0 +286,0 @@ function createChainableTypeChecker(validator) {

4

package.json
{
"name": "@opentripplanner/core-utils",
"version": "0.0.7",
"version": "0.0.8",
"description": "Core functionality that is shared among numerous UI components",

@@ -19,3 +19,3 @@ "main": "lib/index.js",

},
"gitHead": "e6f87c71a639fbd63c0b8916d08e4e2e7ca59129"
"gitHead": "c5651883ccc2dc20140918ee63fc881c84b43d9e"
}

@@ -5,17 +5,244 @@ import PropTypes from "prop-types";

export const configType = PropTypes.shape({});
export const customIconsType = PropTypes.shape({});
export const stepsType = PropTypes.arrayOf(PropTypes.shape({}));
/**
* Describes some options to help display data about a transit agency that is
* configured in an opentripplanner instance.
*/
export const transitOperatorType = PropTypes.shape({
defaultRouteColor: PropTypes.string,
defaultRouteTextColor: PropTypes.string,
id: PropTypes.string.isRequired,
logo: PropTypes.string.isRequired,
longNameSplitter: PropTypes.string,
name: PropTypes.string,
order: PropTypes.number
});
export const languageConfigType = PropTypes.shape({
stopViewer: PropTypes.string
});
/**
* Represents the expected configuration of the webapp
*/
export const configType = PropTypes.shape({
companies: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
/* a comma-separated string listing the modes that this company has */
modes: PropTypes.string.isRequired
}).isRequired
),
dateTime: PropTypes.shape({
timeFormat: PropTypes.string,
dateFormat: PropTypes.string,
longDateFormat: PropTypes.string
}),
transitOperators: PropTypes.arrayOf(transitOperatorType)
});
const feedScopedIdType = PropTypes.shape({
agencyId: PropTypes.string,
id: PropTypes.string
});
const encodedPolylineType = PropTypes.shape({
length: PropTypes.number.isRequired,
points: PropTypes.string.isRequired
});
const elevationData = PropTypes.arrayOf(
PropTypes.shape({
first: PropTypes.number.isRequired,
second: PropTypes.number.isRequired
}).isRequired
);
const alertType = PropTypes.shape({
alertHeaderText: PropTypes.string,
alertDescriptionText: PropTypes.string,
alertUrl: PropTypes.string,
effectiveStartDate: PropTypes.number
});
/**
* Represents steps in a leg in an itinerary of an OTP plan response. These are
* only for non-transit modes.
* See documentation here: http://otp-docs.ibi-transit.com/api/json_WalkStep.html
*/
export const stepsType = PropTypes.arrayOf(
PropTypes.shape({
absoluteDirection: PropTypes.string.isRequired,
alerts: PropTypes.arrayOf(alertType),
area: PropTypes.bool.isRequired,
bogusName: PropTypes.bool.isRequired,
distance: PropTypes.number.isRequired,
elevation: elevationData.isRequired,
lat: PropTypes.number.isRequired,
lon: PropTypes.number.isRequired,
relativeDirection: PropTypes.string.isRequired,
stayOn: PropTypes.bool.isRequired,
streetName: PropTypes.string.isRequired
})
);
const placeType = PropTypes.shape({
arrival: PropTypes.number,
departure: PropTypes.number,
lat: PropTypes.number.isRequired,
lon: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
networks: PropTypes.arrayOf(PropTypes.string.isRequired),
stopCode: PropTypes.string,
stopId: PropTypes.string,
stopIndex: PropTypes.number,
stopSequence: PropTypes.number,
vertexType: PropTypes.string.isRequired,
zoneId: PropTypes.string
});
/**
* Represents a leg in an itinerary of an OTP plan response. Each leg represents
* a portion of the overall itinerary that is done until either reaching the
* destination or transitioning to another mode of travel. See OTP webservice
* documentation here:
* http://otp-docs.ibi-transit.com/api/json_Leg.html
*/
export const legType = PropTypes.shape({
agencyId: PropTypes.string,
agencyName: PropTypes.string,
agencyTimeZoneOffset: PropTypes.number.isRequired,
agencyUrl: PropTypes.string,
alerts: PropTypes.arrayOf(alertType),
arrivalDelay: PropTypes.number.isRequired,
departureDelay: PropTypes.number.isRequired,
distance: PropTypes.number.isRequired,
duration: PropTypes.number.isRequired,
hailedCar: PropTypes.string,
endTime: PropTypes.number.isRequired,
from: placeType.isRequired,
hailedCar: PropTypes.bool.isRequired,
headsign: PropTypes.string,
interlineWithPreviousLeg: PropTypes.bool.isRequired,
intermediateStops: PropTypes.arrayOf(placeType).isRequired,
interStopGeometry: PropTypes.arrayOf(encodedPolylineType),
legGeometry: encodedPolylineType.isRequired,
mode: PropTypes.string.isRequired,
steps: stepsType.isRequired
pathway: PropTypes.bool.isRequired,
realTime: PropTypes.bool.isRequired,
rentedBike: PropTypes.bool.isRequired,
rentedCar: PropTypes.bool.isRequired,
rentedVehicle: PropTypes.bool.isRequired,
route: PropTypes.string,
routeId: PropTypes.string,
routeType: PropTypes.number,
serviceDate: PropTypes.string,
startTime: PropTypes.number.isRequired,
steps: stepsType.isRequired,
tncData: PropTypes.shape({
company: PropTypes.string.isRequired,
currency: PropTypes.string.isRequired,
displayName: PropTypes.string.isRequired,
estimatedArrival: PropTypes.number.isRequired,
maxCost: PropTypes.number.isRequired,
minCost: PropTypes.number.isRequired,
productId: PropTypes.string.isRequired,
travelDuration: PropTypes.number.isRequired
}),
to: placeType.isRequired,
transitLeg: PropTypes.bool.isRequired,
tripBlockId: PropTypes.string,
tripId: PropTypes.string
});
const moneyType = PropTypes.shape({
cents: PropTypes.number.isRequired,
currency: PropTypes.shape({
defaultFractionDigits: PropTypes.number.isRequired,
currencyCode: PropTypes.string.isRequired,
symbol: PropTypes.string.isRequired,
currency: PropTypes.string.isRequired
}).isRequired
});
/**
* Represents the fare component of an itinerary of an OTP plan response. See
* detailed documentation in OTP webservice documentation here:
* http://otp-docs.ibi-transit.com/api/json_Fare.html
*
* NOTE: so far the fare includes ONLY a fare encountered on public transit and
* not any bike rental or TNC rental fees.
*/
export const fareType = PropTypes.shape({
details: PropTypes.objectOf(
PropTypes.shape({
fareId: feedScopedIdType.isRequired,
price: moneyType.isRequired,
routes: PropTypes.arrayOf(feedScopedIdType).isRequired
}).isRequired
),
fare: PropTypes.objectOf(moneyType)
});
/**
* Represents an itinerary of an OTP plan response. See detailed documentation
* in OTP webservice documentation here:
* http://otp-docs.ibi-transit.com/api/json_Itinerary.html
*/
export const itineraryType = PropTypes.shape({
legs: PropTypes.arrayOf(legType).isRequired
duration: PropTypes.number.isRequired,
elevationGained: PropTypes.number.isRequired,
elevationLost: PropTypes.number.isRequired,
endTime: PropTypes.number.isRequired,
fare: fareType,
legs: PropTypes.arrayOf(legType).isRequired,
startTime: PropTypes.number.isRequired,
tooSloped: PropTypes.bool,
transfers: PropTypes.number.isRequired,
transitTime: PropTypes.number.isRequired,
waitingTime: PropTypes.number.isRequired,
walkDistance: PropTypes.number.isRequired,
walkLimitExceeded: PropTypes.bool.isRequired,
walkTime: PropTypes.number.isRequired
});
export const timeOptionsType = PropTypes.shape({});
/**
* Used to help display the time of day within the context of a particular itinerary.
*/
export const timeOptionsType = PropTypes.shape({
/**
* A format string template to be used to display a date using moment.js
*/
format: PropTypes.string,
/*
* The timezone offset in milliseconds if any should be added. This is
* typically calculated using the itinerary.js#getTimeZoneOffset function.
*/
offset: PropTypes.number
});
/**
* This models data about a stop and it's associated routes that is obtained
* from a transit index API.
*/
export const transitIndexStopWithRoutes = PropTypes.shape({
/**
* The stop code if the stop has one
*/
code: PropTypes.string,
/**
* The distance from the user to the stop in meters
*/
dist: PropTypes.number,
lat: PropTypes.number,
lon: PropTypes.number,
name: PropTypes.string,
routes: PropTypes.arrayOf(
PropTypes.shape({
longName: PropTypes.string,
shortName: PropTypes.string
})
)
});
/**
* Utility function to help create chained validators

@@ -22,0 +249,0 @@ * per https://www.ian-thomas.net/custom-proptype-validation-with-react/

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc