npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

paraplan-react

v0.3.0

Published

Library for ParaPlan API

Readme

paraplan-react

Library for ParaPlan API On Demand and Demand Response Transportation

NPM JavaScript Style Guide

Install

npm install --save paraplan-react

Example

There is an example project available here.

Login

Configuration Options (Filespecs)

import { config } from 'paraplan-react'
getConfig(){
        var request = {
            restUrl: '<from login>',
            key: '<from login>',
            device: 'connect-web',
        }
        config(request)
            .then(response => {
                this.setState({
                    success: response.success,
                    config: response.entity,
                })
            })
            .catch(reason => {
                this.setState({
                    success: reason.success,
                    errorMessage: reason.errorMessage,
                })
            })
    }

Drivers

import { allDrivers } from 'paraplan-react'

getDrivers() {
    var request = {
        restUrl: '<from login>',
        key: '<from login>',
        device: 'connect-web',
    }
    allDrivers(request)
        .then(response => {
            this.setState({
                success: response.success,
                allDrivers: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Save Fleetmanager

import { saveFleetmanager } from 'paraplan-react'
saveFleetmanager(){

    var fm = {
        driverID: 157,
        routeId: 102,
        endTime: "/Date(-2209093200000+0000)/",
        startTime: "/Date(-2209141800000+0000)/",
        vehicleID: 311,
        fleetmanagerID: 10463
    }

    var request = {
        restUrl: '<from login>',
        key: '<from login>',
        device: 'connect-web',
        fleetmanager: fm,
    }


    saveFleetmanager(request)
        .then(response => {
            console.log(response);
            this.setState({fleetManagerId: response.fleetmanagerId})

        })
        .catch(reason => {
            console.log(reason.errorMessage)
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })

}

Vehicles

import { allVehicles } from 'paraplan-react'

getVehicles() {

    var request = {
        restUrl: '<from login>',
        key: '<from login>',
        device: 'connect-web',
    }
    allVehicles(request)
        .then(response => {
            this.setState({
                success: response.success,
                allVehicles: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Routes (FleetManagers)

import { routes } from 'paraplan-react'

viewTodaysRoutes() {
  var request = {
      restUrl: '<from login>',
      key: '<from login>',
      tripDate: '06-15-2020'
      device: 'connect-web',
  }
  routes(request).then(response => {
      this.setState({
          success: response.success,
          errorMessage: response.errorMessage,
          routes: response.list,
      })
  })
  .catch((reason) => {
      this.setState({
          success: reason.success,
          errorMessage: reason.errorMessage,
      })
  })
}
import { allRoutes } from 'paraplan-react'
getRoutes() {
    const { key, restUrl, requestDevice } = this.state

    var request = {
        restUrl: '<from login>',
        key: '<from login>',
        device: 'connect-web',
    }
    allRoutes(request)
        .then(response => {
            this.setState({
                success: response.success,
                allRoutes: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Trips

import { trips } from 'paraplan-react'

viewTodaysTrips() {
  var request = {
    restUrl: '<from login>',
    key: '<from login>',
    device: 'connect-web',
    startTime: new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000,
    endTime: new Date(new Date().setHours(24, 0, 0, 0)).getTime() / 1000,
  }
  trips(request).then(response => {
      this.setState({
          success: response.success,
          errorMessage: response.errorMessage,
          trips: response.list,
      })
  })
  .catch((reason) => {
      this.setState({
          success: reason.success,
          errorMessage: reason.errorMessage,
      })
  })
}

Trip Requests

import { tripRequests } from 'paraplan-react'

viewTodaysTripRequests() {
  var request = {
    restUrl: '<from login>',
    key: '<from login>',
    device: 'connect-web',
    startDateTime: new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000,
    endDateTime: new Date(new Date().setHours(24, 0, 0, 0)).getTime() / 1000,
  }
  tripRequests(request).then(response => {
      this.setState({
          success: response.success,
          errorMessage: response.errorMessage,
          requests: response.list,
      })
  })
  .catch((reason) => {
      this.setState({
          success: reason.success,
          errorMessage: reason.errorMessage,
      })
  })
}

Managing Trips Requests

import { approveRequest } from 'paraplan-react'

approveTripRequest() {

    var request = {
        restUrl: '<from login>',
        key: '<from login>',
        device: 'connect-web',
        tripRequest: <trip request to approve>
    }

    approveRequest(request)
        .then(response => {
            var tripStatus = response.request.tripStatus
            var importTripID = response.request.importTripID
            this.setState({
                success: response.success,
                tripRequests: this.state.tripRequests.map(el =>
                    el.importTripID === importTripID
                        ? { ...el,  tripStatus}
                        : el
                )
            })
            //response also includes `.stops` which are the legs of the approved trip
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}
import { rejectRequest } from 'paraplan-react'

rejectTripRequest() {

    var request = {
        restUrl: '<from login>',
        key: '<from login>',
        device: 'connect-web',
        tripRequest: <trip request to reject>,
        rejectReason: <reason trip is being rejected>
    }

    rejectRequest(request)
        .then(response => {
            var tripStatus = response.entity.tripStatus
            var importTripID = response.entity.importTripID
            this.setState({
                success: response.success,
                tripRequests: this.state.tripRequests.map(el =>
                    el.importTripID === importTripID
                        ? { ...el,  tripStatus}
                        : el
                )
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Add a new trip (not request)


addTripFromDispatch() {
    var request = {
        key: <from login>,
        restUrl: <from login>,
        device: 'connect-web',
        trip: {
                client: {
                    id: 19282
                },
                pickUpPlace: {
                    databaseId: 35604
                },
                dropOffPlace: {
                    databaseId: 34409
                },
                scheduledPickUpTime : moment().add(5,'minutes').unix(),
                scheduledDropOffTime : moment().add(30,'minutes').unix(),
                appointmentTime : moment().add(5,'minutes').unix(),
                program : {
                    databaseID : 53
                },
            }
    }

    addTrip(request)
            .then(response => {
                this.setState({
                    success: response.success,
                    successMessage: 'new tripid is ' + response.entity.tripId
                })
            })
            .catch(reason => {
                this.setState({
                    success: reason.success,
                    errorMessage: reason.errorMessage,
                })
            })
}

  • While request.tripRequest will take the entire trip request. It only needs to have .importTripID populated. It will ignore all other fields and build the object on the server fresh from the database.
  • In the return object, request will have the most up to date version of the trip request.
  • Also, the return object of approve will contain stops, which is an array of Stop. Appending existing stop arrays with this data will save a round trip to the server.
  • Since we are dealing with trip requests and http requests, you might want to rename your variables to avoid confusion.

Scheduling trips to routes

import { scheduleTrip } from 'paraplan-react'

scheduleTripToRoute(trip, fleetmanager) {

    var request = {
        key: <from login>,
        restUrl: <from login>,
        device: 'connect-web',
        fleetManagerId: <fleetmanager ID to assign to>,
        trip: <trip to assign. Only .tripId needed>
    }

    scheduleTrip(request)
        .then(response => {
            var tripId = response.entity.tripId
            var fleetmanager = response.entity.fleetmanager

            this.setState({
                success: response.success,
                dispatcherTrips: this.state.dispatcherTrips.map(el =>
                    el.tripId === tripId
                        ? { ...el, fleetmanager }
                        : el
                ),
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}
import { unscheduleTrip } from 'paraplan-react'
unscheduleTrip() {
    var request = {
        key: <from login>,
        restUrl: <from login>,
        device: 'connect-web',
        trip: <trip to assign. Only .tripId needed>
    }

    unscheduleTrip(request)
        .then(response => {
            var tripId = response.trip.tripId
            var fleetmanager = response.trip.fleetmanager

            console.log(response.trip)

            this.setState({
                success: response.success,
                dispatcherTrips: this.state.dispatcherTrips.map(el =>
                    el.tripId === tripId
                        ? { ...el, fleetmanager }
                        : el
                ),
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Searching for clients

import { clientSearch } from 'paraplan-react'

searchClients(){
    const { key, restUrl, requestDevice, clientSearchString } = this.state
    var request = {
        key: key,
        restUrl: restUrl,
        device: requestDevice,
        search: clientSearchString,
    }
    
    clientSearch(request)
        .then(response => {
            this.setState({
                success: response.success,
                clients: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
    }
}

Places

import { placeSearch } from 'paraplan-react'

searchPlaces(){
    const { key, restUrl, requestDevice, placesSearchString } = this.state
    var request = {
        key: key,
        restUrl: restUrl,
        device: requestDevice,
        search: placesSearchString,
    }
    
    placeSearch(request)
        .then(response => {
            this.setState({
                success: response.success,
                places: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })

    }
//Places specificallly designated as on demand spots
import { placesOnDemand } from 'paraplan-react'

getOnDemandPlaces() {
    const { key, restUrl, requestDevice } = this.state

    var request = {
        key: key,
        restUrl: restUrl,
        device: requestDevice,
    }
    placesOnDemand(request)
        .then(response => {
            this.setState({
                success: response.success,
                places: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Programs (Trip funding source)

import { programs } from 'paraplan-react'

getPrograms() {
    const { key, restUrl, requestDevice } = this.state

    var request = {
        key: key,
        restUrl: restUrl,
        device: requestDevice,
    }

    programs(request)
        .then(response => {
            this.setState({
                success: response.success,
                programs: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Trip Purposes (Appointment Types)

import { purposes } from 'paraplan-react'
getPurposes() {
    const { key, restUrl, requestDevice } = this.state

    var request = {
        key: key,
        restUrl: restUrl,
        device: requestDevice,
    }
    purposes(request)
        .then(response => {
            this.setState({
                success: response.success,
                purposes: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Client Status Types

import { statusTypes } from 'paraplan-react'
getStatusTypes() {
    const { key, restUrl, requestDevice } = this.state

    var request = {
        key: key,
        restUrl: restUrl,
        device: requestDevice,
    }
    statusTypes(request)
        .then(response => {
            this.setState({
                success: response.success,
                statusTypes: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

Wheelchair Types

import { wheelchairTypes } from 'paraplan-react'
getWheelchairTypes() {
    const { key, restUrl, requestDevice } = this.state

    var request = {
        key: key,
        restUrl: restUrl,
        device: requestDevice,
    }
    wheelChairTypes(request)
        .then(response => {
            this.setState({
                success: response.success,
                wheelchairTypes: response.list,
            })
        })
        .catch(reason => {
            this.setState({
                success: reason.success,
                errorMessage: reason.errorMessage,
            })
        })
}

License

MIT © timhibbard [email protected]