@finos/legend-application-studio 28.19.117 → 28.21.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 (85) hide show
  1. package/lib/__lib__/LegendStudioUserDataHelper.d.ts +4 -1
  2. package/lib/__lib__/LegendStudioUserDataHelper.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioUserDataHelper.js +18 -0
  4. package/lib/__lib__/LegendStudioUserDataHelper.js.map +1 -1
  5. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/EditorGroup.js +5 -0
  7. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  8. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilder.d.ts +22 -0
  9. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilder.d.ts.map +1 -0
  10. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilder.js +43 -0
  11. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilder.js.map +1 -0
  12. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.d.ts.map +1 -1
  13. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.js +8 -16
  14. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.js.map +1 -1
  15. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
  16. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +123 -80
  17. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
  18. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.d.ts +26 -0
  19. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.d.ts.map +1 -0
  20. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.js +101 -0
  21. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.js.map +1 -0
  22. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.d.ts +23 -0
  23. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.d.ts.map +1 -0
  24. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.js +434 -0
  25. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.js.map +1 -0
  26. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.d.ts +242 -0
  27. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.d.ts.map +1 -0
  28. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.js +371 -0
  29. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.js.map +1 -0
  30. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.d.ts +29 -0
  31. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.d.ts.map +1 -0
  32. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.js +78 -0
  33. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.js.map +1 -0
  34. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.d.ts +30 -0
  35. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.d.ts.map +1 -0
  36. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.js +331 -0
  37. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.js.map +1 -0
  38. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.d.ts +104 -0
  39. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.d.ts.map +1 -0
  40. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.js +151 -0
  41. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.js.map +1 -0
  42. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.d.ts.map +1 -1
  43. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js +3 -78
  44. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js.map +1 -1
  45. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.d.ts +3 -1
  46. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.d.ts.map +1 -1
  47. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js +4 -5
  48. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js.map +1 -1
  49. package/lib/index.css +2 -2
  50. package/lib/index.css.map +1 -1
  51. package/lib/package.json +4 -1
  52. package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
  53. package/lib/stores/editor/EditorTabManagerState.js +5 -3
  54. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  55. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.d.ts +252 -0
  56. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.d.ts.map +1 -0
  57. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.js +755 -0
  58. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.js.map +1 -0
  59. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +2 -1
  60. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  61. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +12 -4
  62. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  63. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +5 -1
  64. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
  65. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +12 -0
  66. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
  67. package/package.json +12 -9
  68. package/src/__lib__/LegendStudioUserDataHelper.ts +30 -0
  69. package/src/components/editor/editor-group/EditorGroup.tsx +4 -0
  70. package/src/components/editor/editor-group/accessor/AccessorQueryBuilder.tsx +81 -0
  71. package/src/components/editor/editor-group/accessor/{AccessorQueryBuilderHelper.ts → AccessorQueryBuilderHelper.tsx} +14 -1
  72. package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +225 -86
  73. package/src/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.tsx +200 -0
  74. package/src/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.tsx +701 -0
  75. package/src/components/editor/editor-group/database-editor/DatabaseDiagramHelper.ts +555 -0
  76. package/src/components/editor/editor-group/database-editor/DatabaseEditor.tsx +246 -0
  77. package/src/components/editor/editor-group/database-editor/DatabaseSchemaTree.tsx +1053 -0
  78. package/src/components/editor/editor-group/database-editor/DatabaseTableNode.tsx +465 -0
  79. package/src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx +2 -242
  80. package/src/components/editor/editor-group/uml-editor/ClassQueryBuilder.tsx +16 -6
  81. package/src/stores/editor/EditorTabManagerState.ts +4 -5
  82. package/src/stores/editor/editor-state/element-editor-state/DatabaseEditorState.ts +938 -0
  83. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +14 -5
  84. package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +27 -0
  85. package/tsconfig.json +9 -1
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Column, type Database, type Join, type Milestoning, type Schema, type Table, View } from '@finos/legend-graph';
17
+ /**
18
+ * Tables and Views are the two top-level "relations" a Database schema can
19
+ * contain. They share a common metamodel ancestor (NamedRelation) and almost
20
+ * the same on-canvas treatment, so most helpers and the React node component
21
+ * accept either.
22
+ */
23
+ export type DatabaseRelation = Table | View;
24
+ export declare const isView: (relation: DatabaseRelation) => relation is View;
25
+ /**
26
+ * Stable identifier for a relation within a Database, encoded as
27
+ * `<schema>.<name>`. Schema-qualified to disambiguate same-named relations
28
+ * across schemas. Works for both Tables and Views.
29
+ */
30
+ export declare const getRelationId: (relation: DatabaseRelation) => string;
31
+ /**
32
+ * Display string for a relational data type (e.g. `VARCHAR(40)`,
33
+ * `DECIMAL(10,4)`). Wraps the upstream helper so the editor doesn't need to
34
+ * know about RelationalDataType subclasses directly.
35
+ */
36
+ export declare const getColumnTypeLabel: (column: Column) => string;
37
+ /**
38
+ * `Relation.columns` is statically typed as `RelationalOperationElement[]`
39
+ * (the broader supertype) but is populated with `Column` instances at runtime
40
+ * for tables. Filter so the form-mode editor can rely on the narrower type
41
+ * without casting at every call site.
42
+ */
43
+ export declare const getTableColumns: (table: Table) => Column[];
44
+ /**
45
+ * Whether a column participates in a relation's primary key. Both Tables and
46
+ * Views can declare a primary key (`primaryKey: Column[]`). For Views we
47
+ * compare by name because a view's `columnMappings` carry their column name
48
+ * directly rather than referencing the same `Column` instances.
49
+ */
50
+ export declare const isPrimaryKey: (relation: DatabaseRelation, columnName: string) => boolean;
51
+ /**
52
+ * Placeholder text shown while view-column Pure-code formulas are still
53
+ * loading (or if rendering them failed). Centralized so both the canvas
54
+ * table node and the tree column row stay in sync.
55
+ */
56
+ export declare const VIEW_COLUMN_FORMULA_PLACEHOLDER = "calculate [...]";
57
+ /**
58
+ * Resolve the Pure-code formula for a single view column mapping. Looks the
59
+ * pre-rendered formula up by `<schema>.<view>.<column>` key in the map
60
+ * populated by `DatabaseEditorState.loadViewColumnFormulas()`. Falls back to
61
+ * a static placeholder when the formula isn't ready yet (initial load,
62
+ * background re-render) or the engine couldn't render it.
63
+ *
64
+ * The map is passed in (not read directly here) so this module stays
65
+ * framework-agnostic — DatabaseDiagramHelper has no MobX dependency.
66
+ */
67
+ export declare const resolveViewColumnFormula: (formulas: ReadonlyMap<string, string>, schemaName: string, viewName: string, columnName: string) => string;
68
+ /**
69
+ * Placeholder text shown while filter Pure-code formulas are still loading
70
+ * (or if rendering them failed). Centralized so the side-panel filter row
71
+ * has a sensible fallback during the brief async window.
72
+ */
73
+ export declare const FILTER_FORMULA_PLACEHOLDER = "filter [...]";
74
+ /**
75
+ * Resolve the Pure-code formula for a single database-level filter. Filter
76
+ * names are unique within a Database, so the lookup key is just the filter
77
+ * name (no schema qualifier needed). Falls back to a static placeholder when
78
+ * the formula isn't ready yet or the engine couldn't render it.
79
+ */
80
+ export declare const resolveFilterFormula: (formulas: ReadonlyMap<string, string>, filterName: string) => string;
81
+ /**
82
+ * Placeholder shown while a join's Pure-code operation is loading or if
83
+ * rendering failed. Same async-load pattern as filters and view-column
84
+ * formulas — reused so the side panel and canvas tooltips stay in sync.
85
+ */
86
+ export declare const JOIN_FORMULA_PLACEHOLDER = "join [...]";
87
+ export declare const resolveJoinFormula: (formulas: ReadonlyMap<string, string>, joinName: string) => string;
88
+ /**
89
+ * Placeholder shown for view groupBy expressions while the engine render
90
+ * is in flight or if rendering failed. Kept distinct from the column-mapping
91
+ * placeholder so users can tell at a glance which kind of expression is
92
+ * still loading.
93
+ */
94
+ export declare const VIEW_GROUP_BY_FORMULA_PLACEHOLDER = "group by [...]";
95
+ /**
96
+ * Resolve the Pure-code formula for a single view groupBy column expression.
97
+ * Keys mirror the loader in `DatabaseEditorState`:
98
+ * `<schema>.<view>.groupBy[<index>]`. Falls back to the static placeholder
99
+ * when the formula isn't ready yet.
100
+ */
101
+ export declare const resolveViewGroupByFormula: (formulas: ReadonlyMap<string, string>, schemaName: string, viewName: string, index: number) => string;
102
+ /**
103
+ * Lowercase, trimmed search-text matcher used by the side-panel tree.
104
+ * Empty query matches everything (so consumers don't need a special case).
105
+ * Match is case-insensitive substring \u2014 not fuzzy \u2014 because users
106
+ * typically know the exact prefix of the schema/relation/column they're
107
+ * looking for and substring keeps the "what matched" obvious.
108
+ */
109
+ export declare const matchesSearch: (name: string, query: string) => boolean;
110
+ /**
111
+ * Renders a single `Milestoning` instance into a short, grammar-flavored
112
+ * label and a longer human description. Mirrors the four concrete subclasses
113
+ * the metamodel ships today:
114
+ *
115
+ * - `BusinessMilestoning` — `business[from..thru]` ("thru inclusive" tag)
116
+ * - `BusinessSnapshotMilestoning` — `business snapshot(<col>)`
117
+ * - `ProcessingMilestoning` — `processing[in..out]` ("out inclusive" tag)
118
+ * - `ProcessingSnapshotMilestoning` — `processing snapshot(<col>)`
119
+ *
120
+ * Unknown subclasses (extension milestonings introduced via plugins) fall
121
+ * back to the constructor name so the user at least sees "something is
122
+ * configured here" instead of a silent omission.
123
+ */
124
+ export interface MilestoningSummary {
125
+ /** Short grammar-style label, e.g. `business[from..thru]`. */
126
+ label: string;
127
+ /** Longer human-readable description used as the tooltip. */
128
+ description: string;
129
+ /** Stable kind tag for styling: `business` | `processing` | `unknown`. */
130
+ kind: 'business' | 'processing' | 'unknown';
131
+ }
132
+ export declare const summarizeMilestoning: (milestoning: Milestoning) => MilestoningSummary;
133
+ /**
134
+ * Whether a join's two endpoints are the same relation (e.g. a hierarchy
135
+ * self-join: `Employee → Employee` on `managerId = id`). We treat any join
136
+ * whose first alias pair has identical source/target relation ids as a
137
+ * self-join — mirrors how `buildJoinEdges` matches endpoints.
138
+ */
139
+ export declare const isSelfJoin: (join: Join) => boolean;
140
+ /**
141
+ * Whether either endpoint of a join lives outside `database` (i.e. resolves
142
+ * to a relation owned by another, included, store). Used to surface a
143
+ * "CROSS-DB" badge in the side panel and to render the canvas placeholder
144
+ * node for the foreign endpoint.
145
+ */
146
+ export declare const isCrossDatabaseJoin: (join: Join, database: Database) => boolean;
147
+ /**
148
+ * Number of column rows a relation's table-node will render. Tables expose
149
+ * Column[] via `columns`, Views expose ColumnMapping[] via `columnMappings`.
150
+ */
151
+ export declare const getRelationColumnCount: (relation: DatabaseRelation) => number;
152
+ /**
153
+ * Identify columns that participate in any join in the database. Used to badge
154
+ * columns as foreign keys in the table node.
155
+ *
156
+ * Note: in Pure relational, joins ARE the relationships — there is no separate
157
+ * FK constraint on the column. A column is "FK-like" iff some join's operation
158
+ * references it.
159
+ */
160
+ export declare const collectForeignKeyColumns: (database: Database) => Set<Column>;
161
+ export interface DatabaseDiagramJoinEdge {
162
+ /** Stable id used by React Flow. */
163
+ id: string;
164
+ /** Join name (used as edge label). */
165
+ name: string;
166
+ /** Source relation id (`<schema>.<name>`). */
167
+ source: string;
168
+ /** Target relation id (`<schema>.<name>`). */
169
+ target: string;
170
+ /** Original `Join` reference for identity-based selection matching. */
171
+ join: Join;
172
+ /** True when both endpoints are the same relation (self-join). React Flow
173
+ * renders these as loop edges; we use this flag so the canvas can pick a
174
+ * distinct edge type / styling without re-walking aliases. */
175
+ isSelfJoin: boolean;
176
+ /** True when at least one endpoint is *not* in this database. The missing
177
+ * endpoint is rendered as a stub placeholder node instead of a real
178
+ * table-node so users can still see the relationship at a glance. */
179
+ isCrossDatabase: boolean;
180
+ }
181
+ /** Synthetic relation id used for the placeholder node that stands in for a
182
+ * cross-database join's foreign endpoint. Includes the schema-qualified
183
+ * source path so the same foreign relation is reused across multiple joins
184
+ * rather than producing one stub per join. */
185
+ export declare const getForeignRelationStubId: (ownerPath: string, schemaName: string, relationName: string) => string;
186
+ export interface ForeignRelationStub {
187
+ id: string;
188
+ schemaName: string;
189
+ relationName: string;
190
+ ownerPath: string;
191
+ }
192
+ export interface DatabaseDiagramBuildResult {
193
+ edges: DatabaseDiagramJoinEdge[];
194
+ /** Foreign endpoints that need a placeholder node on the canvas. Empty
195
+ * when there are no cross-database joins. Deduplicated by stub id. */
196
+ foreignStubs: ForeignRelationStub[];
197
+ }
198
+ /**
199
+ * Walk all joins in the database and produce a deduplicated list of edges
200
+ * between relations (tables and/or views), including self-joins (rendered
201
+ * as loop edges) and cross-database joins (whose foreign endpoint becomes
202
+ * a placeholder stub).
203
+ *
204
+ * Implementation notes:
205
+ * - `Join.aliases` typically contains both directions `(A→B)` and `(B→A)` as a
206
+ * lookup optimization. We treat A↔B as a single edge and use the first alias.
207
+ * - Self-joins (A↔A) are kept and flagged via `isSelfJoin` so the canvas can
208
+ * render a loop edge instead of skipping them.
209
+ * - Joins whose endpoints reference relations outside this database (typically
210
+ * through `includes` / `includedStoreSpecifications`) are kept and flagged
211
+ * via `isCrossDatabase`. The foreign endpoint is replaced with a stub id so
212
+ * the caller can render a small placeholder node beside the in-DB endpoint.
213
+ */
214
+ export declare const buildJoinEdges: (database: Database) => DatabaseDiagramBuildResult;
215
+ export interface LaidOutNode {
216
+ id: string;
217
+ x: number;
218
+ y: number;
219
+ }
220
+ export interface DatabaseDiagramRelationNode {
221
+ id: string;
222
+ relation: DatabaseRelation;
223
+ /** Estimated height in pixels — driven by column count for dagre layout. */
224
+ estimatedHeight: number;
225
+ }
226
+ export declare const estimateNodeHeight: (relation: DatabaseRelation) => number;
227
+ /**
228
+ * Run dagre on the relation/edge graph and return positions keyed by
229
+ * relation id. Uses left-to-right layering, which suits ERDs better than
230
+ * top-down.
231
+ */
232
+ export declare const layoutDatabaseDiagram: (nodes: DatabaseDiagramRelationNode[], edges: DatabaseDiagramJoinEdge[]) => Map<string, LaidOutNode>;
233
+ /**
234
+ * Flat list of (schema, relation) pairs in deterministic order — used by the
235
+ * canvas builder. Tables come before views within each schema (alphabetic
236
+ * within each kind), so the canvas layout stays stable as a database grows.
237
+ */
238
+ export declare const getOrderedRelations: (database: Database) => {
239
+ schema: Schema;
240
+ relation: DatabaseRelation;
241
+ }[];
242
+ //# sourceMappingURL=DatabaseDiagramHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatabaseDiagramHelper.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/editor-group/database-editor/DatabaseDiagramHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAGL,MAAM,EACN,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK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C;AAC/C,eAAO,MAAM,wBAAwB,GACnC,WAAW,MAAM,EACjB,YAAY,MAAM,EAClB,cAAc,MAAM,KACnB,MAAmE,CAAC;AAEvE,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC;2EACuE;IACvE,YAAY,EAAE,mBAAmB,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,QAAQ,KACjB,0BAwEF,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,4EAA4E;IAC5E,eAAe,EAAE,MAAM,CAAC;CACzB;AAOD,eAAO,MAAM,kBAAkB,GAAI,UAAU,gBAAgB,KAAG,MAGlD,CAAC;AAEf;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,2BAA2B,EAAE,EACpC,OAAO,uBAAuB,EAAE,KAC/B,GAAG,CAAC,MAAM,EAAE,WAAW,CAqCzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,QAAQ,KACjB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,EAgBhD,CAAC"}
@@ -0,0 +1,371 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import dagre from '@dagrejs/dagre';
17
+ import { filterByType } from '@finos/legend-shared';
18
+ import { BusinessMilestoning, BusinessSnapshotMilestoning, Column, ProcessingMilestoning, ProcessingSnapshotMilestoning, View, stringifyDataType, } from '@finos/legend-graph';
19
+ export const isView = (relation) => relation instanceof View;
20
+ /**
21
+ * Stable identifier for a relation within a Database, encoded as
22
+ * `<schema>.<name>`. Schema-qualified to disambiguate same-named relations
23
+ * across schemas. Works for both Tables and Views.
24
+ */
25
+ export const getRelationId = (relation) => `${relation.schema.name}.${relation.name}`;
26
+ /**
27
+ * Display string for a relational data type (e.g. `VARCHAR(40)`,
28
+ * `DECIMAL(10,4)`). Wraps the upstream helper so the editor doesn't need to
29
+ * know about RelationalDataType subclasses directly.
30
+ */
31
+ export const getColumnTypeLabel = (column) => stringifyDataType(column.type);
32
+ /**
33
+ * `Relation.columns` is statically typed as `RelationalOperationElement[]`
34
+ * (the broader supertype) but is populated with `Column` instances at runtime
35
+ * for tables. Filter so the form-mode editor can rely on the narrower type
36
+ * without casting at every call site.
37
+ */
38
+ export const getTableColumns = (table) => table.columns.filter(filterByType(Column));
39
+ /**
40
+ * Whether a column participates in a relation's primary key. Both Tables and
41
+ * Views can declare a primary key (`primaryKey: Column[]`). For Views we
42
+ * compare by name because a view's `columnMappings` carry their column name
43
+ * directly rather than referencing the same `Column` instances.
44
+ */
45
+ export const isPrimaryKey = (relation, columnName) => relation.primaryKey.some((pk) => pk.name === columnName);
46
+ /**
47
+ * Placeholder text shown while view-column Pure-code formulas are still
48
+ * loading (or if rendering them failed). Centralized so both the canvas
49
+ * table node and the tree column row stay in sync.
50
+ */
51
+ export const VIEW_COLUMN_FORMULA_PLACEHOLDER = 'calculate [...]';
52
+ /**
53
+ * Resolve the Pure-code formula for a single view column mapping. Looks the
54
+ * pre-rendered formula up by `<schema>.<view>.<column>` key in the map
55
+ * populated by `DatabaseEditorState.loadViewColumnFormulas()`. Falls back to
56
+ * a static placeholder when the formula isn't ready yet (initial load,
57
+ * background re-render) or the engine couldn't render it.
58
+ *
59
+ * The map is passed in (not read directly here) so this module stays
60
+ * framework-agnostic — DatabaseDiagramHelper has no MobX dependency.
61
+ */
62
+ export const resolveViewColumnFormula = (formulas, schemaName, viewName, columnName) => formulas.get(`${schemaName}.${viewName}.${columnName}`) ??
63
+ VIEW_COLUMN_FORMULA_PLACEHOLDER;
64
+ /**
65
+ * Placeholder text shown while filter Pure-code formulas are still loading
66
+ * (or if rendering them failed). Centralized so the side-panel filter row
67
+ * has a sensible fallback during the brief async window.
68
+ */
69
+ export const FILTER_FORMULA_PLACEHOLDER = 'filter [...]';
70
+ /**
71
+ * Resolve the Pure-code formula for a single database-level filter. Filter
72
+ * names are unique within a Database, so the lookup key is just the filter
73
+ * name (no schema qualifier needed). Falls back to a static placeholder when
74
+ * the formula isn't ready yet or the engine couldn't render it.
75
+ */
76
+ export const resolveFilterFormula = (formulas, filterName) => formulas.get(filterName) ?? FILTER_FORMULA_PLACEHOLDER;
77
+ /**
78
+ * Placeholder shown while a join's Pure-code operation is loading or if
79
+ * rendering failed. Same async-load pattern as filters and view-column
80
+ * formulas — reused so the side panel and canvas tooltips stay in sync.
81
+ */
82
+ export const JOIN_FORMULA_PLACEHOLDER = 'join [...]';
83
+ export const resolveJoinFormula = (formulas, joinName) => formulas.get(joinName) ?? JOIN_FORMULA_PLACEHOLDER;
84
+ /**
85
+ * Placeholder shown for view groupBy expressions while the engine render
86
+ * is in flight or if rendering failed. Kept distinct from the column-mapping
87
+ * placeholder so users can tell at a glance which kind of expression is
88
+ * still loading.
89
+ */
90
+ export const VIEW_GROUP_BY_FORMULA_PLACEHOLDER = 'group by [...]';
91
+ /**
92
+ * Resolve the Pure-code formula for a single view groupBy column expression.
93
+ * Keys mirror the loader in `DatabaseEditorState`:
94
+ * `<schema>.<view>.groupBy[<index>]`. Falls back to the static placeholder
95
+ * when the formula isn't ready yet.
96
+ */
97
+ export const resolveViewGroupByFormula = (formulas, schemaName, viewName, index) => formulas.get(`${schemaName}.${viewName}.groupBy[${index}]`) ??
98
+ VIEW_GROUP_BY_FORMULA_PLACEHOLDER;
99
+ /**
100
+ * Lowercase, trimmed search-text matcher used by the side-panel tree.
101
+ * Empty query matches everything (so consumers don't need a special case).
102
+ * Match is case-insensitive substring \u2014 not fuzzy \u2014 because users
103
+ * typically know the exact prefix of the schema/relation/column they're
104
+ * looking for and substring keeps the "what matched" obvious.
105
+ */
106
+ export const matchesSearch = (name, query) => {
107
+ if (!query) {
108
+ return true;
109
+ }
110
+ return name.toLowerCase().includes(query);
111
+ };
112
+ export const summarizeMilestoning = (milestoning) => {
113
+ if (milestoning instanceof BusinessMilestoning) {
114
+ const inclusive = milestoning.thruIsInclusive ? ', thru inclusive' : '';
115
+ return {
116
+ label: `business[${milestoning.from}\u2026${milestoning.thru}]`,
117
+ description: `Business milestoning on columns ${milestoning.from} \u2192 ${milestoning.thru}${inclusive}`,
118
+ kind: 'business',
119
+ };
120
+ }
121
+ if (milestoning instanceof BusinessSnapshotMilestoning) {
122
+ return {
123
+ label: `business snapshot(${milestoning.snapshotDate})`,
124
+ description: `Business snapshot milestoning on column ${milestoning.snapshotDate}`,
125
+ kind: 'business',
126
+ };
127
+ }
128
+ if (milestoning instanceof ProcessingMilestoning) {
129
+ const inclusive = milestoning.outIsInclusive ? ', out inclusive' : '';
130
+ return {
131
+ label: `processing[${milestoning.in}\u2026${milestoning.out}]`,
132
+ description: `Processing milestoning on columns ${milestoning.in} \u2192 ${milestoning.out}${inclusive}`,
133
+ kind: 'processing',
134
+ };
135
+ }
136
+ if (milestoning instanceof ProcessingSnapshotMilestoning) {
137
+ return {
138
+ label: `processing snapshot(${milestoning.snapshotDate})`,
139
+ description: `Processing snapshot milestoning on column ${milestoning.snapshotDate}`,
140
+ kind: 'processing',
141
+ };
142
+ }
143
+ // Plugin-defined milestoning kinds: surface the class name so the user
144
+ // at least knows the table is milestoned even if we can't decode it.
145
+ const className = milestoning.constructor.name;
146
+ return {
147
+ label: className,
148
+ description: `Custom milestoning (${className})`,
149
+ kind: 'unknown',
150
+ };
151
+ };
152
+ /**
153
+ * Whether a join's two endpoints are the same relation (e.g. a hierarchy
154
+ * self-join: `Employee → Employee` on `managerId = id`). We treat any join
155
+ * whose first alias pair has identical source/target relation ids as a
156
+ * self-join — mirrors how `buildJoinEdges` matches endpoints.
157
+ */
158
+ export const isSelfJoin = (join) => {
159
+ const firstPair = join.aliases[0];
160
+ if (!firstPair) {
161
+ return false;
162
+ }
163
+ const source = firstPair.first.relation.value;
164
+ const target = firstPair.second.relation.value;
165
+ return (source.schema.name === target.schema.name && source.name === target.name);
166
+ };
167
+ /**
168
+ * Whether either endpoint of a join lives outside `database` (i.e. resolves
169
+ * to a relation owned by another, included, store). Used to surface a
170
+ * "CROSS-DB" badge in the side panel and to render the canvas placeholder
171
+ * node for the foreign endpoint.
172
+ */
173
+ export const isCrossDatabaseJoin = (join, database) => {
174
+ const firstPair = join.aliases[0];
175
+ if (!firstPair) {
176
+ return false;
177
+ }
178
+ const sourceOwner = firstPair.first.relation.value.schema._OWNER;
179
+ const targetOwner = firstPair.second.relation.value.schema._OWNER;
180
+ return sourceOwner !== database || targetOwner !== database;
181
+ };
182
+ /**
183
+ * Number of column rows a relation's table-node will render. Tables expose
184
+ * Column[] via `columns`, Views expose ColumnMapping[] via `columnMappings`.
185
+ */
186
+ export const getRelationColumnCount = (relation) => isView(relation)
187
+ ? relation.columnMappings.length
188
+ : getTableColumns(relation).length;
189
+ const collectColumnsFromOperation = (
190
+ // The operation tree includes DynaFunction with parameters, TableAliasColumn,
191
+ // Literal, etc. We descend it loosely to collect any column references.
192
+ operation, acc) => {
193
+ if (operation === undefined) {
194
+ return;
195
+ }
196
+ // TableAliasColumn has a `column.value: Column`
197
+ const candidate = operation;
198
+ if (candidate.column?.value) {
199
+ acc.add(candidate.column.value);
200
+ }
201
+ if (Array.isArray(candidate.parameters)) {
202
+ candidate.parameters.forEach((p) => collectColumnsFromOperation(p, acc));
203
+ }
204
+ };
205
+ /**
206
+ * Identify columns that participate in any join in the database. Used to badge
207
+ * columns as foreign keys in the table node.
208
+ *
209
+ * Note: in Pure relational, joins ARE the relationships — there is no separate
210
+ * FK constraint on the column. A column is "FK-like" iff some join's operation
211
+ * references it.
212
+ */
213
+ export const collectForeignKeyColumns = (database) => {
214
+ const fkColumns = new Set();
215
+ database.joins.forEach((join) => {
216
+ collectColumnsFromOperation(join.operation, fkColumns);
217
+ });
218
+ return fkColumns;
219
+ };
220
+ /** Synthetic relation id used for the placeholder node that stands in for a
221
+ * cross-database join's foreign endpoint. Includes the schema-qualified
222
+ * source path so the same foreign relation is reused across multiple joins
223
+ * rather than producing one stub per join. */
224
+ export const getForeignRelationStubId = (ownerPath, schemaName, relationName) => `__foreign__:${ownerPath}::${schemaName}.${relationName}`;
225
+ /**
226
+ * Walk all joins in the database and produce a deduplicated list of edges
227
+ * between relations (tables and/or views), including self-joins (rendered
228
+ * as loop edges) and cross-database joins (whose foreign endpoint becomes
229
+ * a placeholder stub).
230
+ *
231
+ * Implementation notes:
232
+ * - `Join.aliases` typically contains both directions `(A→B)` and `(B→A)` as a
233
+ * lookup optimization. We treat A↔B as a single edge and use the first alias.
234
+ * - Self-joins (A↔A) are kept and flagged via `isSelfJoin` so the canvas can
235
+ * render a loop edge instead of skipping them.
236
+ * - Joins whose endpoints reference relations outside this database (typically
237
+ * through `includes` / `includedStoreSpecifications`) are kept and flagged
238
+ * via `isCrossDatabase`. The foreign endpoint is replaced with a stub id so
239
+ * the caller can render a small placeholder node beside the in-DB endpoint.
240
+ */
241
+ export const buildJoinEdges = (database) => {
242
+ const ownIds = new Set();
243
+ database.schemas.forEach((schema) => {
244
+ schema.tables.forEach((table) => ownIds.add(getRelationId(table)));
245
+ schema.views.forEach((view) => ownIds.add(getRelationId(view)));
246
+ });
247
+ const edges = [];
248
+ const stubs = new Map();
249
+ database.joins.forEach((join) => {
250
+ const firstPair = join.aliases[0];
251
+ if (!firstPair) {
252
+ return;
253
+ }
254
+ const sourceRelation = firstPair.first.relation.value;
255
+ const targetRelation = firstPair.second.relation.value;
256
+ const rawSourceId = `${sourceRelation.schema.name}.${sourceRelation.name}`;
257
+ const rawTargetId = `${targetRelation.schema.name}.${targetRelation.name}`;
258
+ const sourceInOwn = ownIds.has(rawSourceId);
259
+ const targetInOwn = ownIds.has(rawTargetId);
260
+ // Resolve each endpoint to either its real node id (when in-DB) or a
261
+ // stub id (when foreign). For pure self-joins we keep both ids as the
262
+ // same real id so React Flow draws a loop on that node.
263
+ let sourceId = rawSourceId;
264
+ if (!sourceInOwn) {
265
+ const ownerPath = sourceRelation.schema._OWNER.path;
266
+ const stubId = getForeignRelationStubId(ownerPath, sourceRelation.schema.name, sourceRelation.name);
267
+ sourceId = stubId;
268
+ if (!stubs.has(stubId)) {
269
+ stubs.set(stubId, {
270
+ id: stubId,
271
+ schemaName: sourceRelation.schema.name,
272
+ relationName: sourceRelation.name,
273
+ ownerPath,
274
+ });
275
+ }
276
+ }
277
+ let targetId = rawTargetId;
278
+ if (!targetInOwn) {
279
+ const ownerPath = targetRelation.schema._OWNER.path;
280
+ const stubId = getForeignRelationStubId(ownerPath, targetRelation.schema.name, targetRelation.name);
281
+ targetId = stubId;
282
+ if (!stubs.has(stubId)) {
283
+ stubs.set(stubId, {
284
+ id: stubId,
285
+ schemaName: targetRelation.schema.name,
286
+ relationName: targetRelation.name,
287
+ ownerPath,
288
+ });
289
+ }
290
+ }
291
+ edges.push({
292
+ id: `join:${join.name}`,
293
+ name: join.name,
294
+ source: sourceId,
295
+ target: targetId,
296
+ join,
297
+ isSelfJoin: sourceInOwn && targetInOwn && sourceId === targetId,
298
+ isCrossDatabase: !sourceInOwn || !targetInOwn,
299
+ });
300
+ });
301
+ return { edges, foreignStubs: Array.from(stubs.values()) };
302
+ };
303
+ const NODE_WIDTH = 240;
304
+ const NODE_HEADER_HEIGHT = 36;
305
+ const NODE_COL_HEIGHT = 22;
306
+ const NODE_PADDING = 8;
307
+ export const estimateNodeHeight = (relation) => NODE_HEADER_HEIGHT +
308
+ getRelationColumnCount(relation) * NODE_COL_HEIGHT +
309
+ NODE_PADDING;
310
+ /**
311
+ * Run dagre on the relation/edge graph and return positions keyed by
312
+ * relation id. Uses left-to-right layering, which suits ERDs better than
313
+ * top-down.
314
+ */
315
+ export const layoutDatabaseDiagram = (nodes, edges) => {
316
+ const g = new dagre.graphlib.Graph();
317
+ g.setDefaultEdgeLabel(() => ({}));
318
+ g.setGraph({
319
+ rankdir: 'LR',
320
+ nodesep: 60,
321
+ ranksep: 120,
322
+ marginx: 20,
323
+ marginy: 20,
324
+ });
325
+ nodes.forEach((node) => {
326
+ g.setNode(node.id, { width: NODE_WIDTH, height: node.estimatedHeight });
327
+ });
328
+ edges.forEach((edge) => {
329
+ g.setEdge(edge.source, edge.target);
330
+ });
331
+ dagre.layout(g);
332
+ const out = new Map();
333
+ nodes.forEach((node) => {
334
+ const laidOut = g.node(node.id);
335
+ if (laidOut) {
336
+ // dagre returns center; React Flow expects top-left.
337
+ out.set(node.id, {
338
+ id: node.id,
339
+ x: laidOut.x - laidOut.width / 2,
340
+ y: laidOut.y - laidOut.height / 2,
341
+ });
342
+ }
343
+ else {
344
+ out.set(node.id, { id: node.id, x: 0, y: 0 });
345
+ }
346
+ });
347
+ return out;
348
+ };
349
+ /**
350
+ * Flat list of (schema, relation) pairs in deterministic order — used by the
351
+ * canvas builder. Tables come before views within each schema (alphabetic
352
+ * within each kind), so the canvas layout stays stable as a database grows.
353
+ */
354
+ export const getOrderedRelations = (database) => {
355
+ const pairs = [];
356
+ database.schemas
357
+ .slice()
358
+ .sort((a, b) => a.name.localeCompare(b.name))
359
+ .forEach((schema) => {
360
+ schema.tables
361
+ .slice()
362
+ .sort((a, b) => a.name.localeCompare(b.name))
363
+ .forEach((table) => pairs.push({ schema, relation: table }));
364
+ schema.views
365
+ .slice()
366
+ .sort((a, b) => a.name.localeCompare(b.name))
367
+ .forEach((view) => pairs.push({ schema, relation: view }));
368
+ });
369
+ return pairs;
370
+ };
371
+ //# sourceMappingURL=DatabaseDiagramHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatabaseDiagramHelper.js","sourceRoot":"","sources":["../../../../../src/components/editor/editor-group/database-editor/DatabaseDiagramHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,EAIN,qBAAqB,EACrB,6BAA6B,EAG7B,IAAI,EAEJ,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAU7B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAA0B,EAAoB,EAAE,CACrE,QAAQ,YAAY,IAAI,CAAC;AAE3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA0B,EAAU,EAAE,CAClE,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAU,EAAE,CAC3D,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAY,EAAY,EAAE,CACxD,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,G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O,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAAkB,EACgC,EAAE;IACpD,MAAM,KAAK,GAAqD,EAAE,CAAC;IACnE,QAAQ,CAAC,OAAO;SACb,KAAK,EAAE;SACP,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC5C,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAClB,MAAM,CAAC,MAAM;aACV,KAAK,EAAE;aACP,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC5C,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/D,MAAM,CAAC,KAAK;aACT,KAAK,EAAE;aACP,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC5C,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACL,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Top-level editor for `Database` elements in form mode. Has two tabs:
18
+ * - VIEW (default): Schema → Table → Column tree (left) + React-Flow ERD
19
+ * canvas (right). The interactive form mode.
20
+ * - GRAMMAR: read-only Pure DSL preview, regenerated on tab switch by
21
+ * `setSelectedTab` so it always reflects the current metamodel state.
22
+ * Mirrors what global Text Mode would render for this element — included
23
+ * here for users who want to peek at the grammar without leaving form
24
+ * mode.
25
+ */
26
+ export declare const DatabaseEditor: (() => import("react/jsx-runtime").JSX.Element) & {
27
+ displayName: string;
28
+ };
29
+ //# sourceMappingURL=DatabaseEditor.d.ts.map