@directus/api
Version:
Directus is a real-time API and App dashboard for managing SQL database content
50 lines (49 loc) • 2.29 kB
TypeScript
import type { Column, SchemaInspector } from '@directus/schema';
import type { AbstractServiceOptions, Accountability, Field, FieldMutationOptions, MutationOptions, RawField, SchemaOverview, Type } from '@directus/types';
import type Keyv from 'keyv';
import type { Knex } from 'knex';
import { z } from 'zod';
import type { Helpers } from '../database/helpers/index.js';
import { ItemsService } from './items.js';
import { PayloadService } from './payload.js';
export declare const systemFieldUpdateSchema: z.ZodObject<{
collection: z.ZodOptional<z.ZodString>;
field: z.ZodOptional<z.ZodString>;
schema: z.ZodObject<{
is_indexed: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strict>;
}, z.core.$strict>;
export declare class FieldsService {
knex: Knex;
helpers: Helpers;
accountability: Accountability | null;
itemsService: ItemsService;
payloadService: PayloadService;
schemaInspector: SchemaInspector;
schema: SchemaOverview;
cache: Keyv<any> | null;
systemCache: Keyv<any>;
schemaCache: Keyv<any>;
constructor(options: AbstractServiceOptions);
columnInfo(collection?: string): Promise<Column[]>;
columnInfo(collection: string, field: string): Promise<Column>;
readAll(collection?: string): Promise<Field[]>;
readOne(collection: string, field: string): Promise<Record<string, any>>;
createField(collection: string, field: Partial<Field> & {
field: string;
type: Type | null;
}, table?: Knex.CreateTableBuilder, // allows collection creation to
opts?: FieldMutationOptions): Promise<void>;
updateField(collection: string, field: RawField, opts?: FieldMutationOptions): Promise<string>;
updateFields(collection: string, fields: RawField[], opts?: FieldMutationOptions): Promise<string[]>;
deleteField(collection: string, field: string, opts?: MutationOptions): Promise<void>;
addColumnToTable(table: Knex.CreateTableBuilder, collection: string, field: RawField | Field, options?: {
attemptConcurrentIndex?: boolean;
existing?: Column | null;
}): void;
addColumnIndex(collection: string, field: Field | RawField, options?: {
attemptConcurrentIndex?: boolean;
knex?: Knex;
existing?: Column | null;
}): Promise<void>;
}