@graphql-mesh/utils
Version:
16 lines (15 loc) • 853 B
TypeScript
import type { ImportFn, Logger, MeshFetch, MeshFetchRequestInit } from '@graphql-mesh/types';
import { isUrl } from '@graphql-tools/utils';
export interface ReadFileOrUrlOptions extends MeshFetchRequestInit {
allowUnknownExtensions?: boolean;
fallbackFormat?: 'json' | 'yaml' | 'js' | 'ts';
cwd: string;
fetch: MeshFetch;
importFn: ImportFn;
logger: Logger;
}
export { isUrl };
export declare function readFileOrUrl<T>(filePathOrUrl: string, config: ReadFileOrUrlOptions): Promise<T>;
export declare function loadYaml(filepath: string, content: string, logger: Logger): any;
export declare function readFile<T>(fileExpression: string, { allowUnknownExtensions, cwd, fallbackFormat, importFn, logger }: ReadFileOrUrlOptions): Promise<T>;
export declare function readUrl<T>(path: string, config: ReadFileOrUrlOptions): Promise<T>;