@memberjunction/ng-entity-relationship-diagram 0.0.1 → 2.129.0

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 (38) hide show
  1. package/README.md +754 -27
  2. package/dist/lib/components/entity-details/entity-details.component.d.ts +70 -0
  3. package/dist/lib/components/entity-details/entity-details.component.d.ts.map +1 -0
  4. package/dist/lib/components/entity-details/entity-details.component.js +694 -0
  5. package/dist/lib/components/entity-details/entity-details.component.js.map +1 -0
  6. package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.d.ts +48 -0
  7. package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.d.ts.map +1 -0
  8. package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.js +179 -0
  9. package/dist/lib/components/entity-filter-panel/entity-filter-panel.component.js.map +1 -0
  10. package/dist/lib/components/erd-composite/erd-composite.component.d.ts +170 -0
  11. package/dist/lib/components/erd-composite/erd-composite.component.d.ts.map +1 -0
  12. package/dist/lib/components/erd-composite/erd-composite.component.js +391 -0
  13. package/dist/lib/components/erd-composite/erd-composite.component.js.map +1 -0
  14. package/dist/lib/components/erd-diagram.component.d.ts +486 -0
  15. package/dist/lib/components/erd-diagram.component.d.ts.map +1 -0
  16. package/dist/lib/components/erd-diagram.component.js +1936 -0
  17. package/dist/lib/components/erd-diagram.component.js.map +1 -0
  18. package/dist/lib/components/mj-entity-erd.component.d.ts +261 -0
  19. package/dist/lib/components/mj-entity-erd.component.d.ts.map +1 -0
  20. package/dist/lib/components/mj-entity-erd.component.js +416 -0
  21. package/dist/lib/components/mj-entity-erd.component.js.map +1 -0
  22. package/dist/lib/entity-relationship-diagram.module.d.ts +83 -0
  23. package/dist/lib/entity-relationship-diagram.module.d.ts.map +1 -0
  24. package/dist/lib/entity-relationship-diagram.module.js +121 -0
  25. package/dist/lib/entity-relationship-diagram.module.js.map +1 -0
  26. package/dist/lib/interfaces/erd-types.d.ts +491 -0
  27. package/dist/lib/interfaces/erd-types.d.ts.map +1 -0
  28. package/dist/lib/interfaces/erd-types.js +6 -0
  29. package/dist/lib/interfaces/erd-types.js.map +1 -0
  30. package/dist/lib/utils/entity-to-erd-adapter.d.ts +64 -0
  31. package/dist/lib/utils/entity-to-erd-adapter.d.ts.map +1 -0
  32. package/dist/lib/utils/entity-to-erd-adapter.js +231 -0
  33. package/dist/lib/utils/entity-to-erd-adapter.js.map +1 -0
  34. package/dist/public-api.d.ts +9 -0
  35. package/dist/public-api.d.ts.map +1 -0
  36. package/dist/public-api.js +16 -0
  37. package/dist/public-api.js.map +1 -0
  38. package/package.json +45 -6
@@ -0,0 +1,491 @@
1
+ /**
2
+ * Generic ERD Types for the Entity Relationship Diagram component.
3
+ * These types are designed to be framework-agnostic and can work with any data source.
4
+ */
5
+ /**
6
+ * Represents a field in an ERD node (entity).
7
+ */
8
+ export interface ERDField {
9
+ /** Unique identifier for the field */
10
+ id: string;
11
+ /** Display name of the field */
12
+ name: string;
13
+ /** Data type of the field (e.g., 'string', 'int', 'uuid') */
14
+ type?: string;
15
+ /** Whether this field is a primary key */
16
+ isPrimaryKey: boolean;
17
+ /** ID of the related node (for foreign keys) */
18
+ relatedNodeId?: string;
19
+ /** Name of the related node (for display purposes) */
20
+ relatedNodeName?: string;
21
+ /** Name of the field in the related node (for FK relationships) */
22
+ relatedFieldName?: string;
23
+ /** Optional description of the field */
24
+ description?: string;
25
+ /** Whether the field allows null values */
26
+ allowsNull?: boolean;
27
+ /** Default value for the field */
28
+ defaultValue?: string;
29
+ /** Maximum length (for string fields) */
30
+ length?: number;
31
+ /** Precision (for numeric fields) */
32
+ precision?: number;
33
+ /** Scale (for numeric fields) */
34
+ scale?: number;
35
+ /** Whether the field is virtual/computed */
36
+ isVirtual?: boolean;
37
+ /** Whether the field is auto-increment */
38
+ autoIncrement?: boolean;
39
+ /** Possible values for the field (for enums/dropdowns) */
40
+ possibleValues?: ERDFieldValue[];
41
+ /** Additional custom data */
42
+ customData?: Record<string, unknown>;
43
+ }
44
+ /**
45
+ * Represents a possible value for an ERD field (enum values, dropdown options, etc.)
46
+ */
47
+ export interface ERDFieldValue {
48
+ /** Unique identifier for the value */
49
+ id?: string;
50
+ /** The actual value */
51
+ value: string;
52
+ /** Code representation (may differ from value) */
53
+ code?: string;
54
+ /** Description of what this value means */
55
+ description?: string;
56
+ /** Sort order */
57
+ sequence?: number;
58
+ }
59
+ /**
60
+ * Represents a node (entity/table) in the ERD.
61
+ */
62
+ export interface ERDNode {
63
+ /** Unique identifier for the node */
64
+ id: string;
65
+ /** Display name of the node */
66
+ name: string;
67
+ /** Optional schema/namespace name */
68
+ schemaName?: string;
69
+ /** Optional description */
70
+ description?: string;
71
+ /** Status of the node (e.g., 'Active', 'Deprecated') */
72
+ status?: string;
73
+ /** Base table name (if different from display name) */
74
+ baseTable?: string;
75
+ /** All fields in this node */
76
+ fields: ERDField[];
77
+ /** Additional custom data that can be used by the consumer */
78
+ customData?: Record<string, unknown>;
79
+ }
80
+ /**
81
+ * Represents a link (relationship) between two nodes in the ERD.
82
+ */
83
+ export interface ERDLink {
84
+ /** ID of the source node */
85
+ sourceNodeId: string;
86
+ /** ID of the target node */
87
+ targetNodeId: string;
88
+ /** The field that creates this relationship (usually the FK field) */
89
+ sourceField: ERDField;
90
+ /** The field in the target node (usually the PK field) */
91
+ targetField?: ERDField;
92
+ /** Whether this is a self-referencing relationship */
93
+ isSelfReference: boolean;
94
+ /** Relationship type (e.g., 'one-to-many', 'many-to-one') */
95
+ relationshipType?: 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many';
96
+ /** Optional label for the relationship */
97
+ label?: string;
98
+ }
99
+ /**
100
+ * Configuration options for the ERD diagram.
101
+ */
102
+ export interface ERDConfig {
103
+ /** Width of each node box in pixels */
104
+ nodeWidth?: number;
105
+ /** Base height of each node box in pixels */
106
+ nodeBaseHeight?: number;
107
+ /** Height per field in pixels */
108
+ fieldHeight?: number;
109
+ /** Maximum height of a node in pixels */
110
+ maxNodeHeight?: number;
111
+ /** Charge strength for force simulation (negative = repel) */
112
+ chargeStrength?: number;
113
+ /** Link distance for force simulation */
114
+ linkDistance?: number;
115
+ /** Collision radius padding */
116
+ collisionPadding?: number;
117
+ /** Whether to show field details in nodes */
118
+ showFieldDetails?: boolean;
119
+ /** Whether to show relationship labels */
120
+ showRelationshipLabels?: boolean;
121
+ /** Whether to enable node dragging */
122
+ enableDragging?: boolean;
123
+ /** Whether to enable zoom/pan */
124
+ enableZoom?: boolean;
125
+ /** Initial zoom level */
126
+ initialZoom?: number;
127
+ /** Colors for different node states */
128
+ colors?: ERDColorScheme;
129
+ }
130
+ /**
131
+ * Color scheme for the ERD diagram.
132
+ */
133
+ export interface ERDColorScheme {
134
+ /** Background color for node rectangles */
135
+ nodeBackground?: string;
136
+ /** Border color for node rectangles */
137
+ nodeBorder?: string;
138
+ /** Header background color for nodes */
139
+ nodeHeader?: string;
140
+ /** Text color for node headers */
141
+ nodeHeaderText?: string;
142
+ /** Background color for primary key fields */
143
+ primaryKeyBackground?: string;
144
+ /** Text color for primary key fields */
145
+ primaryKeyText?: string;
146
+ /** Background color for foreign key fields */
147
+ foreignKeyBackground?: string;
148
+ /** Text color for foreign key fields */
149
+ foreignKeyText?: string;
150
+ /** Color for relationship links */
151
+ linkColor?: string;
152
+ /** Color for selected nodes */
153
+ selectedBorder?: string;
154
+ /** Color for highlighted nodes */
155
+ highlightBorder?: string;
156
+ /** Color for related nodes (when showing relationships) */
157
+ relatedBorder?: string;
158
+ }
159
+ /**
160
+ * Filter configuration for the ERD.
161
+ */
162
+ export interface ERDFilter {
163
+ /** Filter by schema name */
164
+ schemaName?: string | null;
165
+ /** Filter by node name (search) */
166
+ nodeName?: string;
167
+ /** Filter by node status */
168
+ nodeStatus?: string | null;
169
+ /** Filter by base table name (search) */
170
+ baseTable?: string;
171
+ /** Custom filter function */
172
+ customFilter?: (node: ERDNode) => boolean;
173
+ }
174
+ /**
175
+ * Event data for node selection events.
176
+ */
177
+ export interface ERDNodeSelectionEvent {
178
+ /** The selected node (null if deselected) */
179
+ node: ERDNode | null;
180
+ /** Previous selected node (null if none) */
181
+ previousNode: ERDNode | null;
182
+ /** Whether the consumer can cancel this selection */
183
+ cancel: boolean;
184
+ }
185
+ /**
186
+ * Event data for node click events.
187
+ */
188
+ export interface ERDNodeClickEvent {
189
+ /** The clicked node */
190
+ node: ERDNode;
191
+ /** The mouse event */
192
+ mouseEvent: MouseEvent;
193
+ /** Whether to cancel default behavior (selection) */
194
+ cancel: boolean;
195
+ }
196
+ /**
197
+ * Event data for node double-click events.
198
+ */
199
+ export interface ERDNodeDoubleClickEvent {
200
+ /** The double-clicked node */
201
+ node: ERDNode;
202
+ /** The mouse event */
203
+ mouseEvent: MouseEvent;
204
+ /** Whether to cancel default behavior */
205
+ cancel: boolean;
206
+ }
207
+ /**
208
+ * Event data for link click events.
209
+ */
210
+ export interface ERDLinkClickEvent {
211
+ /** The clicked link */
212
+ link: ERDLink;
213
+ /** Source node */
214
+ sourceNode: ERDNode;
215
+ /** Target node */
216
+ targetNode: ERDNode;
217
+ /** The mouse event */
218
+ mouseEvent: MouseEvent;
219
+ /** Whether to cancel default behavior */
220
+ cancel: boolean;
221
+ }
222
+ /**
223
+ * Event data for zoom change events.
224
+ */
225
+ export interface ERDZoomEvent {
226
+ /** Current zoom level */
227
+ zoomLevel: number;
228
+ /** X translation */
229
+ translateX: number;
230
+ /** Y translation */
231
+ translateY: number;
232
+ }
233
+ /**
234
+ * State of the ERD diagram for saving/restoring.
235
+ * Use with `getState()` and `setState()` methods for persistence.
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * // Save state to localStorage
240
+ * const state = erdComponent.getState();
241
+ * localStorage.setItem('erd-state', JSON.stringify(state));
242
+ *
243
+ * // Restore state
244
+ * const savedState = JSON.parse(localStorage.getItem('erd-state'));
245
+ * erdComponent.setState(savedState);
246
+ * ```
247
+ */
248
+ export interface ERDState {
249
+ /** ID of the currently selected node */
250
+ selectedNodeId: string | null;
251
+ /** IDs of highlighted nodes */
252
+ highlightedNodeIds: string[];
253
+ /** Current zoom level (1 = 100%) */
254
+ zoomLevel: number;
255
+ /** X translation (pan position) */
256
+ translateX: number;
257
+ /** Y translation (pan position) */
258
+ translateY: number;
259
+ /** Focus node ID (if in focus mode) */
260
+ focusNodeId: string | null;
261
+ /** Focus depth (number of relationship hops to show) */
262
+ focusDepth: number;
263
+ /** Node positions for restoring exact layout */
264
+ nodePositions: Record<string, {
265
+ x: number;
266
+ y: number;
267
+ fx?: number | null;
268
+ fy?: number | null;
269
+ }>;
270
+ }
271
+ /**
272
+ * Event data for node hover events.
273
+ * Emitted when the mouse enters a node.
274
+ */
275
+ export interface ERDNodeHoverEvent {
276
+ /** The hovered node */
277
+ node: ERDNode;
278
+ /** The mouse event */
279
+ mouseEvent: MouseEvent;
280
+ /** Nodes directly connected to this node via relationships */
281
+ relatedNodes: ERDNode[];
282
+ /** Position for displaying tooltips */
283
+ position: {
284
+ x: number;
285
+ y: number;
286
+ };
287
+ }
288
+ /**
289
+ * Event data for link hover events.
290
+ * Emitted when the mouse enters a relationship link.
291
+ */
292
+ export interface ERDLinkHoverEvent {
293
+ /** The hovered link */
294
+ link: ERDLink;
295
+ /** Source node of the relationship */
296
+ sourceNode: ERDNode;
297
+ /** Target node of the relationship */
298
+ targetNode: ERDNode;
299
+ /** The mouse event */
300
+ mouseEvent: MouseEvent;
301
+ /** Position for displaying tooltips */
302
+ position: {
303
+ x: number;
304
+ y: number;
305
+ };
306
+ }
307
+ /**
308
+ * Event data for context menu events on nodes.
309
+ * Set `cancel = true` to prevent default browser context menu.
310
+ */
311
+ export interface ERDNodeContextMenuEvent {
312
+ /** The right-clicked node */
313
+ node: ERDNode;
314
+ /** The mouse event */
315
+ mouseEvent: MouseEvent;
316
+ /** Set to true to prevent default context menu */
317
+ cancel: boolean;
318
+ /** Screen position for showing custom context menu */
319
+ position: {
320
+ x: number;
321
+ y: number;
322
+ };
323
+ }
324
+ /**
325
+ * Event data for context menu events on links.
326
+ * Set `cancel = true` to prevent default browser context menu.
327
+ */
328
+ export interface ERDLinkContextMenuEvent {
329
+ /** The right-clicked link */
330
+ link: ERDLink;
331
+ /** Source node */
332
+ sourceNode: ERDNode;
333
+ /** Target node */
334
+ targetNode: ERDNode;
335
+ /** The mouse event */
336
+ mouseEvent: MouseEvent;
337
+ /** Set to true to prevent default context menu */
338
+ cancel: boolean;
339
+ /** Screen position for showing custom context menu */
340
+ position: {
341
+ x: number;
342
+ y: number;
343
+ };
344
+ }
345
+ /**
346
+ * Event data for context menu events on the diagram background.
347
+ * Set `cancel = true` to prevent default browser context menu.
348
+ */
349
+ export interface ERDDiagramContextMenuEvent {
350
+ /** The mouse event */
351
+ mouseEvent: MouseEvent;
352
+ /** Set to true to prevent default context menu */
353
+ cancel: boolean;
354
+ /** Screen position for showing custom context menu */
355
+ position: {
356
+ x: number;
357
+ y: number;
358
+ };
359
+ /** Diagram coordinates of the click */
360
+ diagramPosition: {
361
+ x: number;
362
+ y: number;
363
+ };
364
+ }
365
+ /**
366
+ * Event data for node drag events.
367
+ * Set `cancel = true` in dragStart to prevent dragging.
368
+ */
369
+ export interface ERDNodeDragEvent {
370
+ /** The dragged node */
371
+ node: ERDNode;
372
+ /** Position when drag started */
373
+ startPosition: {
374
+ x: number;
375
+ y: number;
376
+ };
377
+ /** Current position during drag */
378
+ currentPosition: {
379
+ x: number;
380
+ y: number;
381
+ };
382
+ /** Set to true in dragStart to cancel the drag */
383
+ cancel: boolean;
384
+ }
385
+ /**
386
+ * Layout algorithm options for the ERD diagram.
387
+ * - 'force': D3 force-directed layout (dynamic, animated)
388
+ * - 'dagre': Dagre hierarchical layout with orthogonal edges (static, clean)
389
+ * - 'horizontal': Left-to-right hierarchical layout using Dagre
390
+ * - 'vertical': Top-to-bottom hierarchical layout using Dagre
391
+ * - 'radial': Radial layout (not yet implemented)
392
+ */
393
+ export type ERDLayoutAlgorithm = 'force' | 'dagre' | 'horizontal' | 'vertical' | 'radial';
394
+ /**
395
+ * Dagre-specific layout configuration options.
396
+ */
397
+ export interface ERDDagreConfig {
398
+ /** Direction of the graph layout. Default: 'LR' (left-to-right) */
399
+ rankDir?: 'TB' | 'BT' | 'LR' | 'RL';
400
+ /** Horizontal separation between nodes. Default: 50 */
401
+ nodeSep?: number;
402
+ /** Vertical separation between ranks/layers. Default: 100 */
403
+ rankSep?: number;
404
+ /** Separation between different edge paths. Default: 10 */
405
+ edgeSep?: number;
406
+ /** Algorithm for ranking nodes: 'network-simplex', 'tight-tree', 'longest-path'. Default: 'network-simplex' */
407
+ ranker?: 'network-simplex' | 'tight-tree' | 'longest-path';
408
+ /** Alignment of nodes within their rank: 'UL', 'UR', 'DL', 'DR'. Default: undefined (centered) */
409
+ align?: 'UL' | 'UR' | 'DL' | 'DR';
410
+ }
411
+ /**
412
+ * Extended configuration options for the ERD diagram.
413
+ * All options are optional with sensible defaults.
414
+ */
415
+ export interface ERDConfig {
416
+ /** Width of each node box in pixels. Default: 180 */
417
+ nodeWidth?: number;
418
+ /** Base height of each node box in pixels (before adding fields). Default: 60 */
419
+ nodeBaseHeight?: number;
420
+ /** Height per field row in pixels. Default: 20 */
421
+ fieldHeight?: number;
422
+ /** Maximum height of a node in pixels. Default: 300 */
423
+ maxNodeHeight?: number;
424
+ /** Charge strength for force simulation (negative = repel). Default: -800 */
425
+ chargeStrength?: number;
426
+ /** Base distance between linked nodes. Default: 80 */
427
+ linkDistance?: number;
428
+ /** Extra padding for collision detection. Default: 20 */
429
+ collisionPadding?: number;
430
+ /** Whether to show field details (PKs, FKs) in nodes. Default: true */
431
+ showFieldDetails?: boolean;
432
+ /** Whether to show relationship labels on links. Default: true */
433
+ showRelationshipLabels?: boolean;
434
+ /** Whether to show the header bar with controls. Default: true */
435
+ showHeader?: boolean;
436
+ /** Whether to show node count in header. Default: true */
437
+ showNodeCount?: boolean;
438
+ /** Whether to show a minimap for navigation. Default: false */
439
+ showMinimap?: boolean;
440
+ /** Whether to show a legend explaining colors. Default: false */
441
+ showLegend?: boolean;
442
+ /** Enable node dragging. Default: true */
443
+ enableDragging?: boolean;
444
+ /** Enable zoom with mouse wheel. Default: true */
445
+ enableZoom?: boolean;
446
+ /** Enable panning by dragging background. Default: true */
447
+ enablePan?: boolean;
448
+ /** Minimum zoom level. Default: 0.1 */
449
+ minZoom?: number;
450
+ /** Maximum zoom level. Default: 4 */
451
+ maxZoom?: number;
452
+ /** Initial zoom level (1 = 100%). Default: 1 */
453
+ initialZoom?: number;
454
+ /** Enable multi-select with Ctrl+click. Default: false */
455
+ enableMultiSelect?: boolean;
456
+ /** Duration of zoom/pan animations in milliseconds. Default: 750 */
457
+ animationDuration?: number;
458
+ /** Whether to auto-fit diagram to container on initial load. Default: true */
459
+ fitOnLoad?: boolean;
460
+ /**
461
+ * Skip the D3 force simulation animation and render immediately.
462
+ * When true, the simulation runs to completion synchronously and nodes
463
+ * are positioned immediately without animation.
464
+ * Default: false
465
+ */
466
+ skipAnimation?: boolean;
467
+ /** Message to show when no nodes are provided. Default: 'No entities to display' */
468
+ emptyStateMessage?: string;
469
+ /** Icon class for empty state. Default: 'fa-solid fa-diagram-project' */
470
+ emptyStateIcon?: string;
471
+ /** Layout algorithm to use. Default: 'force' */
472
+ layoutAlgorithm?: ERDLayoutAlgorithm;
473
+ /** Dagre-specific layout configuration (only used when layoutAlgorithm is 'dagre', 'horizontal', or 'vertical') */
474
+ dagreConfig?: ERDDagreConfig;
475
+ /** Color scheme for the diagram */
476
+ colors?: ERDColorScheme;
477
+ }
478
+ /**
479
+ * Information about a relationship for highlighting purposes.
480
+ */
481
+ export interface ERDRelationshipInfo {
482
+ /** The related node */
483
+ node: ERDNode;
484
+ /** The link connecting them */
485
+ link: ERDLink;
486
+ /** Direction of relationship from the perspective of the source node */
487
+ direction: 'outgoing' | 'incoming';
488
+ /** The field creating this relationship */
489
+ field: ERDField;
490
+ }
491
+ //# sourceMappingURL=erd-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erd-types.d.ts","sourceRo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* These types are designed to be framework-agnostic and can work with any data source.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=erd-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erd-types.js","sourceRoot":"","sources":["../../../src/lib/interfaces/erd-types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,64 @@
1
+ import { EntityInfo, EntityFieldInfo } from '@memberjunction/core';
2
+ import { ERDNode, ERDField, ERDLink } from '../interfaces/erd-types';
3
+ /**
4
+ * Converts MemberJunction EntityFieldInfo to generic ERDField format.
5
+ */
6
+ export declare function entityFieldToERDField(field: EntityFieldInfo): ERDField;
7
+ /**
8
+ * Converts MemberJunction EntityInfo to generic ERDNode format.
9
+ */
10
+ export declare function entityInfoToERDNode(entity: EntityInfo): ERDNode;
11
+ /**
12
+ * Converts an array of MemberJunction EntityInfo objects to ERDNode format.
13
+ */
14
+ export declare function entitiesToERDNodes(entities: EntityInfo[]): ERDNode[];
15
+ /**
16
+ * Extracts the original EntityInfo from an ERDNode's customData.
17
+ * Returns null if not found.
18
+ */
19
+ export declare function getOriginalEntityFromERDNode(node: ERDNode): EntityInfo | null;
20
+ /**
21
+ * Finds an EntityInfo by node ID from an array.
22
+ */
23
+ export declare function findEntityByNodeId(nodeId: string, entities: EntityInfo[]): EntityInfo | undefined;
24
+ /**
25
+ * Options for building ERD data from entities.
26
+ */
27
+ export interface BuildERDDataOptions {
28
+ /** Include incoming relationships (entities that reference these entities). Default: true */
29
+ includeIncoming?: boolean;
30
+ /** Include outgoing relationships (entities these reference via FK). Default: true */
31
+ includeOutgoing?: boolean;
32
+ /** All entities in the system (for relationship lookups). Required for includeIncoming/includeOutgoing. */
33
+ allEntities?: EntityInfo[];
34
+ /** Relationship depth - how many hops to include. Default: 1 */
35
+ depth?: number;
36
+ }
37
+ /**
38
+ * Result of building ERD data from entities.
39
+ */
40
+ export interface BuildERDDataResult {
41
+ nodes: ERDNode[];
42
+ links: ERDLink[];
43
+ }
44
+ /**
45
+ * Builds ERD nodes and links from an array of EntityInfo objects.
46
+ * This handles the transformation and automatic relationship discovery.
47
+ *
48
+ * @param entities - The primary entities to display
49
+ * @param options - Options for relationship discovery
50
+ * @returns Object containing nodes and links arrays
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * // Single entity with all related entities
55
+ * const result = buildERDDataFromEntities([myEntity], {
56
+ * allEntities: metadata.Entities,
57
+ * includeIncoming: true,
58
+ * includeOutgoing: true,
59
+ * depth: 1
60
+ * });
61
+ * ```
62
+ */
63
+ export declare function buildERDDataFromEntities(entities: EntityInfo[], options?: BuildERDDataOptions): BuildERDDataResult;
64
+ //# sourceMappingURL=entity-to-erd-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-to-erd-adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/entity-to-erd-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAiB,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEpF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,QAAQ,CAmCtE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAc/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,CAEpE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAK7E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,UAAU,GAAG,SAAS,CAEjG;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6FAA6F;IAC7F,eAAe,CAAC,EAAE,OAAO,CAAC;IAC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