UNPKG

wgc

Version:

The official CLI tool to manage the GraphQL Federation Platform Cosmo

66 lines (65 loc) 2.15 kB
import { type ResultPromise } from 'execa'; import type { BaseCommandOptions } from './types/types.js'; export interface PluginFiles { schema: string; dockerFile: string; protoSchema: string; protoMapping: string; protoLock: string; } export interface PluginPublishParams { client: BaseCommandOptions['client']; pluginName: string; pluginDir: string; namespace: string; labels: string[]; platforms: string[]; files: PluginFiles; cancelSignal?: AbortSignal; /** Called with each spawned execa process so the caller can pipe/inherit output. */ onProcess?: (proc: ResultPromise) => void; } export interface PluginPublishResult { error: Error | null; /** Raw response from publishFederatedSubgraph, available when the RPC call was reached. */ response?: { code?: number; details?: string; hasChanged?: boolean; compositionErrors: Array<{ federatedGraphName: string; namespace: string; featureFlag: string; message: string; }>; deploymentErrors: Array<{ federatedGraphName: string; namespace: string; message: string; }>; compositionWarnings: Array<{ federatedGraphName: string; namespace: string; featureFlag: string; message: string; }>; proposalMatchMessage?: string; }; } export declare function getDefaultPlatforms(): string[]; export declare const SUPPORTED_PLATFORMS: string[]; /** * Reads and validates the 5 required plugin files from a plugin directory. * Throws on missing/empty files. */ export declare function readPluginFiles(pluginDir: string): Promise<PluginFiles>; /** * Core plugin publish pipeline: * 1. validateAndFetchPluginData (RPC) * 2. Docker login → buildx build+push → logout * 3. publishFederatedSubgraph (RPC) * * Returns a result object; never calls program.error() — the caller decides * how to handle errors. */ export declare function publishPluginPipeline(params: PluginPublishParams): Promise<PluginPublishResult>;