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

@timbarretto/custom-op-client

v1.0.4

Published

Client library for OpenProject.org server. Works both in Node.js and browsers.

Readme

#op-client

Client library for OpenProject server. Works both in Node.js and browser. Tested with OpenProject v10 and v11.

Installation

npm add op-client

Quick start

import {CO, Duration, EntityManager, Project, Status, StatusEnum, Type, WP, TypeEnum, User} from "../src";
import {config} from "dotenv";

// reading ENVIRONMENT from .env file
config();

(async () => {
  // create EntityManager instance
  const em = new EntityManager({
    baseUrl: process.env.BASE_URL,
    oauthOptions: {
      clientId: process.env.CLIENT_ID,
      clientSecret: process.env.CLIENT_SECRET,
    },
    createLogger: () => console
  });

  // get Work Package by id
  const wp = await em.get<WP>(WP, 12)

  // modify Work package
  wp.type = new Type(TypeEnum.Epic)
  wp.subject = 'Quick start Demo'
  wp.estimatedTime = new Duration({days: 24, hours: 15})
  wp.startDate = new Date()
  await em.patch(wp, false);   // or patch some fields only eg em.patch(wp, false, ['startDate','_links.type']);

  // create new Work Package
  const wp2 = new WP()
  wp2.type = new Type(TypeEnum.Task)
  wp2.project= new Project(1)
  wp2.subject = 'Read all examples'
  wp.assignee= new User(1)
  await em.create(wp2)
  console.log(wp2.createdAt) // -> current date

  // get Work package collection by filters
  const wpCollection = await em.getMany<WP>(WP, {
    offset: 2,
    pageSize: 5,
    filters: [{
      project: {
        operator: "!",
        values: 2
      },
    }]
  })
  console.log(wpCollection[2].subject) // -> Upload presentations to website

  // get Type by id
  const type = await em.get<Type>(Type, TypeEnum.Milestone);
  console.log(type.self.title) // ->Milestone

  // get Project by id
  const project = await em.get<Project>(Project, 1);
  console.log(project.self.title) // ->Demo project

  // get Status by id
  const status = await em.get<Status>(Status, StatusEnum.InProgress);
  console.log(status.self.title) // ->In Progress

  // get Custom Option by id
  try {
    const co = await em.get<CO>(CO, 1);
    console.log(co.self.title) // ->In progress
  }
  // this will throw error if you haven't at least one CustomOptions
  catch(err){
    console.log(err.message) // ->404 [urn:openproject-org:api:v3:errors:NotFound] The requested resource could not be found.
  }

  // get User by id
  const user = await em.get<User>(User, 1);
  console.log(user.self.title) // ->System
})()

Setting up OAuth connection

  • Login as admin
  • Select Administration / Authentication / OAuth applications
  • Follow https://docs.openproject.org/system-admin-guide/authentication/oauth-applications/

Development

# clone repo
git clone https://github.com/alexey2baranov/node-op-client
cd node-op-client

# run unit tests
npm test


# to run integrated test run OpenProject, setup OAuth2.0 connection and fill <PROJECT_ROOT>/.env file
npm run server:up
touch .env
npm run test:integration
npm run server:down

<PROJECT_ROOT>/.env file

BASE_URL=http://localhost:8093

CLIENT_ID=...
CLIENT_SECRET=...

ToDo

  • Add more documentation