Improve types

This commit is contained in:
Adria Navarro 2024-07-30 11:52:43 +02:00
parent 9cf50d1f72
commit 10351c52f8
1 changed files with 19 additions and 0 deletions

View File

@ -157,6 +157,21 @@ export interface FieldConstraints {
}
}
export interface OptionsFieldMetadata extends BaseFieldSchema {
type: FieldType.OPTIONS
constraints: FieldConstraints & {
inclusion: string[]
}
}
export interface ArrayFieldMetadata extends BaseFieldSchema {
type: FieldType.ARRAY
constraints: FieldConstraints & {
type: JsonFieldSubType.ARRAY
inclusion: string[]
}
}
interface BaseFieldSchema extends UIFieldMetadata {
type: FieldType
name: string
@ -182,6 +197,8 @@ interface OtherFieldMetadata extends BaseFieldSchema {
| FieldType.BB_REFERENCE_SINGLE
| FieldType.ATTACHMENTS
| FieldType.STRING
| FieldType.ARRAY
| FieldType.OPTIONS
>
}
@ -198,6 +215,8 @@ export type FieldSchema =
| JsonFieldMetadata
| AttachmentFieldMetadata
| BBReferenceSingleFieldMetadata
| ArrayFieldMetadata
| OptionsFieldMetadata
export interface TableSchema {
[key: string]: FieldSchema