@kosdev-code/kos-ui-sdk 2.0.41 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/core/decorators/index.d.ts +4 -0
- package/core/core/decorators/index.d.ts.map +1 -1
- package/core/core/decorators/kos-companion.d.ts +125 -8
- package/core/core/decorators/kos-companion.d.ts.map +1 -1
- package/core/core/decorators/kos-container-aware.d.ts +465 -0
- package/core/core/decorators/kos-container-aware.d.ts.map +1 -0
- package/core/core/decorators/kos-future-aware.d.ts +150 -0
- package/core/core/decorators/kos-future-aware.d.ts.map +1 -0
- package/core/core/decorators/kos-logger-aware.d.ts +96 -0
- package/core/core/decorators/kos-logger-aware.d.ts.map +1 -0
- package/core/core/decorators/kos-trouble-aware.d.ts +71 -0
- package/core/core/decorators/kos-trouble-aware.d.ts.map +1 -0
- package/core/core/decorators/kosModel.d.ts +8 -2
- package/core/core/decorators/kosModel.d.ts.map +1 -1
- package/core/core/decorators/kosTopicHandler.d.ts.map +1 -1
- package/core/core/decorators/propKeys.d.ts +4 -0
- package/core/core/decorators/propKeys.d.ts.map +1 -1
- package/core/core/extension/extension-manager.d.ts +1 -1
- package/core/core/extension/extension-manager.d.ts.map +1 -1
- package/core/core/kosCore.d.ts.map +1 -1
- package/core/core/registration/index.d.ts +1 -0
- package/core/core/registration/index.d.ts.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/util/container-utils.d.ts +3 -2
- package/core/util/container-utils.d.ts.map +1 -1
- package/core/util/observable-proxy-map.d.ts.map +1 -1
- package/index.cjs +79 -76
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +9672 -7760
- package/index.js.map +1 -1
- package/models/models/browser-router/browser-router-model.d.ts +80 -1
- package/models/models/browser-router/browser-router-model.d.ts.map +1 -1
- package/models/models/browser-router/types/index.d.ts +25 -1
- package/models/models/config-bean/config-bean-model-builder.d.ts +4 -2
- package/models/models/config-bean/config-bean-model-builder.d.ts.map +1 -1
- package/models/models/config-bean/config-bean-model.d.ts +117 -13
- package/models/models/config-bean/config-bean-model.d.ts.map +1 -1
- package/models/models/config-bean/config-bean-types.d.ts +6 -3
- package/models/models/config-bean/config-bean-types.d.ts.map +1 -1
- package/models/models/config-bean/types/index.d.ts +33 -0
- package/models/models/config-bean-prop/config-bean-prop-model.d.ts +112 -1
- package/models/models/config-bean-prop/config-bean-prop-model.d.ts.map +1 -1
- package/models/models/config-bean-prop/types/index.d.ts +293 -17
- package/models/models/device/device-model.d.ts +219 -9
- package/models/models/device/device-model.d.ts.map +1 -1
- package/models/models/device/device-registration.d.ts +61 -48
- package/models/models/device/device-registration.d.ts.map +1 -1
- package/models/models/device/types/index.d.ts +41 -0
- package/models/models/future/future-aware.d.ts +82 -0
- package/models/models/future/future-aware.d.ts.map +1 -1
- package/models/models/future/future-model.d.ts +34 -5
- package/models/models/future/future-model.d.ts.map +1 -1
- package/models/models/future/future-types.d.ts +186 -7
- package/models/models/future/future-types.d.ts.map +1 -1
- package/models/models/future-container/future-container-model.d.ts +2 -2
- package/models/models/index.d.ts +1 -0
- package/models/models/index.d.ts.map +1 -1
- package/models/models/key-value/index.d.ts +4 -0
- package/models/models/key-value/index.d.ts.map +1 -1
- package/models/models/key-value/key-value-model.d.ts +111 -0
- package/models/models/key-value/key-value-model.d.ts.map +1 -1
- package/models/models/key-value/services/key-value-services.d.ts +124 -2
- package/models/models/key-value/services/key-value-services.d.ts.map +1 -1
- package/models/models/key-value/types/index.d.ts +56 -0
- package/models/models/kos-expression-evaluator/index.d.ts +4 -0
- package/models/models/kos-expression-evaluator/index.d.ts.map +1 -0
- package/models/models/kos-expression-evaluator/kos-expression-evaluator-model.d.ts +209 -0
- package/models/models/kos-expression-evaluator/kos-expression-evaluator-model.d.ts.map +1 -0
- package/models/models/kos-expression-evaluator/services/index.d.ts +6 -0
- package/models/models/kos-expression-evaluator/services/index.d.ts.map +1 -0
- package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts +15 -0
- package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts.map +1 -0
- package/models/models/kos-expression-evaluator/types/index.d.ts +1 -0
- package/models/models/kos-log-manager/kos-log-manager-model.d.ts +61 -14
- package/models/models/kos-log-manager/kos-log-manager-model.d.ts.map +1 -1
- package/models/models/kos-log-manager/types/index.d.ts +187 -0
- package/models/models/kos-time/kos-time-model.d.ts +64 -0
- package/models/models/kos-time/kos-time-model.d.ts.map +1 -1
- package/models/models/kos-time/types/index.d.ts +80 -0
- package/models/models/log-block/log-block-container-model.d.ts +132 -0
- package/models/models/log-block/log-block-container-model.d.ts.map +1 -1
- package/models/models/log-block/log-block-model.d.ts +185 -0
- package/models/models/log-block/log-block-model.d.ts.map +1 -1
- package/models/models/log-block/types/index.d.ts +129 -0
- package/models/models/log-stream/index.d.ts +6 -2
- package/models/models/log-stream/index.d.ts.map +1 -1
- package/models/models/log-stream/log-stream-container-model.d.ts +62 -0
- package/models/models/log-stream/log-stream-container-model.d.ts.map +1 -1
- package/models/models/log-stream/log-stream-model.d.ts +55 -0
- package/models/models/log-stream/log-stream-model.d.ts.map +1 -1
- package/models/models/log-stream/services/log-stream-services.d.ts +2 -1
- package/models/models/log-stream/services/log-stream-services.d.ts.map +1 -1
- package/models/models/log-stream/types/index.d.ts +77 -0
- package/models/models/network-interface/index.d.ts +6 -2
- package/models/models/network-interface/index.d.ts.map +1 -1
- package/models/models/network-interface/network-interface-container-model.d.ts +62 -0
- package/models/models/network-interface/network-interface-container-model.d.ts.map +1 -1
- package/models/models/network-interface/network-interface-container-registration.d.ts +2 -1
- package/models/models/network-interface/network-interface-container-registration.d.ts.map +1 -1
- package/models/models/network-interface/network-interface-model.d.ts +77 -0
- package/models/models/network-interface/network-interface-model.d.ts.map +1 -1
- package/models/models/network-interface/network-interface-registration.d.ts +2 -1
- package/models/models/network-interface/network-interface-registration.d.ts.map +1 -1
- package/models/models/network-interface/services/network-interface-services.d.ts +54 -0
- package/models/models/network-interface/services/network-interface-services.d.ts.map +1 -1
- package/models/models/network-interface/types/index.d.ts +21 -0
- package/models/models/ota/ota-model.d.ts +82 -3
- package/models/models/ota/ota-model.d.ts.map +1 -1
- package/models/models/ota/types/index.d.ts +146 -0
- package/models/models/region-info/region-info-model.d.ts +7 -3
- package/models/models/region-info/region-info-model.d.ts.map +1 -1
- package/models/models/region-info/services/region-info-services.d.ts.map +1 -1
- package/models/models/region-info/types/index.d.ts +141 -13
- package/models/models/region-info/types/index.d.ts.map +1 -1
- package/models/models/software-info/software-info-model.d.ts +74 -2
- package/models/models/software-info/software-info-model.d.ts.map +1 -1
- package/models/models/software-info/types/index.d.ts +48 -16
- package/models/models/state-bean/state-bean-model.d.ts +86 -9
- package/models/models/state-bean/state-bean-model.d.ts.map +1 -1
- package/models/models/state-bean/types/index.d.ts +114 -6
- package/models/models/state-prop/state-prop-model.d.ts +78 -1
- package/models/models/state-prop/state-prop-model.d.ts.map +1 -1
- package/models/models/state-prop/types/index.d.ts +55 -7
- package/models/models/storage-device/storage-device-container-model.d.ts +289 -2
- package/models/models/storage-device/storage-device-container-model.d.ts.map +1 -1
- package/models/models/storage-device/storage-device-model.d.ts +84 -2
- package/models/models/storage-device/storage-device-model.d.ts.map +1 -1
- package/models/models/storage-device/types/index.d.ts +112 -0
- package/models/models/studio-properties/studio-properties-model.d.ts +75 -0
- package/models/models/studio-properties/studio-properties-model.d.ts.map +1 -1
- package/models/models/studio-properties/types/index.d.ts +29 -0
- package/models/models/translation/services/translation-services.d.ts +128 -2
- package/models/models/translation/services/translation-services.d.ts.map +1 -1
- package/models/models/translation/translation-container-model.d.ts +100 -10
- package/models/models/translation/translation-container-model.d.ts.map +1 -1
- package/models/models/translation/translation-container-registration.d.ts +2 -1
- package/models/models/translation/translation-container-registration.d.ts.map +1 -1
- package/models/models/translation/translation-context.d.ts +1 -16
- package/models/models/translation/translation-context.d.ts.map +1 -1
- package/models/models/translation/translation-model.d.ts +113 -1
- package/models/models/translation/translation-model.d.ts.map +1 -1
- package/models/models/translation/types/index.d.ts +340 -0
- package/models/models/trouble/services/trouble-services.d.ts +3 -3
- package/models/models/trouble/services/trouble-services.d.ts.map +1 -1
- package/models/models/trouble/trouble-model.d.ts +2 -1
- package/models/models/trouble/trouble-model.d.ts.map +1 -1
- package/models/models/trouble/types/index.d.ts +22 -93
- package/models/models/trouble/utils/is-trouble-aware.d.ts +2 -2
- package/models/models/trouble/utils/is-trouble-aware.d.ts.map +1 -1
- package/models/models/trouble-container/index.d.ts +4 -3
- package/models/models/trouble-container/index.d.ts.map +1 -1
- package/models/models/trouble-container/trouble-container-model.d.ts +9 -5
- package/models/models/trouble-container/trouble-container-model.d.ts.map +1 -1
- package/models/models/trouble-container/types/index.d.ts +2 -15
- package/models/utils/client.d.ts +8 -8
- package/models/utils/core-registration-manager.d.ts +1 -1
- package/models/utils/core-registration-manager.d.ts.map +1 -1
- package/models/utils/index.d.ts +0 -2
- package/models/utils/index.d.ts.map +1 -1
- package/models/utils/service.d.ts +9 -9
- package/package.json +2 -2
- package/ui/contexts/state-bean/state-bean-provider.d.ts.map +1 -1
- package/ui/hooks/state-bean/use-state-bean.d.ts +2 -2
- package/ui/hooks/state-bean/use-state-bean.d.ts.map +1 -1
- package/ui/hooks/state-bean/with-state-bean.d.ts.map +1 -1
- package/ui/hooks/translation-container/use-translation-container.d.ts +4 -33
- package/ui/hooks/translation-container/use-translation-container.d.ts.map +1 -1
- package/models/models/trouble-container/trouble-container-registration.d.ts +0 -5
- package/models/models/trouble-container/trouble-container-registration.d.ts.map +0 -1
- package/models/utils/kosmodel-compatible-future-mixin.d.ts +0 -142
- package/models/utils/kosmodel-compatible-future-mixin.d.ts.map +0 -1
- package/models/utils/kosmodel-interface-companion-mixin.d.ts +0 -83
- package/models/utils/kosmodel-interface-companion-mixin.d.ts.map +0 -1
|
@@ -4,73 +4,349 @@ import { SchemaNodeType, SchemaOptionsType } from '../../../services/config-bean
|
|
|
4
4
|
import { UnitConverter } from '../../../decorators';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Unit conversion configuration for KosConfigProperty instances.
|
|
9
|
+
*
|
|
10
|
+
* Defines how configuration property values should be converted between backend
|
|
11
|
+
* storage units (typically SI) and regional display units. The converter enables
|
|
12
|
+
* automatic unit conversion based on device region while maintaining precision.
|
|
13
|
+
*
|
|
14
|
+
* @example Temperature Conversion
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const temperatureConverter: ConfigPropConverter = {
|
|
17
|
+
* measure: 'temperature',
|
|
18
|
+
* from: { unit: 'kelvin', system: 'si' }, // Backend storage
|
|
19
|
+
* to: { system: 'auto' } // Auto-detect regional display
|
|
20
|
+
* };
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Volume Conversion with Specific Units
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const volumeConverter: ConfigPropConverter = {
|
|
26
|
+
* measure: 'volume',
|
|
27
|
+
* from: { unit: 'liter' }, // Backend in liters
|
|
28
|
+
* to: { unit: 'fluid-ounce', system: 'imperial' } // Force US fluid ounces
|
|
29
|
+
* };
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @group KOS Model
|
|
33
|
+
* @category Configuration
|
|
34
|
+
*/
|
|
7
35
|
export interface ConfigPropConverter {
|
|
36
|
+
/**
|
|
37
|
+
* The physical measure being converted (temperature, volume, pressure, etc.).
|
|
38
|
+
* This helps the system understand what type of conversion to perform.
|
|
39
|
+
*/
|
|
8
40
|
measure?: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Source unit configuration (typically backend storage units).
|
|
44
|
+
* Defines the unit system and specific unit that values are stored in.
|
|
45
|
+
*/
|
|
9
46
|
from?: UnitConverter;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Target unit configuration (display units).
|
|
50
|
+
* Defines how values should be displayed to users, including regional preferences.
|
|
51
|
+
*/
|
|
10
52
|
to?: UnitConverter;
|
|
11
53
|
}
|
|
12
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Formatting options for numeric configuration property display values.
|
|
57
|
+
*
|
|
58
|
+
* Supports both static formatting options and dynamic formatting based on unit system.
|
|
59
|
+
* Built on top of the Intl.NumberFormat API for internationalization support.
|
|
60
|
+
*
|
|
61
|
+
* @example Static Formatting Options
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const staticFormatter: FormatOptions = {
|
|
64
|
+
* style: 'unit',
|
|
65
|
+
* unit: 'celsius',
|
|
66
|
+
* maximumFractionDigits: 1
|
|
67
|
+
* };
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example Dynamic System-Based Formatting
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const dynamicFormatter: FormatOptions = (system: string) => {
|
|
73
|
+
* if (system === 'imperial') {
|
|
74
|
+
* return { style: 'unit', unit: 'fahrenheit', maximumFractionDigits: 0 };
|
|
75
|
+
* }
|
|
76
|
+
* return { style: 'unit', unit: 'celsius', maximumFractionDigits: 1 };
|
|
77
|
+
* };
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @group KOS Model
|
|
81
|
+
* @category Configuration
|
|
82
|
+
*/
|
|
13
83
|
export type FormatOptions =
|
|
14
84
|
| Intl.NumberFormatOptions
|
|
15
85
|
| ((system: string) => Intl.NumberFormatOptions);
|
|
16
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Option definition for enumerated configuration properties.
|
|
89
|
+
*
|
|
90
|
+
* Represents a single selectable option with a display label and internal value.
|
|
91
|
+
* Used for configuration properties that have predefined valid values.
|
|
92
|
+
*
|
|
93
|
+
* @example Basic Options
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const optionsList: OptionsType[] = [
|
|
96
|
+
* { label: 'Low Speed', value: 'low' },
|
|
97
|
+
* { label: 'Medium Speed', value: 'medium' },
|
|
98
|
+
* { label: 'High Speed', value: 'high' }
|
|
99
|
+
* ];
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @group KOS Model
|
|
103
|
+
* @category Configuration
|
|
104
|
+
*/
|
|
17
105
|
export interface OptionsType {
|
|
106
|
+
/** The internal value used by the system */
|
|
18
107
|
value: string;
|
|
108
|
+
/** The human-readable display label */
|
|
19
109
|
label: string;
|
|
20
110
|
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Options provider for configuration properties with enumerated values.
|
|
114
|
+
*
|
|
115
|
+
* Can be either a static list of options or a dynamic function that generates
|
|
116
|
+
* options based on the current unit system. Useful for configuration properties
|
|
117
|
+
* that need different option sets based on regional settings.
|
|
118
|
+
*
|
|
119
|
+
* @example Static Options List
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const staticOptions: OptionsExpander = [
|
|
122
|
+
* { label: 'Automatic', value: 'auto' },
|
|
123
|
+
* { label: 'Manual', value: 'manual' },
|
|
124
|
+
* { label: 'Disabled', value: 'disabled' }
|
|
125
|
+
* ];
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @example Dynamic System-Based Options
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const dynamicOptions: OptionsExpander = (system: string, schemaOptions?: string[]) => {
|
|
131
|
+
* const baseOptions = [
|
|
132
|
+
* { label: 'Automatic', value: 'auto' },
|
|
133
|
+
* { label: 'Manual', value: 'manual' }
|
|
134
|
+
* ];
|
|
135
|
+
*
|
|
136
|
+
* // Add system-specific options
|
|
137
|
+
* if (system === 'imperial') {
|
|
138
|
+
* baseOptions.push({ label: 'Imperial Mode', value: 'imperial' });
|
|
139
|
+
* } else if (system === 'metric') {
|
|
140
|
+
* baseOptions.push({ label: 'Metric Mode', value: 'metric' });
|
|
141
|
+
* }
|
|
142
|
+
*
|
|
143
|
+
* return baseOptions;
|
|
144
|
+
* };
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @group KOS Model
|
|
148
|
+
* @category Configuration
|
|
149
|
+
*/
|
|
21
150
|
export type OptionsExpander =
|
|
22
151
|
| OptionsType[]
|
|
23
152
|
| ((system: string, options?: string[]) => OptionsType[]);
|
|
153
|
+
|
|
24
154
|
/**
|
|
25
|
-
*
|
|
155
|
+
* Configuration options for KosConfigProperty instances.
|
|
156
|
+
*
|
|
157
|
+
* These options define how individual configuration properties access and display
|
|
158
|
+
* values from the backend configuration system. They specify the configuration path,
|
|
159
|
+
* attribute name, and optional unit conversion and formatting behavior.
|
|
160
|
+
*
|
|
161
|
+
* @example Basic Property Configuration
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const pumpRateOptions: ConfigBeanPropOptions = {
|
|
164
|
+
* path: 'assembly:core:board:micro:pump:S4',
|
|
165
|
+
* attribute: 'nominalRate'
|
|
166
|
+
* };
|
|
167
|
+
* ```
|
|
26
168
|
*
|
|
27
|
-
* @
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
169
|
+
* @example Property with Unit Conversion
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const temperatureOptions: ConfigBeanPropOptions = {
|
|
172
|
+
* path: 'assembly:core:board:cooling',
|
|
173
|
+
* attribute: 'targetTemperature',
|
|
174
|
+
* converter: {
|
|
175
|
+
* measure: 'temperature',
|
|
176
|
+
* from: { unit: 'kelvin' },
|
|
177
|
+
* to: { system: 'auto' }
|
|
178
|
+
* },
|
|
179
|
+
* formatter: {
|
|
180
|
+
* style: 'unit',
|
|
181
|
+
* maximumFractionDigits: 1
|
|
182
|
+
* }
|
|
183
|
+
* };
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @group KOS Model
|
|
187
|
+
* @category Configuration
|
|
31
188
|
*/
|
|
32
189
|
export interface ConfigBeanPropOptions {
|
|
190
|
+
/**
|
|
191
|
+
* The hierarchical configuration path using colon-separated notation.
|
|
192
|
+
*
|
|
193
|
+
* This path identifies the specific configuration bean that contains
|
|
194
|
+
* the target attribute. Must match the path used by the parent ConfigBeanModel.
|
|
195
|
+
*
|
|
196
|
+
* @example Common Configuration Paths
|
|
197
|
+
* ```typescript
|
|
198
|
+
* // Hardware component configuration
|
|
199
|
+
* path: 'assembly:core:board:micro:pump:S4'
|
|
200
|
+
*
|
|
201
|
+
* // System-level configuration
|
|
202
|
+
* path: 'system:app'
|
|
203
|
+
*
|
|
204
|
+
* // Service configuration
|
|
205
|
+
* path: 'kos:service:CANPumpMgr'
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
33
208
|
path: string;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* The specific attribute name within the configuration bean.
|
|
212
|
+
*
|
|
213
|
+
* This identifies which property within the configuration bean
|
|
214
|
+
* this KosConfigProperty instance should access and manage.
|
|
215
|
+
*
|
|
216
|
+
* @example Attribute Examples
|
|
217
|
+
* ```typescript
|
|
218
|
+
* attribute: 'nominalRate' // For pump flow rates
|
|
219
|
+
* attribute: 'targetTemperature' // For temperature settings
|
|
220
|
+
* attribute: 'enabled' // For boolean flags
|
|
221
|
+
* attribute: 'retryCount' // For numeric counters
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
34
224
|
attribute: string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Optional unit conversion configuration.
|
|
228
|
+
*
|
|
229
|
+
* When provided, enables automatic conversion between backend storage units
|
|
230
|
+
* and regional display units. If omitted, no unit conversion is performed.
|
|
231
|
+
*
|
|
232
|
+
* @example Temperature Conversion
|
|
233
|
+
* ```typescript
|
|
234
|
+
* converter: {
|
|
235
|
+
* from: { unit: 'kelvin', system: 'si' },
|
|
236
|
+
* to: { system: 'auto' } // Auto-detect regional system
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
35
240
|
converter?: { from?: UnitConverter; to?: UnitConverter };
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Optional display formatting configuration.
|
|
244
|
+
*
|
|
245
|
+
* Configures how numeric values are formatted for display, including
|
|
246
|
+
* decimal places, units, and locale-specific formatting rules.
|
|
247
|
+
*
|
|
248
|
+
* @example Custom Formatting
|
|
249
|
+
* ```typescript
|
|
250
|
+
* formatter: {
|
|
251
|
+
* style: 'unit',
|
|
252
|
+
* unit: 'celsius',
|
|
253
|
+
* maximumFractionDigits: 1,
|
|
254
|
+
* minimumFractionDigits: 1
|
|
255
|
+
* }
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
36
258
|
formatter?: FormatOptions;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Optional predefined options for enumerated properties.
|
|
262
|
+
*
|
|
263
|
+
* Provides a list of valid values for configuration properties that
|
|
264
|
+
* have discrete options rather than continuous values.
|
|
265
|
+
*
|
|
266
|
+
* @example Static Options
|
|
267
|
+
* ```typescript
|
|
268
|
+
* optionsExpander: [
|
|
269
|
+
* { label: 'Low', value: 'low' },
|
|
270
|
+
* { label: 'Medium', value: 'medium' },
|
|
271
|
+
* { label: 'High', value: 'high' }
|
|
272
|
+
* ]
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
37
275
|
optionsExpander?: OptionsExpander;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Optional custom service base path.
|
|
279
|
+
*
|
|
280
|
+
* When provided, overrides the default configuration service endpoint.
|
|
281
|
+
* Useful for testing, development, or alternative service implementations.
|
|
282
|
+
*
|
|
283
|
+
* @default undefined (uses default KOS configuration service path)
|
|
284
|
+
*/
|
|
38
285
|
serviceBasePath?: string;
|
|
39
286
|
}
|
|
40
287
|
|
|
41
288
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* and unit conversion
|
|
47
|
-
* @property unit - the unit of measure for the property. This unit will be formatted based
|
|
48
|
-
* on the formatter options provided.
|
|
289
|
+
* Individual configuration property with automatic unit conversion and regional formatting.
|
|
290
|
+
*
|
|
291
|
+
* Provides type-safe access to specific configuration attributes with built-in unit conversion
|
|
292
|
+
* between backend storage units (typically SI) and regional display units.
|
|
49
293
|
*
|
|
50
|
-
* @
|
|
294
|
+
* @example Basic Usage
|
|
295
|
+
* ```typescript
|
|
296
|
+
* const pumpRate = KosConfigProperty.create('pump-rate', {
|
|
297
|
+
* path: 'assembly:core:board:micro:pump:S4',
|
|
298
|
+
* attribute: 'nominalRate'
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
51
301
|
*
|
|
302
|
+
* @group KOS Model
|
|
303
|
+
* @category Configuration
|
|
52
304
|
*/
|
|
53
305
|
export interface KosConfigProperty<
|
|
54
306
|
PropertyType extends ConfigPropertyTypes = ConfigPropertyTypes
|
|
55
307
|
> extends ConfigBeanPropOptions,
|
|
56
308
|
IKosDataModel {
|
|
309
|
+
/** Unique identifier for the config property instance */
|
|
57
310
|
id: string;
|
|
311
|
+
|
|
312
|
+
/** Optional custom service base path for configuration endpoints */
|
|
58
313
|
serviceBasePath?: string;
|
|
314
|
+
|
|
315
|
+
/** The unit of measure for the property after regional conversion (e.g., "°F", "mL/s") */
|
|
59
316
|
readonly unit?: string;
|
|
317
|
+
|
|
318
|
+
/** The property value converted to regional units */
|
|
60
319
|
readonly value?: PropertyType;
|
|
320
|
+
|
|
321
|
+
/** The raw backend value before any unit conversion (typically SI units) */
|
|
61
322
|
readonly rawValue?: PropertyType;
|
|
323
|
+
|
|
324
|
+
/** The property value with appropriate decimal precision for display */
|
|
62
325
|
readonly significantValue?: PropertyType;
|
|
326
|
+
|
|
327
|
+
/** The previous value before the last update */
|
|
63
328
|
readonly previousValue?: PropertyType;
|
|
329
|
+
|
|
330
|
+
/** Formatted string representation of the value with units and localization */
|
|
64
331
|
readonly displayValue?: string;
|
|
332
|
+
|
|
333
|
+
/** Display configuration options from the backend schema */
|
|
65
334
|
readonly displayOptions?: SchemaOptionsType;
|
|
335
|
+
|
|
336
|
+
/** Available enumerated options for this property (if applicable) */
|
|
66
337
|
readonly options?: OptionsType[];
|
|
338
|
+
|
|
339
|
+
/** The data type of this property as defined in the backend schema */
|
|
67
340
|
readonly schemaType: SchemaNodeType | "enum";
|
|
341
|
+
|
|
342
|
+
/** Optional format specifier from the backend schema (e.g., "s", "ml", "drt") */
|
|
68
343
|
readonly schemaFormat?: string;
|
|
344
|
+
|
|
69
345
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
346
|
+
* Updates the property value and persists it to the backend.
|
|
347
|
+
* Automatically handles unit conversion from display units to backend storage units.
|
|
348
|
+
*
|
|
349
|
+
* @param value The new value in display units
|
|
74
350
|
*/
|
|
75
351
|
updateProperty: (value: PropertyType | string) => void;
|
|
76
352
|
}
|
|
@@ -6,27 +6,238 @@ export declare const TOPIC_CRITICAL_DATA_CHANGED = "/kos/criticalData/changed";
|
|
|
6
6
|
export declare const TOPIC_CRITICAL_DATA_AVAILABLE = "/kos/criticalData/available";
|
|
7
7
|
export declare const TOPIC_CRITICAL_DATA_UNAVAILABLE = "/kos/criticalData/unavailable";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* KOS Device Model - Device Identity and Node Configuration Management
|
|
10
|
+
*
|
|
11
|
+
* The Device model provides centralized management of device identity, node configuration,
|
|
12
|
+
* and hardware identification within KOS systems. It handles device serial numbers,
|
|
13
|
+
* names, and node topology information essential for system coordination and administration.
|
|
14
|
+
*
|
|
15
|
+
* ## Key Features
|
|
16
|
+
*
|
|
17
|
+
* ### Device Identity Management
|
|
18
|
+
* - **Serial Number Tracking**: Hardware-based device identification
|
|
19
|
+
* - **Name Management**: Human-readable device naming for administration
|
|
20
|
+
* - **Node Configuration**: Multi-node deployment topology handling
|
|
21
|
+
*
|
|
22
|
+
* ### Real-time Synchronization
|
|
23
|
+
* - **Critical Data Events**: Automatic updates on system data changes
|
|
24
|
+
* - **WebSocket Integration**: Live device state synchronization
|
|
25
|
+
* - **Lazy Loading**: Efficient data retrieval when needed
|
|
26
|
+
*
|
|
27
|
+
* ### Node Topology Support
|
|
28
|
+
* - **Node Type/Name Parsing**: Automatic node identifier decomposition
|
|
29
|
+
* - **Multi-node Deployments**: Support for complex system architectures
|
|
30
|
+
* - **Role-based Configuration**: Node-specific parameter management
|
|
31
|
+
*
|
|
32
|
+
* ## Common Integration Patterns
|
|
33
|
+
*
|
|
34
|
+
* ### System Administration Dashboards
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const device = Device.factory({
|
|
37
|
+
* serialNumber: 'KOS-DEV-001',
|
|
38
|
+
* name: 'Production Dispenser Alpha',
|
|
39
|
+
* nodeId: 'primary-main'
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Access device identity
|
|
43
|
+
* console.log(`Device: ${device.name}`);
|
|
44
|
+
* console.log(`Serial: ${device.serialNumber}`);
|
|
45
|
+
* console.log(`Node: ${device.nodeType}-${device.nodeName}`);
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* ### Multi-node System Coordination
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const primaryDevice = Device.factory({
|
|
51
|
+
* nodeId: 'primary-controller'
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* const secondaryDevice = Device.factory({
|
|
55
|
+
* nodeId: 'secondary-backup'
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Coordinate based on node roles
|
|
59
|
+
* if (primaryDevice.nodeType === 'primary') {
|
|
60
|
+
* // Handle primary node logic
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* ### Device Registration and Setup
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const newDevice = Device.factory({
|
|
67
|
+
* serialNumber: await getHardwareSerial(),
|
|
68
|
+
* name: userProvidedName,
|
|
69
|
+
* nodeId: deploymentConfiguration.nodeId
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // Device automatically loads additional data
|
|
73
|
+
* // from critical data events
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* ## Real-time Updates
|
|
11
77
|
*
|
|
12
|
-
*
|
|
78
|
+
* The Device model automatically responds to critical data changes:
|
|
79
|
+
* - Monitors `/kos/criticalData/changed` and `/kos/criticalData/available` topics
|
|
80
|
+
* - Updates serial number and configuration when system data becomes available
|
|
81
|
+
* - Maintains consistency across device restarts and configuration changes
|
|
13
82
|
*
|
|
83
|
+
* ## Singleton Behavior
|
|
84
|
+
*
|
|
85
|
+
* Device models use singleton pattern - each device type has one instance:
|
|
86
|
+
* - Subsequent factory calls return the existing instance
|
|
87
|
+
* - Options are ignored after first creation
|
|
88
|
+
* - Ensures system-wide device identity consistency
|
|
89
|
+
*
|
|
90
|
+
* This is an alias for the implementation {@link DeviceModelImpl}.
|
|
91
|
+
*
|
|
92
|
+
* @interface
|
|
93
|
+
* @group KOS Model
|
|
94
|
+
* @category Device Data
|
|
95
|
+
* @useDeclaredType
|
|
14
96
|
*/
|
|
15
97
|
export type DeviceModel = PublicModelInterface<DeviceModelImpl>;
|
|
16
98
|
export declare class DeviceModelImpl implements IKosDataModel, IKosIdentifiable {
|
|
17
99
|
id: string;
|
|
18
100
|
private logger;
|
|
19
101
|
private _serialNumber;
|
|
102
|
+
/**
|
|
103
|
+
* Hardware-based device serial number for unique identification.
|
|
104
|
+
*
|
|
105
|
+
* Returns the device's hardware serial number or "unassigned" if not yet loaded.
|
|
106
|
+
* Serial numbers are typically retrieved from the device's hardware identification
|
|
107
|
+
* system during critical data events.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const device = Device.factory({});
|
|
112
|
+
*
|
|
113
|
+
* // Check if serial number is available
|
|
114
|
+
* if (device.serialNumber !== "unassigned") {
|
|
115
|
+
* console.log(`Device Serial: ${device.serialNumber}`);
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
20
119
|
get serialNumber(): string | "unassigned";
|
|
21
120
|
private _name;
|
|
121
|
+
/**
|
|
122
|
+
* Human-readable device name for administrative identification.
|
|
123
|
+
*
|
|
124
|
+
* Returns the configured device name or "unassigned" if not yet set.
|
|
125
|
+
* Device names are typically configured during device setup and used
|
|
126
|
+
* in administrative interfaces for device identification and management.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const device = Device.factory({
|
|
131
|
+
* name: 'Main Production Dispenser'
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* console.log(`Device Name: ${device.name}`);
|
|
135
|
+
* // Output: "Device Name: Main Production Dispenser"
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
22
138
|
get name(): string | "unassigned";
|
|
23
139
|
private _nodeId;
|
|
140
|
+
/**
|
|
141
|
+
* Full node identifier within the KOS deployment.
|
|
142
|
+
*
|
|
143
|
+
* Returns the complete node ID or "unassigned" if not yet configured.
|
|
144
|
+
* Node IDs follow the pattern "type-instance" (e.g., "primary-main", "secondary-backup")
|
|
145
|
+
* and identify the specific node role and instance within multi-node deployments.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const device = Device.factory({
|
|
150
|
+
* nodeId: 'primary-controller'
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* console.log(`Node ID: ${device.nodeId}`);
|
|
154
|
+
* // Output: "Node ID: primary-controller"
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* @see {@link nodeType} for extracting the node type portion
|
|
158
|
+
* @see {@link nodeName} for extracting the node name portion
|
|
159
|
+
*/
|
|
24
160
|
get nodeId(): string | "unassigned";
|
|
161
|
+
/**
|
|
162
|
+
* Node type extracted from the node identifier.
|
|
163
|
+
*
|
|
164
|
+
* Returns the first part of the node ID (before the hyphen).
|
|
165
|
+
* For node ID "primary-controller", this returns "primary".
|
|
166
|
+
* Used for role-based logic and node coordination.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const device = Device.factory({
|
|
171
|
+
* nodeId: 'primary-controller'
|
|
172
|
+
* });
|
|
173
|
+
*
|
|
174
|
+
* console.log(`Node Type: ${device.nodeType}`);
|
|
175
|
+
* // Output: "Node Type: primary"
|
|
176
|
+
*
|
|
177
|
+
* // Role-based coordination
|
|
178
|
+
* if (device.nodeType === 'primary') {
|
|
179
|
+
* // Handle primary node responsibilities
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
25
183
|
get nodeType(): string;
|
|
184
|
+
/**
|
|
185
|
+
* Node name extracted from the node identifier.
|
|
186
|
+
*
|
|
187
|
+
* Returns the second part of the node ID (after the hyphen).
|
|
188
|
+
* For node ID "primary-controller", this returns "controller".
|
|
189
|
+
* Used for instance-specific identification within node types.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* const device = Device.factory({
|
|
194
|
+
* nodeId: 'secondary-backup'
|
|
195
|
+
* });
|
|
196
|
+
*
|
|
197
|
+
* console.log(`Node Name: ${device.nodeName}`);
|
|
198
|
+
* // Output: "Node Name: backup"
|
|
199
|
+
*
|
|
200
|
+
* // Instance-specific logic
|
|
201
|
+
* if (device.nodeName === 'backup') {
|
|
202
|
+
* // Handle backup node configuration
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
26
206
|
get nodeName(): string;
|
|
27
207
|
constructor(modelId: string, _options: DeviceOptions, context: KosCreationContext);
|
|
28
208
|
/**
|
|
29
|
-
* Update the model with new options.
|
|
209
|
+
* Update the device model with new configuration options.
|
|
210
|
+
*
|
|
211
|
+
* Allows dynamic updating of device identity and node configuration.
|
|
212
|
+
* Any undefined values will be set to "unassigned". This method is typically
|
|
213
|
+
* called internally during device data loading or external configuration changes.
|
|
214
|
+
*
|
|
215
|
+
* @param options - Device configuration options to apply
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* const device = Device.factory({});
|
|
220
|
+
*
|
|
221
|
+
* // Update with new device information
|
|
222
|
+
* device.updateModel({
|
|
223
|
+
* serialNumber: 'KOS-DEVICE-12345',
|
|
224
|
+
* name: 'Updated Dispenser Name',
|
|
225
|
+
* nodeId: 'primary-main'
|
|
226
|
+
* });
|
|
227
|
+
*
|
|
228
|
+
* console.log(device.serialNumber); // "KOS-DEVICE-12345"
|
|
229
|
+
* console.log(device.name); // "Updated Dispenser Name"
|
|
230
|
+
* console.log(device.nodeId); // "primary-main"
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @example Partial Updates
|
|
234
|
+
* ```typescript
|
|
235
|
+
* // Only update specific fields
|
|
236
|
+
* device.updateModel({
|
|
237
|
+
* name: 'New Device Name'
|
|
238
|
+
* // serialNumber and nodeId remain unchanged
|
|
239
|
+
* });
|
|
240
|
+
* ```
|
|
30
241
|
*/
|
|
31
242
|
updateModel(options: DeviceOptions): void;
|
|
32
243
|
private loadDeviceData;
|
|
@@ -35,13 +246,12 @@ export declare class DeviceModelImpl implements IKosDataModel, IKosIdentifiable
|
|
|
35
246
|
* Handle critical data changes to load the serial number at the appropriate time.
|
|
36
247
|
*/
|
|
37
248
|
handleCriticalDataChanged(): Promise<void>;
|
|
249
|
+
/**
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
38
252
|
init(): Promise<void>;
|
|
39
253
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* This method is called when the device model is loaded.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
254
|
+
* @internal
|
|
45
255
|
*/
|
|
46
256
|
load(): Promise<void>;
|
|
47
257
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/device/device-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAEhB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,UAAU,iBAAiB,CAAC;AACzC,eAAO,MAAM,2BAA2B,8BAA8B,CAAC;AACvE,eAAO,MAAM,6BAA6B,gCAAgC,CAAC;AAC3E,eAAO,MAAM,+BAA+B,kCAAkC,CAAC;AAE/E
|
|
1
|
+
{"version":3,"file":"device-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/device/device-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAEhB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,UAAU,iBAAiB,CAAC;AACzC,eAAO,MAAM,2BAA2B,8BAA8B,CAAC;AACvE,eAAO,MAAM,6BAA6B,gCAAgC,CAAC;AAC3E,eAAO,MAAM,+BAA+B,kCAAkC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC;AAEhE,qBACa,eAAgB,YAAW,aAAa,EAAE,gBAAgB;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAAwB;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,YAAY,CAExC;IAED,OAAO,CAAC,KAAK,CAAwB;IAErC;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,IAAI,IAAI,MAAM,GAAG,YAAY,CAEhC;IAED,OAAO,CAAC,OAAO,CAAwB;IAEvC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,MAAM,IAAI,MAAM,GAAG,YAAY,CAElC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,IAAI,QAAQ,IAAI,MAAM,CAGrB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,IAAI,QAAQ,IAAI,MAAM,CAGrB;gBAGC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,kBAAkB;IAS7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;YAM3B,cAAc;YAYd,gBAAgB;IAU9B;;OAEG;IAKG,yBAAyB;IAO/B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5B"}
|