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

uwsws

v10.0.3

Published

Client Library for University of Washington's Student Web Service

Downloads

31

Readme

UW Student Web Service

This implements most of the v5 UW Student 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 9.0.0 and later require Node 16 and only support ES6 modules at this time. CommonJS may be supported in the future.

USE

Installation

npm i uwsws

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 SWS API. This helps when working with UW IT to debug your application.

baseUrl

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

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

The Student 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.

uwSwsLogLevel

You can set the log level to silly, trace, debug, info, warn, error, fatal. If nothing is specified

import UwSws from 'uwsws';

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

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

  //uwSwsLogLevel: '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 uwSws = new UwSws(config);

const termData = await uwSws.term.current();

console.log(termData);

Using the same config, get the intro to programming course for winter 2015.

let options = {
  year: 2015,
  quarter: 'winter',
  curriculum: 'cse',
  course: '142'
};

const courseData = await uwSws.course.get(options);

console.log(courseData);

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 UwSws configuration object.

Endpoint Implementation

All of the UwSws methods return a promise for a result.

All links below go to the official service documentation. The code block refers to it's implementation in this module.

All of the option parameters are outlined in src/endpoint/* modules.

Endpoint | Implementation ------------- | ------------- Campus | UwSws.campus.all() College Search | UwSws.college.search(options) Course | UwSws.course.get(options) Course Search | UwSws.course.search(options) Curriculum Search | UwSws.curriculum.search(options) Department Search | UwSws.department.search(options) Enrollment | UwSws.enrollment.getRegistrations(options) Enrollment Search | UwSws.enrollment.getEnrolledTerms(options) Major | UwSws.major.search(options) Person | UwSws.person.get(regId) Person Search | UwSws.person.search(options) Program | UwSws.program.get(options) Program Search | UwSws.program.search(options) Registration Search | UwSws.registration.search(options) Section | UwSws.section.get(options) Section Search | UwSws.section.search(options) Term | UwSws.term.next(), .previous(), .current(), currentAndNext(number?), and get(options) Test Score | UwSws.testScore.get(options)

Not Implemented

Most of these are not implemented due to additional security requirements beyond a simple 509 cert. Requirements such as permissions in ASTRA or x-uw-act-as permissions passed in the header. Feel free fork and make a pull request with working tests if you have those permissions. Others are simply planned for a future release.

extra security needed

not needed

Development

Copy __tests__/setup/config-sample.ts to __tests__/setup/config.ts and edit values as needed. Use the npm commands indicated in package.json.

npm test