@aws-amplify/graphql-schema-generator
Version:
Amplify GraphQL schema generator
447 lines (388 loc) • 14.4 kB
Markdown
## API Report File for "@aws-amplify/graphql-schema-generator"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { DirectiveNode } from 'graphql';
import { DocumentNode } from 'graphql';
import { FieldDefinitionNode } from 'graphql';
import { ImportedRDSType } from '@aws-amplify/graphql-transformer-core';
import { InputObjectTypeDefinitionNode } from 'graphql';
import { ObjectTypeDefinitionNode } from 'graphql';
import { VpcConfig } from '@aws-amplify/graphql-transformer-interfaces';
// @public (undocumented)
export const applyFieldNameOverrides: (field: FieldDefinitionNode, existingField: FieldDefinitionNode) => Partial<FieldDefinitionNode>;
// @public (undocumented)
export const applyFieldOverrides: (field: FieldDefinitionNode, existingField: FieldDefinitionNode) => FieldDefinitionNode;
// @public (undocumented)
export const applyJSONFieldTypeOverrides: (field: FieldDefinitionNode, existingField: FieldDefinitionNode) => Partial<FieldDefinitionNode>;
// @public (undocumented)
export const applyModelAuthOverrides: (obj: ObjectTypeDefinitionNode, existingObj: ObjectTypeDefinitionNode) => ObjectTypeDefinitionNode;
// @public (undocumented)
export const applyModelNameOverrides: (obj: ObjectTypeDefinitionNode, existingObj: ObjectTypeDefinitionNode) => ObjectTypeDefinitionNode;
// @public (undocumented)
export const applyModelOverrides: (obj: ObjectTypeDefinitionNode, existingObj: ObjectTypeDefinitionNode) => ObjectTypeDefinitionNode;
// @public (undocumented)
export const applySchemaOverrides: (document: DocumentNode, existingDocument?: DocumentNode | undefined) => DocumentNode;
// @public (undocumented)
export const checkDestructiveNullabilityChange: (field: FieldDefinitionNode, existingField: FieldDefinitionNode) => void;
// @public (undocumented)
export const constructDefaultGlobalAmplifyInput: (dataSourceType: ImportedRDSType, includeAuthRule?: boolean, authDocLink?: string) => string;
// @public (undocumented)
export const constructRDSGlobalAmplifyInput: (config: any, schemaDocument: DocumentNode | undefined) => string;
// @public (undocumented)
export const convertToGraphQLFieldName: (fieldName: string) => string;
// @public (undocumented)
export const convertToGraphQLTypeName: (modelName: string) => string;
// @public (undocumented)
export interface CustomType {
// (undocumented)
readonly kind: 'Custom';
// (undocumented)
readonly name: string;
}
// @public (undocumented)
export abstract class DataSourceAdapter {
// (undocumented)
abstract cleanup(): void;
// (undocumented)
describeTable(tableName: string): Model;
// (undocumented)
abstract getFields(tableName: string): Field[];
// (undocumented)
abstract getIndexes(tableName: string): Index[];
// (undocumented)
getModels(): Model[];
// (undocumented)
abstract getPrimaryKey(tableName: string): Index | null;
// (undocumented)
abstract getTablesList(): string[];
// (undocumented)
abstract initialize(): Promise<void>;
// (undocumented)
protected abstract querySchema(): Promise<string>;
// (undocumented)
protected queryToCSV(queryResult: any[]): string;
// (undocumented)
abstract test(): Promise<boolean>;
// (undocumented)
useVPC: boolean;
// (undocumented)
useVpc(vpcSchemaInspectorLambda: string, region: string): void;
// (undocumented)
vpcLambdaRegion: string | undefined;
// (undocumented)
vpcSchemaInspectorLambda: string | undefined;
}
// @public (undocumented)
export interface DataSourceConfig {
// (undocumented)
database: string;
// (undocumented)
host: string;
// (undocumented)
password: string;
// (undocumented)
port: number;
// (undocumented)
sslCertificate?: string;
// (undocumented)
username: string;
}
// @public (undocumented)
export type DataSourceGenerateConfig = {
secretNames: {
connectionUri: string;
sslCertificate?: string;
};
identifier: string;
vpcConfig?: VpcConfig;
};
// @public (undocumented)
export type DBEngineType = 'MySQL' | 'Postgres' | 'DynamoDB';
// @public (undocumented)
export interface DefaultType {
// (undocumented)
readonly kind: 'Scalar';
// (undocumented)
readonly name: FieldDataType;
}
// @public (undocumented)
export interface DefaultValue {
// (undocumented)
readonly kind: 'DB_GENERATED' | 'TRANSFORMER_GENERATED';
// (undocumented)
readonly value: string | number | boolean;
}
// @public (undocumented)
export class EmptySchemaError extends Error {
constructor();
}
// @public (undocumented)
export class Engine {
constructor(type: DBEngineType);
// (undocumented)
type: DBEngineType;
}
// @public (undocumented)
export interface EnumType {
// (undocumented)
readonly kind: 'Enum';
// (undocumented)
name: string;
// (undocumented)
readonly values: string[];
}
// @public (undocumented)
export class Field {
constructor(name: string, type: FieldType);
// (undocumented)
default: DefaultValue | undefined;
// (undocumented)
length: number | null | undefined;
// (undocumented)
name: string;
// (undocumented)
type: FieldType;
}
// @public (undocumented)
export type FieldDataType = 'String' | 'ID' | 'Int' | 'Float' | 'AWSJSON' | 'AWSDate' | 'AWSTime' | 'AWSDateTime' | 'AWSTimestamp' | 'ENUM' | 'Boolean' | 'AWSEmail' | 'AWSPhone' | 'AWSURL' | 'AWSIPAddress';
// @public (undocumented)
export type FieldType = DefaultType | CustomType | ListType | NonNullType | EnumType;
// @public (undocumented)
export const findMatchingField: (columnName: string, taleName: string, document: DocumentNode) => FieldDefinitionNode | undefined;
// @public (undocumented)
export const generateGraphQLSchema: (schema: Schema, existingSchemaDocument?: DocumentNode | undefined) => string;
// @public (undocumented)
export const generateTypescriptDataSchema: (schema: Schema, config?: DataSourceGenerateConfig) => string;
// @public (undocumented)
export const getHostVpc: (hostname: string, region?: string) => Promise<VpcConfig | undefined>;
// @public (undocumented)
export const getParentNode: (ancestors: any[]) => ObjectTypeDefinitionNode | undefined;
// @public (undocumented)
export const getRefersToDirective: (name: string) => DirectiveNode;
// @public (undocumented)
export const getSSLConfig: (host: string, sslCertificate?: string) => {
rejectUnauthorized: boolean;
ca?: string;
};
// @public (undocumented)
export const graphqlSchemaFromSQLSchema: (sqlSchema: string, engineType: ImportedRDSType) => string;
// @public (undocumented)
export class Index {
constructor(name: string);
// (undocumented)
getFields(): string[];
// (undocumented)
name: string;
// (undocumented)
setFields(fields: string[]): void;
}
// @public (undocumented)
export class InvalidSchemaError extends Error {
constructor(schema: any[], expectedColumns: string[]);
}
// @public (undocumented)
export const invokeSchemaInspectorLambda: (funcName: any, dbConfig: any, query: any, region: any) => Promise<any>;
// @public (undocumented)
export const isComputeExpression: (value: string) => boolean;
// @public (undocumented)
export interface ListType {
// (undocumented)
readonly kind: 'List';
// (undocumented)
readonly type: FieldType;
}
// @public (undocumented)
export class Model {
constructor(name: string);
// (undocumented)
addField(field: Field): void;
// (undocumented)
addIndex(name: string, fields: string[]): void;
// (undocumented)
getFields(): Field[];
// (undocumented)
getIndexes(): Index[];
// (undocumented)
getName(): string;
// (undocumented)
getPrimaryKey(): Index | undefined;
// (undocumented)
hasField(name: string): boolean;
// (undocumented)
hasIndex(name: string): boolean;
// (undocumented)
setPrimaryKey(fields: string[]): void;
}
// @public (undocumented)
export class MySQLDataSourceAdapter extends DataSourceAdapter {
constructor(config: DataSourceConfig);
// (undocumented)
cleanup(): void;
// (undocumented)
getFields(tableName: string): Field[];
// (undocumented)
getIndexes(tableName: string): Index[];
// (undocumented)
getPrimaryKey(tableName: string): Index | null;
// (undocumented)
getTablesList(): string[];
// (undocumented)
initialize(): Promise<void>;
// (undocumented)
protected querySchema(): Promise<string>;
// (undocumented)
test(): Promise<boolean>;
}
// @public (undocumented)
export class MySQLStringDataSourceAdapter extends StringDataSourceAdapter {
// (undocumented)
getFields(tableName: string): Field[];
// (undocumented)
getIndexes(tableName: string): Index[];
// (undocumented)
getPrimaryKey(tableName: string): Index | null;
// (undocumented)
getTablesList(): string[];
// (undocumented)
mapDataType(datatype: string, nullable: boolean, tableName: string, fieldName: string, columntype: string): FieldType;
// (undocumented)
protected setFields(parsedSchema: MySQLSchema): void;
// (undocumented)
protected setIndexes(parsedSchema: MySQLSchema): void;
// Warning: (ae-forgotten-export) The symbol "MySQLSchema" needs to be exported by the entry point index.d.ts
//
// (undocumented)
protected setSchema(schema: MySQLSchema): void;
// (undocumented)
protected setTables(parsedSchema: MySQLSchema): void;
// (undocumented)
protected validateSchema(schema: any[]): schema is MySQLSchema;
}
// @public (undocumented)
export interface NonNullType {
// (undocumented)
readonly kind: 'NonNull';
// (undocumented)
readonly type: DefaultType | CustomType | ListType | EnumType;
}
// @public (undocumented)
export class PostgresDataSourceAdapter extends DataSourceAdapter {
constructor(config: DataSourceConfig);
// (undocumented)
cleanup(): void;
// (undocumented)
getFields(tableName: string): Field[];
// (undocumented)
getIndexes(tableName: string): Index[];
// (undocumented)
getPrimaryKey(tableName: string): Index | null;
// (undocumented)
getTablesList(): string[];
// (undocumented)
initialize(): Promise<void>;
// (undocumented)
protected querySchema(): Promise<string>;
// (undocumented)
test(): Promise<boolean>;
}
// @public (undocumented)
export class PostgresStringDataSourceAdapter extends StringDataSourceAdapter {
// (undocumented)
getFields(tableName: string): Field[];
// (undocumented)
getIndexes(tableName: string): Index[];
// (undocumented)
getPrimaryKey(tableName: string): Index | null;
// (undocumented)
getTablesList(): string[];
// (undocumented)
mapDataType(datatype: string, nullable: boolean, tableName: string, fieldName: string, columntype: string): FieldType;
// (undocumented)
protected setEnums(parsedSchema: PostgresSchema): void;
// (undocumented)
protected setFields(fields: PostgresSchema): void;
// (undocumented)
protected setIndexes(indexes: PostgresSchema): void;
// Warning: (ae-forgotten-export) The symbol "PostgresSchema" needs to be exported by the entry point index.d.ts
//
// (undocumented)
protected setSchema(schema: PostgresSchema): void;
// (undocumented)
protected setTables(parsedSchema: PostgresSchema): void;
// (undocumented)
protected validateSchema(schema: any[]): schema is PostgresSchema;
}
// @public (undocumented)
export const printSchema: (document: DocumentNode) => string;
// @public (undocumented)
export const provisionSchemaInspectorLambda: (lambdaName: string, vpc: VpcConfig, region: string) => Promise<void>;
// @public (undocumented)
export const readRDSGlobalAmplifyInput: (schemaDocument: DocumentNode | undefined) => InputObjectTypeDefinitionNode | undefined;
// @public (undocumented)
export const renderSchema: (schema: Schema, databaseConfig: any, includeAuthRule?: boolean, existingSchema?: DocumentNode) => string;
// @public (undocumented)
export class Schema {
constructor(engine: Engine);
// (undocumented)
addModel(model: Model): void;
// (undocumented)
getEngine(): Engine;
// (undocumented)
getModels(): Model[];
// (undocumented)
hasModel(name: string): boolean;
}
// @public (undocumented)
export const sleep: (milliseconds: number) => Promise<void>;
// @public (undocumented)
export abstract class StringDataSourceAdapter {
constructor(schema: string);
// (undocumented)
describeTable(tableName: string): Model;
// (undocumented)
protected getEnumName(name: string): string;
// (undocumented)
abstract getFields(tableName: string): Field[];
// (undocumented)
abstract getIndexes(tableName: string): Index[];
// (undocumented)
getModels(): Model[];
// (undocumented)
abstract getPrimaryKey(tableName: string): Index | null;
// (undocumented)
abstract getTablesList(): string[];
// (undocumented)
protected abstract mapDataType(datatype: string, nullable: boolean, tableName: string, fieldName: string, columnType: string): FieldType;
// (undocumented)
protected parseSchema(schema: string): any[];
// (undocumented)
protected abstract setFields(fields: any[]): void;
// (undocumented)
protected abstract setIndexes(indexes: any[]): void;
// (undocumented)
protected abstract setSchema(schema: any[]): void;
// (undocumented)
protected abstract setTables(tables: any[]): void;
// (undocumented)
protected abstract validateSchema(schema: any[]): void;
}
// @public (undocumented)
export class TypescriptDataSchemaGenerator {
// (undocumented)
static generate: (config: TypescriptDataSchemaGeneratorConfig) => Promise<string>;
}
// @public (undocumented)
export type TypescriptDataSchemaGeneratorConfig = {
engine: 'mysql' | 'postgresql';
host: string;
port: number;
database: string;
username: string;
password: string;
connectionUriSecretName: string;
sslCertificate?: string;
sslCertificateSecretName?: string;
outputFile?: string;
};
// (No @packageDocumentation comment for this package)
```