* StepConfig is a configuration object for a step. * It is used to create a new step that is a combination of other steps.
| 11 | * It is used to create a new step that is a combination of other steps. |
| 12 | */ |
| 13 | class StepConfig { |
| 14 | constructor(opts = {}) { |
| 15 | /** @member {{ opts: StepOptions, timeout: number|undefined, retry: number|undefined }} */ |
| 16 | this.config = { |
| 17 | opts, |
| 18 | timeout: undefined, |
| 19 | retry: undefined, |
| 20 | } |
| 21 | this.__isStepConfig = true |
| 22 | } |
| 23 | |
| 24 | static isStepConfig(obj) { |
| 25 | return obj && (obj instanceof StepConfig || obj.__isStepConfig === true) |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Set the options for the step. |
| 30 | * @param {StepOptions} opts - The options for the step. |
| 31 | * @returns {StepConfig} - The step configuration object. |
| 32 | */ |
| 33 | opts(opts) { |
| 34 | this.config.opts = opts |
| 35 | return this |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Set the timeout for the step. |
| 40 | * @param {number} timeout - The timeout for the step. |
| 41 | * @returns {StepConfig} - The step configuration object. |
| 42 | */ |
| 43 | timeout(timeout) { |
| 44 | this.config.timeout = timeout |
| 45 | return this |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Set the retry for the step. |
| 50 | * @param {number} retry - The retry for the step. |
| 51 | * @returns {StepConfig} - The step configuration object. |
| 52 | */ |
| 53 | retry(retry) { |
| 54 | this.config.retry = retry |
| 55 | return this |
| 56 | } |
| 57 | |
| 58 | getConfig() { |
| 59 | return this.config |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | export default StepConfig |
nothing calls this directly
no outgoing calls
no test coverage detected