@limetech/lime-web-components 6.7.0 → 6.9.0
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/CHANGELOG.md +16 -0
- package/dist/ai-context/ai-context-registry.d.ts +216 -0
- package/dist/ai-context/ai-context-registry.d.ts.map +1 -0
- package/dist/ai-context/index.d.ts +3 -0
- package/dist/ai-context/index.d.ts.map +1 -0
- package/dist/ai-context/types.d.ts +15 -0
- package/dist/ai-context/types.d.ts.map +1 -0
- package/dist/eventdispatcher/eventdispatcher.d.ts +76 -10
- package/dist/eventdispatcher/eventdispatcher.d.ts.map +1 -1
- package/dist/filter/decorator.d.ts +21 -3
- package/dist/filter/decorator.d.ts.map +1 -1
- package/dist/filter/repository.d.ts +84 -6
- package/dist/filter/repository.d.ts.map +1 -1
- package/dist/http/http.d.ts +244 -37
- package/dist/http/http.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +109 -99
- package/dist/index.esm.js.map +1 -1
- package/dist/keybindings/registry.d.ts +140 -27
- package/dist/keybindings/registry.d.ts.map +1 -1
- package/dist/problem/index.d.ts +6 -0
- package/dist/problem/index.d.ts.map +1 -0
- package/dist/problem/problem.d.ts +394 -0
- package/dist/problem/problem.d.ts.map +1 -0
- package/dist/problem/provider.d.ts +192 -0
- package/dist/problem/provider.d.ts.map +1 -0
- package/dist/problem/query.d.ts +312 -0
- package/dist/problem/query.d.ts.map +1 -0
- package/dist/problem/repository.d.ts +111 -0
- package/dist/problem/repository.d.ts.map +1 -0
- package/dist/problem/types.d.ts +15 -0
- package/dist/problem/types.d.ts.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [6.9.0](https://github.com/Lundalogik/lime-web-components/compare/v6.8.0...v6.9.0) (2026-01-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **ai-context:** add AIContextRegistry interface ([86ab2a9](https://github.com/Lundalogik/lime-web-components/commit/86ab2a9eb55a86b3bbd18680c0e24f96c5be3ac0))
|
|
8
|
+
|
|
9
|
+
## [6.8.0](https://github.com/Lundalogik/lime-web-components/compare/v6.7.0...v6.8.0) (2026-01-28)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* **problem:** add problem provider interfaces ([a4d003f](https://github.com/Lundalogik/lime-web-components/commit/a4d003f3a8665185c7ec7a99458ebf671d541641))
|
|
16
|
+
|
|
1
17
|
## [6.7.0](https://github.com/Lundalogik/lime-web-components/compare/v6.6.0...v6.7.0) (2026-01-14)
|
|
2
18
|
|
|
3
19
|
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A value that can be safely serialized to JSON via JSON.stringify().
|
|
3
|
+
*
|
|
4
|
+
* This type excludes non-serializable values like:
|
|
5
|
+
* - `undefined` (use `null` instead)
|
|
6
|
+
* - `Date` (convert to ISO string first)
|
|
7
|
+
* - `Function`
|
|
8
|
+
* - `Symbol`
|
|
9
|
+
* - Circular references
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
* @group AI Context
|
|
13
|
+
*/
|
|
14
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
15
|
+
[key: string]: JsonValue;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Represents context information that a provider contributes to the AI chat.
|
|
19
|
+
*
|
|
20
|
+
* Each contribution is additive - all providers' contributions are collected
|
|
21
|
+
* into an array when the AI chat gathers context.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
* @group AI Context
|
|
25
|
+
*/
|
|
26
|
+
export interface AIContextContribution {
|
|
27
|
+
/**
|
|
28
|
+
* Structured data about the current state.
|
|
29
|
+
*
|
|
30
|
+
* This data will be serialized and included in the AI prompt context.
|
|
31
|
+
* Keep the data focused and relevant to avoid filling the context window
|
|
32
|
+
* with noise.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* data: {
|
|
37
|
+
* currentObject: {
|
|
38
|
+
* limetype: 'deal',
|
|
39
|
+
* id: 123,
|
|
40
|
+
* descriptive: 'Acme Corp - Enterprise License'
|
|
41
|
+
* },
|
|
42
|
+
* availableRelations: ['company', 'person', 'activity']
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
data?: Record<string, JsonValue>;
|
|
47
|
+
/**
|
|
48
|
+
* Describes the purpose of this component and what it shows.
|
|
49
|
+
*
|
|
50
|
+
* Use this to help the AI understand what the component is for,
|
|
51
|
+
* how users interact with it, and what the data represents.
|
|
52
|
+
* This is typically hardcoded by component developers.
|
|
53
|
+
*
|
|
54
|
+
* Do NOT use this to restate structured data in natural language.
|
|
55
|
+
* The AI can read the data directly.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Good: explains what the component is and does
|
|
60
|
+
* purpose: 'Shows a single aggregated value from a filter. ' +
|
|
61
|
+
* 'Clicking navigates to the explorer with that filter applied.'
|
|
62
|
+
*
|
|
63
|
+
* // Good: explains how to interpret the data
|
|
64
|
+
* purpose: 'Displays deals in a pipeline view grouped by stage. ' +
|
|
65
|
+
* 'Users drag deals between columns to change their stage.'
|
|
66
|
+
*
|
|
67
|
+
* // Bad: restates structured data
|
|
68
|
+
* purpose: 'The user is viewing deal 123.' // Use data instead
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
purpose?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A provider that contributes context information to the AI chat.
|
|
75
|
+
*
|
|
76
|
+
* Components register providers to share relevant state with the AI.
|
|
77
|
+
* When the AI chat needs context, it calls `getContext()` on all
|
|
78
|
+
* registered providers and collects their contributions.
|
|
79
|
+
*
|
|
80
|
+
* Typically, providers are registered when a component is created or
|
|
81
|
+
* connected to the DOM, and unregistered when disconnected. Alternatively,
|
|
82
|
+
* some components may register/unregister based on visibility if context
|
|
83
|
+
* should only be provided while the component is visible to the user.
|
|
84
|
+
*
|
|
85
|
+
* The `register()` method returns an unregister function for cleanup.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* Registering a provider in a Stencil component
|
|
89
|
+
* ```typescript
|
|
90
|
+
* @Component({ tag: 'my-custom-panel' })
|
|
91
|
+
* export class MyCustomPanel {
|
|
92
|
+
* private unregisterContext: () => void;
|
|
93
|
+
*
|
|
94
|
+
* connectedCallback() {
|
|
95
|
+
* const registry = this.platform.get(PlatformServiceName.AIContextRegistry);
|
|
96
|
+
* this.unregisterContext = registry.register({
|
|
97
|
+
* contextType: 'my-custom-panel',
|
|
98
|
+
* getContext: () => ({
|
|
99
|
+
* purpose: 'Lets users select items for bulk operations. ' +
|
|
100
|
+
* 'Selected items can be exported or bulk-edited.',
|
|
101
|
+
* data: {
|
|
102
|
+
* selectedItemIds: this.selectedItems.map(i => i.id),
|
|
103
|
+
* selectionCount: this.selectedItems.length
|
|
104
|
+
* }
|
|
105
|
+
* })
|
|
106
|
+
* });
|
|
107
|
+
* }
|
|
108
|
+
*
|
|
109
|
+
* disconnectedCallback() {
|
|
110
|
+
* this.unregisterContext?.();
|
|
111
|
+
* }
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @alpha
|
|
116
|
+
* @group AI Context
|
|
117
|
+
*/
|
|
118
|
+
export interface AIContextProvider {
|
|
119
|
+
/**
|
|
120
|
+
* Semantic label for grouping related providers.
|
|
121
|
+
*
|
|
122
|
+
* Multiple providers can share the same contextType (e.g., multiple
|
|
123
|
+
* info-tiles on a page). Each registration gets a unique internal key,
|
|
124
|
+
* so there are no collisions. This label is used for debugging and
|
|
125
|
+
* potential future grouping/filtering of context.
|
|
126
|
+
*
|
|
127
|
+
* Use a descriptive name that identifies the component or feature type.
|
|
128
|
+
*/
|
|
129
|
+
readonly contextType: string;
|
|
130
|
+
/**
|
|
131
|
+
* Get context from this provider.
|
|
132
|
+
*
|
|
133
|
+
* Called when the AI chat needs to gather context from all providers.
|
|
134
|
+
* Should return data that the component already has available - this
|
|
135
|
+
* method is synchronous because providers should only return data
|
|
136
|
+
* that is already rendered on-screen.
|
|
137
|
+
*
|
|
138
|
+
* The implementation should be fast and avoid expensive operations
|
|
139
|
+
* since it's called on every message.
|
|
140
|
+
*
|
|
141
|
+
* @returns The context contribution.
|
|
142
|
+
*/
|
|
143
|
+
getContext(): AIContextContribution;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Registry for AI context providers.
|
|
147
|
+
*
|
|
148
|
+
* The AIContextRegistry manages context providers that contribute information
|
|
149
|
+
* to the AI chat. Components register providers to share their state, and the
|
|
150
|
+
* AI chat gathers context from all providers when needed.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* Gathering context for an AI request
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const registry = platform.get(PlatformServiceName.AIContextRegistry);
|
|
156
|
+
* const contributions = registry.gatherContext();
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @see {@link AIContextProvider} for provider interface
|
|
160
|
+
* @see {@link AIContextContribution} for contribution format
|
|
161
|
+
*
|
|
162
|
+
* @alpha
|
|
163
|
+
* @group AI Context
|
|
164
|
+
*/
|
|
165
|
+
export interface AIContextRegistry {
|
|
166
|
+
/**
|
|
167
|
+
* Register a context provider.
|
|
168
|
+
*
|
|
169
|
+
* The provider will be called when context is gathered via `gatherContext()`.
|
|
170
|
+
* Multiple providers with the same contextType can coexist - each registration
|
|
171
|
+
* gets a unique internal key.
|
|
172
|
+
*
|
|
173
|
+
* @param provider - The provider to register.
|
|
174
|
+
* @returns A function to unregister the provider. Call this when the
|
|
175
|
+
* component is disconnected or the context is no longer relevant.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const unregister = registry.register({
|
|
180
|
+
* contextType: 'deal-card',
|
|
181
|
+
* getContext: () => ({
|
|
182
|
+
* purpose: 'Shows full details of a deal record. ' +
|
|
183
|
+
* 'Users can edit fields and manage related records.',
|
|
184
|
+
* data: {
|
|
185
|
+
* limetype: 'deal',
|
|
186
|
+
* id: this.dealId,
|
|
187
|
+
* descriptive: this.deal.descriptive
|
|
188
|
+
* }
|
|
189
|
+
* })
|
|
190
|
+
* });
|
|
191
|
+
*
|
|
192
|
+
* // Later, when component is disconnected:
|
|
193
|
+
* unregister();
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
register(provider: AIContextProvider): () => void;
|
|
197
|
+
/**
|
|
198
|
+
* Get all registered providers.
|
|
199
|
+
*
|
|
200
|
+
* Useful for debugging or introspection.
|
|
201
|
+
*
|
|
202
|
+
* @returns Array of all registered providers.
|
|
203
|
+
*/
|
|
204
|
+
getProviders(): AIContextProvider[];
|
|
205
|
+
/**
|
|
206
|
+
* Gather context from all registered providers.
|
|
207
|
+
*
|
|
208
|
+
* Calls `getContext()` on each provider and collects the results.
|
|
209
|
+
* Providers that throw errors are skipped (with a warning logged).
|
|
210
|
+
*
|
|
211
|
+
* @returns An array of context contributions, one from each provider
|
|
212
|
+
* that returned successfully.
|
|
213
|
+
*/
|
|
214
|
+
gatherContext(): AIContextContribution[];
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=ai-context-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-context-registry.d.ts","sourceRoot":"","sources":["../../src/ai-context/ai-context-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,GACf,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IAClC;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;;;;;;;;;;OAYG;IACH,UAAU,IAAI,qBAAqB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAC;IAElD;;;;;;OAMG;IACH,YAAY,IAAI,iBAAiB,EAAE,CAAC;IAEpC;;;;;;;;OAQG;IACH,aAAa,IAAI,qBAAqB,EAAE,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai-context/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AIContextRegistry as Service } from './ai-context-registry';
|
|
2
|
+
declare const SERVICE_NAME = "aiContextRegistry";
|
|
3
|
+
declare module '../core/platform' {
|
|
4
|
+
interface PlatformServiceNameType {
|
|
5
|
+
/**
|
|
6
|
+
* @see {@link Service | AIContextRegistry}
|
|
7
|
+
*/
|
|
8
|
+
AIContextRegistry: typeof SERVICE_NAME;
|
|
9
|
+
}
|
|
10
|
+
interface LimeWebComponentPlatform {
|
|
11
|
+
get(name: PlatformServiceNameType['AIContextRegistry']): Service;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ai-context/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE,QAAA,MAAM,YAAY,sBAAsB,CAAC;AAIzC,OAAO,QAAQ,kBAAkB,CAAC;IAC9B,UAAU,uBAAuB;QAC7B;;WAEG;QACH,iBAAiB,EAAE,OAAO,YAAY,CAAC;KAC1C;IACD,UAAU,wBAAwB;QAC9B,GAAG,CAAC,IAAI,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC;KACpE;CACJ"}
|
|
@@ -1,28 +1,94 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Service for
|
|
2
|
+
* Service for application-wide event communication
|
|
3
|
+
*
|
|
4
|
+
* The {@link EventDispatcher} enables loosely-coupled communication between
|
|
5
|
+
* components through a publish-subscribe pattern.
|
|
6
|
+
*
|
|
7
|
+
* Components can dispatch custom events and subscribe to events from other
|
|
8
|
+
* components without direct coupling. This is particularly useful for:
|
|
9
|
+
* - Cross-component communication
|
|
10
|
+
* - Responding to platform-level events (navigation, data changes)
|
|
11
|
+
* - Notifying other components of state changes
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* Basic usage
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const eventDispatcher = platform.get(PlatformServiceName.EventDispatcher);
|
|
17
|
+
*
|
|
18
|
+
* // Dispatch an event
|
|
19
|
+
* eventDispatcher.dispatch('data-changed', { id: 123 });
|
|
20
|
+
*
|
|
21
|
+
* // Listen for events
|
|
22
|
+
* const handler = (event: CustomEvent<{ id: number }>) => {
|
|
23
|
+
* console.log('Data changed:', event.detail.id);
|
|
24
|
+
* };
|
|
25
|
+
* eventDispatcher.addListener('data-changed', handler);
|
|
26
|
+
*
|
|
27
|
+
* // Clean up
|
|
28
|
+
* eventDispatcher.removeListener('data-changed', handler);
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
3
31
|
* @public
|
|
4
32
|
* @group Event dispatching
|
|
5
33
|
*/
|
|
6
34
|
export interface EventDispatcher {
|
|
7
35
|
/**
|
|
8
|
-
* Dispatch a
|
|
36
|
+
* Dispatch a custom event to all registered listeners
|
|
9
37
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
38
|
+
* Creates and dispatches a `CustomEvent` with the provided data. All components
|
|
39
|
+
* that have registered listeners for this event name will be notified.
|
|
40
|
+
*
|
|
41
|
+
* @param eventName - Unique name identifying the event type
|
|
42
|
+
* @param data - Data payload to include in the event's `detail` property
|
|
43
|
+
* @returns The `CustomEvent` that was dispatched
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const eventDispatcher = platform.get(PlatformServiceName.EventDispatcher);
|
|
48
|
+
* eventDispatcher.dispatch('item-selected', { itemId: 42, name: 'Widget' });
|
|
49
|
+
* ```
|
|
12
50
|
*/
|
|
13
51
|
dispatch<T>(eventName: string, data: T): CustomEvent<T>;
|
|
14
52
|
/**
|
|
15
|
-
*
|
|
53
|
+
* Register a listener for a specific event type
|
|
54
|
+
*
|
|
55
|
+
* The listener function will be called whenever an event with the matching
|
|
56
|
+
* name is dispatched. The same listener can be registered multiple times,
|
|
57
|
+
* but should typically be registered only once per component instance.
|
|
58
|
+
*
|
|
59
|
+
* **Important:** Always remove listeners in `disconnectedCallback()` to
|
|
60
|
+
* prevent memory leaks.
|
|
16
61
|
*
|
|
17
|
-
* @param eventName -
|
|
18
|
-
* @param listener -
|
|
62
|
+
* @param eventName - Name of the event to listen for
|
|
63
|
+
* @param listener - Callback function to invoke when the event is dispatched
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* eventDispatcher.addListener('message-received', (event) => {
|
|
68
|
+
* console.log('Message:', event.detail);
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
19
71
|
*/
|
|
20
72
|
addListener<T>(eventName: string, listener: (event: CustomEvent<T>) => void): void;
|
|
21
73
|
/**
|
|
22
|
-
*
|
|
74
|
+
* Unregister a previously registered event listener
|
|
75
|
+
*
|
|
76
|
+
* Removes the specified listener function for the given event name. The
|
|
77
|
+
* listener reference must be the same function instance that was passed
|
|
78
|
+
* to {@link addListener}.
|
|
79
|
+
*
|
|
80
|
+
* Always call this in `disconnectedCallback()` to clean up listeners and
|
|
81
|
+
* prevent memory leaks.
|
|
82
|
+
*
|
|
83
|
+
* @param eventName - Name of the event to stop listening for
|
|
84
|
+
* @param listener - The exact listener function that was previously registered
|
|
23
85
|
*
|
|
24
|
-
* @
|
|
25
|
-
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const handler = (event: CustomEvent<string>) => console.log(event.detail);
|
|
89
|
+
* eventDispatcher.addListener('message-received', handler);
|
|
90
|
+
* eventDispatcher.removeListener('message-received', handler);
|
|
91
|
+
* ```
|
|
26
92
|
*/
|
|
27
93
|
removeListener<T>(eventName: string, listener: (event: CustomEvent<T>) => void): void;
|
|
28
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventdispatcher.d.ts","sourceRoot":"","sources":["../../src/eventdispatcher/eventdispatcher.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"eventdispatcher.d.ts","sourceRoot":"","sources":["../../src/eventdispatcher/eventdispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAExD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,CAAC,EACT,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,GAC1C,IAAI,CAAC;IAER;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,CAAC,CAAC,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,GAC1C,IAAI,CAAC;CACX"}
|
|
@@ -9,10 +9,28 @@ export interface SelectFiltersOptions extends StateOptions {
|
|
|
9
9
|
limetype?: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Decorator that subscribes to filters from the {@link FilterRepository}.
|
|
13
|
+
*
|
|
14
|
+
* This decorator automatically updates the decorated property whenever filters
|
|
15
|
+
* change in the platform. You can optionally filter by limetype or filter ID.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Configuration including limetype/ID filtering and state transformation via {@link SelectFiltersOptions}
|
|
18
|
+
* @returns A PropertyDecorator that sets up automatic subscription to filters
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* @State()
|
|
23
|
+
* @SelectFilters()
|
|
24
|
+
* private filters: Filter[];
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* @State()
|
|
30
|
+
* @SelectFilters({ limetype: 'company' })
|
|
31
|
+
* private companyFilters: Filter[];
|
|
32
|
+
* ```
|
|
13
33
|
*
|
|
14
|
-
* @param options - state decorator options
|
|
15
|
-
* @returns state decorator
|
|
16
34
|
* @public
|
|
17
35
|
* @group Filters
|
|
18
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/filter/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,SAAS,CAAC;AAGjB;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/filter/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,SAAS,CAAC;AAGjB;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CACzB,OAAO,GAAE,oBAAyB,GACnC,iBAAiB,CAMnB"}
|
|
@@ -1,22 +1,100 @@
|
|
|
1
1
|
import { Filter } from '../query';
|
|
2
2
|
import { StateRepository } from '../core';
|
|
3
3
|
/**
|
|
4
|
+
* Repository for managing saved filter definitions.
|
|
5
|
+
*
|
|
6
|
+
* {@link FilterRepository} provides methods to create, update, and delete {@link Filter}
|
|
7
|
+
* definitions. Filters are named, reusable query expressions that can be applied to
|
|
8
|
+
* limetypes to define subsets of objects (e.g., "My Active Deals", "High Priority Tickets").
|
|
9
|
+
*
|
|
10
|
+
* Filters can be:
|
|
11
|
+
* - System-wide (available to all users)
|
|
12
|
+
* - User-specific (private to a single user when `iduser` is set)
|
|
13
|
+
* - Referenced in {@link InFilterExpression}s for advanced queries
|
|
14
|
+
*
|
|
15
|
+
* The repository extends {@link StateRepository}, enabling:
|
|
16
|
+
* - Reactive subscriptions to filter changes
|
|
17
|
+
* - Automatic UI updates when filters are created or deleted
|
|
18
|
+
* - Integration with state decorators
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* Basic usage
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const repo = platform.get(PlatformServiceName.FilterRepository);
|
|
24
|
+
*
|
|
25
|
+
* const filter: Filter = {
|
|
26
|
+
* id: 'high_value_deals',
|
|
27
|
+
* limetype: 'deal',
|
|
28
|
+
* name: { 'en': 'High Value Deals' },
|
|
29
|
+
* filter: {
|
|
30
|
+
* op: Operator.AND,
|
|
31
|
+
* exp: [
|
|
32
|
+
* { key: 'status', op: Operator.EQUALS, exp: 'active' },
|
|
33
|
+
* { key: 'value', op: Operator.GREATER_OR_EQUAL, exp: 100000 }
|
|
34
|
+
* ]
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
*
|
|
38
|
+
* await repo.save(filter);
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
4
41
|
* @public
|
|
5
42
|
* @group Filters
|
|
43
|
+
* @see {@link Filter} for filter definition structure
|
|
44
|
+
* @see {@link Expression} for building filter expressions
|
|
45
|
+
* @see {@link InFilterExpression} for referencing filters in queries
|
|
46
|
+
* @see {@link StateRepository} for subscription patterns
|
|
6
47
|
*/
|
|
7
48
|
export interface FilterRepository extends StateRepository {
|
|
8
49
|
/**
|
|
9
|
-
*
|
|
50
|
+
* Save a filter definition to the database.
|
|
10
51
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
52
|
+
* Creates a new filter or updates an existing one. The filter will be stored
|
|
53
|
+
* persistently and become available for use in queries and filter expressions.
|
|
54
|
+
*
|
|
55
|
+
* If a filter with the same `id` already exists, it will be updated with the
|
|
56
|
+
* new values. Otherwise, a new filter is created.
|
|
57
|
+
*
|
|
58
|
+
* @param filter - The {@link Filter} definition to save
|
|
59
|
+
* @returns Promise that resolves when the filter is saved
|
|
60
|
+
* @throws Error if save fails due to validation or permission issues
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const repo = platform.get(PlatformServiceName.FilterRepository);
|
|
65
|
+
*
|
|
66
|
+
* const filter: Filter = {
|
|
67
|
+
* id: 'my_deals',
|
|
68
|
+
* limetype: 'deal',
|
|
69
|
+
* name: { 'en': 'My Deals' },
|
|
70
|
+
* filter: { key: 'owner', op: Operator.EQUALS, exp: currentUserId }
|
|
71
|
+
* };
|
|
72
|
+
*
|
|
73
|
+
* await repo.save(filter);
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @see {@link Filter} for the filter structure
|
|
77
|
+
* @see {@link Expression} for building filter expressions
|
|
78
|
+
* @see {@link delete} to remove a filter
|
|
13
79
|
*/
|
|
14
80
|
save(filter: Filter): Promise<void>;
|
|
15
81
|
/**
|
|
16
|
-
*
|
|
82
|
+
* Delete a filter from the database.
|
|
83
|
+
*
|
|
84
|
+
* Permanently removes the specified filter. This operation cannot be undone.
|
|
85
|
+
*
|
|
86
|
+
* @param filter - The {@link Filter} to delete
|
|
87
|
+
* @returns Promise that resolves when the filter is deleted
|
|
88
|
+
* @throws Error if deletion fails due to permissions or other issues
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const repo = platform.get(PlatformServiceName.FilterRepository);
|
|
93
|
+
* await repo.delete(filter);
|
|
94
|
+
* ```
|
|
17
95
|
*
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
96
|
+
* @see {@link Filter} for the filter structure
|
|
97
|
+
* @see {@link save} to create or update a filter
|
|
20
98
|
*/
|
|
21
99
|
delete(filter: Filter): Promise<void>;
|
|
22
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/filter/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/filter/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC"}
|