budibase/packages/server/src/definitions/common.ts

104 lines
1.7 KiB
TypeScript
Raw Normal View History

export { Query, Datasource } from "./datasource"
export interface Base {
2021-06-28 11:21:37 +02:00
_id?: string
_rev?: string
}
2022-02-24 16:13:14 +01:00
export interface Application extends Base {
appId?: string
}
export interface FieldSchema {
// TODO: replace with field types enum when done
type: string
fieldName?: string
name: string
tableId?: string
relationshipType?: string
through?: string
foreignKey?: string
autocolumn?: boolean
subtype?: string
throughFrom?: string
throughTo?: string
formula?: string
formulaType?: string
main?: boolean
meta?: {
toTable: string
toKey: string
}
constraints?: {
type?: string
email?: boolean
inclusion?: string[]
length?: {
minimum?: string | number
maximum?: string | number
2021-06-28 11:21:37 +02:00
}
presence?: boolean
2021-06-28 11:21:37 +02:00
}
}
export interface TableSchema {
[key: string]: FieldSchema
}
export interface Table extends Base {
2021-06-28 11:21:37 +02:00
type?: string
views?: {}
2021-10-28 20:39:42 +02:00
name: string
2021-06-28 11:21:37 +02:00
primary?: string[]
schema: TableSchema
primaryDisplay?: string
sourceId?: string
relatedFormula?: string[]
constrained?: string[]
}
export interface Row extends Base {
2021-06-28 11:21:37 +02:00
type?: string
tableId?: string
2021-06-28 11:21:37 +02:00
[key: string]: any
}
interface JsonSchemaField {
properties: {
[key: string]: {
2021-06-28 11:21:37 +02:00
type: string
title: string
customType?: string
}
}
required?: string[]
}
export interface AutomationStep {
2021-06-28 11:21:37 +02:00
description: string
event?: string
icon: string
id: string
inputs: {
2021-06-28 11:21:37 +02:00
[key: string]: any
}
name: string
schema: {
2021-06-28 11:21:37 +02:00
inputs: JsonSchemaField
outputs: JsonSchemaField
}
stepId: string
tagline: string
type: string
}
export interface Automation extends Base {
2021-06-28 11:21:37 +02:00
name: string
type: string
appId?: string
definition: {
2021-06-28 11:21:37 +02:00
steps: AutomationStep[]
trigger?: AutomationStep
}
}