import type { SchemaInspector, Table } from '@db-studio/db-schema'; import type { Accountability, RawField, SchemaOverview } from '@db-studio/types'; import type Keyv from 'keyv'; import type { Knex } from 'knex'; import type { Helpers } from '../database/helpers/index.js'; import type { AbstractServiceOptions, Collection, CollectionMeta, MutationOptions } from '../types/index.js'; export type RawCollection = { collection: string; fields?: RawField[]; schema?: Partial | null; meta?: Partial | null; }; export declare class CollectionsService { knex: Knex; helpers: Helpers; accountability: Accountability | null; schemaInspector: SchemaInspector; schema: SchemaOverview; cache: Keyv | null; systemCache: Keyv; constructor(options: AbstractServiceOptions); /** * Create a single new collection */ createOne(payload: RawCollection, opts?: MutationOptions): Promise; /** * Create multiple new collections */ createMany(payloads: RawCollection[], opts?: MutationOptions): Promise; /** * Read all collections. Currently doesn't support any query. */ readByQuery(): Promise; /** * Get a single collection by name */ readOne(collectionKey: string): Promise; /** * Read many collections by name */ readMany(collectionKeys: string[]): Promise; /** * Update a single collection by name */ updateOne(collectionKey: string, data: Partial, opts?: MutationOptions): Promise; /** * Update multiple collections in a single transaction */ updateBatch(data: Partial[], opts?: MutationOptions): Promise; /** * Update multiple collections by name */ updateMany(collectionKeys: string[], data: Partial, opts?: MutationOptions): Promise; /** * Delete a single collection This will delete the table and all records within. It'll also * delete any fields, presets, activity, revisions, and permissions relating to this collection */ deleteOne(collectionKey: string, opts?: MutationOptions): Promise; /** * Delete multiple collections by key */ deleteMany(collectionKeys: string[], opts?: MutationOptions): Promise; }