@power-maverick/tool-erd-generator 0.0.7 → 0.0.8
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/MIGRATION_COMPLETE.md +181 -0
- package/README.md +118 -359
- package/index.html +18 -1
- package/package.json +12 -27
- package/tsconfig.json +20 -15
- package/{webview/vite.config.ts → vite.config.ts} +1 -1
- package/CONVERSION_SUMMARY.md +0 -288
- package/REFACTORING_COMPLETE.md +0 -352
- package/TYPESCRIPT_NOTES.md +0 -57
- package/dist/src/components/ERDGenerator.d.ts +0 -44
- package/dist/src/components/ERDGenerator.d.ts.map +0 -1
- package/dist/src/components/ERDGenerator.js +0 -232
- package/dist/src/components/ERDGenerator.js.map +0 -1
- package/dist/src/dvdtIntegration/integration.d.ts +0 -47
- package/dist/src/dvdtIntegration/integration.d.ts.map +0 -1
- package/dist/src/dvdtIntegration/integration.js +0 -223
- package/dist/src/dvdtIntegration/integration.js.map +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -26
- package/dist/src/index.js.map +0 -1
- package/dist/src/models/interfaces.d.ts +0 -84
- package/dist/src/models/interfaces.d.ts.map +0 -1
- package/dist/src/models/interfaces.js +0 -3
- package/dist/src/models/interfaces.js.map +0 -1
- package/dist/src/models/platformApi.d.ts +0 -92
- package/dist/src/models/platformApi.d.ts.map +0 -1
- package/dist/src/models/platformApi.js +0 -213
- package/dist/src/models/platformApi.js.map +0 -1
- package/dist/src/utils/Constants.d.ts +0 -3
- package/dist/src/utils/Constants.d.ts.map +0 -1
- package/dist/src/utils/Constants.js +0 -6
- package/dist/src/utils/Constants.js.map +0 -1
- package/dist/src/utils/DataverseClient.d.ts +0 -53
- package/dist/src/utils/DataverseClient.d.ts.map +0 -1
- package/dist/src/utils/DataverseClient.js +0 -236
- package/dist/src/utils/DataverseClient.js.map +0 -1
- package/dist/webview/index.css +0 -1
- package/dist/webview/index.html +0 -13
- package/dist/webview/index.js +0 -49
- package/tsconfig.webview.json +0 -24
- package/ui/test.html +0 -326
- package/webview/App.tsx +0 -412
- package/webview/index.html +0 -12
- package/webview/main.tsx +0 -10
- package/webview/styles.css +0 -288
- package/webview/tsconfig.json +0 -35
- /package/{webview/tsconfig.node.json → tsconfig.node.json} +0 -0
package/README.md
CHANGED
|
@@ -1,192 +1,160 @@
|
|
|
1
|
-
# ERD Generator
|
|
1
|
+
# Dataverse ERD Generator
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
> **🚀 Works in Both Platforms**: This tool automatically detects whether it's running in DVDT (VS Code extension) or PPTB (desktop application) and adapts accordingly. Zero configuration needed!
|
|
6
|
-
|
|
7
|
-
## Quick Links
|
|
8
|
-
|
|
9
|
-
- **[PPTB Integration Guide](docs/PPTB_Integration.md)** - For PowerPlatform ToolBox users
|
|
10
|
-
- **[DVDT Integration Guide](docs/DVDT_Integration.md)** - For VS Code extension developers
|
|
11
|
-
- **[Integration Examples](docs/Integration_Examples.md)** - Complete code samples for both platforms
|
|
12
|
-
- **[Getting Started](docs/Getting_Started.md)** - New to this tool? Start here!
|
|
3
|
+
A PowerPlatform ToolBox tool for generating Entity Relationship Diagrams (ERD) from Dataverse solutions using React and Vite.
|
|
13
4
|
|
|
14
5
|
## Features
|
|
15
6
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- **🔒 Secure**: Platform-abstracted APIs ensure security in both environments
|
|
26
|
-
|
|
27
|
-
## Platform Support
|
|
7
|
+
- ✅ React 18 with TypeScript
|
|
8
|
+
- ✅ Vite for fast development and building
|
|
9
|
+
- ✅ Access to ToolBox API via `window.toolboxAPI`
|
|
10
|
+
- ✅ Dataverse connection and authentication
|
|
11
|
+
- ✅ Multiple ERD formats: Mermaid, PlantUML, Graphviz
|
|
12
|
+
- ✅ Visual Mermaid diagram rendering
|
|
13
|
+
- ✅ Configurable output (attributes, relationships, table limits)
|
|
14
|
+
- ✅ Export diagrams (download source files or copy to clipboard)
|
|
15
|
+
- ✅ Interactive UI with solution selection
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
|----------|-------------|--------|
|
|
31
|
-
| **DVDT** | Dataverse DevTools for VS Code | ✅ Fully Supported |
|
|
32
|
-
| **PPTB** | PowerPlatform ToolBox (Desktop) | ✅ Fully Supported |
|
|
17
|
+
## Structure
|
|
33
18
|
|
|
34
|
-
|
|
19
|
+
```
|
|
20
|
+
erd-generator/
|
|
21
|
+
├── src/
|
|
22
|
+
│ ├── App.tsx # Main React component
|
|
23
|
+
│ ├── main.tsx # Entry point
|
|
24
|
+
│ ├── styles.css # Global styles
|
|
25
|
+
│ ├── components/
|
|
26
|
+
│ │ └── ERDGenerator.ts # ERD generation logic
|
|
27
|
+
│ ├── models/
|
|
28
|
+
│ │ └── interfaces.ts # TypeScript interfaces
|
|
29
|
+
│ └── utils/
|
|
30
|
+
│ └── DataverseClient.ts # Dataverse API client
|
|
31
|
+
├── index.html # HTML template
|
|
32
|
+
├── vite.config.ts # Vite configuration
|
|
33
|
+
├── package.json
|
|
34
|
+
├── tsconfig.json
|
|
35
|
+
└── README.md
|
|
36
|
+
```
|
|
35
37
|
|
|
36
|
-
##
|
|
38
|
+
## Installation
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
The tool uses a unified `IPlatformAPI` interface that abstracts platform differences:
|
|
40
|
+
Install dependencies:
|
|
40
41
|
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
const api = PlatformAPIFactory.create();
|
|
44
|
-
|
|
45
|
-
// Works the same in both platforms
|
|
46
|
-
const context = await api.getToolContext();
|
|
47
|
-
await api.showNotification({ title: 'Success', body: 'Done!', type: 'success' });
|
|
48
|
-
await api.saveFile('erd.mmd', diagram);
|
|
49
|
-
await api.copyToClipboard(text);
|
|
42
|
+
```bash
|
|
43
|
+
npm install
|
|
50
44
|
```
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
- **Vite**: Modern build tool for fast development and optimized production builds
|
|
54
|
-
- **React 18**: Latest React with hooks and concurrent features
|
|
55
|
-
- **TypeScript**: Full type safety across the codebase
|
|
56
|
-
- **Dual Build Target**:
|
|
57
|
-
- Extension code (Node.js/VS Code) compiled with `tsc`
|
|
58
|
-
- Webview (browser) bundled with Vite
|
|
59
|
-
- Single `dist/` output works for both platforms
|
|
60
|
-
|
|
61
|
-
### Platform Integration
|
|
62
|
-
The tool automatically detects its environment:
|
|
63
|
-
|
|
64
|
-
1. **DVDT (VS Code)**: Detects `window.acquireVsCodeApi()`
|
|
65
|
-
- Receives credentials via `postMessage` with `setCredentials` command
|
|
66
|
-
- Uses VS Code APIs for file operations and clipboard
|
|
67
|
-
|
|
68
|
-
2. **PPTB (ToolBox)**: Detects `window.toolboxAPI`
|
|
69
|
-
- Gets context via `toolboxAPI.getToolContext()`
|
|
70
|
-
- Listens for `TOOLBOX_CONTEXT` via `postMessage`
|
|
71
|
-
- Uses PPTB APIs for file operations, clipboard, and notifications
|
|
46
|
+
## Development
|
|
72
47
|
|
|
73
|
-
|
|
48
|
+
Run development server:
|
|
74
49
|
|
|
75
50
|
```bash
|
|
76
|
-
npm
|
|
51
|
+
npm run dev
|
|
77
52
|
```
|
|
78
53
|
|
|
79
|
-
|
|
54
|
+
Build for production:
|
|
80
55
|
|
|
81
|
-
|
|
56
|
+
```bash
|
|
57
|
+
npm run build
|
|
58
|
+
```
|
|
82
59
|
|
|
83
|
-
|
|
60
|
+
Preview production build:
|
|
84
61
|
|
|
85
62
|
```bash
|
|
86
|
-
npm run
|
|
63
|
+
npm run preview
|
|
87
64
|
```
|
|
88
65
|
|
|
89
|
-
|
|
90
|
-
1. **Extension build** (`npm run build:extension`): Compiles TypeScript for Node.js/VS Code
|
|
91
|
-
- Input: `src/` TypeScript files
|
|
92
|
-
- Output: `dist/src/` JavaScript files
|
|
93
|
-
- Target: Node.js runtime (VS Code extension host)
|
|
66
|
+
## Usage in ToolBox
|
|
94
67
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
68
|
+
1. Build the tool:
|
|
69
|
+
```bash
|
|
70
|
+
npm run build
|
|
71
|
+
```
|
|
99
72
|
|
|
100
|
-
|
|
73
|
+
2. The built files will be in the `dist/` directory:
|
|
74
|
+
- `index.html` - Main entry point
|
|
75
|
+
- `index.js` - Bundled application
|
|
76
|
+
- `index.css` - Compiled styles
|
|
101
77
|
|
|
102
|
-
|
|
78
|
+
3. Install the tool in PowerPlatform ToolBox through the UI or programmatically
|
|
103
79
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
80
|
+
## Key Concepts
|
|
81
|
+
|
|
82
|
+
### ToolBox API Integration
|
|
107
83
|
|
|
108
|
-
|
|
109
|
-
- TypeScript compiler in watch mode
|
|
110
|
-
- Vite dev server with instant HMR
|
|
84
|
+
The tool integrates with PowerPlatform ToolBox via `window.toolboxAPI`:
|
|
111
85
|
|
|
112
|
-
|
|
86
|
+
```typescript
|
|
87
|
+
// Get connection context
|
|
88
|
+
const context = await window.toolboxAPI.getToolContext();
|
|
113
89
|
|
|
114
|
-
|
|
90
|
+
// Show notification
|
|
91
|
+
await window.toolboxAPI.showNotification({
|
|
92
|
+
title: "Success",
|
|
93
|
+
body: "ERD generated successfully",
|
|
94
|
+
type: "success"
|
|
95
|
+
});
|
|
115
96
|
|
|
116
|
-
|
|
117
|
-
|
|
97
|
+
// Save file
|
|
98
|
+
await window.toolboxAPI.saveFile(fileName, content);
|
|
99
|
+
|
|
100
|
+
// Copy to clipboard
|
|
101
|
+
await window.toolboxAPI.copyToClipboard(text);
|
|
118
102
|
```
|
|
119
103
|
|
|
120
|
-
|
|
104
|
+
**Important**: The tool must listen for `TOOLBOX_CONTEXT` via `postMessage` from the parent window. This provides connection information when the tool is loaded in a webview.
|
|
121
105
|
|
|
122
|
-
###
|
|
106
|
+
### React Hooks
|
|
123
107
|
|
|
124
|
-
The
|
|
108
|
+
The tool demonstrates:
|
|
125
109
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
export function activate(context: vscode.ExtensionContext) {
|
|
131
|
-
// When you want to show ERD Generator (e.g., from a command)
|
|
132
|
-
showERDPanel(
|
|
133
|
-
context.extensionUri,
|
|
134
|
-
environmentUrl, // Your Dataverse environment URL
|
|
135
|
-
accessToken // Your Dataverse access token
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
```
|
|
110
|
+
- `useState` for managing component state
|
|
111
|
+
- `useEffect` for initialization and side effects
|
|
112
|
+
- Type-safe event handling with TypeScript
|
|
113
|
+
- Dataverse API integration
|
|
139
114
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
The tool automatically integrates with PPTB when deployed as a tool:
|
|
149
|
-
|
|
150
|
-
**No code required!** The React app detects PPTB environment and:
|
|
151
|
-
1. Listens for `TOOLBOX_CONTEXT` via `postMessage`
|
|
152
|
-
2. Calls `window.toolboxAPI.getToolContext()` to get connection details
|
|
153
|
-
3. Uses `window.toolboxAPI.showNotification()` for user feedback
|
|
154
|
-
4. Subscribes to toolbox events via `window.toolboxAPI.onToolboxEvent()`
|
|
155
|
-
|
|
156
|
-
**Package structure for PPTB:**
|
|
157
|
-
```json
|
|
158
|
-
{
|
|
159
|
-
"name": "dvdt-erd-generator",
|
|
160
|
-
"version": "0.0.6",
|
|
161
|
-
"displayName": "Dataverse ERD Generator",
|
|
162
|
-
"description": "Generate Entity Relationship Diagrams for Dataverse solutions"
|
|
163
|
-
}
|
|
164
|
-
```
|
|
115
|
+
### ERD Generation
|
|
116
|
+
|
|
117
|
+
Supports three formats:
|
|
118
|
+
|
|
119
|
+
1. **Mermaid** - Visual diagrams with interactive rendering
|
|
120
|
+
2. **PlantUML** - Text-based UML diagrams
|
|
121
|
+
3. **Graphviz** - DOT language for graph visualization
|
|
165
122
|
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
123
|
+
Configuration options:
|
|
124
|
+
- Include/exclude attributes
|
|
125
|
+
- Include/exclude relationships
|
|
126
|
+
- Limit maximum attributes per table
|
|
170
127
|
|
|
171
|
-
|
|
128
|
+
### Styling
|
|
172
129
|
|
|
173
|
-
|
|
130
|
+
Uses CSS with modern features:
|
|
174
131
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
6. Download or copy the generated diagram
|
|
132
|
+
- CSS Grid for layouts
|
|
133
|
+
- Flexbox for alignment
|
|
134
|
+
- Gradient backgrounds
|
|
135
|
+
- Responsive design
|
|
136
|
+
- Clean, professional UI
|
|
181
137
|
|
|
182
|
-
|
|
138
|
+
## TypeScript
|
|
183
139
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
140
|
+
Full TypeScript support with:
|
|
141
|
+
|
|
142
|
+
- Type declarations for ToolBox API
|
|
143
|
+
- Strict type checking
|
|
144
|
+
- Modern ES2020 features
|
|
145
|
+
- React JSX types
|
|
146
|
+
- Dataverse API types
|
|
147
|
+
|
|
148
|
+
## Building Diagrams
|
|
149
|
+
|
|
150
|
+
The tool:
|
|
151
|
+
|
|
152
|
+
1. Connects to Dataverse using provided credentials
|
|
153
|
+
2. Lists available solutions
|
|
154
|
+
3. Fetches solution metadata (tables, attributes, relationships)
|
|
155
|
+
4. Generates diagram in selected format
|
|
156
|
+
5. Renders visual preview (Mermaid) or shows source code
|
|
157
|
+
6. Allows export via download or clipboard
|
|
190
158
|
|
|
191
159
|
## Configuration Options
|
|
192
160
|
|
|
@@ -214,60 +182,6 @@ The tool provides several configuration options:
|
|
|
214
182
|
- Powerful layout engines
|
|
215
183
|
- Flexible customization options
|
|
216
184
|
|
|
217
|
-
## Architecture Details
|
|
218
|
-
|
|
219
|
-
### No Node.js Dependencies in Webview
|
|
220
|
-
|
|
221
|
-
The webview bundle (`dist/webview/index.js`) is **pure browser JavaScript**:
|
|
222
|
-
- ✅ No `require()` or `module.exports`
|
|
223
|
-
- ✅ No `process.env` or Node.js globals
|
|
224
|
-
- ✅ No Node.js-specific APIs
|
|
225
|
-
- ✅ Uses only browser-standard APIs
|
|
226
|
-
|
|
227
|
-
This ensures:
|
|
228
|
-
- Works in any browser environment (PPTB)
|
|
229
|
-
- Works in VS Code webviews (DVDT)
|
|
230
|
-
- No runtime dependencies
|
|
231
|
-
- Smaller bundle size
|
|
232
|
-
|
|
233
|
-
### Build Output Structure
|
|
234
|
-
|
|
235
|
-
```
|
|
236
|
-
dist/
|
|
237
|
-
├── src/ # Extension code (Node.js)
|
|
238
|
-
│ ├── index.js # Main export
|
|
239
|
-
│ ├── components/
|
|
240
|
-
│ │ └── ERDGenerator.js
|
|
241
|
-
│ ├── utils/
|
|
242
|
-
│ │ └── DataverseClient.js
|
|
243
|
-
│ └── dvdtIntegration/
|
|
244
|
-
│ └── integration.js # VS Code panel management
|
|
245
|
-
└── webview/ # Browser bundle (React app)
|
|
246
|
-
├── index.html # Entry point
|
|
247
|
-
├── index.js # Bundled React app (~195 KB)
|
|
248
|
-
└── index.css # Styles (~5 KB)
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
## Core Components
|
|
252
|
-
|
|
253
|
-
### ERDGenerator (`src/components/ERDGenerator.ts`)
|
|
254
|
-
- Core logic for generating diagrams
|
|
255
|
-
- Supports multiple output formats
|
|
256
|
-
- Handles table and relationship mapping
|
|
257
|
-
- Shared between extension and webview builds
|
|
258
|
-
|
|
259
|
-
### DataverseClient (`src/utils/DataverseClient.ts`)
|
|
260
|
-
- Dataverse API client
|
|
261
|
-
- Fetches solutions, tables, attributes, relationships
|
|
262
|
-
- Uses Axios for HTTP requests
|
|
263
|
-
- Shared between extension and webview builds
|
|
264
|
-
|
|
265
|
-
### App Component (`webview/App.tsx`)
|
|
266
|
-
- Main React component
|
|
267
|
-
- Environment detection (DVDT vs PPTB)
|
|
268
|
-
- State management with hooks
|
|
269
|
-
- User interface and interactions
|
|
270
|
-
|
|
271
185
|
## Troubleshooting
|
|
272
186
|
|
|
273
187
|
### Build Issues
|
|
@@ -280,15 +194,7 @@ npm install
|
|
|
280
194
|
npm run build
|
|
281
195
|
```
|
|
282
196
|
|
|
283
|
-
###
|
|
284
|
-
|
|
285
|
-
Check:
|
|
286
|
-
1. Extension is built: `npm run build:extension`
|
|
287
|
-
2. Webview is built: `npm run build:webview`
|
|
288
|
-
3. Files exist in `dist/webview/`
|
|
289
|
-
4. CSP settings in integration.ts allow loading scripts
|
|
290
|
-
|
|
291
|
-
### PPTB Integration Issues
|
|
197
|
+
### ToolBox Integration Issues
|
|
292
198
|
|
|
293
199
|
Check:
|
|
294
200
|
1. `window.toolboxAPI` is available
|
|
@@ -296,29 +202,13 @@ Check:
|
|
|
296
202
|
3. Connection context is being received
|
|
297
203
|
4. Network requests are successful
|
|
298
204
|
|
|
299
|
-
## Migration from Webpack to Vite
|
|
300
|
-
|
|
301
|
-
This tool was migrated from Webpack to Vite for better performance and simpler configuration:
|
|
302
|
-
|
|
303
|
-
**Benefits:**
|
|
304
|
-
- ⚡ Faster development with instant HMR
|
|
305
|
-
- 📦 Smaller production bundles
|
|
306
|
-
- 🎯 Simpler configuration
|
|
307
|
-
- 🔧 Better TypeScript integration
|
|
308
|
-
- 🚀 Native ESM support
|
|
309
|
-
|
|
310
|
-
**Breaking Changes:**
|
|
311
|
-
- Webview bundle location changed from `dist/webview/webview.js` to `dist/webview/index.js`
|
|
312
|
-
- HTML is now generated (not loaded from template)
|
|
313
|
-
- Build output structure simplified
|
|
314
|
-
|
|
315
205
|
## Contributing
|
|
316
206
|
|
|
317
207
|
Contributions are welcome! When contributing:
|
|
318
208
|
|
|
319
|
-
1. Maintain
|
|
209
|
+
1. Maintain PPTB integration patterns
|
|
320
210
|
2. Keep webview bundle browser-only (no Node.js dependencies)
|
|
321
|
-
3. Test in
|
|
211
|
+
3. Test in PowerPlatform ToolBox
|
|
322
212
|
4. Update documentation as needed
|
|
323
213
|
5. Follow existing code style
|
|
324
214
|
|
|
@@ -330,134 +220,3 @@ This project is licensed under the GPL-2.0 License - see the [LICENSE](../../LIC
|
|
|
330
220
|
|
|
331
221
|
- **Issues**: [GitHub Issues](https://github.com/Power-Maverick/DVDT-Tools/issues)
|
|
332
222
|
- **Discussions**: [GitHub Discussions](https://github.com/Power-Maverick/DVDT-Tools/discussions)
|
|
333
|
-
|
|
334
|
-
## Changelog
|
|
335
|
-
|
|
336
|
-
### v0.0.6
|
|
337
|
-
- 🎉 **Major Rewrite**: Converted to React-based architecture
|
|
338
|
-
- 🔄 Added PPTB (Power Platform Toolbox) integration support
|
|
339
|
-
- ⚡ Migrated from Webpack to Vite
|
|
340
|
-
- 🎨 Modern React components with hooks
|
|
341
|
-
- 🌐 Dual platform support (DVDT + PPTB)
|
|
342
|
-
- 📦 Cleaner build output with no Node.js artifacts in webview
|
|
343
|
-
- 🔧 Improved TypeScript configuration
|
|
344
|
-
- 📚 Updated documentation
|
|
345
|
-
|
|
346
|
-
### Previous Versions
|
|
347
|
-
See [CHANGELOG.md](../../CHANGELOG.md) for full history.
|
|
348
|
-
- Copy to clipboard
|
|
349
|
-
|
|
350
|
-
## Integration with Dataverse DevTools
|
|
351
|
-
|
|
352
|
-
### VS Code WebView Panel Integration
|
|
353
|
-
|
|
354
|
-
**Simple function call - no command registration needed:**
|
|
355
|
-
|
|
356
|
-
```typescript
|
|
357
|
-
import { showERDPanel } from '@dvdt-tools/erd-generator';
|
|
358
|
-
|
|
359
|
-
// Call this when you want to show the ERD panel
|
|
360
|
-
showERDPanel(context.extensionUri, environmentUrl, accessToken);
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
**Complete example:**
|
|
364
|
-
|
|
365
|
-
```typescript
|
|
366
|
-
import { showERDPanel } from '@dvdt-tools/erd-generator';
|
|
367
|
-
import * as vscode from 'vscode';
|
|
368
|
-
|
|
369
|
-
// In your DVDT menu handler or button click
|
|
370
|
-
async function openERDGenerator() {
|
|
371
|
-
try {
|
|
372
|
-
const environmentUrl = dvdtConfig.getCurrentEnvironment();
|
|
373
|
-
const accessToken = await dvdtAuth.getAccessToken();
|
|
374
|
-
|
|
375
|
-
if (!environmentUrl || !accessToken) {
|
|
376
|
-
vscode.window.showErrorMessage('Please connect to Dataverse first');
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// Open ERD tool panel
|
|
381
|
-
showERDPanel(context.extensionUri, environmentUrl, accessToken);
|
|
382
|
-
} catch (error) {
|
|
383
|
-
vscode.window.showErrorMessage(`Failed to open ERD Generator: ${error.message}`);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
That's it! The ERD tool will:
|
|
389
|
-
- Open as a panel when called
|
|
390
|
-
- List all solutions in a dropdown control
|
|
391
|
-
- Allow users to select and generate ERDs
|
|
392
|
-
- Handle downloading and copying
|
|
393
|
-
- Provide a complete UI experience with configuration options
|
|
394
|
-
|
|
395
|
-
See [../../VSCODE_INTEGRATION.md](../../VSCODE_INTEGRATION.md) for complete integration guide.
|
|
396
|
-
|
|
397
|
-
## API
|
|
398
|
-
|
|
399
|
-
### showERDPanel()
|
|
400
|
-
|
|
401
|
-
Opens the ERD Generator panel in VS Code.
|
|
402
|
-
|
|
403
|
-
**Parameters:**
|
|
404
|
-
- `extensionUri: vscode.Uri` - VS Code extension URI from context
|
|
405
|
-
- `environmentUrl: string` - Dataverse environment URL
|
|
406
|
-
- `accessToken: string` - Dataverse access token
|
|
407
|
-
|
|
408
|
-
**Example:**
|
|
409
|
-
```typescript
|
|
410
|
-
showERDPanel(context.extensionUri, environmentUrl, accessToken);
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
### DataverseClient
|
|
414
|
-
|
|
415
|
-
Handles communication with Dataverse Web API.
|
|
416
|
-
|
|
417
|
-
**Constructor:**
|
|
418
|
-
```typescript
|
|
419
|
-
new DataverseClient({
|
|
420
|
-
environmentUrl: string,
|
|
421
|
-
accessToken: string,
|
|
422
|
-
apiVersion?: string // Optional, defaults to '9.2'
|
|
423
|
-
})
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
**Methods:**
|
|
427
|
-
- `listSolutions(): Promise<Solution[]>` - Lists all solutions
|
|
428
|
-
- `fetchSolution(uniqueName: string): Promise<DataverseSolution>` - Fetches complete solution metadata
|
|
429
|
-
|
|
430
|
-
### ERDGenerator
|
|
431
|
-
|
|
432
|
-
Generates ERD diagrams from solution metadata.
|
|
433
|
-
|
|
434
|
-
**Constructor:**
|
|
435
|
-
```typescript
|
|
436
|
-
new ERDGenerator({
|
|
437
|
-
format: 'mermaid' | 'plantuml' | 'graphviz',
|
|
438
|
-
includeAttributes?: boolean, // Default: true
|
|
439
|
-
includeRelationships?: boolean, // Default: true
|
|
440
|
-
maxAttributesPerTable?: number // Default: 10, 0 = all
|
|
441
|
-
})
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
**Methods:**
|
|
445
|
-
- `generate(solution: DataverseSolution): string` - Generates ERD diagram
|
|
446
|
-
|
|
447
|
-
## Architecture
|
|
448
|
-
|
|
449
|
-
The ERD tool is self-contained:
|
|
450
|
-
|
|
451
|
-
```
|
|
452
|
-
DVDT Extension
|
|
453
|
-
↓ (provides credentials)
|
|
454
|
-
ERD Tool WebView Panel
|
|
455
|
-
↓ (uses)
|
|
456
|
-
DataverseClient → Dataverse Web API
|
|
457
|
-
↓ (fetches metadata)
|
|
458
|
-
ERDGenerator → Generates diagrams
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
## License
|
|
462
|
-
|
|
463
|
-
GPL-2.0
|
package/index.html
CHANGED
|
@@ -4,9 +4,26 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Dataverse ERD Generator</title>
|
|
7
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
|
8
|
+
<script>
|
|
9
|
+
if (typeof mermaid !== 'undefined') {
|
|
10
|
+
mermaid.initialize({
|
|
11
|
+
startOnLoad: false,
|
|
12
|
+
theme: 'default',
|
|
13
|
+
themeVariables: {
|
|
14
|
+
primaryColor: '#0e639c',
|
|
15
|
+
primaryTextColor: '#fff',
|
|
16
|
+
primaryBorderColor: '#0a4f7c',
|
|
17
|
+
lineColor: '#0e639c',
|
|
18
|
+
secondaryColor: '#f3f4f6',
|
|
19
|
+
tertiaryColor: '#e5e7eb'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
7
24
|
</head>
|
|
8
25
|
<body>
|
|
9
26
|
<div id="root"></div>
|
|
10
|
-
<script type="module" src="/
|
|
27
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
28
|
</body>
|
|
12
29
|
</html>
|
package/package.json
CHANGED
|
@@ -1,50 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-maverick/tool-erd-generator",
|
|
3
3
|
"displayName": "ERD Generator",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"description": "Generate Entity Relationship Diagrams (ERD) for Dataverse solutions - React-based tool
|
|
6
|
-
"
|
|
7
|
-
"types": "dist/src/index.d.ts",
|
|
4
|
+
"version": "0.0.8",
|
|
5
|
+
"description": "Generate Entity Relationship Diagrams (ERD) for Dataverse solutions - React-based tool for PowerPlatform ToolBox",
|
|
6
|
+
"type": "module",
|
|
8
7
|
"scripts": {
|
|
9
|
-
"
|
|
10
|
-
"build
|
|
11
|
-
"
|
|
12
|
-
"dev": "npm run dev:extension & npm run dev:webview",
|
|
13
|
-
"dev:extension": "tsc --watch",
|
|
14
|
-
"dev:webview": "cd webview && vite",
|
|
15
|
-
"preview": "cd webview && vite preview"
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"preview": "vite preview"
|
|
16
11
|
},
|
|
17
12
|
"keywords": [
|
|
18
13
|
"dataverse",
|
|
19
14
|
"erd",
|
|
20
15
|
"entity-relationship-diagram",
|
|
21
16
|
"power-platform",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
17
|
+
"pptb",
|
|
18
|
+
"toolbox"
|
|
24
19
|
],
|
|
25
20
|
"author": "Power Maverick",
|
|
26
21
|
"license": "GPL-2.0",
|
|
27
22
|
"dependencies": {
|
|
28
23
|
"react": "^18.3.1",
|
|
29
|
-
"react-dom": "^18.3.1"
|
|
24
|
+
"react-dom": "^18.3.1",
|
|
25
|
+
"axios": "^1.7.9"
|
|
30
26
|
},
|
|
31
27
|
"devDependencies": {
|
|
32
|
-
"@pptb/types": "1.0.0",
|
|
33
|
-
"@types/node": "24.7.2",
|
|
28
|
+
"@pptb/types": "^1.0.0",
|
|
34
29
|
"@types/react": "^18.3.1",
|
|
35
30
|
"@types/react-dom": "^18.3.0",
|
|
36
|
-
"@types/vscode": "1.85.0",
|
|
37
31
|
"@vitejs/plugin-react": "^4.3.4",
|
|
38
|
-
"
|
|
39
|
-
"typescript": "5.9.3",
|
|
32
|
+
"typescript": "^5.9.3",
|
|
40
33
|
"vite": "^6.0.7"
|
|
41
|
-
},
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"vscode": "^1.85.0"
|
|
44
|
-
},
|
|
45
|
-
"peerDependenciesMeta": {
|
|
46
|
-
"vscode": {
|
|
47
|
-
"optional": true
|
|
48
|
-
}
|
|
49
34
|
}
|
|
50
35
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
2
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"module": "
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
10
7
|
"skipLibCheck": true,
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": false,
|
|
20
|
+
"noUnusedParameters": false,
|
|
21
|
+
"noFallthroughCasesInSwitch": true
|
|
13
22
|
},
|
|
14
|
-
"include": [
|
|
15
|
-
|
|
16
|
-
],
|
|
17
|
-
"exclude": [
|
|
18
|
-
"src/dvdtIntegration/webview.ts",
|
|
19
|
-
]
|
|
23
|
+
"include": ["src"],
|
|
24
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
20
25
|
}
|