Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

kettle

fluid-project1.1kBSD-3-Clause2.3.0

Declarative IoC-based framework for HTTP and WebSockets servers on node.js based on express and ws

infusion, framework, application, fluid, IoC, express, Inversion of Control, MVC, evented

readme

Kettle

Build status

Kettle is an integration technology which promotes the expression of servers handling HTTP and WebSockets endpoints. With a few exceptions, Kettle implements no primary functionality of its own, but aggregates the facilities of express and ws, as well as middleware held in the wider pillarjs "Bring your own HTTP Framework Framework" ecosystem. Kettle applications can easily incorporate any express-standard middleware, as well as coexisting with standard express apps targeted at the same node.js http.Server. Since Kettle applications are expressed declaratively, in the JSON format encoding Infusion's component trees, it is possible to adapt existing applications easily, as well as inserting middleware and new handlers anywhere in the pipeline without modifying the original application's code. This makes Kettle suitable for uses where application functionality needs to be deployed flexibly in a variety of different configurations.

In fact, Kettle's dependency on express itself is minimal, since the entirety of the Kettle request handling pipeline is packaged as a single piece of express-compatible middleware – Kettle could be deployed against any other consumer of middleware or even a raw node.js HTTP server.

Notes on Kettle 2.x releases

The 2.x line of Kettle releases are (at the time of writing) still code-compatible with the 1.x releases in terms of support for user code, but the 2.x Kettle releases break compatibility with older versions of Infusion (1.x through 3.x). Kettle 1.x has been compatible with mainline releases of Infusion as well as those from in-progress FLUID-6145 and FLUID-6148 branches. Kettle 2.x releases are only compatible with 4.x releases of Infusion (and historically, those from the FLUID-6145 branch, newer than and including 3.0.0-dev.20200930T151056Z.d0b9e348d.FLUID-6145 ).

Contents of this repository

Core Kettle implementation

This is packaged as Infusion grades derived from kettle.server, kettle.request and kettle.app. The first two of these exist in variants specialized both for plain HTTP (with the .http suffix) and for WebSockets (with the .ws suffix) – kettle.app does not specialize.

Contents - Testing

As well as the integration technology implementing Kettle itself, this repository also contains functionality helpful for testing HTTP and WebSockets servers written in arbitrary technologies. This is accessed by running kettle.loadTestingSupport() after having called require("kettle"). Kettle testing support allows HTTP and WebSockets client requests to be packaged as Infusion components, suitable for use with Infusion's IoC Testing Framework. Any user of Kettle's testing support needs to have node-jqunit registered as a member of their own project's devDependencies in their own package.json.

Kettle runs on node.js version 12.x and upward (see package.json for current dependency profile).

Contents - DataSources

The Kettle repository also contains a few implementations of the simple DataSource contract for read/write access to data with a simple semantic (broadly the same as that encoded in CRUD although the current DataSource semantic does not provide explicitly for deletion). See the documentation section on DataSources for details of this contract, the available implementations and how to use them.

This repository contains DataSource implementations suitable for HTTP endpoints (with a particular variety specialised for accessing CouchDB databases with CRUDlike semantics) as well as the filesystem, with an emphasis on JSON payloads.

Getting Started and Community

Installation instructions

Firstly, install node and npm by running a standard installer from node.js. Clone this repository and then run npm install.

Issue Tracking

Issue tracking is at http://issues.fluidproject.org/browse/KETTLE.

IRC

Visit #fluid-work on Freenode – community resources are linked at Fluid's IRC Channels.

Mailing list

Contact us on the fluid-work mailing list with any problems or comments.

The primary user of Kettle is the GPII's autopersonalisation infrastructure, held at GPII/universal. Kettle is used to provide a flexible means of deploying the GPII's "Flow Manager" and related components distributed across multiple local and remote installations.

A closely related project to Kettle is gpii-express which is used in other GPII projects such as the terms registry and unified listing. This is similar in architecture to Kettle (wrapping express primitives such as servers and requests into dynamically constructed Infusion components) but slightly different in emphasis –

  • gpii-express allows independently mounted application units with nested routing, in the Express 4.x style – whereas Kettle is currently limited to flat Express 3.x-style routing
  • Kettle incorporates support for WebSockets endpoints, whereas gpii-express does not
  • Kettle incorporates support for DataSources (see DataSources )

The request handling architecture for gpii-express and Kettle is quite similar and the projects will probably converge over time. gpii-express currently already depends on Kettle to get access to its HTTP testing support.

Documentation

Documentation and sample code for working with Kettle is contained in the docs directory. Kettle is based on Fluid Infusion's component model. If you aren't familiar with the syntax and meaning of Infusion component trees, it is a good idea to browse the documentation, tutorials and examples at the Infusion documentation site.

It contains the following topics:

  1. Defining top-level Kettle applications using "config" files.
  2. Defining HTTP and Websockets servers using the grades kettle.server and kettle.server.ws.
  3. Defining Kettle request handlers derived from grades kettle.request grouped into app units derived from kettle.app
  4. Working with standard express middleware – incorporating any standard middleware from the express community and registering it into a Kettle application
  5. Working with DataSources to abstract over asynchronous access to (primarily JSON-formatted) data stored locally or remotely
  6. Defining conversational, asynchronous test fixtures against HTTP and WebSockets servers using the Kettle testing framework

Of these elements of this module, those described in topics 1, 5 and 6 (configs, DataSources and the testing framework) are portable and do not depend specifically on the Kettle server and request handling infrastructure – they can be used together with any technologies defining node.js HTTP and WebSockets servers (or in the case of configs, any node.js enabled Infusion application).

changelog

Version History

2.3.0 / 2022-02-16

  • Dependency updates, including to pre-release version of Infusion 4.0.0

2.2.0 / 2021-03-12

  • FLUID-6599: Updated to version of Infusion fixing incorrect defaulting of DataSource port to 80 and fixed corresponding bug here
  • Other dependency updates

2.1.0 / 2021-01-20

  • KETTLE-92: Restored ability of kettle.test.request.http to be configured with a full URL
  • KETTLE-93: Moved over to fluid-lint-all for linting, and deleted Grunt and all of its odious dependencies
  • Inauguration day
  • Other dependency updates

Version History

2.0.0 / 2020-09-30

  • KETTLE-55: Adopted Infusion's DataSource infrastructure and factored away duplicate code
  • KETTLE-50: kettle.dataSource.file.moduleTerms has been decoupled from kettle.dataSource.file as kettle.dataSource.moduleTerms
  • KETTLE-49: Eliminated "readOnlyGrade" system in favour of slightly more logical "writableGrade" system and contextAwareness definition.
  • KETTLE-61: Client-side URL DataSource which is now part of the FLUID-6145 branch
  • URL DataSource now follows node's modern WhatWG-oriented naming for URL fields
  • BREAKING CHANGES Kettle after 2.0.0 is only compatible with releases of Infusion from the FLUID-6145 branch which are dated later than 2020-09-24. This branch will eventually become the released version of Infusion 3.x.
  • Other dependency updates

1.16.0 / 2020-08-07

  • KETTLE-89: Follow HTTP redirects from URL DataSource
  • Other dependency updates

1.15.0 / 2020-07-20

  • Updated to fluid-xxxx version of former GPII dependencies, including update of fluid-pouchdb that allows build on node 12.x
  • Other dependency updates

1.14.0 / 2020-07-16

  • KETTLE-86: Corrected version incorporating extra commits following review

1.13.0 / 2020-07-16

  • KETTLE-86: Extended request.events.onSuccess accepting additional arguments allowing custom status codes, and added request.outerRequestPromise which accepts a wider framed payload correspondingly.
  • KETTLE-84: Extended kettle.test.request.ws to support an onClose event
  • Various docs fixes
  • General dependency update

1.12.0 / 2020-04-10

  • KETTLE-82: Fix for client abort causing server exit
  • Updates for compatibility with FLUID-6148/FLUID-6145 branches of Infusion - "golden release"
  • General dependency update

1.11.1 / 2019-05-23

  • Reorganisation of request launching logic to permit use under post-FLUID-6148 branches of Infusion
  • Significant quantities of JSDocs for core files
  • General dependency update

1.10.1 / 2019-02-05

  • KETTLE-75: Improvements to CLI parsing to allow use of node-directed arguments on electron

1.10.0 / 2019-02-04

  • KETTLE-73: Improvements to censoring of sensitive values supplied as URL parameters to DataSources
  • General dependency updates

1.9.0 / 2018-10-17

  • KETTLE-73: Allow censoring of sensitive information which may be present in URL of DataSource
  • General dependency updates, particularly to recent Infusion with support for fluid.loggingEvent

1.8.1 / 2018-10-04

  • KETTLE-71: Vagrant build courtesy of waharnum
  • KETTLE-72: Added form-data to main dependencies rather than dev dependencies
  • General dependency updates

1.8.0 / 2018-08-16

  • KETTLE-66: Multipart form upload middleware based on multer, courtesy of waharnum
  • Update to gpii-grunt-lint-all linting rollup resulting in huge changes in formatting
  • General dependency updates

1.7.1 / 2017-11-17

  • FLUID-6225: Update to latest versions of Infusion and node-jqUnit (which have been tested separately) to avoid self-deduping race with uncaught exception handler
  • KETTLE-65: Update dependencies to latest versions to address security vulnerabilities

1.7.0 / 2017-08-31

  • GPII-2147: Encode localhost to 127.0.0.1 allowing offline use on Windows
  • Updated dependencies to latest versions, with exception of path-to-regexp 2.0.0 which breaks compatibility with /* path

1.6.4 / 2017-07-24

  • GPII-2483: Updated dependencies to allow operation from bare drive letter on Windows

1.6.2 / 2017-07-14

  • GPII-2483: Corrected bad merge of GPII-2483 branch

1.6.1 / 2017-07-13

  • GPII-2483: Reverted to Fluid community edition of "resolve" in order to resolve UNC path issues on Windows

1.6.0 / 2017-06-16

  • KETTLE-59: Implemented "resolvers" to pull environmental values into configs

1.5.0 / 2017-05-01

  • KETTLE-58: Update to "root-safe" self-deduping Infusion with FLUID-6149
  • KETTLE-37: Completed support for JSON5-formatted config files
  • Updated all outdated npm dependencies (including to express 4.15.2)

1.4.1 / 2017-04-19

  • Updated to dev release of Infusion for fix of self-deduping at root - FLUID-6140

1.4.0 / 2017-02-18

  • KETTLE-57: Fix for failure to properly mark request during action of asynchronous middleware (static serving middleware was broken prior to this release)
  • Updated to latest dependencies (including ws 2.x)

1.3.2 / 2017-01-31

  • Updated to quieter version of Infusion and logged created defaults at lower priority

1.3.1 / 2017-01-27

  • Updated all outdated dependencies (including to an infusion 3.0.0-dev release)

1.3.0 / 2017-01-05

  • KETTLE-51: Fixed faulty Content-Length header that did not account for length of UTF-8 encoded bytes

1.2.2 / 2016-11-23

  • Removed unused dependency node-uuid following deprecation warning

1.2.1 / 2016-11-14

  • GPII-2110: Added JSON5 linting task, moved JS linting to eslint-config-fluid shared rules

1.2.0 / 2016-11-03

  • GPII-2110: Added support for JSON5 files both in DataSources and configs

1.1.1 / 2016-11-01

  • KETTLE-48: Updated to latest gpii-express to fix tests under npm 3

1.1.0 / 2016-07-15

  • KETTLE-45: Fixed implementation of gradeNames support for request handlers
  • Updated to latest versions of dependencies (ws 1.1.1, express 4.14.0, etc.)

1.0.1 / 2016-06-08

  • Updated to later versions of Infusion, gpii-express and gpii-pouchdb, moved over to ESLint for linting

1.0.0 / 2016-05-26

  • First release with reasonable test coverage - consult docs for features