/
constants.ts
121 lines (108 loc) · 2.43 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/* eslint-disable @typescript-eslint/camelcase */
export const ATTRIBUTE_NAME_PATTERN = '^[a-zA-Z][a-zA-Z0-9_]*$';
export const attributeNameRegex = new RegExp(ATTRIBUTE_NAME_PATTERN);
export const ENUM_VALUE_PATTERN = '^[_a-zA-Z][_a-zA-Z0-9]*$';
export const enumValueRegex = new RegExp(ENUM_VALUE_PATTERN);
export const STATE_NAME_PATTERN = '^[a-zA-Z][_a-zA-Z0-9]*$';
export const stateNameRegex = new RegExp(STATE_NAME_PATTERN);
export const LANGUAGE_ISO_CODE_PATTERN = '^[a-z]+$';
export const languageIsoCodeRegex = new RegExp(LANGUAGE_ISO_CODE_PATTERN);
export const storageDataTypeCapabilityType = {
VALUE: 1,
LIST: 2,
};
const sdtcVALUE = storageDataTypeCapabilityType.VALUE;
const sdtcLIST = storageDataTypeCapabilityType.LIST;
export const storageDataTypeCapabilities = {
in: sdtcLIST,
lt: sdtcVALUE,
lte: sdtcVALUE,
gt: sdtcVALUE,
gte: sdtcVALUE,
contains: sdtcVALUE,
starts_with: sdtcVALUE,
ends_with: sdtcVALUE,
ne: sdtcVALUE,
not_in: sdtcLIST,
not_contains: sdtcVALUE,
not_starts_with: sdtcVALUE,
not_ends_with: sdtcVALUE,
};
export const entityPropertiesWhitelist: Array<string> = [
'name',
'description',
'attributes',
'attributesGenerator',
'storageType',
'isUserEntity',
'includeTimeTracking',
'includeUserTracking',
'indexes',
'mutations',
'subscriptions',
'permissions',
'states',
'preProcessor',
'postProcessor',
'preFilters',
'preFiltersGenerator',
'meta',
];
export const attributePropertiesWhitelist: Array<string> = [
'name',
'description',
'type',
'required',
'primary',
'unique',
'index',
'resolve',
'defaultValue',
'serialize',
'validate',
'hidden',
'i18n',
'mock',
'mutationInput',
'meta',
];
export const viewEntityPropertiesWhitelist: Array<string> = [
'name',
'description',
'attributes',
'attributesGenerator',
'storageType',
'viewExpression',
'permissions',
'preProcessor',
'postProcessor',
'preFilters',
'preFiltersGenerator',
'meta',
];
export const viewAttributePropertiesWhitelist: Array<string> = [
'name',
'description',
'type',
'required',
'primary',
'resolve',
'mock',
'meta',
];
export const shadowEntityPropertiesWhitelist: Array<string> = [
'name',
'attributes',
'attributesGenerator',
'storageType',
'isUserEntity',
'meta',
];
export const shadowEntityAttributePropertiesWhitelist: Array<string> = [
'name',
'description',
'type',
'required',
'primary',
'meta',
];