Directus / @directus/sdk / rest / updateField
Function: updateField() ​
updateField<
Schema,TQuery>(collection,field,item,query?):RestCommand<IfAny<Schema,Record<string,any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, DirectusField<Schema>> extends FF ? MapFlatFields<DirectusField<Schema>, FieldsWildcard<DirectusField<Schema>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof DirectusField<Schema> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>,Schema>
Defined in: rest/commands/update/fields.ts:23
Updates the given field in the given collection.
Type Parameters ​
• Schema
• TQuery extends Query<Schema, DirectusField<Schema>>
Parameters ​
collection ​
string
field ​
string
item ​
collection ​
string
field ​
string
meta ​
NestedUnion<IfAny<Schema, { collection: string; conditions: null | FieldMetaConditionType[]; display: null | string; display_options: null | Record<string, any>; field: string; group: null | string; hidden: boolean; id: number; interface: null | string; note: null | string; options: null | Record<string, any>; readonly: boolean; required: boolean; sort: null | number; special: null | string[]; translations: null | FieldMetaTranslationType[]; validation: null | Record<string, any>; validation_message: null | string; width: null | string; }, "directus_fields" extends keyof Schema ? UnpackList<Schema[keyof Schema & "directus_fields"]> extends Item ? { [Field in string | number | symbol]: Item[Field] } & object : never : object>>
schema ​
{ comment: null | string; data_type: string; default_value: any; foreign_key_column: null | string; foreign_key_schema: null | string; foreign_key_table: null | string; generation_expression: unknown; has_auto_increment: boolean; is_generated: boolean; is_indexed: boolean; is_nullable: boolean; is_primary_key: boolean; is_unique: boolean; max_length: null | number; name: string; numeric_precision: null | number; numeric_scale: null | number; schema: string; table: string; }
schema.comment ​
null | string
schema.data_type ​
string
schema.default_value ​
any
schema.foreign_key_column ​
null | string
schema.foreign_key_schema ​
null | string
schema.foreign_key_table ​
null | string
schema.generation_expression ​
unknown
schema.has_auto_increment ​
boolean
schema.is_generated ​
boolean
schema.is_indexed ​
boolean
schema.is_nullable ​
boolean
schema.is_primary_key ​
boolean
schema.is_unique ​
boolean
schema.max_length ​
null | number
schema.name ​
string
schema.numeric_precision ​
null | number
schema.numeric_scale ​
null | number
schema.schema ​
string
schema.table ​
string
type ​
string
query? ​
TQuery
Returns ​
RestCommand<IfAny<Schema, Record<string, any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, DirectusField<Schema>> extends FF ? MapFlatFields<DirectusField<Schema>, FieldsWildcard<DirectusField<Schema>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof DirectusField<Schema> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>, Schema>
Throws ​
Will throw if collection is empty
Throws ​
Will throw if field is empty