@graphql-hive/laboratory
Version:
[Hive](https://the-guild.dev/graphql/hive) is a fully open-source schema registry, analytics, metrics and gateway for [GraphQL federation](https://the-guild.dev/graphql/hive/federation) and other GraphQL APIs.
28 lines (27 loc) • 1.37 kB
TypeScript
import { ClassValue } from 'clsx';
export declare function cn(...inputs: ClassValue[]): string;
export declare function capitalize(str: string): string;
/** Formats a byte count for display, e.g. 0 -> "0 B", 1536 -> "1.5 KB". */
export declare function formatBytes(bytes: number): string;
export declare function splitIdentifier(input: string): string[];
export declare function asyncInterval(fn: () => Promise<void>, delay: number, signal?: AbortSignal): Promise<void>;
export declare function isAsyncIterable<T>(val: unknown): val is AsyncIterable<T>;
/**
* Ends a stream when the signal aborts, whatever the source does with it:
* @graphql-tools/executor-legacy-ws ignores `request.signal` entirely, so a stopped
* LEGACY_WS subscription would otherwise keep streaming until the server finished.
* Racing the abort also covers a source whose return() never settles a pending next().
*/
export declare function untilAborted<T>(source: AsyncIterable<T>, signal: AbortSignal): AsyncIterable<T>;
export type TextToken = {
type: 'text';
value: string;
} | {
type: 'url';
value: string;
};
/**
* Split text into plain-text and http(s) URL tokens, preserving all original characters
* (incl. newlines/whitespace). Only https?:// is matched, so javascript:/data: can't be linked.
*/
export declare function tokenizeUrls(text: string): TextToken[];