@wallarm-org/design-system 4.9.0 → 4.10.0-rc-feat-parser.1
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/components/DropdownMenu/DropdownMenu.d.ts +2 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +84 -71
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +14 -0
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +209 -0
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +15 -0
- package/dist/components/Rules/PointSelector/MatchStep.js +186 -0
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +16 -0
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +177 -0
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +10 -0
- package/dist/components/Rules/PointSelector/PointPreview.js +88 -0
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +17 -0
- package/dist/components/Rules/PointSelector/PointSelector.js +937 -0
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +12 -0
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +173 -0
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +31 -0
- package/dist/components/Rules/PointSelector/PointSelectorError.js +275 -0
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +20 -0
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +130 -0
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +31 -0
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +317 -0
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +8 -0
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +73 -0
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +14 -0
- package/dist/components/Rules/PointSelector/SampleRequest.js +116 -0
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +40 -0
- package/dist/components/Rules/PointSelector/StepMenu.js +210 -0
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +26 -0
- package/dist/components/Rules/PointSelector/VersionWarning.js +231 -0
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +48 -0
- package/dist/components/Rules/PointSelector/WhereBar.js +263 -0
- package/dist/components/Rules/PointSelector/classes.d.ts +28 -0
- package/dist/components/Rules/PointSelector/classes.js +22 -0
- package/dist/components/Rules/PointSelector/index.d.ts +20 -0
- package/dist/components/Rules/PointSelector/index.js +18 -0
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +8 -0
- package/dist/components/Rules/PointSelector/liftLayer.js +4 -0
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +6 -0
- package/dist/components/Rules/PointSelector/sampleValue.js +51 -0
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +508 -0
- package/dist/components/Rules/PointSelector/sdkBridge.js +339 -0
- package/dist/components/Rules/PointSelector/types.d.ts +304 -0
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +161 -0
- package/dist/components/Rules/PointSelector/usePointSelector.js +1088 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +28 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +208 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +23 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +950 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +21 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +110 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +20 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +31 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +23 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +131 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +17 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +14 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +6 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +6 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +24 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +245 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +15 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +691 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +19 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +72 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +407 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +269 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +25 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +99 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +118 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +446 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +266 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +35 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +57 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +15 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +10 -0
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +67 -0
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +366 -0
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +32 -0
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +420 -0
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +446 -0
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +7 -0
- package/dist/components/Rules/RuleBuilder/Summary/index.js +2 -0
- package/dist/components/Rules/RuleBuilder/classes.d.ts +19 -0
- package/dist/components/Rules/RuleBuilder/classes.js +18 -0
- package/dist/components/Rules/RuleBuilder/index.d.ts +55 -0
- package/dist/components/Rules/RuleBuilder/index.js +11 -0
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +31 -0
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +276 -0
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +95 -0
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +418 -0
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +3 -0
- package/dist/components/Rules/RuleBuilder/models/index.js +3 -0
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +176 -0
- package/dist/components/Rules/RuleBuilder/models/validation.js +242 -0
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +92 -0
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +1 -0
- package/dist/components/Rules/RuleBuilder/shared/index.js +1 -0
- package/dist/components/Rules/RuleBuilder/types.d.ts +384 -0
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +65 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.js +356 -0
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +48 -0
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +42 -0
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +92 -0
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +54 -0
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +2 -0
- package/dist/components/Rules/RuleBuilder/utils/index.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/metadata/components.json +100 -2
- package/dist/metadata/guidelines.json +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c as compiler_runtime_c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../../../utils/cn.js";
|
|
4
|
+
import { useTestId } from "../../../../utils/testId.js";
|
|
5
|
+
import { Code } from "../../../Code/index.js";
|
|
6
|
+
import { Tag } from "../../../Tag/index.js";
|
|
7
|
+
import { Text } from "../../../Text/index.js";
|
|
8
|
+
import { summaryCardVariants, summaryNestedVariants, summaryVariants } from "../classes.js";
|
|
9
|
+
import { OPERATOR_CHOICES } from "../utils/constants.js";
|
|
10
|
+
function getOperatorLabel(operator) {
|
|
11
|
+
return OPERATOR_CHOICES.find((c)=>c.value === operator)?.label ?? operator;
|
|
12
|
+
}
|
|
13
|
+
const ConditionNodeSummary = (t0)=>{
|
|
14
|
+
const $ = compiler_runtime_c(67);
|
|
15
|
+
const { node } = t0;
|
|
16
|
+
switch(node.kind){
|
|
17
|
+
case "field":
|
|
18
|
+
{
|
|
19
|
+
const { segments, condition: conditionType, value, ignoreCase } = node.value;
|
|
20
|
+
segments.map(_temp).join(" → ");
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
|
+
t1 = cn(summaryCardVariants());
|
|
24
|
+
$[0] = t1;
|
|
25
|
+
} else t1 = $[0];
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[1] !== segments) {
|
|
28
|
+
t2 = segments.map(_temp2);
|
|
29
|
+
$[1] = segments;
|
|
30
|
+
$[2] = t2;
|
|
31
|
+
} else t2 = $[2];
|
|
32
|
+
let t3;
|
|
33
|
+
if ($[3] !== t2) {
|
|
34
|
+
t3 = /*#__PURE__*/ jsx("div", {
|
|
35
|
+
className: "flex flex-wrap items-center gap-4",
|
|
36
|
+
children: t2
|
|
37
|
+
});
|
|
38
|
+
$[3] = t2;
|
|
39
|
+
$[4] = t3;
|
|
40
|
+
} else t3 = $[4];
|
|
41
|
+
const t4 = conditionType || "condition not set";
|
|
42
|
+
let t5;
|
|
43
|
+
if ($[5] !== t4) {
|
|
44
|
+
t5 = /*#__PURE__*/ jsx("span", {
|
|
45
|
+
className: "text-text-secondary",
|
|
46
|
+
children: t4
|
|
47
|
+
});
|
|
48
|
+
$[5] = t4;
|
|
49
|
+
$[6] = t5;
|
|
50
|
+
} else t5 = $[6];
|
|
51
|
+
let t6;
|
|
52
|
+
if ($[7] !== value) {
|
|
53
|
+
t6 = value && /*#__PURE__*/ jsxs(Fragment, {
|
|
54
|
+
children: [
|
|
55
|
+
" ",
|
|
56
|
+
/*#__PURE__*/ jsxs("span", {
|
|
57
|
+
className: "font-mono text-text-primary",
|
|
58
|
+
children: [
|
|
59
|
+
'"',
|
|
60
|
+
value,
|
|
61
|
+
'"'
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
$[7] = value;
|
|
67
|
+
$[8] = t6;
|
|
68
|
+
} else t6 = $[8];
|
|
69
|
+
let t7;
|
|
70
|
+
if ($[9] !== ignoreCase) {
|
|
71
|
+
t7 = ignoreCase && /*#__PURE__*/ jsx("span", {
|
|
72
|
+
className: "text-text-secondary",
|
|
73
|
+
children: " (case-insensitive)"
|
|
74
|
+
});
|
|
75
|
+
$[9] = ignoreCase;
|
|
76
|
+
$[10] = t7;
|
|
77
|
+
} else t7 = $[10];
|
|
78
|
+
let t8;
|
|
79
|
+
if ($[11] !== t5 || $[12] !== t6 || $[13] !== t7) {
|
|
80
|
+
t8 = /*#__PURE__*/ jsxs(Text, {
|
|
81
|
+
size: "sm",
|
|
82
|
+
children: [
|
|
83
|
+
t5,
|
|
84
|
+
t6,
|
|
85
|
+
t7
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
$[11] = t5;
|
|
89
|
+
$[12] = t6;
|
|
90
|
+
$[13] = t7;
|
|
91
|
+
$[14] = t8;
|
|
92
|
+
} else t8 = $[14];
|
|
93
|
+
let t9;
|
|
94
|
+
if ($[15] !== conditionType) {
|
|
95
|
+
t9 = !conditionType && /*#__PURE__*/ jsx(Text, {
|
|
96
|
+
size: "xs",
|
|
97
|
+
color: "secondary",
|
|
98
|
+
children: "Incomplete condition"
|
|
99
|
+
});
|
|
100
|
+
$[15] = conditionType;
|
|
101
|
+
$[16] = t9;
|
|
102
|
+
} else t9 = $[16];
|
|
103
|
+
let t10;
|
|
104
|
+
if ($[17] !== t1 || $[18] !== t3 || $[19] !== t8 || $[20] !== t9) {
|
|
105
|
+
t10 = /*#__PURE__*/ jsxs("div", {
|
|
106
|
+
className: t1,
|
|
107
|
+
children: [
|
|
108
|
+
t3,
|
|
109
|
+
t8,
|
|
110
|
+
t9
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
$[17] = t1;
|
|
114
|
+
$[18] = t3;
|
|
115
|
+
$[19] = t8;
|
|
116
|
+
$[20] = t9;
|
|
117
|
+
$[21] = t10;
|
|
118
|
+
} else t10 = $[21];
|
|
119
|
+
return t10;
|
|
120
|
+
}
|
|
121
|
+
case "attack":
|
|
122
|
+
{
|
|
123
|
+
let t1;
|
|
124
|
+
let t2;
|
|
125
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
126
|
+
t1 = cn(summaryCardVariants());
|
|
127
|
+
t2 = /*#__PURE__*/ jsx(Text, {
|
|
128
|
+
size: "sm",
|
|
129
|
+
weight: "medium",
|
|
130
|
+
children: "An attack was detected"
|
|
131
|
+
});
|
|
132
|
+
$[22] = t1;
|
|
133
|
+
$[23] = t2;
|
|
134
|
+
} else {
|
|
135
|
+
t1 = $[22];
|
|
136
|
+
t2 = $[23];
|
|
137
|
+
}
|
|
138
|
+
let t3;
|
|
139
|
+
if ($[24] !== node.attackType) {
|
|
140
|
+
t3 = node.attackType && /*#__PURE__*/ jsxs(Text, {
|
|
141
|
+
size: "sm",
|
|
142
|
+
color: "secondary",
|
|
143
|
+
children: [
|
|
144
|
+
"Attack type: ",
|
|
145
|
+
node.attackType
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
$[24] = node.attackType;
|
|
149
|
+
$[25] = t3;
|
|
150
|
+
} else t3 = $[25];
|
|
151
|
+
let t4;
|
|
152
|
+
if ($[26] !== node.point) {
|
|
153
|
+
t4 = node.point && "flow" !== node.point && /*#__PURE__*/ jsxs(Text, {
|
|
154
|
+
size: "sm",
|
|
155
|
+
color: "secondary",
|
|
156
|
+
children: [
|
|
157
|
+
"At: ",
|
|
158
|
+
node.point
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
$[26] = node.point;
|
|
162
|
+
$[27] = t4;
|
|
163
|
+
} else t4 = $[27];
|
|
164
|
+
let t5;
|
|
165
|
+
if ($[28] !== t1 || $[29] !== t3 || $[30] !== t4) {
|
|
166
|
+
t5 = /*#__PURE__*/ jsxs("div", {
|
|
167
|
+
className: t1,
|
|
168
|
+
children: [
|
|
169
|
+
t2,
|
|
170
|
+
t3,
|
|
171
|
+
t4
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
$[28] = t1;
|
|
175
|
+
$[29] = t3;
|
|
176
|
+
$[30] = t4;
|
|
177
|
+
$[31] = t5;
|
|
178
|
+
} else t5 = $[31];
|
|
179
|
+
return t5;
|
|
180
|
+
}
|
|
181
|
+
case "signal":
|
|
182
|
+
{
|
|
183
|
+
let t1;
|
|
184
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
185
|
+
t1 = {
|
|
186
|
+
key_duplicate: "Duplicate keys detected",
|
|
187
|
+
resource_overlimit: "Resource limit exceeded"
|
|
188
|
+
};
|
|
189
|
+
$[32] = t1;
|
|
190
|
+
} else t1 = $[32];
|
|
191
|
+
const signalLabels = t1;
|
|
192
|
+
let t2;
|
|
193
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
194
|
+
t2 = cn(summaryCardVariants());
|
|
195
|
+
$[33] = t2;
|
|
196
|
+
} else t2 = $[33];
|
|
197
|
+
const t3 = signalLabels[node.signalType] || "A request anomaly was detected";
|
|
198
|
+
let t4;
|
|
199
|
+
if ($[34] !== t3) {
|
|
200
|
+
t4 = /*#__PURE__*/ jsx(Text, {
|
|
201
|
+
size: "sm",
|
|
202
|
+
weight: "medium",
|
|
203
|
+
children: t3
|
|
204
|
+
});
|
|
205
|
+
$[34] = t3;
|
|
206
|
+
$[35] = t4;
|
|
207
|
+
} else t4 = $[35];
|
|
208
|
+
let t5;
|
|
209
|
+
if ($[36] !== node.point || $[37] !== node.signalType) {
|
|
210
|
+
t5 = "key_duplicate" === node.signalType && /*#__PURE__*/ jsxs(Text, {
|
|
211
|
+
size: "sm",
|
|
212
|
+
color: "secondary",
|
|
213
|
+
children: [
|
|
214
|
+
"In: ",
|
|
215
|
+
node.point
|
|
216
|
+
]
|
|
217
|
+
});
|
|
218
|
+
$[36] = node.point;
|
|
219
|
+
$[37] = node.signalType;
|
|
220
|
+
$[38] = t5;
|
|
221
|
+
} else t5 = $[38];
|
|
222
|
+
let t6;
|
|
223
|
+
if ($[39] !== node.limit || $[40] !== node.signalType) {
|
|
224
|
+
t6 = "resource_overlimit" === node.signalType && node.limit && /*#__PURE__*/ jsxs(Text, {
|
|
225
|
+
size: "sm",
|
|
226
|
+
color: "secondary",
|
|
227
|
+
children: [
|
|
228
|
+
"Limit: ",
|
|
229
|
+
node.limit
|
|
230
|
+
]
|
|
231
|
+
});
|
|
232
|
+
$[39] = node.limit;
|
|
233
|
+
$[40] = node.signalType;
|
|
234
|
+
$[41] = t6;
|
|
235
|
+
} else t6 = $[41];
|
|
236
|
+
let t7;
|
|
237
|
+
if ($[42] !== t2 || $[43] !== t4 || $[44] !== t5 || $[45] !== t6) {
|
|
238
|
+
t7 = /*#__PURE__*/ jsxs("div", {
|
|
239
|
+
className: t2,
|
|
240
|
+
children: [
|
|
241
|
+
t4,
|
|
242
|
+
t5,
|
|
243
|
+
t6
|
|
244
|
+
]
|
|
245
|
+
});
|
|
246
|
+
$[42] = t2;
|
|
247
|
+
$[43] = t4;
|
|
248
|
+
$[44] = t5;
|
|
249
|
+
$[45] = t6;
|
|
250
|
+
$[46] = t7;
|
|
251
|
+
} else t7 = $[46];
|
|
252
|
+
return t7;
|
|
253
|
+
}
|
|
254
|
+
case "group":
|
|
255
|
+
{
|
|
256
|
+
let t1;
|
|
257
|
+
if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
|
|
258
|
+
t1 = cn(summaryNestedVariants());
|
|
259
|
+
$[47] = t1;
|
|
260
|
+
} else t1 = $[47];
|
|
261
|
+
let t2;
|
|
262
|
+
if ($[48] !== node.operator) {
|
|
263
|
+
t2 = getOperatorLabel(node.operator);
|
|
264
|
+
$[48] = node.operator;
|
|
265
|
+
$[49] = t2;
|
|
266
|
+
} else t2 = $[49];
|
|
267
|
+
let t3;
|
|
268
|
+
if ($[50] !== t2) {
|
|
269
|
+
t3 = /*#__PURE__*/ jsxs(Text, {
|
|
270
|
+
size: "sm",
|
|
271
|
+
weight: "medium",
|
|
272
|
+
children: [
|
|
273
|
+
t2,
|
|
274
|
+
" of:"
|
|
275
|
+
]
|
|
276
|
+
});
|
|
277
|
+
$[50] = t2;
|
|
278
|
+
$[51] = t3;
|
|
279
|
+
} else t3 = $[51];
|
|
280
|
+
let t4;
|
|
281
|
+
if ($[52] !== node.children) {
|
|
282
|
+
t4 = 0 === node.children.length ? /*#__PURE__*/ jsx(Text, {
|
|
283
|
+
size: "sm",
|
|
284
|
+
color: "secondary",
|
|
285
|
+
children: "(empty group)"
|
|
286
|
+
}) : node.children.map(_temp3);
|
|
287
|
+
$[52] = node.children;
|
|
288
|
+
$[53] = t4;
|
|
289
|
+
} else t4 = $[53];
|
|
290
|
+
let t5;
|
|
291
|
+
if ($[54] !== t1 || $[55] !== t3 || $[56] !== t4) {
|
|
292
|
+
t5 = /*#__PURE__*/ jsxs("div", {
|
|
293
|
+
className: t1,
|
|
294
|
+
children: [
|
|
295
|
+
t3,
|
|
296
|
+
t4
|
|
297
|
+
]
|
|
298
|
+
});
|
|
299
|
+
$[54] = t1;
|
|
300
|
+
$[55] = t3;
|
|
301
|
+
$[56] = t4;
|
|
302
|
+
$[57] = t5;
|
|
303
|
+
} else t5 = $[57];
|
|
304
|
+
return t5;
|
|
305
|
+
}
|
|
306
|
+
case "raw":
|
|
307
|
+
{
|
|
308
|
+
let t1;
|
|
309
|
+
let t2;
|
|
310
|
+
if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
|
|
311
|
+
t1 = cn(summaryCardVariants());
|
|
312
|
+
t2 = /*#__PURE__*/ jsx(Text, {
|
|
313
|
+
size: "xs",
|
|
314
|
+
color: "secondary",
|
|
315
|
+
children: "Raw condition (cannot be edited):"
|
|
316
|
+
});
|
|
317
|
+
$[58] = t1;
|
|
318
|
+
$[59] = t2;
|
|
319
|
+
} else {
|
|
320
|
+
t1 = $[58];
|
|
321
|
+
t2 = $[59];
|
|
322
|
+
}
|
|
323
|
+
let t3;
|
|
324
|
+
if ($[60] !== node.check) {
|
|
325
|
+
t3 = JSON.stringify(node.check, null, 2);
|
|
326
|
+
$[60] = node.check;
|
|
327
|
+
$[61] = t3;
|
|
328
|
+
} else t3 = $[61];
|
|
329
|
+
let t4;
|
|
330
|
+
if ($[62] !== t3) {
|
|
331
|
+
t4 = /*#__PURE__*/ jsx(Code, {
|
|
332
|
+
size: "s",
|
|
333
|
+
className: "break-all",
|
|
334
|
+
children: t3
|
|
335
|
+
});
|
|
336
|
+
$[62] = t3;
|
|
337
|
+
$[63] = t4;
|
|
338
|
+
} else t4 = $[63];
|
|
339
|
+
let t5;
|
|
340
|
+
if ($[64] !== t1 || $[65] !== t4) {
|
|
341
|
+
t5 = /*#__PURE__*/ jsxs("div", {
|
|
342
|
+
className: t1,
|
|
343
|
+
children: [
|
|
344
|
+
t2,
|
|
345
|
+
t4
|
|
346
|
+
]
|
|
347
|
+
});
|
|
348
|
+
$[64] = t1;
|
|
349
|
+
$[65] = t4;
|
|
350
|
+
$[66] = t5;
|
|
351
|
+
} else t5 = $[66];
|
|
352
|
+
return t5;
|
|
353
|
+
}
|
|
354
|
+
default:
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
const ConditionSummary = (t0)=>{
|
|
359
|
+
const $ = compiler_runtime_c(14);
|
|
360
|
+
const { ref, "data-testid": testIdProp, condition, className } = t0;
|
|
361
|
+
const testId = useTestId("condition-summary");
|
|
362
|
+
const finalTestId = testIdProp ?? testId;
|
|
363
|
+
let t1;
|
|
364
|
+
if ($[0] !== className) {
|
|
365
|
+
t1 = cn(summaryVariants(), className);
|
|
366
|
+
$[0] = className;
|
|
367
|
+
$[1] = t1;
|
|
368
|
+
} else t1 = $[1];
|
|
369
|
+
let t2;
|
|
370
|
+
if ($[2] !== condition.operator) {
|
|
371
|
+
t2 = getOperatorLabel(condition.operator).toLowerCase();
|
|
372
|
+
$[2] = condition.operator;
|
|
373
|
+
$[3] = t2;
|
|
374
|
+
} else t2 = $[3];
|
|
375
|
+
let t3;
|
|
376
|
+
if ($[4] !== t2) {
|
|
377
|
+
t3 = /*#__PURE__*/ jsx("div", {
|
|
378
|
+
className: "flex items-center gap-8",
|
|
379
|
+
children: /*#__PURE__*/ jsxs(Text, {
|
|
380
|
+
size: "sm",
|
|
381
|
+
weight: "medium",
|
|
382
|
+
children: [
|
|
383
|
+
"If a request matches ",
|
|
384
|
+
t2,
|
|
385
|
+
":"
|
|
386
|
+
]
|
|
387
|
+
})
|
|
388
|
+
});
|
|
389
|
+
$[4] = t2;
|
|
390
|
+
$[5] = t3;
|
|
391
|
+
} else t3 = $[5];
|
|
392
|
+
let t4;
|
|
393
|
+
if ($[6] !== condition.children) {
|
|
394
|
+
t4 = 0 === condition.children.length ? /*#__PURE__*/ jsx(Text, {
|
|
395
|
+
size: "sm",
|
|
396
|
+
color: "secondary",
|
|
397
|
+
children: "No conditions — the rule applies to every request."
|
|
398
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
399
|
+
className: "flex flex-col gap-8",
|
|
400
|
+
children: condition.children.map(_temp4)
|
|
401
|
+
});
|
|
402
|
+
$[6] = condition.children;
|
|
403
|
+
$[7] = t4;
|
|
404
|
+
} else t4 = $[7];
|
|
405
|
+
let t5;
|
|
406
|
+
if ($[8] !== finalTestId || $[9] !== ref || $[10] !== t1 || $[11] !== t3 || $[12] !== t4) {
|
|
407
|
+
t5 = /*#__PURE__*/ jsxs("div", {
|
|
408
|
+
ref: ref,
|
|
409
|
+
"data-slot": "condition-summary",
|
|
410
|
+
"data-testid": finalTestId,
|
|
411
|
+
className: t1,
|
|
412
|
+
children: [
|
|
413
|
+
t3,
|
|
414
|
+
t4
|
|
415
|
+
]
|
|
416
|
+
});
|
|
417
|
+
$[8] = finalTestId;
|
|
418
|
+
$[9] = ref;
|
|
419
|
+
$[10] = t1;
|
|
420
|
+
$[11] = t3;
|
|
421
|
+
$[12] = t4;
|
|
422
|
+
$[13] = t5;
|
|
423
|
+
} else t5 = $[13];
|
|
424
|
+
return t5;
|
|
425
|
+
};
|
|
426
|
+
ConditionSummary.displayName = "ConditionSummary";
|
|
427
|
+
function _temp(seg) {
|
|
428
|
+
return seg.label || seg.text;
|
|
429
|
+
}
|
|
430
|
+
function _temp2(seg_0, i) {
|
|
431
|
+
return /*#__PURE__*/ jsx(Tag, {
|
|
432
|
+
size: "medium",
|
|
433
|
+
children: seg_0.label || seg_0.text
|
|
434
|
+
}, i);
|
|
435
|
+
}
|
|
436
|
+
function _temp3(child) {
|
|
437
|
+
return /*#__PURE__*/ jsx(ConditionNodeSummary, {
|
|
438
|
+
node: child
|
|
439
|
+
}, child.id);
|
|
440
|
+
}
|
|
441
|
+
function _temp4(child) {
|
|
442
|
+
return /*#__PURE__*/ jsx(ConditionNodeSummary, {
|
|
443
|
+
node: child
|
|
444
|
+
}, child.id);
|
|
445
|
+
}
|
|
446
|
+
export { ConditionSummary };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuleBuilder CVA variants
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Main RuleBuilder container variants
|
|
6
|
+
*/
|
|
7
|
+
export declare const ruleBuilderVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Summary container variants (for read-only views)
|
|
10
|
+
*/
|
|
11
|
+
export declare const summaryVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Summary card variants (for individual condition/action display)
|
|
14
|
+
*/
|
|
15
|
+
export declare const summaryCardVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Summary nested group variants (for nested condition groups)
|
|
18
|
+
*/
|
|
19
|
+
export declare const summaryNestedVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
const ruleBuilderVariants = cva('flex flex-col gap-20', {
|
|
3
|
+
variants: {},
|
|
4
|
+
defaultVariants: {}
|
|
5
|
+
});
|
|
6
|
+
const summaryVariants = cva('flex flex-col gap-12', {
|
|
7
|
+
variants: {},
|
|
8
|
+
defaultVariants: {}
|
|
9
|
+
});
|
|
10
|
+
const summaryCardVariants = cva('rounded-8 border border-border-primary-light p-12 flex flex-col gap-8', {
|
|
11
|
+
variants: {},
|
|
12
|
+
defaultVariants: {}
|
|
13
|
+
});
|
|
14
|
+
const summaryNestedVariants = cva('border-l-2 border-border-primary-light pl-12 ml-8 flex flex-col gap-8', {
|
|
15
|
+
variants: {},
|
|
16
|
+
defaultVariants: {}
|
|
17
|
+
});
|
|
18
|
+
export { ruleBuilderVariants, summaryCardVariants, summaryNestedVariants, summaryVariants };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuleBuilder - Rule authoring component for Wallarm WAF rules
|
|
3
|
+
*
|
|
4
|
+
* A compound component system for building and editing Wallarm WAF rules.
|
|
5
|
+
* Integrates with PointSelector for point selection and provides full CRUD
|
|
6
|
+
* operations for condition trees and action configuration.
|
|
7
|
+
*
|
|
8
|
+
* ## Foundational Layer (Phase 1)
|
|
9
|
+
*
|
|
10
|
+
* This file exports the foundational types, models, and utilities.
|
|
11
|
+
* UI components (RuleBuilder, ConditionTree, ActionEditor, etc.) will be
|
|
12
|
+
* added in Phase 2.
|
|
13
|
+
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import {
|
|
18
|
+
* type GroupCondition,
|
|
19
|
+
* type ActionDraft,
|
|
20
|
+
* newGroup,
|
|
21
|
+
* newAction,
|
|
22
|
+
* toProtonCondition,
|
|
23
|
+
* toProtonAction,
|
|
24
|
+
* fromProtonCondition,
|
|
25
|
+
* fromProtonAction,
|
|
26
|
+
* conditionProblems,
|
|
27
|
+
* actionProblems,
|
|
28
|
+
* } from '@wallarm-org/design-system';
|
|
29
|
+
*
|
|
30
|
+
* // Create new condition tree
|
|
31
|
+
* const condition = newGroup('and');
|
|
32
|
+
*
|
|
33
|
+
* // Create new action
|
|
34
|
+
* const action = newAction('add_attack');
|
|
35
|
+
*
|
|
36
|
+
* // Validate
|
|
37
|
+
* const errors = conditionProblems(condition);
|
|
38
|
+
*
|
|
39
|
+
* // Convert to API format
|
|
40
|
+
* const protonCondition = toProtonCondition(condition);
|
|
41
|
+
* const protonAction = toProtonAction(action);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export { ActionEditor, type ActionEditorProps, ActionFields, type ActionFieldsProps, ActionTargetPicker, type ActionTargetPickerProps, ActionTypeSelect, type ActionTypeSelectProps, AttackTypeField, type AttackTypeFieldProps, actionEditorVariants, actionFieldsVariants, actionTargetPickerVariants, } from './ActionEditor/index.js';
|
|
45
|
+
export { AddConditionMenu, type AddConditionMenuProps, AttackCondition as AttackConditionComponent, type AttackConditionProps, addConditionButtonVariants, ConditionCard, type ConditionCardProps, ConditionTree, type ConditionTreeProps, conditionCardVariants, conditionTreeVariants, FieldCondition as FieldConditionComponent, type FieldConditionProps, GroupCondition as GroupConditionComponent, type GroupConditionProps, groupBorderVariants, operatorSelectVariants, SampleCondition as SampleConditionComponent, type SampleConditionProps, SignalCondition as SignalConditionComponent, type SignalConditionProps, TagCondition as TagConditionComponent, type TagConditionProps, } from './ConditionTree/index.js';
|
|
46
|
+
export { ruleBuilderVariants, summaryCardVariants, summaryNestedVariants, summaryVariants, } from './classes.js';
|
|
47
|
+
export { fromProtonAction, newAction, toProtonAction, } from './models/actionModel.js';
|
|
48
|
+
export { conditionProblems, EMPTY_FIELD_VALUE, fieldComplete, fromProtonCondition, newAttack, newField, newGroup, newSample, newSignal, newTag, nodeId, toProtonCondition, } from './models/conditionModel.js';
|
|
49
|
+
export { actionProblems, isActionValid, isValidDuration, isValidInteger, isValidQuantity, validators, } from './models/validation.js';
|
|
50
|
+
export { RuleBuilder, type RuleBuilderProps, type RuleBuilderSection } from './RuleBuilder.js';
|
|
51
|
+
export { ActionSummary, type ActionSummaryProps, ConditionSummary, type ConditionSummaryProps, } from './Summary/index.js';
|
|
52
|
+
export { ChoiceSelect, type ChoiceSelectProps } from './shared/index.js';
|
|
53
|
+
export type { ActionDraft, ActionKind, ActionTarget, AttackCondition, Choice, ConditionNode, FieldCondition, GroupCondition, GroupOperator, ProtonAction, ProtonCheck, ProtonCondition, RawCondition, SampleCondition, SignalCondition, SignalType, TagCondition, } from './types.js';
|
|
54
|
+
export { ACTION_KIND_CHOICES, ADDABLE_NODE_KINDS, CHECK_TYPE_CHOICES, CONTEXT_CHOICES, DEFAULT_PRIORITY, DEFAULT_SEPARATOR, DUPLICATE_CONTAINERS, OPERATOR_CHOICES, RESOURCE_LIMITS, SIGNAL_TYPE_CHOICES, TARGET_REQUIREMENT, } from './utils/constants.js';
|
|
55
|
+
export { countChecks, countNodesOfKind, findNodeById, getLeafNodes, hasDescendantOfKind, isLeafNode, mapNode, maxDepth, removeNode, } from './utils/helpers.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { ActionEditor, ActionFields, ActionTargetPicker, ActionTypeSelect, AttackTypeField, actionEditorVariants, actionFieldsVariants, actionTargetPickerVariants } from "./ActionEditor/index.js";
|
|
2
|
+
export { AddConditionMenu, AttackCondition as AttackConditionComponent, ConditionCard, ConditionTree, FieldCondition as FieldConditionComponent, GroupCondition as GroupConditionComponent, SampleCondition as SampleConditionComponent, SignalCondition as SignalConditionComponent, TagCondition as TagConditionComponent, addConditionButtonVariants, conditionCardVariants, conditionTreeVariants, groupBorderVariants, operatorSelectVariants } from "./ConditionTree/index.js";
|
|
3
|
+
export { ruleBuilderVariants, summaryCardVariants, summaryNestedVariants, summaryVariants } from "./classes.js";
|
|
4
|
+
export { fromProtonAction, newAction, toProtonAction } from "./models/actionModel.js";
|
|
5
|
+
export { EMPTY_FIELD_VALUE, conditionProblems, fieldComplete, fromProtonCondition, newAttack, newField, newGroup, newSample, newSignal, newTag, nodeId, toProtonCondition } from "./models/conditionModel.js";
|
|
6
|
+
export { actionProblems, isActionValid, isValidDuration, isValidInteger, isValidQuantity, validators } from "./models/validation.js";
|
|
7
|
+
export { RuleBuilder } from "./RuleBuilder.js";
|
|
8
|
+
export { ActionSummary, ConditionSummary } from "./Summary/index.js";
|
|
9
|
+
export { ChoiceSelect } from "./shared/index.js";
|
|
10
|
+
export { ACTION_KIND_CHOICES, ADDABLE_NODE_KINDS, CHECK_TYPE_CHOICES, CONTEXT_CHOICES, DEFAULT_PRIORITY, DEFAULT_SEPARATOR, DUPLICATE_CONTAINERS, OPERATOR_CHOICES, RESOURCE_LIMITS, SIGNAL_TYPE_CHOICES, TARGET_REQUIREMENT } from "./utils/constants.js";
|
|
11
|
+
export { countChecks, countNodesOfKind, findNodeById, getLeafNodes, hasDescendantOfKind, isLeafNode, mapNode, maxDepth, removeNode } from "./utils/helpers.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Model
|
|
3
|
+
*
|
|
4
|
+
* Converts between UI action draft and Proton API format.
|
|
5
|
+
* Handles action transformations, factory functions, and validation.
|
|
6
|
+
*/
|
|
7
|
+
import type { Proton } from '@wallarm-org/rules-lib';
|
|
8
|
+
import type { ActionDraft, ActionKind, ProtonAction } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Create a new action draft with default values.
|
|
11
|
+
*
|
|
12
|
+
* @param kind - Action kind (default: 'add_attack')
|
|
13
|
+
* @returns New ActionDraft
|
|
14
|
+
*/
|
|
15
|
+
export declare function newAction(kind?: ActionKind): ActionDraft;
|
|
16
|
+
/**
|
|
17
|
+
* Convert UI action draft to Proton API format.
|
|
18
|
+
*
|
|
19
|
+
* @param draft - Action draft
|
|
20
|
+
* @param proton - Optional Proton SDK instance for canonical point rendering
|
|
21
|
+
* @returns Proton action object
|
|
22
|
+
*/
|
|
23
|
+
export declare function toProtonAction(draft: ActionDraft, proton?: Proton | null): ProtonAction;
|
|
24
|
+
/**
|
|
25
|
+
* Convert Proton API format to UI action draft.
|
|
26
|
+
*
|
|
27
|
+
* @param action - Proton action (may be array or object)
|
|
28
|
+
* @param proton - SDK instance for parsing point strings (optional)
|
|
29
|
+
* @returns ActionDraft
|
|
30
|
+
*/
|
|
31
|
+
export declare function fromProtonAction(action: unknown, proton?: Proton | null): ActionDraft;
|