@principal-ai/principal-view-core 0.5.6
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/README.md +126 -0
- package/dist/ConfigurationLoader.d.ts +76 -0
- package/dist/ConfigurationLoader.d.ts.map +1 -0
- package/dist/ConfigurationLoader.js +144 -0
- package/dist/ConfigurationLoader.js.map +1 -0
- package/dist/ConfigurationValidator.d.ts +31 -0
- package/dist/ConfigurationValidator.d.ts.map +1 -0
- package/dist/ConfigurationValidator.js +242 -0
- package/dist/ConfigurationValidator.js.map +1 -0
- package/dist/EventProcessor.d.ts +49 -0
- package/dist/EventProcessor.d.ts.map +1 -0
- package/dist/EventProcessor.js +215 -0
- package/dist/EventProcessor.js.map +1 -0
- package/dist/EventRecorderService.d.ts +305 -0
- package/dist/EventRecorderService.d.ts.map +1 -0
- package/dist/EventRecorderService.js +463 -0
- package/dist/EventRecorderService.js.map +1 -0
- package/dist/LibraryLoader.d.ts +63 -0
- package/dist/LibraryLoader.d.ts.map +1 -0
- package/dist/LibraryLoader.js +188 -0
- package/dist/LibraryLoader.js.map +1 -0
- package/dist/PathBasedEventProcessor.d.ts +90 -0
- package/dist/PathBasedEventProcessor.d.ts.map +1 -0
- package/dist/PathBasedEventProcessor.js +239 -0
- package/dist/PathBasedEventProcessor.js.map +1 -0
- package/dist/SessionManager.d.ts +194 -0
- package/dist/SessionManager.d.ts.map +1 -0
- package/dist/SessionManager.js +299 -0
- package/dist/SessionManager.js.map +1 -0
- package/dist/ValidationEngine.d.ts +31 -0
- package/dist/ValidationEngine.d.ts.map +1 -0
- package/dist/ValidationEngine.js +158 -0
- package/dist/ValidationEngine.js.map +1 -0
- package/dist/helpers/GraphInstrumentationHelper.d.ts +93 -0
- package/dist/helpers/GraphInstrumentationHelper.d.ts.map +1 -0
- package/dist/helpers/GraphInstrumentationHelper.js +248 -0
- package/dist/helpers/GraphInstrumentationHelper.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/config.d.ts +57 -0
- package/dist/rules/config.d.ts.map +1 -0
- package/dist/rules/config.js +382 -0
- package/dist/rules/config.js.map +1 -0
- package/dist/rules/engine.d.ts +70 -0
- package/dist/rules/engine.d.ts.map +1 -0
- package/dist/rules/engine.js +252 -0
- package/dist/rules/engine.js.map +1 -0
- package/dist/rules/implementations/connection-type-references.d.ts +7 -0
- package/dist/rules/implementations/connection-type-references.d.ts.map +1 -0
- package/dist/rules/implementations/connection-type-references.js +104 -0
- package/dist/rules/implementations/connection-type-references.js.map +1 -0
- package/dist/rules/implementations/dead-end-states.d.ts +17 -0
- package/dist/rules/implementations/dead-end-states.d.ts.map +1 -0
- package/dist/rules/implementations/dead-end-states.js +72 -0
- package/dist/rules/implementations/dead-end-states.js.map +1 -0
- package/dist/rules/implementations/index.d.ts +24 -0
- package/dist/rules/implementations/index.d.ts.map +1 -0
- package/dist/rules/implementations/index.js +62 -0
- package/dist/rules/implementations/index.js.map +1 -0
- package/dist/rules/implementations/library-node-type-match.d.ts +17 -0
- package/dist/rules/implementations/library-node-type-match.d.ts.map +1 -0
- package/dist/rules/implementations/library-node-type-match.js +123 -0
- package/dist/rules/implementations/library-node-type-match.js.map +1 -0
- package/dist/rules/implementations/minimum-node-sources.d.ts +22 -0
- package/dist/rules/implementations/minimum-node-sources.d.ts.map +1 -0
- package/dist/rules/implementations/minimum-node-sources.js +54 -0
- package/dist/rules/implementations/minimum-node-sources.js.map +1 -0
- package/dist/rules/implementations/no-unknown-fields.d.ts +7 -0
- package/dist/rules/implementations/no-unknown-fields.d.ts.map +1 -0
- package/dist/rules/implementations/no-unknown-fields.js +211 -0
- package/dist/rules/implementations/no-unknown-fields.js.map +1 -0
- package/dist/rules/implementations/orphaned-edge-types.d.ts +7 -0
- package/dist/rules/implementations/orphaned-edge-types.d.ts.map +1 -0
- package/dist/rules/implementations/orphaned-edge-types.js +47 -0
- package/dist/rules/implementations/orphaned-edge-types.js.map +1 -0
- package/dist/rules/implementations/orphaned-node-types.d.ts +7 -0
- package/dist/rules/implementations/orphaned-node-types.d.ts.map +1 -0
- package/dist/rules/implementations/orphaned-node-types.js +50 -0
- package/dist/rules/implementations/orphaned-node-types.js.map +1 -0
- package/dist/rules/implementations/required-metadata.d.ts +7 -0
- package/dist/rules/implementations/required-metadata.d.ts.map +1 -0
- package/dist/rules/implementations/required-metadata.js +57 -0
- package/dist/rules/implementations/required-metadata.js.map +1 -0
- package/dist/rules/implementations/state-transition-references.d.ts +7 -0
- package/dist/rules/implementations/state-transition-references.d.ts.map +1 -0
- package/dist/rules/implementations/state-transition-references.js +135 -0
- package/dist/rules/implementations/state-transition-references.js.map +1 -0
- package/dist/rules/implementations/unreachable-states.d.ts +7 -0
- package/dist/rules/implementations/unreachable-states.d.ts.map +1 -0
- package/dist/rules/implementations/unreachable-states.js +80 -0
- package/dist/rules/implementations/unreachable-states.js.map +1 -0
- package/dist/rules/implementations/valid-action-patterns.d.ts +17 -0
- package/dist/rules/implementations/valid-action-patterns.d.ts.map +1 -0
- package/dist/rules/implementations/valid-action-patterns.js +109 -0
- package/dist/rules/implementations/valid-action-patterns.js.map +1 -0
- package/dist/rules/implementations/valid-color-format.d.ts +7 -0
- package/dist/rules/implementations/valid-color-format.d.ts.map +1 -0
- package/dist/rules/implementations/valid-color-format.js +91 -0
- package/dist/rules/implementations/valid-color-format.js.map +1 -0
- package/dist/rules/implementations/valid-edge-types.d.ts +7 -0
- package/dist/rules/implementations/valid-edge-types.d.ts.map +1 -0
- package/dist/rules/implementations/valid-edge-types.js +244 -0
- package/dist/rules/implementations/valid-edge-types.js.map +1 -0
- package/dist/rules/implementations/valid-node-types.d.ts +7 -0
- package/dist/rules/implementations/valid-node-types.d.ts.map +1 -0
- package/dist/rules/implementations/valid-node-types.js +175 -0
- package/dist/rules/implementations/valid-node-types.js.map +1 -0
- package/dist/rules/index.d.ts +28 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +45 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/types.d.ts +309 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +35 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/types/canvas.d.ts +409 -0
- package/dist/types/canvas.d.ts.map +1 -0
- package/dist/types/canvas.js +70 -0
- package/dist/types/canvas.js.map +1 -0
- package/dist/types/index.d.ts +311 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/library.d.ts +185 -0
- package/dist/types/library.d.ts.map +1 -0
- package/dist/types/library.js +15 -0
- package/dist/types/library.js.map +1 -0
- package/dist/types/path-based-config.d.ts +230 -0
- package/dist/types/path-based-config.d.ts.map +1 -0
- package/dist/types/path-based-config.js +9 -0
- package/dist/types/path-based-config.js.map +1 -0
- package/dist/utils/CanvasConverter.d.ts +118 -0
- package/dist/utils/CanvasConverter.d.ts.map +1 -0
- package/dist/utils/CanvasConverter.js +315 -0
- package/dist/utils/CanvasConverter.js.map +1 -0
- package/dist/utils/GraphConverter.d.ts +18 -0
- package/dist/utils/GraphConverter.d.ts.map +1 -0
- package/dist/utils/GraphConverter.js +61 -0
- package/dist/utils/GraphConverter.js.map +1 -0
- package/dist/utils/LibraryConverter.d.ts +113 -0
- package/dist/utils/LibraryConverter.d.ts.map +1 -0
- package/dist/utils/LibraryConverter.js +166 -0
- package/dist/utils/LibraryConverter.js.map +1 -0
- package/dist/utils/PathMatcher.d.ts +55 -0
- package/dist/utils/PathMatcher.d.ts.map +1 -0
- package/dist/utils/PathMatcher.js +172 -0
- package/dist/utils/PathMatcher.js.map +1 -0
- package/dist/utils/YamlParser.d.ts +36 -0
- package/dist/utils/YamlParser.d.ts.map +1 -0
- package/dist/utils/YamlParser.js +63 -0
- package/dist/utils/YamlParser.js.map +1 -0
- package/package.json +47 -0
- package/src/ConfigurationLoader.test.ts +490 -0
- package/src/ConfigurationLoader.ts +185 -0
- package/src/ConfigurationValidator.test.ts +200 -0
- package/src/ConfigurationValidator.ts +283 -0
- package/src/EventProcessor.test.ts +405 -0
- package/src/EventProcessor.ts +250 -0
- package/src/EventRecorderService.test.ts +541 -0
- package/src/EventRecorderService.ts +744 -0
- package/src/LibraryLoader.ts +215 -0
- package/src/PathBasedEventProcessor.test.ts +567 -0
- package/src/PathBasedEventProcessor.ts +332 -0
- package/src/SessionManager.test.ts +424 -0
- package/src/SessionManager.ts +470 -0
- package/src/ValidationEngine.test.ts +371 -0
- package/src/ValidationEngine.ts +196 -0
- package/src/helpers/GraphInstrumentationHelper.test.ts +340 -0
- package/src/helpers/GraphInstrumentationHelper.ts +326 -0
- package/src/index.ts +85 -0
- package/src/rules/config.test.ts +278 -0
- package/src/rules/config.ts +459 -0
- package/src/rules/engine.test.ts +332 -0
- package/src/rules/engine.ts +318 -0
- package/src/rules/implementations/connection-type-references.ts +117 -0
- package/src/rules/implementations/dead-end-states.ts +101 -0
- package/src/rules/implementations/index.ts +73 -0
- package/src/rules/implementations/library-node-type-match.ts +148 -0
- package/src/rules/implementations/minimum-node-sources.ts +82 -0
- package/src/rules/implementations/no-unknown-fields.ts +342 -0
- package/src/rules/implementations/orphaned-edge-types.ts +55 -0
- package/src/rules/implementations/orphaned-node-types.ts +58 -0
- package/src/rules/implementations/required-metadata.ts +64 -0
- package/src/rules/implementations/state-transition-references.ts +151 -0
- package/src/rules/implementations/unreachable-states.ts +94 -0
- package/src/rules/implementations/valid-action-patterns.ts +136 -0
- package/src/rules/implementations/valid-color-format.ts +140 -0
- package/src/rules/implementations/valid-edge-types.ts +258 -0
- package/src/rules/implementations/valid-node-types.ts +189 -0
- package/src/rules/index.ts +95 -0
- package/src/rules/types.ts +426 -0
- package/src/types/canvas.ts +496 -0
- package/src/types/index.ts +382 -0
- package/src/types/library.ts +233 -0
- package/src/types/path-based-config.ts +281 -0
- package/src/utils/CanvasConverter.ts +431 -0
- package/src/utils/GraphConverter.test.ts +195 -0
- package/src/utils/GraphConverter.ts +71 -0
- package/src/utils/LibraryConverter.ts +245 -0
- package/src/utils/PathMatcher.test.ts +148 -0
- package/src/utils/PathMatcher.ts +183 -0
- package/src/utils/YamlParser.ts +75 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules Engine Type Definitions
|
|
3
|
+
* Provides types for configuration validation rules
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Severity levels following ESLint convention
|
|
7
|
+
* - "off" or 0: Disable rule
|
|
8
|
+
* - "warn" or 1: Warning (doesn't affect exit code)
|
|
9
|
+
* - "error" or 2: Error (exit code 1)
|
|
10
|
+
*/
|
|
11
|
+
export type RuleSeverity = 'off' | 'warn' | 'error' | 0 | 1 | 2;
|
|
12
|
+
/**
|
|
13
|
+
* Normalized severity (string form only)
|
|
14
|
+
*/
|
|
15
|
+
export type NormalizedSeverity = 'off' | 'warn' | 'error';
|
|
16
|
+
/**
|
|
17
|
+
* Rule categories for grouping and filtering
|
|
18
|
+
*/
|
|
19
|
+
export type RuleCategory = 'schema' | 'reference' | 'structure' | 'pattern' | 'library';
|
|
20
|
+
/**
|
|
21
|
+
* Full rule configuration object
|
|
22
|
+
*/
|
|
23
|
+
export interface RuleConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Rule severity
|
|
26
|
+
* @default "error"
|
|
27
|
+
*/
|
|
28
|
+
severity?: RuleSeverity;
|
|
29
|
+
/**
|
|
30
|
+
* Rule-specific options
|
|
31
|
+
*/
|
|
32
|
+
options?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* VGC Configuration file schema
|
|
36
|
+
*/
|
|
37
|
+
export interface PrivuConfig {
|
|
38
|
+
/**
|
|
39
|
+
* Schema version for forward compatibility
|
|
40
|
+
*/
|
|
41
|
+
$schema?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Extend from a shared configuration
|
|
44
|
+
* Can be a package name or relative path
|
|
45
|
+
*/
|
|
46
|
+
extends?: string | string[];
|
|
47
|
+
/**
|
|
48
|
+
* Root flag - stop searching parent directories
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
root?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Path to default component library
|
|
54
|
+
* Used by library-node-type-match rule
|
|
55
|
+
*/
|
|
56
|
+
library?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Glob patterns for configuration files to lint
|
|
59
|
+
* @default [".vgc/**\/*.yaml", ".vgc/**\/*.yml", ".vgc/**\/*.json"]
|
|
60
|
+
*/
|
|
61
|
+
include?: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Glob patterns to exclude from linting
|
|
64
|
+
* @default ["**\/node_modules/**", "**\/*.test.*"]
|
|
65
|
+
*/
|
|
66
|
+
exclude?: string[];
|
|
67
|
+
/**
|
|
68
|
+
* Rule configurations
|
|
69
|
+
*/
|
|
70
|
+
rules?: {
|
|
71
|
+
[ruleId: string]: RuleConfig | RuleSeverity | false;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Rule-specific options type (varies per rule)
|
|
76
|
+
*/
|
|
77
|
+
export type RuleOptions = Record<string, unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* Definition of a validation rule
|
|
80
|
+
*/
|
|
81
|
+
export interface GraphRule<TOptions extends RuleOptions = RuleOptions> {
|
|
82
|
+
/**
|
|
83
|
+
* Unique rule identifier (kebab-case)
|
|
84
|
+
*/
|
|
85
|
+
id: string;
|
|
86
|
+
/**
|
|
87
|
+
* Human-readable rule name
|
|
88
|
+
*/
|
|
89
|
+
name: string;
|
|
90
|
+
/**
|
|
91
|
+
* Brief description of what the rule checks
|
|
92
|
+
*/
|
|
93
|
+
description: string;
|
|
94
|
+
/**
|
|
95
|
+
* Explanation of why this rule matters
|
|
96
|
+
*/
|
|
97
|
+
impact: string;
|
|
98
|
+
/**
|
|
99
|
+
* Default severity level
|
|
100
|
+
* @default "error"
|
|
101
|
+
*/
|
|
102
|
+
severity: NormalizedSeverity;
|
|
103
|
+
/**
|
|
104
|
+
* Rule category for grouping
|
|
105
|
+
*/
|
|
106
|
+
category: RuleCategory;
|
|
107
|
+
/**
|
|
108
|
+
* Whether the rule is enabled by default
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the rule supports auto-fix
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
fixable: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Default options for this rule
|
|
119
|
+
*/
|
|
120
|
+
defaultOptions?: TOptions;
|
|
121
|
+
/**
|
|
122
|
+
* Execute the rule check
|
|
123
|
+
*/
|
|
124
|
+
check: (context: GraphRuleContext<TOptions>) => Promise<GraphRuleViolation[]>;
|
|
125
|
+
/**
|
|
126
|
+
* Optional auto-fix implementation
|
|
127
|
+
*/
|
|
128
|
+
fix?: (violation: GraphRuleViolation, context: GraphRuleContext<TOptions>) => Promise<FixResult>;
|
|
129
|
+
}
|
|
130
|
+
import type { GraphConfiguration } from '../types';
|
|
131
|
+
import type { ComponentLibrary } from '../types/library';
|
|
132
|
+
/**
|
|
133
|
+
* Context passed to rules during evaluation
|
|
134
|
+
*/
|
|
135
|
+
export interface GraphRuleContext<TOptions extends RuleOptions = RuleOptions> {
|
|
136
|
+
/**
|
|
137
|
+
* The configuration being validated
|
|
138
|
+
*/
|
|
139
|
+
configuration: GraphConfiguration;
|
|
140
|
+
/**
|
|
141
|
+
* Optional component library for library rules
|
|
142
|
+
*/
|
|
143
|
+
library?: ComponentLibrary;
|
|
144
|
+
/**
|
|
145
|
+
* Path to the configuration file (for error reporting)
|
|
146
|
+
*/
|
|
147
|
+
configPath?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Path to the library file (for error reporting)
|
|
150
|
+
*/
|
|
151
|
+
libraryPath?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Raw YAML/JSON string (for line number lookup)
|
|
154
|
+
*/
|
|
155
|
+
rawContent?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Rule-specific options (merged with defaults)
|
|
158
|
+
*/
|
|
159
|
+
options: TOptions;
|
|
160
|
+
/**
|
|
161
|
+
* All rule options from config (for cross-rule access if needed)
|
|
162
|
+
*/
|
|
163
|
+
allRuleOptions?: Map<string, RuleOptions>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A violation detected by a rule
|
|
167
|
+
*/
|
|
168
|
+
export interface GraphRuleViolation {
|
|
169
|
+
/**
|
|
170
|
+
* ID of the rule that detected this violation
|
|
171
|
+
*/
|
|
172
|
+
ruleId: string;
|
|
173
|
+
/**
|
|
174
|
+
* Severity of this violation
|
|
175
|
+
*/
|
|
176
|
+
severity: NormalizedSeverity;
|
|
177
|
+
/**
|
|
178
|
+
* Path to the file containing the violation
|
|
179
|
+
*/
|
|
180
|
+
file?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Line number in the file (1-indexed)
|
|
183
|
+
*/
|
|
184
|
+
line?: number;
|
|
185
|
+
/**
|
|
186
|
+
* Column number in the file (1-indexed)
|
|
187
|
+
*/
|
|
188
|
+
column?: number;
|
|
189
|
+
/**
|
|
190
|
+
* JSON path to the problematic field (e.g., "nodeTypes.service.shape")
|
|
191
|
+
*/
|
|
192
|
+
path?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Clear, actionable error message
|
|
195
|
+
*/
|
|
196
|
+
message: string;
|
|
197
|
+
/**
|
|
198
|
+
* Explanation of why this matters
|
|
199
|
+
*/
|
|
200
|
+
impact: string;
|
|
201
|
+
/**
|
|
202
|
+
* Suggestion for how to fix
|
|
203
|
+
*/
|
|
204
|
+
suggestion?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Whether this violation can be auto-fixed
|
|
207
|
+
*/
|
|
208
|
+
fixable: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Data needed for auto-fix
|
|
211
|
+
*/
|
|
212
|
+
fixData?: Record<string, unknown>;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Result of running all rules
|
|
216
|
+
*/
|
|
217
|
+
export interface GraphLintResult {
|
|
218
|
+
/**
|
|
219
|
+
* All violations found
|
|
220
|
+
*/
|
|
221
|
+
violations: GraphRuleViolation[];
|
|
222
|
+
/**
|
|
223
|
+
* Count of error-level violations
|
|
224
|
+
*/
|
|
225
|
+
errorCount: number;
|
|
226
|
+
/**
|
|
227
|
+
* Count of warning-level violations
|
|
228
|
+
*/
|
|
229
|
+
warningCount: number;
|
|
230
|
+
/**
|
|
231
|
+
* Count of fixable violations
|
|
232
|
+
*/
|
|
233
|
+
fixableCount: number;
|
|
234
|
+
/**
|
|
235
|
+
* Violations grouped by category
|
|
236
|
+
*/
|
|
237
|
+
byCategory: Record<RuleCategory, number>;
|
|
238
|
+
/**
|
|
239
|
+
* Violations grouped by rule ID
|
|
240
|
+
*/
|
|
241
|
+
byRule: Record<string, number>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Result of attempting to fix a violation
|
|
245
|
+
*/
|
|
246
|
+
export interface FixResult {
|
|
247
|
+
/**
|
|
248
|
+
* Whether the fix was successful
|
|
249
|
+
*/
|
|
250
|
+
success: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Description of what was fixed
|
|
253
|
+
*/
|
|
254
|
+
message?: string;
|
|
255
|
+
/**
|
|
256
|
+
* New content after fix (if applicable)
|
|
257
|
+
*/
|
|
258
|
+
newContent?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Error message if fix failed
|
|
261
|
+
*/
|
|
262
|
+
error?: string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Options for the lint operation
|
|
266
|
+
*/
|
|
267
|
+
export interface LintOptions {
|
|
268
|
+
/**
|
|
269
|
+
* Only run these rules (by ID)
|
|
270
|
+
*/
|
|
271
|
+
enabledRules?: string[];
|
|
272
|
+
/**
|
|
273
|
+
* Skip these rules (by ID)
|
|
274
|
+
*/
|
|
275
|
+
disabledRules?: string[];
|
|
276
|
+
/**
|
|
277
|
+
* Override severity for specific rules
|
|
278
|
+
*/
|
|
279
|
+
severityOverrides?: Map<string, NormalizedSeverity>;
|
|
280
|
+
/**
|
|
281
|
+
* Component library for library rules
|
|
282
|
+
*/
|
|
283
|
+
library?: ComponentLibrary;
|
|
284
|
+
/**
|
|
285
|
+
* Path to config file (for error reporting)
|
|
286
|
+
*/
|
|
287
|
+
configPath?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Path to library file (for error reporting)
|
|
290
|
+
*/
|
|
291
|
+
libraryPath?: string;
|
|
292
|
+
/**
|
|
293
|
+
* Raw content for line number reporting
|
|
294
|
+
*/
|
|
295
|
+
rawContent?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Rule-specific options
|
|
298
|
+
*/
|
|
299
|
+
ruleOptions?: Map<string, RuleOptions>;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Normalize severity to string form
|
|
303
|
+
*/
|
|
304
|
+
export declare function normalizeSeverity(severity: RuleSeverity): NormalizedSeverity;
|
|
305
|
+
/**
|
|
306
|
+
* Check if a severity means the rule is disabled
|
|
307
|
+
*/
|
|
308
|
+
export declare function isRuleDisabled(severity: RuleSeverity | false | undefined): boolean;
|
|
309
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/rules/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,S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AEpB;;OAEG;IACH,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACxC;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,kBAAkB,CAc5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAKlF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules Engine Type Definitions
|
|
3
|
+
* Provides types for configuration validation rules
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Utility Types
|
|
7
|
+
// ============================================================================
|
|
8
|
+
/**
|
|
9
|
+
* Normalize severity to string form
|
|
10
|
+
*/
|
|
11
|
+
export function normalizeSeverity(severity) {
|
|
12
|
+
if (typeof severity === 'number') {
|
|
13
|
+
switch (severity) {
|
|
14
|
+
case 0:
|
|
15
|
+
return 'off';
|
|
16
|
+
case 1:
|
|
17
|
+
return 'warn';
|
|
18
|
+
case 2:
|
|
19
|
+
return 'error';
|
|
20
|
+
default:
|
|
21
|
+
return 'error';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return severity;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check if a severity means the rule is disabled
|
|
28
|
+
*/
|
|
29
|
+
export function isRuleDisabled(severity) {
|
|
30
|
+
if (severity === false || severity === 'off' || severity === 0) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/rules/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuYH,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAsB;IACtD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,CAAC;gBACJ,OAAO,KAAK,CAAC;YACf,KAAK,CAAC;gBACJ,OAAO,MAAM,CAAC;YAChB,KAAK,CAAC;gBACJ,OAAO,OAAO,CAAC;YACjB;gBACE,OAAO,OAAO,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAA0C;IACvE,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|