2021-09-27 15:57:22 +02:00
|
|
|
import { Table } from "./common"
|
2021-09-23 17:17:23 +02:00
|
|
|
|
2021-06-24 19:16:48 +02:00
|
|
|
export enum Operation {
|
|
|
|
CREATE = "CREATE",
|
|
|
|
READ = "READ",
|
|
|
|
UPDATE = "UPDATE",
|
|
|
|
DELETE = "DELETE",
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum SortDirection {
|
|
|
|
ASCENDING = "ASCENDING",
|
|
|
|
DESCENDING = "DESCENDING",
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum QueryTypes {
|
|
|
|
SQL = "sql",
|
|
|
|
JSON = "json",
|
|
|
|
FIELDS = "fields",
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum DatasourceFieldTypes {
|
|
|
|
STRING = "string",
|
|
|
|
BOOLEAN = "boolean",
|
|
|
|
NUMBER = "number",
|
|
|
|
PASSWORD = "password",
|
|
|
|
LIST = "list",
|
|
|
|
OBJECT = "object",
|
|
|
|
JSON = "json",
|
|
|
|
}
|
|
|
|
|
2021-07-03 12:15:01 +02:00
|
|
|
export enum SourceNames {
|
|
|
|
POSTGRES = "POSTGRES",
|
|
|
|
DYNAMODB = "DYNAMODB",
|
|
|
|
MONGODB = "MONGODB",
|
|
|
|
ELASTICSEARCH = "ELASTICSEARCH",
|
|
|
|
COUCHDB = "COUCHDB",
|
|
|
|
SQL_SERVER = "SQL_SERVER",
|
|
|
|
S3 = "S3",
|
|
|
|
AIRTABLE = "AIRTABLE",
|
|
|
|
MYSQL = "MYSQL",
|
|
|
|
ARANGODB = "ARANGODB",
|
|
|
|
REST = "REST",
|
|
|
|
}
|
|
|
|
|
2021-09-01 20:40:47 +02:00
|
|
|
export enum IncludeRelationships {
|
|
|
|
INCLUDE = 1,
|
2021-09-06 17:24:51 +02:00
|
|
|
EXCLUDE = 0,
|
2021-09-01 20:40:47 +02:00
|
|
|
}
|
|
|
|
|
2021-06-24 19:16:48 +02:00
|
|
|
export interface QueryDefinition {
|
2021-06-25 19:34:21 +02:00
|
|
|
type: QueryTypes
|
|
|
|
displayName?: string
|
|
|
|
readable?: boolean
|
|
|
|
customisable?: boolean
|
|
|
|
fields?: object
|
|
|
|
urlDisplay?: boolean
|
2021-06-24 19:16:48 +02:00
|
|
|
}
|
|
|
|
|
2021-07-08 14:38:49 +02:00
|
|
|
export interface ExtraQueryConfig {
|
|
|
|
[key: string]: {
|
2021-07-29 11:11:52 +02:00
|
|
|
displayName: string
|
|
|
|
type: string
|
2021-07-08 14:38:49 +02:00
|
|
|
required: boolean
|
|
|
|
data?: object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-24 19:16:48 +02:00
|
|
|
export interface Integration {
|
2021-06-25 19:34:21 +02:00
|
|
|
docs: string
|
|
|
|
plus?: boolean
|
|
|
|
description: string
|
|
|
|
friendlyName: string
|
|
|
|
datasource: {}
|
2021-06-24 19:16:48 +02:00
|
|
|
query: {
|
2021-06-25 19:34:21 +02:00
|
|
|
[key: string]: QueryDefinition
|
|
|
|
}
|
2021-07-08 14:38:49 +02:00
|
|
|
extra?: ExtraQueryConfig
|
2021-06-24 19:16:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface SearchFilters {
|
2021-07-01 20:20:41 +02:00
|
|
|
allOr?: boolean
|
2021-06-24 19:16:48 +02:00
|
|
|
string?: {
|
2021-06-25 19:34:21 +02:00
|
|
|
[key: string]: string
|
|
|
|
}
|
2021-06-24 19:16:48 +02:00
|
|
|
fuzzy?: {
|
2021-06-25 19:34:21 +02:00
|
|
|
[key: string]: string
|
|
|
|
}
|
2021-06-24 19:16:48 +02:00
|
|
|
range?: {
|
|
|
|
[key: string]: {
|
2021-06-25 19:34:21 +02:00
|
|
|
high: number | string
|
|
|
|
low: number | string
|
|
|
|
}
|
|
|
|
}
|
2021-06-24 19:16:48 +02:00
|
|
|
equal?: {
|
2021-06-25 19:34:21 +02:00
|
|
|
[key: string]: any
|
|
|
|
}
|
2021-06-24 19:16:48 +02:00
|
|
|
notEqual?: {
|
2021-06-25 19:34:21 +02:00
|
|
|
[key: string]: any
|
|
|
|
}
|
2021-06-24 19:16:48 +02:00
|
|
|
empty?: {
|
2021-06-25 19:34:21 +02:00
|
|
|
[key: string]: any
|
|
|
|
}
|
2021-06-24 19:16:48 +02:00
|
|
|
notEmpty?: {
|
2021-06-25 19:34:21 +02:00
|
|
|
[key: string]: any
|
|
|
|
}
|
2021-07-01 15:10:44 +02:00
|
|
|
oneOf?: {
|
|
|
|
[key: string]: any[]
|
|
|
|
}
|
2021-06-25 19:13:11 +02:00
|
|
|
}
|
|
|
|
|
2021-07-01 20:20:41 +02:00
|
|
|
export interface SortJson {
|
|
|
|
[key: string]: SortDirection
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PaginationJson {
|
|
|
|
limit: number
|
|
|
|
page: string | number
|
|
|
|
}
|
|
|
|
|
2021-06-25 19:13:11 +02:00
|
|
|
export interface RelationshipsJson {
|
2021-06-28 13:36:05 +02:00
|
|
|
through?: string
|
2021-07-01 20:20:41 +02:00
|
|
|
from?: string
|
|
|
|
to?: string
|
2021-10-01 18:16:43 +02:00
|
|
|
fromPrimary?: string
|
|
|
|
toPrimary?: string
|
2021-06-25 19:34:21 +02:00
|
|
|
tableName: string
|
2021-07-01 20:20:41 +02:00
|
|
|
column: string
|
2021-06-24 19:16:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface QueryJson {
|
|
|
|
endpoint: {
|
2021-06-25 19:34:21 +02:00
|
|
|
datasourceId: string
|
|
|
|
entityId: string
|
|
|
|
operation: Operation
|
|
|
|
}
|
2021-06-24 19:16:48 +02:00
|
|
|
resource: {
|
2021-06-25 19:34:21 +02:00
|
|
|
fields: string[]
|
|
|
|
}
|
|
|
|
filters?: SearchFilters
|
2021-07-01 20:20:41 +02:00
|
|
|
sort?: SortJson
|
|
|
|
paginate?: PaginationJson
|
2021-06-25 19:34:21 +02:00
|
|
|
body?: object
|
2021-09-23 17:17:23 +02:00
|
|
|
meta?: {
|
2021-09-27 15:57:22 +02:00
|
|
|
table?: Table
|
2021-09-23 17:17:23 +02:00
|
|
|
}
|
2021-06-25 19:13:11 +02:00
|
|
|
extra?: {
|
2021-06-25 19:34:21 +02:00
|
|
|
idFilter?: SearchFilters
|
|
|
|
}
|
|
|
|
relationships?: RelationshipsJson[]
|
2021-06-24 19:16:48 +02:00
|
|
|
}
|
|
|
|
|
2021-06-25 14:46:02 +02:00
|
|
|
export interface SqlQuery {
|
2021-06-25 19:34:21 +02:00
|
|
|
sql: string
|
2021-07-13 18:11:11 +02:00
|
|
|
bindings?:
|
|
|
|
| string[]
|
|
|
|
| {
|
|
|
|
[key: string]: any
|
|
|
|
}
|
2021-06-25 14:46:02 +02:00
|
|
|
}
|
|
|
|
|
2021-06-24 19:16:48 +02:00
|
|
|
export interface QueryOptions {
|
2021-06-25 19:34:21 +02:00
|
|
|
disableReturning?: boolean
|
2021-06-24 19:17:26 +02:00
|
|
|
}
|