@graphql-hive/core
Version:
37 lines • 1.75 kB
TypeScript
import type { HiveClient, HivePluginOptions, Logger } from './types.js';
export declare function createHash(algo: 'SHA-256' | 'SHA-1'): {
update(data: string): /*elided*/ any;
digest(output: "hex" | "base64"): Promise<string>;
};
export declare function memo<R, A, K>(fn: (arg: A) => R, cacheKeyFn: (arg: A) => K): (arg: A) => R;
export declare function isAsyncIterable<T>(value: any): value is AsyncIterable<T>;
export declare function cache<R, A, K, V>(fn: (arg: A, arg2: V) => R, cacheKeyFn: (arg: A, arg2: V) => Promise<K>, cacheMap: {
has(key: K): boolean;
set(key: K, value: R): void;
get(key: K): R | undefined;
}): (arg: A, arg2: V) => Promise<{
key: Awaited<K>;
value: R;
cacheHit: boolean;
}>;
export declare function cacheDocumentKey<T, V>(doc: T, variables: V | null): Promise<string>;
export declare function measureDuration(): () => number;
export declare function addProperty<T, K extends string>(key: K, value: undefined | null, obj: T): T;
export declare function addProperty<T, K extends string, V>(key: K, value: V, obj: T): T & {
[k in K]: V;
};
export declare function isHiveClient(clientOrOptions: HiveClient | HivePluginOptions): clientOrOptions is HiveClient;
export declare function logIf(condition: boolean, message: string, logFn: (message: string) => void): void;
export declare function joinUrl(url: string, subdirectory: string): string;
declare const hiveSymbol: unique symbol;
type HiveLogger = {
info(message: string): void;
error(error: any, ...data: any[]): void;
[hiveSymbol]: {
path: string;
logger: Logger;
};
};
export declare function createHiveLogger(baseLogger: Logger, prefix: string): HiveLogger;
export {};
//# sourceMappingURL=utils.d.ts.map