@nhtio/adk/factories
Factory helpers for creating configured runtime values and exception classes.
Remarks
Public factory surface for the ADK. A "factory" here means a function that produces a configured runtime value — typically a class or a class instance — rather than a value primitive. The ADK's data primitives (value classes plus their Raw* companion types) live in @nhtio/adk/common; the ADK's exception classes that are part of the core contract live in @nhtio/adk/exceptions. This barrel hosts the factory helpers that downstream consumers (including in-tree batteries) use to mint their own configured runtime values.
Today the only factory exposed here is @nhtio/adk/factories!createException, which mints a named @nhtio/adk!BaseException subclass with a fixed printf-style message template, error code, HTTP status, and fatality flag. The BaseException class itself is re-exported so consumers writing patterns the factory does not cover (e.g. richer constructor signatures carrying structured context payloads) can extend it directly.
Battery-scoped exceptions belong in their own battery's barrel — createException imported from here is what battery code calls to mint them. The ADK's core exception module (@nhtio/adk/exceptions) does not grow a new symbol every time a battery is added.
Future factories (middleware factories, helper-builder factories, etc.) will be added here as they appear.
Classes
| Class | Description |
|---|---|
| BaseException | Base class for all structured exceptions in the ADK. |
Type Aliases
| Type Alias | Description |
|---|---|
| CreatedException | Constructor signature of an exception class produced by createException. |
| ExceptionOptions | Options accepted by @nhtio/adk!BaseException (and factory-created exceptions) beyond the standard ErrorOptions. |
Functions
| Function | Description |
|---|---|
| createException | Factory that produces a named @nhtio/adk!BaseException subclass with a fixed printf-style message template, error code, HTTP status, and fatality flag. |