@marcoappio/marco-config 11.0.13 → 11.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +2 -0
- package/dist/constants/rules.d.ts +8 -0
- package/dist/constants/rules.d.ts.map +1 -0
- package/dist/constants/rules.js +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/schemas/id.d.ts +5 -0
- package/dist/schemas/id.d.ts.map +1 -1
- package/dist/schemas/id.js +1 -0
- package/dist/schemas/index.d.ts +442 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +4 -1
- package/dist/schemas/models/index.d.ts +1 -0
- package/dist/schemas/models/index.d.ts.map +1 -1
- package/dist/schemas/models/index.js +1 -0
- package/dist/schemas/models/rule.d.ts +300 -0
- package/dist/schemas/models/rule.d.ts.map +1 -0
- package/dist/schemas/models/rule.js +79 -0
- package/dist/schemas/mutators/mutatorSchemas.d.ts +265 -0
- package/dist/schemas/mutators/mutatorSchemas.d.ts.map +1 -1
- package/dist/schemas/mutators/mutatorSchemas.js +24 -0
- package/dist/sdk/endpoints/private/models/account/getRules.d.ts +155 -0
- package/dist/sdk/endpoints/private/models/account/getRules.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/account/getRules.js +17 -0
- package/dist/sdk/endpoints/private/models/account/index.d.ts +1 -0
- package/dist/sdk/endpoints/private/models/account/index.d.ts.map +1 -1
- package/dist/sdk/endpoints/private/models/account/index.js +1 -0
- package/dist/sdk/endpoints/private/mutations/account/createRule.d.ts +170 -0
- package/dist/sdk/endpoints/private/mutations/account/createRule.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/createRule.js +20 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteRule.d.ts +48 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteRule.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteRule.js +20 -0
- package/dist/sdk/endpoints/private/mutations/account/index.d.ts +5 -0
- package/dist/sdk/endpoints/private/mutations/account/index.d.ts.map +1 -1
- package/dist/sdk/endpoints/private/mutations/account/index.js +5 -0
- package/dist/sdk/endpoints/private/mutations/account/reorderRules.d.ts +48 -0
- package/dist/sdk/endpoints/private/mutations/account/reorderRules.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/reorderRules.js +20 -0
- package/dist/sdk/endpoints/private/mutations/account/setRuleEnabled.d.ts +54 -0
- package/dist/sdk/endpoints/private/mutations/account/setRuleEnabled.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/setRuleEnabled.js +21 -0
- package/dist/sdk/endpoints/private/mutations/account/updateRule.d.ts +175 -0
- package/dist/sdk/endpoints/private/mutations/account/updateRule.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/updateRule.js +21 -0
- package/dist/sdk/index.d.ts +6 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/validation/errors.d.ts +12 -0
- package/dist/sdk/validation/errors.d.ts.map +1 -1
- package/dist/sdk/validation/errors.js +5 -0
- package/dist/sdk/validation/index.d.ts +6 -0
- package/dist/sdk/validation/index.d.ts.map +1 -1
- package/dist/types/RuleActionType.d.ts +3 -0
- package/dist/types/RuleActionType.d.ts.map +1 -0
- package/dist/types/RuleActionType.js +10 -0
- package/dist/types/RuleConditionField.d.ts +3 -0
- package/dist/types/RuleConditionField.d.ts.map +1 -0
- package/dist/types/RuleConditionField.js +1 -0
- package/dist/types/RuleConditionOperator.d.ts +5 -0
- package/dist/types/RuleConditionOperator.d.ts.map +1 -0
- package/dist/types/RuleConditionOperator.js +2 -0
- package/dist/types/RuleDisabledReason.d.ts +3 -0
- package/dist/types/RuleDisabledReason.d.ts.map +1 -0
- package/dist/types/RuleDisabledReason.js +1 -0
- package/dist/types/RuleMatchMode.d.ts +3 -0
- package/dist/types/RuleMatchMode.d.ts.map +1 -0
- package/dist/types/RuleMatchMode.js +1 -0
- package/dist/types/SDKError.d.ts +1 -1
- package/dist/types/SDKError.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +5 -0
- package/dist/utils/labels/getInboxUnreadTotal/getInboxUnreadTotal.d.ts +8 -0
- package/dist/utils/labels/getInboxUnreadTotal/getInboxUnreadTotal.d.ts.map +1 -0
- package/dist/utils/labels/getInboxUnreadTotal/getInboxUnreadTotal.js +1 -0
- package/dist/utils/labels/getInboxUnreadTotal/index.d.ts +2 -0
- package/dist/utils/labels/getInboxUnreadTotal/index.d.ts.map +1 -0
- package/dist/utils/labels/getInboxUnreadTotal/index.js +1 -0
- package/dist/utils/labels/index.d.ts +5 -0
- package/dist/utils/labels/index.d.ts.map +1 -1
- package/dist/utils/labels/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const ruleConditionSchema: v.VariantSchema<"field", [v.ObjectSchema<{
|
|
3
|
+
readonly field: v.LiteralSchema<"FROM", undefined>;
|
|
4
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS", "DOMAIN_IS"], undefined>;
|
|
5
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
6
|
+
}, undefined>, v.ObjectSchema<{
|
|
7
|
+
readonly field: v.LiteralSchema<"TO_OR_CC", undefined>;
|
|
8
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS", "DOMAIN_IS"], undefined>;
|
|
9
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
10
|
+
}, undefined>, v.ObjectSchema<{
|
|
11
|
+
readonly field: v.LiteralSchema<"SUBJECT", undefined>;
|
|
12
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS"], undefined>;
|
|
13
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
14
|
+
}, undefined>, v.ObjectSchema<{
|
|
15
|
+
readonly field: v.LiteralSchema<"BODY", undefined>;
|
|
16
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
17
|
+
}, undefined>, v.ObjectSchema<{
|
|
18
|
+
readonly field: v.LiteralSchema<"HAS_ATTACHMENT", undefined>;
|
|
19
|
+
readonly value: v.BooleanSchema<undefined>;
|
|
20
|
+
}, undefined>, v.ObjectSchema<{
|
|
21
|
+
readonly field: v.LiteralSchema<"MAILING_LIST", undefined>;
|
|
22
|
+
readonly listId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
23
|
+
}, undefined>], undefined>;
|
|
24
|
+
export declare const ruleActionSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
25
|
+
readonly type: v.LiteralSchema<"ARCHIVE", undefined>;
|
|
26
|
+
}, undefined>, v.ObjectSchema<{
|
|
27
|
+
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "LabelId">]>, undefined>;
|
|
28
|
+
readonly type: v.LiteralSchema<"MOVE_TO_FOLDER", undefined>;
|
|
29
|
+
}, undefined>, v.ObjectSchema<{
|
|
30
|
+
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "LabelId">]>, undefined>;
|
|
31
|
+
readonly type: v.LiteralSchema<"ADD_LABEL", undefined>;
|
|
32
|
+
}, undefined>, v.ObjectSchema<{
|
|
33
|
+
readonly type: v.LiteralSchema<"MARK_READ", undefined>;
|
|
34
|
+
}, undefined>, v.ObjectSchema<{
|
|
35
|
+
readonly type: v.LiteralSchema<"STAR", undefined>;
|
|
36
|
+
}, undefined>, v.ObjectSchema<{
|
|
37
|
+
readonly type: v.LiteralSchema<"TRASH", undefined>;
|
|
38
|
+
}, undefined>, v.ObjectSchema<{
|
|
39
|
+
readonly type: v.LiteralSchema<"MARK_SPAM", undefined>;
|
|
40
|
+
}, undefined>, v.ObjectSchema<{
|
|
41
|
+
readonly type: v.LiteralSchema<"MUTE_NOTIFICATION", undefined>;
|
|
42
|
+
}, undefined>], undefined>;
|
|
43
|
+
export declare const ruleDefinitionSchema: v.ObjectSchema<{
|
|
44
|
+
readonly actions: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
45
|
+
readonly type: v.LiteralSchema<"ARCHIVE", undefined>;
|
|
46
|
+
}, undefined>, v.ObjectSchema<{
|
|
47
|
+
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "LabelId">]>, undefined>;
|
|
48
|
+
readonly type: v.LiteralSchema<"MOVE_TO_FOLDER", undefined>;
|
|
49
|
+
}, undefined>, v.ObjectSchema<{
|
|
50
|
+
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "LabelId">]>, undefined>;
|
|
51
|
+
readonly type: v.LiteralSchema<"ADD_LABEL", undefined>;
|
|
52
|
+
}, undefined>, v.ObjectSchema<{
|
|
53
|
+
readonly type: v.LiteralSchema<"MARK_READ", undefined>;
|
|
54
|
+
}, undefined>, v.ObjectSchema<{
|
|
55
|
+
readonly type: v.LiteralSchema<"STAR", undefined>;
|
|
56
|
+
}, undefined>, v.ObjectSchema<{
|
|
57
|
+
readonly type: v.LiteralSchema<"TRASH", undefined>;
|
|
58
|
+
}, undefined>, v.ObjectSchema<{
|
|
59
|
+
readonly type: v.LiteralSchema<"MARK_SPAM", undefined>;
|
|
60
|
+
}, undefined>, v.ObjectSchema<{
|
|
61
|
+
readonly type: v.LiteralSchema<"MUTE_NOTIFICATION", undefined>;
|
|
62
|
+
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
63
|
+
type: "ARCHIVE";
|
|
64
|
+
} | {
|
|
65
|
+
labelId: string & v.Brand<"LabelId">;
|
|
66
|
+
type: "MOVE_TO_FOLDER";
|
|
67
|
+
} | {
|
|
68
|
+
labelId: string & v.Brand<"LabelId">;
|
|
69
|
+
type: "ADD_LABEL";
|
|
70
|
+
} | {
|
|
71
|
+
type: "MARK_READ";
|
|
72
|
+
} | {
|
|
73
|
+
type: "STAR";
|
|
74
|
+
} | {
|
|
75
|
+
type: "TRASH";
|
|
76
|
+
} | {
|
|
77
|
+
type: "MARK_SPAM";
|
|
78
|
+
} | {
|
|
79
|
+
type: "MUTE_NOTIFICATION";
|
|
80
|
+
})[], 1, undefined>, v.MaxLengthAction<({
|
|
81
|
+
type: "ARCHIVE";
|
|
82
|
+
} | {
|
|
83
|
+
labelId: string & v.Brand<"LabelId">;
|
|
84
|
+
type: "MOVE_TO_FOLDER";
|
|
85
|
+
} | {
|
|
86
|
+
labelId: string & v.Brand<"LabelId">;
|
|
87
|
+
type: "ADD_LABEL";
|
|
88
|
+
} | {
|
|
89
|
+
type: "MARK_READ";
|
|
90
|
+
} | {
|
|
91
|
+
type: "STAR";
|
|
92
|
+
} | {
|
|
93
|
+
type: "TRASH";
|
|
94
|
+
} | {
|
|
95
|
+
type: "MARK_SPAM";
|
|
96
|
+
} | {
|
|
97
|
+
type: "MUTE_NOTIFICATION";
|
|
98
|
+
})[], number, undefined>]>;
|
|
99
|
+
readonly conditions: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"field", [v.ObjectSchema<{
|
|
100
|
+
readonly field: v.LiteralSchema<"FROM", undefined>;
|
|
101
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS", "DOMAIN_IS"], undefined>;
|
|
102
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
103
|
+
}, undefined>, v.ObjectSchema<{
|
|
104
|
+
readonly field: v.LiteralSchema<"TO_OR_CC", undefined>;
|
|
105
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS", "DOMAIN_IS"], undefined>;
|
|
106
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
107
|
+
}, undefined>, v.ObjectSchema<{
|
|
108
|
+
readonly field: v.LiteralSchema<"SUBJECT", undefined>;
|
|
109
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS"], undefined>;
|
|
110
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
111
|
+
}, undefined>, v.ObjectSchema<{
|
|
112
|
+
readonly field: v.LiteralSchema<"BODY", undefined>;
|
|
113
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
114
|
+
}, undefined>, v.ObjectSchema<{
|
|
115
|
+
readonly field: v.LiteralSchema<"HAS_ATTACHMENT", undefined>;
|
|
116
|
+
readonly value: v.BooleanSchema<undefined>;
|
|
117
|
+
}, undefined>, v.ObjectSchema<{
|
|
118
|
+
readonly field: v.LiteralSchema<"MAILING_LIST", undefined>;
|
|
119
|
+
readonly listId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
120
|
+
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
121
|
+
field: "FROM";
|
|
122
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
123
|
+
value: string;
|
|
124
|
+
} | {
|
|
125
|
+
field: "TO_OR_CC";
|
|
126
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
127
|
+
value: string;
|
|
128
|
+
} | {
|
|
129
|
+
field: "SUBJECT";
|
|
130
|
+
operator: "CONTAINS" | "IS";
|
|
131
|
+
value: string;
|
|
132
|
+
} | {
|
|
133
|
+
field: "BODY";
|
|
134
|
+
value: string;
|
|
135
|
+
} | {
|
|
136
|
+
field: "HAS_ATTACHMENT";
|
|
137
|
+
value: boolean;
|
|
138
|
+
} | {
|
|
139
|
+
field: "MAILING_LIST";
|
|
140
|
+
listId: string | null;
|
|
141
|
+
})[], 1, undefined>, v.MaxLengthAction<({
|
|
142
|
+
field: "FROM";
|
|
143
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
144
|
+
value: string;
|
|
145
|
+
} | {
|
|
146
|
+
field: "TO_OR_CC";
|
|
147
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
148
|
+
value: string;
|
|
149
|
+
} | {
|
|
150
|
+
field: "SUBJECT";
|
|
151
|
+
operator: "CONTAINS" | "IS";
|
|
152
|
+
value: string;
|
|
153
|
+
} | {
|
|
154
|
+
field: "BODY";
|
|
155
|
+
value: string;
|
|
156
|
+
} | {
|
|
157
|
+
field: "HAS_ATTACHMENT";
|
|
158
|
+
value: boolean;
|
|
159
|
+
} | {
|
|
160
|
+
field: "MAILING_LIST";
|
|
161
|
+
listId: string | null;
|
|
162
|
+
})[], number, undefined>]>;
|
|
163
|
+
readonly match: v.PicklistSchema<readonly ["ALL", "ANY"], undefined>;
|
|
164
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
165
|
+
readonly stopProcessing: v.BooleanSchema<undefined>;
|
|
166
|
+
}, undefined>;
|
|
167
|
+
export declare const ruleSchema: v.ObjectSchema<{
|
|
168
|
+
readonly accountId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "AccountId">]>, undefined>;
|
|
169
|
+
readonly disabledReason: v.NullableSchema<v.PicklistSchema<readonly ["LABEL_NOT_FOUND"], undefined>, undefined>;
|
|
170
|
+
readonly enabled: v.BooleanSchema<undefined>;
|
|
171
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "RuleId">]>, undefined>;
|
|
172
|
+
readonly lastMatchedAt: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
173
|
+
readonly matchCount: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
174
|
+
readonly actions: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
175
|
+
readonly type: v.LiteralSchema<"ARCHIVE", undefined>;
|
|
176
|
+
}, undefined>, v.ObjectSchema<{
|
|
177
|
+
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "LabelId">]>, undefined>;
|
|
178
|
+
readonly type: v.LiteralSchema<"MOVE_TO_FOLDER", undefined>;
|
|
179
|
+
}, undefined>, v.ObjectSchema<{
|
|
180
|
+
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "LabelId">]>, undefined>;
|
|
181
|
+
readonly type: v.LiteralSchema<"ADD_LABEL", undefined>;
|
|
182
|
+
}, undefined>, v.ObjectSchema<{
|
|
183
|
+
readonly type: v.LiteralSchema<"MARK_READ", undefined>;
|
|
184
|
+
}, undefined>, v.ObjectSchema<{
|
|
185
|
+
readonly type: v.LiteralSchema<"STAR", undefined>;
|
|
186
|
+
}, undefined>, v.ObjectSchema<{
|
|
187
|
+
readonly type: v.LiteralSchema<"TRASH", undefined>;
|
|
188
|
+
}, undefined>, v.ObjectSchema<{
|
|
189
|
+
readonly type: v.LiteralSchema<"MARK_SPAM", undefined>;
|
|
190
|
+
}, undefined>, v.ObjectSchema<{
|
|
191
|
+
readonly type: v.LiteralSchema<"MUTE_NOTIFICATION", undefined>;
|
|
192
|
+
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
193
|
+
type: "ARCHIVE";
|
|
194
|
+
} | {
|
|
195
|
+
labelId: string & v.Brand<"LabelId">;
|
|
196
|
+
type: "MOVE_TO_FOLDER";
|
|
197
|
+
} | {
|
|
198
|
+
labelId: string & v.Brand<"LabelId">;
|
|
199
|
+
type: "ADD_LABEL";
|
|
200
|
+
} | {
|
|
201
|
+
type: "MARK_READ";
|
|
202
|
+
} | {
|
|
203
|
+
type: "STAR";
|
|
204
|
+
} | {
|
|
205
|
+
type: "TRASH";
|
|
206
|
+
} | {
|
|
207
|
+
type: "MARK_SPAM";
|
|
208
|
+
} | {
|
|
209
|
+
type: "MUTE_NOTIFICATION";
|
|
210
|
+
})[], 1, undefined>, v.MaxLengthAction<({
|
|
211
|
+
type: "ARCHIVE";
|
|
212
|
+
} | {
|
|
213
|
+
labelId: string & v.Brand<"LabelId">;
|
|
214
|
+
type: "MOVE_TO_FOLDER";
|
|
215
|
+
} | {
|
|
216
|
+
labelId: string & v.Brand<"LabelId">;
|
|
217
|
+
type: "ADD_LABEL";
|
|
218
|
+
} | {
|
|
219
|
+
type: "MARK_READ";
|
|
220
|
+
} | {
|
|
221
|
+
type: "STAR";
|
|
222
|
+
} | {
|
|
223
|
+
type: "TRASH";
|
|
224
|
+
} | {
|
|
225
|
+
type: "MARK_SPAM";
|
|
226
|
+
} | {
|
|
227
|
+
type: "MUTE_NOTIFICATION";
|
|
228
|
+
})[], number, undefined>]>;
|
|
229
|
+
readonly conditions: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"field", [v.ObjectSchema<{
|
|
230
|
+
readonly field: v.LiteralSchema<"FROM", undefined>;
|
|
231
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS", "DOMAIN_IS"], undefined>;
|
|
232
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
233
|
+
}, undefined>, v.ObjectSchema<{
|
|
234
|
+
readonly field: v.LiteralSchema<"TO_OR_CC", undefined>;
|
|
235
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS", "DOMAIN_IS"], undefined>;
|
|
236
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
237
|
+
}, undefined>, v.ObjectSchema<{
|
|
238
|
+
readonly field: v.LiteralSchema<"SUBJECT", undefined>;
|
|
239
|
+
readonly operator: v.PicklistSchema<readonly ["CONTAINS", "IS"], undefined>;
|
|
240
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
241
|
+
}, undefined>, v.ObjectSchema<{
|
|
242
|
+
readonly field: v.LiteralSchema<"BODY", undefined>;
|
|
243
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
244
|
+
}, undefined>, v.ObjectSchema<{
|
|
245
|
+
readonly field: v.LiteralSchema<"HAS_ATTACHMENT", undefined>;
|
|
246
|
+
readonly value: v.BooleanSchema<undefined>;
|
|
247
|
+
}, undefined>, v.ObjectSchema<{
|
|
248
|
+
readonly field: v.LiteralSchema<"MAILING_LIST", undefined>;
|
|
249
|
+
readonly listId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
250
|
+
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
251
|
+
field: "FROM";
|
|
252
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
253
|
+
value: string;
|
|
254
|
+
} | {
|
|
255
|
+
field: "TO_OR_CC";
|
|
256
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
257
|
+
value: string;
|
|
258
|
+
} | {
|
|
259
|
+
field: "SUBJECT";
|
|
260
|
+
operator: "CONTAINS" | "IS";
|
|
261
|
+
value: string;
|
|
262
|
+
} | {
|
|
263
|
+
field: "BODY";
|
|
264
|
+
value: string;
|
|
265
|
+
} | {
|
|
266
|
+
field: "HAS_ATTACHMENT";
|
|
267
|
+
value: boolean;
|
|
268
|
+
} | {
|
|
269
|
+
field: "MAILING_LIST";
|
|
270
|
+
listId: string | null;
|
|
271
|
+
})[], 1, undefined>, v.MaxLengthAction<({
|
|
272
|
+
field: "FROM";
|
|
273
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
274
|
+
value: string;
|
|
275
|
+
} | {
|
|
276
|
+
field: "TO_OR_CC";
|
|
277
|
+
operator: "CONTAINS" | "IS" | "DOMAIN_IS";
|
|
278
|
+
value: string;
|
|
279
|
+
} | {
|
|
280
|
+
field: "SUBJECT";
|
|
281
|
+
operator: "CONTAINS" | "IS";
|
|
282
|
+
value: string;
|
|
283
|
+
} | {
|
|
284
|
+
field: "BODY";
|
|
285
|
+
value: string;
|
|
286
|
+
} | {
|
|
287
|
+
field: "HAS_ATTACHMENT";
|
|
288
|
+
value: boolean;
|
|
289
|
+
} | {
|
|
290
|
+
field: "MAILING_LIST";
|
|
291
|
+
listId: string | null;
|
|
292
|
+
})[], number, undefined>]>;
|
|
293
|
+
readonly match: v.PicklistSchema<readonly ["ALL", "ANY"], undefined>;
|
|
294
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
295
|
+
readonly stopProcessing: v.BooleanSchema<undefined>;
|
|
296
|
+
}, undefined>;
|
|
297
|
+
export type Rule = v.InferOutput<typeof ruleSchema>;
|
|
298
|
+
export type RuleAction = v.InferOutput<typeof ruleActionSchema>;
|
|
299
|
+
export type RuleCondition = v.InferOutput<typeof ruleConditionSchema>;
|
|
300
|
+
//# sourceMappingURL=rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../src/schemas/models/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAgB5B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;0BA4B9B,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;0BA2B3B,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAM/B,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAQrB,CAAA;AAEF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,UAAU,CAAC,CAAA;AACnD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { rules } from '../../constants/rules';
|
|
3
|
+
import { id } from '../../schemas/id';
|
|
4
|
+
import { number } from '../../schemas/number';
|
|
5
|
+
import { RULE_ADDRESS_OPERATORS, RULE_DISABLED_REASONS, RULE_MATCH_MODES, RULE_SUBJECT_OPERATORS, } from '../../types';
|
|
6
|
+
const ruleValueSchema = v.pipe(v.string(), v.trim(), v.nonEmpty(), v.maxLength(rules.valueMaxLength));
|
|
7
|
+
export const ruleConditionSchema = v.variant('field', [
|
|
8
|
+
v.object({
|
|
9
|
+
field: v.literal('FROM'),
|
|
10
|
+
operator: v.picklist(RULE_ADDRESS_OPERATORS),
|
|
11
|
+
value: ruleValueSchema,
|
|
12
|
+
}),
|
|
13
|
+
v.object({
|
|
14
|
+
field: v.literal('TO_OR_CC'),
|
|
15
|
+
operator: v.picklist(RULE_ADDRESS_OPERATORS),
|
|
16
|
+
value: ruleValueSchema,
|
|
17
|
+
}),
|
|
18
|
+
v.object({
|
|
19
|
+
field: v.literal('SUBJECT'),
|
|
20
|
+
operator: v.picklist(RULE_SUBJECT_OPERATORS),
|
|
21
|
+
value: ruleValueSchema,
|
|
22
|
+
}),
|
|
23
|
+
v.object({
|
|
24
|
+
field: v.literal('BODY'),
|
|
25
|
+
value: ruleValueSchema,
|
|
26
|
+
}),
|
|
27
|
+
v.object({
|
|
28
|
+
field: v.literal('HAS_ATTACHMENT'),
|
|
29
|
+
value: v.boolean(),
|
|
30
|
+
}),
|
|
31
|
+
v.object({
|
|
32
|
+
field: v.literal('MAILING_LIST'),
|
|
33
|
+
listId: v.nullable(ruleValueSchema),
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
export const ruleActionSchema = v.variant('type', [
|
|
37
|
+
v.object({
|
|
38
|
+
type: v.literal('ARCHIVE'),
|
|
39
|
+
}),
|
|
40
|
+
v.object({
|
|
41
|
+
labelId: id.labelId.required(),
|
|
42
|
+
type: v.literal('MOVE_TO_FOLDER'),
|
|
43
|
+
}),
|
|
44
|
+
v.object({
|
|
45
|
+
labelId: id.labelId.required(),
|
|
46
|
+
type: v.literal('ADD_LABEL'),
|
|
47
|
+
}),
|
|
48
|
+
v.object({
|
|
49
|
+
type: v.literal('MARK_READ'),
|
|
50
|
+
}),
|
|
51
|
+
v.object({
|
|
52
|
+
type: v.literal('STAR'),
|
|
53
|
+
}),
|
|
54
|
+
v.object({
|
|
55
|
+
type: v.literal('TRASH'),
|
|
56
|
+
}),
|
|
57
|
+
v.object({
|
|
58
|
+
type: v.literal('MARK_SPAM'),
|
|
59
|
+
}),
|
|
60
|
+
v.object({
|
|
61
|
+
type: v.literal('MUTE_NOTIFICATION'),
|
|
62
|
+
}),
|
|
63
|
+
]);
|
|
64
|
+
export const ruleDefinitionSchema = v.object({
|
|
65
|
+
actions: v.pipe(v.array(ruleActionSchema), v.minLength(1), v.maxLength(rules.maxActionsPerRule)),
|
|
66
|
+
conditions: v.pipe(v.array(ruleConditionSchema), v.minLength(1), v.maxLength(rules.maxConditionsPerRule)),
|
|
67
|
+
match: v.picklist(RULE_MATCH_MODES),
|
|
68
|
+
name: ruleValueSchema,
|
|
69
|
+
stopProcessing: v.boolean(),
|
|
70
|
+
});
|
|
71
|
+
export const ruleSchema = v.object({
|
|
72
|
+
...ruleDefinitionSchema.entries,
|
|
73
|
+
accountId: id.accountId.required(),
|
|
74
|
+
disabledReason: v.nullable(v.picklist(RULE_DISABLED_REASONS)),
|
|
75
|
+
enabled: v.boolean(),
|
|
76
|
+
id: id.ruleId.required(),
|
|
77
|
+
lastMatchedAt: v.nullable(number.positiveInteger()),
|
|
78
|
+
matchCount: number.positiveInteger(),
|
|
79
|
+
});
|