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 🙏

© 2024 – Pkg Stats / Ryan Hefner

jira-wrapper

v0.0.9

Published

JS wrapper around the Jira REST API

Downloads

16

Readme

Jira REST API wrapper

Installation

npm intall jira-wrapper

Usage

var jira = require('jira-wrapper')({
  authString: 'base64 of user:pass',
  uri: 'http://jira.example.com/api'
});

// print assigned issues worked on in the past week
jira
  .search
  .any('engineer', 'currentUser()', 'assignee', 'currentUser()')
  .whereIn('issueFunction', 'worklogged("after today -1w")')
  .orderBy('priority DESC, created ASC')
  .run(function(issues){
    issues.forEach(function(i){
      console.log(i.format('%(id)-11s %(status)-17s %(priority)-14s %(summary)s'));
    });
  });

API

Jira

constructor(options)

  • uri - URL of the JSON REST API (e.g. http://jira.example.com/api)
  • authString - base64 encoded version of "user:pass"
  • strictSSL - If true, requires SSL certificates to be valid. (default: true)
  • customFields - object defining custom fields defined in the Jira instance Should be an object where the keys are the friendly field name and will be set as attributes on Issues. The value can either be a string or a function. If a string, it should be the name of the field in Jira. If a function, it should take one argument: the json object response from Jira, and return the field value.

request(path, [options], [callback])

Makes a request to the Jira REST API.

  • path can either be an absolute url, or the relative API path
  • options, if specified, is forwarded to the request (mikeal/request)
  • callback, receives (err, response, json)

search()

Returns a new Search instance for building a JQL query.

issue(issueId, [update, fields], callback)

Retrieves or updates an issue. If only the id and callback are specified, it retrieves the issue. If update and fields are also specified, it will make a POST request to update the issue. The callback receives (err, response, Issue)

worklog(issue, duration, [started], [comment], [callback])

Post a work log.

Search

where(key, value)

Add a filter to the where clause.

whereIn(key, values...)

Add a contains filter to the where clause.

any(key, value, key2, value2, ...)

Add multiple where filters, or'd together.

orderBy(str)

Set the order by clause.

query([query])

Get or set the query.

run(callback)

Run the query. Callback receives (err, response, Issues).

Issue

loadWorkLog(callback)

Loads the work logs for the issue. Callback receives one argument: the issue.

format(str)

Format a string using fields from this issue. Uses sprintf.

e.g.: issue.format('%(id)-11s: %(summary)')

isBug()

Test if the issue is a bug.

isProject()

Test if the issue is a 'project', as defined by Issue.projectTypes.

Issue.isBug(issue)

Tests if an issue is a bug. Helper function when filtering lists.

Issue.isProject(issue)

Tests if an issue is a project, as defined by Issue.projectTypes. Helper function when filtering lists.

Issue.projectTypes

Array of issue types considered to be a 'project'. Defaults to: Feature, Improvement, and Task.

License

MIT