From 8aa2b11d29c30fab57ec78307925c1b243cc6b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=8D=A3=E6=9D=B0?= Date: Wed, 1 Jun 2022 11:41:46 +0800 Subject: [PATCH] chore: trigger startPipeline support output --- src/trigger/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/trigger/index.ts b/src/trigger/index.ts index 02e46aa..1069974 100644 --- a/src/trigger/index.ts +++ b/src/trigger/index.ts @@ -21,14 +21,14 @@ export default class Trigger { this.pipeline.use(middleware); } - async initContext(input: Input): Promise { - const ctx = new Context(input, new Output()); + async initContext(input: Input, output?: Output): Promise { + const ctx = new Context(input, output || new Output()); ctx.container = new ExecutionContainer(ctx, this.app.getContainer()) return ctx; } - async startPipeline(input: Input = new Input()): Promise { - const ctx = await this.initContext(input); + async startPipeline(input: Input = new Input(), output?: Output): Promise { + const ctx = await (output ? this.initContext(input, output) : this.initContext(input)); await this.pipeline.run(ctx); return ctx; }