dolittle / JavaScript.SDK

Dolittle JavaScript SDK
https://dolittle.io
MIT License
5 stars 2 forks source link

Register all decorated types in the imported files automatically #100

Closed jakhog closed 2 years ago

jakhog commented 2 years ago

Summary

Introduces a ModuleTraverser that starts in the main module, and looks through all the exported objects and their properties recursively - and registers anything it finds annotated with @eventType, @aggregateRoot, @eventHandler, @projection or @embedding automatically. Since traversing all the exported things quickly takes a long time in a real project, there is a blacklist of paths to stop at (currently just the JavaScript.SDK packages itself).

It still requires you to import or require the files containing the annotated types to discover, but it reduces the amount of code for the .setup(...) of the DolittleClient.

Added