@aws-amplify/graphql-schema-generator
Version:
Amplify GraphQL schema generator
58 lines • 1.8 kB
TypeScript
export type FieldType = DefaultType | CustomType | ListType | NonNullType | EnumType;
export type FieldDataType = 'String' | 'ID' | 'Int' | 'Float' | 'AWSJSON' | 'AWSDate' | 'AWSTime' | 'AWSDateTime' | 'AWSTimestamp' | 'ENUM' | 'Boolean' | 'AWSEmail' | 'AWSPhone' | 'AWSURL' | 'AWSIPAddress';
export interface DefaultType {
readonly kind: 'Scalar';
readonly name: FieldDataType;
}
export interface CustomType {
readonly kind: 'Custom';
readonly name: string;
}
export interface ListType {
readonly kind: 'List';
readonly type: FieldType;
}
export interface NonNullType {
readonly kind: 'NonNull';
readonly type: DefaultType | CustomType | ListType | EnumType;
}
export interface EnumType {
readonly kind: 'Enum';
name: string;
readonly values: string[];
}
export interface DefaultValue {
readonly kind: 'DB_GENERATED' | 'TRANSFORMER_GENERATED';
readonly value: string | number | boolean;
}
export declare class Field {
name: string;
type: FieldType;
default: DefaultValue | undefined;
length: number | null | undefined;
constructor(name: string, type: FieldType);
}
export declare class Index {
name: string;
private fields;
constructor(name: string);
getFields(): string[];
setFields(fields: string[]): void;
}
export declare class Model {
private name;
private fields;
private primaryKey;
private indexes;
constructor(name: string);
getName(): string;
addField(field: Field): void;
hasField(name: string): boolean;
setPrimaryKey(fields: string[]): void;
getPrimaryKey(): Index | undefined;
getIndexes(): Index[];
addIndex(name: string, fields: string[]): void;
hasIndex(name: string): boolean;
getFields(): Field[];
}
//# sourceMappingURL=types.d.ts.map