driftdetect-galaxy 0.4.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.
- package/dist/audio/index.d.ts +8 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +8 -0
- package/dist/audio/index.js.map +1 -0
- package/dist/audio/sound-effects.d.ts +78 -0
- package/dist/audio/sound-effects.d.ts.map +1 -0
- package/dist/audio/sound-effects.js +660 -0
- package/dist/audio/sound-effects.js.map +1 -0
- package/dist/audio/useGalaxySound.d.ts +70 -0
- package/dist/audio/useGalaxySound.d.ts.map +1 -0
- package/dist/audio/useGalaxySound.js +127 -0
- package/dist/audio/useGalaxySound.js.map +1 -0
- package/dist/components/canvas/GalaxyCamera.d.ts +16 -0
- package/dist/components/canvas/GalaxyCamera.d.ts.map +1 -0
- package/dist/components/canvas/GalaxyCamera.js +74 -0
- package/dist/components/canvas/GalaxyCamera.js.map +1 -0
- package/dist/components/canvas/GalaxyCanvas.d.ts +16 -0
- package/dist/components/canvas/GalaxyCanvas.d.ts.map +1 -0
- package/dist/components/canvas/GalaxyCanvas.js +104 -0
- package/dist/components/canvas/GalaxyCanvas.js.map +1 -0
- package/dist/components/canvas/GalaxyLighting.d.ts +8 -0
- package/dist/components/canvas/GalaxyLighting.d.ts.map +1 -0
- package/dist/components/canvas/GalaxyLighting.js +36 -0
- package/dist/components/canvas/GalaxyLighting.js.map +1 -0
- package/dist/components/canvas/index.d.ts +11 -0
- package/dist/components/canvas/index.d.ts.map +1 -0
- package/dist/components/canvas/index.js +9 -0
- package/dist/components/canvas/index.js.map +1 -0
- package/dist/components/connections/DataPathLane.d.ts +26 -0
- package/dist/components/connections/DataPathLane.d.ts.map +1 -0
- package/dist/components/connections/DataPathLane.js +71 -0
- package/dist/components/connections/DataPathLane.js.map +1 -0
- package/dist/components/connections/TableRelationship.d.ts +19 -0
- package/dist/components/connections/TableRelationship.d.ts.map +1 -0
- package/dist/components/connections/TableRelationship.js +46 -0
- package/dist/components/connections/TableRelationship.js.map +1 -0
- package/dist/components/connections/index.d.ts +10 -0
- package/dist/components/connections/index.d.ts.map +1 -0
- package/dist/components/connections/index.js +8 -0
- package/dist/components/connections/index.js.map +1 -0
- package/dist/components/effects/AccessPulse.d.ts +23 -0
- package/dist/components/effects/AccessPulse.d.ts.map +1 -0
- package/dist/components/effects/AccessPulse.js +72 -0
- package/dist/components/effects/AccessPulse.js.map +1 -0
- package/dist/components/effects/GalaxyBloom.d.ts +8 -0
- package/dist/components/effects/GalaxyBloom.d.ts.map +1 -0
- package/dist/components/effects/GalaxyBloom.js +23 -0
- package/dist/components/effects/GalaxyBloom.js.map +1 -0
- package/dist/components/effects/StarField.d.ts +18 -0
- package/dist/components/effects/StarField.d.ts.map +1 -0
- package/dist/components/effects/StarField.js +86 -0
- package/dist/components/effects/StarField.js.map +1 -0
- package/dist/components/effects/index.d.ts +11 -0
- package/dist/components/effects/index.d.ts.map +1 -0
- package/dist/components/effects/index.js +9 -0
- package/dist/components/effects/index.js.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +16 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/nodes/EntryPointStation.d.ts +22 -0
- package/dist/components/nodes/EntryPointStation.d.ts.map +1 -0
- package/dist/components/nodes/EntryPointStation.js +120 -0
- package/dist/components/nodes/EntryPointStation.js.map +1 -0
- package/dist/components/nodes/FieldMoon.d.ts +30 -0
- package/dist/components/nodes/FieldMoon.d.ts.map +1 -0
- package/dist/components/nodes/FieldMoon.js +92 -0
- package/dist/components/nodes/FieldMoon.js.map +1 -0
- package/dist/components/nodes/TablePlanet.d.ts +22 -0
- package/dist/components/nodes/TablePlanet.d.ts.map +1 -0
- package/dist/components/nodes/TablePlanet.js +101 -0
- package/dist/components/nodes/TablePlanet.js.map +1 -0
- package/dist/components/nodes/index.d.ts +12 -0
- package/dist/components/nodes/index.d.ts.map +1 -0
- package/dist/components/nodes/index.js +9 -0
- package/dist/components/nodes/index.js.map +1 -0
- package/dist/components/ui/ControlsPanel.d.ts +7 -0
- package/dist/components/ui/ControlsPanel.d.ts.map +1 -0
- package/dist/components/ui/ControlsPanel.js +59 -0
- package/dist/components/ui/ControlsPanel.js.map +1 -0
- package/dist/components/ui/DetailsPanel.d.ts +8 -0
- package/dist/components/ui/DetailsPanel.d.ts.map +1 -0
- package/dist/components/ui/DetailsPanel.js +44 -0
- package/dist/components/ui/DetailsPanel.js.map +1 -0
- package/dist/components/ui/SearchOverlay.d.ts +7 -0
- package/dist/components/ui/SearchOverlay.d.ts.map +1 -0
- package/dist/components/ui/SearchOverlay.js +68 -0
- package/dist/components/ui/SearchOverlay.js.map +1 -0
- package/dist/components/ui/SecurityPanel.d.ts +8 -0
- package/dist/components/ui/SecurityPanel.d.ts.map +1 -0
- package/dist/components/ui/SecurityPanel.js +65 -0
- package/dist/components/ui/SecurityPanel.js.map +1 -0
- package/dist/components/ui/StatsOverlay.d.ts +7 -0
- package/dist/components/ui/StatsOverlay.d.ts.map +1 -0
- package/dist/components/ui/StatsOverlay.js +29 -0
- package/dist/components/ui/StatsOverlay.js.map +1 -0
- package/dist/components/ui/index.d.ts +11 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +11 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/constants/index.d.ts +244 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +289 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAccessStream.d.ts +23 -0
- package/dist/hooks/useAccessStream.d.ts.map +1 -0
- package/dist/hooks/useAccessStream.js +86 -0
- package/dist/hooks/useAccessStream.js.map +1 -0
- package/dist/hooks/useGalaxyData.d.ts +83 -0
- package/dist/hooks/useGalaxyData.d.ts.map +1 -0
- package/dist/hooks/useGalaxyData.js +176 -0
- package/dist/hooks/useGalaxyData.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/store/galaxy-store.d.ts +85 -0
- package/dist/store/galaxy-store.d.ts.map +1 -0
- package/dist/store/galaxy-store.js +254 -0
- package/dist/store/galaxy-store.js.map +1 -0
- package/dist/store/index.d.ts +5 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +5 -0
- package/dist/store/index.js.map +1 -0
- package/dist/types/index.d.ts +337 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/color-utils.d.ts +100 -0
- package/dist/utils/color-utils.d.ts.map +1 -0
- package/dist/utils/color-utils.js +217 -0
- package/dist/utils/color-utils.js.map +1 -0
- package/dist/utils/geometry-utils.d.ts +97 -0
- package/dist/utils/geometry-utils.d.ts.map +1 -0
- package/dist/utils/geometry-utils.js +245 -0
- package/dist/utils/geometry-utils.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/layout-engine.d.ts +40 -0
- package/dist/utils/layout-engine.d.ts.map +1 -0
- package/dist/utils/layout-engine.js +343 -0
- package/dist/utils/layout-engine.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Galaxy Visualization Types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for the 3D database galaxy visualization.
|
|
5
|
+
* All types are immutable and follow strict typing conventions.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Data sensitivity classification levels
|
|
9
|
+
*/
|
|
10
|
+
export type SensitivityLevel = 'critical' | 'high' | 'medium' | 'low' | 'public';
|
|
11
|
+
/**
|
|
12
|
+
* Security priority tiers (P0 = most critical)
|
|
13
|
+
*/
|
|
14
|
+
export type SecurityTier = 'P0' | 'P1' | 'P2' | 'P3' | 'P4';
|
|
15
|
+
/**
|
|
16
|
+
* Data operation types
|
|
17
|
+
*/
|
|
18
|
+
export type DataOperation = 'read' | 'write' | 'delete' | 'unknown';
|
|
19
|
+
/**
|
|
20
|
+
* Authentication level for entry points
|
|
21
|
+
*/
|
|
22
|
+
export type AuthLevel = 'public' | 'authenticated' | 'admin' | 'internal';
|
|
23
|
+
/**
|
|
24
|
+
* A database table represented as a planet in the galaxy
|
|
25
|
+
*/
|
|
26
|
+
export interface TableNode {
|
|
27
|
+
/** Unique identifier */
|
|
28
|
+
readonly id: string;
|
|
29
|
+
/** Table name */
|
|
30
|
+
readonly name: string;
|
|
31
|
+
/** Schema/database name if applicable */
|
|
32
|
+
readonly schema?: string;
|
|
33
|
+
/** Estimated row count (affects size) */
|
|
34
|
+
readonly rowCount: number;
|
|
35
|
+
/** Access frequency (affects importance) */
|
|
36
|
+
readonly accessCount: number;
|
|
37
|
+
/** Highest sensitivity level of any field */
|
|
38
|
+
readonly sensitivity: SensitivityLevel;
|
|
39
|
+
/** Security tier based on data exposure */
|
|
40
|
+
readonly securityTier: SecurityTier;
|
|
41
|
+
/** Fields in this table */
|
|
42
|
+
readonly fields: readonly FieldNode[];
|
|
43
|
+
/** 3D position in galaxy (computed by layout engine) */
|
|
44
|
+
position?: Vector3D;
|
|
45
|
+
/** Domain cluster this table belongs to */
|
|
46
|
+
readonly cluster?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A database field represented as a moon orbiting a table
|
|
50
|
+
*/
|
|
51
|
+
export interface FieldNode {
|
|
52
|
+
/** Unique identifier */
|
|
53
|
+
readonly id: string;
|
|
54
|
+
/** Field/column name */
|
|
55
|
+
readonly name: string;
|
|
56
|
+
/** Parent table ID */
|
|
57
|
+
readonly tableId: string;
|
|
58
|
+
/** Data type */
|
|
59
|
+
readonly dataType: string;
|
|
60
|
+
/** Sensitivity classification */
|
|
61
|
+
readonly sensitivity: SensitivityLevel;
|
|
62
|
+
/** Is this a primary key */
|
|
63
|
+
readonly isPrimaryKey: boolean;
|
|
64
|
+
/** Is this a foreign key */
|
|
65
|
+
readonly isForeignKey: boolean;
|
|
66
|
+
/** Foreign key target if applicable */
|
|
67
|
+
readonly foreignKeyTarget?: string;
|
|
68
|
+
/** Access count for this specific field */
|
|
69
|
+
readonly accessCount: number;
|
|
70
|
+
/** Is this field tested */
|
|
71
|
+
readonly isTested: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* An API entry point represented as a space station
|
|
75
|
+
*/
|
|
76
|
+
export interface EntryPointNode {
|
|
77
|
+
/** Unique identifier */
|
|
78
|
+
readonly id: string;
|
|
79
|
+
/** Route path (e.g., /api/users) */
|
|
80
|
+
readonly path: string;
|
|
81
|
+
/** HTTP method */
|
|
82
|
+
readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'ALL';
|
|
83
|
+
/** Authentication level required */
|
|
84
|
+
readonly authLevel: AuthLevel;
|
|
85
|
+
/** Security tier */
|
|
86
|
+
readonly securityTier: SecurityTier;
|
|
87
|
+
/** Source file */
|
|
88
|
+
readonly file: string;
|
|
89
|
+
/** Line number */
|
|
90
|
+
readonly line: number;
|
|
91
|
+
/** Framework (Express, FastAPI, etc.) */
|
|
92
|
+
readonly framework: string;
|
|
93
|
+
/** Tables this entry point can reach */
|
|
94
|
+
readonly reachableTables: readonly string[];
|
|
95
|
+
/** 3D position (computed) */
|
|
96
|
+
position?: Vector3D;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A code function that accesses data
|
|
100
|
+
*/
|
|
101
|
+
export interface FunctionNode {
|
|
102
|
+
/** Unique identifier */
|
|
103
|
+
readonly id: string;
|
|
104
|
+
/** Function name */
|
|
105
|
+
readonly name: string;
|
|
106
|
+
/** Qualified name (Class.method) */
|
|
107
|
+
readonly qualifiedName: string;
|
|
108
|
+
/** Source file */
|
|
109
|
+
readonly file: string;
|
|
110
|
+
/** Line number */
|
|
111
|
+
readonly line: number;
|
|
112
|
+
/** Tables this function accesses directly */
|
|
113
|
+
readonly directAccess: readonly string[];
|
|
114
|
+
/** Is this function tested */
|
|
115
|
+
readonly isTested: boolean;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A data access path (hyperspace lane) connecting entry points to tables
|
|
119
|
+
*/
|
|
120
|
+
export interface DataPath {
|
|
121
|
+
/** Unique identifier */
|
|
122
|
+
readonly id: string;
|
|
123
|
+
/** Source node (entry point or function) */
|
|
124
|
+
readonly sourceId: string;
|
|
125
|
+
/** Source type */
|
|
126
|
+
readonly sourceType: 'entryPoint' | 'function';
|
|
127
|
+
/** Target table */
|
|
128
|
+
readonly targetTableId: string;
|
|
129
|
+
/** Target field (optional, for field-level access) */
|
|
130
|
+
readonly targetFieldId?: string;
|
|
131
|
+
/** Operation type */
|
|
132
|
+
readonly operation: DataOperation;
|
|
133
|
+
/** Access frequency */
|
|
134
|
+
readonly frequency: number;
|
|
135
|
+
/** Call chain depth */
|
|
136
|
+
readonly depth: number;
|
|
137
|
+
/** Is this path tested */
|
|
138
|
+
readonly isTested: boolean;
|
|
139
|
+
/** Intermediate functions in the path */
|
|
140
|
+
readonly callChain: readonly string[];
|
|
141
|
+
/** Sensitivity of data accessed */
|
|
142
|
+
readonly sensitivity: SensitivityLevel;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A foreign key relationship between tables
|
|
146
|
+
*/
|
|
147
|
+
export interface TableRelationship {
|
|
148
|
+
/** Unique identifier */
|
|
149
|
+
readonly id: string;
|
|
150
|
+
/** Source table */
|
|
151
|
+
readonly sourceTableId: string;
|
|
152
|
+
/** Source field */
|
|
153
|
+
readonly sourceFieldId: string;
|
|
154
|
+
/** Target table */
|
|
155
|
+
readonly targetTableId: string;
|
|
156
|
+
/** Target field */
|
|
157
|
+
readonly targetFieldId: string;
|
|
158
|
+
/** Relationship type */
|
|
159
|
+
readonly type: 'one-to-one' | 'one-to-many' | 'many-to-many';
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Complete galaxy data model
|
|
163
|
+
*/
|
|
164
|
+
export interface GalaxyData {
|
|
165
|
+
/** All tables (planets) */
|
|
166
|
+
readonly tables: readonly TableNode[];
|
|
167
|
+
/** All entry points (space stations) */
|
|
168
|
+
readonly entryPoints: readonly EntryPointNode[];
|
|
169
|
+
/** All data access paths (hyperspace lanes) */
|
|
170
|
+
readonly dataPaths: readonly DataPath[];
|
|
171
|
+
/** Table relationships (gravitational links) */
|
|
172
|
+
readonly relationships: readonly TableRelationship[];
|
|
173
|
+
/** Statistics */
|
|
174
|
+
readonly stats: GalaxyStats;
|
|
175
|
+
/** Last updated timestamp */
|
|
176
|
+
readonly lastUpdated: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Galaxy statistics
|
|
180
|
+
*/
|
|
181
|
+
export interface GalaxyStats {
|
|
182
|
+
/** Total tables */
|
|
183
|
+
readonly tableCount: number;
|
|
184
|
+
/** Total fields */
|
|
185
|
+
readonly fieldCount: number;
|
|
186
|
+
/** Total entry points */
|
|
187
|
+
readonly entryPointCount: number;
|
|
188
|
+
/** Total data paths */
|
|
189
|
+
readonly pathCount: number;
|
|
190
|
+
/** Sensitive field count by level */
|
|
191
|
+
readonly sensitiveFields: Record<SensitivityLevel, number>;
|
|
192
|
+
/** Untested paths count */
|
|
193
|
+
readonly untestedPaths: number;
|
|
194
|
+
/** Dead code functions */
|
|
195
|
+
readonly deadCodeCount: number;
|
|
196
|
+
/** Health score (0-100) */
|
|
197
|
+
readonly healthScore: number;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 3D vector for positions
|
|
201
|
+
*/
|
|
202
|
+
export interface Vector3D {
|
|
203
|
+
readonly x: number;
|
|
204
|
+
readonly y: number;
|
|
205
|
+
readonly z: number;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Camera state
|
|
209
|
+
*/
|
|
210
|
+
export interface CameraState {
|
|
211
|
+
/** Camera position */
|
|
212
|
+
readonly position: Vector3D;
|
|
213
|
+
/** Look-at target */
|
|
214
|
+
readonly target: Vector3D;
|
|
215
|
+
/** Zoom level (1 = default) */
|
|
216
|
+
readonly zoom: number;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Selection state
|
|
220
|
+
*/
|
|
221
|
+
export interface SelectionState {
|
|
222
|
+
/** Selected table ID */
|
|
223
|
+
readonly selectedTable: string | null;
|
|
224
|
+
/** Selected field ID */
|
|
225
|
+
readonly selectedField: string | null;
|
|
226
|
+
/** Selected entry point ID */
|
|
227
|
+
readonly selectedEntryPoint: string | null;
|
|
228
|
+
/** Selected data path ID */
|
|
229
|
+
readonly selectedPath: string | null;
|
|
230
|
+
/** Hovered node ID */
|
|
231
|
+
readonly hoveredNode: string | null;
|
|
232
|
+
/** Hovered node type */
|
|
233
|
+
readonly hoveredType: 'table' | 'field' | 'entryPoint' | 'path' | null;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* View mode for the galaxy
|
|
237
|
+
*/
|
|
238
|
+
export type ViewMode = 'overview' | 'security' | 'coverage' | 'blast-radius' | 'timeline';
|
|
239
|
+
/**
|
|
240
|
+
* Filter state
|
|
241
|
+
*/
|
|
242
|
+
export interface FilterState {
|
|
243
|
+
/** Show only tables with this sensitivity or higher */
|
|
244
|
+
readonly minSensitivity: SensitivityLevel | null;
|
|
245
|
+
/** Show only paths with this operation */
|
|
246
|
+
readonly operationType: DataOperation | null;
|
|
247
|
+
/** Show only untested paths */
|
|
248
|
+
readonly untestedOnly: boolean;
|
|
249
|
+
/** Show only public entry points */
|
|
250
|
+
readonly publicOnly: boolean;
|
|
251
|
+
/** Search query */
|
|
252
|
+
readonly searchQuery: string;
|
|
253
|
+
/** Selected clusters */
|
|
254
|
+
readonly clusters: readonly string[];
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Display settings
|
|
258
|
+
*/
|
|
259
|
+
export interface DisplaySettings {
|
|
260
|
+
/** Show field moons */
|
|
261
|
+
readonly showFields: boolean;
|
|
262
|
+
/** Show data paths */
|
|
263
|
+
readonly showPaths: boolean;
|
|
264
|
+
/** Show relationships */
|
|
265
|
+
readonly showRelationships: boolean;
|
|
266
|
+
/** Show labels */
|
|
267
|
+
readonly showLabels: boolean;
|
|
268
|
+
/** Enable bloom effect */
|
|
269
|
+
readonly enableBloom: boolean;
|
|
270
|
+
/** Animation speed (0-1) */
|
|
271
|
+
readonly animationSpeed: number;
|
|
272
|
+
/** Path opacity (0-1) */
|
|
273
|
+
readonly pathOpacity: number;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Real-time access event
|
|
277
|
+
*/
|
|
278
|
+
export interface AccessEvent {
|
|
279
|
+
/** Event ID */
|
|
280
|
+
readonly id: string;
|
|
281
|
+
/** Timestamp */
|
|
282
|
+
readonly timestamp: string;
|
|
283
|
+
/** Table accessed */
|
|
284
|
+
readonly tableId: string;
|
|
285
|
+
/** Field accessed (optional) */
|
|
286
|
+
readonly fieldId?: string;
|
|
287
|
+
/** Operation type */
|
|
288
|
+
readonly operation: DataOperation;
|
|
289
|
+
/** Source entry point */
|
|
290
|
+
readonly entryPointId?: string;
|
|
291
|
+
/** Source file */
|
|
292
|
+
readonly sourceFile: string;
|
|
293
|
+
/** Source line */
|
|
294
|
+
readonly sourceLine: number;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Galaxy event for animations/effects
|
|
298
|
+
*/
|
|
299
|
+
export interface GalaxyEvent {
|
|
300
|
+
/** Event type */
|
|
301
|
+
readonly type: 'access' | 'violation' | 'alert';
|
|
302
|
+
/** Target node ID */
|
|
303
|
+
readonly targetId: string;
|
|
304
|
+
/** Event data */
|
|
305
|
+
readonly data: AccessEvent | ViolationEvent | AlertEvent;
|
|
306
|
+
/** Timestamp */
|
|
307
|
+
readonly timestamp: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Violation event
|
|
311
|
+
*/
|
|
312
|
+
export interface ViolationEvent {
|
|
313
|
+
/** Violation ID */
|
|
314
|
+
readonly id: string;
|
|
315
|
+
/** Severity */
|
|
316
|
+
readonly severity: 'critical' | 'high' | 'medium' | 'low';
|
|
317
|
+
/** Message */
|
|
318
|
+
readonly message: string;
|
|
319
|
+
/** Affected table */
|
|
320
|
+
readonly tableId: string;
|
|
321
|
+
/** Affected path */
|
|
322
|
+
readonly pathId?: string;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Alert event
|
|
326
|
+
*/
|
|
327
|
+
export interface AlertEvent {
|
|
328
|
+
/** Alert ID */
|
|
329
|
+
readonly id: string;
|
|
330
|
+
/** Alert type */
|
|
331
|
+
readonly type: 'security' | 'coverage' | 'drift';
|
|
332
|
+
/** Message */
|
|
333
|
+
readonly message: string;
|
|
334
|
+
/** Affected nodes */
|
|
335
|
+
readonly affectedNodes: readonly string[];
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,UAAU,CAAC;AAM1E;;GAEG;AACH,MAAM,WAAW,SAAS;IACx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ACf,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC1D,cAAc;IACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qBAAqB;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,eAAe;IACf,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,iBAAiB;IACjB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;IACjD,cAAc;IACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qBAAqB;IACrB,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color Utilities
|
|
3
|
+
*
|
|
4
|
+
* Color manipulation and mapping functions for galaxy visualization.
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
import type { SensitivityLevel, SecurityTier, AuthLevel, DataOperation } from '../types/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Convert hex color to THREE.Color
|
|
10
|
+
*/
|
|
11
|
+
export declare function hexToThreeColor(hex: string): THREE.Color;
|
|
12
|
+
/**
|
|
13
|
+
* Convert hex to RGB object
|
|
14
|
+
*/
|
|
15
|
+
export declare function hexToRgb(hex: string): {
|
|
16
|
+
r: number;
|
|
17
|
+
g: number;
|
|
18
|
+
b: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Interpolate between two colors
|
|
22
|
+
*/
|
|
23
|
+
export declare function lerpColor(color1: string, color2: string, t: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Brighten a color
|
|
26
|
+
*/
|
|
27
|
+
export declare function brightenColor(hex: string, factor: number): string;
|
|
28
|
+
/**
|
|
29
|
+
* Darken a color
|
|
30
|
+
*/
|
|
31
|
+
export declare function darkenColor(hex: string, factor: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Get color for sensitivity level
|
|
34
|
+
*/
|
|
35
|
+
export declare function getSensitivityColor(level: SensitivityLevel): string;
|
|
36
|
+
/**
|
|
37
|
+
* Get THREE.Color for sensitivity level
|
|
38
|
+
*/
|
|
39
|
+
export declare function getSensitivityThreeColor(level: SensitivityLevel): THREE.Color;
|
|
40
|
+
/**
|
|
41
|
+
* Get emissive intensity for sensitivity level
|
|
42
|
+
*/
|
|
43
|
+
export declare function getSensitivityEmissive(level: SensitivityLevel): number;
|
|
44
|
+
/**
|
|
45
|
+
* Get sensitivity level from numeric score (0-100)
|
|
46
|
+
*/
|
|
47
|
+
export declare function scoreToSensitivity(score: number): SensitivityLevel;
|
|
48
|
+
/**
|
|
49
|
+
* Get color for security tier
|
|
50
|
+
*/
|
|
51
|
+
export declare function getSecurityTierColor(tier: SecurityTier): string;
|
|
52
|
+
/**
|
|
53
|
+
* Get THREE.Color for security tier
|
|
54
|
+
*/
|
|
55
|
+
export declare function getSecurityTierThreeColor(tier: SecurityTier): THREE.Color;
|
|
56
|
+
/**
|
|
57
|
+
* Get color for auth level
|
|
58
|
+
*/
|
|
59
|
+
export declare function getAuthLevelColor(level: AuthLevel): string;
|
|
60
|
+
/**
|
|
61
|
+
* Get THREE.Color for auth level
|
|
62
|
+
*/
|
|
63
|
+
export declare function getAuthLevelThreeColor(level: AuthLevel): THREE.Color;
|
|
64
|
+
/**
|
|
65
|
+
* Get color for data operation
|
|
66
|
+
*/
|
|
67
|
+
export declare function getOperationColor(operation: DataOperation): string;
|
|
68
|
+
/**
|
|
69
|
+
* Get THREE.Color for data operation
|
|
70
|
+
*/
|
|
71
|
+
export declare function getOperationThreeColor(operation: DataOperation): THREE.Color;
|
|
72
|
+
/**
|
|
73
|
+
* Get color for cluster
|
|
74
|
+
*/
|
|
75
|
+
export declare function getClusterColor(cluster: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Get THREE.Color for cluster
|
|
78
|
+
*/
|
|
79
|
+
export declare function getClusterThreeColor(cluster: string): THREE.Color;
|
|
80
|
+
/**
|
|
81
|
+
* Generate a gradient texture for paths
|
|
82
|
+
*/
|
|
83
|
+
export declare function createGradientTexture(color1: string, color2: string, width?: number): THREE.DataTexture;
|
|
84
|
+
/**
|
|
85
|
+
* Calculate pulse color based on time
|
|
86
|
+
*/
|
|
87
|
+
export declare function getPulseColor(baseColor: string, time: number, frequency?: number, intensity?: number): string;
|
|
88
|
+
/**
|
|
89
|
+
* Calculate pulse opacity based on time
|
|
90
|
+
*/
|
|
91
|
+
export declare function getPulseOpacity(baseOpacity: number, time: number, frequency?: number, range?: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* Get color for health score (0-100)
|
|
94
|
+
*/
|
|
95
|
+
export declare function getHealthScoreColor(score: number): string;
|
|
96
|
+
/**
|
|
97
|
+
* Get THREE.Color for health score
|
|
98
|
+
*/
|
|
99
|
+
export declare function getHealthScoreThreeColor(score: number): THREE.Color;
|
|
100
|
+
//# sourceMappingURL=color-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../src/utils/color-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAclG;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,CAExD;AAED;;GAEG;AACH,wBAAgB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AAsB,CAAC,SAAS,EAAE,aAAa,GAAG,KAAK,CAAC,KAAK,CAE5E;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,CAEjE;AAMD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAY,GAClB,KAAK,CAAC,WAAW,CAkBnB;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAU,EACrB,SAAS,GAAE,MAAY,GACtB,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAU,EACrB,KAAK,GAAE,MAAY,GAClB,MAAM,CAGR;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,CAEnE"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color Utilities
|
|
3
|
+
*
|
|
4
|
+
* Color manipulation and mapping functions for galaxy visualization.
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
import { SENSITIVITY_COLORS, SENSITIVITY_EMISSIVE, SECURITY_TIER_COLORS, AUTH_LEVEL_COLORS, OPERATION_COLORS, CLUSTER_COLORS, } from '../constants/index.js';
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Color Conversion
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Convert hex color to THREE.Color
|
|
13
|
+
*/
|
|
14
|
+
export function hexToThreeColor(hex) {
|
|
15
|
+
return new THREE.Color(hex);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert hex to RGB object
|
|
19
|
+
*/
|
|
20
|
+
export function hexToRgb(hex) {
|
|
21
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
22
|
+
if (!result || !result[1] || !result[2] || !result[3]) {
|
|
23
|
+
return { r: 0, g: 0, b: 0 };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
r: parseInt(result[1], 16) / 255,
|
|
27
|
+
g: parseInt(result[2], 16) / 255,
|
|
28
|
+
b: parseInt(result[3], 16) / 255,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Interpolate between two colors
|
|
33
|
+
*/
|
|
34
|
+
export function lerpColor(color1, color2, t) {
|
|
35
|
+
const c1 = hexToRgb(color1);
|
|
36
|
+
const c2 = hexToRgb(color2);
|
|
37
|
+
const r = Math.round((c1.r + (c2.r - c1.r) * t) * 255);
|
|
38
|
+
const g = Math.round((c1.g + (c2.g - c1.g) * t) * 255);
|
|
39
|
+
const b = Math.round((c1.b + (c2.b - c1.b) * t) * 255);
|
|
40
|
+
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Brighten a color
|
|
44
|
+
*/
|
|
45
|
+
export function brightenColor(hex, factor) {
|
|
46
|
+
const rgb = hexToRgb(hex);
|
|
47
|
+
const r = Math.min(255, Math.round(rgb.r * 255 * (1 + factor)));
|
|
48
|
+
const g = Math.min(255, Math.round(rgb.g * 255 * (1 + factor)));
|
|
49
|
+
const b = Math.min(255, Math.round(rgb.b * 255 * (1 + factor)));
|
|
50
|
+
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Darken a color
|
|
54
|
+
*/
|
|
55
|
+
export function darkenColor(hex, factor) {
|
|
56
|
+
const rgb = hexToRgb(hex);
|
|
57
|
+
const r = Math.max(0, Math.round(rgb.r * 255 * (1 - factor)));
|
|
58
|
+
const g = Math.max(0, Math.round(rgb.g * 255 * (1 - factor)));
|
|
59
|
+
const b = Math.max(0, Math.round(rgb.b * 255 * (1 - factor)));
|
|
60
|
+
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
61
|
+
}
|
|
62
|
+
// ============================================================================
|
|
63
|
+
// Sensitivity Colors
|
|
64
|
+
// ============================================================================
|
|
65
|
+
/**
|
|
66
|
+
* Get color for sensitivity level
|
|
67
|
+
*/
|
|
68
|
+
export function getSensitivityColor(level) {
|
|
69
|
+
return SENSITIVITY_COLORS[level];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get THREE.Color for sensitivity level
|
|
73
|
+
*/
|
|
74
|
+
export function getSensitivityThreeColor(level) {
|
|
75
|
+
return hexToThreeColor(SENSITIVITY_COLORS[level]);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get emissive intensity for sensitivity level
|
|
79
|
+
*/
|
|
80
|
+
export function getSensitivityEmissive(level) {
|
|
81
|
+
return SENSITIVITY_EMISSIVE[level];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get sensitivity level from numeric score (0-100)
|
|
85
|
+
*/
|
|
86
|
+
export function scoreToSensitivity(score) {
|
|
87
|
+
if (score >= 90)
|
|
88
|
+
return 'critical';
|
|
89
|
+
if (score >= 70)
|
|
90
|
+
return 'high';
|
|
91
|
+
if (score >= 50)
|
|
92
|
+
return 'medium';
|
|
93
|
+
if (score >= 20)
|
|
94
|
+
return 'low';
|
|
95
|
+
return 'public';
|
|
96
|
+
}
|
|
97
|
+
// ============================================================================
|
|
98
|
+
// Security Colors
|
|
99
|
+
// ============================================================================
|
|
100
|
+
/**
|
|
101
|
+
* Get color for security tier
|
|
102
|
+
*/
|
|
103
|
+
export function getSecurityTierColor(tier) {
|
|
104
|
+
return SECURITY_TIER_COLORS[tier];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get THREE.Color for security tier
|
|
108
|
+
*/
|
|
109
|
+
export function getSecurityTierThreeColor(tier) {
|
|
110
|
+
return hexToThreeColor(SECURITY_TIER_COLORS[tier]);
|
|
111
|
+
}
|
|
112
|
+
// ============================================================================
|
|
113
|
+
// Auth Level Colors
|
|
114
|
+
// ============================================================================
|
|
115
|
+
/**
|
|
116
|
+
* Get color for auth level
|
|
117
|
+
*/
|
|
118
|
+
export function getAuthLevelColor(level) {
|
|
119
|
+
return AUTH_LEVEL_COLORS[level];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get THREE.Color for auth level
|
|
123
|
+
*/
|
|
124
|
+
export function getAuthLevelThreeColor(level) {
|
|
125
|
+
return hexToThreeColor(AUTH_LEVEL_COLORS[level]);
|
|
126
|
+
}
|
|
127
|
+
// ============================================================================
|
|
128
|
+
// Operation Colors
|
|
129
|
+
// ============================================================================
|
|
130
|
+
/**
|
|
131
|
+
* Get color for data operation
|
|
132
|
+
*/
|
|
133
|
+
export function getOperationColor(operation) {
|
|
134
|
+
return OPERATION_COLORS[operation];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get THREE.Color for data operation
|
|
138
|
+
*/
|
|
139
|
+
export function getOperationThreeColor(operation) {
|
|
140
|
+
return hexToThreeColor(OPERATION_COLORS[operation]);
|
|
141
|
+
}
|
|
142
|
+
// ============================================================================
|
|
143
|
+
// Cluster Colors
|
|
144
|
+
// ============================================================================
|
|
145
|
+
/**
|
|
146
|
+
* Get color for cluster
|
|
147
|
+
*/
|
|
148
|
+
export function getClusterColor(cluster) {
|
|
149
|
+
return CLUSTER_COLORS[cluster] ?? CLUSTER_COLORS['other'] ?? '#7f8c8d';
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get THREE.Color for cluster
|
|
153
|
+
*/
|
|
154
|
+
export function getClusterThreeColor(cluster) {
|
|
155
|
+
return hexToThreeColor(getClusterColor(cluster));
|
|
156
|
+
}
|
|
157
|
+
// ============================================================================
|
|
158
|
+
// Gradient Generation
|
|
159
|
+
// ============================================================================
|
|
160
|
+
/**
|
|
161
|
+
* Generate a gradient texture for paths
|
|
162
|
+
*/
|
|
163
|
+
export function createGradientTexture(color1, color2, width = 256) {
|
|
164
|
+
const data = new Uint8Array(width * 4);
|
|
165
|
+
const c1 = hexToRgb(color1);
|
|
166
|
+
const c2 = hexToRgb(color2);
|
|
167
|
+
for (let i = 0; i < width; i++) {
|
|
168
|
+
const t = i / (width - 1);
|
|
169
|
+
const idx = i * 4;
|
|
170
|
+
data[idx] = Math.round((c1.r + (c2.r - c1.r) * t) * 255);
|
|
171
|
+
data[idx + 1] = Math.round((c1.g + (c2.g - c1.g) * t) * 255);
|
|
172
|
+
data[idx + 2] = Math.round((c1.b + (c2.b - c1.b) * t) * 255);
|
|
173
|
+
data[idx + 3] = 255;
|
|
174
|
+
}
|
|
175
|
+
const texture = new THREE.DataTexture(data, width, 1, THREE.RGBAFormat);
|
|
176
|
+
texture.needsUpdate = true;
|
|
177
|
+
return texture;
|
|
178
|
+
}
|
|
179
|
+
// ============================================================================
|
|
180
|
+
// Pulse Effect Colors
|
|
181
|
+
// ============================================================================
|
|
182
|
+
/**
|
|
183
|
+
* Calculate pulse color based on time
|
|
184
|
+
*/
|
|
185
|
+
export function getPulseColor(baseColor, time, frequency = 2, intensity = 0.3) {
|
|
186
|
+
const pulse = (Math.sin(time * frequency * Math.PI * 2) + 1) / 2;
|
|
187
|
+
return brightenColor(baseColor, pulse * intensity);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Calculate pulse opacity based on time
|
|
191
|
+
*/
|
|
192
|
+
export function getPulseOpacity(baseOpacity, time, frequency = 2, range = 0.3) {
|
|
193
|
+
const pulse = (Math.sin(time * frequency * Math.PI * 2) + 1) / 2;
|
|
194
|
+
return baseOpacity + pulse * range;
|
|
195
|
+
}
|
|
196
|
+
// ============================================================================
|
|
197
|
+
// Health Score Colors
|
|
198
|
+
// ============================================================================
|
|
199
|
+
/**
|
|
200
|
+
* Get color for health score (0-100)
|
|
201
|
+
*/
|
|
202
|
+
export function getHealthScoreColor(score) {
|
|
203
|
+
if (score >= 80)
|
|
204
|
+
return '#22c55e'; // Green
|
|
205
|
+
if (score >= 60)
|
|
206
|
+
return '#eab308'; // Yellow
|
|
207
|
+
if (score >= 40)
|
|
208
|
+
return '#f97316'; // Orange
|
|
209
|
+
return '#ef4444'; // Red
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get THREE.Color for health score
|
|
213
|
+
*/
|
|
214
|
+
export function getHealthScoreThreeColor(score) {
|
|
215
|
+
return hexToThreeColor(getHealthScoreColor(score));
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=color-utils.js.map
|