Enterprise Features Overview
What Enterprise Features Are
The enterprise module (src/enterprise/) provides experimental utilities that most real applications need but that belong outside the core framework: an HTTP client with interceptors, a type-safe form manager, a component-level error boundary, a reactive context API, and a router. These are opt-in additions — you import only what you use, and none of them require the full framework to function.
The key difference between enterprise features and the framework core is scope. The core (DI, state, middleware, telemetry) is about application architecture. The enterprise module is about application-level concerns: making HTTP requests, handling user input, catching rendering errors, sharing request-scoped data, and navigating between views.
Modules Covered
| Module | Primary Export | Purpose |
|---|---|---|
| HTTP client | HttpClient, QueryCache |
Fetch wrapper with interceptors and response caching |
| Form management | FormManager, createForm, validationRules |
Reactive form state with per-field validation |
| Error boundaries | ErrorBoundary, GlobalErrorHandler |
Catch and isolate rendering errors; show fallback UI |
| Context API | Context<T>, createContext |
Reactive value container for request-scoped or global data |
| Routing | Router, createRouter |
Client-side route matching and navigation |
How Enterprise Features Integrate with the Core
Dependency Injection. Enterprise classes are plain TypeScript — they do not carry @Injectable() themselves, but they compose naturally with DI. Wrap HttpClient in an @Injectable() service and inject it wherever you need it:
import { Injectable } from '@tagna/udiot';
import { HttpClient } from '@tagna/udiot';
@Injectable()
class ApiService {
private http = new HttpClient('https://api.example.com');
async getUsers() {
return this.http.get('/users');
}
}
Middleware. Use middleware to populate a Context before business logic runs, or to attach auth headers via an HttpClient request interceptor. Both operate on data flowing through the pipeline before a handler is reached.
State. FormManager and Context both expose a subscribe() method that returns an unsubscribe function, matching the same reactive contract used by Store.subscribe(). You can mirror form state into a store or project context values into selectors without adapter layers.
Telemetry. Use public startSpan and telemetry logger functions around requests and submissions; the internal AILogged decorator is not exported. GlobalErrorHandler can forward errors to the telemetry layer via addErrorListener.
When to Use Enterprise Features vs. Building Your Own
Use HttpClient when you need interceptor chains, consistent error typing (HttpError), and optional response caching without pulling in a dedicated HTTP library.
Use FormManager when your form validation logic is straightforward (required fields, regex patterns, length limits) and you want a predictable FormState shape that drives your UI reactively.
Use ErrorBoundary when you need to isolate component subtrees so a rendering failure in one part of the UI does not cascade. Use GlobalErrorHandler for cross-cutting error reporting (analytics, telemetry).
Use Context<T> for request-scoped data (current user, request ID, active tenant) that needs to flow through multiple layers without explicit prop drilling or constructor injection.
Build your own when your requirements exceed what these classes cover: streaming responses, complex multi-step wizard forms with branching validation, fine-grained error recovery with circuit breakers, or deeply nested context hierarchies with performance-sensitive subscriptions.