graphql-transformer-core
Version:
A framework to transform from GraphQL SDL to AWS cloudFormation.
101 lines • 3.3 kB
TypeScript
import { Template } from 'cloudform-types';
import { InputObjectTypeDefinitionNode } from 'graphql';
import { ProjectOptions } from './amplifyUtils';
export declare const TRANSFORM_CONFIG_FILE_NAME = "transform.conf.json";
export declare const TRANSFORM_BASE_VERSION = 4;
export declare const TRANSFORM_CURRENT_VERSION = 5;
export interface TransformMigrationConfig {
V1?: {
Resources: string[];
};
}
export declare const enum ConflictHandlerType {
OPTIMISTIC = "OPTIMISTIC_CONCURRENCY",
AUTOMERGE = "AUTOMERGE",
LAMBDA = "LAMBDA"
}
export type ConflictDetectionType = 'VERSION' | 'NONE';
export type SyncConfigOPTIMISTIC = {
ConflictDetection: ConflictDetectionType;
ConflictHandler: ConflictHandlerType.OPTIMISTIC;
};
export type SyncConfigSERVER = {
ConflictDetection: ConflictDetectionType;
ConflictHandler: ConflictHandlerType.AUTOMERGE;
};
export type SyncConfigLAMBDA = {
ConflictDetection: ConflictDetectionType;
ConflictHandler: ConflictHandlerType.LAMBDA;
LambdaConflictHandler: {
name: string;
region?: string;
lambdaArn?: any;
};
};
export type SyncConfig = SyncConfigOPTIMISTIC | SyncConfigSERVER | SyncConfigLAMBDA;
export type ResolverConfig = {
project?: SyncConfig;
models?: {
[key: string]: SyncConfig;
};
};
type SchemaReaderConfig = {
amplifyType: InputObjectTypeDefinitionNode;
schema: string;
};
export interface TransformConfig {
StackMapping?: {
[resourceId: string]: string;
};
TransformerOptions?: {
[transformer: string]: {
[option: string]: any;
};
};
Migration?: TransformMigrationConfig;
Version?: number;
ElasticsearchWarning?: boolean;
ResolverConfig?: ResolverConfig;
transformers?: string[];
warningESMessage?: boolean;
}
export declare function loadConfig(projectDir: string): Promise<TransformConfig>;
export declare function writeConfig(projectDir: string, config: TransformConfig): Promise<TransformConfig>;
export declare const isDataStoreEnabled: (projectDir: string) => Promise<boolean>;
interface ProjectConfiguration {
schema: string;
functions: {
[k: string]: string;
};
pipelineFunctions: {
[k: string]: string;
};
resolvers: {
[k: string]: string;
};
stacks: {
[k: string]: Template;
};
config: TransformConfig;
modelToDatasourceMap: Map<string, DataSourceType>;
customQueries: Map<string, string>;
}
export declare const loadProject: (projectDirectory: string, opts?: ProjectOptions) => Promise<ProjectConfiguration>;
export declare const readSchema: (projectDirectory: string) => Promise<{
schema: string;
modelToDatasourceMap: Map<string, DataSourceType>;
}>;
export declare const removeAmplifyInput: (schema: string) => SchemaReaderConfig;
export type DBType = 'DYNAMODB' | 'MYSQL' | 'POSTGRES';
export interface DataSourceType {
dbType: DBType;
provisionDB: boolean;
provisionStrategy: DataSourceProvisionStrategy;
}
export declare const enum DynamoDBProvisionStrategy {
DEFAULT = "DEFAULT",
AMPLIFY_TABLE = "AMPLIFY_TABLE"
}
export type DataSourceProvisionStrategy = DynamoDBProvisionStrategy;
export {};
//# sourceMappingURL=transformConfig.d.ts.map