UNPKG

wgc

Version:

The official CLI tool to manage the GraphQL Federation Platform Cosmo

78 lines (77 loc) 2.82 kB
import type { BaseCommandOptions } from '../../core/types/types.js'; import type { UserInfo } from './types.js'; export declare function demoSpinner(text?: string): import("ora").Ora; /** * Clears whole screen */ export declare function clearScreen(): void; export declare function resetScreen(userInfo?: UserInfo): void; /** * Fancy WG logo */ export declare function printLogo(userInfo?: UserInfo): void; /** * Updates the logo region at the top of the screen with userInfo * without clearing the rest of the screen content. */ export declare function updateScreenWithUserInfo(userInfo: UserInfo): void; /** * Copies over support files (gRPC plugin data) from onboarding * repository and stores them in the host filesystem [cacheDir] * folder. * @returns [directory] path which contains the support data */ export declare function prepareSupportingData(): Promise<string>; /** * Checks whether host system has [docker] installed and whether [buildx] is set up * properly. In case of failures, show prompt to install/setup. */ export declare function checkDockerReadiness(): Promise<void>; /** * Returns the path to the demo log file at ~/.cache/cosmo/demo/demo.log. * Creates the parent directory if needed. */ export declare function getDemoLogPath(): string; /** * Runs the cosmo router as a Docker container. Shows an ora spinner * that transitions from "Starting…" to "Router is ready" once the * health endpoint responds. The process stays alive until the abort * signal fires (CTRL+C / crash) or docker exits on its own. */ export declare function runRouterContainer({ routerToken, routerBaseUrl, signal, logPath, }: { routerToken: string; routerBaseUrl: string; signal: AbortSignal; logPath: string; }): Promise<{ error: Error | null; }>; /** * Publishes demo plugins sequentially. * Returns [error] on first failure; spinner shows which plugin failed. */ export declare function publishAllPlugins({ client, supportDir, signal, logPath, }: { client: BaseCommandOptions['client']; supportDir: string; signal: AbortSignal; logPath: string; }): Promise<{ error: Error; } | { error: null; }>; export declare function captureOnboardingEvent({ name, properties, }: { name: 'onboarding_step_completed'; properties: { step_name: 'init' | 'check_onboarding' | 'create_federated_graph' | 'delete_federated_graph' | 'run_router_send_metrics'; entry_source: 'wgc'; }; } | { name: 'onboarding_step_failed'; properties: { step_name: 'init' | 'check_onboarding' | 'create_federated_graph' | 'delete_federated_graph' | 'run_router_send_metrics'; entry_source: 'wgc'; error_category: 'resource' | 'support_files' | 'docker_readiness' | 'router'; error_message: string; }; }): void;