@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
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export type { KeyValueModel } from './key-value-model';
|
|
2
2
|
export { KeyValue } from './key-value-registration';
|
|
3
|
+
/**
|
|
4
|
+
* @group KOS Model
|
|
5
|
+
* @category Key-Value Store
|
|
6
|
+
*/
|
|
3
7
|
export * as KeyValueServices from './services';
|
|
4
8
|
export type * from './types';
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/key-value/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,gBAAgB,MAAM,YAAY,CAAC;AAC/C,mBAAmB,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/key-value/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD;;;GAGG;AACH,OAAO,KAAK,gBAAgB,MAAM,YAAY,CAAC;AAC/C,mBAAmB,SAAS,CAAC"}
|
|
@@ -3,17 +3,128 @@ import { KeyValueUpdate } from './services';
|
|
|
3
3
|
import { IKosDataModel, IKosIdentifiable, KosCreationContext, KosData, PublicModelInterface } from '../../../core';
|
|
4
4
|
|
|
5
5
|
export declare const MODEL_TYPE = "key-value-model";
|
|
6
|
+
/**
|
|
7
|
+
* Key-Value Model - Persistent, reactive state storage with real-time synchronization across KOS applications.
|
|
8
|
+
*
|
|
9
|
+
* This model provides a namespaced key-value store that automatically persists data and synchronizes
|
|
10
|
+
* changes across all connected clients in real-time. Perfect for storing user preferences, application
|
|
11
|
+
* state, feature flags, or any data that needs to persist between sessions and sync across instances.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
* - **Persistent Storage** - Data survives application restarts and browser refreshes
|
|
15
|
+
* - **Real-time Synchronization** - Changes propagate instantly to all connected clients
|
|
16
|
+
* - **Namespace Isolation** - Multiple stores can coexist without key collisions
|
|
17
|
+
* - **Type-Safe Values** - Supports string, number, boolean, and undefined types
|
|
18
|
+
* - **Reactive Updates** - Automatic UI updates when values change (locally or remotely)
|
|
19
|
+
* - **Topic-Based Sync** - Uses KOS event system for distributed state management
|
|
20
|
+
*
|
|
21
|
+
* ## Topic-Based Reactivity
|
|
22
|
+
* The model listens to two KOS topics for real-time synchronization:
|
|
23
|
+
* - **`/keyVal/set`** - Fired when any key-value pair is updated or added
|
|
24
|
+
* - **`/keyVal/remove`** - Fired when a key is deleted from the store
|
|
25
|
+
*
|
|
26
|
+
* These topics ensure that all instances of the model with the same namespace stay
|
|
27
|
+
* synchronized across browser tabs, windows, and even different client applications.
|
|
28
|
+
* The model automatically filters events by namespace to ensure isolation.
|
|
29
|
+
*
|
|
30
|
+
* @interface
|
|
31
|
+
*
|
|
32
|
+
* @example Basic Usage
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const preferences = KeyValue.instance('user-prefs')
|
|
35
|
+
* .options({ namespace: 'preferences' })
|
|
36
|
+
* .build();
|
|
37
|
+
*
|
|
38
|
+
* // Store values
|
|
39
|
+
* await preferences.updateState('theme', 'dark');
|
|
40
|
+
* await preferences.updateState('fontSize', 14);
|
|
41
|
+
*
|
|
42
|
+
* // Access reactive data
|
|
43
|
+
* console.log(preferences.data.theme); // 'dark'
|
|
44
|
+
* console.log(preferences.data.fontSize); // 14
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example React Integration
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const UserSettings: React.FC = kosComponent(() => {
|
|
50
|
+
* const settings = useModel(KeyValue, 'app-settings');
|
|
51
|
+
*
|
|
52
|
+
* return (
|
|
53
|
+
* <div>
|
|
54
|
+
* <p>Theme: {settings.data.theme || 'light'}</p>
|
|
55
|
+
* <button onClick={() => settings.updateState('theme', 'dark')}>
|
|
56
|
+
* Set Dark Theme
|
|
57
|
+
* </button>
|
|
58
|
+
* </div>
|
|
59
|
+
* );
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @group KOS Model
|
|
64
|
+
* @category State Management
|
|
65
|
+
* @category Key-Value Store
|
|
66
|
+
* @useDeclaredType
|
|
67
|
+
* @see {@link KeyValueOptions} - Configuration options for key-value stores
|
|
68
|
+
* @see {@link KeyValueUpdate} - Update event structure for synchronization
|
|
69
|
+
*/
|
|
6
70
|
export type KeyValueModel = PublicModelInterface<KeyValueModelImpl>;
|
|
71
|
+
/**
|
|
72
|
+
* @ignore
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
7
75
|
export declare class KeyValueModelImpl implements IKosDataModel, IKosIdentifiable {
|
|
8
76
|
id: string;
|
|
9
77
|
private logger;
|
|
10
78
|
private namespace;
|
|
11
79
|
data: KosData<Record<string, string | number | boolean | undefined>>;
|
|
12
80
|
constructor(modelId: string, options: KeyValueOptions, context: KosCreationContext);
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
13
84
|
init(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Update or delete a key-value pair in the store.
|
|
87
|
+
*
|
|
88
|
+
* Changes are automatically persisted and synchronized across all instances
|
|
89
|
+
* with the same namespace via KOS topics.
|
|
90
|
+
*
|
|
91
|
+
* @param key - The key to update or delete
|
|
92
|
+
* @param value - The value to set (string | number | boolean), or undefined to delete the key
|
|
93
|
+
* @returns Promise that resolves when the operation completes
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* // Set a value
|
|
98
|
+
* await keyValue.updateState('theme', 'dark');
|
|
99
|
+
*
|
|
100
|
+
* // Delete a key
|
|
101
|
+
* await keyValue.updateState('theme', undefined);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
14
104
|
updateState(key: string, value: string | number | boolean | undefined): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Load initial data from persistent storage.
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
15
110
|
load(): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Topic handler for `/keyVal/set` events to sync updates across instances.
|
|
113
|
+
*
|
|
114
|
+
* Automatically called when any KeyValue model instance updates a value,
|
|
115
|
+
* ensuring all instances with the same namespace stay synchronized.
|
|
116
|
+
*
|
|
117
|
+
* @param update - The key-value update event containing namespace, key, and new value
|
|
118
|
+
*/
|
|
16
119
|
handleStateUpdate(update: KeyValueUpdate): void;
|
|
120
|
+
/**
|
|
121
|
+
* Topic handler for `/keyVal/remove` events to sync deletions across instances.
|
|
122
|
+
*
|
|
123
|
+
* Automatically called when any KeyValue model instance deletes a key,
|
|
124
|
+
* ensuring all instances with the same namespace stay synchronized.
|
|
125
|
+
*
|
|
126
|
+
* @param update - The key-value update event containing namespace and deleted key
|
|
127
|
+
*/
|
|
17
128
|
handleStateDelete(update: KeyValueUpdate): void;
|
|
18
129
|
}
|
|
19
130
|
//# sourceMappingURL=key-value-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-value-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/key-value/key-value-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAEhB,kBAAkB,EAClB,OAAO,EACP,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEpE,qBACa,iBAAkB,YAAW,aAAa,EAAE,gBAAgB;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,SAAS,CAAS;IAC1B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC;gBAEnE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"key-value-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/key-value/key-value-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAEhB,kBAAkB,EAClB,OAAO,EACP,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEpE;;;GAGG;AACH,qBACa,iBAAkB,YAAW,aAAa,EAAE,gBAAgB;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,SAAS,CAAS;IAC1B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC;gBAEnE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,kBAAkB;IAQ7B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;;;;;;;;;;;;;;;;OAkBG;IACG,WAAW,CACf,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAC3C,OAAO,CAAC,IAAI,CAAC;IAUhB;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;;;;;;OAOG;IAEH,iBAAiB,CAAC,MAAM,EAAE,cAAc;IAOxC;;;;;;;OAOG;IAEH,iBAAiB,CAAC,MAAM,EAAE,cAAc;CAMzC"}
|
|
@@ -1,18 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Key-Value service functions for persistent data storage and retrieval.
|
|
3
|
+
*
|
|
4
|
+
* This module provides service functions for managing key-value pairs in KOS device storage.
|
|
5
|
+
* Supports namespaced storage, CRUD operations, and typed value handling for configuration
|
|
6
|
+
* data, user preferences, and application state persistence.
|
|
7
|
+
*
|
|
8
|
+
* @module KeyValueServices
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Response format for key-value data retrieval.
|
|
12
|
+
*
|
|
13
|
+
* Represents the structure of data returned from key-value service endpoints,
|
|
14
|
+
* supporting primitive types commonly used for configuration and state data.
|
|
15
|
+
*
|
|
16
|
+
* @group KOS Model
|
|
17
|
+
* @category Key-Value Store
|
|
18
|
+
*/
|
|
1
19
|
interface KeyValueResponse {
|
|
20
|
+
/** Key-value pairs with primitive values */
|
|
2
21
|
[key: string]: string | number | boolean;
|
|
3
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Update request format for key-value operations.
|
|
25
|
+
*
|
|
26
|
+
* Defines the structure for updating individual key-value pairs within
|
|
27
|
+
* specific namespaces, supporting targeted updates without affecting
|
|
28
|
+
* other stored data.
|
|
29
|
+
*
|
|
30
|
+
* @group KOS Model
|
|
31
|
+
* @category Key-Value Store
|
|
32
|
+
*/
|
|
4
33
|
export interface KeyValueUpdate {
|
|
34
|
+
/** Namespace identifier for data organization */
|
|
5
35
|
namespace: string;
|
|
36
|
+
/** Specific key within the namespace */
|
|
6
37
|
key: string;
|
|
38
|
+
/** Value to store (as string for API compatibility) */
|
|
7
39
|
value: string;
|
|
8
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Removes a specific key-value pair from storage.
|
|
43
|
+
*
|
|
44
|
+
* Permanently deletes a key and its associated value from the specified namespace.
|
|
45
|
+
* This operation cannot be undone, so use with caution for critical data.
|
|
46
|
+
*
|
|
47
|
+
* @param namespace - Namespace containing the key to delete
|
|
48
|
+
* @param key - Specific key to remove from storage
|
|
49
|
+
*
|
|
50
|
+
* @throws {Error} When deletion request fails or service is unavailable
|
|
51
|
+
*
|
|
52
|
+
* @example Delete User Preference
|
|
53
|
+
* ```typescript
|
|
54
|
+
* await deleteKeyValue('user-preferences', 'theme-mode');
|
|
55
|
+
* console.log('Theme preference cleared');
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @group KOS Model
|
|
59
|
+
* @category Key-Value Store
|
|
60
|
+
*/
|
|
9
61
|
export declare const deleteKeyValue: (namespace: string, key: string) => Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates or updates a key-value pair in persistent storage.
|
|
64
|
+
*
|
|
65
|
+
* Stores a value under the specified key within the given namespace. If the key
|
|
66
|
+
* already exists, its value will be overwritten. Supports primitive types with
|
|
67
|
+
* automatic string conversion for API compatibility.
|
|
68
|
+
*
|
|
69
|
+
* @param namespace - Namespace for organizing related key-value pairs
|
|
70
|
+
* @param key - Unique identifier within the namespace
|
|
71
|
+
* @param value - Value to store (primitive types supported)
|
|
72
|
+
* @returns Promise resolving to the stored value
|
|
73
|
+
*
|
|
74
|
+
* @throws {Error} When update request fails or service returns non-200 status
|
|
75
|
+
*
|
|
76
|
+
* @example Store Configuration Setting
|
|
77
|
+
* ```typescript
|
|
78
|
+
* await updateKeyValue('device-config', 'maxRetries', 5);
|
|
79
|
+
* await updateKeyValue('user-prefs', 'darkMode', true);
|
|
80
|
+
* await updateKeyValue('app-state', 'lastLogin', '2024-01-15');
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @group KOS Model
|
|
84
|
+
* @category Key-Value Store
|
|
85
|
+
*/
|
|
10
86
|
export declare const updateKeyValue: (namespace: string, key: string, value: string | number | boolean) => Promise<any>;
|
|
11
87
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
88
|
+
* Retrieves all key-value pairs from a specified namespace.
|
|
89
|
+
*
|
|
90
|
+
* Fetches all stored data within the given namespace as a complete object.
|
|
91
|
+
* Useful for loading configuration sets, user preferences, or application
|
|
92
|
+
* state data in bulk operations.
|
|
93
|
+
*
|
|
94
|
+
* @param namespace - Namespace to retrieve data from (defaults to "studio")
|
|
95
|
+
* @returns Promise resolving to object containing all key-value pairs in namespace
|
|
96
|
+
*
|
|
97
|
+
* @throws {Error} When retrieval fails or service returns non-200 status
|
|
98
|
+
*
|
|
99
|
+
* @example Load Application Configuration
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const appConfig = await getKeyValue('app-config');
|
|
102
|
+
* console.log('Max retries:', appConfig.maxRetries);
|
|
103
|
+
* console.log('Debug mode:', appConfig.debugMode);
|
|
104
|
+
*
|
|
105
|
+
* const userPrefs = await getKeyValue('user-preferences');
|
|
106
|
+
* const theme = userPrefs.themeMode || 'light';
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @group KOS Model
|
|
110
|
+
* @category Key-Value Store
|
|
14
111
|
*/
|
|
15
112
|
export declare const getKeyValue: (namespace?: string) => Promise<KeyValueResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* Removes an entire namespace and all its key-value pairs.
|
|
115
|
+
*
|
|
116
|
+
* Permanently deletes all data within the specified namespace. This is a
|
|
117
|
+
* destructive operation that cannot be undone. Use with extreme caution
|
|
118
|
+
* for critical data or production systems.
|
|
119
|
+
*
|
|
120
|
+
* @param namespace - Namespace to completely remove from storage
|
|
121
|
+
*
|
|
122
|
+
* @throws {Error} When deletion request fails or service is unavailable
|
|
123
|
+
*
|
|
124
|
+
* @example Clear All User Preferences
|
|
125
|
+
* ```typescript
|
|
126
|
+
* // Warning: This removes ALL user preferences permanently
|
|
127
|
+
* await deleteKeyValueNamespace('user-preferences');
|
|
128
|
+
* console.log('All user preferences cleared');
|
|
129
|
+
*
|
|
130
|
+
* // Better: Clear specific preferences individually
|
|
131
|
+
* await deleteKeyValue('user-preferences', 'theme-mode');
|
|
132
|
+
* await deleteKeyValue('user-preferences', 'language');
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @group KOS Model
|
|
136
|
+
* @category Key-Value Store
|
|
137
|
+
*/
|
|
16
138
|
export declare const deleteKeyValueNamespace: (namespace: string) => Promise<void>;
|
|
17
139
|
export {};
|
|
18
140
|
//# sourceMappingURL=key-value-services.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-value-services.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/key-value/services/key-value-services.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"key-value-services.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/key-value/services/key-value-services.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkBH;;;;;;;;GAQG;AACH,UAAU,gBAAgB;IACxB,4CAA4C;IAC5C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC1C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,cAAqB,MAAM,OAAO,MAAM,kBAKlE,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,cACd,MAAM,OACZ,MAAM,SACJ,MAAM,GAAG,MAAM,GAAG,OAAO,iBAcjC,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW,mDAavB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,uBAAuB,cAAqB,MAAM,kBAK9D,CAAC"}
|
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for creating KeyValue model instances.
|
|
3
|
+
*
|
|
4
|
+
* The namespace option allows you to create isolated key-value stores that don't
|
|
5
|
+
* interfere with each other, even when using the same keys. This is essential for
|
|
6
|
+
* organizing different types of data and preventing key collisions.
|
|
7
|
+
*
|
|
8
|
+
* @example Default Namespace
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Uses default 'studio' namespace
|
|
11
|
+
* const store = KeyValue.instance('my-store')
|
|
12
|
+
* .options({})
|
|
13
|
+
* .build();
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Custom Namespace
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Create isolated stores with custom namespaces
|
|
19
|
+
* const userStore = KeyValue.instance('user')
|
|
20
|
+
* .options({ namespace: 'user-data' })
|
|
21
|
+
* .build();
|
|
22
|
+
*
|
|
23
|
+
* const appStore = KeyValue.instance('app')
|
|
24
|
+
* .options({ namespace: 'app-state' })
|
|
25
|
+
* .build();
|
|
26
|
+
*
|
|
27
|
+
* // Same key, different namespaces = no collision
|
|
28
|
+
* await userStore.updateState('id', 'user-123');
|
|
29
|
+
* await appStore.updateState('id', 'app-456');
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example Namespace Conventions
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Recommended namespace patterns
|
|
35
|
+
* const examples: KeyValueOptions[] = [
|
|
36
|
+
* { namespace: 'user-preferences' }, // User-specific settings
|
|
37
|
+
* { namespace: 'application-state' }, // Global app state
|
|
38
|
+
* { namespace: 'feature-flags' }, // Feature toggles
|
|
39
|
+
* { namespace: 'session-data' }, // Session-specific data
|
|
40
|
+
* { namespace: 'cache-layer' }, // Cached API responses
|
|
41
|
+
* { namespace: 'dev-tools' } // Development/debug data
|
|
42
|
+
* ];
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @group KOS Model
|
|
46
|
+
* @category Data Persistence
|
|
47
|
+
* @category Key-Value Store
|
|
48
|
+
*/
|
|
1
49
|
export interface KeyValueOptions {
|
|
50
|
+
/**
|
|
51
|
+
* Namespace for the key-value store to prevent key collisions between different stores.
|
|
52
|
+
*
|
|
53
|
+
* Defaults to 'studio' if not specified. Choose descriptive namespaces that clearly
|
|
54
|
+
* indicate the purpose of the stored data.
|
|
55
|
+
*
|
|
56
|
+
* @default 'studio'
|
|
57
|
+
*/
|
|
2
58
|
namespace?: string;
|
|
3
59
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { KosExpressionEvaluatorModel, KosExpressionEvaluatorModelImpl, } from './kos-expression-evaluator-model';
|
|
2
|
+
export type * from './types';
|
|
3
|
+
export declare const KosExpressionEvaluator: import('../../..').KosModelRegistrationType<import('./kos-expression-evaluator-model').KosExpressionEvaluatorModel<string>, import('./types').KosExpressionEvaluatorOptions>;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/kos-expression-evaluator/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,kCAAkC,CAAC;AAC1C,mBAAmB,SAAS,CAAC;AAE7B,eAAO,MAAM,sBAAsB,8KACW,CAAC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { KosExpressionEvaluatorOptions } from './types';
|
|
2
|
+
import { PublicModelInterface } from '../../../core/types';
|
|
3
|
+
import { IKosIdentifiable } from '../../../core/core/types';
|
|
4
|
+
import { IKosDataModel, KosCreationContext } from '../../../core/core/kosModel';
|
|
5
|
+
import { KosModelRegistrationType } from '../../../core';
|
|
6
|
+
|
|
7
|
+
export declare const MODEL_TYPE = "kos-expression-evaluator-model";
|
|
8
|
+
/**
|
|
9
|
+
* Result of evaluating an expression, containing either a successful value or error details.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const result = evaluator.getExpressionValue('myExpression');
|
|
14
|
+
* if (result?.error) {
|
|
15
|
+
* console.error(`Expression error: ${result.error}`);
|
|
16
|
+
* } else {
|
|
17
|
+
* console.log(`Result: ${result?.value}`);
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface ExpressionResult {
|
|
22
|
+
/** The computed value of the expression, or undefined if evaluation failed */
|
|
23
|
+
value: unknown;
|
|
24
|
+
/** Error message if expression evaluation failed, undefined if successful */
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface NamedExpression {
|
|
28
|
+
/** Unique name identifier for this expression */
|
|
29
|
+
name: string;
|
|
30
|
+
/** The expression string (JavaScript-like syntax) */
|
|
31
|
+
expression: string;
|
|
32
|
+
/** Getter that returns the cached result */
|
|
33
|
+
get result(): ExpressionResult;
|
|
34
|
+
/** Method to evaluate the expression with given context data */
|
|
35
|
+
evaluate(contextData: Record<string, unknown>): ExpressionResult;
|
|
36
|
+
/** Method to update the cached result */
|
|
37
|
+
updateResult(result: ExpressionResult): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* KOS Expression Evaluator Model - Reactive expression evaluation with dynamic context and type-safe named expressions.
|
|
41
|
+
*
|
|
42
|
+
* This model provides a reactive expression evaluation system that automatically re-evaluates
|
|
43
|
+
* expressions when their context data changes. Perfect for business rules, computed values,
|
|
44
|
+
* and conditional logic that needs to stay synchronized with changing data.
|
|
45
|
+
*
|
|
46
|
+
* ## Key Features
|
|
47
|
+
* - **Automatic reactivity** - Expressions re-evaluate when dependencies change thanks to KOS reactive patterns
|
|
48
|
+
* - **Type safety** - Generic type parameter provides compile-time checking for expression names
|
|
49
|
+
* - **Efficient updates** - Only affected expressions recalculate when their data dependencies change
|
|
50
|
+
* - **Synchronous access** - Results available immediately via getters
|
|
51
|
+
* - **Error handling** - Expressions with runtime errors are handled gracefully
|
|
52
|
+
* - **KOS model integration** - Add any KOS model to context for fully reactive expressions
|
|
53
|
+
*
|
|
54
|
+
* @interface
|
|
55
|
+
* @example Basic Usage
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const evaluator = KosExpressionEvaluatorModel.instance('my-evaluator').build();
|
|
58
|
+
*
|
|
59
|
+
* evaluator.setContextData({ temperature: 72, humidity: 45 });
|
|
60
|
+
* evaluator.addExpression('isComfortable', 'temperature >= 68 && temperature <= 78');
|
|
61
|
+
*
|
|
62
|
+
* console.log(evaluator.results.isComfortable?.value); // true
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @group KOS Model
|
|
66
|
+
* @category Expression Processing
|
|
67
|
+
* @useDeclaredType
|
|
68
|
+
*/
|
|
69
|
+
export type KosExpressionEvaluatorModel<T extends string = string> = PublicModelInterface<KosExpressionEvaluatorModelImpl<T>>;
|
|
70
|
+
/**
|
|
71
|
+
* @ignore
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export declare class KosExpressionEvaluatorModelImpl<T extends string = string> implements IKosDataModel, IKosIdentifiable {
|
|
75
|
+
static Registration: KosModelRegistrationType<KosExpressionEvaluatorModel, KosExpressionEvaluatorOptions>;
|
|
76
|
+
id: string;
|
|
77
|
+
private logger;
|
|
78
|
+
private parser;
|
|
79
|
+
private _data;
|
|
80
|
+
private _expressions;
|
|
81
|
+
private _results;
|
|
82
|
+
private _contextRevision;
|
|
83
|
+
constructor(modelId: string, _options: KosExpressionEvaluatorOptions, context: KosCreationContext);
|
|
84
|
+
/**
|
|
85
|
+
* Get the current context data that expressions are evaluated against.
|
|
86
|
+
*
|
|
87
|
+
* @returns The current context data as a record of key-value pairs
|
|
88
|
+
*/
|
|
89
|
+
get data(): Record<string, unknown>;
|
|
90
|
+
get contextRevision(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Replace the entire context data with new values. All expressions will
|
|
93
|
+
* automatically re-evaluate against the new context.
|
|
94
|
+
*
|
|
95
|
+
* @param newData - Complete new context data to replace existing data
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* evaluator.setContextData({ temperature: 75, humidity: 40 });
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
setContextData(newData: Record<string, unknown>): void;
|
|
103
|
+
/**
|
|
104
|
+
* Update a single value in the context data. All expressions using this
|
|
105
|
+
* value will automatically re-evaluate.
|
|
106
|
+
*
|
|
107
|
+
* @param key - The context data key to update
|
|
108
|
+
* @param value - The new value to set
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* evaluator.updateContextValue('temperature', 85);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
updateContextValue(key: string, value: unknown): void;
|
|
116
|
+
/**
|
|
117
|
+
* Update a nested property in the context data using dot notation.
|
|
118
|
+
* This method safely updates nested properties without replacing the entire object structure.
|
|
119
|
+
*
|
|
120
|
+
* @param path - Dot-separated path to the nested property (e.g., 'sensors.humidity', 'config.thresholds.temp')
|
|
121
|
+
* @param value - The new value to set at the nested path
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* evaluator.updateNestedValue('sensors.humidity', 60);
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
updateNestedValue(path: string, value: unknown): void;
|
|
129
|
+
/**
|
|
130
|
+
* Add a KOS model to the evaluation context. The model's observable properties
|
|
131
|
+
* will be accessible via dotted notation and expressions will automatically
|
|
132
|
+
* re-evaluate when the model's data changes.
|
|
133
|
+
*
|
|
134
|
+
* @param key - The context key to store the model under
|
|
135
|
+
* @param model - Any KOS model instance (must be observable)
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const sensorModel = SensorModel.instance('main-sensor').build();
|
|
140
|
+
* evaluator.addModelToContext('sensor', sensorModel);
|
|
141
|
+
* evaluator.addExpression('isCritical', 'sensor.temperature > 80');
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
addModelToContext(key: string, model: unknown): void;
|
|
145
|
+
/**
|
|
146
|
+
* Add a named expression that will be automatically evaluated against context data.
|
|
147
|
+
* The expression will re-evaluate whenever its dependencies in the context change.
|
|
148
|
+
*
|
|
149
|
+
* @param name - Unique identifier for this expression (type-safe when using generic)
|
|
150
|
+
* @param expressionString - JavaScript-like expression string
|
|
151
|
+
* @throws {Error} If the expression has invalid syntax
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* evaluator.addExpression('isHot', 'temperature > 80');
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
addExpression(name: T, expressionString: string): void;
|
|
159
|
+
removeExpression(name: T): boolean;
|
|
160
|
+
getExpression(name: T): NamedExpression | undefined;
|
|
161
|
+
getExpressionValue(name: T): ExpressionResult | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Get the cached result of an expression without triggering re-evaluation.
|
|
164
|
+
* This is useful for dependency tracking in effects where you want to avoid
|
|
165
|
+
* creating reactive chains through the expression evaluation.
|
|
166
|
+
*
|
|
167
|
+
* @param name - The expression name to get the cached result for
|
|
168
|
+
* @returns The last cached result, or undefined if expression doesn't exist
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* const cached = evaluator.getCachedExpressionValue('myExpression');
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
getCachedExpressionValue(name: T): ExpressionResult | undefined;
|
|
176
|
+
get expressions(): NamedExpression[];
|
|
177
|
+
get expressionNames(): T[];
|
|
178
|
+
get results(): Record<T, ExpressionResult>;
|
|
179
|
+
/**
|
|
180
|
+
* Force re-evaluation of all expressions and update cached results.
|
|
181
|
+
* This is called by the effect when context data changes.
|
|
182
|
+
*/
|
|
183
|
+
private evaluateAllExpressions;
|
|
184
|
+
/**
|
|
185
|
+
* Evaluate a specific expression and update the cached result if it changed.
|
|
186
|
+
*/
|
|
187
|
+
private evaluateExpression;
|
|
188
|
+
/**
|
|
189
|
+
* Internal method to update the results object when expression values change.
|
|
190
|
+
* This is called by ReactiveExpression when its value changes.
|
|
191
|
+
* ObservableData handles dynamic properties automatically with MobX atoms.
|
|
192
|
+
*/
|
|
193
|
+
private updateResult;
|
|
194
|
+
/**
|
|
195
|
+
* Create an anonymous reactive expression and return its generated ID.
|
|
196
|
+
* The expression becomes fully reactive and can be accessed via the returned ID.
|
|
197
|
+
*
|
|
198
|
+
* @param expressionString - JavaScript-like expression string
|
|
199
|
+
* @returns Generated UUID that can be used to access the expression via `getExpressionValue(id)` or `results[id]`
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const tempCheckId = evaluator.createExpression('temperature > 75');
|
|
204
|
+
* const result = evaluator.getExpressionValue(tempCheckId);
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
createExpression(expressionString: string): string;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=kos-expression-evaluator-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kos-expression-evaluator-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/kos-expression-evaluator/kos-expression-evaluator-model.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/kos-expression-evaluator/services/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KOS Expression Evaluator Services
|
|
3
|
+
*
|
|
4
|
+
* The Expression Evaluator model is a purely computational model that performs
|
|
5
|
+
* local expression evaluation against context data. It does not require any
|
|
6
|
+
* HTTP services or external API calls.
|
|
7
|
+
*
|
|
8
|
+
* All functionality is self-contained within the model using:
|
|
9
|
+
* - expr-eval library for expression parsing and evaluation
|
|
10
|
+
* - KOS reactive patterns for automatic re-evaluation
|
|
11
|
+
* - Local context data storage
|
|
12
|
+
*
|
|
13
|
+
* No external services are needed.
|
|
14
|
+
*/
|
|
15
|
+
//# sourceMappingURL=kos-expression-evaluator-services.d.ts.map
|
package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kos-expression-evaluator-services.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-ui-sdk/src/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export interface KosExpressionEvaluatorOptions {}
|