Merge branch 'INDA-330-pii-update' into 'main'
[ProtonMail-WebClient.git] / packages / sieve / fixtures / archive.ts
blobfa0ffea777b97db982f88fdf8c4eb9bca369d118
1 /*
2  * Sieve/Tree test inputs
3  */
4 import type { SimpleObject } from '@proton/components/containers/filters/interfaces';
5 import { ConditionComparator, ConditionType, FilterStatement } from '@proton/components/containers/filters/interfaces';
7 const tree = [
8     {
9         List: ['fileinto', 'imap4flags'],
10         Type: 'Require',
11     },
12     {
13         If: {
14             Tests: [
15                 {
16                     Test: {
17                         Headers: ['Subject'],
18                         Keys: ['Subject1'],
19                         Match: {
20                             Type: 'Contains',
21                         },
22                         Format: {
23                             Type: 'UnicodeCaseMap',
24                         },
25                         Type: 'Header',
26                     },
27                     Type: 'Not',
28                 },
29                 {
30                     Headers: ['To', 'Cc', 'Bcc'],
31                     Keys: ['Recipient1'],
32                     Match: {
33                         Type: 'Is',
34                     },
35                     Format: {
36                         Type: 'UnicodeCaseMap',
37                     },
38                     Type: 'Address',
39                     AddressPart: {
40                         Type: 'All',
41                     },
42                 },
43                 {
44                     Test: {
45                         Headers: ['To', 'Cc', 'Bcc'],
46                         Keys: ['Recipient2'],
47                         Match: {
48                             Type: 'Matches',
49                         },
50                         Format: {
51                             Type: 'UnicodeCaseMap',
52                         },
53                         Type: 'Address',
54                         AddressPart: {
55                             Type: 'All',
56                         },
57                     },
58                     Type: 'Not',
59                 },
60                 {
61                     Headers: ['From'],
62                     Keys: ['Sender1*'],
63                     Match: {
64                         Type: 'Matches',
65                     },
66                     Format: {
67                         Type: 'UnicodeCaseMap',
68                     },
69                     Type: 'Address',
70                     AddressPart: {
71                         Type: 'All',
72                     },
73                 },
74                 {
75                     Test: {
76                         Headers: ['From'],
77                         Keys: ['*Sender2'],
78                         Match: {
79                             Type: 'Matches',
80                         },
81                         Format: {
82                             Type: 'UnicodeCaseMap',
83                         },
84                         Type: 'Address',
85                         AddressPart: {
86                             Type: 'All',
87                         },
88                     },
89                     Type: 'Not',
90                 },
91                 {
92                     Test: {
93                         Headers: ['X-Attached'],
94                         Type: 'Exists',
95                     },
96                     Type: 'Not',
97                 },
98             ],
99             Type: 'AllOf',
100         },
101         Then: [
102             {
103                 Name: 'panda qwe qwe qwe qweqwe qw e',
104                 Type: 'FileInto',
105             },
106             {
107                 Name: 'panda3',
108                 Type: 'FileInto',
109             },
110             {
111                 Name: 'cool',
112                 Type: 'FileInto',
113             },
114             {
115                 Name: 'panda2',
116                 Type: 'FileInto',
117             },
118             {
119                 Name: 'test',
120                 Type: 'FileInto',
121             },
122             {
123                 Name: 'very long label wowowowowowowowowowowowoowowowwo',
124                 Type: 'FileInto',
125             },
126             {
127                 Name: 'wqeqweqweqweqweqweqweqweqweqweqweqweqweqweqwe',
128                 Type: 'FileInto',
129             },
130             {
131                 Name: 'archive',
132                 Type: 'FileInto',
133             },
134             {
135                 Flags: ['\\Seen'],
136                 Type: 'AddFlag',
137             },
138             {
139                 Type: 'Keep',
140             },
141         ],
142         Type: 'If',
143     },
146 const simple: SimpleObject = {
147     Operator: {
148         label: 'All',
149         value: FilterStatement.ALL,
150     },
151     Conditions: [
152         {
153             Type: {
154                 label: 'Subject',
155                 value: ConditionType.SUBJECT,
156             },
157             Comparator: {
158                 label: 'does not contain',
159                 value: ConditionComparator.DOES_NOT_CONTAIN,
160             },
161             Values: ['Subject1'],
162         },
163         {
164             Type: {
165                 label: 'Recipient',
166                 value: ConditionType.RECIPIENT,
167             },
168             Comparator: {
169                 label: 'is exactly',
170                 value: ConditionComparator.IS,
171             },
172             Values: ['Recipient1'],
173         },
174         {
175             Type: {
176                 label: 'Recipient',
177                 value: ConditionType.RECIPIENT,
178             },
179             Comparator: {
180                 label: 'does not match',
181                 value: ConditionComparator.DOES_NOT_MATCH,
182             },
183             Values: ['Recipient2'],
184         },
185         {
186             Type: {
187                 label: 'Sender',
188                 value: ConditionType.SENDER,
189             },
190             Comparator: {
191                 label: 'Matches',
192                 value: ConditionComparator.STARTS,
193             },
194             Values: ['Sender1'],
195         },
196         {
197             Type: {
198                 label: 'Sender',
199                 value: ConditionType.SENDER,
200             },
201             Comparator: {
202                 label: 'does not end with',
203                 value: ConditionComparator.DOES_NOT_END,
204             },
205             Values: ['Sender2'],
206         },
207         {
208             Type: {
209                 label: 'Attachments',
210                 value: ConditionType.ATTACHMENTS,
211             },
212             Comparator: {
213                 label: 'does not contain',
214                 value: ConditionComparator.DOES_NOT_CONTAIN,
215             },
216             Values: [],
217         },
218     ],
219     Actions: {
220         FileInto: [
221             'panda qwe qwe qwe qweqwe qw e',
222             'panda3',
223             'cool',
224             'panda2',
225             'test',
226             'very long label wowowowowowowowowowowowoowowowwo',
227             'wqeqweqweqweqweqweqweqweqweqweqweqweqweqweqwe',
228             'archive',
229         ],
230         Mark: {
231             Read: true,
232             Starred: false,
233         },
234     },
237 export default { tree, simple };