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

uwpws

v6.0.8

Published

Client Library for University of Washington's Person Web Service

Downloads

91

Readme

UW Person Web Service

This implements the v2 UW Person Webservice endpoints. Each endpoint is queried using convenient options to build the final request.

This module assumes you have gone through all the required steps to get access and verified that access as documented in the SWS wiki.

Note: Version 4.0.0 and later require Node 8.

USE

Installation

npm i uwpws

Configuration

Configuration options are passed as an object to the constructor.

organizationName

The organization name is a string that identifies your organization and will appear in the headers of requests to the UW PWS API. This helps when working with UW IT to debug your application.

baseUrl

The URL of the PWS server. You can use the test or production server.

auth: { cert: 'cert data', key: 'key data' }

The Person Web Service requires that you pass a valid UW x509 client certificate with all requests. The data returned from the request is restricted to what is authorized for your cert.

You can use the included certificate fetcher helpers to get cert and key data from local files, from an AWS S3 bucket, or you can create a custom fetcher.

uwPwsLogLevel

You can set the log level to silly, trace, debug, info, warn, error, or fatal.

import UwPws from 'uwPws';

const config = {
  organizationName: 'YOUR ORGANIZATION NAME',

  baseUrl: 'https://ws.admin.washington.edu/student/v5/',

  //uwPwsLogLevel: 'debug',

  // Change 'certData' property to the return value of the
  // 'readCertificate()' method if using a certFetcher helper.
  certData: {
    cert: 'PASS CERT STRING OR BUFFER HERE',
    key: 'PASS CERT STRING OR BUFFER HERE',
  },
};

const uwPws = new UwPws(config);

const aPerson = {
  firstName: 'BART',
  lastName: 'SIMPSON',
};
const result = await uwPws.person.search(aPerson);
const searchResults = result.data;

console.log(searchResults);

For more use examples see the unit tests in __tests__/*.

For a full list of all the supported endpoints and options see src/endpoints/*.

If you find one that doesn't work or if an endpoint or option isn't supported, please create an issue.

Certificate Fetchers

This package includes a helper module to fetch client certificates using different methods. The built-in fetchers includes support for AWS S3 and the local file system. You can also create custom certificate fetchers. See the ./__tests__/certFetcher-test.ts file for a custom certFetcher example.

import { CertFetcherManager } from '../src/index';

// AWS S3 fetcher configuration options
const s3Config = {
  region: 'YOUR S3 REGION',
  certBucket: 'CERTIFICATE BUCKET NAME',
  certKey: 'CERTIFICATE KEY',
  keyBucket: 'KEY BUCKET NAME',
  keyKey: 'KEY KEY',
}

// Local file fetcher configuration options
const localConfig = {
      cert: 'PATH TO CERTIFICATE FILE',
      key: 'PATH TO KEY FILE',
    }

const certFetcherManager = new CertFetcherManager();

const s3Fetcher = certFetcherManager.getFetcher('s3');
const s3CertData = await s3Fetcher.readCertificate(s3Config);

const fileFetcher = certFetcherManager.getFetcher('file');
const fileCertData = await fileFetcher.readCertificate(localConfig);

// ... pass s3CertData or fileCertData to UwPws configuration object.

Endpoint Implementation

Endpoint | Implementation ---------|-------------- Entity | UwPws.entity.get(options) Entity Search | UwPws.entity.search(options) Person | UwPws.person.get(options) Person Search | UwPws.person.search(options)