import { Command, MultipleRestCommand, SingleRestCommand, DirectusBaseType, DirectusId, Query, WithoutIdAndSyncId, WithoutSyncId } from './interfaces'; import { MigrationClient } from '../../migration-client'; import { Logger } from '../../logger'; /** * This class is responsible for calling CRUD operations on the target collection using the rest API. */ export declare abstract class DataClient { protected readonly logger: Logger; protected readonly migrationClient: MigrationClient; constructor(logger: Logger, migrationClient: MigrationClient); /** * Request data from the target collection using the rest API. */ query(query: Query): Promise; /** * Inserts data into the target collection using the rest API. * Remove the id and the syncId from the item before inserting it. */ create(item: WithoutSyncId): Promise; /** * Updates data in the target collection using the rest API. * The diff item already excludes the id and the syncId. */ update(itemId: DirectusId, diffItem: Partial>): Promise; /** * Deletes data from the target collection using the rest API. * The id is the local id. */ delete(itemId: DirectusId): Promise; /** * Execute commands in sequence and return the last result. */ protected executeCommandsInSequence(commands: Command | [...Command[], Command]): Promise; /** * Split the pre-commands and the final command. */ protected splitCommands(commands: Command | [...Command[], Command]): [Command[], Command]; protected abstract getQueryCommand(query: Query): SingleRestCommand; protected abstract getInsertCommand(item: WithoutSyncId): MultipleRestCommand; protected abstract getUpdateCommand(itemId: DirectusId, diffItem: Partial>): MultipleRestCommand; protected abstract getDeleteCommand(itemId: DirectusId): MultipleRestCommand; }