@ckeditor/ckeditor5-watchdog 48.2.0-alpha.7 → 48.3.0-alpha.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/dist/actionsrecorder.d.ts +246 -246
- package/dist/actionsrecorderconfig.d.ts +187 -187
- package/dist/augmentation.d.ts +18 -18
- package/dist/contextwatchdog.d.ts +315 -315
- package/dist/editorwatchdog.d.ts +214 -214
- package/dist/index-content.css +1 -0
- package/dist/index-editor.css +1 -0
- package/dist/index.css +0 -2
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1633 -1849
- package/dist/index.js.map +1 -1
- package/dist/utils/areconnectedthroughproperties.d.ts +7 -7
- package/dist/utils/getsubnodes.d.ts +7 -7
- package/dist/utils/normalizerootsconfig.d.ts +15 -15
- package/dist/watchdog.d.ts +205 -205
- package/package.json +4 -4
- package/dist/index.css.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
* Traverses both structures to find out whether there is a reference that is shared between both structures.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
10
|
export declare function areConnectedThroughProperties(target1: unknown, target2: unknown, excludedNodes?: Set<unknown>): boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module watchdog/utils/getsubnodes
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
11
|
export declare function getSubNodes(head: unknown, excludedProperties?: Set<unknown>): Set<unknown>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { EditorConfig } from
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
import type { EditorConfig } from "@ckeditor/ckeditor5-core";
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
* Normalizes the editor roots configuration. It ensures that all root configurations are defined in `config.roots`
|
|
8
|
+
* and that they have `initialData` defined.
|
|
9
|
+
*
|
|
10
|
+
* It normalizes a single-root configuration (where `config.root` is used) to a multi-root configuration
|
|
11
|
+
* (where all roots are defined in `config.roots`). This is considered a standard configuration format,
|
|
12
|
+
* so the editor features can always expect roots to be defined in `config.roots`.
|
|
13
|
+
*
|
|
14
|
+
* It also handles legacy configuration options, such as `config.initialData`, `config.placeholder`, and `config.label`.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
18
|
export declare function normalizeRootsConfig(sourceElementsOrData: HTMLElement | string | Record<string, HTMLElement> | Record<string, string>, config: EditorConfig, defaultRootName: string | false): void;
|
package/dist/watchdog.d.ts
CHANGED
|
@@ -1,229 +1,229 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { CKEditorError } from
|
|
9
|
-
import type { EditorWatchdogRestartEvent } from
|
|
10
|
-
import type { ContextWatchdogItemErrorEvent, ContextWatchdogItemRestartEvent } from
|
|
6
|
+
* @module watchdog/watchdog
|
|
7
|
+
*/
|
|
8
|
+
import type { CKEditorError } from "@ckeditor/ckeditor5-utils";
|
|
9
|
+
import type { EditorWatchdogRestartEvent } from "./editorwatchdog.js";
|
|
10
|
+
import type { ContextWatchdogItemErrorEvent, ContextWatchdogItemRestartEvent } from "./contextwatchdog.js";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
* An abstract watchdog class that handles most of the error handling process and the state of the underlying component.
|
|
13
|
+
*
|
|
14
|
+
* See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and how to use it.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
18
|
export declare abstract class Watchdog {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
19
|
+
/**
|
|
20
|
+
* An array of crashes saved as an object with the following properties:
|
|
21
|
+
*
|
|
22
|
+
* * `message`: `String`,
|
|
23
|
+
* * `stack`: `String`,
|
|
24
|
+
* * `date`: `Number`,
|
|
25
|
+
* * `filename`: `String | undefined`,
|
|
26
|
+
* * `lineno`: `Number | undefined`,
|
|
27
|
+
* * `colno`: `Number | undefined`,
|
|
28
|
+
*/
|
|
29
|
+
readonly crashes: Array<{
|
|
30
|
+
message: string;
|
|
31
|
+
stack?: string;
|
|
32
|
+
date: number;
|
|
33
|
+
filename?: string;
|
|
34
|
+
lineno?: number;
|
|
35
|
+
colno?: number;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the state of the item watched by the watchdog. The state can be one of the following values:
|
|
39
|
+
*
|
|
40
|
+
* * `initializing` – Before the first initialization, and after crashes, before the item is ready.
|
|
41
|
+
* * `ready` – A state when the user can interact with the item.
|
|
42
|
+
* * `crashed` – A state when an error occurs. It quickly changes to `initializing` or `crashedPermanently`
|
|
43
|
+
* depending on how many and how frequent errors have been caught recently.
|
|
44
|
+
* * `crashedPermanently` – A state when the watchdog stops reacting to errors and keeps the item it is watching crashed,
|
|
45
|
+
* * `destroyed` – A state when the item is manually destroyed by the user after calling `watchdog.destroy()`.
|
|
46
|
+
*/
|
|
47
|
+
state: WatchdogState;
|
|
48
|
+
/**
|
|
49
|
+
* @see module:watchdog/watchdog~WatchdogConfig
|
|
50
|
+
*/
|
|
51
|
+
private _crashNumberLimit;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the result of the `Date.now()` call. It can be overridden in tests to mock time as some popular
|
|
54
|
+
* approaches like `sinon.useFakeTimers()` do not work well with error handling.
|
|
55
|
+
*/
|
|
56
|
+
private _now;
|
|
57
|
+
/**
|
|
58
|
+
* @see module:watchdog/watchdog~WatchdogConfig
|
|
59
|
+
*/
|
|
60
|
+
private _minimumNonErrorTimePeriod;
|
|
61
|
+
/**
|
|
62
|
+
* Checks if the event error comes from the underlying item and restarts the item.
|
|
63
|
+
*/
|
|
64
|
+
private _boundErrorHandler;
|
|
65
|
+
/**
|
|
66
|
+
* The method responsible for restarting the watched item.
|
|
67
|
+
*/
|
|
68
|
+
protected abstract _restart(): Promise<unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Traverses the error context and the watched item to find out whether the error should
|
|
71
|
+
* be handled by the given item.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
abstract _isErrorComingFromThisItem(error: CKEditorError): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The watched item.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
abstract get _item(): unknown;
|
|
82
|
+
/**
|
|
83
|
+
* A dictionary of event emitter listeners.
|
|
84
|
+
*/
|
|
85
|
+
private _listeners;
|
|
86
|
+
/**
|
|
87
|
+
* @param {module:watchdog/watchdog~WatchdogConfig} config The watchdog plugin configuration.
|
|
88
|
+
*/
|
|
89
|
+
constructor(config: WatchdogConfig);
|
|
90
|
+
/**
|
|
91
|
+
* Destroys the watchdog and releases the resources.
|
|
92
|
+
*/
|
|
93
|
+
destroy(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Starts listening to a specific event name by registering a callback that will be executed
|
|
96
|
+
* whenever an event with a given name fires.
|
|
97
|
+
*
|
|
98
|
+
* Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
|
|
99
|
+
*
|
|
100
|
+
* @param eventName The event name.
|
|
101
|
+
* @param callback A callback which will be added to event listeners.
|
|
102
|
+
*/
|
|
103
|
+
on<K extends keyof WatchdogEventMap>(eventName: K, callback: WatchdogEventCallback<K>): void;
|
|
104
|
+
/**
|
|
105
|
+
* Stops listening to the specified event name by removing the callback from event listeners.
|
|
106
|
+
*
|
|
107
|
+
* Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
|
|
108
|
+
*
|
|
109
|
+
* @param eventName The event name.
|
|
110
|
+
* @param callback A callback which will be removed from event listeners.
|
|
111
|
+
*/
|
|
112
|
+
off(eventName: keyof WatchdogEventMap, callback: unknown): void;
|
|
113
|
+
/**
|
|
114
|
+
* Fires an event with a given event name and arguments.
|
|
115
|
+
*
|
|
116
|
+
* Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
|
|
117
|
+
*/
|
|
118
|
+
protected _fire<K extends keyof WatchdogEventMap>(eventName: K, ...args: WatchdogEventArgs<K>): void;
|
|
119
|
+
/**
|
|
120
|
+
* Starts error handling by attaching global error handlers.
|
|
121
|
+
*/
|
|
122
|
+
protected _startErrorHandling(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Stops error handling by detaching global error handlers.
|
|
125
|
+
*/
|
|
126
|
+
protected _stopErrorHandling(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Checks if an error comes from the watched item and restarts it.
|
|
129
|
+
* It reacts to {@link module:utils/ckeditorerror~CKEditorError `CKEditorError` errors} only.
|
|
130
|
+
*
|
|
131
|
+
* @fires error
|
|
132
|
+
* @param error Error.
|
|
133
|
+
* @param evt An error event.
|
|
134
|
+
*/
|
|
135
|
+
private _handleError;
|
|
136
|
+
/**
|
|
137
|
+
* Checks whether an error should be handled by the watchdog.
|
|
138
|
+
*
|
|
139
|
+
* @param error An error that was caught by the error handling process.
|
|
140
|
+
*/
|
|
141
|
+
private _shouldReactToError;
|
|
142
|
+
/**
|
|
143
|
+
* Checks if the watchdog should restart the underlying item.
|
|
144
|
+
*/
|
|
145
|
+
private _shouldRestart;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
148
|
+
* Fired when a new {@link module:utils/ckeditorerror~CKEditorError `CKEditorError`} error connected to the watchdog instance occurs
|
|
149
|
+
* and the watchdog will react to it.
|
|
150
|
+
*
|
|
151
|
+
* ```ts
|
|
152
|
+
* watchdog.on( 'error', ( evt, { error, causesRestart } ) => {
|
|
153
|
+
* console.log( 'An error occurred.' );
|
|
154
|
+
* } );
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* @eventName ~Watchdog#error
|
|
158
|
+
*/
|
|
159
159
|
export type WatchdogErrorEvent = {
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
name: "error";
|
|
161
|
+
args: [WatchdogErrorEventData];
|
|
162
162
|
};
|
|
163
163
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
* The `error` event data.
|
|
165
|
+
*/
|
|
166
166
|
export type WatchdogErrorEventData = {
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
error: Error;
|
|
168
|
+
causesRestart: boolean;
|
|
169
169
|
};
|
|
170
170
|
/**
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
* Fired when the watchdog state changed.
|
|
172
|
+
*
|
|
173
|
+
* @eventName ~Watchdog#stateChange
|
|
174
|
+
*/
|
|
175
175
|
export type WatchdogStateChangeEvent = {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
name: "stateChange";
|
|
177
|
+
args: [];
|
|
178
178
|
};
|
|
179
179
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
* The map of watchdog events.
|
|
181
|
+
*/
|
|
182
182
|
export interface WatchdogEventMap {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
stateChange: WatchdogStateChangeEvent;
|
|
184
|
+
error: WatchdogErrorEvent;
|
|
185
|
+
restart: EditorWatchdogRestartEvent;
|
|
186
|
+
itemError: ContextWatchdogItemErrorEvent;
|
|
187
|
+
itemRestart: ContextWatchdogItemRestartEvent;
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
export type WatchdogEventArgs<K extends keyof WatchdogEventMap> = WatchdogEventMap[K][
|
|
190
|
+
* Utility type that gets the arguments type for the given event.
|
|
191
|
+
*/
|
|
192
|
+
export type WatchdogEventArgs<K extends keyof WatchdogEventMap> = WatchdogEventMap[K]["args"];
|
|
193
193
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
* Utility type that gets the callback type for the given event.
|
|
195
|
+
*/
|
|
196
196
|
export type WatchdogEventCallback<K extends keyof WatchdogEventMap> = (evt: null, ...args: WatchdogEventArgs<K>) => void;
|
|
197
197
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
* The watchdog plugin configuration.
|
|
199
|
+
*/
|
|
200
200
|
export interface WatchdogConfig {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
201
|
+
/**
|
|
202
|
+
* A threshold specifying the number of watched item crashes
|
|
203
|
+
* when the watchdog stops restarting the item in case of errors.
|
|
204
|
+
* After this limit is reached and the time between the last errors is shorter than `minimumNonErrorTimePeriod`,
|
|
205
|
+
* the watchdog changes its state to `crashedPermanently` and it stops restarting the item. This prevents an infinite restart loop.
|
|
206
|
+
*
|
|
207
|
+
* @default 3
|
|
208
|
+
*/
|
|
209
|
+
crashNumberLimit?: number;
|
|
210
|
+
/**
|
|
211
|
+
* An average number of milliseconds between the last watched item errors
|
|
212
|
+
* (defaults to 5000). When the period of time between errors is lower than that and the `crashNumberLimit` is also reached,
|
|
213
|
+
* the watchdog changes its state to `crashedPermanently` and it stops restarting the item. This prevents an infinite restart loop.
|
|
214
|
+
*
|
|
215
|
+
* @default 5000
|
|
216
|
+
*/
|
|
217
|
+
minimumNonErrorTimePeriod?: number;
|
|
218
|
+
/**
|
|
219
|
+
* A minimum number of milliseconds between saving the editor data internally (defaults to 5000).
|
|
220
|
+
* Note that for large documents this might impact the editor performance.
|
|
221
|
+
*
|
|
222
|
+
* @default 5000
|
|
223
|
+
*/
|
|
224
|
+
saveInterval?: number;
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
export type WatchdogState =
|
|
227
|
+
* Specifies the state of the item watched by the watchdog.
|
|
228
|
+
*/
|
|
229
|
+
export type WatchdogState = "initializing" | "ready" | "crashed" | "crashedPermanently" | "destroyed";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-watchdog",
|
|
3
|
-
"version": "48.
|
|
3
|
+
"version": "48.3.0-alpha.0",
|
|
4
4
|
"description": "A watchdog feature for CKEditor 5 editors. It keeps a CKEditor 5 editor instance running.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ckeditor/ckeditor5-core": "48.
|
|
29
|
-
"@ckeditor/ckeditor5-engine": "48.
|
|
30
|
-
"@ckeditor/ckeditor5-utils": "48.
|
|
28
|
+
"@ckeditor/ckeditor5-core": "48.3.0-alpha.0",
|
|
29
|
+
"@ckeditor/ckeditor5-engine": "48.3.0-alpha.0",
|
|
30
|
+
"@ckeditor/ckeditor5-utils": "48.3.0-alpha.0",
|
|
31
31
|
"es-toolkit": "1.45.1"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
package/dist/index.css.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.css"],"names":[],"mappings":";;;;;;AAEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index.css.map","sourcesContent":["\n\n/*# sourceMappingURL=index.css.map */"]}
|