@power-maverick/tool-erd-generator 0.0.7 → 0.0.9
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/README.md +118 -359
- package/index.html +18 -1
- package/package.json +13 -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/CONVERSION_SUMMARY.md
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
# ERD Generator React Conversion - Implementation Summary
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
Successfully converted the ERD Generator from vanilla TypeScript/Webpack to React-based architecture with dual platform support (DVDT and PPTB).
|
|
5
|
-
|
|
6
|
-
## Objectives Achieved
|
|
7
|
-
|
|
8
|
-
### ✅ 1. Convert to React-based Tool
|
|
9
|
-
- Implemented React 18 with functional components and hooks
|
|
10
|
-
- Created modular component structure (App.tsx, main.tsx)
|
|
11
|
-
- Migrated all UI logic to React patterns (state management, effects, event handlers)
|
|
12
|
-
- Maintained all existing functionality
|
|
13
|
-
|
|
14
|
-
### ✅ 2. Enable DVDT Integration with Minimal Changes
|
|
15
|
-
- Kept the same integration API: `showERDPanel(extensionUri, environmentUrl, accessToken)`
|
|
16
|
-
- Updated integration.ts to generate HTML dynamically instead of loading template
|
|
17
|
-
- Removed `fs` dependency from integration layer
|
|
18
|
-
- Webview receives credentials via postMessage (unchanged behavior)
|
|
19
|
-
- File save and clipboard operations still handled by VS Code APIs
|
|
20
|
-
|
|
21
|
-
### ✅ 3. Enable PPTB Integration
|
|
22
|
-
- Automatic environment detection (DVDT vs PPTB)
|
|
23
|
-
- Support for `window.toolboxAPI` methods:
|
|
24
|
-
- `getToolContext()` - Get connection details
|
|
25
|
-
- `showNotification()` - Display notifications
|
|
26
|
-
- `onToolboxEvent()` - Subscribe to events
|
|
27
|
-
- `getConnections()` - List available connections
|
|
28
|
-
- Listens for `TOOLBOX_CONTEXT` via postMessage
|
|
29
|
-
- Browser-native file download and clipboard APIs for PPTB
|
|
30
|
-
|
|
31
|
-
### ✅ 4. No Node.js Artifacts in Output
|
|
32
|
-
- Webview bundle is pure browser JavaScript
|
|
33
|
-
- Verified zero occurrences of:
|
|
34
|
-
- `require()`
|
|
35
|
-
- `module.exports`
|
|
36
|
-
- `process.env`
|
|
37
|
-
- Other Node.js-specific patterns
|
|
38
|
-
- Bundle size: ~196 KB (minified)
|
|
39
|
-
- Uses only browser-standard APIs
|
|
40
|
-
|
|
41
|
-
## Technical Architecture
|
|
42
|
-
|
|
43
|
-
### Build System
|
|
44
|
-
**Before (Webpack):**
|
|
45
|
-
```
|
|
46
|
-
webpack → dist/webview/webview.js (single bundle)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**After (Vite):**
|
|
50
|
-
```
|
|
51
|
-
vite → dist/webview/
|
|
52
|
-
├── index.html
|
|
53
|
-
├── index.js
|
|
54
|
-
└── index.css
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Component Structure
|
|
58
|
-
```
|
|
59
|
-
webview/
|
|
60
|
-
├── App.tsx # Main React component (16.7 KB)
|
|
61
|
-
├── main.tsx # React entry point (231 bytes)
|
|
62
|
-
└── styles.css # Styling (6.5 KB)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Dual Platform Support
|
|
66
|
-
```typescript
|
|
67
|
-
// Automatic detection
|
|
68
|
-
if (window.acquireVsCodeApi) {
|
|
69
|
-
// DVDT mode - VS Code webview
|
|
70
|
-
setIsVSCode(true);
|
|
71
|
-
} else if (window.toolboxAPI) {
|
|
72
|
-
// PPTB mode - Power Platform Toolbox
|
|
73
|
-
setIsPPTB(true);
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Integration Flow
|
|
78
|
-
|
|
79
|
-
**DVDT (VS Code):**
|
|
80
|
-
1. Extension calls `showERDPanel(uri, url, token)`
|
|
81
|
-
2. Creates WebView panel
|
|
82
|
-
3. Generates HTML with React bundle references
|
|
83
|
-
4. Sends credentials via `postMessage`
|
|
84
|
-
5. React app receives and uses credentials
|
|
85
|
-
6. File operations go through VS Code APIs
|
|
86
|
-
|
|
87
|
-
**PPTB (Web):**
|
|
88
|
-
1. Tool loads in browser iframe
|
|
89
|
-
2. Listens for `TOOLBOX_CONTEXT`
|
|
90
|
-
3. Calls `toolboxAPI.getToolContext()`
|
|
91
|
-
4. React app receives connection details
|
|
92
|
-
5. File operations use browser APIs
|
|
93
|
-
|
|
94
|
-
## File Changes
|
|
95
|
-
|
|
96
|
-
### Added Files
|
|
97
|
-
- `webview/App.tsx` - Main React component (419 lines)
|
|
98
|
-
- `webview/main.tsx` - React entry point (10 lines)
|
|
99
|
-
- `webview/styles.css` - Styling (232 lines)
|
|
100
|
-
- `vite.config.ts` - Vite configuration (17 lines)
|
|
101
|
-
- `index.html` - HTML entry point (11 lines)
|
|
102
|
-
|
|
103
|
-
### Modified Files
|
|
104
|
-
- `package.json` - Updated dependencies and build scripts
|
|
105
|
-
- `tsconfig.webview.json` - Updated for React
|
|
106
|
-
- `src/dvdtIntegration/integration.ts` - Generate HTML instead of loading template
|
|
107
|
-
- `README.md` - Updated documentation
|
|
108
|
-
- `tools/erd-generator/README.md` - Comprehensive guide
|
|
109
|
-
|
|
110
|
-
### Removed Files
|
|
111
|
-
- `webpack.config.js` - No longer needed (replaced by Vite)
|
|
112
|
-
- `src/dvdtIntegration/webview.ts` - Replaced by React components
|
|
113
|
-
- `ui/webview.html` - HTML now generated dynamically
|
|
114
|
-
|
|
115
|
-
## Dependencies
|
|
116
|
-
|
|
117
|
-
### Production Dependencies
|
|
118
|
-
```json
|
|
119
|
-
{
|
|
120
|
-
"react": "^18.3.1",
|
|
121
|
-
"react-dom": "^18.3.1"
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Development Dependencies
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"@types/react": "^18.3.1",
|
|
129
|
-
"@types/react-dom": "^18.3.0",
|
|
130
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
131
|
-
"vite": "^6.0.7"
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Removed Dependencies
|
|
136
|
-
- `webpack`: ^5.102.1
|
|
137
|
-
- `webpack-cli`: ^5.1.4
|
|
138
|
-
- `ts-loader`: ^9.5.4
|
|
139
|
-
|
|
140
|
-
## Build Output
|
|
141
|
-
|
|
142
|
-
### Size Comparison
|
|
143
|
-
**Before (Webpack):**
|
|
144
|
-
- webview.js: ~50 KB
|
|
145
|
-
|
|
146
|
-
**After (Vite):**
|
|
147
|
-
- index.js: 191 KB (includes React)
|
|
148
|
-
- index.css: 5.2 KB
|
|
149
|
-
- index.html: 376 bytes
|
|
150
|
-
- **Total: ~196 KB**
|
|
151
|
-
|
|
152
|
-
Note: Size increase is expected due to React library inclusion, but the bundle is still highly optimized.
|
|
153
|
-
|
|
154
|
-
### Structure
|
|
155
|
-
```
|
|
156
|
-
dist/
|
|
157
|
-
├── src/ # Extension code (Node.js)
|
|
158
|
-
│ ├── index.js # Main export
|
|
159
|
-
│ ├── components/
|
|
160
|
-
│ │ └── ERDGenerator.js
|
|
161
|
-
│ ├── utils/
|
|
162
|
-
│ │ └── DataverseClient.js
|
|
163
|
-
│ └── dvdtIntegration/
|
|
164
|
-
│ └── integration.js
|
|
165
|
-
└── webview/ # Browser bundle
|
|
166
|
-
├── index.html
|
|
167
|
-
├── index.js
|
|
168
|
-
└── index.css
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Quality Checks
|
|
172
|
-
|
|
173
|
-
### ✅ Build Status
|
|
174
|
-
- Extension build: SUCCESS
|
|
175
|
-
- Webview build: SUCCESS
|
|
176
|
-
- No TypeScript errors
|
|
177
|
-
- No linting errors
|
|
178
|
-
|
|
179
|
-
### ✅ Security
|
|
180
|
-
- CodeQL analysis: 0 vulnerabilities
|
|
181
|
-
- No security warnings
|
|
182
|
-
- Clean code review
|
|
183
|
-
|
|
184
|
-
### ✅ Browser Compatibility
|
|
185
|
-
- Pure browser JavaScript
|
|
186
|
-
- No Node.js dependencies
|
|
187
|
-
- Standard Web APIs only
|
|
188
|
-
- Works in modern browsers
|
|
189
|
-
|
|
190
|
-
## Migration Guide for Users
|
|
191
|
-
|
|
192
|
-
### For DVDT Integration (No Changes Required)
|
|
193
|
-
The integration API remains the same:
|
|
194
|
-
```typescript
|
|
195
|
-
import { showERDPanel } from '@dvdt-tools/erd-generator';
|
|
196
|
-
|
|
197
|
-
showERDPanel(context.extensionUri, environmentUrl, accessToken);
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**Note:** If you were referencing the webview bundle path directly, update from:
|
|
201
|
-
- Old: `dist/webview/webview.js`
|
|
202
|
-
- New: `dist/webview/index.js`
|
|
203
|
-
|
|
204
|
-
### For PPTB Integration (New Feature)
|
|
205
|
-
No code changes needed - the tool automatically detects PPTB environment and integrates.
|
|
206
|
-
|
|
207
|
-
## Benefits
|
|
208
|
-
|
|
209
|
-
### Developer Experience
|
|
210
|
-
- ⚡ **Faster builds**: Vite HMR is instant
|
|
211
|
-
- 🔧 **Simpler config**: Vite config is 17 lines vs 30+ for Webpack
|
|
212
|
-
- 📦 **Better TypeScript**: Native TypeScript support
|
|
213
|
-
- 🎨 **Component reusability**: React components are modular
|
|
214
|
-
|
|
215
|
-
### User Experience
|
|
216
|
-
- 🎯 **Consistent UI**: Same experience in DVDT and PPTB
|
|
217
|
-
- 🚀 **Modern feel**: React provides smooth interactions
|
|
218
|
-
- 🔄 **Reactive updates**: State changes update UI automatically
|
|
219
|
-
- 💪 **Robust**: Type-safe throughout
|
|
220
|
-
|
|
221
|
-
### Maintenance
|
|
222
|
-
- 📚 **Better docs**: Comprehensive guides for both platforms
|
|
223
|
-
- 🧪 **Easier testing**: React Testing Library compatible
|
|
224
|
-
- 🔍 **Clearer code**: Component-based structure
|
|
225
|
-
- 🛠️ **Industry standard**: React is widely known
|
|
226
|
-
|
|
227
|
-
## Future Enhancements (Out of Scope)
|
|
228
|
-
|
|
229
|
-
While not part of this PR, future enhancements could include:
|
|
230
|
-
- Unit tests with React Testing Library
|
|
231
|
-
- E2E tests with Playwright
|
|
232
|
-
- Additional diagram export formats
|
|
233
|
-
- Real-time collaboration features
|
|
234
|
-
- Theme customization
|
|
235
|
-
- Diagram templates
|
|
236
|
-
|
|
237
|
-
## Testing Recommendations
|
|
238
|
-
|
|
239
|
-
### Manual Testing
|
|
240
|
-
1. **DVDT (VS Code)**
|
|
241
|
-
- Install in Dataverse DevTools
|
|
242
|
-
- Call showERDPanel with credentials
|
|
243
|
-
- Verify panel opens and loads
|
|
244
|
-
- Select a solution and generate ERD
|
|
245
|
-
- Test download and copy functions
|
|
246
|
-
|
|
247
|
-
2. **PPTB (Web)**
|
|
248
|
-
- Deploy to Power Platform Toolbox
|
|
249
|
-
- Open tool from toolbox
|
|
250
|
-
- Verify connection context is received
|
|
251
|
-
- Select a solution and generate ERD
|
|
252
|
-
- Test browser download and copy functions
|
|
253
|
-
|
|
254
|
-
### Automated Testing (Future)
|
|
255
|
-
- Unit tests for React components
|
|
256
|
-
- Integration tests for API calls
|
|
257
|
-
- E2E tests for complete workflows
|
|
258
|
-
- Visual regression tests
|
|
259
|
-
|
|
260
|
-
## Rollback Plan
|
|
261
|
-
|
|
262
|
-
If issues are discovered:
|
|
263
|
-
1. Revert to previous version (pre-React)
|
|
264
|
-
2. Webpack and old webview files are in git history
|
|
265
|
-
3. Package.json can be reverted to use webpack
|
|
266
|
-
4. No database or breaking API changes
|
|
267
|
-
|
|
268
|
-
## Success Metrics
|
|
269
|
-
|
|
270
|
-
- ✅ Build completes successfully
|
|
271
|
-
- ✅ No linting errors
|
|
272
|
-
- ✅ No security vulnerabilities
|
|
273
|
-
- ✅ Zero Node.js artifacts in webview bundle
|
|
274
|
-
- ✅ Dual platform support implemented
|
|
275
|
-
- ✅ Documentation updated
|
|
276
|
-
- ✅ Code review passed
|
|
277
|
-
- ✅ All original features preserved
|
|
278
|
-
|
|
279
|
-
## Conclusion
|
|
280
|
-
|
|
281
|
-
This conversion successfully modernizes the ERD Generator tool while:
|
|
282
|
-
- Maintaining backward compatibility with DVDT
|
|
283
|
-
- Adding new PPTB integration capabilities
|
|
284
|
-
- Eliminating Node.js artifacts from webview
|
|
285
|
-
- Following industry best practices
|
|
286
|
-
- Providing comprehensive documentation
|
|
287
|
-
|
|
288
|
-
The tool is now production-ready for both DVDT and PPTB platforms.
|
package/REFACTORING_COMPLETE.md
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
# ERD Generator Dual-Platform Refactoring Summary
|
|
2
|
-
|
|
3
|
-
## Completion Date
|
|
4
|
-
October 19, 2025
|
|
5
|
-
|
|
6
|
-
## Objective
|
|
7
|
-
Refactor the ERD Generator to work with both PowerPlatform ToolBox (PPTB) and Dataverse DevTools (DVDT) while maintaining a single codebase and ensuring simple integration for tool makers.
|
|
8
|
-
|
|
9
|
-
## Implementation Status: ✅ COMPLETE
|
|
10
|
-
|
|
11
|
-
All design decisions and implementation tasks have been successfully completed.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Design Decisions (All Approved ✅)
|
|
16
|
-
|
|
17
|
-
### 1. Single Package with Runtime Detection ✅
|
|
18
|
-
- **Implementation**: Platform abstraction layer in `platformApi.ts` with `PlatformAPIFactory`
|
|
19
|
-
- **Detection**: Automatic environment detection via `isPPTB()` and `isDVDT()` methods
|
|
20
|
-
- **Result**: Zero configuration needed - tool detects platform automatically
|
|
21
|
-
|
|
22
|
-
### 2. Unified Platform API Interface ✅
|
|
23
|
-
- **Interface**: `IPlatformAPI` with consistent methods across platforms
|
|
24
|
-
- **Implementations**:
|
|
25
|
-
- `PPTBPlatformAPI` - Uses `window.toolboxAPI`
|
|
26
|
-
- `DVDTPlatformAPI` - Uses VS Code message passing
|
|
27
|
-
- **Result**: App.tsx uses same API calls regardless of platform
|
|
28
|
-
|
|
29
|
-
### 3. Single Build Output ✅
|
|
30
|
-
- **Build System**: Vite for webview, TypeScript compiler for extension code
|
|
31
|
-
- **Output Location**: `dist/webview/` with predictable filenames
|
|
32
|
-
- `index.html` - Entry point
|
|
33
|
-
- `index.js` - Bundled application
|
|
34
|
-
- `index.css` - Compiled styles
|
|
35
|
-
- **Result**: Both platforms use the same build artifacts
|
|
36
|
-
|
|
37
|
-
### 4. Backward Compatible ✅
|
|
38
|
-
- **DVDT Integration**: `showERDPanel()` function maintained
|
|
39
|
-
- **API Stability**: No breaking changes to existing DVDT integration
|
|
40
|
-
- **Verification**: Existing integration code works with new build output
|
|
41
|
-
- **Result**: Existing DVDT consumers require no code changes
|
|
42
|
-
|
|
43
|
-
### 5. Automatic Initialization ✅
|
|
44
|
-
- **Platform Detection**: Runs on first render via `useEffect`
|
|
45
|
-
- **Context Handling**:
|
|
46
|
-
- PPTB: Listens for `TOOLBOX_CONTEXT` via `postMessage`
|
|
47
|
-
- DVDT: Listens for `setCredentials` command
|
|
48
|
-
- **Result**: No manual initialization required by consumers
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Completed Tasks
|
|
53
|
-
|
|
54
|
-
### ✅ 1. Install @pptb/types Dependency
|
|
55
|
-
- Added `@pptb/types` as dev dependency
|
|
56
|
-
- Provides TypeScript definitions for PPTB API
|
|
57
|
-
- Version: 1.0.0
|
|
58
|
-
|
|
59
|
-
### ✅ 2. Create Platform Abstraction Layer
|
|
60
|
-
**File**: `src/models/platformApi.ts` (280 lines)
|
|
61
|
-
|
|
62
|
-
**Components**:
|
|
63
|
-
- `IPlatformAPI` interface - Unified API surface
|
|
64
|
-
- `PPTBPlatformAPI` class - PPTB implementation
|
|
65
|
-
- `DVDTPlatformAPI` class - DVDT implementation
|
|
66
|
-
- `PlatformAPIFactory` - Factory with auto-detection
|
|
67
|
-
|
|
68
|
-
**Key Methods**:
|
|
69
|
-
- `getToolContext()` - Retrieve connection credentials
|
|
70
|
-
- `showNotification()` - Display notifications
|
|
71
|
-
- `saveFile()` - Save files to disk
|
|
72
|
-
- `copyToClipboard()` - Copy text to clipboard
|
|
73
|
-
- `getPlatformName()` - Get platform identifier
|
|
74
|
-
|
|
75
|
-
### ✅ 3. Update React App for Dual-Mode
|
|
76
|
-
**File**: `webview/App.tsx` (413 lines)
|
|
77
|
-
|
|
78
|
-
**Changes**:
|
|
79
|
-
- Added `platformAPI` state management
|
|
80
|
-
- Implemented dual-mode initialization in `useEffect`
|
|
81
|
-
- Updated all platform-specific operations to use `IPlatformAPI`
|
|
82
|
-
- Added message listeners for both PPTB and DVDT contexts
|
|
83
|
-
- Refactored notification, file save, and clipboard operations
|
|
84
|
-
|
|
85
|
-
### ✅ 4. Update Integration Code
|
|
86
|
-
**File**: `src/dvdtIntegration/integration.ts`
|
|
87
|
-
|
|
88
|
-
**Status**: Already compatible - no changes needed
|
|
89
|
-
- `showERDPanel()` function maintained
|
|
90
|
-
- Uses correct build output paths via Constants
|
|
91
|
-
- Backward compatible with existing DVDT consumers
|
|
92
|
-
|
|
93
|
-
### ✅ 5. Update Build Configuration
|
|
94
|
-
**Changes**:
|
|
95
|
-
- Created `webview/tsconfig.json` for proper TypeScript support
|
|
96
|
-
- Created `webview/tsconfig.node.json` for Vite config
|
|
97
|
-
- Moved `vite.config.ts` to `webview/` folder
|
|
98
|
-
- Updated `package.json` scripts:
|
|
99
|
-
- `build:webview`: `cd webview && vite build`
|
|
100
|
-
- `dev:webview`: `cd webview && vite`
|
|
101
|
-
- Created `webview/index.html` as Vite entry point
|
|
102
|
-
|
|
103
|
-
**Build Output**:
|
|
104
|
-
```
|
|
105
|
-
dist/
|
|
106
|
-
├── src/ # Extension code (TypeScript compiled)
|
|
107
|
-
└── webview/ # React app (Vite bundled)
|
|
108
|
-
├── index.html
|
|
109
|
-
├── index.js
|
|
110
|
-
└── index.css
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Verification**: ✅ Build succeeds with predictable filenames
|
|
114
|
-
|
|
115
|
-
### ✅ 6. Update Documentation
|
|
116
|
-
**Created Files**:
|
|
117
|
-
1. **PPTB_Integration.md** (300+ lines)
|
|
118
|
-
- Complete PPTB integration guide
|
|
119
|
-
- Installation instructions
|
|
120
|
-
- Usage examples
|
|
121
|
-
- API reference
|
|
122
|
-
- Development tips
|
|
123
|
-
|
|
124
|
-
2. **Integration_Examples.md** (600+ lines)
|
|
125
|
-
- Full PPTB tool example
|
|
126
|
-
- Full DVDT extension example
|
|
127
|
-
- Dual-mode tool creation guide
|
|
128
|
-
- Package.json templates
|
|
129
|
-
|
|
130
|
-
3. **Updated README.md**
|
|
131
|
-
- Prominent dual-platform messaging
|
|
132
|
-
- Quick links to integration guides
|
|
133
|
-
- Platform support table
|
|
134
|
-
- Platform abstraction overview
|
|
135
|
-
- Technical architecture details
|
|
136
|
-
|
|
137
|
-
### ✅ 7. Add Sample Code for Both Platforms
|
|
138
|
-
**Location**: `docs/Integration_Examples.md`
|
|
139
|
-
|
|
140
|
-
**Includes**:
|
|
141
|
-
- Complete PPTB tool implementation (150+ lines)
|
|
142
|
-
- Complete DVDT extension implementation (100+ lines)
|
|
143
|
-
- Dual-mode custom webview example (100+ lines)
|
|
144
|
-
- Package.json configuration for both platforms
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Type Definitions
|
|
149
|
-
|
|
150
|
-
### Created Files
|
|
151
|
-
|
|
152
|
-
**File**: `src/types/pptb.d.ts`
|
|
153
|
-
```typescript
|
|
154
|
-
/// <reference types="@pptb/types" />
|
|
155
|
-
|
|
156
|
-
declare global {
|
|
157
|
-
interface Window {
|
|
158
|
-
toolboxAPI: ToolBox.ToolBoxAPI;
|
|
159
|
-
TOOLBOX_CONTEXT?: {
|
|
160
|
-
toolId?: string | null;
|
|
161
|
-
connectionUrl?: string | null;
|
|
162
|
-
accessToken?: string | null;
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## Platform Detection Logic
|
|
171
|
-
|
|
172
|
-
### Automatic Detection
|
|
173
|
-
```typescript
|
|
174
|
-
// In PlatformAPIFactory
|
|
175
|
-
static isPPTB(): boolean {
|
|
176
|
-
return typeof window !== 'undefined' &&
|
|
177
|
-
'toolboxAPI' in window &&
|
|
178
|
-
window.toolboxAPI !== null;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
static isDVDT(): boolean {
|
|
182
|
-
return typeof window !== 'undefined' &&
|
|
183
|
-
'acquireVsCodeApi' in window;
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Factory Pattern
|
|
188
|
-
```typescript
|
|
189
|
-
const api = PlatformAPIFactory.create();
|
|
190
|
-
// Automatically creates PPTBPlatformAPI or DVDTPlatformAPI
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
## Integration Workflows
|
|
196
|
-
|
|
197
|
-
### PPTB Integration
|
|
198
|
-
1. Tool calls `toolbox.loadTool()` with webview HTML
|
|
199
|
-
2. HTML loads `dist/webview/index.html`
|
|
200
|
-
3. App detects PPTB via `window.toolboxAPI`
|
|
201
|
-
4. Listens for `TOOLBOX_CONTEXT` via `postMessage`
|
|
202
|
-
5. Uses `PPTBPlatformAPI` for all operations
|
|
203
|
-
|
|
204
|
-
### DVDT Integration
|
|
205
|
-
1. Extension calls `showERDPanel(extensionUri, url, token)`
|
|
206
|
-
2. WebView panel created with ERD tool
|
|
207
|
-
3. App detects DVDT via `acquireVsCodeApi`
|
|
208
|
-
4. Listens for `setCredentials` message
|
|
209
|
-
5. Uses `DVDTPlatformAPI` for all operations
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## File Structure
|
|
214
|
-
|
|
215
|
-
```
|
|
216
|
-
tools/erd-generator/
|
|
217
|
-
├── src/
|
|
218
|
-
│ ├── models/
|
|
219
|
-
│ │ └── platformApi.ts # Platform abstraction ✅
|
|
220
|
-
│ ├── types/
|
|
221
|
-
│ │ └── pptb.d.ts # PPTB type definitions ✅
|
|
222
|
-
│ ├── dvdtIntegration/
|
|
223
|
-
│ │ └── integration.ts # DVDT showERDPanel() ✅
|
|
224
|
-
│ ├── utils/
|
|
225
|
-
│ │ └── Constants.ts # Path constants ✅
|
|
226
|
-
│ └── index.ts # Public exports ✅
|
|
227
|
-
├── webview/
|
|
228
|
-
│ ├── App.tsx # React app (refactored) ✅
|
|
229
|
-
│ ├── main.tsx # React entry point ✅
|
|
230
|
-
│ ├── styles.css # Styles ✅
|
|
231
|
-
│ ├── index.html # Vite entry ✅
|
|
232
|
-
│ ├── vite.config.ts # Vite config ✅
|
|
233
|
-
│ ├── tsconfig.json # Webview TypeScript config ✅
|
|
234
|
-
│ └── tsconfig.node.json # Node TypeScript config ✅
|
|
235
|
-
├── docs/
|
|
236
|
-
│ ├── PPTB_Integration.md # PPTB guide ✅
|
|
237
|
-
│ ├── Integration_Examples.md # Code examples ✅
|
|
238
|
-
│ ├── DVDT_Integration.md # DVDT guide ✅
|
|
239
|
-
│ └── Getting_Started.md # Beginner guide ✅
|
|
240
|
-
├── dist/ # Build output ✅
|
|
241
|
-
│ ├── src/ # Extension code
|
|
242
|
-
│ └── webview/ # React app
|
|
243
|
-
│ ├── index.html
|
|
244
|
-
│ ├── index.js
|
|
245
|
-
│ └── index.css
|
|
246
|
-
├── package.json # Updated scripts ✅
|
|
247
|
-
└── README.md # Updated overview ✅
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## Build Commands
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
# Build everything
|
|
256
|
-
npm run build
|
|
257
|
-
|
|
258
|
-
# Build extension code only
|
|
259
|
-
npm run build:extension
|
|
260
|
-
|
|
261
|
-
# Build webview only
|
|
262
|
-
npm run build:webview
|
|
263
|
-
|
|
264
|
-
# Development mode
|
|
265
|
-
npm run dev
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
**Build Output**: ✅ Verified working with predictable filenames
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## Key Achievements
|
|
273
|
-
|
|
274
|
-
1. ✅ **Zero Configuration** - Platform detection is automatic
|
|
275
|
-
2. ✅ **Single Codebase** - No platform-specific branches in application code
|
|
276
|
-
3. ✅ **Unified API** - Same interface for both platforms
|
|
277
|
-
4. ✅ **Backward Compatible** - Existing DVDT integrations continue working
|
|
278
|
-
5. ✅ **Predictable Build** - Vite outputs to dist/webview with stable filenames
|
|
279
|
-
6. ✅ **Comprehensive Documentation** - Guides for both platforms with examples
|
|
280
|
-
7. ✅ **Type Safety** - Full TypeScript support for both platforms
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
## Testing Checklist
|
|
285
|
-
|
|
286
|
-
### Build Verification ✅
|
|
287
|
-
- [x] Extension code compiles without errors
|
|
288
|
-
- [x] Webview builds with predictable filenames
|
|
289
|
-
- [x] Build output structure matches requirements
|
|
290
|
-
|
|
291
|
-
### Code Quality ✅
|
|
292
|
-
- [x] Platform abstraction layer implemented
|
|
293
|
-
- [x] Type definitions complete
|
|
294
|
-
- [x] App.tsx refactored for dual-mode
|
|
295
|
-
|
|
296
|
-
### Documentation ✅
|
|
297
|
-
- [x] PPTB integration guide created
|
|
298
|
-
- [x] Integration examples provided
|
|
299
|
-
- [x] README updated with dual-platform support
|
|
300
|
-
|
|
301
|
-
### Integration ✅
|
|
302
|
-
- [x] DVDT `showERDPanel()` maintained
|
|
303
|
-
- [x] Build paths compatible with DVDT
|
|
304
|
-
- [x] No breaking changes introduced
|
|
305
|
-
|
|
306
|
-
---
|
|
307
|
-
|
|
308
|
-
## Next Steps (For Testing)
|
|
309
|
-
|
|
310
|
-
### Manual Testing Required
|
|
311
|
-
|
|
312
|
-
1. **Test PPTB Integration**
|
|
313
|
-
- Load tool in PowerPlatform ToolBox
|
|
314
|
-
- Verify context injection works
|
|
315
|
-
- Test notifications, file save, clipboard
|
|
316
|
-
- Verify ERD generation
|
|
317
|
-
|
|
318
|
-
2. **Test DVDT Integration**
|
|
319
|
-
- Install in Dataverse DevTools
|
|
320
|
-
- Call `showERDPanel()` from extension
|
|
321
|
-
- Verify credentials passed correctly
|
|
322
|
-
- Test ERD generation and export
|
|
323
|
-
|
|
324
|
-
3. **Test Platform Detection**
|
|
325
|
-
- Verify automatic detection works
|
|
326
|
-
- Check console logs show correct platform
|
|
327
|
-
- Ensure no errors in browser console
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## Documentation Links
|
|
332
|
-
|
|
333
|
-
- **PPTB Integration**: `docs/PPTB_Integration.md`
|
|
334
|
-
- **DVDT Integration**: `docs/DVDT_Integration.md`
|
|
335
|
-
- **Integration Examples**: `docs/Integration_Examples.md`
|
|
336
|
-
- **Getting Started**: `docs/Getting_Started.md`
|
|
337
|
-
- **Main README**: `README.md`
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## Conclusion
|
|
342
|
-
|
|
343
|
-
The ERD Generator has been successfully refactored to support both PPTB and DVDT platforms with:
|
|
344
|
-
|
|
345
|
-
- ✅ **Clean architecture** using platform abstraction pattern
|
|
346
|
-
- ✅ **Zero breaking changes** to existing integrations
|
|
347
|
-
- ✅ **Automatic platform detection** requiring no configuration
|
|
348
|
-
- ✅ **Comprehensive documentation** for tool makers
|
|
349
|
-
- ✅ **Working build system** with predictable output
|
|
350
|
-
- ✅ **Type-safe implementation** with full TypeScript support
|
|
351
|
-
|
|
352
|
-
**Status**: Ready for testing in both platforms! 🚀
|
package/TYPESCRIPT_NOTES.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# TypeScript Language Service Notes
|
|
2
|
-
|
|
3
|
-
## Editor Errors vs Build Errors
|
|
4
|
-
|
|
5
|
-
You may see TypeScript errors in VS Code's editor for `webview/App.tsx`, such as:
|
|
6
|
-
- "Cannot find name 'window'"
|
|
7
|
-
- "Cannot use JSX unless the '--jsx' flag is provided"
|
|
8
|
-
|
|
9
|
-
**These are editor-only errors and do NOT affect the build.**
|
|
10
|
-
|
|
11
|
-
## Why This Happens
|
|
12
|
-
|
|
13
|
-
The VS Code TypeScript language service sometimes doesn't correctly pick up the separate `webview/tsconfig.json` configuration, especially in monorepo-style projects where different folders have different TypeScript configurations.
|
|
14
|
-
|
|
15
|
-
## Build Still Works
|
|
16
|
-
|
|
17
|
-
Despite the editor errors, the build process works correctly because:
|
|
18
|
-
|
|
19
|
-
1. **Vite builds the webview** using `webview/tsconfig.json`:
|
|
20
|
-
- Has `"jsx": "react-jsx"` configured
|
|
21
|
-
- Includes DOM types via `"lib": ["ES2020", "DOM", "DOM.Iterable"]`
|
|
22
|
-
- Result: `npm run build:webview` ✅ succeeds
|
|
23
|
-
|
|
24
|
-
2. **TypeScript compiles the extension** using `tsconfig.json`:
|
|
25
|
-
- Configured for Node.js/VS Code environment
|
|
26
|
-
- Excludes webview files
|
|
27
|
-
- Result: `npm run build:extension` ✅ succeeds
|
|
28
|
-
|
|
29
|
-
## Verification
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Build succeeds with no errors
|
|
33
|
-
npm run build
|
|
34
|
-
|
|
35
|
-
# Output shows success
|
|
36
|
-
✓ 81 modules transformed.
|
|
37
|
-
✓ built in 382ms
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Solution (Optional)
|
|
41
|
-
|
|
42
|
-
If you want to clear the editor errors, you can:
|
|
43
|
-
|
|
44
|
-
1. **Reload VS Code window**: `Cmd+Shift+P` → "Developer: Reload Window"
|
|
45
|
-
2. **Restart TS Server**: `Cmd+Shift+P` → "TypeScript: Restart TS Server"
|
|
46
|
-
3. **Use workspace TypeScript**: Ensure VS Code uses the workspace TypeScript version
|
|
47
|
-
|
|
48
|
-
However, these steps are optional since the build works correctly regardless.
|
|
49
|
-
|
|
50
|
-
## Summary
|
|
51
|
-
|
|
52
|
-
✅ **Build works perfectly** - all files compile and bundle correctly
|
|
53
|
-
✅ **Code is valid** - React, JSX, and window references are all correct
|
|
54
|
-
✅ **Type safety maintained** - Full TypeScript checking during build
|
|
55
|
-
⚠️ **Editor shows false positives** - language service configuration issue only
|
|
56
|
-
|
|
57
|
-
**You can safely ignore the editor errors and proceed with testing the tool in both PPTB and DVDT platforms.**
|