Skip to content
On this page

This is an auto-generated document to support extension builders understand the internal packages they can utilize. To find our written guides, tutorials, and API/SDK reference, check out our main docs .

Directus / @directus/sdk / types / ApplyQueryFields

Type alias: ApplyQueryFields<Schema, Collection, ReadonlyFields, CollectionItem, Fields, RelationalFields, RelationalKeys, FlatFields>

ApplyQueryFields<Schema, Collection, ReadonlyFields, CollectionItem, Fields, RelationalFields, RelationalKeys, FlatFields>: IfAny<Schema, Record<string, any>, Merge<MappedFunctionFields<Schema, CollectionItem> extends infer FF ? MapFlatFields<CollectionItem, FlatFields, FF extends Record<string, string> ? FF : Record<string, string>> : never, RelationalFields extends never ? never : { [Field in keyof RelationalFields]: Field extends keyof CollectionItem ? Extract<CollectionItem[Field], ItemType<Schema>> extends infer RelatedCollection ? RelationNullable<CollectionItem[Field], RelatedCollection extends any[] ? HasManyToAnyRelation<RelatedCollection> extends never ? ApplyNestedQueryFields<Schema, RelatedCollection, RelationalFields[Field]>[] | null : ApplyManyToAnyFields<Schema, RelatedCollection, RelationalFields[Field]>[] : ApplyNestedQueryFields<Schema, RelatedCollection, RelationalFields[Field]>> : never : never }>>

Apply the configured fields query parameter on a given Item type

Type parameters

Schema extends object

Collection extends object


CollectionItem extends object = UnpackList<Collection>

Fields = UnpackList<Mutable<ReadonlyFields>>

RelationalFields = PickRelationalFields<Fields>

RelationalKeys extends keyof RelationalFields = RelationalFields extends never ? never : keyof RelationalFields

FlatFields extends keyof CollectionItem = FieldsWildcard<CollectionItem, Exclude<Fields, RelationalKeys>>