@aws-amplify/graphql-api-construct
Version:
AppSync GraphQL Api Construct using Amplify GraphQL Transformer.
25 lines (24 loc) • 2.05 kB
TypeScript
import { DataSourceStrategiesProvider } from '@aws-amplify/graphql-transformer-interfaces';
import { CustomSqlDataSourceStrategy as ConstructCustomSqlDataSourceStrategy, ModelDataSourceStrategy as ConstructModelDataSourceStrategy } from '../model-datasource-strategy-types';
import { IAmplifyGraphqlDefinition } from '../types';
/**
* Creates an interface flavor of customSqlDataSourceStrategies from a factory method's schema and data source. Internally, this function
* scans the fields of `Query` and `Mutation` looking for fields annotated with the `@sql` directive and designates the specified
* dataSourceStrategy to fulfill those custom queries.
*
* Note that we do not scan for `Subscription` fields: `@sql` directives are not allowed on those, and it wouldn't make sense to do so
* anyway, since subscriptions are processed from an incoming Mutation, not as the result of a direct datasource access.
*/
export declare const constructCustomSqlDataSourceStrategies: (schema: string, dataSourceStrategy: ConstructModelDataSourceStrategy) => ConstructCustomSqlDataSourceStrategy[];
/**
* Extracts the data source provider from the definition. This jumps through some hoops to avoid changing the public interface. If we decide
* to change the public interface to simplify the structure, then this process gets a lot simpler.
*/
export declare const getDataSourceStrategiesProvider: (definition: IAmplifyGraphqlDefinition) => DataSourceStrategiesProvider;
/**
* Creates a new schema by merging the individual schemas contained in the definitions, combining fields of the Query and Mutation types in
* individual definitions into a single combined definition. Adding directives to `Query` and `Mutation` types participating in a
* combination is not supported (the behavior is undefined whether those directives are migrated).
*/
export declare const schemaByMergingDefinitions: (definitions: IAmplifyGraphqlDefinition[]) => string;
export declare const validateDataSourceStrategy: (strategy: ConstructModelDataSourceStrategy) => void;