UNPKG

@directus/api

Version:

Directus is a real-time API and App dashboard for managing SQL database content

34 lines (33 loc) 1.82 kB
import type { Column } from '@directus/schema'; import type { Field, Relation, SnapshotCollection, SnapshotField, SnapshotRelation, SnapshotSystemField } from '@directus/types'; import type { Collection } from '../types/index.js'; /** * Pick certain database vendor specific collection properties that should be compared when performing diff * * @param collection collection to sanitize * @returns sanitized collection */ export declare function sanitizeCollection(collection: Collection): SnapshotCollection; /** * Pick certain database vendor specific field properties that should be compared when performing diff * * @param field field to sanitize * @param sanitizeAllSchema Whether or not the whole field schema should be sanitized. Mainly used to prevent modifying autoincrement fields * @returns sanitized field */ export declare function sanitizeField(field: Field, sanitizeAllSchema?: boolean): SnapshotField; export declare function sanitizeColumn(column: Column): Pick<Column, "table" | "foreign_key_table" | "foreign_key_column" | "name" | "data_type" | "default_value" | "max_length" | "numeric_precision" | "numeric_scale" | "is_nullable" | "is_unique" | "is_indexed" | "is_primary_key" | "is_generated" | "generation_expression" | "has_auto_increment">; /** * Pick certain database vendor specific relation properties that should be compared when performing diff * * @param relation relation to sanitize * @returns sanitized relation */ export declare function sanitizeRelation(relation: Relation): SnapshotRelation; /** * Pick certain specific system field properties that should be compared when performing diff * * @param field field to sanitize * @returns sanitized system field */ export declare function sanitizeSystemField(field: Field | SnapshotSystemField): SnapshotSystemField;