Registry / database / pipeline-segment

pipeline-segment

JSON →
library0.0.6jsnpmunverified

Composable pieces of a Redis pipeline, enabling modular construction of pipeline commands with grouped result processing and chaining of command outputs. Current stable version: 0.0.6. Release cadence: low activity, likely experimental. Key differentiator vs raw ioredis pipelines: allows composing reusable pipeline segments that can process multiple results together and feed results between segments. ESM-only, TypeScript types included, requires ioredis 5.x as peer dependency.

npm install pipeline-segment
INSTALL
IMPORT
SIG · PIPELINE-SEGMENT
P
pipeline-segment
databasejavascriptv0.0.6
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.

createSegment
import { createSegment } from 'pipeline-segment'
const createSegment = require('pipeline-segment')
Package is ESM-only; CommonJS require will fail.
Segment
import { Segment } from 'pipeline-segment'
import Segment from 'pipeline-segment'
Named export, not default.
PipelineSegment
import type { PipelineSegment } from 'pipeline-segment'
import { PipelineSegment } from 'pipeline-segment'
TypeScript type export, use type import to avoid runtime inclusion.

Creates a pipeline segment that sends GET 'foo' and extracts the result.

import { createSegment } from 'pipeline-segment'; import Redis from 'ioredis'; const redis = new Redis({ host: process.env.REDIS_HOST ?? 'localhost' }); const segment = createSegment( // Command: calls redis.get('foo') (pipeline) => pipeline.get('foo'), // Process result: return the value as-is (result) => result ); const pipeline = redis.pipeline(); const chain = segment.addToPipeline(pipeline); const results = await pipeline.exec(); const value = chain.extractResult(results[0][1]); console.log(value); // 'bar'
Debug
Known issues
gotchaSegment results extraction is order-sensitive; you must extract from the correct position in the results array.
fix
Match the order of segment.addToPipeline calls with the order of results from pipeline.exec().
affects: >=0.0.0
gotchaPackage version 0.0.6 is very early; API may change without major version bump.
fix
Pin to exact version and test upgrades.
affects: <1.0.0
gotchaRequires ioredis 5.x as peer dependency; incompatible with ioredis 4.x or earlier.
fix
Install ioredis@5 or later.
affects: >=0.0.0
Errors
Common errors & fixes
ERR_MODULE_NOT_FOUND: Cannot find package 'pipeline-segment' imported from ...
Package is not installed or not in node_modules.
fix
Run npm install pipeline-segment
TypeError: createSegment is not a function
Import incorrectly used default import instead of named import.
fix
Use import { createSegment } from 'pipeline-segment'
Error: Cannot find module 'ioredis'
Peer dependency ioredis is missing.
fix
Run npm install ioredis@5
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies
ioredisrequiredpeer dependency - required to use pipeline segments
Agent activity
2 hits · last 30 days
node
2
Resources
pipeline-segment — npm install pipeline-segment · libregistry