UNPKG

@paroicms/site-generator-plugin

Version:

ParoiCMS Site Generator Plugin

47 lines (46 loc) 1.39 kB
import { strVal, strValOrUndef } from "@paroi/data-formatters-lib"; export function ensureType(value) { return value; } export function formatStepKind(value) { const v = strVal(value); if (v === "initialSchema" || v === "updateSchema" || v === "generateSite") { return v; } throw new Error(`Invalid step kind "${v}"`); } export function formatSchemaStepKind(value) { const v = strVal(value); if (v === "initialSchema" || v === "updateSchema") { return v; } throw new Error(`Invalid schema step kind "${v}"`); } export function formatGeneratedSiteStepKind(value) { const v = strVal(value); if (v === "generateSite") { return v; } throw new Error(`Invalid generated site step kind "${v}"`); } export function formatStepStatus(value) { const v = strVal(value); if (v === "completed" || v === "pending" || v === "failed" || v === "noEffect") { return v; } throw new Error(`Invalid step status "${v}"`); } export function formatActivityCode(value) { const v = strValOrUndef(value); if (v === undefined) return; if (v === "initial1" || v === "initial2" || v === "updating1" || v === "updating2" || v === "generatingSite" || v === "generatingContent") { return v; } throw new Error(`Invalid activity code "${v}"`); }