aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/helpers/custom-validators/runners/runners.ts
blob: 953fac3b5dc2ed5285c794c62a1935bf26599ce5 (plain) (tree)





























                                                                                           
import validator from 'validator'
import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'
import { exists } from '../misc'

const RUNNERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.RUNNERS

function isRunnerRegistrationTokenValid (value: string) {
  return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.TOKEN)
}

function isRunnerTokenValid (value: string) {
  return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.TOKEN)
}

function isRunnerNameValid (value: string) {
  return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.NAME)
}

function isRunnerDescriptionValid (value: string) {
  return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.DESCRIPTION)
}

// ---------------------------------------------------------------------------

export {
  isRunnerRegistrationTokenValid,
  isRunnerTokenValid,
  isRunnerNameValid,
  isRunnerDescriptionValid
}