mirror of
https://github.com/JohnRiceML/clawport-ui.git
synced 2026-08-14 08:51:58 +00:00
Moved loadPipelines() (which uses Node fs) to cron-pipelines.server.ts. Types and pure utility functions stay in cron-pipelines.ts so client components can import them without triggering "Can't resolve 'fs'" errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
813 B
TypeScript
35 lines
813 B
TypeScript
/**
|
|
* Pipeline types and client-safe utilities.
|
|
* Server-only loader lives in cron-pipelines.server.ts.
|
|
*/
|
|
|
|
export interface PipelineEdge {
|
|
from: string
|
|
to: string
|
|
artifact: string
|
|
}
|
|
|
|
export interface Pipeline {
|
|
name: string
|
|
edges: PipelineEdge[]
|
|
}
|
|
|
|
/** Get all pipelines that include a specific job name. */
|
|
export function getPipelinesForJob(name: string, pipelines: Pipeline[]): Pipeline[] {
|
|
return pipelines.filter(p =>
|
|
p.edges.some(e => e.from === name || e.to === name)
|
|
)
|
|
}
|
|
|
|
/** Get the set of all job names that appear in any pipeline. */
|
|
export function getAllPipelineJobNames(pipelines: Pipeline[]): Set<string> {
|
|
const names = new Set<string>()
|
|
for (const p of pipelines) {
|
|
for (const e of p.edges) {
|
|
names.add(e.from)
|
|
names.add(e.to)
|
|
}
|
|
}
|
|
return names
|
|
}
|