Live Data extraction for Reuse

Last modified by Manuel Leduc on 2026/01/19 15:27

Description

Use Cases

  • UC1: Live Data is usable in XWiki with the usual macro and velocity script services
  • UC2: Live Data is usable from other web projects using npm dependencies
  • UC3: Live Data can be connected to other sources of data (e.g., CVS files on a file system).

Requirements

  • RQ1: The amount of data transferred to the browser must not be larger because of the extraction of Live Data to make it reusable
  • RQ2: **todo**

Architecture

Packages published to a public npm registry:

  • @xwiki/platform-livedata-api: Generic API to provide data to display in a Live Data from arbitrary sources (e.g., an XWiki instance or a file system).
  • @xwiki/platform-livedata-ui: contains the reusable Live Data UI elements.
  • @xwiki/platform-livedata-xwiki: contains the XWiki-specific implementation of the API to access data to display in a Live Data.

Maven modules bundling copies of published npm packages for distribution on XWiki packaging:

  • xwiki-platform-livedata-node-xwiki: bundle copy of @xwiki/platform-livedata-xwiki
  • xwiki-platform-livedata-node-ui: bundle copy of @xwiki/platform-livedata-ui
Information

The way JavaScript bundling is working is by copying all the (transitive) dependencies into a big set of JavaScript files that are packaged and optimized together (unused code is removed, code used several times is de-duplicated, and so on).
We do a bundling like this for each application webjars. Meaning that without further refinement, dependencies are copied in each webjars.
This is not acceptable, as it means loading into the client browser the same code several times for no reason.
To avoid this, we:
- Introduce dedicated webjars (webjar-node-*) for shared node packages and distribute them separately
- Exclude those shared dependencies from the bundle of webjars to avoid the duplication.

Warning

If @xwiki/platform-livedata-api is purely an API (i.e., defines only TypeScript types and no code), there is no need to build a module for it.

 Existing modules:

  • xwiki-platform-livedata-webjar: Original Live Data webjar, iso-functional with before the refactoring, but stripped down of a few elements now available through other webjars
  • xwiki-platform-notifications-webjar: Original Notification webjar, iso-functional with before the refactoring, this one does not change but simply loads its dependencies from xwiki-platform-livedata-node-ui instead of xwiki-platform-livedata-webjar

 

Get Connected