@wallarm-org/design-system 4.8.0-rc-feat-parser.1 → 4.8.0-rc-fix-claude-code.2

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.
Files changed (176) hide show
  1. package/README.md +4 -2
  2. package/dist/components/BulkBar/index.d.ts +5 -0
  3. package/dist/components/Drawer/classes.js +1 -1
  4. package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
  5. package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
  6. package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
  7. package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
  8. package/dist/components/NotificationCenter/NotificationCenter.d.ts +20 -0
  9. package/dist/components/NotificationCenter/NotificationCenter.js +65 -0
  10. package/dist/components/NotificationCenter/NotificationCenterBody.d.ts +18 -0
  11. package/dist/components/NotificationCenter/NotificationCenterBody.js +202 -0
  12. package/dist/components/NotificationCenter/NotificationCenterContent.d.ts +5 -0
  13. package/dist/components/NotificationCenter/NotificationCenterContent.js +42 -0
  14. package/dist/components/NotificationCenter/NotificationCenterHeader.d.ts +20 -0
  15. package/dist/components/NotificationCenter/NotificationCenterHeader.js +202 -0
  16. package/dist/components/NotificationCenter/NotificationCenterItem.d.ts +26 -0
  17. package/dist/components/NotificationCenter/NotificationCenterItem.js +211 -0
  18. package/dist/components/NotificationCenter/NotificationCenterItemTime.d.ts +9 -0
  19. package/dist/components/NotificationCenter/NotificationCenterItemTime.js +148 -0
  20. package/dist/components/NotificationCenter/NotificationCenterItemTitle.d.ts +14 -0
  21. package/dist/components/NotificationCenter/NotificationCenterItemTitle.js +115 -0
  22. package/dist/components/NotificationCenter/NotificationCenterTabs.d.ts +10 -0
  23. package/dist/components/NotificationCenter/NotificationCenterTabs.js +77 -0
  24. package/dist/components/NotificationCenter/NotificationCenterTrigger.d.ts +13 -0
  25. package/dist/components/NotificationCenter/NotificationCenterTrigger.js +138 -0
  26. package/dist/components/NotificationCenter/index.d.ts +9 -0
  27. package/dist/components/NotificationCenter/index.js +9 -0
  28. package/dist/components/Overlay/Overlay.js +1 -1
  29. package/dist/components/SearchInput/SearchInput.d.ts +7 -5
  30. package/dist/components/SearchInput/SearchInput.js +119 -101
  31. package/dist/components/Select/SelectSearchInput.d.ts +1 -1
  32. package/dist/components/Table/types.d.ts +1 -1
  33. package/dist/components/Tabs/Tabs.d.ts +1 -0
  34. package/dist/components/Tabs/Tabs.js +30 -28
  35. package/dist/components/Tabs/TabsList/index.d.ts +1 -1
  36. package/dist/components/Tabs/index.d.ts +2 -2
  37. package/dist/components/Tour/TourPositioner.d.ts +3 -0
  38. package/dist/components/Tour/TourPositioner.js +4 -4
  39. package/dist/guidelines/foundations/color.md +157 -0
  40. package/dist/guidelines/foundations/focus.md +122 -0
  41. package/dist/guidelines/foundations/layering.md +131 -0
  42. package/dist/guidelines/foundations/radius-elevation.md +111 -0
  43. package/dist/guidelines/foundations/spacing.md +117 -0
  44. package/dist/guidelines/foundations/typography.md +114 -0
  45. package/dist/guidelines/patterns/app-layout.md +1567 -0
  46. package/dist/guidelines/patterns/auth-page.md +668 -0
  47. package/dist/guidelines/patterns/confirmation-dialogs.md +605 -0
  48. package/dist/guidelines/patterns/create-edit-forms.md +768 -0
  49. package/dist/guidelines/patterns/detail-drawer.md +868 -0
  50. package/dist/guidelines/patterns/empty-states.md +461 -0
  51. package/dist/guidelines/patterns/entity-table.md +533 -0
  52. package/dist/guidelines/patterns/feedback-toasts.md +493 -0
  53. package/dist/guidelines/patterns/filtering.md +630 -0
  54. package/dist/guidelines/patterns/resource-list-page.md +558 -0
  55. package/dist/guidelines/patterns/settings-page.md +752 -0
  56. package/dist/guidelines/rules.md +25 -0
  57. package/dist/index.d.ts +2 -3
  58. package/dist/index.js +1 -2
  59. package/dist/metadata/components.json +12431 -9208
  60. package/dist/metadata/guidelines.json +1705 -0
  61. package/dist/theme/typography.css +5 -0
  62. package/dist/utils/formatDateTime.d.ts +6 -0
  63. package/dist/utils/formatDateTime.js +13 -1
  64. package/package.json +6 -4
  65. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
  66. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
  67. package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
  68. package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
  69. package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
  70. package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
  71. package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
  72. package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
  73. package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
  74. package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
  75. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
  76. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
  77. package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
  78. package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
  79. package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
  80. package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
  81. package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
  82. package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
  83. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
  84. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
  85. package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
  86. package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
  87. package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
  88. package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
  89. package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
  90. package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
  91. package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
  92. package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
  93. package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
  94. package/dist/components/Rules/PointSelector/classes.js +0 -22
  95. package/dist/components/Rules/PointSelector/index.d.ts +0 -20
  96. package/dist/components/Rules/PointSelector/index.js +0 -18
  97. package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
  98. package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
  99. package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
  100. package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
  101. package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
  102. package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
  103. package/dist/components/Rules/PointSelector/types.d.ts +0 -304
  104. package/dist/components/Rules/PointSelector/types.js +0 -0
  105. package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
  106. package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
  107. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
  108. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
  109. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
  110. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
  111. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
  112. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
  113. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
  114. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
  115. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
  116. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
  117. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
  118. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
  119. package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
  120. package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
  121. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
  122. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
  123. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
  124. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
  125. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
  126. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
  127. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
  128. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
  129. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
  130. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
  131. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
  132. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
  133. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
  134. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
  135. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
  136. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
  137. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
  138. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
  139. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
  140. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
  141. package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
  142. package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
  143. package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
  144. package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
  145. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
  146. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
  147. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
  148. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
  149. package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
  150. package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
  151. package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
  152. package/dist/components/Rules/RuleBuilder/classes.js +0 -18
  153. package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
  154. package/dist/components/Rules/RuleBuilder/index.js +0 -11
  155. package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
  156. package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
  157. package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
  158. package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
  159. package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
  160. package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
  161. package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
  162. package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
  163. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
  164. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
  165. package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
  166. package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
  167. package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
  168. package/dist/components/Rules/RuleBuilder/types.js +0 -0
  169. package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
  170. package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
  171. package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
  172. package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
  173. package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
  174. package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
  175. package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
  176. package/dist/components/Rules/RuleBuilder/utils/index.js +0 -2
@@ -1,276 +0,0 @@
1
- import { pointOf } from "../../PointSelector/sdkBridge.js";
2
- import { DEFAULT_SEPARATOR, TARGET_REQUIREMENT } from "../utils/constants.js";
3
- const WHOLE_REQUEST = {
4
- whole: true,
5
- context: 'http_request',
6
- segments: []
7
- };
8
- function newAction(kind = 'add_attack') {
9
- const targetType = TARGET_REQUIREMENT[kind];
10
- const needsPoint = 'point' === targetType;
11
- return {
12
- kind,
13
- attackType: '',
14
- comment: '',
15
- experimental: false,
16
- tagKey: '',
17
- tagValue: '',
18
- separator: DEFAULT_SEPARATOR,
19
- limit: '',
20
- softLimit: '',
21
- hardLimit: '',
22
- priority: '',
23
- parsers: [],
24
- parser: '',
25
- ruleIds: [],
26
- target: needsPoint ? {
27
- ...WHOLE_REQUEST,
28
- whole: false
29
- } : WHOLE_REQUEST
30
- };
31
- }
32
- function targetToProton(target, proton) {
33
- let point;
34
- point = target.whole ? 'flow' : target.canonical ? target.canonical : pointOf(target.segments, proton);
35
- return [
36
- {
37
- context: target.context,
38
- point
39
- }
40
- ];
41
- }
42
- function priorityOf(draft) {
43
- const trimmed = draft.priority?.trim() ?? '';
44
- if ('' !== trimmed && Number.isInteger(Number(trimmed))) return {
45
- priority: Number(trimmed)
46
- };
47
- return {};
48
- }
49
- function bindingFields(draft) {
50
- const result = {};
51
- if (draft.attackRef) result.attack_ref = draft.attackRef;
52
- if (draft.targetRef) result.target_ref = draft.targetRef;
53
- if (draft.targetRole) result.target_role = draft.targetRole;
54
- return result;
55
- }
56
- function toProtonAction(draft, proton) {
57
- const target = targetToProton(draft.target, proton);
58
- switch(draft.kind){
59
- case 'raw':
60
- return draft.raw ?? {};
61
- case 'add_attack':
62
- {
63
- const action = {
64
- action_type: 'add_attack',
65
- target,
66
- attack: {
67
- attack_type: draft.attackType ?? ''
68
- },
69
- ...bindingFields(draft)
70
- };
71
- if (draft.comment?.trim()) action.attack.comment = draft.comment.trim();
72
- if (draft.known) action.attack.known = draft.known;
73
- if (draft.knownFalse) action.attack.known_false = draft.knownFalse;
74
- if (draft.experimental) action.experimental = true;
75
- return action;
76
- }
77
- case 'add_tag':
78
- {
79
- const action = {
80
- action_type: 'add_tag',
81
- target,
82
- tag: {
83
- key: draft.tagKey ?? '',
84
- value: draft.tagValue ?? ''
85
- },
86
- ...bindingFields(draft)
87
- };
88
- if (draft.experimental) action.experimental = true;
89
- return action;
90
- }
91
- case 'suppress_attack':
92
- {
93
- const action = {
94
- action_type: 'suppress_attack',
95
- target,
96
- ...bindingFields(draft)
97
- };
98
- if (draft.attackType?.trim()) action.attack = {
99
- attack_type: draft.attackType.trim()
100
- };
101
- return action;
102
- }
103
- case 'mark_attack':
104
- {
105
- const action = {
106
- action_type: 'mark_attack',
107
- target,
108
- ...bindingFields(draft)
109
- };
110
- if (void 0 !== draft.experimental) action.experimental = draft.experimental;
111
- if (draft.attackType?.trim() || draft.known || draft.knownFalse) {
112
- action.attack = {};
113
- if (draft.attackType?.trim()) action.attack.attack_type = draft.attackType.trim();
114
- if (draft.known) action.attack.known = draft.known;
115
- if (draft.knownFalse) action.attack.known_false = draft.knownFalse;
116
- }
117
- return action;
118
- }
119
- case 'combine':
120
- return {
121
- action_type: 'combine',
122
- target,
123
- separator: draft.separator ?? DEFAULT_SEPARATOR,
124
- ...bindingFields(draft)
125
- };
126
- case 'processing_time_limit':
127
- return {
128
- action_type: 'processing_time_limit',
129
- target: targetToProton(WHOLE_REQUEST, proton),
130
- limit: draft.limit?.trim() ?? '',
131
- ...priorityOf(draft)
132
- };
133
- case 'processing_space_limit':
134
- return {
135
- action_type: 'processing_space_limit',
136
- target: targetToProton(WHOLE_REQUEST, proton),
137
- limit: draft.limit?.trim() ?? '',
138
- ...priorityOf(draft)
139
- };
140
- case 'entry_limits':
141
- {
142
- const action = {
143
- action_type: 'entry_limits',
144
- target,
145
- ...priorityOf(draft),
146
- ...bindingFields(draft)
147
- };
148
- if (draft.softLimit?.trim()) action.entry_size_soft_limit = draft.softLimit.trim();
149
- if (draft.hardLimit?.trim()) action.entry_size_hard_limit = draft.hardLimit.trim();
150
- return action;
151
- }
152
- case 'disable_parsers':
153
- return {
154
- action_type: 'disable_parsers',
155
- target,
156
- parsers: draft.parsers ?? [],
157
- ...priorityOf(draft),
158
- ...bindingFields(draft)
159
- };
160
- case 'allow_parsers':
161
- return {
162
- action_type: 'allow_parsers',
163
- target,
164
- parsers: draft.parsers ?? [],
165
- ...priorityOf(draft),
166
- ...bindingFields(draft)
167
- };
168
- case 'force_parser':
169
- return {
170
- action_type: 'force_parser',
171
- target,
172
- parser: draft.parser ?? '',
173
- ...priorityOf(draft),
174
- ...bindingFields(draft)
175
- };
176
- case 'disable_rule':
177
- return {
178
- action_type: 'disable_rule',
179
- rule_ids: draft.ruleIds ?? []
180
- };
181
- default:
182
- return {
183
- action_type: 'unknown',
184
- target
185
- };
186
- }
187
- }
188
- function segmentsOfPoint(point, context, proton) {
189
- if (!point) return [];
190
- if (!proton) return [];
191
- try {
192
- const result = proton.point.parse(point);
193
- return result;
194
- } catch (error) {
195
- console.warn('Failed to parse canonical point string with SDK', {
196
- point,
197
- error: error instanceof Error ? error.message : String(error)
198
- });
199
- return [];
200
- }
201
- }
202
- function parseTarget(target, proton) {
203
- const context = target?.context ?? 'http_request';
204
- const point = target?.point ?? 'flow';
205
- if ('flow' === point) return WHOLE_REQUEST;
206
- const segments = segmentsOfPoint(point, context, proton);
207
- const currentVersion = proton ? proton.version().canonical : void 0;
208
- return {
209
- whole: false,
210
- context,
211
- segments,
212
- canonical: point,
213
- canonicalVersion: currentVersion
214
- };
215
- }
216
- const KNOWN_KINDS = [
217
- 'add_attack',
218
- 'add_tag',
219
- 'suppress_attack',
220
- 'mark_attack',
221
- 'combine',
222
- 'processing_time_limit',
223
- 'processing_space_limit',
224
- 'entry_limits',
225
- 'disable_parsers',
226
- 'allow_parsers',
227
- 'force_parser',
228
- 'disable_rule'
229
- ];
230
- function fromProtonAction(action, proton = null) {
231
- const obj = Array.isArray(action) ? action[0] : action;
232
- const raw = ()=>({
233
- ...newAction(),
234
- kind: 'raw',
235
- raw: obj ?? {}
236
- });
237
- if (!obj || 'object' != typeof obj) return raw();
238
- const kind = obj.action_type;
239
- if (!kind || !KNOWN_KINDS.includes(kind)) return raw();
240
- if ('disable_rule' === kind) {
241
- const ruleIds = Array.isArray(obj.rule_ids) ? obj.rule_ids : [];
242
- return {
243
- ...newAction(kind),
244
- ruleIds: ruleIds.map((id)=>String(id))
245
- };
246
- }
247
- if (!Array.isArray(obj.target) || 1 !== obj.target.length) return raw();
248
- const target = parseTarget(obj.target[0], proton);
249
- const attack = obj.attack ?? {};
250
- const tag = obj.tag ?? {};
251
- const draft = {
252
- ...newAction(kind),
253
- attackType: 'string' == typeof attack.attack_type ? attack.attack_type : '',
254
- comment: 'string' == typeof attack.comment ? attack.comment : '',
255
- experimental: true === obj.experimental,
256
- tagKey: tag.key ?? '',
257
- tagValue: tag.value ?? '',
258
- separator: 'string' == typeof obj.separator ? obj.separator : DEFAULT_SEPARATOR,
259
- limit: 'string' == typeof obj.limit ? obj.limit : '',
260
- softLimit: 'string' == typeof obj.entry_size_soft_limit ? obj.entry_size_soft_limit : '',
261
- hardLimit: 'string' == typeof obj.entry_size_hard_limit ? obj.entry_size_hard_limit : '',
262
- priority: 'number' == typeof obj.priority ? String(obj.priority) : '',
263
- target
264
- };
265
- if (attack.known && 'object' == typeof attack.known) draft.known = attack.known;
266
- if (void 0 !== attack.known_false) draft.knownFalse = attack.known_false;
267
- if ('string' == typeof obj.attack_ref) draft.attackRef = obj.attack_ref;
268
- if ('string' == typeof obj.target_ref) draft.targetRef = obj.target_ref;
269
- if ('string' == typeof obj.target_role) draft.targetRole = obj.target_role;
270
- if ('disable_parsers' === kind || 'allow_parsers' === kind) if ('string' == typeof obj.parsers) draft.parsers = obj.parsers;
271
- else if (Array.isArray(obj.parsers)) draft.parsers = obj.parsers.map((p)=>String(p));
272
- else draft.parsers = [];
273
- if ('force_parser' === kind) draft.parser = 'string' == typeof obj.parser ? obj.parser : '';
274
- return draft;
275
- }
276
- export { fromProtonAction, newAction, toProtonAction };
@@ -1,95 +0,0 @@
1
- /**
2
- * Condition Model
3
- *
4
- * Converts between UI tree structure and Proton API format.
5
- * Handles condition tree transformations, factory functions, and validation.
6
- */
7
- import type { Proton } from '@wallarm-org/rules-lib';
8
- import type { PointSelectorValue, RuleContext } from '../../PointSelector/types.js';
9
- import type { AttackCondition, FieldCondition, GroupCondition, GroupOperator, ProtonCondition, SampleCondition, SignalCondition, SignalType, TagCondition } from '../types.js';
10
- /**
11
- * Generate a unique ID for a condition node.
12
- *
13
- * @returns Unique node ID
14
- */
15
- export declare function nodeId(): string;
16
- /**
17
- * Empty PointSelector value for new field conditions.
18
- */
19
- export declare const EMPTY_FIELD_VALUE: PointSelectorValue;
20
- /**
21
- * Create a new field condition with default values.
22
- *
23
- * @param context - Rule context (default: 'http_request')
24
- * @returns New FieldCondition
25
- */
26
- export declare function newField(context?: RuleContext): FieldCondition;
27
- /**
28
- * Create a new attack condition with default values.
29
- *
30
- * @param attackType - Attack type (default: '')
31
- * @param point - Point where attack is detected (default: 'flow')
32
- * @returns New AttackCondition
33
- */
34
- export declare function newAttack(attackType?: string, point?: string): AttackCondition;
35
- /**
36
- * Create a new signal condition with default values.
37
- *
38
- * @param signalType - Signal type (default: '')
39
- * @param point - Point where signal is detected (default: '[http:header]')
40
- * @returns New SignalCondition
41
- */
42
- export declare function newSignal(signalType?: SignalType | '', point?: string): SignalCondition;
43
- /**
44
- * Create a new tag condition with default values.
45
- *
46
- * @param tagKey - Tag key (default: '')
47
- * @param tagValue - Tag value (default: '')
48
- * @param point - Point where tag is checked (default: 'flow')
49
- * @returns New TagCondition
50
- */
51
- export declare function newTag(tagKey?: string, tagValue?: string, point?: string): TagCondition;
52
- /**
53
- * Create a new sample condition with default values.
54
- *
55
- * @param percent - Percentage of flows to sample (default: 10)
56
- * @returns New SampleCondition
57
- */
58
- export declare function newSample(percent?: number): SampleCondition;
59
- /**
60
- * Create a new group condition with default values.
61
- *
62
- * @param operator - Group operator (default: 'and')
63
- * @returns New GroupCondition with one empty field
64
- */
65
- export declare function newGroup(operator?: GroupOperator): GroupCondition;
66
- /**
67
- * Check if a field condition is complete enough to serialize.
68
- *
69
- * @param condition - Field condition to check
70
- * @returns True if condition has segments, a condition type, and value if required
71
- */
72
- export declare function fieldComplete(condition: FieldCondition): boolean;
73
- /**
74
- * Convert UI condition tree to Proton API format.
75
- *
76
- * @param root - Root group condition
77
- * @param proton - Optional Proton SDK instance for canonical point rendering
78
- * @returns Proton condition or null if empty/incomplete
79
- */
80
- export declare function toProtonCondition(root: GroupCondition, proton?: Proton | null): ProtonCondition | null;
81
- /**
82
- * Convert Proton API format to UI condition tree.
83
- *
84
- * @param condition - Proton condition (null/undefined = empty tree)
85
- * @param proton - SDK instance for parsing point strings (optional)
86
- * @returns Group condition (always returns a group, even if empty)
87
- */
88
- export declare function fromProtonCondition(condition: unknown, proton?: Proton | null): GroupCondition;
89
- /**
90
- * Validate a condition tree and return problems.
91
- *
92
- * @param root - Root group condition
93
- * @returns Array of problem descriptions (empty if valid)
94
- */
95
- export declare function conditionProblems(root: GroupCondition): string[];