Optional options: KosTroubleAwareOptionsConfiguration options for the decorator
A class decorator
// Default usage - uses this.path
interface HolderModelImpl extends TroubleAware {}
@kosTroubleAware()
class HolderModelImpl implements IKosDataModel {
path: string; // Required for trouble path resolution
constructor(modelId: string, options: HolderOptions) {
this.path = options.path;
}
}
// Custom path property
interface CustomModelImpl extends TroubleAware {}
@kosTroubleAware({ pathProperty: 'devicePath' })
class CustomModelImpl implements IKosDataModel {
devicePath: string; // Custom path property
constructor(modelId: string, options: CustomOptions) {
this.devicePath = options.devicePath;
}
}
// Type-safe external interface
export type HolderModel = PublicModelInterface<HolderModelImpl> & TroubleAware;
2.0.0
Class decorator that automatically adds TroubleAware capabilities to a KOS model.
This decorator eliminates the need for manual TroubleAware interface implementation by:
Important: Use TypeScript interface merging to get proper type information:
The decorator requires the model to have a path property (default) or specify a custom path property via options.