Μετάβαση στο περιεχόμενο

createPipeline

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

createPipeline(options?): Pipeline

Defined in: packages/pipeline/src/create-pipeline.ts:158

Creates a pipeline: behaviors that wrap plain functions and class methods with cross-cutting concerns, with no framework and no dependency-injection container.

Global behaviors are constructed when the pipeline is created, so a behavior whose required dependency is missing fails here rather than at its first call.

PipelineOptions = {}

Pipeline

TypeError on a malformed global entry or two instances of one behavior class.

const pipeline = createPipeline({
behaviors: [new CacheBehavior(buildCache({}))],
globalBehaviors: { before: [logging({ requestResponseLogLevel: 'log' })] },
});
export const getPrice = pipeline.wrap(
{ name: 'getPrice', kind: 'query' },
cache({ key }),
)(async (sku: string) => prices.find(sku));
class Prices {
@pipeline.wrap({ kind: 'query' }, cache({ key }))
async find(sku: string) {}
}