shyft
Version:
Model driven GraphQL API framework
39 lines (38 loc) • 2.12 kB
TypeScript
import { DataType } from '../datatype/DataType';
import { StorageConfiguration } from './StorageConfiguration';
import { ComplexDataType, Entity, StorageDataType } from '../..';
import { Mutation } from '../mutation/Mutation';
import { Connection } from 'typeorm';
export declare type StorageTypeSetup = {
name?: string;
description?: string;
findOne?: (entity?: Entity, id?: any, args?: Record<string, any>, context?: Record<string, any>) => any;
findOneByValues?: (entity?: Entity, arg?: any, context?: Record<string, any>) => any;
find?: (entity?: Entity, args?: Record<string, any>, context?: Record<string, any>, parentConnection?: any) => any;
count?: (entity?: Entity, args?: Record<string, any>, context?: Record<string, any>, parentConnection?: any) => number | any;
mutate?: (entity?: Entity, id?: any, input?: any, entityMutation?: Mutation, context?: Record<string, any>) => void | any;
checkLookupPermission?: (entity?: Entity, where?: any, context?: Record<string, any>) => boolean | any;
};
export declare class StorageType {
name: string;
description: string;
findOne: (...arg: any[]) => any;
findOneByValues: (...arg: any[]) => any;
find: (...args: any[]) => any;
count: (...arg: any[]) => any;
mutate: (...args: any[]) => any;
checkLookupPermission: (...arg: any[]) => any;
private _dataTypeMap;
private _dynamicDataTypeMap;
storageConfiguration: StorageConfiguration;
constructor(setup?: StorageTypeSetup);
addDataTypeMap(schemaDataType: DataType, storageDataType: StorageDataType): void;
addDynamicDataTypeMap(schemaDataTypeDetector: (...args: any[]) => any, storageDataType: StorageDataType | ((...args: any[]) => any)): void;
convertToStorageDataType(schemaDataType: DataType | ComplexDataType): StorageDataType;
setStorageConfiguration(storageConfiguration: StorageConfiguration): void;
getStorageConfiguration(): StorageConfiguration;
getStorageInstance(): Connection;
getStorageModels(): any;
toString(): string;
}
export declare const isStorageType: (obj: unknown) => boolean;