1
0
Fork 0
mirror of synced 2024-06-29 11:31:06 +12:00
budibase/packages/server/src/integrations/base/definitions.ts

103 lines
1.6 KiB
TypeScript
Raw Normal View History

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",
}
export interface QueryDefinition {
2021-06-25 05:17:26 +12:00
type: QueryTypes
displayName?: string
readable?: boolean
customisable?: boolean
fields?: object
urlDisplay?: boolean
}
export interface Integration {
2021-06-25 05:17:26 +12:00
docs: string
plus?: boolean
description: string
friendlyName: string
datasource: {}
query: {
2021-06-25 05:17:26 +12:00
[key: string]: QueryDefinition
}
}
export interface SearchFilters {
2021-06-25 05:17:26 +12:00
allOr: boolean
string?: {
2021-06-25 05:17:26 +12:00
[key: string]: string
}
fuzzy?: {
2021-06-25 05:17:26 +12:00
[key: string]: string
}
range?: {
[key: string]: {
2021-06-25 05:17:26 +12:00
high: number | string
low: number | string
}
}
equal?: {
2021-06-25 05:17:26 +12:00
[key: string]: any
}
notEqual?: {
2021-06-25 05:17:26 +12:00
[key: string]: any
}
empty?: {
2021-06-25 05:17:26 +12:00
[key: string]: any
}
notEmpty?: {
2021-06-25 05:17:26 +12:00
[key: string]: any
}
}
export interface QueryJson {
endpoint: {
2021-06-25 05:17:26 +12:00
datasourceId: string
entityId: string
operation: Operation
}
resource: {
2021-06-25 05:17:26 +12:00
fields: string[]
}
filters?: SearchFilters
sort?: {
2021-06-25 05:17:26 +12:00
[key: string]: SortDirection
}
paginate?: {
2021-06-25 05:17:26 +12:00
limit: number
page: string | number
}
body?: object
extra: {
2021-06-25 05:17:26 +12:00
idFilter?: SearchFilters
}
}
export interface QueryOptions {
2021-06-25 05:17:26 +12:00
disableReturning?: boolean
}