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

node-gaws

v8.0.0-beta.15

Published

This package implements the [v4 Graduate Applicant Webservice](https://webapps.grad.uw.edu/services/applicants/v4/documentation/servicesApplicants.xml) API for Node.js.

Downloads

11

Readme

UW Graduate Applicant Web Service

This package implements the v4 Graduate Applicant Webservice API for Node.js.

Note: node-gaws version 7 supports GAWS api V4. Use node-gaws 6.x for GAWS api V3.

USE

Installation

Install from the NPM package repository.

npm i node-gaws

Basic Use

Import the module and initialize it.

import { Gaws } from 'node-gaws';

const gaws = new Gaws({
  organizationName: 'My Organization Name',
  baseUrl: 'https://testweb.grad.uw.edu/services/applicants/v4/api/',
  auth: {
    cert: 'your certificate data',
    key: 'your key data'
  },
  logLevel: config.logLevel,
});

const gawsApiResponse = await gaws.programs.getAuthorized();

console.log(gawsApiResponse.data);

Certificate Helpers

Usually you do not want to put certificates and other secrets in your code. You can implement your own certificate data retrieval and supply it directly to Gaws. This GAWS API package provides two helper certificate fetchers for retrieving certificate information: file and AWS S3. These helpers are accessed via the certificate fetcher manager.

You can create your own cert fetchers and add them dynamically to the certificate fetcher manager. See the certFetcher tests for examples how to add custom fetchers.

The certificate manager returns a certificate fetcher of the type you specify. Once you have the cert fetcher, you can call readCertificate() to get the certificate data in an object that you can pass directly to the auth option.

File Certificate Fetcher

The file certificate fetcher retrieves the certificate information from the local file system. You pass the path to the certificate and key to the fetcher.


import { Gaws, CertFetcherManager} from 'node-gaws';

const config = {
  organizationName: 'FosterIT-GAWS',
  baseUrl: 'https://testweb.grad.uw.edu/services/applicants/v3/api/',
  logLevel: 'debug',
  certFiles: {
    certPath: 'path to certificate file',
    keyPath: 'path to key file',
  },
};

const certFetcherManager = new CertFetcherManager();

const fetcher = certFetcherManager.getFetcher('file');

const certData = await fetcher.readCertificate(config.certFiles);

const gaws = new Gaws({
  organizationName: config.organizationName,
  baseUrl: config.baseUrl,
  auth: certData,
  logLevel: config.logLevel,
});

const gawsApiResponse = await gaws.programs.getAuthorized();

console.log(gawsApiResponse.data);

S3 Certificate Fetcher

The s3 certificate fetcher retrieves the certificate information from an Amazon AWS S3 object store. You pass the bucket and key for the certificate and key to the fetcher.


import { Gaws, CertFetcherManager} from 'node-gaws';

const config = {
  organizationName: 'FosterIT-GAWS',
  baseUrl: 'https://testweb.grad.uw.edu/services/applicants/v3/api/',
  logLevel: 'debug',
  certFiles: {
    certBucket: 'cert bucket name',
    certKey: 'cert S3 key name',
    keyBucket: 'key bucket name',
    keyKey: 'key S3 key name',
  },
};

const certFetcherManager = new CertFetcherManager();

const fetcher = certFetcherManager.getFetcher('s3');

const certData = await fetcher.readCertificate(config.certFiles);

const gaws = new Gaws({
  organizationName: config.organizationName,
  baseUrl: config.baseUrl,
  auth: certData,
  logLevel: config.logLevel,
});

const gawsApiResponse = await gaws.programs.getAuthorized();

console.log(gawsApiResponse.data);

Config options

organizationName

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

baseUrl

At the moment, this module only supports the GAWS v3 api. You can use the test or production server.

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

The Graduate Applicant 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.

logLevel

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

Endpoints Implemented

All the v3 endpoints except for documents have been implemented. By default, all requests are made to the JSON endpoints, if you want XML as the response set options.format to xml.

GAWS Endpoint|Implementation -|- gradprograms|uwgaws.programs.getAuthorized() applicants|uwgaws.applicants.getByProgram(program options) applications (single)|uwgaws.applications.getById(application options) applications (for program)|uwgaws.applications.getByProgram(program options)

Program Options

  const options = {
    gradProgId: 999,
    year:       2037,
    quarter:    1
  };

Application Options

  const options = {
    id: 12345678
  };

Got to v3 Graduate Applicant Web Service page for complete details.

DEVELOPMENT

This package is written in TypeScript and uses Jest for testing.

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

npm run test
npm run lint
npm run build