Merge branch 'INDA-330-pii-update' into 'main'
[ProtonMail-WebClient.git] / packages / sieve / fixtures / v2.ts
blobf0a7d0b1f676262bfe1face07cba557d0e11a9f7
1 import type { SimpleObject } from '@proton/components/containers/filters/interfaces';
2 import { ConditionComparator, ConditionType, FilterStatement } from '@proton/components/containers/filters/interfaces';
4 const tree = [
5     {
6         List: ['include', 'environment', 'variables', 'relational', 'comparator-i;ascii-numeric', 'spamtest'],
7         Type: 'Require',
8     },
9     {
10         List: ['fileinto', 'imap4flags'],
11         Type: 'Require',
12     },
13     {
14         Text: '# Generated: Do not run this script on spam messages',
15         Type: 'Comment',
16     },
17     {
18         If: {
19             Tests: [
20                 {
21                     Name: 'vnd.proton.spam-threshold',
22                     Keys: ['*'],
23                     Format: null,
24                     Match: {
25                         Type: 'Matches',
26                     },
27                     Type: 'Environment',
28                 },
29                 {
30                     Value: {
31                         Value: '${1}',
32                         Type: 'VariableString',
33                     },
34                     Flags: [],
35                     Format: {
36                         Type: 'ASCIINumeric',
37                     },
38                     Match: {
39                         Comparator: 'ge',
40                         Type: 'GreaterEqualsValue',
41                     },
42                     Type: 'SpamTest',
43                 },
44             ],
45             Type: 'AllOf',
46         },
47         Then: [
48             {
49                 Type: 'Return',
50             },
51         ],
52         Type: 'If',
53     },
54     {
55         Text: '/**\r\n * @type and\r\n * @comparator contains\r\n */',
56         Type: 'Comment',
57     },
58     {
59         If: {
60             Tests: [
61                 {
62                     Headers: ['Subject'],
63                     Keys: ['Order'],
64                     Match: {
65                         Type: 'Contains',
66                     },
67                     Format: {
68                         Type: 'UnicodeCaseMap',
69                     },
70                     Type: 'Header',
71                 },
72             ],
73             Type: 'AllOf',
74         },
75         Then: [
76             {
77                 Type: 'FileInto',
78                 Name: 'important',
79             },
80             {
81                 Type: 'FileInto',
82                 Name: 'Folder',
83             },
84             {
85                 Type: 'AddFlag',
86                 Flags: ['\\Seen'],
87             },
88             {
89                 Type: 'Keep',
90             },
91         ],
92         Type: 'If',
93     },
96 const simple: SimpleObject = {
97     Operator: {
98         label: 'All',
99         value: FilterStatement.ALL,
100     },
101     Conditions: [
102         {
103             Values: ['Order'],
104             Type: {
105                 label: 'Subject',
106                 value: ConditionType.SUBJECT,
107             },
108             Comparator: {
109                 label: 'contains',
110                 value: ConditionComparator.CONTAINS,
111             },
112         },
113     ],
114     Actions: {
115         FileInto: ['important', 'Folder'],
116         Mark: {
117             Read: true,
118             Starred: false,
119         },
120     },
123 export default { tree, simple };