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

79 lines
1.3 KiB
TypeScript
Raw Normal View History

interface Base {
2021-06-28 11:21:37 +02:00
_id?: string
_rev?: string
}
export interface TableSchema {
[key: string]: {
// TODO: replace with field types enum when done
2021-06-28 11:21:37 +02:00
type: string
fieldName?: string
name: string
constraints?: {
2021-06-28 11:21:37 +02:00
type?: string
email?: boolean
inclusion?: string[]
length?: {
2021-06-28 11:21:37 +02:00
minimum?: string | number
maximum?: string | number
}
presence?: boolean
}
}
}
export interface Table extends Base {
2021-06-28 11:21:37 +02:00
type?: string
views?: {}
name?: string
primary?: string[]
schema: TableSchema
primaryDisplay?: string
sourceId?: string
}
export interface Row extends Base {
2021-06-28 11:21:37 +02:00
type?: string
tableId: string
[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
}
}