@valos/toolset-rest-api-gateway-plugin

0.35.0-prerelease.1 • Public • Published

@valos/toolset-rest-api-gateway-plugin

This package acts as both a gateway plugin and a worker toolset. As worker toolset it sets up a REST API server based on its toolset config. As a gateway plugin it exposes the gateway resource model through the API.

This package is also a major study on whether ValOS <-> REST API mappings for a particular domain can be specified in a fully declarative fashion. There are several points to be made here:

  1. ValOS object model allows delegation of the REST API calls into valospace business logic functions. This improves fabric-valospace integration and reduces the need for custom fabric code and is the reason declarative approach can even be considered.
  2. The declarative mappings allow for faster adaptations to the wild west that is valospace. It also provides better foundation for introspecting and validating the mappings at any point in time. At least as it has no custom code it shouldn't make the complexity problems worse, in principle.
  3. The no-code aspect allows an opportunistic instance of the rest-api-gateway-plugin to be attached to a local inspire gateway for it to serve REST calls locally. Then a parallel non-valospace web application which has a valos REST perspire backend can request the local inspire REST endpoint to fetch its API mappings to serve some (or all) REST requests locally. This arrangement is possible even non-intrusively as long as the web application allows a service worker to intercept the appropriate remote REST calls and forward them locally.

The description language is JSON schema which is extended with ValOS mapping descriptors. schema-builder/ contains the convenience functions that can be used to build the schema description types and routes and emit the description objects.

The current system is a working prototype. the core is structurally sound but there's no specification and leaks abstractions somewhat; most notably the JSON schema is fixed at what the underlying fastify web server consumes.

Readme

Keywords

none

Package Sidebar

Install

npm i @valos/toolset-rest-api-gateway-plugin

Weekly Downloads

2

Version

0.35.0-prerelease.1

License

MIT

Unpacked Size

184 kB

Total Files

32

Last publish

Collaborators

  • ikajaste
  • iridian