PROPOSAL: instead of implementing the CycloneDX stuff on your own,
lets collaborate and use https://www.npmjs.com/package/%40cyclonedx/cyclonedx-library instead.
Like your current implementation, this library
- follows official specs.
- is typed via TypeScript.
- knows data models
- can handle serialization of these models to JSON or XML
The trade-off:
- you depend on another lib
The benefit:
- you do o longer have to maintain the CycloneDX implementation yourself