2021-07-03 12:15:01 +02:00
|
|
|
import { SourceNames } from "./datasource"
|
|
|
|
|
2021-06-27 00:09:46 +02:00
|
|
|
interface Base {
|
2021-06-28 11:21:37 +02:00
|
|
|
_id?: string
|
|
|
|
_rev?: string
|
2021-06-27 00:09:46 +02:00
|
|
|
}
|
|
|
|
|
2021-07-01 20:20:41 +02:00
|
|
|
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
|
2021-07-05 19:11:23 +02:00
|
|
|
autocolumn?: boolean
|
2021-10-01 18:16:43 +02:00
|
|
|
throughFrom?: string
|
|
|
|
throughTo?: string
|
2021-10-29 19:37:29 +02:00
|
|
|
main?: boolean
|
|
|
|
meta?: {
|
|
|
|
toTable: string
|
|
|
|
toKey: string
|
|
|
|
}
|
2021-07-01 20:20:41 +02:00
|
|
|
constraints?: {
|
|
|
|
type?: string
|
|
|
|
email?: boolean
|
|
|
|
inclusion?: string[]
|
|
|
|
length?: {
|
|
|
|
minimum?: string | number
|
|
|
|
maximum?: string | number
|
2021-06-28 11:21:37 +02:00
|
|
|
}
|
2021-07-01 20:20:41 +02:00
|
|
|
presence?: boolean
|
2021-06-28 11:21:37 +02:00
|
|
|
}
|
2021-06-27 00:09:46 +02:00
|
|
|
}
|
|
|
|
|
2021-07-01 20:20:41 +02:00
|
|
|
export interface TableSchema {
|
|
|
|
[key: string]: FieldSchema
|
|
|
|
}
|
|
|
|
|
2021-06-27 00:09:46 +02:00
|
|
|
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
|
2021-06-27 00:09:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Row extends Base {
|
2021-06-28 11:21:37 +02:00
|
|
|
type?: string
|
2021-07-01 20:20:41 +02:00
|
|
|
tableId?: string
|
2021-06-28 11:21:37 +02:00
|
|
|
[key: string]: any
|
2021-06-27 00:09:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
interface JsonSchemaField {
|
|
|
|
properties: {
|
|
|
|
[key: string]: {
|
2021-06-28 11:21:37 +02:00
|
|
|
type: string
|
|
|
|
title: string
|
|
|
|
customType?: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
required?: string[]
|
2021-06-27 00:09:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface AutomationStep {
|
2021-06-28 11:21:37 +02:00
|
|
|
description: string
|
|
|
|
event?: string
|
|
|
|
icon: string
|
|
|
|
id: string
|
2021-06-27 00:09:46 +02:00
|
|
|
inputs: {
|
2021-06-28 11:21:37 +02:00
|
|
|
[key: string]: any
|
|
|
|
}
|
|
|
|
name: string
|
2021-06-27 00:09:46 +02:00
|
|
|
schema: {
|
2021-06-28 11:21:37 +02:00
|
|
|
inputs: JsonSchemaField
|
|
|
|
outputs: JsonSchemaField
|
|
|
|
}
|
|
|
|
stepId: string
|
|
|
|
tagline: string
|
|
|
|
type: string
|
2021-06-27 00:09:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Automation extends Base {
|
2021-06-28 11:21:37 +02:00
|
|
|
name: string
|
|
|
|
type: string
|
|
|
|
appId?: string
|
2021-06-27 00:09:46 +02:00
|
|
|
definition: {
|
2021-06-28 11:21:37 +02:00
|
|
|
steps: AutomationStep[]
|
|
|
|
trigger?: AutomationStep
|
|
|
|
}
|
2021-06-27 00:09:46 +02:00
|
|
|
}
|
2021-07-03 12:15:01 +02:00
|
|
|
|
|
|
|
export interface Datasource extends Base {
|
|
|
|
type: string
|
|
|
|
name: string
|
|
|
|
source: SourceNames
|
|
|
|
// the config is defined by the schema
|
|
|
|
config: {
|
|
|
|
[key: string]: string | number | boolean
|
|
|
|
}
|
|
|
|
plus: boolean
|
|
|
|
entities?: {
|
|
|
|
[key: string]: Table
|
|
|
|
}
|
|
|
|
}
|