tianji/src/server/utils/const.ts

123 lines
2.2 KiB
TypeScript
Raw Normal View History

2023-09-26 06:45:28 +00:00
export enum SYSTEM_ROLES {
admin = 'admin',
user = 'user',
}
2023-09-02 19:49:20 +00:00
2023-09-26 06:45:28 +00:00
export enum ROLES {
owner = 'owner',
readOnly = 'readOnly',
}
2023-09-03 11:28:53 +00:00
export const HOSTNAME_REGEX =
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/;
export const COLLECTION_TYPE = {
event: 'event',
identify: 'identify',
};
export const DESKTOP_OS = [
'BeOS',
'Chrome OS',
'Linux',
'Mac OS',
'Open BSD',
'OS/2',
'QNX',
'Sun OS',
'Windows 10',
'Windows 2000',
'Windows 3.11',
'Windows 7',
'Windows 8',
'Windows 8.1',
'Windows 95',
'Windows 98',
'Windows ME',
'Windows Server 2003',
'Windows Vista',
'Windows XP',
];
export const MOBILE_OS = [
'Amazon OS',
'Android OS',
'BlackBerry OS',
'iOS',
'Windows Mobile',
];
export const DESKTOP_SCREEN_WIDTH = 1920;
export const LAPTOP_SCREEN_WIDTH = 1024;
export const MOBILE_SCREEN_WIDTH = 479;
export const URL_LENGTH = 500;
export const EVENT_NAME_LENGTH = 50;
export const EVENT_TYPE = {
pageView: 1,
customEvent: 2,
} as const;
export const DATA_TYPE = {
string: 1,
number: 2,
boolean: 3,
date: 4,
array: 5,
} as const;
2023-09-12 15:04:39 +00:00
2023-10-06 14:08:15 +00:00
export const EVENT_COLUMNS = ['url', 'referrer', 'title', 'query', 'event'];
2023-09-12 15:04:39 +00:00
export const SESSION_COLUMNS = [
'browser',
'os',
'device',
'screen',
'language',
'country',
'region',
'city',
];
export const OPERATORS = {
equals: 'eq',
notEquals: 'neq',
set: 's',
notSet: 'ns',
contains: 'c',
doesNotContain: 'dnc',
true: 't',
false: 'f',
greaterThan: 'gt',
lessThan: 'lt',
greaterThanEquals: 'gte',
lessThanEquals: 'lte',
before: 'bf',
after: 'af',
} as const;
export const FILTER_COLUMNS = {
2023-09-16 07:50:36 +00:00
url: 'urlPath',
referrer: 'referrerDomain',
title: 'pageTitle',
query: 'urlQuery',
2023-09-12 15:04:39 +00:00
os: 'os',
browser: 'browser',
device: 'device',
country: 'country',
region: 'subdivision1',
city: 'city',
language: 'language',
2023-09-16 07:50:36 +00:00
event: 'eventName',
2023-09-12 15:04:39 +00:00
};
export const DEFAULT_RESET_DATE = '2000-01-01';
2023-10-21 16:26:13 +00:00
export enum OPENAPI_TAG {
USER = 'User',
}
export const hostnameRegex =
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/gim;