@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.
Files changed (177) hide show
  1. package/core/core/decorators/index.d.ts +4 -0
  2. package/core/core/decorators/index.d.ts.map +1 -1
  3. package/core/core/decorators/kos-companion.d.ts +125 -8
  4. package/core/core/decorators/kos-companion.d.ts.map +1 -1
  5. package/core/core/decorators/kos-container-aware.d.ts +465 -0
  6. package/core/core/decorators/kos-container-aware.d.ts.map +1 -0
  7. package/core/core/decorators/kos-future-aware.d.ts +150 -0
  8. package/core/core/decorators/kos-future-aware.d.ts.map +1 -0
  9. package/core/core/decorators/kos-logger-aware.d.ts +96 -0
  10. package/core/core/decorators/kos-logger-aware.d.ts.map +1 -0
  11. package/core/core/decorators/kos-trouble-aware.d.ts +71 -0
  12. package/core/core/decorators/kos-trouble-aware.d.ts.map +1 -0
  13. package/core/core/decorators/kosModel.d.ts +8 -2
  14. package/core/core/decorators/kosModel.d.ts.map +1 -1
  15. package/core/core/decorators/kosTopicHandler.d.ts.map +1 -1
  16. package/core/core/decorators/propKeys.d.ts +4 -0
  17. package/core/core/decorators/propKeys.d.ts.map +1 -1
  18. package/core/core/extension/extension-manager.d.ts +1 -1
  19. package/core/core/extension/extension-manager.d.ts.map +1 -1
  20. package/core/core/kosCore.d.ts.map +1 -1
  21. package/core/core/registration/index.d.ts +1 -0
  22. package/core/core/registration/index.d.ts.map +1 -1
  23. package/core/index.d.ts +1 -1
  24. package/core/index.d.ts.map +1 -1
  25. package/core/util/container-utils.d.ts +3 -2
  26. package/core/util/container-utils.d.ts.map +1 -1
  27. package/core/util/observable-proxy-map.d.ts.map +1 -1
  28. package/index.cjs +79 -76
  29. package/index.cjs.map +1 -1
  30. package/index.d.cts +1 -0
  31. package/index.d.ts +1 -0
  32. package/index.d.ts.map +1 -1
  33. package/index.js +9672 -7760
  34. package/index.js.map +1 -1
  35. package/models/models/browser-router/browser-router-model.d.ts +80 -1
  36. package/models/models/browser-router/browser-router-model.d.ts.map +1 -1
  37. package/models/models/browser-router/types/index.d.ts +25 -1
  38. package/models/models/config-bean/config-bean-model-builder.d.ts +4 -2
  39. package/models/models/config-bean/config-bean-model-builder.d.ts.map +1 -1
  40. package/models/models/config-bean/config-bean-model.d.ts +117 -13
  41. package/models/models/config-bean/config-bean-model.d.ts.map +1 -1
  42. package/models/models/config-bean/config-bean-types.d.ts +6 -3
  43. package/models/models/config-bean/config-bean-types.d.ts.map +1 -1
  44. package/models/models/config-bean/types/index.d.ts +33 -0
  45. package/models/models/config-bean-prop/config-bean-prop-model.d.ts +112 -1
  46. package/models/models/config-bean-prop/config-bean-prop-model.d.ts.map +1 -1
  47. package/models/models/config-bean-prop/types/index.d.ts +293 -17
  48. package/models/models/device/device-model.d.ts +219 -9
  49. package/models/models/device/device-model.d.ts.map +1 -1
  50. package/models/models/device/device-registration.d.ts +61 -48
  51. package/models/models/device/device-registration.d.ts.map +1 -1
  52. package/models/models/device/types/index.d.ts +41 -0
  53. package/models/models/future/future-aware.d.ts +82 -0
  54. package/models/models/future/future-aware.d.ts.map +1 -1
  55. package/models/models/future/future-model.d.ts +34 -5
  56. package/models/models/future/future-model.d.ts.map +1 -1
  57. package/models/models/future/future-types.d.ts +186 -7
  58. package/models/models/future/future-types.d.ts.map +1 -1
  59. package/models/models/future-container/future-container-model.d.ts +2 -2
  60. package/models/models/index.d.ts +1 -0
  61. package/models/models/index.d.ts.map +1 -1
  62. package/models/models/key-value/index.d.ts +4 -0
  63. package/models/models/key-value/index.d.ts.map +1 -1
  64. package/models/models/key-value/key-value-model.d.ts +111 -0
  65. package/models/models/key-value/key-value-model.d.ts.map +1 -1
  66. package/models/models/key-value/services/key-value-services.d.ts +124 -2
  67. package/models/models/key-value/services/key-value-services.d.ts.map +1 -1
  68. package/models/models/key-value/types/index.d.ts +56 -0
  69. package/models/models/kos-expression-evaluator/index.d.ts +4 -0
  70. package/models/models/kos-expression-evaluator/index.d.ts.map +1 -0
  71. package/models/models/kos-expression-evaluator/kos-expression-evaluator-model.d.ts +209 -0
  72. package/models/models/kos-expression-evaluator/kos-expression-evaluator-model.d.ts.map +1 -0
  73. package/models/models/kos-expression-evaluator/services/index.d.ts +6 -0
  74. package/models/models/kos-expression-evaluator/services/index.d.ts.map +1 -0
  75. package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts +15 -0
  76. package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts.map +1 -0
  77. package/models/models/kos-expression-evaluator/types/index.d.ts +1 -0
  78. package/models/models/kos-log-manager/kos-log-manager-model.d.ts +61 -14
  79. package/models/models/kos-log-manager/kos-log-manager-model.d.ts.map +1 -1
  80. package/models/models/kos-log-manager/types/index.d.ts +187 -0
  81. package/models/models/kos-time/kos-time-model.d.ts +64 -0
  82. package/models/models/kos-time/kos-time-model.d.ts.map +1 -1
  83. package/models/models/kos-time/types/index.d.ts +80 -0
  84. package/models/models/log-block/log-block-container-model.d.ts +132 -0
  85. package/models/models/log-block/log-block-container-model.d.ts.map +1 -1
  86. package/models/models/log-block/log-block-model.d.ts +185 -0
  87. package/models/models/log-block/log-block-model.d.ts.map +1 -1
  88. package/models/models/log-block/types/index.d.ts +129 -0
  89. package/models/models/log-stream/index.d.ts +6 -2
  90. package/models/models/log-stream/index.d.ts.map +1 -1
  91. package/models/models/log-stream/log-stream-container-model.d.ts +62 -0
  92. package/models/models/log-stream/log-stream-container-model.d.ts.map +1 -1
  93. package/models/models/log-stream/log-stream-model.d.ts +55 -0
  94. package/models/models/log-stream/log-stream-model.d.ts.map +1 -1
  95. package/models/models/log-stream/services/log-stream-services.d.ts +2 -1
  96. package/models/models/log-stream/services/log-stream-services.d.ts.map +1 -1
  97. package/models/models/log-stream/types/index.d.ts +77 -0
  98. package/models/models/network-interface/index.d.ts +6 -2
  99. package/models/models/network-interface/index.d.ts.map +1 -1
  100. package/models/models/network-interface/network-interface-container-model.d.ts +62 -0
  101. package/models/models/network-interface/network-interface-container-model.d.ts.map +1 -1
  102. package/models/models/network-interface/network-interface-container-registration.d.ts +2 -1
  103. package/models/models/network-interface/network-interface-container-registration.d.ts.map +1 -1
  104. package/models/models/network-interface/network-interface-model.d.ts +77 -0
  105. package/models/models/network-interface/network-interface-model.d.ts.map +1 -1
  106. package/models/models/network-interface/network-interface-registration.d.ts +2 -1
  107. package/models/models/network-interface/network-interface-registration.d.ts.map +1 -1
  108. package/models/models/network-interface/services/network-interface-services.d.ts +54 -0
  109. package/models/models/network-interface/services/network-interface-services.d.ts.map +1 -1
  110. package/models/models/network-interface/types/index.d.ts +21 -0
  111. package/models/models/ota/ota-model.d.ts +82 -3
  112. package/models/models/ota/ota-model.d.ts.map +1 -1
  113. package/models/models/ota/types/index.d.ts +146 -0
  114. package/models/models/region-info/region-info-model.d.ts +7 -3
  115. package/models/models/region-info/region-info-model.d.ts.map +1 -1
  116. package/models/models/region-info/services/region-info-services.d.ts.map +1 -1
  117. package/models/models/region-info/types/index.d.ts +141 -13
  118. package/models/models/region-info/types/index.d.ts.map +1 -1
  119. package/models/models/software-info/software-info-model.d.ts +74 -2
  120. package/models/models/software-info/software-info-model.d.ts.map +1 -1
  121. package/models/models/software-info/types/index.d.ts +48 -16
  122. package/models/models/state-bean/state-bean-model.d.ts +86 -9
  123. package/models/models/state-bean/state-bean-model.d.ts.map +1 -1
  124. package/models/models/state-bean/types/index.d.ts +114 -6
  125. package/models/models/state-prop/state-prop-model.d.ts +78 -1
  126. package/models/models/state-prop/state-prop-model.d.ts.map +1 -1
  127. package/models/models/state-prop/types/index.d.ts +55 -7
  128. package/models/models/storage-device/storage-device-container-model.d.ts +289 -2
  129. package/models/models/storage-device/storage-device-container-model.d.ts.map +1 -1
  130. package/models/models/storage-device/storage-device-model.d.ts +84 -2
  131. package/models/models/storage-device/storage-device-model.d.ts.map +1 -1
  132. package/models/models/storage-device/types/index.d.ts +112 -0
  133. package/models/models/studio-properties/studio-properties-model.d.ts +75 -0
  134. package/models/models/studio-properties/studio-properties-model.d.ts.map +1 -1
  135. package/models/models/studio-properties/types/index.d.ts +29 -0
  136. package/models/models/translation/services/translation-services.d.ts +128 -2
  137. package/models/models/translation/services/translation-services.d.ts.map +1 -1
  138. package/models/models/translation/translation-container-model.d.ts +100 -10
  139. package/models/models/translation/translation-container-model.d.ts.map +1 -1
  140. package/models/models/translation/translation-container-registration.d.ts +2 -1
  141. package/models/models/translation/translation-container-registration.d.ts.map +1 -1
  142. package/models/models/translation/translation-context.d.ts +1 -16
  143. package/models/models/translation/translation-context.d.ts.map +1 -1
  144. package/models/models/translation/translation-model.d.ts +113 -1
  145. package/models/models/translation/translation-model.d.ts.map +1 -1
  146. package/models/models/translation/types/index.d.ts +340 -0
  147. package/models/models/trouble/services/trouble-services.d.ts +3 -3
  148. package/models/models/trouble/services/trouble-services.d.ts.map +1 -1
  149. package/models/models/trouble/trouble-model.d.ts +2 -1
  150. package/models/models/trouble/trouble-model.d.ts.map +1 -1
  151. package/models/models/trouble/types/index.d.ts +22 -93
  152. package/models/models/trouble/utils/is-trouble-aware.d.ts +2 -2
  153. package/models/models/trouble/utils/is-trouble-aware.d.ts.map +1 -1
  154. package/models/models/trouble-container/index.d.ts +4 -3
  155. package/models/models/trouble-container/index.d.ts.map +1 -1
  156. package/models/models/trouble-container/trouble-container-model.d.ts +9 -5
  157. package/models/models/trouble-container/trouble-container-model.d.ts.map +1 -1
  158. package/models/models/trouble-container/types/index.d.ts +2 -15
  159. package/models/utils/client.d.ts +8 -8
  160. package/models/utils/core-registration-manager.d.ts +1 -1
  161. package/models/utils/core-registration-manager.d.ts.map +1 -1
  162. package/models/utils/index.d.ts +0 -2
  163. package/models/utils/index.d.ts.map +1 -1
  164. package/models/utils/service.d.ts +9 -9
  165. package/package.json +2 -2
  166. package/ui/contexts/state-bean/state-bean-provider.d.ts.map +1 -1
  167. package/ui/hooks/state-bean/use-state-bean.d.ts +2 -2
  168. package/ui/hooks/state-bean/use-state-bean.d.ts.map +1 -1
  169. package/ui/hooks/state-bean/with-state-bean.d.ts.map +1 -1
  170. package/ui/hooks/translation-container/use-translation-container.d.ts +4 -33
  171. package/ui/hooks/translation-container/use-translation-container.d.ts.map +1 -1
  172. package/models/models/trouble-container/trouble-container-registration.d.ts +0 -5
  173. package/models/models/trouble-container/trouble-container-registration.d.ts.map +0 -1
  174. package/models/utils/kosmodel-compatible-future-mixin.d.ts +0 -142
  175. package/models/utils/kosmodel-compatible-future-mixin.d.ts.map +0 -1
  176. package/models/utils/kosmodel-interface-companion-mixin.d.ts +0 -83
  177. package/models/utils/kosmodel-interface-companion-mixin.d.ts.map +0 -1
@@ -1,24 +1,132 @@
1
1
  import { StatePropertyTypes } from '../../types';
2
- import { IKosDataModel } from '../../../core';
3
2
 
4
3
 
4
+ /**
5
+ * Configuration options for StateBean model instances.
6
+ *
7
+ * This interface defines the configuration options for the StateBean model,
8
+ * specifying which state path the model should monitor for real-time updates.
9
+ *
10
+ * @example Basic StateBean Model Creation
11
+ * ```typescript
12
+ * // Monitor device operational status
13
+ * const deviceState = StateBean.instance('device-status')
14
+ * .options({ path: 'device.operational.status' })
15
+ * .build();
16
+ *
17
+ * // Monitor system health metrics
18
+ * const healthState = StateBean.instance('system-health')
19
+ * .options({ path: 'system.health.metrics' })
20
+ * .build();
21
+ * ```
22
+ *
23
+ * @example Path Patterns
24
+ * ```typescript
25
+ * // Different path patterns for different use cases
26
+ * const networkOptions: StateBeanOptions = {
27
+ * path: 'network.interfaces.primary' // Network interface state
28
+ * };
29
+ *
30
+ * const pumpOptions: StateBeanOptions = {
31
+ * path: 'assembly.pumps.status' // Pump system state
32
+ * };
33
+ *
34
+ * const brewingOptions: StateBeanOptions = {
35
+ * path: 'beverage.brewing.process' // Brewing process state
36
+ * };
37
+ * ```
38
+ *
39
+ * @example Hierarchical State Organization
40
+ * ```typescript
41
+ * // Use dot notation for hierarchical state paths
42
+ * const parentState = StateBean.instance('parent')
43
+ * .options({ path: 'system' })
44
+ * .build();
45
+ *
46
+ * const childState = StateBean.instance('child')
47
+ * .options({ path: 'system.subsystem.component' })
48
+ * .build();
49
+ * ```
50
+ *
51
+ * @category Model Configuration
52
+ * @category State Management
53
+ */
5
54
  export interface StateBeanOptions {
55
+ /**
56
+ * State path to monitor for updates using dot notation hierarchy.
57
+ * This path corresponds to the WebSocket topic `/kos/state/{path}` for real-time updates.
58
+ *
59
+ * @example "device.operational.status"
60
+ * @example "network.interfaces.primary"
61
+ * @example "assembly.pumps.status"
62
+ */
6
63
  path: string;
7
64
  }
8
65
 
66
+ /**
67
+ * Type-safe keys for state properties within a StateBean.
68
+ *
69
+ * @template T - The state property type mapping
70
+ */
9
71
  type StateKeys<T extends Record<string, StatePropertyTypes>> = keyof T;
72
+
73
+ /**
74
+ * Reactive Map-based storage for state properties with type safety.
75
+ *
76
+ * This Map provides efficient storage and retrieval of state properties with automatic
77
+ * reactivity through MobX observables. The Map structure allows for dynamic property
78
+ * addition/removal while maintaining type safety for known properties.
79
+ *
80
+ * @example Accessing State Properties
81
+ * ```typescript
82
+ * // Define typed state interface
83
+ * interface PumpState {
84
+ * active: boolean;
85
+ * flowRate: number;
86
+ * temperature: number;
87
+ * lastMaintenance: string;
88
+ * }
89
+ *
90
+ * const pumpState = StateBean.instance('pump-monitor')
91
+ * .options({ path: 'assembly.pumps.pump1' })
92
+ * .build() as StateBean<PumpState>;
93
+ *
94
+ * // Type-safe property access
95
+ * const isActive = pumpState.props.get('active') as boolean;
96
+ * const currentFlow = pumpState.props.get('flowRate') as number;
97
+ * const temp = pumpState.props.get('temperature') as number;
98
+ * const maintenance = pumpState.props.get('lastMaintenance') as string;
99
+ * ```
100
+ *
101
+ * @template T - The state property type mapping
102
+ *
103
+ * @group KOS Model
104
+ * @category Types
105
+ */
10
106
  export type StatePropsMap<T> = Map<StateKeys<T>, T[keyof T]>;
11
107
 
12
108
  /**
13
- * State Bean Model
14
- * @category Model
109
+ * State Bean Model interface - maintains the state of KOS device state properties.
110
+ *
111
+ * This interface represents the public API for StateBean models, providing reactive
112
+ * access to device state properties through an observable Map structure. The interface
113
+ * supports real-time synchronization with device state via WebSocket topics.
114
+ *
115
+ * @group KOS Model
116
+ * @category Model Interface
15
117
  */
16
118
  export interface StateBeanModel<
17
- T extends Record<string, StatePropertyTypes> = any
18
- > extends StateBeanOptions,
19
- IKosDataModel {
119
+ T extends Record<string, StatePropertyTypes> = Record<
120
+ string,
121
+ StatePropertyTypes
122
+ >
123
+ > {
124
+ /** Unique model identifier */
20
125
  id: string;
126
+ /** State path being monitored */
21
127
  path: string;
128
+ /** Reactive Map of state properties */
22
129
  props: StatePropsMap<T>;
130
+ /** Update model configuration */
23
131
  updateModel(options: StateBeanOptions): void;
24
132
  }
@@ -1,19 +1,96 @@
1
1
  import { KosStateProp, StatePropOptions } from './types';
2
2
  import { StatePropertyTypes } from '../types';
3
3
  import { StateBeanModel } from '../state-bean/types';
4
+ import { PublicModelInterface } from '../../../core/types';
4
5
  import { IKosModelLogger, KosContextLogger, KosCreationContext } from '../../../core';
5
6
 
6
7
  export declare const MODEL_TYPE = "state-prop-model";
7
- export declare class StatePropModelImpl<T extends StatePropertyTypes = any> implements KosStateProp<T>, IKosModelLogger {
8
+ /**
9
+ * StateProp - Focused access to individual state properties with dependency on StateBean.
10
+ *
11
+ * The StateProp model provides targeted access to a single property within a StateBean,
12
+ * offering a focused interface for components or services that only need to monitor
13
+ * specific state values. This model automatically manages its dependency on the underlying
14
+ * StateBean and provides reactive access to individual property values.
15
+ *
16
+ * ## Key Features
17
+ * - **Single Property Focus** - Access one specific property from a StateBean path
18
+ * - **Automatic StateBean Dependency** - Manages StateBean dependency transparently
19
+ * - **Type-safe Value Access** - Strongly typed property value with generic support
20
+ * - **Reactive Updates** - Automatically updates when underlying StateBean changes
21
+ * - **Simplified Interface** - Clean `.value` accessor for property values
22
+ * - **String Conversion** - Built-in `toString()` method for display purposes
23
+ *
24
+ * ## StateBean Integration
25
+ * StateProp models automatically create and manage dependencies on StateBean models:
26
+ * - **Automatic Dependency** - Creates StateBean with matching path automatically
27
+ * - **Shared StateBean** - Multiple StateProp models can share the same StateBean
28
+ * - **Lifecycle Management** - Proper initialization and cleanup of dependencies
29
+ * - **Real-time Synchronization** - Inherits WebSocket updates from StateBean
30
+ *
31
+ * ## Common Use Cases
32
+ * - **Single Value Components** - React components that only need one state property
33
+ * - **Conditional Logic** - Enable/disable functionality based on specific state
34
+ * - **Status Indicators** - Display individual status flags or measurements
35
+ * - **Property Validation** - Monitor specific properties for validation rules
36
+ * - **Focused Updates** - Reduce re-renders by tracking only needed properties
37
+ * - **Service Dependencies** - Services that depend on specific state values
38
+ *
39
+ * @interface
40
+ * @example Basic Usage
41
+ * ```typescript
42
+ * const deviceOnline = StateProp.instance('device-online')
43
+ * .options({
44
+ * path: 'device.operational.status',
45
+ * attribute: 'online'
46
+ * })
47
+ * .build();
48
+ *
49
+ * // Access focused property value with type safety
50
+ * const isOnline = deviceOnline.value as boolean;
51
+ * console.log(`Status: ${deviceOnline.toString()}`);
52
+ * ```
53
+ *
54
+ * @group KOS Model
55
+ * @category State Management
56
+ * @useDeclaredType
57
+ *
58
+ * @see {@link StatePropOptions} - Configuration options for StateProp model
59
+ * @see {@link StatePropertyTypes} - Supported property value types
60
+ * @see {@link StateBean} - Underlying state collection model
61
+ * @see {@link StateBeanOptions} - StateBean configuration options
62
+ */
63
+ export type StateProp<T extends StatePropertyTypes = StatePropertyTypes> = PublicModelInterface<StatePropModelImpl<T>>;
64
+ /**
65
+ * @ignore
66
+ * @internal
67
+ */
68
+ export declare class StatePropModelImpl<T extends StatePropertyTypes = StatePropertyTypes> implements KosStateProp<T>, IKosModelLogger {
69
+ /** Unique identifier for the model instance */
8
70
  id: string;
71
+ /** State path being monitored (same as dependent StateBean) */
9
72
  path: string;
73
+ /** Specific attribute name to access within the state path */
10
74
  attribute: string;
75
+ /** Context logger for debugging and diagnostics */
11
76
  logger: KosContextLogger;
77
+ /** Automatic dependency on StateBean for the specified path */
12
78
  stateBean: StateBeanModel;
13
79
  constructor(modelId: string, options: StatePropOptions, context: KosCreationContext);
80
+ /** The current value of the specific attribute, with type safety */
14
81
  get value(): T | undefined;
82
+ /**
83
+ * @internal
84
+ */
15
85
  init(): Promise<void>;
86
+ /**
87
+ * @internal
88
+ */
16
89
  load(): Promise<void>;
90
+ /**
91
+ * Converts the current property value to string for display purposes.
92
+ * @returns String representation of the property value, or empty string if undefined
93
+ */
17
94
  toString(): string;
18
95
  }
19
96
  //# sourceMappingURL=state-prop-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state-prop-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/state-prop/state-prop-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAG7C,qBACa,kBAAkB,CAAC,CAAC,SAAS,kBAAkB,GAAG,GAAG,CAChE,YAAW,YAAY,CAAC,CAAC,CAAC,EAAE,eAAe;IAE3C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,gBAAgB,CAAC;IAOzB,SAAS,EAAG,cAAc,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,kBAAkB;IAW7B,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzB;IAIK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,QAAQ,IAAI,MAAM;CAGnB"}
1
+ {"version":3,"file":"state-prop-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/state-prop/state-prop-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IACrE,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;AAI9C;;;GAGG;AACH,qBACa,kBAAkB,CAC7B,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,CACjD,YAAW,YAAY,CAAC,CAAC,CAAC,EAAE,eAAe;IAE3C,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,MAAM,EAAE,gBAAgB,CAAC;IAEzB,+DAA+D;IAM/D,SAAS,EAAG,cAAc,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,kBAAkB;IAW7B,oEAAoE;IACpE,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzB;IAID;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;OAGG;IACH,QAAQ,IAAI,MAAM;CAGnB"}
@@ -1,20 +1,68 @@
1
1
  import { StatePropertyTypes } from '../../types';
2
- import { IKosDataModel } from '../../../core';
3
2
 
4
3
 
4
+ /**
5
+ * Configuration options for StateProp model instances.
6
+ *
7
+ * This interface defines the configuration options for the StateProp model,
8
+ * specifying which state path and attribute the model should monitor for
9
+ * focused property access.
10
+ *
11
+ * @example Basic Usage
12
+ * ```typescript
13
+ * const deviceOnline = StateProp.instance('device-online')
14
+ * .options({
15
+ * path: 'device.operational.status',
16
+ * attribute: 'online'
17
+ * })
18
+ * .build();
19
+ * ```
20
+ *
21
+ * @category Model Configuration
22
+ * @category State Management
23
+ */
5
24
  export interface StatePropOptions {
25
+ /**
26
+ * State path to monitor, matching the StateBean path structure.
27
+ * Uses dot notation hierarchy corresponding to `/kos/state/{path}` WebSocket topic.
28
+ *
29
+ * @example "device.operational.status"
30
+ * @example "assembly.pumps.pump1"
31
+ * @example "system.health.metrics"
32
+ */
6
33
  path: string;
34
+
35
+ /**
36
+ * Specific attribute name within the state path to access.
37
+ * This corresponds to a property key within the StateBean's properties Map.
38
+ *
39
+ * @example "online"
40
+ * @example "temperature"
41
+ * @example "flowRate"
42
+ * @example "active"
43
+ */
7
44
  attribute: string;
8
45
  }
9
46
 
10
47
  /**
11
- * State Property Model manages the state of a single state bean property
12
- * @category Model
48
+ * State Property Model interface - manages access to a single state property.
49
+ *
50
+ * This interface represents the public API for StateProp models, providing focused
51
+ * access to individual properties within a StateBean through automatic dependency
52
+ * management and reactive value updates.
53
+ *
54
+ * @group KOS Model
55
+ * @category Model Interface
13
56
  */
14
-
15
- export interface KosStateProp<T extends StatePropertyTypes = any>
16
- extends StatePropOptions,
17
- IKosDataModel {
57
+ export interface KosStateProp<
58
+ T extends StatePropertyTypes = StatePropertyTypes
59
+ > {
60
+ /** Unique model identifier */
18
61
  id: string;
62
+ /** State path being monitored */
63
+ path: string;
64
+ /** Specific attribute name within the state path */
65
+ attribute: string;
66
+ /** Current property value (reactive) */
19
67
  value: T | undefined;
20
68
  }
@@ -7,10 +7,297 @@ import { IKosIdentifiable, IKosModelHolder, PublicModelInterface } from '../../.
7
7
 
8
8
  export declare const MODEL_TYPE = "storage-device-container-model";
9
9
  export declare const TOPIC_STORAGE_AVAILABILITY = "/kos/storage";
10
+ /**
11
+ * StorageDeviceContainer - Manages collections of storage devices with real-time discovery.
12
+ *
13
+ * The StorageDeviceContainer model provides centralized management of multiple storage devices
14
+ * connected to KOS systems. It automatically discovers devices through REST API calls and
15
+ * maintains real-time synchronization via WebSocket topics, handling device insertion,
16
+ * removal, and state updates across the entire storage ecosystem.
17
+ *
18
+ * ## Key Features
19
+ * - **Automatic Device Discovery** - Scans and loads all available storage devices
20
+ * - **Real-time Synchronization** - WebSocket updates for insertion/removal events
21
+ * - **Collection Management** - Add, remove, and query storage device collections
22
+ * - **Availability Monitoring** - Track overall storage availability status
23
+ * - **Volume Access** - Direct access to managed storage device instances
24
+ * - **Parent-Child Architecture** - Proper lifecycle management for contained devices
25
+ *
26
+ * ## Topic-Based Reactivity
27
+ * The model listens to these KOS topics for real-time synchronization:
28
+ * - **`/kos/storage`** - Storage device availability changes (insertion/removal events)
29
+ * - Payload: `StorageDeviceResponse[]` - Array of current storage device states
30
+ * - Triggers automatic model updates, additions, and removals
31
+ * - Handles both physical device changes and mount/unmount operations
32
+ *
33
+ * ## Storage Management Operations
34
+ * The container provides comprehensive storage device management:
35
+ * - **Device Lifecycle**: Automatic creation and cleanup of StorageDevice models
36
+ * - **State Synchronization**: Real-time updates from system storage changes
37
+ * - **Collection Queries**: Access devices by ID, status, or availability
38
+ * - **Volume Tracking**: Monitor mounted and available storage volumes
39
+ *
40
+ * ## Common Use Cases
41
+ * - **Storage Management Dashboard** - Display all connected storage devices
42
+ * - **File Transfer Interface** - Select available storage for operations
43
+ * - **System Monitoring** - Track storage availability and health
44
+ * - **Backup Management** - Identify backup destination devices
45
+ * - **Multi-node Storage** - Manage distributed storage across KOS nodes
46
+ * - **Device Diagnostics** - Monitor storage device runtime and status
47
+ *
48
+ * @example Basic Storage Container Usage
49
+ * ```typescript
50
+ * // Create storage device container for system management
51
+ * const storageContainer = StorageDeviceContainer.instance('main-storage')
52
+ * .options({}) // Empty configuration - behavior driven by discovery
53
+ * .build();
54
+ *
55
+ * // Check overall storage availability
56
+ * console.log(`Storage available: ${storageContainer.isStorageInserted}`);
57
+ * console.log(`Total volumes: ${storageContainer.volumes.length}`);
58
+ *
59
+ * // Access individual storage devices
60
+ * const usbDevice = storageContainer.getModel('usb-drive-1');
61
+ * if (usbDevice && !usbDevice.removed) {
62
+ * console.log(`USB device mounted at: ${usbDevice.mountDir}`);
63
+ * }
64
+ * ```
65
+ *
66
+ * @example Storage Device Discovery and Management
67
+ * ```typescript
68
+ * // Container automatically handles device discovery
69
+ * const storageManager = StorageDeviceContainer.instance('storage-mgr')
70
+ * .options({})
71
+ * .build();
72
+ *
73
+ * // Monitor storage changes with reactive patterns
74
+ * const monitorStorageChanges = () => {
75
+ * // Container automatically updates via /kos/storage topic
76
+ * const availableDevices = storageManager.data.filter(device =>
77
+ * !device.removed && device.mountDir
78
+ * );
79
+ *
80
+ * const localDevices = availableDevices.filter(device => device.local);
81
+ * const remoteDevices = availableDevices.filter(device => !device.local);
82
+ *
83
+ * console.log(`Available storage: ${availableDevices.length} devices`);
84
+ * console.log(`Local: ${localDevices.length}, Remote: ${remoteDevices.length}`);
85
+ *
86
+ * return {
87
+ * total: availableDevices.length,
88
+ * local: localDevices.length,
89
+ * remote: remoteDevices.length,
90
+ * devices: availableDevices
91
+ * };
92
+ * };
93
+ * ```
94
+ *
95
+ * @example React Storage Management Interface
96
+ * ```typescript
97
+ * const StorageManagerComponent: React.FC = kosComponent(() => {
98
+ * const storageContainer = useModel(StorageDeviceContainer, 'storage-manager');
99
+ *
100
+ * // Reactive data automatically updates via WebSocket
101
+ * const availableDevices = storageContainer.volumes.filter(device =>
102
+ * !device.removed && device.mountDir
103
+ * );
104
+ *
105
+ * const removedDevices = storageContainer.volumes.filter(device =>
106
+ * device.removed
107
+ * );
108
+ *
109
+ * return (
110
+ * <div className="storage-manager">
111
+ * <div className="storage-status">
112
+ * <h2>Storage Overview</h2>
113
+ * <div className="status-indicator">
114
+ * <span className={storageContainer.isStorageInserted ? 'online' : 'offline'}>
115
+ * {storageContainer.isStorageInserted ? 'Storage Available' : 'No Storage'}
116
+ * </span>
117
+ * </div>
118
+ * <div className="device-count">
119
+ * Total Devices: {storageContainer.volumes.length}
120
+ * </div>
121
+ * </div>
122
+ *
123
+ * <div className="device-sections">
124
+ * <section className="available-devices">
125
+ * <h3>Available Storage ({availableDevices.length})</h3>
126
+ * {availableDevices.map(device => (
127
+ * <StorageDeviceCard key={device.id} device={device} />
128
+ * ))}
129
+ * </section>
130
+ *
131
+ * {removedDevices.length > 0 && (
132
+ * <section className="removed-devices">
133
+ * <h3>Recently Removed ({removedDevices.length})</h3>
134
+ * {removedDevices.map(device => (
135
+ * <StorageDeviceCard key={device.id} device={device} />
136
+ * ))}
137
+ * </section>
138
+ * )}
139
+ * </div>
140
+ * </div>
141
+ * );
142
+ * });
143
+ * ```
144
+ *
145
+ * @example Storage Device Filtering and Queries
146
+ * ```typescript
147
+ * // Create storage container for advanced device management
148
+ * const storageController = StorageDeviceContainer.instance('storage-ctrl')
149
+ * .options({})
150
+ * .build();
151
+ *
152
+ * // Helper functions for device filtering
153
+ * const getStorageQueries = (container: StorageDeviceContainer) => ({
154
+ * // Get all available (mounted and not removed) devices
155
+ * getAvailableDevices: () =>
156
+ * container.data.filter(device => !device.removed && device.mountDir),
157
+ *
158
+ * // Get devices by specific node
159
+ * getDevicesByNode: (nodeId: string) =>
160
+ * container.data.filter(device => device.nodeId === nodeId),
161
+ *
162
+ * // Get local vs remote devices
163
+ * getLocalDevices: () =>
164
+ * container.data.filter(device => device.local),
165
+ *
166
+ * // Get devices by vendor
167
+ * getDevicesByVendor: (vendor: string) =>
168
+ * container.data.filter(device =>
169
+ * device.vendor.toLowerCase().includes(vendor.toLowerCase())
170
+ * ),
171
+ *
172
+ * // Get backup-suitable devices (available with sufficient runtime)
173
+ * getBackupDevices: () =>
174
+ * container.data.filter(device =>
175
+ * !device.removed &&
176
+ * device.mountDir &&
177
+ * device.runTimeMs > 300000 // More than 5 minutes runtime
178
+ * ),
179
+ *
180
+ * // Get device statistics
181
+ * getStorageStats: () => {
182
+ * const devices = container.data;
183
+ * return {
184
+ * total: devices.length,
185
+ * available: devices.filter(d => !d.removed && d.mountDir).length,
186
+ * removed: devices.filter(d => d.removed).length,
187
+ * local: devices.filter(d => d.local).length,
188
+ * remote: devices.filter(d => !d.local).length,
189
+ * averageRuntime: devices.reduce((sum, d) => sum + d.runTimeMs, 0) / devices.length
190
+ * };
191
+ * }
192
+ * });
193
+ *
194
+ * // Usage examples
195
+ * const queries = getStorageQueries(storageController);
196
+ *
197
+ * console.log('Storage Statistics:', queries.getStorageStats());
198
+ * console.log('Available Devices:', queries.getAvailableDevices().length);
199
+ * console.log('Backup-Ready Devices:', queries.getBackupDevices().length);
200
+ * ```
201
+ *
202
+ * @example WebSocket Topic Synchronization
203
+ * ```typescript
204
+ * // The container automatically handles /kos/storage topic updates
205
+ * const storageSync = StorageDeviceContainer.instance('sync-demo')
206
+ * .options({})
207
+ * .build();
208
+ *
209
+ * // Topic payload structure: StorageDeviceResponse[]
210
+ * // Example payload when device is inserted:
211
+ * // [
212
+ * // {
213
+ * // id: "usb-drive-new",
214
+ * // mountDir: "/media/usb-new",
215
+ * // vendor: "Kingston",
216
+ * // model: "DataTraveler",
217
+ * // label: "KINGSTON_32GB",
218
+ * // nodeId: "primary",
219
+ * // local: true,
220
+ * // removed: false,
221
+ * // runTimeMs: 0,
222
+ * // syspath: "/sys/devices/usb/new"
223
+ * // }
224
+ * // ]
225
+ *
226
+ * // Container automatically:
227
+ * // 1. Compares payload with existing models
228
+ * // 2. Removes models not in payload (device unplugged)
229
+ * // 3. Updates existing models with new state
230
+ * // 4. Creates new models for discovered devices
231
+ * // 5. Maintains parent-child relationships
232
+ *
233
+ * // Monitor changes reactively
234
+ * const logStorageChanges = () => {
235
+ * const currentDevices = storageSync.data.map(device => ({
236
+ * id: device.id,
237
+ * vendor: device.vendor,
238
+ * mounted: !!device.mountDir,
239
+ * removed: device.removed
240
+ * }));
241
+ *
242
+ * console.log('Current Storage State:', currentDevices);
243
+ * };
244
+ * ```
245
+ *
246
+ * @example Multi-Node Storage Architecture
247
+ * ```typescript
248
+ * // Container manages storage across distributed KOS nodes
249
+ * const distributedStorage = StorageDeviceContainer.instance('distributed')
250
+ * .options({})
251
+ * .build();
252
+ *
253
+ * // Analyze storage distribution across nodes
254
+ * const analyzeStorageDistribution = () => {
255
+ * const nodeGroups = distributedStorage.data.reduce((groups, device) => {
256
+ * const nodeId = device.nodeId;
257
+ * if (!groups[nodeId]) {
258
+ * groups[nodeId] = {
259
+ * nodeId,
260
+ * devices: [],
261
+ * available: 0,
262
+ * totalRuntime: 0
263
+ * };
264
+ * }
265
+ *
266
+ * groups[nodeId].devices.push(device);
267
+ * if (!device.removed && device.mountDir) {
268
+ * groups[nodeId].available++;
269
+ * }
270
+ * groups[nodeId].totalRuntime += device.runTimeMs;
271
+ *
272
+ * return groups;
273
+ * }, {} as Record<string, any>);
274
+ *
275
+ * // Display node distribution
276
+ * Object.values(nodeGroups).forEach((node: any) => {
277
+ * const avgRuntime = node.totalRuntime / node.devices.length;
278
+ * console.log(`Node ${node.nodeId}:`);
279
+ * console.log(` Devices: ${node.devices.length}`);
280
+ * console.log(` Available: ${node.available}`);
281
+ * console.log(` Avg Runtime: ${Math.round(avgRuntime / 60000)}min`);
282
+ * });
283
+ *
284
+ * return nodeGroups;
285
+ * };
286
+ * ```
287
+ *
288
+ * @group KOS Model
289
+ * @category Device Management
290
+ *
291
+ * @see {@link StorageDevice} - Individual storage device model
292
+ * @see {@link StorageDeviceOptions} - Configuration options for storage devices
293
+ * @see {@link StorageDeviceContainerOptions} - Container configuration options
294
+ * @see {@link StorageDeviceResponse} - API response structure for device discovery
295
+ */
296
+ export type StorageDeviceContainer = PublicModelInterface<StorageDeviceContainerModelImpl>;
10
297
  export type StorageDeviceContainerModel = PublicModelInterface<StorageDeviceContainerModelImpl>;
11
298
  /**
12
- * Storage Device Container Model
13
- * @category Model
299
+ * @ignore
300
+ * @internal
14
301
  */
15
302
  export declare class StorageDeviceContainerModelImpl implements IKosIdentifiable, IKosModelHolder<StorageDeviceModel>, IKosDataModel {
16
303
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"storage-device-container-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/storage-device/storage-device-container-model.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAIpB,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,UAAU,mCAAmC,CAAC;AAE3D,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AAEzD,MAAM,MAAM,2BAA2B,GACrC,oBAAoB,CAAC,+BAA+B,CAAC,CAAC;AAExD;;;GAGG;AACH,qBACa,+BACX,YACE,gBAAgB,EAChB,eAAe,CAAC,kBAAkB,CAAC,EACnC,aAAa;IAEf,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IACvB,OAAO,CAAC,OAAO,CAAyC;gBAEhE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,kBAAkB;IAY7B,QAAQ,CAAC,EAAE,EAAE,MAAM;IAGnB,IAAI,MAAM,2CAET;IACD,IAAI,IAAI,yBAEP;IAED,QAAQ,CAAC,KAAK,EAAE,kBAAkB;IAIlC,WAAW,CAAC,EAAE,EAAE,MAAM;IAKhB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,IAAI,iBAAiB,YAEpB;IAED,IAAI,OAAO,yBAEV;IAMD,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,EAAE;IA6BpD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAc5B"}
1
+ {"version":3,"file":"storage-device-container-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/storage-device/storage-device-container-model.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAIpB,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,UAAU,mCAAmC,CAAC;AAE3D,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6RG;AACH,MAAM,MAAM,sBAAsB,GAChC,oBAAoB,CAAC,+BAA+B,CAAC,CAAC;AAExD,MAAM,MAAM,2BAA2B,GACrC,oBAAoB,CAAC,+BAA+B,CAAC,CAAC;AAExD;;;GAGG;AACH,qBACa,+BACX,YACE,gBAAgB,EAChB,eAAe,CAAC,kBAAkB,CAAC,EACnC,aAAa;IAEf,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IACvB,OAAO,CAAC,OAAO,CAAyC;gBAEhE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,kBAAkB;IAY7B,QAAQ,CAAC,EAAE,EAAE,MAAM;IAGnB,IAAI,MAAM,2CAET;IACD,IAAI,IAAI,yBAEP;IAED,QAAQ,CAAC,KAAK,EAAE,kBAAkB;IAIlC,WAAW,CAAC,EAAE,EAAE,MAAM;IAKhB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,IAAI,iBAAiB,YAEpB;IAED,IAAI,OAAO,yBAEV;IAMD,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,EAAE;IA6BpD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAc5B"}