Frontmatter
| id | 9450 |
| title | Enhance Data Worker to Instantiate Dynamically Loaded Modules |
| state | Closed |
| labels | enhancementaiarchitecturecore |
| assignees | tobiu |
| createdAt | Mar 12, 2026, 4:04 PM |
| updatedAt | Mar 12, 2026, 4:36 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9450 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 9449 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 12, 2026, 4:16 PM |
Enhance Data Worker to Instantiate Dynamically Loaded Modules
tobiu added parent issue #9449 on Mar 12, 2026, 4:04 PM

tobiu
Mar 12, 2026, 4:16 PM
Input from Gemini 3.1 Pro:
✦ I have implemented the Data Worker instantiation mechanism.
Changes Made:
src/worker/Data.mjs: Added thecreateInstance({config, path})remote method. This method loads the module via the dynamic import logic, passes theconfigtoNeo.create(), and stores the resulting object in a persistentthis.instancesmap.src/worker/Data.mjs: ExposedcreateInstancevia theremoteconfig.src/data/Store.mjs: Updated the JSDoc fornormalizer_to strictly document it must be an object (not a class/instance) to preserve thread boundaries.src/data/Store.mjs: ImplementedafterSetNormalizer(). It asserts that the value is a config object, defaults thepathusing thentypeproperty if missing (e.g.,normalizer-treeresolves tosrc/data/normalizer/Tree.mjs), and invokes the Data Worker RMA. Upon success, it caches the resulting ID asme.normalizerId.These updates are pushed and live.
tobiu closed this issue on Mar 12, 2026, 4:16 PM
tobiu assigned to @tobiu on Mar 12, 2026, 4:36 PM
tobiu cross-referenced by #9453 on Mar 12, 2026, 7:23 PM
Goal
Enhance the Data Worker's remote method access to not only
import()ES modules but also instantiate them using a provided configuration object, and wire this up toNeo.data.Store.Context
To keep the App Worker lightweight, it should not import
ParserorNormalizerclasses. Instead, theStoreconfig will define a config object (e.g.,{ module: 'Neo.data.normalizer.Tree', childrenProperty: 'items' }). When the Data Worker receives this config, it must load the module and immediately create an instance to be used by the connection pipeline.Acceptance Criteria
createInstance({config})remote method inNeo.worker.Data.import()the required module based on the class name or path, and then useNeo.create(module, config)to instantiate it.instancesmap keyed by ID) and return the instance ID to the App Worker.afterSetNormalizer(value, oldValue)inNeo.data.Store. If the value is a config object, it must call the Data Worker'screateInstancevia RMA to ensure the normalizer is ready before data loading begins.