Interface KosConfigProperty<PropertyType>

Individual configuration property with automatic unit conversion and regional formatting.

Provides type-safe access to specific configuration attributes with built-in unit conversion between backend storage units (typically SI) and regional display units.

Example: Basic Usage

const pumpRate = KosConfigProperty.create('pump-rate', {
path: 'assembly:core:board:micro:pump:S4',
attribute: 'nominalRate'
});
interface KosConfigProperty<PropertyType> {
    path: string;
    attribute: string;
    id: string;
    schemaType: "enum" | SchemaNodeType;
    updateProperty: ((value) => void);
    converter?: {
        from?: UnitConverter;
        to?: UnitConverter;
    };
    formatter?: FormatOptions;
    optionsExpander?: OptionsExpander;
    serviceBasePath?: string;
    unit?: string;
    value?: PropertyType;
    rawValue?: PropertyType;
    significantValue?: PropertyType;
    previousValue?: PropertyType;
    displayValue?: string;
    displayOptions?: SchemaOptionsType;
    options?: OptionsType[];
    schemaFormat?: string;
}

Type Parameters

  • PropertyType extends ConfigPropertyTypes = ConfigPropertyTypes

Hierarchy (view full)

Properties

path: string

The hierarchical configuration path using colon-separated notation.

This path identifies the specific configuration bean that contains the target attribute. Must match the path used by the parent ConfigBeanModel.

Example: Common Configuration Paths

// Hardware component configuration
path: 'assembly:core:board:micro:pump:S4'

// System-level configuration
path: 'system:app'

// Service configuration
path: 'kos:service:CANPumpMgr'
attribute: string

The specific attribute name within the configuration bean.

This identifies which property within the configuration bean this KosConfigProperty instance should access and manage.

Example: Attribute Examples

attribute: 'nominalRate'      // For pump flow rates
attribute: 'targetTemperature' // For temperature settings
attribute: 'enabled' // For boolean flags
attribute: 'retryCount' // For numeric counters
id: string

Unique identifier for the config property instance

schemaType: "enum" | SchemaNodeType

The data type of this property as defined in the backend schema

updateProperty: ((value) => void)

Updates the property value and persists it to the backend. Automatically handles unit conversion from display units to backend storage units.

Type declaration

    • (value): void
    • Parameters

      Returns void

converter?: {
    from?: UnitConverter;
    to?: UnitConverter;
}

Optional unit conversion configuration.

When provided, enables automatic conversion between backend storage units and regional display units. If omitted, no unit conversion is performed.

Type declaration

  • Optional from?: UnitConverter
  • Optional to?: UnitConverter

Example: Temperature Conversion

converter: {
from: { unit: 'kelvin', system: 'si' },
to: { system: 'auto' } // Auto-detect regional system
}
formatter?: FormatOptions

Optional display formatting configuration.

Configures how numeric values are formatted for display, including decimal places, units, and locale-specific formatting rules.

Example: Custom Formatting

formatter: {
style: 'unit',
unit: 'celsius',
maximumFractionDigits: 1,
minimumFractionDigits: 1
}
optionsExpander?: OptionsExpander

Optional predefined options for enumerated properties.

Provides a list of valid values for configuration properties that have discrete options rather than continuous values.

Example: Static Options

optionsExpander: [
{ label: 'Low', value: 'low' },
{ label: 'Medium', value: 'medium' },
{ label: 'High', value: 'high' }
]
serviceBasePath?: string

Optional custom service base path for configuration endpoints

unit?: string

The unit of measure for the property after regional conversion (e.g., "°F", "mL/s")

value?: PropertyType

The property value converted to regional units

rawValue?: PropertyType

The raw backend value before any unit conversion (typically SI units)

significantValue?: PropertyType

The property value with appropriate decimal precision for display

previousValue?: PropertyType

The previous value before the last update

displayValue?: string

Formatted string representation of the value with units and localization

displayOptions?: SchemaOptionsType

Display configuration options from the backend schema

options?: OptionsType[]

Available enumerated options for this property (if applicable)

schemaFormat?: string

Optional format specifier from the backend schema (e.g., "s", "ml", "drt")