import { Knex } from 'knex'; import Keyv from 'keyv'; import { Accountability, Query, PermissionsAction, SchemaOverview } from '@directus/shared/types'; import { AbstractService, AbstractServiceOptions, Item as AnyItem, PrimaryKey, MutationOptions } from '../types'; export declare type QueryOptions = { stripNonRequested?: boolean; permissionsAction?: PermissionsAction; transformers?: { conceal?: boolean; hash?: boolean; json?: boolean; 'json-stringify'?: boolean; }; }; export declare class ItemsService implements AbstractService { collection: string; knex: Knex; accountability: Accountability | null; eventScope: string; schema: SchemaOverview; cache: Keyv | null; bearerToken: string | null; constructor(collection: string, options: AbstractServiceOptions); getKeysByQuery(query: Query): Promise; /** * Create a single new item. */ createOne(data: Partial, opts?: MutationOptions): Promise; /** * Create multiple new items at once. Inserts all provided records sequentially wrapped in a transaction. */ createMany(data: Partial[], opts?: MutationOptions): Promise; /** * Get items by query */ readByQuery(query: Query, opts?: QueryOptions): Promise; /** * Get single item by primary key */ readOne(key: PrimaryKey, query?: Query, opts?: QueryOptions): Promise; /** * Get multiple items by primary keys */ readMany(keys: PrimaryKey[], query?: Query, opts?: QueryOptions): Promise; /** * Update multiple items by query */ updateByQuery(query: Query, data: Partial, opts?: MutationOptions): Promise; /** * Update a single item by primary key */ updateOne(key: PrimaryKey, data: Partial, opts?: MutationOptions): Promise; /** * Update many items by primary key */ updateMany(keys: PrimaryKey[], data: Partial, opts?: MutationOptions): Promise; /** * Upsert a single item */ upsertOne(payload: Partial, opts?: MutationOptions): Promise; /** * Upsert many items */ upsertMany(payloads: Partial[], opts?: MutationOptions): Promise; /** * Delete multiple items by query */ deleteByQuery(query: Query, opts?: MutationOptions): Promise; /** * Delete a single item by primary key */ deleteOne(key: PrimaryKey, opts?: MutationOptions): Promise; /** * Delete multiple items by primary key */ deleteMany(keys: PrimaryKey[], opts?: MutationOptions): Promise; /** * Read/treat collection as singleton */ readSingleton(query: Query, opts?: QueryOptions): Promise>; /** * Upsert/treat collection as singleton */ upsertSingleton(data: Partial, opts?: MutationOptions): Promise; }