@erd-studio/renderer 0.1.3 → 0.3.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.
@@ -2,15 +2,15 @@
2
2
  * Types for React Flow graph nodes and edges.
3
3
  *
4
4
  * These types define the data payloads for custom React Flow node and edge
5
- * components. The graph transformer converts DisplayDomain data into
5
+ * components. The graph transformer converts DisplaySubjectArea data into
6
6
  * these shapes.
7
7
  */
8
8
  import type { Node, Edge } from '@xyflow/react';
9
- import type { AnnotationColor, Cardinality, ColumnPair, DbtKeyHint, Layer, Meta, ModelLoadError, ModelRole, Stage } from '@erd-studio/core';
9
+ import type { AnnotationColor, Cardinality, ColumnPair, DbtKeyHint, Layer, Meta, TableLoadError, TableLoadWarning, TableRole, Stage } from '@erd-studio/core';
10
10
  import type { LayerConfig } from '@erd-studio/core';
11
- import type { ModelDiscrepancy } from '@erd-studio/core';
11
+ import type { TableDiscrepancy } from '@erd-studio/core';
12
12
  import type { PhysicalProvenance } from '@erd-studio/core';
13
- /** Column data enriched with PK/FK/NK indicators for display in ModelNode. */
13
+ /** Column data enriched with PK/FK/NK indicators for display in TableNode. */
14
14
  export interface ColumnDisplay {
15
15
  name: string;
16
16
  dataType: string;
@@ -30,14 +30,14 @@ export interface ColumnDisplay {
30
30
  /** What dbt's tests say about the column (editable logical canvas only) — one line of its hover text. */
31
31
  dbtKey?: DbtKeyHint;
32
32
  }
33
- /** Data payload for a ModelNode React Flow node. */
34
- export type ModelNodeData = {
33
+ /** Data payload for a TableNode React Flow node. */
34
+ export type TableNodeData = {
35
35
  /** Model name (unique within a domain). */
36
36
  modelName: string;
37
37
  /**
38
38
  * Header label when it differs from `modelName`: the model's table name
39
39
  * (`alias`), qualified by schema when another model on the canvas would read
40
- * the same. See `computeModelLabels`.
40
+ * the same. See `computeTableLabels`.
41
41
  */
42
42
  label?: string;
43
43
  /** The active design stage. */
@@ -65,7 +65,7 @@ export type ModelNodeData = {
65
65
  /** Grain statement — "One row per ___". Shown as subtitle on node. */
66
66
  grain?: string;
67
67
  /** Model's role in the data warehouse architecture. Shown as badge on node. */
68
- modelRole?: ModelRole;
68
+ modelRole?: TableRole;
69
69
  /** Structured metadata (`meta:`) — shown in the name's hover tip. Absent when empty. */
70
70
  meta?: Meta;
71
71
  /** Whether this stage is read-only (physical). */
@@ -93,11 +93,16 @@ export type ModelNodeData = {
93
93
  * The model's file exists but could not be read (logical stage only): the
94
94
  * node shows the error and an "Open file" button instead of "No columns".
95
95
  */
96
- loadError?: ModelLoadError;
96
+ loadError?: TableLoadError;
97
+ /**
98
+ * The model's file was read but needs fixing (logical stage only): a key
99
+ * written twice, whose last value is shown (#164). Absent from an older core.
100
+ */
101
+ loadWarning?: TableLoadWarning;
97
102
  /** Whether this model is in stub display mode (PK/NK columns only). */
98
103
  isStub: boolean;
99
104
  /** Per-model discrepancy data when a cross-stage comparison report is active. */
100
- discrepancy?: ModelDiscrepancy;
105
+ discrepancy?: TableDiscrepancy;
101
106
  /** The stage currently being viewed (set when discrepancy overlay is active). */
102
107
  discrepancySourceStage?: Stage;
103
108
  /** The stage being compared against (set when discrepancy overlay is active). */
@@ -106,14 +111,14 @@ export type ModelNodeData = {
106
111
  * Index signature required by React Flow's Node generic.
107
112
  *
108
113
  * It also means an unknown or misspelled key type-checks, and a field written
109
- * here but never destructured in ModelNode ships as dead payload — which is
114
+ * here but never destructured in TableNode ships as dead payload — which is
110
115
  * exactly how `hasRationale` and `modelRole` gained matching dead CSS. Add a
111
116
  * field here only together with the code that reads it.
112
117
  */
113
118
  [key: string]: unknown;
114
119
  };
115
120
  /** Typed React Flow node for a semantic model. */
116
- export type ModelFlowNode = Node<ModelNodeData, 'model'>;
121
+ export type TableFlowNode = Node<TableNodeData, 'model'>;
117
122
  /** Data payload for an FkEdge React Flow edge. */
118
123
  export type FkEdgeData = {
119
124
  fromModel: string;
@@ -130,6 +135,11 @@ export type FkEdgeData = {
130
135
  pairs?: ColumnPair[];
131
136
  /** The composite's `compositeKey` name, alongside `pairs`. */
132
137
  compositeKey?: string;
138
+ /**
139
+ * The keys contradict its direction (`DisplayRelationship.keysContradict`,
140
+ * #163): drawn with a ⚠ and Turn round, except for viewers.
141
+ */
142
+ keysContradict?: true;
133
143
  /** Stage of the owning domain canvas — drives CSS colour class. */
134
144
  stage?: Stage;
135
145
  /** Discrepancy status for ghost/extra/mismatch edges. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erd-studio/renderer",
3
- "version": "0.1.3",
3
+ "version": "0.3.0",
4
4
  "description": "ERD Studio's React Flow canvas: the entity-relationship diagram renderer shared by the VS Code extension, with a read-only viewer mode.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "files": [
38
38
  "dist",
39
+ "CHANGELOG.md",
39
40
  "LICENSE",
40
41
  "README.md"
41
42
  ],
@@ -46,7 +47,7 @@
46
47
  "prepack": "npm run build"
47
48
  },
48
49
  "dependencies": {
49
- "@erd-studio/core": "0.1.3",
50
+ "@erd-studio/core": "0.3.0",
50
51
  "zustand": "^5.0.0"
51
52
  },
52
53
  "peerDependencies": {