51Degrees Pipeline Node.js  4.1

51Degrees Pipeline for Node.js

readme

51Degrees Node Pipeline

Developer Documentation

Introduction

This repository contains the components of the Node.JS implementation of the 51Degrees Pipeline API.

The Pipeline is a generic web request intelligence and data processing solution with the ability to add a range of 51Degrees and/or custom plug ins (Engines)

Contents

This repository produces 5 modules:

  • fiftyone.pipeline.core - Defines the essential components of the Pipeline API such as 'flow elements', 'flow data' and 'evidence'
  • fiftyone.pipeline.engines - Functionality for a specialized type of flow element called an engine.
  • fiftyone.pipeline.engines.fiftyone - Functionality specific to 51Degrees engines.
  • fiftyone.pipeline.cloudrequestengine - An engine used to make requests to the 51Degrees cloud service.
  • fiftyone.pipeline.javascriptbundler - A flow element used to bundle together and minify multiple JavaScript snippets.

Installation

The modules in this repository are available on the node package manager:

npm i fiftyone.pipeline.core
npm i fiftyone.pipeline.engines
npm i fiftyone.pipeline.engines.fiftyone
npm i fiftyone.pipeline.cloudrequestengine
npm i fiftyone.pipeline.javascriptbundler

They can also be installed from this repository by running:

npm i <path to module>

Tests

Most modules include some automated tests. To run these, make sure jest is installed:

npm install jest --global

Then, navigate to the module directory and execute:

npm test

Examples

There are several examples available:

  • examples/pipelines.js - Demonstrates several different types of flow element and how to add them to a pipeline.
  • examples/caching.js - Demonstrates a custom cache that makes use of the result caching feature that engines provide.
  • examples/customFlowElements/1-simpleEvidenceFlowElement.js - Demonstrates how to create a custom flow element that takes some evidence (birthdate) and returns something related to that evidence (star sign)
  • examples/customFlowElements/2-onPremiseFlowElement.js - Demonstrates how to modify the flow element from the 'simple evidence' example to use a data file to determine star sign rather than a hard-coded table.
  • examples/customFlowelements/3-clientSideEvidenceFlowElement.js - Demonstrates how to modify the flow element from the 'simple evidence' example to gather evidence from code running on the client device (i.e. JavaScript).