Architecture: How should Angular Element widgets connect to the Platform E...
Documentation for Sessions
🏗️ Architecture: How should Angular Element widgets connect to the Platform E...
Date: 2026-03-26
Time: 15:29:17 UTC
Session: gspace1-271.6
Agent: backend
Confidence: 93%
Status: ✅ Documented
📋 Decision Context
Question:
How should Angular Element widgets connect to the Platform Elements backend for CRUD operations?
Task: Not specified
🎯 Decision Made
Chosen:
PeDataBridge utility wraps window.platformDataClient (set by platform-app). Each widget accepts entity, board-entity, column-entity, group-entity @Input attributes. Auto-fetches on init when DataClient is available. Falls back to static data/JSON attributes in demo mode. Create operations strip client-side IDs and replace with MongoDB _id from response for future update/delete calls.
Options Considered:
- No alternatives documented
💭 Reasoning
Platform Elements already initializes a DataClient in platform-app's connectedCallback and stores it on window.platformDataClient. Angular Elements load AFTER platform-app (script order + lazy loading), so the DataClient is guaranteed available. The bridge must match the DataClient's exact API: list() POSTs to /query with {page, pageSize, search, sort, filter}, create() POSTs to /insert with {data: {...}}, update() PUTs to /{_id} with {data: cleanData}, delete() DELETEs /{_id}. The dual-mode (entity attribute for live data, data attribute for static JSON) means Vitto can generate either mode and the widget works in both Studio preview and production deployment.
📁 Files Involved
libs/libs-structural/platform-elements-angular/src/lib/utils/pe-data-bridge.tslibs/libs-structural/platform-elements/src/lib/runtime/data-client.ts
🔗 Related
- Decision ID:
dev_1774538957523_dg0m7vv - Session: 271
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation