wgc
Version:
The official CLI tool to manage the GraphQL Federation Platform Cosmo
70 lines (69 loc) • 3.2 kB
TypeScript
import { CompositionOptions, FederationResult, Subgraph } from '@wundergraph/composition';
import { SubscriptionProtocol, WebsocketSubprotocol } from '@wundergraph/cosmo-shared';
import { SubgraphPublishStats } from '@wundergraph/cosmo-connect/dist/platform/v1/platform_pb';
import { KeycloakToken } from './commands/auth/utils.js';
export interface Header {
key: string;
value: string;
}
export declare const introspectSubgraph: ({ subgraphURL, additionalHeaders, rawIntrospection, }: {
subgraphURL: string;
additionalHeaders: Header[];
rawIntrospection?: boolean;
}) => Promise<{
sdl: string;
errorMessage?: string;
success: boolean;
}>;
/**
* Composes a list of subgraphs into a single schema.
*/
export declare function composeSubgraphs(subgraphs: Subgraph[], options?: CompositionOptions): FederationResult;
export type ConfigData = Partial<KeycloakToken & {
organizationSlug: string;
lastUpdateCheck: number;
}>;
/**
* Asynchronously checks whether a file (or directory) exists at the given path.
*/
export declare const fileExists: (filePath: string) => Promise<boolean>;
export declare const readConfigFile: () => ConfigData;
export declare const updateConfigFile: (newData: ConfigData) => void;
export declare const checkForUpdates: () => Promise<void>;
export declare const validateSubscriptionProtocols: ({ subscriptionProtocol, websocketSubprotocol, }: {
subscriptionProtocol: SubscriptionProtocol;
websocketSubprotocol: WebsocketSubprotocol;
}) => void;
type PrintTruncationWarningParams = {
displayedErrorCounts: SubgraphPublishStats;
totalErrorCounts?: SubgraphPublishStats;
};
type KeyPressCallback = () => unknown | Promise<unknown>;
/**
* Waits for a single keypress matching one of the keys in the provided map.
* Keys are case-sensitive strings. Use 'Enter' for the enter key.
* Each entry is either a callback function or a descriptor `{ callback, persistent }`.
* When `persistent` is true the callback fires but the prompt keeps listening,
* useful for side-effect actions (e.g. opening a URL) alongside a terminating key.
*/
export declare function waitForKeyPress(keyMap: Record<string, KeyPressCallback | {
callback: KeyPressCallback;
persistent: boolean;
} | undefined>, message?: string): Promise<void>;
export declare function printTruncationWarning({ displayedErrorCounts, totalErrorCounts }: PrintTruncationWarningParams): void;
/**
* Prints text with rainbow-like effect. Respects NO_COLOR
*/
export declare function rainbow(text: string): string;
/** Strips ANSI SGR escape sequences (colors, bold, dim, etc.) from a string. */
export declare function stripAnsi(s: string): string;
/** Returns the visible character count of a string, ignoring ANSI escape sequences. */
export declare function visibleLength(s: string): number;
/**
* JSON.stringify replacer that strips protobuf-es v2 internal fields
* (`$typeName`, `$unknown`) from message objects, so CLI `--json` output stays a
* clean, user-facing shape. It runs for every nested object too, so nested
* messages are handled as well.
*/
export declare function stripProtobufInternals(_key: string, value: unknown): unknown;
export {};