1
5
6export const WORKSPACE_ROLES = ["OWNER", "ADMIN", "MEMBER", "GUEST"] as const;
7export type WorkspaceRole = (typeof WORKSPACE_ROLES)[number];
8
9
10export const WORKSPACE_TYPES = ["team", "project", "kb", "custom"] as const;
11export type WorkspaceType = (typeof WORKSPACE_TYPES)[number];
12
13export const PERMISSION_LEVELS = ["NONE", "VIEW", "COMMENT", "EDIT", "FULL_ACCESS"] as const;
14export type PermissionLevel = (typeof PERMISSION_LEVELS)[number];
15
16
17export const BLOCK_TYPES = [
18 "PARAGRAPH", "HEADING_1", "HEADING_2", "HEADING_3", "QUOTE", "CALLOUT",
19 "BULLETED_LIST", "NUMBERED_LIST", "TODO", "TOGGLE", "IMAGE", "VIDEO",
20 "AUDIO", "FILE", "BOOKMARK", "EMBED", "CODE", "EQUATION", "COLUMN",
21 "COLUMN_LIST", "DIVIDER", "SPACER", "DATABASE", "LINKED_DATABASE", "TABLE",
22 "CHART", "FORM", "SYNCED_BLOCK", "CHILD_PAGE", "CHILD_DATABASE", "TOC"
23] as const;
24export type BlockType = (typeof BLOCK_TYPES)[number];
25
26
27export const PROPERTY_TYPES = [
28 "TITLE", "TEXT", "RICH_TEXT", "NUMBER", "SELECT", "MULTI_SELECT", "STATUS",
29 "DATE", "DATE_RANGE", "PERSON", "EMAIL", "PHONE", "URL", "CHECKBOX", "FILES",
30 "CREATED_TIME", "CREATED_BY", "LAST_EDITED_TIME", "LAST_EDITED_BY", "RELATION",
31 "ROLLUP", "FORMULA", "BUTTON", "UNIQUE_ID"
32] as const;
33export type PropertyType = (typeof PROPERTY_TYPES)[number];
34
35export const VIEW_TYPES = [
36 "TABLE", "LIST", "BOARD", "GALLERY", "CALENDAR", "TIMELINE", "CHART", "DASHBOARD", "FORM"
37] as const;
38export type ViewType = (typeof VIEW_TYPES)[number];
39
40export const RELATION_CARDINALITIES = ["ONE_TO_ONE", "ONE_TO_MANY", "MANY_TO_MANY"] as const;
41export type RelationCardinality = (typeof RELATION_CARDINALITIES)[number];
42
43export const ROLLUP_AGGREGATES = ["COUNT", "SUM", "AVERAGE", "MIN", "MAX", "PERCENT", "UNIQUE"] as const;
44export type RollupAggregate = (typeof ROLLUP_AGGREGATES)[number];
45
46export const AUTOMATION_TRIGGER_TYPES = [
47 "RECORD_CREATED", "RECORD_UPDATED", "PROPERTY_CHANGED", "PAGE_CREATED",
48 "FORM_SUBMITTED", "SCHEDULE", "WEBHOOK", "MANUAL"
49] as const;
50export type AutomationTriggerType = (typeof AUTOMATION_TRIGGER_TYPES)[number];
51
52export const AUTOMATION_ACTION_TYPES = [
53 "UPDATE_RECORD", "CREATE_PAGE", "SEND_EMAIL", "SEND_WEBHOOK",
54 "CREATE_NOTIFICATION", "ASSIGN_USER", "CHANGE_STATUS", "CALL_INTEGRATION", "RUN_AI_ACTION"
55] as const;
56export type AutomationActionType = (typeof AUTOMATION_ACTION_TYPES)[number];
57
58export const AUTOMATION_STATUSES = ["DRAFT", "ACTIVE", "PAUSED", "ARCHIVED"] as const;
59export type AutomationStatus = (typeof AUTOMATION_STATUSES)[number];
60
61export const FORM_QUESTION_TYPES = [
62 "SHORT_TEXT", "LONG_TEXT", "NUMBER", "EMAIL", "DATE", "CHECKBOX",
63 "SINGLE_SELECT", "MULTI_SELECT", "RATING", "FILE"
64] as const;
65export type FormQuestionType = (typeof FORM_QUESTION_TYPES)[number];
66
67export const FORM_STATUSES = ["DRAFT", "PUBLISHED", "CLOSED"] as const;
68export type FormStatus = (typeof FORM_STATUSES)[number];
69
70export const API_KEY_SCOPES = ["READ", "WRITE", "ADMIN"] as const;
71export type ApiKeyScope = (typeof API_KEY_SCOPES)[number];
72
73export const SHARE_SCOPES = ["PRIVATE", "WORKSPACE", "TEAM", "USERS", "PUBLIC"] as const;
74export type ShareScope = (typeof SHARE_SCOPES)[number];
75
76export const FILE_STATUSES = ["UPLOADING", "SCANNING", "READY", "VIRUS_DETECTED", "FAILED"] as const;
77export type FileStatus = (typeof FILE_STATUSES)[number];
78
79
90export const FILTER_OPS = [
91 "eq", "neq", "contains", "ncontains", "startsWith", "endsWith",
92 "isEmpty", "isNotEmpty",
93 "gt", "gte", "lt", "lte", "before", "after", "between",
94 "isThisWeek", "isThisMonth", "withinNextDays", "isPast", "isFuture",
95 "contains_any", "contains_all", "isCurrentUser"
96] as const;
97export type FilterOp = (typeof FILTER_OPS)[number];
98
99export const APP_VERSION = "0.1.0";
100export const API_PREFIX = "api/v1";
101export const REFRESH_COOKIE = "factory_refresh";
102export const EVENTS_STREAM = "factory:events";
103export const EVENTS_STREAM_MAXLEN = 10000;
104export const MAX_FILE_SIZE_DEFAULT = 50 * 1024 * 1024;
105export const MAX_BLOCK_BATCH = 200;
106export const MAX_BULK_RECORDS = 500;
107export const MAX_EXPORT_ROWS = 50_000;
108export const MAX_BLOCK_TREE = 5000;
109
110
111
112
113export const MAX_CSV_IMPORT_ROWS = 10_000;
114export const MAX_CSV_IMPORT_BODY_BYTES = 2 * 1024 * 1024;
115
116
117
118
119export const MAX_WHITEBOARD_BODY_BYTES = 2 * 1024 * 1024;
120
121
122export const DEFAULT_DB_PROPERTIES = [
123 { name: "Title", type: "TITLE", isTitle: true },
124 {
125 name: "Status",
126 type: "SELECT",
127 config: {
128 options: [
129 { name: "To Do", color: "gray" },
130 { name: "In Progress", color: "blue" },
131 { name: "Done", color: "green" }
132 ]
133 }
134 }
135] as const;
136
137
138export const EVENTS = {
139 PAGE_CREATED: "page.created",
140 PAGE_UPDATED: "page.updated",
141 PAGE_DELETED: "page.deleted",
142 PAGE_SHARED: "page.shared",
143 DATABASE_CREATED: "database.created",
144 DATABASE_UPDATED: "database.updated",
145 RECORD_CREATED: "record.created",
146 RECORD_UPDATED: "record.updated",
147 COMMENT_CREATED: "comment.created",
148
149
150
151
152
153
154 COMMENT_RESOLVED: "comment.resolved",
155 COMMENT_REOPENED: "comment.reopened",
156 COMMENT_REACTION: "comment.reaction",
157 COMMENT_DELETED: "comment.deleted",
158
159
160 NOTIFICATION_CREATED: "notification.created",
161 FORM_SUBMITTED: "form.submitted",
162 AUTOMATION_EXECUTED: "automation.executed",
163 AUTOMATION_MANUAL: "automation.manual",
164 FILE_UPLOADED: "file.uploaded",
165 API_KEY_CREATED: "api_key.created",
166 USER_LOGIN: "user.login",
167 USER_LOGOUT: "user.logout",
168 USER_REGISTER: "user.register",
169 PERMISSION_CHANGED: "permission.changed",
170 WORKSPACE_CREATED: "workspace.created"
171} as const;
172export type EventName = (typeof EVENTS)[keyof typeof EVENTS];
173