budibase/packages/builder/src/constants/backend/index.js

290 lines
6.1 KiB
JavaScript
Raw Normal View History

2020-06-15 17:41:31 +02:00
export const FIELDS = {
2020-08-07 17:13:57 +02:00
STRING: {
name: "Text",
2020-06-16 21:29:18 +02:00
type: "string",
icon: "Text",
2020-06-16 21:29:18 +02:00
constraints: {
2020-06-15 17:41:31 +02:00
type: "string",
2020-06-16 21:29:18 +02:00
length: {},
presence: false,
2020-06-15 17:41:31 +02:00
},
},
BARCODEQR: {
name: "Barcode/QR",
type: "barcodeqr",
icon: "Camera",
2022-10-05 10:28:07 +02:00
constraints: {
type: "string",
length: {},
presence: false,
},
},
LONGFORM: {
name: "Long Form Text",
type: "longform",
icon: "TextAlignLeft",
constraints: {
type: "string",
length: {},
presence: false,
},
},
OPTIONS: {
name: "Options",
type: "options",
icon: "Dropdown",
constraints: {
type: "string",
2020-10-11 21:42:30 +02:00
presence: false,
inclusion: [],
},
},
ARRAY: {
2021-08-26 15:04:18 +02:00
name: "Multi-select",
type: "array",
icon: "Duplicate",
constraints: {
type: "array",
presence: false,
inclusion: [],
},
},
2020-06-15 17:41:31 +02:00
NUMBER: {
name: "Number",
2020-06-16 21:29:18 +02:00
type: "number",
icon: "123",
2020-06-16 21:29:18 +02:00
constraints: {
2020-06-15 17:41:31 +02:00
type: "number",
presence: false,
numericality: { greaterThanOrEqualTo: "", lessThanOrEqualTo: "" },
2020-06-15 17:41:31 +02:00
},
},
BIGINT: {
name: "BigInt",
type: "bigint",
icon: "TagBold",
},
2020-06-15 17:41:31 +02:00
BOOLEAN: {
2021-02-23 10:38:24 +01:00
name: "Boolean",
2020-06-16 21:29:18 +02:00
type: "boolean",
icon: "Boolean",
2020-06-16 21:29:18 +02:00
constraints: {
2020-06-15 17:41:31 +02:00
type: "boolean",
presence: false,
2020-06-15 17:41:31 +02:00
},
},
DATETIME: {
name: "Date/Time",
type: "datetime",
icon: "Calendar",
constraints: {
type: "string",
length: {},
presence: false,
datetime: {
latest: "",
earliest: "",
},
},
},
2020-09-11 16:09:56 +02:00
ATTACHMENT: {
name: "Attachment",
type: "attachment",
icon: "Folder",
2020-09-11 16:09:56 +02:00
constraints: {
type: "array",
presence: false,
2020-09-11 16:09:56 +02:00
},
},
LINK: {
name: "Relationship",
type: "link",
icon: "Link",
constraints: {
type: "array",
2020-10-11 21:42:30 +02:00
presence: false,
},
2021-02-15 20:59:49 +01:00
},
FORMULA: {
name: "Formula",
type: "formula",
icon: "Calculator",
constraints: {},
},
JSON: {
2021-12-10 16:26:43 +01:00
name: "JSON",
type: "json",
icon: "Brackets",
constraints: {
type: "object",
presence: false,
},
},
}
export const AUTO_COLUMN_SUB_TYPES = {
AUTO_ID: "autoID",
CREATED_BY: "createdBy",
CREATED_AT: "createdAt",
UPDATED_BY: "updatedBy",
UPDATED_AT: "updatedAt",
}
export const AUTO_COLUMN_DISPLAY_NAMES = {
AUTO_ID: "Auto ID",
CREATED_BY: "Created By",
CREATED_AT: "Created At",
UPDATED_BY: "Updated By",
UPDATED_AT: "Updated At",
2020-06-15 17:41:31 +02:00
}
2020-09-17 13:45:28 +02:00
export const FILE_TYPES = {
IMAGE: ["png", "tiff", "gif", "raw", "jpg", "jpeg"],
CODE: ["js", "rs", "py", "java", "rb", "hs", "yml"],
2020-09-17 17:36:39 +02:00
DOCUMENT: ["odf", "docx", "doc", "pdf", "csv"],
}
export const HostingTypes = {
CLOUD: "cloud",
SELF: "self",
}
2021-02-10 23:23:27 +01:00
export const Roles = {
ADMIN: "ADMIN",
POWER: "POWER",
BASIC: "BASIC",
PUBLIC: "PUBLIC",
BUILDER: "BUILDER",
}
export function isAutoColumnUserRelationship(subtype) {
2021-02-15 20:59:49 +01:00
return (
subtype === AUTO_COLUMN_SUB_TYPES.CREATED_BY ||
subtype === AUTO_COLUMN_SUB_TYPES.UPDATED_BY
2021-02-15 20:59:49 +01:00
)
}
export const RelationshipType = {
MANY_TO_MANY: "many-to-many",
ONE_TO_MANY: "one-to-many",
MANY_TO_ONE: "many-to-one",
}
export const ALLOWABLE_STRING_OPTIONS = [
FIELDS.STRING,
FIELDS.OPTIONS,
FIELDS.LONGFORM,
FIELDS.BARCODEQR,
]
export const ALLOWABLE_STRING_TYPES = ALLOWABLE_STRING_OPTIONS.map(
opt => opt.type
)
export const ALLOWABLE_NUMBER_OPTIONS = [FIELDS.NUMBER, FIELDS.BOOLEAN]
export const ALLOWABLE_NUMBER_TYPES = ALLOWABLE_NUMBER_OPTIONS.map(
opt => opt.type
)
export const SWITCHABLE_TYPES = [
...ALLOWABLE_STRING_TYPES,
...ALLOWABLE_NUMBER_TYPES,
]
2021-12-06 18:39:51 +01:00
2022-11-15 18:03:35 +01:00
export const BUDIBASE_INTERNAL_DB_ID = "bb_internal"
export const DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default"
2022-11-15 18:03:35 +01:00
export const BUDIBASE_DATASOURCE_TYPE = "budibase"
2022-11-23 18:12:23 +01:00
export const DB_TYPE_INTERNAL = "internal"
export const DB_TYPE_EXTERNAL = "external"
2021-12-06 18:39:51 +01:00
export const IntegrationTypes = {
POSTGRES: "POSTGRES",
MONGODB: "MONGODB",
COUCHDB: "COUCHDB",
S3: "S3",
MYSQL: "MYSQL",
REST: "REST",
DYNAMODB: "DYNAMODB",
ELASTICSEARCH: "ELASTICSEARCH",
SQL_SERVER: "SQL_SERVER",
AIRTABLE: "AIRTABLE",
ARANGODB: "ARANGODB",
ORACLE: "ORACLE",
INTERNAL: "INTERNAL",
2022-01-15 19:28:04 +01:00
GOOGLE_SHEETS: "GOOGLE_SHEETS",
2022-06-08 13:05:29 +02:00
FIRESTORE: "FIRESTORE",
2022-03-31 11:56:16 +02:00
REDIS: "REDIS",
2022-05-30 22:13:45 +02:00
SNOWFLAKE: "SNOWFLAKE",
2021-12-06 18:39:51 +01:00
}
export const IntegrationNames = {
[IntegrationTypes.POSTGRES]: "PostgreSQL",
[IntegrationTypes.MONGODB]: "MongoDB",
[IntegrationTypes.COUCHDB]: "CouchDB",
[IntegrationTypes.S3]: "S3",
[IntegrationTypes.MYSQL]: "MySQL",
[IntegrationTypes.REST]: "REST",
[IntegrationTypes.DYNAMODB]: "DynamoDB",
[IntegrationTypes.ELASTICSEARCH]: "ElasticSearch",
[IntegrationTypes.SQL_SERVER]: "SQL Server",
[IntegrationTypes.AIRTABLE]: "Airtable",
[IntegrationTypes.ARANGODB]: "ArangoDB",
[IntegrationTypes.ORACLE]: "Oracle",
[IntegrationTypes.INTERNAL]: "Internal",
2022-01-15 19:28:04 +01:00
[IntegrationTypes.GOOGLE_SHEETS]: "Google Sheets",
2022-06-08 13:05:29 +02:00
[IntegrationTypes.FIRESTORE]: "Firestore",
2022-03-31 11:56:16 +02:00
[IntegrationTypes.REDIS]: "Redis",
2022-05-30 22:13:45 +02:00
[IntegrationTypes.SNOWFLAKE]: "Snowflake",
2021-12-06 18:39:51 +01:00
}
export const SchemaTypeOptions = [
{ label: "Text", value: "string" },
{ label: "Number", value: "number" },
{ label: "Boolean", value: "boolean" },
{ label: "Datetime", value: "datetime" },
]
export const RawRestBodyTypes = {
NONE: "none",
FORM: "form",
ENCODED: "encoded",
JSON: "json",
TEXT: "text",
XML: "xml",
2021-12-06 18:39:51 +01:00
}
export const RestBodyTypes = [
{ name: "none", value: "none" },
{ name: "form-data", value: "form" },
{ name: "x-www-form-encoded", value: "encoded" },
{ name: "raw (JSON)", value: "json" },
{ name: "raw (XML)", value: "xml" },
2021-12-06 18:39:51 +01:00
{ name: "raw (Text)", value: "text" },
]
2021-12-17 12:37:50 +01:00
export const PaginationTypes = [
{ label: "Page number based", value: "page" },
{ label: "Cursor based", value: "cursor" },
]
export const PaginationLocations = [
{ label: "Query parameters", value: "query" },
{ label: "Request body", value: "body" },
]
export const BannedSearchTypes = [
"link",
"attachment",
"formula",
"json",
"jsonarray",
]
export const DatasourceTypes = {
RELATIONAL: "Relational",
NON_RELATIONAL: "Non-relational",
SPREADSHEET: "Spreadsheet",
OBJECT_STORE: "Object store",
GRAPH: "Graph",
API: "API",
}