Skip to content

Conversation

@seansica
Copy link
Contributor

Description of what has changed

This is a catch all PR to get some ongoing work merged into a dev distribution channel

Firstly, there have been reports that the ADM cannot be used in Angular due to the Angular compiler performing static analysis at build time which triggers coverage of Node.js code, despite that code being conditioned behind environment checks. This PR contains some tsup changes that aims to transpile multiple copies of the ADM for different build environments. This requires additional interop testing before it can be merged into a stable distribution channel.

Secondly, there are some bugs that need squashing.

Thirdly, I have started refactoring the library to draw a clearer line of separation between our Zod schemas, the TypeScript API, and general-purpose utilities. The TS API still needs major work, but the foundation has been laid with the new Validated class.

I'm mainly just trying to get this merged so I can perform some interop testing with Workbench.

seansica added 22 commits July 21, 2025 14:59
- Add Validated base class with Zod schema integration
- Refactor TechniqueImpl to use new architecture pattern
- Replace interface declaration merging with schema-based approach
- Add comprehensive relationship management with private fields
- Include domain-specific utility methods (getAttackId, supportsPlatform, etc.)
- Add technique-impl.example.ts demonstrating usage patterns
- Remove TypeScript linting suppressions from implementation

This proof of concept establishes the foundation for overhauling all *Impl classes
to eliminate declaration merging workarounds and improve type safety.
- Rename DataSourceOptions → ContentOriginOptions
- Rename DataSourceRegistration → ContentOriginRegistration
- Rename registerDataSource() → registerContentOrigin()
- Rename DataSourceMap → ContentOriginMap
- Rename dataSources variable → contentOrigins
- Change 'attack' source option to 'mitre' for clarity
- Update all documentation in README.md, docs/, and docusaurus/docs/
- Update error messages and comments throughout codebase

BREAKING CHANGE: API functions and types have been renamed. Update imports to use
ContentOriginRegistration and registerContentOrigin instead of DataSourceRegistration and
registerDataSource. Change source: 'attack' to source: 'mitre' in configurations.
- Refinements have been moved from @/refinements to @/schemas/refinements
- Update downstream references accordingly
- Generator has been moved to the utils sub-package
- Update downstream references accordingly
- Update test modules in test/documentation
- Update references to content origin (from data source)
- Update import paths
- Fix some small type hinting issues
- Create tsup.config.ts to enable separate builds for browser (ESM), Node.js (ESM), and Node.js (CJS)
- Set platform: 'browser' for browser build
- Changed build script to use npx tsup (reads from tsup.config.ts)
- Changed all imports to use import { z } from 'zod/v4' (consistent pattern)
- Refactored readFile() to use universal fetch() API (works in both browser and Node.js)
- Wrapped process.env access in try-catch for browser safety

This change should (in theory) allow for the ADM to run as an an Angular dependency,
even when static analysis tools perform full code coverage for browser-only envs.
@seansica seansica self-assigned this Nov 11, 2025
@seansica seansica merged commit 6eeaf07 into beta Nov 11, 2025
6 of 8 checks passed
@github-actions
Copy link

🎉 This PR is included in version 5.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants