priestine/versions

View on GitHub
src/pipes/validate-input-pipe.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { IAppCtx } from '../types/app-ctx'
import type { LogFatalError } from '../utils/logger'
import { ExtendPipe } from '../utils/pipe'
import { exitIfInvalidBuildMetadata } from '../pure/validators/exit-if-invalid-build-metadata'
import { exitIfInvalidPreRelease } from '../pure/validators/exit-if-invalid-pre-release'
import { exitIfInvalidRepository } from '../pure/validators/exit-if-invalid-repository'

interface IDeps {
    logFatalError: LogFatalError
}

export const validateInputPipe = ({ logFatalError }: IDeps) =>
    ExtendPipe.empty<IAppCtx, Partial<IAppCtx>>()
        .pipeTap(exitIfInvalidBuildMetadata({ logFatalError }))
        .pipeTap(exitIfInvalidPreRelease({ logFatalError }))
        .pipeTap(exitIfInvalidRepository({ logFatalError }))