diff options
author | Elizabeth <lizhunt@amazon.com> | 2025-05-28 15:05:38 -0700 |
---|---|---|
committer | Elizabeth <lizhunt@amazon.com> | 2025-05-28 15:05:38 -0700 |
commit | 3005cc83e605fb89b079cf0e6fd0ec95cd27b30e (patch) | |
tree | 992c5933f2ec4a75e32469ddd772c61dbcb2e2fd /model/pipeline.ts | |
parent | e3cf820b07e282221502cf2f116c9780b7375e0e (diff) | |
download | ci-3005cc83e605fb89b079cf0e6fd0ec95cd27b30e.tar.gz ci-3005cc83e605fb89b079cf0e6fd0ec95cd27b30e.zip |
Run prettier, add zed settings
Diffstat (limited to 'model/pipeline.ts')
-rw-r--r-- | model/pipeline.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/model/pipeline.ts b/model/pipeline.ts index b0db1b7..d7b6435 100644 --- a/model/pipeline.ts +++ b/model/pipeline.ts @@ -5,7 +5,9 @@ export interface PipelineStage { readonly parallelJobs: Array<Job>; } export const isPipelineStage = (t: unknown): t is PipelineStage => - isObject(t) && "parallelJobs" in t && Array.isArray(t.parallelJobs) && + isObject(t) && + "parallelJobs" in t && + Array.isArray(t.parallelJobs) && t.parallelJobs.every((j) => isJob(j)); export interface Pipeline { @@ -13,7 +15,9 @@ export interface Pipeline { serialize(): string; } export const isPipeline = (t: unknown): t is Pipeline => - isObject(t) && "serialJobs" in t && Array.isArray(t.serialJobs) && + isObject(t) && + "serialJobs" in t && + Array.isArray(t.serialJobs) && t.serialJobs.every((p) => isPipelineStage(p)); export interface PipelineBuilder { @@ -29,15 +33,13 @@ export class PipelineImpl implements Pipeline { } public static from(s: string): IEither<Error, Pipeline> { - return Either.fromFailable<Error, unknown>(() => JSON.parse(s)).flatMap< - Pipeline - >(( - eitherPipelineJson, - ) => - isPipeline(eitherPipelineJson) - ? Either.right(eitherPipelineJson) - : Either.left(new Error("oh noes D: its a bad pipewine :((")) - ).mapRight((pipeline) => new PipelineImpl(pipeline.serialJobs)); + return Either.fromFailable<Error, unknown>(() => JSON.parse(s)) + .flatMap<Pipeline>((eitherPipelineJson) => + isPipeline(eitherPipelineJson) + ? Either.right(eitherPipelineJson) + : Either.left(new Error("oh noes D: its a bad pipewine :((")), + ) + .mapRight((pipeline) => new PipelineImpl(pipeline.serialJobs)); } } @@ -64,7 +66,7 @@ export class DefaultGitHookPipelineBuilder extends BasePipelineBuilder { this.addStage({ parallelJobs: [ - <FetchCodeJob> { + <FetchCodeJob>{ type: "fetch_code", arguments: { remoteUrl, |