@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/ai-context/ai-context-registry.d.ts +216 -0
  3. package/dist/ai-context/ai-context-registry.d.ts.map +1 -0
  4. package/dist/ai-context/index.d.ts +3 -0
  5. package/dist/ai-context/index.d.ts.map +1 -0
  6. package/dist/ai-context/types.d.ts +15 -0
  7. package/dist/ai-context/types.d.ts.map +1 -0
  8. package/dist/eventdispatcher/eventdispatcher.d.ts +76 -10
  9. package/dist/eventdispatcher/eventdispatcher.d.ts.map +1 -1
  10. package/dist/filter/decorator.d.ts +21 -3
  11. package/dist/filter/decorator.d.ts.map +1 -1
  12. package/dist/filter/repository.d.ts +84 -6
  13. package/dist/filter/repository.d.ts.map +1 -1
  14. package/dist/http/http.d.ts +244 -37
  15. package/dist/http/http.d.ts.map +1 -1
  16. package/dist/index.cjs +3 -3
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.esm.js +109 -99
  21. package/dist/index.esm.js.map +1 -1
  22. package/dist/keybindings/registry.d.ts +140 -27
  23. package/dist/keybindings/registry.d.ts.map +1 -1
  24. package/dist/problem/index.d.ts +6 -0
  25. package/dist/problem/index.d.ts.map +1 -0
  26. package/dist/problem/problem.d.ts +394 -0
  27. package/dist/problem/problem.d.ts.map +1 -0
  28. package/dist/problem/provider.d.ts +192 -0
  29. package/dist/problem/provider.d.ts.map +1 -0
  30. package/dist/problem/query.d.ts +312 -0
  31. package/dist/problem/query.d.ts.map +1 -0
  32. package/dist/problem/repository.d.ts +111 -0
  33. package/dist/problem/repository.d.ts.map +1 -0
  34. package/dist/problem/types.d.ts +15 -0
  35. package/dist/problem/types.d.ts.map +1 -0
  36. package/package.json +3 -3
@@ -0,0 +1,192 @@
1
+ import { Action } from '../action';
2
+ import { Icon } from '../core';
3
+ import { Problem } from './problem';
4
+ import { ProblemQueryOptions, ProblemStatus, ProblemType } from './query';
5
+ /**
6
+ * Interface that packages implement to provide problems to the platform.
7
+ *
8
+ * Providers are responsible for:
9
+ * - Storing and managing their own problems
10
+ * - Defining problem types with display information
11
+ * - Supplying actions users can take on problems
12
+ * - Responding to queries from the platform
13
+ *
14
+ * The platform aggregates problems from all registered providers.
15
+ *
16
+ * @example
17
+ * Provider implementation
18
+ * ```typescript
19
+ * class EmailProblemProvider implements ProblemProvider {
20
+ * id = 'email-integration';
21
+ * title = 'Email Integration';
22
+ * description = 'Problems related to email sending and delivery';
23
+ * icon = 'envelope';
24
+ *
25
+ * private types: ProblemType[] = [
26
+ * { id: 'delivery-failed', title: 'Delivery Failed' }
27
+ * ];
28
+ *
29
+ * private statuses: ProblemStatus[] = [
30
+ * { id: 'open', title: 'Open' },
31
+ * { id: 'resolved', title: 'Resolved' }
32
+ * ];
33
+ *
34
+ * getTypes(): ProblemType[] { return this.types; }
35
+ * getType(type: string): ProblemType | undefined {
36
+ * return this.types.find(t => t.id === type);
37
+ * }
38
+ * getStatuses(): ProblemStatus[] { return this.statuses; }
39
+ * getStatus(status: string): ProblemStatus | undefined {
40
+ * return this.statuses.find(s => s.id === status);
41
+ * }
42
+ * // ... implement remaining methods
43
+ * }
44
+ * ```
45
+ *
46
+ * @example
47
+ * Registering a provider
48
+ * ```typescript
49
+ * const repository = platform.get(PlatformServiceName.ProblemRepository);
50
+ * repository.registerProvider(new EmailProblemProvider());
51
+ * ```
52
+ *
53
+ * @see {@link ProblemRepository} for registering providers and querying problems
54
+ * @see {@link Problem} for the problem structure
55
+ * @see {@link ProblemQueryOptions} for query filtering
56
+ * @see {@link ProblemType} for problem type display information
57
+ * @see {@link Action} for problem actions
58
+ *
59
+ * @alpha
60
+ * @group Problem
61
+ */
62
+ export interface ProblemProvider {
63
+ /**
64
+ * Unique identifier for this provider.
65
+ *
66
+ * Used to identify the provider in the repository and to link problems back
67
+ * to their source. Should be a stable, lowercase identifier using hyphens
68
+ * for word separation (e.g., 'email-integration', 'external-crm-sync').
69
+ *
70
+ * The platform uses this id to set {@link Problem.providerId} when
71
+ * returning problems to consumers.
72
+ */
73
+ id: string;
74
+ /**
75
+ * Human-readable title for the provider.
76
+ *
77
+ * Should clearly identify the source of problems
78
+ * (e.g., 'Email Integration', 'External CRM Sync').
79
+ */
80
+ title: string;
81
+ /**
82
+ * Description of what problems this provider handles.
83
+ */
84
+ description: string;
85
+ /**
86
+ * Icon representing this provider.
87
+ *
88
+ * Can be either a string referencing an icon name from the platform's icon
89
+ * library, or an {@link Icon} object with additional properties like color.
90
+ *
91
+ * @see {@link Icon}
92
+ */
93
+ icon: string | Icon;
94
+ /**
95
+ * Retrieves problems from this provider.
96
+ *
97
+ * Implement filtering based on the provided options where supported.
98
+ * Unsupported filters should be silently ignored.
99
+ *
100
+ * @param options - Query options for filtering and pagination. All properties
101
+ * are optional. Providers should handle what they support and ignore the rest.
102
+ * @returns A promise resolving to an array of problems matching the query.
103
+ *
104
+ * @see {@link ProblemQueryOptions}
105
+ */
106
+ getProblems(options?: ProblemQueryOptions): Promise<Omit<Problem, 'providerId'>[]>;
107
+ /**
108
+ * Returns the count of problems matching the query options.
109
+ *
110
+ * Should return the total count of matching problems, not affected by
111
+ * pagination (limit/offset).
112
+ *
113
+ * @param options - Query options for filtering. Pagination options (limit/offset)
114
+ * should be ignored when counting.
115
+ * @returns A promise resolving to the number of matching problems.
116
+ */
117
+ getCount(options?: ProblemQueryOptions): Promise<number>;
118
+ /**
119
+ * Retrieves a specific problem by its id.
120
+ *
121
+ * @param id - The unique identifier of the problem within this provider.
122
+ * @returns A promise resolving to the problem if found, or undefined if
123
+ * no problem with that id exists.
124
+ */
125
+ get(id: string): Promise<Omit<Problem, 'providerId'> | undefined>;
126
+ /**
127
+ * Returns available actions for a specific problem.
128
+ *
129
+ * Actions allow users to take action on problems (e.g., retry, dismiss,
130
+ * navigate to configuration). Each action wraps a command that executes
131
+ * when triggered.
132
+ *
133
+ * @param problem - The problem to get actions for.
134
+ * @returns An array of actions available for this problem. Return an empty
135
+ * array `[]` if no actions are available.
136
+ *
137
+ * @see {@link Action}
138
+ */
139
+ getActions(problem: Problem): Action[];
140
+ /**
141
+ * Returns all problem types supported by this provider.
142
+ *
143
+ * Used by the platform to render type filters and understand
144
+ * the provider's problem categories.
145
+ *
146
+ * @returns An array of all problem types this provider can produce.
147
+ *
148
+ * @see {@link ProblemType}
149
+ * @see {@link Problem."type"}
150
+ */
151
+ getTypes(): ProblemType[];
152
+ /**
153
+ * Returns display information for a problem type.
154
+ *
155
+ * Problem types are provider-specific identifiers (e.g., 'delivery-failed',
156
+ * 'connection-error'). This method provides the human-readable title,
157
+ * description, and icon for each type.
158
+ *
159
+ * @param type - The problem type identifier (from {@link Problem."type"}).
160
+ * @returns Display information for the type, or undefined if the type
161
+ * is not recognized by this provider.
162
+ *
163
+ * @see {@link ProblemType}
164
+ * @see {@link Problem."type"}
165
+ */
166
+ getType(type: string): ProblemType | undefined;
167
+ /**
168
+ * Returns all statuses supported by this provider.
169
+ *
170
+ * Used by the platform to render status filters and understand
171
+ * the provider's workflow.
172
+ *
173
+ * @returns An array of all statuses this provider uses. Return an empty
174
+ * array `[]` if this provider doesn't track status.
175
+ *
176
+ * @see {@link ProblemStatus}
177
+ * @see {@link Problem.status}
178
+ */
179
+ getStatuses(): ProblemStatus[];
180
+ /**
181
+ * Returns display information for a problem status.
182
+ *
183
+ * @param status - The status identifier (from {@link Problem.status}).
184
+ * @returns Display information for the status, or undefined if the status
185
+ * is not recognized by this provider.
186
+ *
187
+ * @see {@link ProblemStatus}
188
+ * @see {@link Problem.status}
189
+ */
190
+ getStatus(status: string): ProblemStatus | undefined;
191
+ }
192
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/problem/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;;;;;;OASG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB;;;;;;;;;;;OAWG;IACH,WAAW,CACP,OAAO,CAAC,EAAE,mBAAmB,GAC9B,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;IAE1C;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzD;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC;IAElE;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAEvC;;;;;;;;;;OAUG;IACH,QAAQ,IAAI,WAAW,EAAE,CAAC;IAE1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IAE/C;;;;;;;;;;;OAWG;IACH,WAAW,IAAI,aAAa,EAAE,CAAC;IAE/B;;;;;;;;;OASG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;CACxD"}
@@ -0,0 +1,312 @@
1
+ import { Icon } from '../core';
2
+ import { ProblemSeverity } from './problem';
3
+ /**
4
+ * Filter for querying problems related to {@link LimeObject}s.
5
+ *
6
+ * Used with {@link ProblemQueryOptions.context} to find problems linked to
7
+ * specific limeobjects. The limetype is always required, while id is optional:
8
+ * - With only `limetype`: Returns all problems related to that object type
9
+ * - With both `limetype` and `id`: Returns problems for that specific object
10
+ *
11
+ * @example
12
+ * Find all problems related to contacts
13
+ * ```typescript
14
+ * const contactProblems = await provider.getProblems({
15
+ * context: { limetype: 'contact' }
16
+ * });
17
+ * ```
18
+ *
19
+ * @example
20
+ * Find problems for a specific deal
21
+ * ```typescript
22
+ * const dealProblems = await provider.getProblems({
23
+ * context: {
24
+ * limetype: 'deal',
25
+ * id: 12345
26
+ * }
27
+ * });
28
+ * ```
29
+ *
30
+ * @see {@link ProblemQueryOptions.context}
31
+ * @see {@link ProblemContext} for the context stored on problems
32
+ *
33
+ * @alpha
34
+ * @group Problem
35
+ */
36
+ export type ProblemContextFilter = {
37
+ /**
38
+ * The limetype to filter by (e.g., 'contact', 'deal', 'company').
39
+ *
40
+ * This is required because object ids are only unique within a limetype.
41
+ */
42
+ limetype: string;
43
+ /**
44
+ * The specific object id to filter by.
45
+ *
46
+ * When omitted, matches all problems related to the specified limetype.
47
+ */
48
+ id?: number;
49
+ };
50
+ /**
51
+ * Options for querying problems from a {@link ProblemProvider}.
52
+ *
53
+ * All filter properties are optional. Providers handle what they support and
54
+ * silently ignore unsupported filters. This allows the platform to pass a
55
+ * consistent set of filters without needing to know each provider's capabilities.
56
+ *
57
+ * Multiple values can be provided for most filters (severity, status, type, tags)
58
+ * to match problems that have any of the specified values (OR logic).
59
+ *
60
+ * @example
61
+ * Get all open problems
62
+ * ```typescript
63
+ * const openProblems = await provider.getProblems({
64
+ * status: 'open'
65
+ * });
66
+ * ```
67
+ *
68
+ * @example
69
+ * Get high-priority unresolved problems with pagination
70
+ * ```typescript
71
+ * const urgentProblems = await provider.getProblems({
72
+ * severity: [ProblemSeverity.High, ProblemSeverity.Critical],
73
+ * status: ['open', 'acknowledged'],
74
+ * limit: 20,
75
+ * offset: 0
76
+ * });
77
+ * ```
78
+ *
79
+ * @example
80
+ * Get problems for a specific type and user
81
+ * ```typescript
82
+ * const userEmailProblems = await provider.getProblems({
83
+ * type: 'email.delivery-failed',
84
+ * userId: 'user-123'
85
+ * });
86
+ * ```
87
+ *
88
+ * @example
89
+ * Get problems related to a specific limeobject
90
+ * ```typescript
91
+ * const dealProblems = await provider.getProblems({
92
+ * context: {
93
+ * limetype: 'deal',
94
+ * id: 98765
95
+ * }
96
+ * });
97
+ * ```
98
+ *
99
+ * @see {@link ProblemProvider.getProblems}
100
+ * @see {@link ProblemProvider.getCount}
101
+ *
102
+ * @alpha
103
+ * @group Problem
104
+ */
105
+ export interface ProblemQueryOptions {
106
+ /**
107
+ * Filter by severity level(s).
108
+ *
109
+ * When a single value is provided, returns problems with that severity.
110
+ * When an array is provided, returns problems matching any of the severities.
111
+ *
112
+ * @see {@link ProblemSeverity}
113
+ */
114
+ severity?: ProblemSeverity | ProblemSeverity[];
115
+ /**
116
+ * Filter by status(es).
117
+ *
118
+ * Status values are provider-defined strings. When a single value is provided,
119
+ * returns problems with that status. When an array is provided, returns
120
+ * problems matching any of the statuses.
121
+ *
122
+ * @see {@link Problem.status}
123
+ */
124
+ status?: string | string[];
125
+ /**
126
+ * Filter by problem type(s).
127
+ *
128
+ * Types are provider-specific strings like 'email.delivery-failed' or
129
+ * 'sync.connection-error'. When an array is provided, returns problems
130
+ * matching any of the types.
131
+ *
132
+ * @see {@link Problem."type"}
133
+ */
134
+ type?: string | string[];
135
+ /**
136
+ * Filter by tag(s).
137
+ *
138
+ * Returns problems that have any of the specified tags (OR logic).
139
+ *
140
+ * @see {@link Problem.tags}
141
+ */
142
+ tags?: string[];
143
+ /**
144
+ * Filter by user identifier.
145
+ *
146
+ * Returns problems associated with the specified user.
147
+ *
148
+ * @see {@link Problem.userId}
149
+ */
150
+ userId?: string;
151
+ /**
152
+ * Filter by related {@link LimeObject}.
153
+ *
154
+ * Use this to find problems linked to a specific limetype or object instance.
155
+ *
156
+ * @see {@link ProblemContextFilter}
157
+ * @see {@link Problem.context}
158
+ */
159
+ context?: ProblemContextFilter;
160
+ /**
161
+ * Maximum number of problems to return.
162
+ *
163
+ * Used for pagination. When omitted, the provider decides the default limit.
164
+ */
165
+ limit?: number;
166
+ /**
167
+ * Number of problems to skip before returning results.
168
+ *
169
+ * Used for pagination in combination with `limit`. For example, to get
170
+ * the second page of 20 items, use `{ limit: 20, offset: 20 }`.
171
+ */
172
+ offset?: number;
173
+ }
174
+ /**
175
+ * Display information for a problem type.
176
+ *
177
+ * Providers define multiple problem types (e.g., an Email Integration provider
178
+ * might have 'delivery-failed', 'validation-error', 'attachment-too-large').
179
+ * ProblemType provides the human-readable display information for each type.
180
+ *
181
+ * The platform retrieves this information via {@link ProblemProvider.getType}
182
+ * and {@link ProblemProvider.getTypes} to display problems with appropriate
183
+ * titles and icons.
184
+ *
185
+ * @example
186
+ * Implementing type methods in a provider
187
+ * ```typescript
188
+ * class EmailProblemProvider implements ProblemProvider {
189
+ * private types: ProblemType[] = [
190
+ * {
191
+ * id: 'delivery-failed',
192
+ * title: 'Delivery Failed',
193
+ * description: 'Email could not be delivered to the recipient',
194
+ * icon: 'envelope-exclamation'
195
+ * },
196
+ * {
197
+ * id: 'validation-error',
198
+ * title: 'Validation Error'
199
+ * }
200
+ * ];
201
+ *
202
+ * getTypes(): ProblemType[] {
203
+ * return this.types;
204
+ * }
205
+ *
206
+ * getType(type: string): ProblemType | undefined {
207
+ * return this.types.find(t => t.id === type);
208
+ * }
209
+ * }
210
+ * ```
211
+ *
212
+ * @see {@link ProblemProvider.getType}
213
+ * @see {@link ProblemProvider.getTypes}
214
+ * @see {@link Problem."type"}
215
+ *
216
+ * @alpha
217
+ * @group Problem
218
+ */
219
+ export interface ProblemType {
220
+ /**
221
+ * The type identifier as used in {@link Problem."type"}.
222
+ */
223
+ id: string;
224
+ /**
225
+ * Human-readable title for the problem type.
226
+ *
227
+ * Displayed as the primary label for problems of this type. Should be
228
+ * concise but descriptive (e.g., 'Delivery Failed', 'Connection Error').
229
+ */
230
+ title: string;
231
+ /**
232
+ * Detailed description of what this type of problem means.
233
+ *
234
+ * Provides context to help users understand the nature of the problem.
235
+ * May be displayed in tooltips or detail views.
236
+ */
237
+ description?: string;
238
+ /**
239
+ * Icon to display for problems of this type.
240
+ *
241
+ * Can be either a string referencing an icon name from the platform's icon
242
+ * library, or an {@link Icon} object with additional properties like color.
243
+ *
244
+ * @see {@link Icon}
245
+ */
246
+ icon?: string | Icon;
247
+ }
248
+ /**
249
+ * Display information for a problem status.
250
+ *
251
+ * Since status values are provider-defined, providers must supply display
252
+ * information for their statuses so the platform can render them appropriately.
253
+ *
254
+ * @example
255
+ * Implementing getStatus in a provider
256
+ * ```typescript
257
+ * class EmailProblemProvider implements ProblemProvider {
258
+ * private statusInfoMap: Record<string, ProblemStatus> = {
259
+ * 'open': {
260
+ * id: 'open',
261
+ * title: 'Open',
262
+ * icon: 'circle'
263
+ * },
264
+ * 'pending-retry': {
265
+ * id: 'pending-retry',
266
+ * title: 'Pending Retry',
267
+ * icon: 'clock'
268
+ * },
269
+ * 'resolved': {
270
+ * id: 'resolved',
271
+ * title: 'Resolved',
272
+ * icon: 'check-circle'
273
+ * }
274
+ * };
275
+ *
276
+ * getStatus(status: string): ProblemStatus | undefined {
277
+ * return this.statusInfoMap[status];
278
+ * }
279
+ *
280
+ * getStatuses(): ProblemStatus[] {
281
+ * return Object.values(this.statusInfoMap);
282
+ * }
283
+ * }
284
+ * ```
285
+ *
286
+ * @see {@link ProblemProvider.getStatus}
287
+ * @see {@link ProblemProvider.getStatuses}
288
+ * @see {@link Problem.status}
289
+ *
290
+ * @alpha
291
+ * @group Problem
292
+ */
293
+ export interface ProblemStatus {
294
+ /**
295
+ * The status identifier as used in {@link Problem.status}.
296
+ */
297
+ id: string;
298
+ /**
299
+ * Human-readable title for the status.
300
+ */
301
+ title: string;
302
+ /**
303
+ * Icon to display for this status.
304
+ *
305
+ * Can be either a string referencing an icon name from the platform's icon
306
+ * library, or an {@link Icon} object with additional properties like color.
307
+ *
308
+ * @see {@link Icon}
309
+ */
310
+ icon?: string | Icon;
311
+ }
312
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/problem/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,CAAC;IAE/C;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEzB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAE/B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB"}
@@ -0,0 +1,111 @@
1
+ import { Problem } from './problem';
2
+ import { ProblemProvider } from './provider';
3
+ import { ProblemQueryOptions } from './query';
4
+ /**
5
+ * Repository for accessing problems from registered providers.
6
+ *
7
+ * The repository is the primary interface for consumers to interact with
8
+ * problems. It provides a unified API for querying, counting, and retrieving
9
+ * problems from registered {@link ProblemProvider}s.
10
+ *
11
+ * Packages register their providers with the repository during initialization.
12
+ * Consumers then use the repository's query methods rather than interacting
13
+ * with providers directly.
14
+ *
15
+ * @example
16
+ * Registering a provider
17
+ * ```typescript
18
+ * const repository = platform.get(PlatformServiceName.ProblemRepository);
19
+ * repository.registerProvider(new EmailProblemProvider());
20
+ * ```
21
+ *
22
+ * @example
23
+ * Fetching problems from a provider
24
+ * ```typescript
25
+ * const repository = platform.get(PlatformServiceName.ProblemRepository);
26
+ * const problems = await repository.getProblems('email-integration', {
27
+ * severity: ProblemSeverity.Critical
28
+ * });
29
+ * ```
30
+ *
31
+ * @example
32
+ * Getting actions for a problem
33
+ * ```typescript
34
+ * const problem = await repository.get('email-integration', 'prob-123');
35
+ * const provider = repository.getProvider(problem.providerId);
36
+ * const actions = provider.getActions(problem);
37
+ * ```
38
+ *
39
+ * @see {@link ProblemProvider} for the provider interface
40
+ *
41
+ * @alpha
42
+ * @group Problem
43
+ */
44
+ export interface ProblemRepository {
45
+ /**
46
+ * Registers a problem provider with the repository.
47
+ *
48
+ * The provider's {@link ProblemProvider.id} must be unique. Registering
49
+ * a provider with an id that already exists will throw an error.
50
+ *
51
+ * @param provider - The provider to register. Must have a unique id.
52
+ * @throws Error if a provider with the same id is already registered.
53
+ */
54
+ registerProvider(provider: ProblemProvider): void;
55
+ /**
56
+ * Returns all registered providers.
57
+ *
58
+ * Useful for displaying provider information in the UI, such as
59
+ * provider titles and icons for filtering.
60
+ *
61
+ * @returns An array of all registered providers.
62
+ */
63
+ getProviders(): ProblemProvider[];
64
+ /**
65
+ * Returns a specific provider by its id.
66
+ *
67
+ * @param id - The unique identifier of the provider.
68
+ * @returns The provider if found, undefined otherwise.
69
+ */
70
+ getProvider(id: string): ProblemProvider | undefined;
71
+ /**
72
+ * Fetches problems from a provider matching the query options.
73
+ *
74
+ * @param providerId - The provider id to query.
75
+ * @param options - Optional filtering and pagination options.
76
+ * @returns A promise resolving to an array of problems.
77
+ * @throws Error if no provider with the given id is registered.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const emailProblems = await repository.getProblems('email-integration');
82
+ *
83
+ * const criticalProblems = await repository.getProblems(
84
+ * 'email-integration',
85
+ * { severity: ProblemSeverity.Critical }
86
+ * );
87
+ * ```
88
+ */
89
+ getProblems(providerId: string, options?: ProblemQueryOptions): Promise<Problem[]>;
90
+ /**
91
+ * Returns the count of problems from a provider.
92
+ *
93
+ * More efficient than fetching all problems when only the count is needed.
94
+ *
95
+ * @param providerId - The provider id to query.
96
+ * @param options - Optional filtering options.
97
+ * @returns A promise resolving to the count.
98
+ * @throws Error if no provider with the given id is registered.
99
+ */
100
+ getCount(providerId: string, options?: ProblemQueryOptions): Promise<number>;
101
+ /**
102
+ * Retrieves a specific problem by provider and problem id.
103
+ *
104
+ * @param providerId - The id of the provider that owns the problem.
105
+ * @param problemId - The id of the problem within that provider.
106
+ * @returns A promise resolving to the problem if found, undefined otherwise.
107
+ * @throws Error if no provider with the given id is registered.
108
+ */
109
+ get(providerId: string, problemId: string): Promise<Problem | undefined>;
110
+ }
111
+ //# sourceMappingURL=repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/problem/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAElD;;;;;;;OAOG;IACH,YAAY,IAAI,eAAe,EAAE,CAAC;IAElC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IAErD;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CACP,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC9B,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtB;;;;;;;;;OASG;IACH,QAAQ,CACJ,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB;;;;;;;OAOG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;CAC5E"}
@@ -0,0 +1,15 @@
1
+ import { ProblemRepository as Service } from './repository';
2
+ declare const SERVICE_NAME = "problemRepository";
3
+ declare module '../core/platform' {
4
+ interface PlatformServiceNameType {
5
+ /**
6
+ * @see {@link Service | ProblemRepository}
7
+ */
8
+ ProblemRepository: typeof SERVICE_NAME;
9
+ }
10
+ interface LimeWebComponentPlatform {
11
+ get(name: PlatformServiceNameType['ProblemRepository']): Service;
12
+ }
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/problem/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5D,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-web-components",
3
- "version": "6.7.0",
3
+ "version": "6.9.0",
4
4
  "description": "Lime Web Components",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "@microsoft/api-extractor": "^7.55.2",
41
41
  "eslint": "^9.39.2",
42
42
  "expect-type": "^1.3.0",
43
- "globals": "^17.0.0",
43
+ "globals": "^17.2.0",
44
44
  "jsdom": "^27.4.0",
45
45
  "replace-in-file": "^8.4.0",
46
46
  "shelljs": "0.10.0",
@@ -49,7 +49,7 @@
49
49
  "typescript": "^4.9.5",
50
50
  "vite": "^7.3.1",
51
51
  "vite-plugin-dts": "^4.5.0",
52
- "vitest": "^4.0.17",
52
+ "vitest": "^4.0.18",
53
53
  "yargs": "^18.0.0"
54
54
  },
55
55
  "keywords": [