@xylabs/forget 4.13.4 → 4.13.6
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/neutral/neutral/index.d.ts +33 -35
- package/dist/node/node/index.d.ts +44 -46
- package/package.json +7 -7
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
static
|
|
19
|
-
static
|
|
20
|
-
static
|
|
21
|
-
static
|
|
22
|
-
static
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
static
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export { }
|
|
1
|
+
import { Promisable, PromiseEx } from '@xylabs/promise';
|
|
2
|
+
import { Logger } from '@xylabs/logger';
|
|
3
|
+
|
|
4
|
+
interface ForgetConfig<T = any> {
|
|
5
|
+
name?: string;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
onComplete?: (result: [T | undefined, Error | undefined]) => void;
|
|
8
|
+
onException?: (error: Error) => void;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
11
|
+
declare const defaultForgetConfig: ForgetConfig<unknown>;
|
|
12
|
+
|
|
13
|
+
declare const forget: <T>(promise: Promisable<T>, config?: ForgetConfig<T>) => void;
|
|
14
|
+
|
|
15
|
+
type PromisableFunction<T> = () => Promisable<T>;
|
|
16
|
+
declare class ForgetPromise {
|
|
17
|
+
static activeForgets: number;
|
|
18
|
+
static exceptedForgets: number;
|
|
19
|
+
static logger: Logger;
|
|
20
|
+
static get active(): boolean;
|
|
21
|
+
static awaitInactive(interval?: number, timeout?: number): Promise<number>;
|
|
22
|
+
static exceptionHandler(error: Error, { name }: ForgetConfig, externalStackTrace?: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
25
|
+
* @param promise The promise to forget
|
|
26
|
+
* @param config Configuration of forget settings
|
|
27
|
+
*/
|
|
28
|
+
static forget<T>(promise: Promise<T> | PromiseEx<T> | PromisableFunction<T> | T, config?: ForgetConfig<T>): void;
|
|
29
|
+
static timeoutHandler(time: number, { name }: ForgetConfig, externalStackTrace?: string): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { ForgetPromise, defaultForgetConfig, forget };
|
|
33
|
+
export type { ForgetConfig };
|
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
static
|
|
24
|
-
static
|
|
25
|
-
static
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
static
|
|
34
|
-
static
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
static
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export { }
|
|
1
|
+
import { Promisable, PromiseEx } from '@xylabs/promise';
|
|
2
|
+
import { Logger } from '@xylabs/logger';
|
|
3
|
+
|
|
4
|
+
interface ForgetConfig<T = any> {
|
|
5
|
+
name?: string;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
onComplete?: (result: [T | undefined, Error | undefined]) => void;
|
|
8
|
+
onException?: (error: Error) => void;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ForgetNodeConfig<T = any> extends ForgetConfig<T> {
|
|
13
|
+
terminateOnException?: boolean;
|
|
14
|
+
terminateOnTimeout?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const defaultForgetNodeConfig: ForgetNodeConfig<unknown>;
|
|
17
|
+
|
|
18
|
+
declare const forgetNode: <T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) => void;
|
|
19
|
+
|
|
20
|
+
type PromisableFunction<T> = () => Promisable<T>;
|
|
21
|
+
declare class ForgetPromise {
|
|
22
|
+
static activeForgets: number;
|
|
23
|
+
static exceptedForgets: number;
|
|
24
|
+
static logger: Logger;
|
|
25
|
+
static get active(): boolean;
|
|
26
|
+
static awaitInactive(interval?: number, timeout?: number): Promise<number>;
|
|
27
|
+
static exceptionHandler(error: Error, { name }: ForgetConfig, externalStackTrace?: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
30
|
+
* @param promise The promise to forget
|
|
31
|
+
* @param config Configuration of forget settings
|
|
32
|
+
*/
|
|
33
|
+
static forget<T>(promise: Promise<T> | PromiseEx<T> | PromisableFunction<T> | T, config?: ForgetConfig<T>): void;
|
|
34
|
+
static timeoutHandler(time: number, { name }: ForgetConfig, externalStackTrace?: string): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare class ForgetPromiseNode extends ForgetPromise {
|
|
38
|
+
static exceptionHandler(error: Error, config: ForgetNodeConfig, externalStackTrace?: string): void;
|
|
39
|
+
static forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>): void;
|
|
40
|
+
static timeoutHandler(time: number, config: ForgetNodeConfig, externalStackTrace?: string): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { ForgetPromiseNode as ForgetPromise, defaultForgetNodeConfig, forgetNode as forget };
|
|
44
|
+
export type { ForgetNodeConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/forget",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.6",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"forget",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"module": "./dist/node/index.mjs",
|
|
41
41
|
"types": "./dist/node/node/index.d.ts",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@xylabs/delay": "^4.13.
|
|
44
|
-
"@xylabs/logger": "^4.13.
|
|
45
|
-
"@xylabs/promise": "^4.13.
|
|
46
|
-
"@xylabs/typeof": "^4.13.
|
|
43
|
+
"@xylabs/delay": "^4.13.6",
|
|
44
|
+
"@xylabs/logger": "^4.13.6",
|
|
45
|
+
"@xylabs/promise": "^4.13.6",
|
|
46
|
+
"@xylabs/typeof": "^4.13.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.
|
|
50
|
-
"@xylabs/tsconfig-dom": "^7.0.0-rc.
|
|
49
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.8",
|
|
50
|
+
"@xylabs/tsconfig-dom": "^7.0.0-rc.8",
|
|
51
51
|
"typescript": "^5.8.3",
|
|
52
52
|
"vitest": "^3.2.4"
|
|
53
53
|
},
|