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

zosconnect-node

v2.0.0

Published

Node zosconnect

Downloads

2,678

Readme

Build status codecov.io Dependencies Module LTS Adopted'

Table of Contents

Node zosconnect

A wrapper service for z/OS® Connect EE, enabling node applications to discover and access zSystems resources that are service enabled by z/OS® Connect. Version 2 of this module pre-reqs z/OS Connect EE V3.0.8 or later.

Services and APIs are identified by name that is unique within the scope of the target z/OS® Connect instance (or cluster). The node application uses pre-existing knowledge of the service or API name, or discovers it dynamically by retrieving a list of available services or APIs. The z/OS® Connect node wrapper provides access to JSON request and response schemas for the specific z/OS® Connect service and the Swagger document for APIs, enabling the node application to invoke that service and process the response.

Installing

npm install zosconnect-node

Usage

Connecting to z/OS Connect

var ZosConnect = require('zosconnect-node');
var options = {
  uri:'http://mainframe:8080'
}
var zosconnect = new ZosConnect(options);

The options object matches exactly the options described by the request/request module. The uri or url parameter must be specified.

HTTPs Support

Create the options object with locations for the CA certificate file and optionally the client certificate and client private key (if using client authentication). If the strictSSL option is set to false then invalid SSL certificates can be used which may be of use in development environments.

var fs = require('fs');
var path = require('path');
var caFile = path.resolve(__dirname, 'ca.pem');
var certFile = path.resolve(__dirname, 'cert.pem');
var keyFile = path.resolve(__dirname, 'key.pem');
var options = {
  uri:'https://mainframe:9443',
  ca: fs.readFileSync(caFile),
  cert: fs.readFileSync(certFile),
  key: fs.readFileSync(keyFile),
  passphrase: 'passw0rd',
  strictSSL: true
}
Basic Authentication

Add the authentication credentials to the options object.

var options = {
  uri: 'http://mainframe:9080',
  auth: {
    user: 'userId',
    pass: 'password'
  }
}

APIs

Retrieve a list of APIs
zosconnect.getApis().then(console.log);
Get an API
zosconnect.getApi('healthApi').then(console.log);
Create an API
zosconnect.createApi(fs.readFileSync('api.aar')).then(console.log);
Call an API
zosconnect.getApi('healthApi').then((api) => {
  api.invoke('patient/12345', 'GET', null).then((response) => {
    if(response.statusCode != 200) {
      console.log('Invoke failed with respCode = ' + response.statusCode);
    } else {
      console.log(response.body);
    }
  }).catch(console.log);
});
Get the Swagger document for an API
zosconnect.getApi('healthApi').then((api) => {
  api.getApiDoc('swagger').then(console.log);
});
Start or Stop an API
zosconnect.getApi('healthApi', function(error, api){
  api.stop().catch(console.log);
  api.start().catch(console.log);
})
Update an API
zosconnect.getApi('healthApi').then((api) => {
  api.update(fs.readFileSync('healthApi.aar')).catch(console.log);
});
Delete an API
zosconnect.getApi('healthApi').then((api) => {
  api.delete().catch(console.log);
})

Services

Retrieve a list of services
zosconnect.getServices().then(console.log);
Create a Service
zosconnect.createService(fs.readFileSync('dateTimeService.sar')).then(console.log);
Get a service
zosconnect.getService('dateTimeService').then(console.log);
//normally this would then go on and work with the service
Invoke a service
zosconnect.getService('dateTimeService').then((service) => {
  service.invoke({input:'data'}).then((response) => {
    if(response.statusCode != 200) {
      console.log('Invoke failed with respCode = ' + response.statusCode);
    } else {
      console.log(response.body);
    }
  }).catch(console.log);
});
Get the request schema
zosconnect.getService('dateTimeService').then((service) => {
  service.getRequestSchema().then(console.log).catch(console.log);
});
Get the response schema
zosconnect.getService('dateTimeService').then((service) => {
  service.getResponseSchema().then(console.log).catch(console.log);;
});
Update a Service
zosconnect.getService('dateTimeService').then((service) => {
  service.update(fs.readFileSync('dateTimeService.sar')).catch(console.log);
});
Delete a Service
zosconnect.getService('dateTimeService').then((service) => {
  service.delete().catch(console.log);
})

Module Long Term Support Policy

This module adopts the Module Long Term Support (LTS) policy, with the following End Of Life (EOL) dates:

| Module Version | Release Date | Minimum EOL | EOL With | Status | |------------------|--------------|-------------|--------------|---------| | 2.x.x | Jul 2018 | Dec 2019 | | Current | 1.x.x | Jul 2017 | Dec 2019 | Node 8 | LTS |

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.