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

cityworks

v2.2.7

Published

A Cityworks API wrapper

Readme

Cityworks node.js API wrapper

This API wrapper for Cityworks follows the Cityworks release schedule as closely as possible. Functionality may be missing depending on necessity or use.

Require the class:

  const cw = require('cityworks')

or

  import * as cw from 'cityworks'

Instantiate the Class for the instance of Cityworks available given a domain:

  cw.Cityworks.configure('cwoffice.domain.tld', {path: 'cityworks', version: 15})

or

  cw.Cityworks.configure('cw.domain.tld', {path: 'cityworks', version: 23});

Authentication

Authenticate with the Cityworks install:

  cw.Cityworks.authenticate('myuser', 'mypassword').then(resp => {}).catch(error => {
    console.log(error.message)
  })

Get the currently valid token in order to store it in a session or cookie:

  cw.Cityworks.getToken()

Provide a saved token instead of the standard u/p auth:

  cw.Cityworks.setToken('mytoken')

Main method calls

Access the primary AMS (Inspection, WorkOrder, & Service Request) & PLL object libraries like so:

  cw.inspection.methodHere().then(resp => {})
  cw.workorder.methodHere().then(resp => {})
  cw.request.methodHere().then(resp => {})
  cw.briefcase.methodHere().then(resp => {})

Some of the methods are general or top-level, and so, are accessed separately are at the same level of reference from the cityworks object:

General methods including authentication:

  cw.general.methodHere().then(resp => {})

Message queue methods for examining, processing, and troubleshooting webhooks and activity events:

  cw.message_queue.methodHere().then(resp => {})

Activity link for linking one node/object to another:

  cw.activity_link.methodHere().then(resp => {})

Mapping and GIS methods not specific to a single object type:

  cw.gis.methodHere().then(resp => {})

General query methods:

  cw.query.methodHere().then(resp => {})

(Deprecated) General search methods:

  cw.search.methodHere().then(resp => {})

Case financials, data details, and admin

For the sake of organizing some of the other methods needed by the primary and secondary libraries, there are also objects and methods accessed within those main libraries:

For PLL case financial actions:

  cw.briefcase.financial.methodHere().then(resp => {})

For PLL case data details & data groups:

  cw.briefcase.data.methodHere().then(resp => {})

For PLL case workflow and task actions:

  cw.briefcase.workflow.methodHere().then(resp => {})

For PLL administration actions:

  cw.briefcase.admin.methodHere().then(resp => {})

Commenting

For any object in Cityworks which can be commented on, use the Comments class via the class the comment is to be made on:

  cw.briefcase.comment.add(CaObjectIdGoesHere, "Comment goes here").then(resp => {})

  cw.workorder.comment.add(WorkOrderSIDGoesHere, "Comment goes here").then(resp => {})

  cw.request.comment.add(RequestIDGoesHere, "Comment goes here").then(resp => {})

Attachments

For any object in Cityworks which has attachments, (including cases as CaRelDocs), use the Attachments class via the class the attachment is to be made on:

  cw.briefcase.attachment.add(CaObjectIdGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})

  cw.workorder.attachment.add(WorkOrderSIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})

  cw.request.attachment.add(RequestIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})

  cw.inspection.attachment.add(InspectionIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})

Activity Links

  cw.activity_link.add(source_type, source_sid, destination_type, destination_sid)