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

r3connect-vjsoria

v1.1.0

Published

r3connect is a lean wrapper of node-rfc that provides comfortable access to SAP back-ends via a simple REST API.

Downloads

5

Readme

r3connect

npm license github-issues
styled with prettier

r3connect is a lean wrapper of node-rfc that provides comfortable access to SAP back-ends via a simple REST API or via a Promise-based API. All remote function calls are handled via connection pools in order to reuse connections as much as possible and run function calls in parallel. Technical errors are prettified and mapped to corresponding HTTP responses. In favor of simplification this module is also designed to run in a container with Docker.

nodei.co

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Install the latest LTS version of Node.js. In case you did not use the installer, make sure that node and npm are available in the terminal. In order to use r3connect you need to obtain the SAP NW RFC Library from the SAP Service Marketplace Software Download Center. If you want to build a Docker container, also install Docker.

Installing

Node module

In case you would like to call a RFC within your existing node script without using the REST API you can also install r3connect as a dependency:

npm install r3connect --save

Please make sure that you installed node-rfc

npm install node-rfc --save

Afterwards you can require r3connect and call any RFC:

const r3connect = require('r3connect');

// Define connection configuration
const configuration = {
  applicationServer: 'example.company.corp',
  instanceNumber: 1,
  username: 'testuser',
  password: 'helloworld',
  client: 123,
  router: '',
};

// Acquire client from pool
r3connect.Pool.get(configuration).acquire()
.then(function (client) {
  // Actually call the back-end
  return client.invoke('RSIM_RFC_CONNECTION_TEST', { 
    iv_test: 'test'
  });
})
.then(function (response) {
  // Output response
  const result = response[0];
  const meta = response[1];
  
  console.log('Result:');
  console.log(result);
  console.log('Metadata:');
  console.log(meta);
})
.catch(function (error) {
  // Output error
  console.log('Error:');
  console.log(error);
});

Or alternatively in ES6 syntax:

import { Pool } from 'r3connect';

// Define connection configuration
const configuration = {
  applicationServer: 'example.company.corp',
  instanceNumber: 1,
  username: 'testuser',
  password: 'helloworld',
  client: 123,
  router: '',
};

// Acquire client from pool
Pool.get(configuration).acquire()
.then((client) => {
  return client.invoke('RSIM_RFC_CONNECTION_TEST', { 
    iv_test: 'test'
  });
})
.then(([result, meta]) => {
  console.log('Result:');
  console.log(result);
  console.log('Metadata:');
  console.log(meta);
})
.catch((error) => {
  console.log('Error:');
  console.log(error);
});

Local Server

Open the terminal and install r3connect globally. This usually takes some time which you can use to grab a cup of coffee or tea.

npm install r3connect -g

To generate a new project, navigate to the directory where you want it to be and type. Skip the parts that you cannot or do not want to answer.

npm init

This will generate a package.json which will define your new project including all dependencies. Afterwards kick-start your first r3connect project by running:

r3connect init

This should initialize your project folder with all necessary files to start with. If you want to start a local server run:

r3connect server

Depending on which hostname and port you defined in config.js the server will be available via https://localhost:3001/ by default. For example, if you want to invoke the remote-enabled function module RSIM_RFC_CONNECTION_TEST, execute the following POST request. The endpoint in this case would be https://localhost:3001/rfc/RSIM_RFC_CONNECTION_TEST and the body of the request would contain values for applicationServer, instanceNumber, client, username, password and parameters (JSON object).

POST /rfc/RSIM_RFC_CONNECTION_TEST HTTP/1.1
Host: localhost:3001
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="applicationServer"

example.company.corp
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="username"

testuser
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="password"

helloworld
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="instanceNumber"

1
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="client"

123
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="parameters"

{ "iv_test": "test" }
------WebKitFormBoundary7MA4YWxkTrZu0gW--

An example response would look like this:

{
  "result": {
    "E_INVOKED": "X"
  },
  "meta": {
    "invokeTime": 54,
    "connectTime": 102
  }
}

Docker

Similar to the local server, open the terminal and install r3connect globally:

npm install r3connect -g

To generate a new project, navigate to the directory where you want it to be and type. Skip the parts that you cannot or do not want to answer.

npm init

This will generate a package.json which will define your new project including all dependencies. Afterwards kick-start your first r3connect project by running:

r3connect init

This should initialize your project folder with all necessary files to start with. If you want to create the Docker container, run:

r3connect docker

Running the tests

Mocha tests are implemented and you can run all tests via

npm run test

Built With

  • hapi.js - Rich framework for building applications and services
  • node-rfc - nodejs RFC Connector
  • pool2 - Simple resource pool

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Julian Hundeloh - Initial work - jaulz

See also the list of contributors who participated in this project.

License

This project is licensed under the AGPL-3.0+ License - see the LICENSE.md file for details. If you are interested in other options please get in touch via [email protected].

Acknowledgments