Registry / devops / rest-pipeline-js

rest-pipeline-js

JSON →
library1.3.14jsnpmunverified

Pipeline orchestration utilities for building modular REST API clients in JavaScript/TypeScript. Current stable version is 1.3.14, with regular releases. Key differentiators include sequential and parallel stage execution, retry with exponential backoff and Retry-After support, response caching for GET requests, rate limiting, auth provider with automatic 401 refresh, stream stages (SSE/AsyncIterable), pause/resume/abort capabilities, pipeline metrics, a plugin system, persist adapter, and Vue/React integrations. It ships TypeScript types and has a single runtime dependency (axios). Peer dependencies for React/Vue integrations are separate entry points.

npm install rest-pipeline-js
INSTALL
IMPORT
SIG · REST-PIPELINE-JS
R
rest-pipeline-js
devopsjavascriptv1.3.14
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RestClient
✓ import { RestClient } from 'rest-pipeline-js'
✗ const RestClient = require('rest-pipeline-js')
ESM-only; CommonJS require is not supported.
createRestClient
✓ import { createRestClient } from 'rest-pipeline-js'
✗ import createRestClient from 'rest-pipeline-js'
Named export, not default.
usePipelineRunReact
✓ import { usePipelineRunReact } from 'rest-pipeline-js/react'
✗ import { usePipelineRunReact } from 'rest-pipeline-js'
React integration is in its own entry point to allow tree-shaking.

Shows how to create a rest client with retry, cache, and rate limiting, then define a two-stage pipeline with conditional execution.

import { createRestClient } from 'rest-pipeline-js'; import { usePipelineRunReact } from 'rest-pipeline-js/react'; const client = createRestClient({ baseURL: 'https://api.example.com', retry: { maxRetries: 3, baseDelay: 1000 }, cache: { ttl: 60000 }, rateLimit: { maxConcurrent: 5, intervalMs: 1000, maxRequestsPerInterval: 10 }, }); // Example: sequential pipeline with two stages const pipeline = client.createPipeline({ stages: [ { name: 'fetchUser', request: { url: '/user', method: 'GET' }, }, { name: 'fetchPosts', condition: (ctx) => ctx.stageResults?.fetchUser?.status === 200, request: { url: '/posts', method: 'GET' }, }, ], }); pipeline.onPipelineEnd = (result) => console.log('Pipeline finished', result); pipeline.execute().then(() => console.log('Done'));
Debug
Known issues
gotchaVue and React integrations require peer dependencies (react, react-dom) to be installed separately. They are not included in the core package.
fix
Install react and react-dom if using React integrations: npm install react react-dom. For Vue integrations, ensure Vue 3 is available (peer dependency not formally declared).
affects: >=1.0.0
breakingIn version 1.0.0, the package switched from a default export to named exports. All users must update imports.
fix
Change import RestClient from 'rest-pipeline-js' to import { RestClient } from 'rest-pipeline-js'.
affects: >=1.0.0 <1.1.0
deprecatedThe old function createPipeline() without arguments is deprecated. Use createPipeline(config) with explicit config object.
fix
Update calls to createPipeline() to pass a config object: createPipeline({ stages: [] }).
affects: >=1.2.0
gotchaThe HTTP adapter option is only available when creating a new RestClient. It cannot be changed after client creation.
fix
Pass adapter in the initial config to RestClient constructor: new RestClient({ adapter: myAdapter }).
affects: >=1.0.0
breakingIn version 1.3.0, the persist adapter interface changed. Custom persist adapters must implement save/load methods with a specific signature.
fix
Update custom persist adapters: save must accept (key, data) and return Promise<void>; load must accept (key) and return Promise<any>.
affects: >=1.3.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module not supported
Using CommonJS require() for this ESM-only package.
fix
Use import syntax: import { createRestClient } from 'rest-pipeline-js'; or use dynamic import: const { createRestClient } = await import('rest-pipeline-js');
TypeError: client.createPipeline is not a function
Importing createPipeline directly from package instead of using it on a client instance.
fix
Create a client first: const client = createRestClient({...}); then call client.createPipeline({...}).
Module not found: Can't resolve 'rest-pipeline-js/react'
Missing peer dependencies (react, react-dom) or incorrect import path.
fix
Install react and react-dom (npm install react react-dom) and ensure you're importing from 'rest-pipeline-js/react' (not 'rest-pipeline-js').
Uncaught (in promise) Error: No adapter found for request
Custom HTTP adapter not provided or configured incorrectly.
fix
Ensure you pass a valid adapter in the RestClient config: createRestClient({ adapter: myFetchAdapter }). The adapter must be compatible with the axios adapter interface.
Upgrade
Version history
1.3.14latest on npm
Audit
Dependencies
axiosrequiredHTTP client used by RestClient
reactoptionalPeer dependency for React integration entry point
react-domoptionalPeer dependency for React integration entry point
Agent activity
6 hits · last 30 days
node
6
Resources
rest-pipeline-js — npm install rest-pipeline-js · libregistry