Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 32x 32x 32x 32x 32x 32x 32x 32x 8x 8x 9x 84x 48x 8x 3x 11x | /* * Copyright 2021 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ import type { StepType } from '@pipeline/components/PipelineSteps/PipelineStepInterface' import type { StageType } from '@pipeline/utils/stageHelpers' import type { StepDetailsRegister, ExecutionCardInfoRegister, ExecutionSummaryRegister, ConsoleViewStepDetailsRegister, StageDetailsRegister } from './types' export interface ExecutionFactoryConstruct { defaultStepDetails: StepDetailsRegister defaultConsoleViewStepDetails: ConsoleViewStepDetailsRegister } export class ExecutionFactory { private stepDetailsMap = new Map<StepType, StepDetailsRegister>() private defaultStepDetails: StepDetailsRegister private cardInfoMap = new Map<StageType, ExecutionCardInfoRegister>() private summaryInfoMap = new Map<StageType, ExecutionSummaryRegister>() private consoleViewStepDetailsMap = new Map<StepType, ConsoleViewStepDetailsRegister>() private defaultConsoleViewStepDetails: ConsoleViewStepDetailsRegister private stageDetailsMap = new Map<StageType, StageDetailsRegister>() constructor(opt: ExecutionFactoryConstruct) { this.defaultStepDetails = opt.defaultStepDetails this.defaultConsoleViewStepDetails = opt.defaultConsoleViewStepDetails } registerStepDetails(stepType: StepType, stepDetails: StepDetailsRegister): void { Iif (this.stepDetailsMap.has(stepType)) { throw new Error(`Step of type "${stepType}" is already registred`) } this.stepDetailsMap.set(stepType, stepDetails) } getStepDetails(stepType?: StepType): StepDetailsRegister { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion return stepType && this.stepDetailsMap.has(stepType) ? this.stepDetailsMap.get(stepType)! : this.defaultStepDetails } registerCardInfo(type: StageType, data: ExecutionCardInfoRegister): void { this.cardInfoMap.set(type, data) } getCardInfo(type: StageType): ExecutionCardInfoRegister | null { return this.cardInfoMap.get(type) || null } registerSummary(type: StageType, data: ExecutionSummaryRegister): void { this.summaryInfoMap.set(type, data) } getSummary(type: StageType): ExecutionSummaryRegister | null { return this.summaryInfoMap.get(type) || null } registerConsoleViewStepDetails(type: StepType, data: ConsoleViewStepDetailsRegister): void { this.consoleViewStepDetailsMap.set(type, data) } getConsoleViewStepDetails(type: StepType): ConsoleViewStepDetailsRegister { return this.consoleViewStepDetailsMap.get(type) || this.defaultConsoleViewStepDetails } registerStageDetails(type: StageType, data: StageDetailsRegister): void { this.stageDetailsMap.set(type, data) } getStageDetails(type: StageType): StageDetailsRegister | null { return this.stageDetailsMap.get(type) || null } } |