import { GraphQLRecordAssertion, GraphQLArgumentAssertion } from '../graphql/graphqlService'; import { DataStorageInternal, GenericGraphQLStorageSource } from './dataStorageInternalService'; import { MergeNonOptionalFieldsIntoSimilarType, RequiredDifference, NonNullableProps } from '../../utilities/types'; export type CreateMutationResolver = (mutationArg: A, id: string) => B; export type UpdateMutationResolver = (mutationArg: A, sourceRecord: B) => B; export type DeleteMutationResolver = (mutationId: string, fullStorageState: A, isDynamic: boolean) => A; export type ListAllResolver = (allValues: A[]) => A[]; export interface ManagerResolvers, CreateType extends GraphQLArgumentAssertion, UpdateType extends GraphQLRecordAssertion, StorageType extends GenericGraphQLStorageSource, _FullBaseType extends RequiredDifference<_FullBaseType, NonNullableProps> & NonNullableProps> & NonNullableProps>>, SafeUpdateType = MergeNonOptionalFieldsIntoSimilarType> { listAllResolver: ListAllResolver; createMutationResolver?: CreateMutationResolver; updateMutationResolver?: UpdateMutationResolver; deleteMutationResolver?: DeleteMutationResolver; } /** * SafeUpdateType: The GraphQL schema types for updates are insufficient because * they do not tell you whether a field is nullable or not. All update types are * by default a Null/Partial of the base schema type with the exception of the UID. * By merging the create type into the update type, we can actually infer what properties * are nullable by finding which properties are required as part of the create type. * This will remove the '| null' from any properties that are required but will keep the ? * which ultimately means they still support partial updates but not nullability. */ export declare class DataManager, CreateType extends GraphQLArgumentAssertion, UpdateType extends GraphQLRecordAssertion, StorageType extends GenericGraphQLStorageSource, _FullBaseType extends RequiredDifference<_FullBaseType, NonNullableProps> & NonNullableProps> & NonNullableProps>>, SafeUpdateType = MergeNonOptionalFieldsIntoSimilarType> { private _schema; private _contextId; private _storage; private _createMutationResolver; private _updateMutationResolver; private _deleteMutationResolver; private _listAllResolver; constructor(schema: keyof GenericGraphQLStorageSource, storage: DataStorageInternal, contextId: string, resolvers: ManagerResolvers); private notImplementedResolver; createItem(item: CreateType): QueryType; updateItem(item: SafeUpdateType): QueryType; deleteItem(itemId: string): void; listAll(): QueryType[]; } //# sourceMappingURL=dataManagerService.d.ts.map