@atomist/automation-client
Version:
Atomist API for software low-level client
111 lines • 4.24 kB
TypeScript
import { GraphQLError } from "graphql";
export declare class ParameterEnum {
value: string | string[];
constructor(value: string | string[]);
}
export declare function enumValue(value: string | string[]): ParameterEnum;
/**
* see src/graph/graphQL.ts
*/
export declare function subscription(options: SubscriptionOptions): string;
export interface SubscriptionOptions {
subscription?: string;
path?: string;
name?: string;
fragmentDir?: string;
inline?: boolean;
variables?: {
[name: string]: string | boolean | number | ParameterEnum;
};
operationName?: string;
moduleDir?: string;
}
/**
* Prepare a GraphQL query string for the use with Apollo.
*
* Queries can be provided by the following options:
*
* * query: string containing the subscription GraphQL, or
* * path: absolute or relative path to a .graphql file to load; if provided a relative
* path this will resolve the relative path to an absolute given the location
* of the calling script.
* * name: name of the .graphql file to load; this will walk up the directory structure
* starting at the location of the calling script and look for a folder called
* 'graphql'. Once that folder is found, by convention name is being looked for
* in the 'query' sub directory.
* * fragmentsDir: location of fragment .graphql files
* * moduleDir: location of the calling script
* * inline: remove any unneeded whitespace and line breaks from returned GraphQL string
*
* @param {{query?: string; path?: string; name?: string; fragmentDir?: string; moduleDir: string; inline?: boolean}} options
* @returns {string}
*/
export declare function query<T, Q>(options: QueryOptions): string;
export interface QueryOptions {
query?: string;
path?: string;
name?: string;
fragmentDir?: string;
moduleDir: string;
inline?: boolean;
}
/**
* Prepare a GraphQL mutation string for the use with Apollo.
*
* Mutations can be provided by the following options:
*
* * mutation: string containing the subscription GraphQL, or
* * path: absolute or relative path to a .graphql file to load; if provided a relative
* path this will resolve the relative path to an absolute given the location
* of the calling script.
* * name: name of the .graphql file to load; this will walk up the directory structure
* starting a t the location of the calling script and look for a folder called
* 'graphql'. Once that folder is found, by convention name is being looked for
* in the 'mutation' sub directory.
* * moduleDir: location of the calling script
* * inline: remove any unneeded whitespace and line breaks from returned GraphQL string
*
* @param {{mutation?: string; path?: string; name?: string; moduleDir: string; inline?: boolean}} options
* @returns {string}
*/
export declare function mutate<T, Q>(options: MutationOptions): string;
export interface MutationOptions {
mutation?: string;
path?: string;
name?: string;
moduleDir: string;
inline?: boolean;
}
/**
* see src/graph/graphQL.ts
*/
export declare function ingester(options: IngesterOptions): string;
export interface IngesterOptions {
name?: string;
path?: string;
moduleDir?: string;
}
/**
* Extract operationName from the provided query or subscription
* @param {string} q
* @returns {string}
*/
export declare function operationName(q: string): string;
/**
* Inline the given query. Mainly useful for nicer log messages
* @param {string} query
* @returns {string}
*/
export declare function inlineQuery(q: string): string;
/**
* Replace the operation name in the query or subscription
*/
export declare function replaceOperationName(q: string, name: string): string;
export declare function prettyPrintErrors(errors: GraphQLError[], q?: string): string;
export declare function replaceParameters(q: string, parameters?: {
[name: string]: string | boolean | number | ParameterEnum;
}): string;
export declare function resolveAndReadFileSync(path: string, current?: string, parameters?: {
[name: string]: string | boolean | number | ParameterEnum;
}): string;
//# sourceMappingURL=graphQL.d.ts.map