2021-05-15 02:43:41 +12:00
|
|
|
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
2021-04-22 03:42:44 +12:00
|
|
|
const { UserStatus } = require("@budibase/auth").constants
|
2021-05-07 06:27:24 +12:00
|
|
|
const { ObjectStoreBuckets } = require("@budibase/auth").objectStore
|
2020-11-26 04:03:19 +13:00
|
|
|
|
2021-05-19 03:37:54 +12:00
|
|
|
exports.JobQueues = {
|
2021-05-19 08:03:26 +12:00
|
|
|
AUTOMATIONS: "automationQueue",
|
2021-05-19 03:37:54 +12:00
|
|
|
}
|
|
|
|
|
2021-10-07 05:38:32 +13:00
|
|
|
const FilterTypes = {
|
|
|
|
STRING: "string",
|
|
|
|
FUZZY: "fuzzy",
|
|
|
|
RANGE: "range",
|
|
|
|
EQUAL: "equal",
|
|
|
|
NOT_EQUAL: "notEqual",
|
|
|
|
EMPTY: "empty",
|
|
|
|
NOT_EMPTY: "notEmpty",
|
|
|
|
CONTAINS: "contains",
|
|
|
|
NOT_CONTAINS: "notContains",
|
|
|
|
ONE_OF: "oneOf",
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.FilterTypes = FilterTypes
|
|
|
|
exports.NoEmptyFilterStrings = [
|
|
|
|
FilterTypes.STRING,
|
|
|
|
FilterTypes.FUZZY,
|
|
|
|
FilterTypes.EQUAL,
|
|
|
|
FilterTypes.NOT_EQUAL,
|
|
|
|
FilterTypes.CONTAINS,
|
|
|
|
FilterTypes.NOT_CONTAINS,
|
|
|
|
]
|
|
|
|
|
2021-02-23 00:39:58 +13:00
|
|
|
exports.FieldTypes = {
|
|
|
|
STRING: "string",
|
|
|
|
LONGFORM: "longform",
|
|
|
|
OPTIONS: "options",
|
|
|
|
NUMBER: "number",
|
|
|
|
BOOLEAN: "boolean",
|
2021-08-20 03:54:44 +12:00
|
|
|
ARRAY: "array",
|
2021-02-23 00:39:58 +13:00
|
|
|
DATETIME: "datetime",
|
|
|
|
ATTACHMENT: "attachment",
|
|
|
|
LINK: "link",
|
2021-04-30 06:06:58 +12:00
|
|
|
FORMULA: "formula",
|
2021-02-23 00:39:58 +13:00
|
|
|
AUTO: "auto",
|
2021-06-25 05:16:48 +12:00
|
|
|
JSON: "json",
|
2021-10-18 09:23:30 +13:00
|
|
|
INTERNAL: "internal",
|
2021-02-23 00:39:58 +13:00
|
|
|
}
|
|
|
|
|
2021-02-26 01:21:24 +13:00
|
|
|
exports.RelationshipTypes = {
|
|
|
|
ONE_TO_MANY: "one-to-many",
|
2021-03-02 06:06:08 +13:00
|
|
|
MANY_TO_ONE: "many-to-one",
|
2021-02-26 01:23:47 +13:00
|
|
|
MANY_TO_MANY: "many-to-many",
|
2021-02-26 01:21:24 +13:00
|
|
|
}
|
|
|
|
|
2021-02-23 00:39:58 +13:00
|
|
|
exports.AuthTypes = {
|
2020-10-14 09:33:56 +13:00
|
|
|
APP: "app",
|
|
|
|
BUILDER: "builder",
|
|
|
|
EXTERNAL: "external",
|
|
|
|
}
|
|
|
|
|
2021-06-05 01:53:49 +12:00
|
|
|
exports.DataSourceOperation = {
|
|
|
|
CREATE: "CREATE",
|
|
|
|
READ: "READ",
|
|
|
|
UPDATE: "UPDATE",
|
|
|
|
DELETE: "DELETE",
|
2021-10-29 07:39:42 +13:00
|
|
|
CREATE_TABLE: "CREATE_TABLE",
|
|
|
|
UPDATE_TABLE: "UPDATE_TABLE",
|
|
|
|
DELETE_TABLE: "DELETE_TABLE",
|
2021-06-05 01:53:49 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.SortDirection = {
|
|
|
|
ASCENDING: "ASCENDING",
|
|
|
|
DESCENDING: "DESCENDING",
|
|
|
|
}
|
|
|
|
|
2021-02-23 00:39:58 +13:00
|
|
|
exports.USERS_TABLE_SCHEMA = {
|
2020-11-26 04:03:19 +13:00
|
|
|
_id: "ta_users",
|
|
|
|
type: "table",
|
|
|
|
views: {},
|
|
|
|
name: "Users",
|
2021-04-20 03:26:33 +12:00
|
|
|
// TODO: ADMIN PANEL - when implemented this doesn't need to be carried out
|
2020-11-26 04:03:19 +13:00
|
|
|
schema: {
|
2020-12-05 01:22:45 +13:00
|
|
|
email: {
|
2021-02-23 00:39:58 +13:00
|
|
|
type: exports.FieldTypes.STRING,
|
2020-11-26 04:03:19 +13:00
|
|
|
constraints: {
|
2021-02-23 00:39:58 +13:00
|
|
|
type: exports.FieldTypes.STRING,
|
2020-12-05 01:22:45 +13:00
|
|
|
email: true,
|
2020-11-26 04:03:19 +13:00
|
|
|
length: {
|
|
|
|
maximum: "",
|
|
|
|
},
|
|
|
|
presence: true,
|
|
|
|
},
|
2020-12-05 01:22:45 +13:00
|
|
|
fieldName: "email",
|
|
|
|
name: "email",
|
2020-11-26 04:03:19 +13:00
|
|
|
},
|
2021-05-19 22:06:57 +12:00
|
|
|
firstName: {
|
|
|
|
name: "firstName",
|
|
|
|
fieldName: "firstName",
|
|
|
|
type: exports.FieldTypes.STRING,
|
|
|
|
constraints: {
|
|
|
|
type: exports.FieldTypes.STRING,
|
|
|
|
presence: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
lastName: {
|
|
|
|
name: "lastName",
|
|
|
|
fieldName: "lastName",
|
|
|
|
type: exports.FieldTypes.STRING,
|
|
|
|
constraints: {
|
|
|
|
type: exports.FieldTypes.STRING,
|
|
|
|
presence: false,
|
|
|
|
},
|
|
|
|
},
|
2020-12-03 02:20:56 +13:00
|
|
|
roleId: {
|
|
|
|
fieldName: "roleId",
|
|
|
|
name: "roleId",
|
2021-02-23 00:39:58 +13:00
|
|
|
type: exports.FieldTypes.OPTIONS,
|
2020-11-26 04:03:19 +13:00
|
|
|
constraints: {
|
2021-02-23 00:39:58 +13:00
|
|
|
type: exports.FieldTypes.STRING,
|
2020-11-26 04:03:19 +13:00
|
|
|
presence: false,
|
2020-12-09 01:20:37 +13:00
|
|
|
inclusion: Object.values(BUILTIN_ROLE_IDS),
|
2020-11-26 04:03:19 +13:00
|
|
|
},
|
|
|
|
},
|
2021-02-23 01:29:49 +13:00
|
|
|
status: {
|
|
|
|
fieldName: "status",
|
|
|
|
name: "status",
|
|
|
|
type: exports.FieldTypes.OPTIONS,
|
2021-02-23 00:39:58 +13:00
|
|
|
constraints: {
|
2021-02-23 01:29:49 +13:00
|
|
|
type: exports.FieldTypes.STRING,
|
2021-02-23 00:39:58 +13:00
|
|
|
presence: false,
|
2021-04-09 03:58:33 +12:00
|
|
|
inclusion: Object.values(UserStatus),
|
2021-02-23 00:39:58 +13:00
|
|
|
},
|
|
|
|
},
|
2020-11-26 04:03:19 +13:00
|
|
|
},
|
2020-12-05 01:22:45 +13:00
|
|
|
primaryDisplay: "email",
|
2020-11-26 04:03:19 +13:00
|
|
|
}
|
|
|
|
|
2021-02-16 06:47:14 +13:00
|
|
|
exports.AutoFieldSubTypes = {
|
|
|
|
CREATED_BY: "createdBy",
|
|
|
|
CREATED_AT: "createdAt",
|
|
|
|
UPDATED_BY: "updatedBy",
|
|
|
|
UPDATED_AT: "updatedAt",
|
|
|
|
AUTO_ID: "autoID",
|
|
|
|
}
|
|
|
|
|
2021-05-25 09:39:13 +12:00
|
|
|
exports.OBJ_STORE_DIRECTORY = "/prod-budi-app-assets"
|
2021-02-06 05:45:23 +13:00
|
|
|
exports.BaseQueryVerbs = {
|
|
|
|
CREATE: "create",
|
|
|
|
READ: "read",
|
|
|
|
UPDATE: "update",
|
|
|
|
DELETE: "delete",
|
|
|
|
}
|
2021-03-20 08:07:47 +13:00
|
|
|
|
2021-09-09 06:29:28 +12:00
|
|
|
exports.MetadataTypes = {
|
|
|
|
AUTOMATION_TEST_INPUT: "automationTestInput",
|
|
|
|
AUTOMATION_TEST_HISTORY: "automationTestHistory",
|
|
|
|
}
|
|
|
|
|
2021-10-27 08:03:54 +13:00
|
|
|
exports.BuildSchemaErrors = {
|
|
|
|
NO_KEY: "no_key",
|
|
|
|
}
|
|
|
|
|
2021-05-07 06:27:24 +12:00
|
|
|
// pass through the list from the auth/core lib
|
|
|
|
exports.ObjectStoreBuckets = ObjectStoreBuckets
|