import type { z } from 'zod'; import type { ClientConfigSchema, CollectionEnum, CollectionPreservableIdEnum, ConfigFileOptionsSchema, OptionsFields, OptionsSchema, RestConfigSchema } from './schema'; import type { MigrationClient } from '../migration-client'; import type { DirectusBaseType, Query } from '../collections'; import type { Snapshot } from '../snapshot'; export type OptionName = keyof typeof OptionsFields; export type Options = z.infer; export type ConfigFileOptions = z.infer; export type CollectionName = z.infer; export type CollectionPreservableIdName = z.infer; export type CollectionRecord = Record; export type TransformDataFunction = (data: T[], directusClient: Awaited>) => T[] | Promise; export type TransformQueryFunction = >(query: T, directusClient: Awaited>) => T | Promise; export type TransformSnapshotFunction = (snapshot: Snapshot, directusClient: Awaited>) => Snapshot | Promise; export interface CollectionHooks { onLoad?: TransformDataFunction; onDump?: TransformDataFunction; onSave?: TransformDataFunction; onQuery?: TransformQueryFunction; } export interface SnapshotHooks { onLoad?: TransformSnapshotFunction; onSave?: TransformSnapshotFunction; } export interface DirectusConfigBase { url: string; clientConfig: z.infer | undefined; restConfig: z.infer | undefined; } export interface DirectusConfigWithToken extends DirectusConfigBase { token: string; } export interface DirectusConfigWithCredentials extends DirectusConfigBase { email: string; password: string; }