@xylabs/forget 5.0.84 → 5.0.86

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 (2) hide show
  1. package/README.md +68 -239
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -15,6 +15,8 @@
15
15
 
16
16
  Base functionality used throughout XY Labs TypeScript/JavaScript libraries
17
17
 
18
+
19
+
18
20
  ## Reference
19
21
 
20
22
  **@xylabs/forget**
@@ -23,19 +25,27 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
23
25
 
24
26
  ## Classes
25
27
 
26
- - [ForgetPromise](#classes/ForgetPromise)
28
+ | Class | Description |
29
+ | ------ | ------ |
30
+ | [ForgetPromise](#classes/ForgetPromise) | Node.js extension of ForgetPromise that can terminate the process on exceptions or timeouts. |
27
31
 
28
32
  ## Interfaces
29
33
 
30
- - [ForgetNodeConfig](#interfaces/ForgetNodeConfig)
34
+ | Interface | Description |
35
+ | ------ | ------ |
36
+ | [ForgetNodeConfig](#interfaces/ForgetNodeConfig) | Node.js-specific forget configuration that extends ForgetConfig with process termination options. |
31
37
 
32
38
  ## Variables
33
39
 
34
- - [defaultForgetNodeConfig](#variables/defaultForgetNodeConfig)
40
+ | Variable | Description |
41
+ | ------ | ------ |
42
+ | [defaultForgetNodeConfig](#variables/defaultForgetNodeConfig) | Default Node.js forget configuration with termination disabled. |
35
43
 
36
44
  ## Functions
37
45
 
38
- - [forget](#functions/forget)
46
+ | Function | Description |
47
+ | ------ | ------ |
48
+ | [forget](#functions/forget) | Node.js variant of forget that can optionally terminate the process on exceptions or timeouts. |
39
49
 
40
50
  ### classes
41
51
 
@@ -71,51 +81,11 @@ ForgetPromise.constructor
71
81
 
72
82
  ## Properties
73
83
 
74
- ### activeForgets
75
-
76
- ```ts
77
- static activeForgets: number = 0;
78
- ```
79
-
80
- Number of currently active (unresolved) forgotten promises.
81
-
82
- ### Inherited from
83
-
84
- ```ts
85
- ForgetPromise.activeForgets
86
- ```
87
-
88
- ***
89
-
90
- ### exceptedForgets
91
-
92
- ```ts
93
- static exceptedForgets: number = 0;
94
- ```
95
-
96
- Number of forgotten promises that threw exceptions.
97
-
98
- ### Inherited from
99
-
100
- ```ts
101
- ForgetPromise.exceptedForgets
102
- ```
103
-
104
- ***
105
-
106
- ### logger
107
-
108
- ```ts
109
- static logger: Logger = console;
110
- ```
111
-
112
- Logger instance used for error and warning output.
113
-
114
- ### Inherited from
115
-
116
- ```ts
117
- ForgetPromise.logger
118
- ```
84
+ | Property | Modifier | Type | Default value | Description | Inherited from |
85
+ | ------ | ------ | ------ | ------ | ------ | ------ |
86
+ | <a id="activeforgets"></a> `activeForgets` | `static` | `number` | `0` | Number of currently active (unresolved) forgotten promises. | `ForgetPromise.activeForgets` |
87
+ | <a id="exceptedforgets"></a> `exceptedForgets` | `static` | `number` | `0` | Number of forgotten promises that threw exceptions. | `ForgetPromise.exceptedForgets` |
88
+ | <a id="logger"></a> `logger` | `static` | `Logger` | `console` | Logger instance used for error and warning output. | `ForgetPromise.logger` |
119
89
 
120
90
  ## Accessors
121
91
 
@@ -144,24 +114,17 @@ ForgetPromise.active
144
114
  ### awaitInactive()
145
115
 
146
116
  ```ts
147
- static awaitInactive(interval?, timeout?): Promise<number>;
117
+ static awaitInactive(interval?: number, timeout?: number): Promise<number>;
148
118
  ```
149
119
 
150
120
  Waits until all forgotten promises have completed.
151
121
 
152
122
  ### Parameters
153
123
 
154
- #### interval?
155
-
156
- `number` = `100`
157
-
158
- Polling interval in milliseconds.
159
-
160
- #### timeout?
161
-
162
- `number`
163
-
164
- Optional maximum wait time in milliseconds.
124
+ | Parameter | Type | Default value | Description |
125
+ | ------ | ------ | ------ | ------ |
126
+ | `interval` | `number` | `100` | Polling interval in milliseconds. |
127
+ | `timeout?` | `number` | `undefined` | Optional maximum wait time in milliseconds. |
165
128
 
166
129
  ### Returns
167
130
 
@@ -181,26 +144,20 @@ ForgetPromise.awaitInactive
181
144
 
182
145
  ```ts
183
146
  static exceptionHandler(
184
- error,
185
- config,
186
- externalStackTrace?): void;
147
+ error: Error,
148
+ config: ForgetNodeConfig,
149
+ externalStackTrace?: string): void;
187
150
  ```
188
151
 
189
152
  Handles exceptions, optionally terminating the process based on config.
190
153
 
191
154
  ### Parameters
192
155
 
193
- #### error
194
-
195
- `Error`
196
-
197
- #### config
198
-
199
- [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig)
200
-
201
- #### externalStackTrace?
202
-
203
- `string`
156
+ | Parameter | Type |
157
+ | ------ | ------ |
158
+ | `error` | `Error` |
159
+ | `config` | [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig) |
160
+ | `externalStackTrace?` | `string` |
204
161
 
205
162
  ### Returns
206
163
 
@@ -217,26 +174,23 @@ ForgetPromise.exceptionHandler
217
174
  ### forget()
218
175
 
219
176
  ```ts
220
- static forget<T>(promise, config?): void;
177
+ static forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>): void;
221
178
  ```
222
179
 
223
180
  Forgets a promise using Node.js-specific configuration with process termination support.
224
181
 
225
182
  ### Type Parameters
226
183
 
227
- #### T
228
-
229
- `T`
184
+ | Type Parameter |
185
+ | ------ |
186
+ | `T` |
230
187
 
231
188
  ### Parameters
232
189
 
233
- #### promise
234
-
235
- `Promisable`\<`T`\>
236
-
237
- #### config?
238
-
239
- [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig)\<`T`\>
190
+ | Parameter | Type |
191
+ | ------ | ------ |
192
+ | `promise` | `Promisable`\<`T`\> |
193
+ | `config?` | [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig)\<`T`\> |
240
194
 
241
195
  ### Returns
242
196
 
@@ -254,26 +208,20 @@ ForgetPromise.forget
254
208
 
255
209
  ```ts
256
210
  static timeoutHandler(
257
- time,
258
- config,
259
- externalStackTrace?): void;
211
+ time: number,
212
+ config: ForgetNodeConfig,
213
+ externalStackTrace?: string): void;
260
214
  ```
261
215
 
262
216
  Handles timeouts, optionally terminating the process based on config.
263
217
 
264
218
  ### Parameters
265
219
 
266
- #### time
267
-
268
- `number`
269
-
270
- #### config
271
-
272
- [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig)
273
-
274
- #### externalStackTrace?
275
-
276
- `string`
220
+ | Parameter | Type |
221
+ | ------ | ------ |
222
+ | `time` | `number` |
223
+ | `config` | [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig) |
224
+ | `externalStackTrace?` | `string` |
277
225
 
278
226
  ### Returns
279
227
 
@@ -294,30 +242,23 @@ ForgetPromise.timeoutHandler
294
242
  ***
295
243
 
296
244
  ```ts
297
- function forget<T>(promise, config?): void;
245
+ function forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>): void;
298
246
  ```
299
247
 
300
248
  Node.js variant of forget that can optionally terminate the process on exceptions or timeouts.
301
249
 
302
250
  ## Type Parameters
303
251
 
304
- ### T
305
-
306
- `T`
252
+ | Type Parameter |
253
+ | ------ |
254
+ | `T` |
307
255
 
308
256
  ## Parameters
309
257
 
310
- ### promise
311
-
312
- `Promisable`\<`T`\>
313
-
314
- The promise or promisable value to forget.
315
-
316
- ### config?
317
-
318
- [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig)\<`T`\>
319
-
320
- Optional Node.js-specific configuration including process termination options.
258
+ | Parameter | Type | Description |
259
+ | ------ | ------ | ------ |
260
+ | `promise` | `Promisable`\<`T`\> | The promise or promisable value to forget. |
261
+ | `config?` | [`ForgetNodeConfig`](#../interfaces/ForgetNodeConfig)\<`T`\> | Optional Node.js-specific configuration including process termination options. |
321
262
 
322
263
  ## Returns
323
264
 
@@ -339,133 +280,21 @@ Node.js-specific forget configuration that extends ForgetConfig with process ter
339
280
 
340
281
  ## Type Parameters
341
282
 
342
- ### T
343
-
344
- `T` = `any`
283
+ | Type Parameter | Default type |
284
+ | ------ | ------ |
285
+ | `T` | `any` |
345
286
 
346
287
  ## Properties
347
288
 
348
- ### name?
349
-
350
- ```ts
351
- optional name: string;
352
- ```
353
-
354
- Optional name for identifying the forgotten promise in logs.
355
-
356
- ### Inherited from
357
-
358
- ```ts
359
- ForgetConfig.name
360
- ```
361
-
362
- ***
363
-
364
- ### onCancel()?
365
-
366
- ```ts
367
- optional onCancel: () => void;
368
- ```
369
-
370
- Called when the promise is cancelled due to timeout.
371
-
372
- ### Returns
373
-
374
- `void`
375
-
376
- ### Inherited from
377
-
378
- ```ts
379
- ForgetConfig.onCancel
380
- ```
381
-
382
- ***
383
-
384
- ### onComplete()?
385
-
386
- ```ts
387
- optional onComplete: (result) => void;
388
- ```
389
-
390
- Called when the promise completes, with a tuple of [result, error].
391
-
392
- ### Parameters
393
-
394
- #### result
395
-
396
- \[`T` \| `undefined`, `Error` \| `undefined`\]
397
-
398
- ### Returns
399
-
400
- `void`
401
-
402
- ### Inherited from
403
-
404
- ```ts
405
- ForgetConfig.onComplete
406
- ```
407
-
408
- ***
409
-
410
- ### onException()?
411
-
412
- ```ts
413
- optional onException: (error) => void;
414
- ```
415
-
416
- Called when an exception occurs outside the promise itself.
417
-
418
- ### Parameters
419
-
420
- #### error
421
-
422
- `Error`
423
-
424
- ### Returns
425
-
426
- `void`
427
-
428
- ### Inherited from
429
-
430
- ```ts
431
- ForgetConfig.onException
432
- ```
433
-
434
- ***
435
-
436
- ### timeout?
437
-
438
- ```ts
439
- optional timeout: number;
440
- ```
441
-
442
- Timeout in milliseconds after which the promise is considered timed out.
443
-
444
- ### Inherited from
445
-
446
- ```ts
447
- ForgetConfig.timeout
448
- ```
449
-
450
- ***
451
-
452
- ### terminateOnException?
453
-
454
- ```ts
455
- optional terminateOnException: boolean;
456
- ```
457
-
458
- Terminate the process on an exception that happens outside of the promise being forgotten.
459
-
460
- ***
461
-
462
- ### terminateOnTimeout?
463
-
464
- ```ts
465
- optional terminateOnTimeout: boolean;
466
- ```
467
-
468
- Terminate the process if the promise times out.
289
+ | Property | Type | Description | Inherited from |
290
+ | ------ | ------ | ------ | ------ |
291
+ | <a id="name"></a> `name?` | `string` | Optional name for identifying the forgotten promise in logs. | `ForgetConfig.name` |
292
+ | <a id="oncancel"></a> `onCancel?` | () => `void` | Called when the promise is cancelled due to timeout. | `ForgetConfig.onCancel` |
293
+ | <a id="oncomplete"></a> `onComplete?` | (`result`: \[`T` \| `undefined`, `Error` \| `undefined`\]) => `void` | Called when the promise completes, with a tuple of [result, error]. | `ForgetConfig.onComplete` |
294
+ | <a id="onexception"></a> `onException?` | (`error`: `Error`) => `void` | Called when an exception occurs outside the promise itself. | `ForgetConfig.onException` |
295
+ | <a id="timeout"></a> `timeout?` | `number` | Timeout in milliseconds after which the promise is considered timed out. | `ForgetConfig.timeout` |
296
+ | <a id="terminateonexception"></a> `terminateOnException?` | `boolean` | Terminate the process on an exception that happens outside of the promise being forgotten. | - |
297
+ | <a id="terminateontimeout"></a> `terminateOnTimeout?` | `boolean` | Terminate the process if the promise times out. | - |
469
298
 
470
299
  ### variables
471
300
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/forget",
3
- "version": "5.0.84",
3
+ "version": "5.0.86",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "forget",
@@ -46,15 +46,15 @@
46
46
  "!**/*.test.*"
47
47
  ],
48
48
  "dependencies": {
49
- "@xylabs/delay": "~5.0.84",
50
- "@xylabs/logger": "~5.0.84",
51
- "@xylabs/promise": "~5.0.84",
52
- "@xylabs/typeof": "~5.0.84"
49
+ "@xylabs/delay": "~5.0.86",
50
+ "@xylabs/logger": "~5.0.86",
51
+ "@xylabs/promise": "~5.0.86",
52
+ "@xylabs/typeof": "~5.0.86"
53
53
  },
54
54
  "devDependencies": {
55
- "@xylabs/ts-scripts-yarn3": "~7.4.13",
56
- "@xylabs/tsconfig": "~7.4.13",
57
- "@xylabs/tsconfig-dom": "~7.4.13",
55
+ "@xylabs/ts-scripts-yarn3": "~7.4.16",
56
+ "@xylabs/tsconfig": "~7.4.16",
57
+ "@xylabs/tsconfig-dom": "~7.4.16",
58
58
  "typescript": "~5.9.3",
59
59
  "vitest": "~4.0.18"
60
60
  },