@limetech/lime-web-components 6.7.0 → 6.8.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 +8 -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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +93 -85
- 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
|
@@ -6,31 +6,66 @@
|
|
|
6
6
|
* to individual keys typed by a user. The key combination can be pressing a single
|
|
7
7
|
* key or a sequence of keys one after the other.
|
|
8
8
|
*
|
|
9
|
-
* The service works together with the
|
|
9
|
+
* The service works together with the {@link CommandBus} to execute the commands and
|
|
10
10
|
* a command needs to already be registered on the command bus in order to be
|
|
11
11
|
* bound as a keyboard shortcut.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Keybindings are scoped to the component that creates them and should be
|
|
14
|
+
* cleaned up when the component is removed from the DOM to prevent memory leaks
|
|
15
|
+
* and unintended behavior.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
* `unbind` method.
|
|
17
|
+
* ## Key Combination Format
|
|
19
18
|
*
|
|
20
|
-
*
|
|
19
|
+
* Key combinations can be:
|
|
20
|
+
* - Single keys: `'a'`, `'enter'`, `'escape'`
|
|
21
|
+
* - Modifier combinations: `'ctrl+s'`, `'alt+shift+n'`, `'meta+k'`
|
|
22
|
+
* - Sequences: `'g i'` (press 'g' then 'i')
|
|
23
|
+
*
|
|
24
|
+
* Supported modifiers: `ctrl`, `alt`, `shift`, `meta` (Command on Mac)
|
|
25
|
+
*
|
|
26
|
+
* @example Binding a command to a key combination
|
|
27
|
+
* ```ts
|
|
28
|
+
* const saveCommand = new SaveCommand();
|
|
29
|
+
* commandBus.register(SaveCommand, { handle: (cmd) => handleSave(cmd) });
|
|
30
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
31
|
+
* registry.bind('ctrl+s', saveCommand);
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Checking for conflicts before binding
|
|
35
|
+
* ```ts
|
|
36
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
37
|
+
* if (!registry.isBound('j')) {
|
|
38
|
+
* registry.bind('j', navigateNextCommand);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Vim-style key sequences
|
|
43
|
+
* ```ts
|
|
44
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
45
|
+
* registry.bind('g i', goToInboxCommand);
|
|
46
|
+
* registry.bind('g s', goToSentCommand);
|
|
47
|
+
* registry.bind('g d', goToDraftsCommand);
|
|
21
48
|
* ```
|
|
22
|
-
* // The command bus needs to have a handler registered for the command
|
|
23
|
-
* // before it can be bound to a key sequence
|
|
24
|
-
* const handler = new MyHandler();
|
|
25
|
-
* commandBus.register(MyCommand, handler);
|
|
26
49
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
50
|
+
* @example Usage in a component
|
|
51
|
+
* ```ts
|
|
52
|
+
* class MyComponent {
|
|
53
|
+
* private saveCommand = new SaveCommand();
|
|
30
54
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
55
|
+
* connectedCallback() {
|
|
56
|
+
* this.keybindingRegistry.bind('ctrl+s', this.saveCommand);
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* disconnectedCallback() {
|
|
60
|
+
* this.keybindingRegistry.unbind('ctrl+s', this.saveCommand);
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* private get keybindingRegistry() {
|
|
64
|
+
* return this.platform.get(PlatformServiceName.KeybindingRegistry);
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
33
67
|
* ```
|
|
68
|
+
*
|
|
34
69
|
* @note This service is work in progress
|
|
35
70
|
* @beta
|
|
36
71
|
* @group Keyboard shortcuts
|
|
@@ -39,46 +74,124 @@ export interface KeybindingRegistry {
|
|
|
39
74
|
/**
|
|
40
75
|
* Bind a command to a specific key combination to add it to the registry
|
|
41
76
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
77
|
+
* When a user presses the specified key combination, the command will be
|
|
78
|
+
* dispatched through the {@link CommandBus}. The command must already have
|
|
79
|
+
* a handler registered on the command bus before binding.
|
|
80
|
+
*
|
|
81
|
+
* If the same key combination is bound to multiple commands, all commands
|
|
82
|
+
* will be executed in the order they were registered.
|
|
83
|
+
*
|
|
84
|
+
* @param keys - the string representation of keys (e.g., 'ctrl+s', 'alt+shift+n', 'g i')
|
|
85
|
+
* @param command - the command instance to trigger when keys are pressed
|
|
86
|
+
* @throws Will throw an error if the command is invalid or not registered on the command bus
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const command = new SaveCommand();
|
|
91
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
92
|
+
* registry.bind('ctrl+s', command);
|
|
93
|
+
* ```
|
|
45
94
|
*/
|
|
46
95
|
bind: (keys: string, command: object) => void;
|
|
47
96
|
/**
|
|
48
97
|
* Unbind a keybinding to remove it from the registry
|
|
49
98
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
99
|
+
* Removes the association between a key combination and a command. After
|
|
100
|
+
* unbinding, pressing the key combination will no longer trigger the command.
|
|
101
|
+
* This is essential for cleanup when components are removed from the DOM.
|
|
102
|
+
*
|
|
103
|
+
* If multiple commands are bound to the same key combination, only the
|
|
104
|
+
* specified command will be unbound.
|
|
105
|
+
*
|
|
106
|
+
* @param keys - the string representation of the key combination (e.g., 'ctrl+s')
|
|
107
|
+
* @param command - the command instance connected to the key combination
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
112
|
+
* registry.unbind('ctrl+s', saveCommand);
|
|
113
|
+
* ```
|
|
52
114
|
*/
|
|
53
115
|
unbind: (keys: string, command: object) => void;
|
|
54
116
|
/**
|
|
55
117
|
* Get a list of the key bindings that are currently in the registry
|
|
56
118
|
*
|
|
57
|
-
*
|
|
119
|
+
* Returns all active keybindings across all components. Useful for debugging,
|
|
120
|
+
* displaying keyboard shortcuts to users, or detecting conflicts.
|
|
121
|
+
*
|
|
122
|
+
* @returns the list of all active keybindings with their commands
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
127
|
+
* const bindings = registry.getKeybindings();
|
|
128
|
+
* bindings.forEach(binding => {
|
|
129
|
+
* console.log(`${binding.keys} → ${binding.command}`);
|
|
130
|
+
* });
|
|
131
|
+
* ```
|
|
58
132
|
*/
|
|
59
133
|
getKeybindings: () => Keybinding[];
|
|
60
134
|
/**
|
|
61
135
|
* Checks if a key combination or a specific keybinding is already bound
|
|
62
136
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
137
|
+
* Use this method to detect conflicts before binding new keybindings.
|
|
138
|
+
* When called with just a key combination, returns true if any command
|
|
139
|
+
* is bound to those keys. When called with both keys and a command,
|
|
140
|
+
* returns true only if that specific combination exists.
|
|
141
|
+
*
|
|
142
|
+
* @param keys - the string representation of a key combination (e.g., 'ctrl+s')
|
|
143
|
+
* @param command - optional command instance to check for a specific binding
|
|
144
|
+
* @returns true if the key combination is bound (to any or the specified command), false otherwise
|
|
145
|
+
*
|
|
146
|
+
* @example Check if any command is bound to keys
|
|
147
|
+
* ```ts
|
|
148
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
149
|
+
* if (registry.isBound('ctrl+s')) {
|
|
150
|
+
* console.warn('ctrl+s is already bound');
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @example Check if a specific command is bound to keys
|
|
155
|
+
* ```ts
|
|
156
|
+
* const registry = platform.get(PlatformServiceName.KeybindingRegistry);
|
|
157
|
+
* if (registry.isBound('ctrl+s', saveCommand)) {
|
|
158
|
+
* console.log('Save command is bound to ctrl+s');
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
66
161
|
*/
|
|
67
162
|
isBound: (keys: string, command?: object) => boolean;
|
|
68
163
|
}
|
|
69
164
|
/**
|
|
70
165
|
* A key combination and its corresponding command that will be triggered when
|
|
71
166
|
* the key combination is pressed
|
|
167
|
+
*
|
|
168
|
+
* Represents an active binding in the {@link KeybindingRegistry}. Each keybinding
|
|
169
|
+
* associates a specific key combination with a command instance that will be
|
|
170
|
+
* executed via the {@link CommandBus} when the keys are pressed.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const binding: Keybinding = {
|
|
175
|
+
* keys: 'ctrl+s',
|
|
176
|
+
* command: new SaveCommand(),
|
|
177
|
+
* };
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
72
180
|
* @beta
|
|
73
181
|
* @group Keyboard shortcuts
|
|
74
182
|
*/
|
|
75
183
|
export interface Keybinding {
|
|
76
184
|
/**
|
|
77
|
-
* The string representation of key combination
|
|
185
|
+
* The string representation of a key combination
|
|
186
|
+
*
|
|
187
|
+
* Examples: `'ctrl+s'`, `'alt+shift+n'`, `'g i'`, `'escape'`
|
|
78
188
|
*/
|
|
79
189
|
keys: string;
|
|
80
190
|
/**
|
|
81
|
-
* The command to trigger when the key combination is pressed
|
|
191
|
+
* The command instance to trigger when the key combination is pressed
|
|
192
|
+
*
|
|
193
|
+
* This command must be registered on the {@link CommandBus} before the
|
|
194
|
+
* keybinding is created.
|
|
82
195
|
*/
|
|
83
196
|
command: object;
|
|
84
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/keybindings/registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/keybindings/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhD;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,EAAE,MAAM,UAAU,EAAE,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CACxD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,UAAU;IACvB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/problem/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available severity levels for problems.
|
|
3
|
+
*
|
|
4
|
+
* Severity indicates the urgency and impact of a problem, helping users
|
|
5
|
+
* prioritize which issues need attention first. The levels are:
|
|
6
|
+
* - `Low` - Minor issues that don't significantly impact operations
|
|
7
|
+
* - `Medium` - Issues that should be addressed but aren't urgent
|
|
8
|
+
* - `High` - Important issues requiring prompt attention
|
|
9
|
+
* - `Critical` - Severe issues that need immediate action
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* Setting severity when creating a problem
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const problem: Problem = {
|
|
15
|
+
* id: 'email-123',
|
|
16
|
+
* providerId: 'email-integration',
|
|
17
|
+
* type: 'delivery-failed',
|
|
18
|
+
* description: 'Email could not be delivered to recipient',
|
|
19
|
+
* createdAt: new Date().toISOString(),
|
|
20
|
+
* severity: ProblemSeverity.High
|
|
21
|
+
* };
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* Filtering problems by severity
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const criticalProblems = await provider.getProblems({
|
|
28
|
+
* severity: ProblemSeverity.Critical
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const urgentProblems = await provider.getProblems({
|
|
32
|
+
* severity: [ProblemSeverity.High, ProblemSeverity.Critical]
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @alpha
|
|
37
|
+
* @group Problem
|
|
38
|
+
*/
|
|
39
|
+
export declare const ProblemSeverity: {
|
|
40
|
+
readonly Low: "low";
|
|
41
|
+
readonly Medium: "medium";
|
|
42
|
+
readonly High: "high";
|
|
43
|
+
readonly Critical: "critical";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Severity level for a problem, indicating urgency and impact.
|
|
47
|
+
*
|
|
48
|
+
* @see {@link ProblemSeverity} for available values
|
|
49
|
+
*
|
|
50
|
+
* @alpha
|
|
51
|
+
* @group Problem
|
|
52
|
+
*/
|
|
53
|
+
export type ProblemSeverity = (typeof ProblemSeverity)[keyof typeof ProblemSeverity];
|
|
54
|
+
/**
|
|
55
|
+
* Links a problem to a specific {@link LimeObject}.
|
|
56
|
+
*
|
|
57
|
+
* When a problem is related to a specific business object (e.g., a contact
|
|
58
|
+
* whose email bounced, or a deal that failed to sync), the context provides
|
|
59
|
+
* the link to that object. This enables:
|
|
60
|
+
* - Navigating from the problem to the related object
|
|
61
|
+
* - Showing problems when viewing a specific object
|
|
62
|
+
* - Filtering problems by related object type or instance
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* Problem linked to a specific contact
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const problem: Problem = {
|
|
68
|
+
* id: 'email-789',
|
|
69
|
+
* providerId: 'email-integration',
|
|
70
|
+
* type: 'delivery-failed',
|
|
71
|
+
* description: 'Email bounced - invalid address',
|
|
72
|
+
* createdAt: new Date().toISOString(),
|
|
73
|
+
* context: {
|
|
74
|
+
* limetype: 'contact',
|
|
75
|
+
* id: 12345
|
|
76
|
+
* }
|
|
77
|
+
* };
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @see {@link Problem.context}
|
|
81
|
+
* @see {@link ProblemContextFilter} for filtering by context
|
|
82
|
+
*
|
|
83
|
+
* @alpha
|
|
84
|
+
* @group Problem
|
|
85
|
+
*/
|
|
86
|
+
export type ProblemContext = {
|
|
87
|
+
/**
|
|
88
|
+
* The limetype of the related object (e.g., 'contact', 'deal', 'company')
|
|
89
|
+
*/
|
|
90
|
+
limetype: string;
|
|
91
|
+
/**
|
|
92
|
+
* The id of the specific object instance
|
|
93
|
+
*/
|
|
94
|
+
id: number;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Technical error details for a problem.
|
|
98
|
+
*
|
|
99
|
+
* While {@link Problem.description} provides a user-friendly explanation,
|
|
100
|
+
* ProblemError captures the underlying technical details useful for debugging.
|
|
101
|
+
* This separation allows the platform to show appropriate information to
|
|
102
|
+
* different audiences.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* Problem with error details
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const problem: Problem = {
|
|
108
|
+
* id: 'sync-001',
|
|
109
|
+
* providerId: 'external-crm',
|
|
110
|
+
* type: 'connection-error',
|
|
111
|
+
* description: 'Could not sync deal with external CRM',
|
|
112
|
+
* createdAt: new Date().toISOString(),
|
|
113
|
+
* error: {
|
|
114
|
+
* message: 'Connection refused by remote host',
|
|
115
|
+
* code: 'ECONNREFUSED',
|
|
116
|
+
* stack: 'Error: Connection refused\n at TCPConnectWrap...'
|
|
117
|
+
* }
|
|
118
|
+
* };
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @see {@link Problem.error}
|
|
122
|
+
*
|
|
123
|
+
* @alpha
|
|
124
|
+
* @group Problem
|
|
125
|
+
*/
|
|
126
|
+
export interface ProblemError {
|
|
127
|
+
/**
|
|
128
|
+
* Technical error message.
|
|
129
|
+
*
|
|
130
|
+
* This is the raw error message from the underlying system, which may
|
|
131
|
+
* be more technical than the user-facing {@link Problem.description}.
|
|
132
|
+
*/
|
|
133
|
+
message: string;
|
|
134
|
+
/**
|
|
135
|
+
* Error code for programmatic handling.
|
|
136
|
+
*
|
|
137
|
+
* Codes allow categorizing errors without parsing message text.
|
|
138
|
+
* Use standard codes where applicable (e.g., `ETIMEDOUT`, `ECONNREFUSED`)
|
|
139
|
+
* or provider-specific codes.
|
|
140
|
+
*/
|
|
141
|
+
code?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Stack trace for debugging.
|
|
144
|
+
*
|
|
145
|
+
* The full stack trace helps developers diagnose where errors originated.
|
|
146
|
+
* May be displayed in an expandable "Technical Details" section.
|
|
147
|
+
*/
|
|
148
|
+
stack?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Represents a problem reported by a {@link ProblemProvider}.
|
|
152
|
+
*
|
|
153
|
+
* Problems are system-level issues that require manual intervention, such as:
|
|
154
|
+
* - Failed email delivery or validation errors
|
|
155
|
+
* - Integration sync failures with external systems
|
|
156
|
+
* - Background task configuration errors
|
|
157
|
+
* - Data import issues with corrupt records
|
|
158
|
+
*
|
|
159
|
+
* Each problem belongs to a provider which owns the problem's lifecycle,
|
|
160
|
+
* storage, and available actions. Problems can optionally be linked to a
|
|
161
|
+
* specific {@link LimeObject} via the `context` property.
|
|
162
|
+
*
|
|
163
|
+
* The platform aggregates problems from all registered providers, allowing
|
|
164
|
+
* authorized users to view and manage issues across the system.
|
|
165
|
+
*
|
|
166
|
+
* The generic type parameter `T` allows providers to define strongly-typed
|
|
167
|
+
* metadata for their specific problem types.
|
|
168
|
+
*
|
|
169
|
+
* @typeParam T - The type of the metadata object. Defaults to `unknown`.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* Basic problem with required fields only
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const problem: Problem = {
|
|
175
|
+
* id: 'prob-001',
|
|
176
|
+
* providerId: 'email-integration',
|
|
177
|
+
* type: 'delivery-failed',
|
|
178
|
+
* description: 'Email to john@example.com bounced with error: mailbox full',
|
|
179
|
+
* createdAt: '2024-01-15T10:30:00Z'
|
|
180
|
+
* };
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* Problem with typed metadata
|
|
185
|
+
* ```typescript
|
|
186
|
+
* interface EmailProblemMetadata {
|
|
187
|
+
* recipientEmail: string;
|
|
188
|
+
* bounceType: 'permanent' | 'temporary';
|
|
189
|
+
* smtpCode: number;
|
|
190
|
+
* }
|
|
191
|
+
*
|
|
192
|
+
* const problem: Problem<EmailProblemMetadata> = {
|
|
193
|
+
* id: 'email-123',
|
|
194
|
+
* providerId: 'email-integration',
|
|
195
|
+
* type: 'delivery-failed',
|
|
196
|
+
* description: 'Email bounced',
|
|
197
|
+
* createdAt: '2024-01-15T10:30:00Z',
|
|
198
|
+
* metadata: {
|
|
199
|
+
* recipientEmail: 'john@example.com',
|
|
200
|
+
* bounceType: 'permanent',
|
|
201
|
+
* smtpCode: 550
|
|
202
|
+
* }
|
|
203
|
+
* };
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* Problem with error details
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const problem: Problem = {
|
|
210
|
+
* id: 'sync-error-042',
|
|
211
|
+
* providerId: 'external-crm-sync',
|
|
212
|
+
* type: 'connection-error',
|
|
213
|
+
* description: 'Failed to sync deal with external CRM',
|
|
214
|
+
* createdAt: '2024-01-15T14:22:00Z',
|
|
215
|
+
* severity: ProblemSeverity.High,
|
|
216
|
+
* status: 'pending-retry',
|
|
217
|
+
* context: { limetype: 'deal', id: 98765 },
|
|
218
|
+
* error: {
|
|
219
|
+
* message: 'ETIMEDOUT: connection timed out after 30000ms',
|
|
220
|
+
* code: 'ETIMEDOUT',
|
|
221
|
+
* stack: 'Error: ETIMEDOUT\n at TCPConnectWrap.afterConnect...'
|
|
222
|
+
* }
|
|
223
|
+
* };
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* @see {@link ProblemProvider} for the interface that supplies problems
|
|
227
|
+
* @see {@link ProblemRepository} for registering providers and querying problems
|
|
228
|
+
* @see {@link ProblemSeverity} for severity levels
|
|
229
|
+
* @see {@link ProblemError} for technical error details
|
|
230
|
+
*
|
|
231
|
+
* @alpha
|
|
232
|
+
* @group Problem
|
|
233
|
+
*/
|
|
234
|
+
export interface Problem<T = unknown> {
|
|
235
|
+
/**
|
|
236
|
+
* Unique identifier for the problem within the provider.
|
|
237
|
+
*
|
|
238
|
+
* The id only needs to be unique within a single provider. The combination
|
|
239
|
+
* of `providerId` and `id` uniquely identifies a problem across the system.
|
|
240
|
+
*/
|
|
241
|
+
id: string;
|
|
242
|
+
/**
|
|
243
|
+
* Identifier of the {@link ProblemProvider} that reported this problem.
|
|
244
|
+
*
|
|
245
|
+
* This links the problem back to its owning provider, which controls
|
|
246
|
+
* the problem's lifecycle and available actions.
|
|
247
|
+
*
|
|
248
|
+
* This property is set automatically by the platform when problems are
|
|
249
|
+
* returned from the {@link ProblemRepository}. Providers should not
|
|
250
|
+
* include this property when returning problems from their methods.
|
|
251
|
+
*/
|
|
252
|
+
providerId: string;
|
|
253
|
+
/**
|
|
254
|
+
* Type identifier for categorizing the problem.
|
|
255
|
+
*
|
|
256
|
+
* Types are provider-specific and allow grouping similar problems together.
|
|
257
|
+
* Use a consistent naming convention, typically with a prefix indicating
|
|
258
|
+
* the domain (e.g., 'email.delivery-failed', 'sync.connection-error').
|
|
259
|
+
*
|
|
260
|
+
* The provider's {@link ProblemProvider.getType} method returns display
|
|
261
|
+
* information (title, description, icon) for each type.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* // Email integration provider types
|
|
266
|
+
* type: 'email.delivery-failed'
|
|
267
|
+
* type: 'email.validation-error'
|
|
268
|
+
* type: 'email.attachment-too-large'
|
|
269
|
+
*
|
|
270
|
+
* // Sync provider types
|
|
271
|
+
* type: 'sync.connection-error'
|
|
272
|
+
* type: 'sync.data-conflict'
|
|
273
|
+
* type: 'sync.rate-limited'
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
type: string;
|
|
277
|
+
/**
|
|
278
|
+
* Human-readable description of what went wrong.
|
|
279
|
+
*
|
|
280
|
+
* The description should be clear enough for users to understand the issue
|
|
281
|
+
* without needing technical knowledge. Include relevant details like
|
|
282
|
+
* affected entities, error messages, or suggested actions.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```typescript
|
|
286
|
+
* // Good descriptions
|
|
287
|
+
* description: 'Email to john@example.com could not be delivered: mailbox is full'
|
|
288
|
+
* description: 'Failed to sync deal "Big Corp Renewal" with external system: connection timeout'
|
|
289
|
+
*
|
|
290
|
+
* // Avoid overly technical descriptions
|
|
291
|
+
* description: 'SMTP 452 4.2.2 error' // Too technical
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
description: string;
|
|
295
|
+
/**
|
|
296
|
+
* ISO 8601 timestamp when the problem was first detected.
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```typescript
|
|
300
|
+
* createdAt: '2024-01-15T10:30:00Z'
|
|
301
|
+
* createdAt: new Date().toISOString()
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
createdAt: string;
|
|
305
|
+
/**
|
|
306
|
+
* Severity level indicating the problem's urgency and impact.
|
|
307
|
+
*
|
|
308
|
+
* Use severity to help users prioritize which problems to address first.
|
|
309
|
+
*
|
|
310
|
+
* @see {@link ProblemSeverity}
|
|
311
|
+
*/
|
|
312
|
+
severity?: ProblemSeverity;
|
|
313
|
+
/**
|
|
314
|
+
* Current status in the problem's lifecycle.
|
|
315
|
+
*
|
|
316
|
+
* Status is provider-defined. Each provider can define their own status
|
|
317
|
+
* values that make sense for their workflow (e.g., 'open', 'in-progress',
|
|
318
|
+
* 'pending-retry', 'resolved').
|
|
319
|
+
*
|
|
320
|
+
* Status is optional. Some providers may choose to simply remove problems
|
|
321
|
+
* when they're resolved rather than tracking status transitions.
|
|
322
|
+
*/
|
|
323
|
+
status?: string;
|
|
324
|
+
/**
|
|
325
|
+
* Tags for additional categorization and filtering.
|
|
326
|
+
*
|
|
327
|
+
* Tags provide flexible categorization beyond the `type` field. They can
|
|
328
|
+
* represent things like affected systems, error categories, or custom
|
|
329
|
+
* classifications specific to your domain.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```typescript
|
|
333
|
+
* tags: ['email', 'bounce', 'permanent']
|
|
334
|
+
* tags: ['sync', 'external-system', 'timeout']
|
|
335
|
+
* tags: ['import', 'validation', 'required-field']
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
tags?: string[];
|
|
339
|
+
/**
|
|
340
|
+
* Identifier of the user associated with this problem.
|
|
341
|
+
*
|
|
342
|
+
* This could be the user who triggered the action that failed, or the
|
|
343
|
+
* user responsible for the affected data. The exact meaning depends on
|
|
344
|
+
* the provider's context.
|
|
345
|
+
*/
|
|
346
|
+
userId?: string;
|
|
347
|
+
/**
|
|
348
|
+
* Link to a related {@link LimeObject}.
|
|
349
|
+
*
|
|
350
|
+
* When a problem is directly related to a specific business object,
|
|
351
|
+
* the context provides navigation and filtering capabilities.
|
|
352
|
+
*
|
|
353
|
+
* @see {@link ProblemContext}
|
|
354
|
+
*/
|
|
355
|
+
context?: ProblemContext;
|
|
356
|
+
/**
|
|
357
|
+
* Technical error details for debugging.
|
|
358
|
+
*
|
|
359
|
+
* While `description` provides a user-friendly explanation, `error`
|
|
360
|
+
* captures the underlying technical details. The platform may display
|
|
361
|
+
* this in an expandable "Technical Details" section.
|
|
362
|
+
*
|
|
363
|
+
* @see {@link ProblemError}
|
|
364
|
+
*/
|
|
365
|
+
error?: ProblemError;
|
|
366
|
+
/**
|
|
367
|
+
* Additional provider-specific data.
|
|
368
|
+
*
|
|
369
|
+
* Metadata allows providers to attach arbitrary data to problems that
|
|
370
|
+
* may be useful for debugging, displaying additional details, or
|
|
371
|
+
* powering actions. Values should be JSON-serializable.
|
|
372
|
+
*
|
|
373
|
+
* Use the generic type parameter to get type safety for your metadata.
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```typescript
|
|
377
|
+
* metadata: {
|
|
378
|
+
* originalEmailId: 'msg-123',
|
|
379
|
+
* recipientEmail: 'john@example.com',
|
|
380
|
+
* bounceType: 'permanent',
|
|
381
|
+
* smtpCode: 550
|
|
382
|
+
* }
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
metadata?: T;
|
|
386
|
+
/**
|
|
387
|
+
* ISO 8601 timestamp when the problem was last modified.
|
|
388
|
+
*
|
|
389
|
+
* Updated when status changes, metadata is modified, or any other
|
|
390
|
+
* property is updated after initial creation.
|
|
391
|
+
*/
|
|
392
|
+
updatedAt?: string;
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=problem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem.d.ts","sourceRoot":"","sources":["../../src/problem/problem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GACvB,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,OAAO;IAChC;;;;;OAKG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;;;;;OASG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;;OAQG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEb;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|