@xylabs/forget 4.11.2 → 4.11.4
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/index.mjs +14 -14
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/index-node.mjs +41 -35
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/types/ForgetPromise.d.ts +9 -9
- package/dist/types/ForgetPromise.d.ts.map +1 -1
- package/dist/types/ForgetPromiseNode.d.ts +7 -14
- package/dist/types/ForgetPromiseNode.d.ts.map +1 -1
- package/dist/types/forgetNode.d.ts +2 -2
- package/dist/types/forgetNode.d.ts.map +1 -1
- package/dist/types/index-node.d.ts +1 -1
- package/dist/types/index-node.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/ForgetNodeConfig.ts +2 -2
- package/src/ForgetPromise.ts +19 -18
- package/src/ForgetPromiseNode.ts +28 -21
- package/src/forgetNode.ts +2 -2
- package/src/index-node.ts +1 -1
package/dist/neutral/index.mjs
CHANGED
|
@@ -7,19 +7,13 @@ import { isNumber } from "@xylabs/typeof";
|
|
|
7
7
|
var defaultForgetConfig = { timeout: 3e4 };
|
|
8
8
|
|
|
9
9
|
// src/ForgetPromise.ts
|
|
10
|
-
var ForgetPromise = {
|
|
11
|
-
|
|
10
|
+
var ForgetPromise = class {
|
|
11
|
+
static activeForgets = 0;
|
|
12
|
+
static exceptedForgets = 0;
|
|
13
|
+
static get active() {
|
|
12
14
|
return this.activeForgets > 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
exceptedForgets: 0,
|
|
16
|
-
exceptionHandler: (error, _config) => {
|
|
17
|
-
console.error(`forget promise handler excepted: ${error.message}`, error);
|
|
18
|
-
},
|
|
19
|
-
timeoutHandler: (time, _config) => {
|
|
20
|
-
console.error(`forget promise timeout out after ${time}ms [Cancelling]`);
|
|
21
|
-
},
|
|
22
|
-
async awaitInactive(interval = 100, timeout) {
|
|
15
|
+
}
|
|
16
|
+
static async awaitInactive(interval = 100, timeout) {
|
|
23
17
|
let timeoutRemaining = timeout;
|
|
24
18
|
while (this.active) {
|
|
25
19
|
await delay(interval);
|
|
@@ -31,13 +25,16 @@ var ForgetPromise = {
|
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
27
|
return 0;
|
|
34
|
-
}
|
|
28
|
+
}
|
|
29
|
+
static exceptionHandler(error, _config) {
|
|
30
|
+
console.error(`forget promise handler excepted: ${error.message}`, error);
|
|
31
|
+
}
|
|
35
32
|
/**
|
|
36
33
|
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
37
34
|
* @param promise The promise to forget
|
|
38
35
|
* @param config Configuration of forget settings
|
|
39
36
|
*/
|
|
40
|
-
forget(promise, config) {
|
|
37
|
+
static forget(promise, config) {
|
|
41
38
|
const resolvedConfig = {
|
|
42
39
|
...defaultForgetConfig,
|
|
43
40
|
...globalThis.xy?.forget?.config,
|
|
@@ -85,6 +82,9 @@ var ForgetPromise = {
|
|
|
85
82
|
return promise();
|
|
86
83
|
}
|
|
87
84
|
}
|
|
85
|
+
static timeoutHandler(time, _config) {
|
|
86
|
+
console.error(`forget promise timeout out after ${time}ms [Cancelling]`);
|
|
87
|
+
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// src/forget.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ForgetPromise.ts","../../src/ForgetConfig.ts","../../src/forget.ts"],"sourcesContent":["import { delay } from '@xylabs/delay'\nimport { isPromise, type Promisable } from '@xylabs/promise'\nimport { isNumber } from '@xylabs/typeof'\n\nimport { defaultForgetConfig, type ForgetConfig } from './ForgetConfig.ts'\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../src/ForgetPromise.ts","../../src/ForgetConfig.ts","../../src/forget.ts"],"sourcesContent":["import { delay } from '@xylabs/delay'\nimport { isPromise, type Promisable } from '@xylabs/promise'\nimport { isNumber } from '@xylabs/typeof'\n\nimport { defaultForgetConfig, type ForgetConfig } from './ForgetConfig.ts'\n\n// eslint-disable-next-line unicorn/no-static-only-class\nexport class ForgetPromise {\n static activeForgets = 0\n static exceptedForgets = 0\n\n static get active() {\n return this.activeForgets > 0\n }\n\n static async awaitInactive(interval = 100, timeout?: number) {\n let timeoutRemaining = timeout\n while (this.active) {\n await delay(interval)\n if (timeoutRemaining !== undefined) {\n timeoutRemaining -= interval\n if (timeoutRemaining <= 0) {\n return this.activeForgets\n }\n }\n }\n return 0\n }\n\n static exceptionHandler(error: Error, _config: ForgetConfig) {\n console.error(`forget promise handler excepted: ${error.message}`, error)\n }\n\n /**\n * Used to explicitly launch an async function (or Promise) with awaiting it\n * @param promise The promise to forget\n * @param config Configuration of forget settings\n */\n static forget<T>(promise: Promisable<T>, config?: ForgetConfig<T>) {\n // default | global | provided priorities for config (not deep merge)\n const resolvedConfig = {\n ...defaultForgetConfig, ...globalThis.xy?.forget?.config, ...config,\n }\n if (isPromise(promise)) {\n try {\n let completed = false\n this.activeForgets++\n\n const promiseWrapper = async () => {\n await promise\n .then((result: T) => {\n this.activeForgets--\n completed = true\n resolvedConfig?.onComplete?.([result, undefined])\n })\n .catch((error) => {\n this.activeForgets--\n completed = true\n resolvedConfig?.onComplete?.([undefined, error])\n })\n }\n\n const promises = [promiseWrapper()]\n\n // if there is a timeout, add it to the race\n const timeout = resolvedConfig.timeout ?? defaultForgetConfig.timeout\n if (isNumber(timeout)) {\n const timeoutFunc = async () => {\n await delay(timeout)\n if (!completed) {\n resolvedConfig.onCancel?.()\n this.timeoutHandler(timeout, resolvedConfig)\n }\n }\n promises.push(timeoutFunc())\n }\n\n const all = Promise.race(promises)\n\n all\n .then(() => {\n return\n })\n .catch(() => {\n return\n })\n } catch (ex) {\n this.exceptedForgets += 1\n resolvedConfig?.onException?.(ex as Error)\n this.exceptionHandler(ex as Error, resolvedConfig)\n }\n } else {\n return (promise as () => void)()\n }\n }\n\n static timeoutHandler(time: number, _config: ForgetConfig) {\n console.error(`forget promise timeout out after ${time}ms [Cancelling]`)\n }\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ForgetConfig<T = any> {\n onCancel?: () => void\n onComplete?: (result: [T | undefined, Error | undefined]) => void\n onException?: (error: Error) => void\n timeout?: number\n}\n\nexport const defaultForgetConfig: ForgetConfig<unknown> = { timeout: 30_000 }\n","import { type Promisable } from '@xylabs/promise'\n\nimport type { ForgetConfig } from './ForgetConfig.ts'\nimport { ForgetPromise } from './ForgetPromise.ts'\n\n// used to explicitly launch an async function (or Promise) with awaiting it\nexport const forget = <T>(promise: Promisable<T>, config?: ForgetConfig<T>) => {\n ForgetPromise.forget<T>(promise, config)\n}\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,iBAAkC;AAC3C,SAAS,gBAAgB;;;ACMlB,IAAM,sBAA6C,EAAE,SAAS,IAAO;;;ADDrE,IAAM,gBAAN,MAAoB;AAAA,EACzB,OAAO,gBAAgB;AAAA,EACvB,OAAO,kBAAkB;AAAA,EAEzB,WAAW,SAAS;AAClB,WAAO,KAAK,gBAAgB;AAAA,EAC9B;AAAA,EAEA,aAAa,cAAc,WAAW,KAAK,SAAkB;AAC3D,QAAI,mBAAmB;AACvB,WAAO,KAAK,QAAQ;AAClB,YAAM,MAAM,QAAQ;AACpB,UAAI,qBAAqB,QAAW;AAClC,4BAAoB;AACpB,YAAI,oBAAoB,GAAG;AACzB,iBAAO,KAAK;AAAA,QACd;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,OAAO,iBAAiB,OAAc,SAAuB;AAC3D,YAAQ,MAAM,oCAAoC,MAAM,OAAO,IAAI,KAAK;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,OAAU,SAAwB,QAA0B;AAEjE,UAAM,iBAAiB;AAAA,MACrB,GAAG;AAAA,MAAqB,GAAG,WAAW,IAAI,QAAQ;AAAA,MAAQ,GAAG;AAAA,IAC/D;AACA,QAAI,UAAU,OAAO,GAAG;AACtB,UAAI;AACF,YAAI,YAAY;AAChB,aAAK;AAEL,cAAM,iBAAiB,YAAY;AACjC,gBAAM,QACH,KAAK,CAAC,WAAc;AACnB,iBAAK;AACL,wBAAY;AACZ,4BAAgB,aAAa,CAAC,QAAQ,MAAS,CAAC;AAAA,UAClD,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,iBAAK;AACL,wBAAY;AACZ,4BAAgB,aAAa,CAAC,QAAW,KAAK,CAAC;AAAA,UACjD,CAAC;AAAA,QACL;AAEA,cAAM,WAAW,CAAC,eAAe,CAAC;AAGlC,cAAM,UAAU,eAAe,WAAW,oBAAoB;AAC9D,YAAI,SAAS,OAAO,GAAG;AACrB,gBAAM,cAAc,YAAY;AAC9B,kBAAM,MAAM,OAAO;AACnB,gBAAI,CAAC,WAAW;AACd,6BAAe,WAAW;AAC1B,mBAAK,eAAe,SAAS,cAAc;AAAA,YAC7C;AAAA,UACF;AACA,mBAAS,KAAK,YAAY,CAAC;AAAA,QAC7B;AAEA,cAAM,MAAM,QAAQ,KAAK,QAAQ;AAEjC,YACG,KAAK,MAAM;AACV;AAAA,QACF,CAAC,EACA,MAAM,MAAM;AACX;AAAA,QACF,CAAC;AAAA,MACL,SAAS,IAAI;AACX,aAAK,mBAAmB;AACxB,wBAAgB,cAAc,EAAW;AACzC,aAAK,iBAAiB,IAAa,cAAc;AAAA,MACnD;AAAA,IACF,OAAO;AACL,aAAQ,QAAuB;AAAA,IACjC;AAAA,EACF;AAAA,EAEA,OAAO,eAAe,MAAc,SAAuB;AACzD,YAAQ,MAAM,oCAAoC,IAAI,iBAAiB;AAAA,EACzE;AACF;;;AE7FO,IAAM,SAAS,CAAI,SAAwB,WAA6B;AAC7E,gBAAc,OAAU,SAAS,MAAM;AACzC;","names":[]}
|
package/dist/node/index-node.mjs
CHANGED
|
@@ -4,27 +4,21 @@ var defaultForgetConfig = { timeout: 3e4 };
|
|
|
4
4
|
// src/ForgetNodeConfig.ts
|
|
5
5
|
var defaultForgetNodeConfig = {
|
|
6
6
|
...defaultForgetConfig,
|
|
7
|
-
terminateOnTimeout:
|
|
8
|
-
terminateOnException:
|
|
7
|
+
terminateOnTimeout: false,
|
|
8
|
+
terminateOnException: false
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// src/ForgetPromise.ts
|
|
12
12
|
import { delay } from "@xylabs/delay";
|
|
13
13
|
import { isPromise } from "@xylabs/promise";
|
|
14
14
|
import { isNumber } from "@xylabs/typeof";
|
|
15
|
-
var ForgetPromise = {
|
|
16
|
-
|
|
15
|
+
var ForgetPromise = class {
|
|
16
|
+
static activeForgets = 0;
|
|
17
|
+
static exceptedForgets = 0;
|
|
18
|
+
static get active() {
|
|
17
19
|
return this.activeForgets > 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exceptedForgets: 0,
|
|
21
|
-
exceptionHandler: (error, _config) => {
|
|
22
|
-
console.error(`forget promise handler excepted: ${error.message}`, error);
|
|
23
|
-
},
|
|
24
|
-
timeoutHandler: (time, _config) => {
|
|
25
|
-
console.error(`forget promise timeout out after ${time}ms [Cancelling]`);
|
|
26
|
-
},
|
|
27
|
-
async awaitInactive(interval = 100, timeout) {
|
|
20
|
+
}
|
|
21
|
+
static async awaitInactive(interval = 100, timeout) {
|
|
28
22
|
let timeoutRemaining = timeout;
|
|
29
23
|
while (this.active) {
|
|
30
24
|
await delay(interval);
|
|
@@ -36,13 +30,16 @@ var ForgetPromise = {
|
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
32
|
return 0;
|
|
39
|
-
}
|
|
33
|
+
}
|
|
34
|
+
static exceptionHandler(error, _config) {
|
|
35
|
+
console.error(`forget promise handler excepted: ${error.message}`, error);
|
|
36
|
+
}
|
|
40
37
|
/**
|
|
41
38
|
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
42
39
|
* @param promise The promise to forget
|
|
43
40
|
* @param config Configuration of forget settings
|
|
44
41
|
*/
|
|
45
|
-
forget(promise, config) {
|
|
42
|
+
static forget(promise, config) {
|
|
46
43
|
const resolvedConfig = {
|
|
47
44
|
...defaultForgetConfig,
|
|
48
45
|
...globalThis.xy?.forget?.config,
|
|
@@ -90,35 +87,44 @@ var ForgetPromise = {
|
|
|
90
87
|
return promise();
|
|
91
88
|
}
|
|
92
89
|
}
|
|
90
|
+
static timeoutHandler(time, _config) {
|
|
91
|
+
console.error(`forget promise timeout out after ${time}ms [Cancelling]`);
|
|
92
|
+
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
// src/ForgetPromiseNode.ts
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
var getStackTrace = () => {
|
|
97
|
+
try {
|
|
98
|
+
throw new Error("Getting stack trace");
|
|
99
|
+
} catch (ex) {
|
|
100
|
+
const error = ex;
|
|
101
|
+
return error.stack;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var ForgetPromiseNode = class extends ForgetPromise {
|
|
105
|
+
static exceptionHandler(error, config) {
|
|
106
|
+
super.exceptionHandler(error, config);
|
|
107
|
+
console.warn(getStackTrace());
|
|
100
108
|
if (config?.terminateOnException === true) {
|
|
109
|
+
console.log("Attempting to terminate process...");
|
|
101
110
|
process.exit(1);
|
|
102
111
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
ForgetPromise.timeoutHandler(time, config);
|
|
106
|
-
if (config?.terminateOnTimeout === true) {
|
|
107
|
-
process.exit(2);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
/**
|
|
111
|
-
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
112
|
-
* @param promise The promise to forget
|
|
113
|
-
* @param config Configuration of forget settings
|
|
114
|
-
*/
|
|
115
|
-
forget(promise, config) {
|
|
112
|
+
}
|
|
113
|
+
static forget(promise, config) {
|
|
116
114
|
const resolvedConfig = {
|
|
117
115
|
...defaultForgetNodeConfig,
|
|
118
116
|
...globalThis.xy?.forget?.config,
|
|
119
117
|
...config
|
|
120
118
|
};
|
|
121
|
-
|
|
119
|
+
super.forget(promise, resolvedConfig);
|
|
120
|
+
}
|
|
121
|
+
static timeoutHandler(time, config) {
|
|
122
|
+
super.timeoutHandler(time, config);
|
|
123
|
+
console.warn(getStackTrace());
|
|
124
|
+
if (config?.terminateOnTimeout === true) {
|
|
125
|
+
console.log("Attempting to terminate process...");
|
|
126
|
+
process.exit(2);
|
|
127
|
+
}
|
|
122
128
|
}
|
|
123
129
|
};
|
|
124
130
|
|
|
@@ -128,7 +134,7 @@ var forgetNode = (promise, config) => {
|
|
|
128
134
|
};
|
|
129
135
|
export {
|
|
130
136
|
ForgetPromiseNode as ForgetPromise,
|
|
131
|
-
|
|
137
|
+
defaultForgetNodeConfig,
|
|
132
138
|
forgetNode as forget
|
|
133
139
|
};
|
|
134
140
|
//# sourceMappingURL=index-node.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ForgetConfig.ts","../../src/ForgetNodeConfig.ts","../../src/ForgetPromise.ts","../../src/ForgetPromiseNode.ts","../../src/forgetNode.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ForgetConfig<T = any> {\n onCancel?: () => void\n onComplete?: (result: [T | undefined, Error | undefined]) => void\n onException?: (error: Error) => void\n timeout?: number\n}\n\nexport const defaultForgetConfig: ForgetConfig<unknown> = { timeout: 30_000 }\n","import { defaultForgetConfig, type ForgetConfig } from './ForgetConfig.ts'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ForgetNodeConfig<T = any> extends ForgetConfig<T> {\n terminateOnException?: boolean // terminate the process on an exception that happens outside of the promise being forgotten\n terminateOnTimeout?: boolean // terminate the process if the promise times out\n}\n\nexport const defaultForgetNodeConfig: ForgetNodeConfig<unknown> = {\n ...defaultForgetConfig,\n terminateOnTimeout:
|
|
1
|
+
{"version":3,"sources":["../../src/ForgetConfig.ts","../../src/ForgetNodeConfig.ts","../../src/ForgetPromise.ts","../../src/ForgetPromiseNode.ts","../../src/forgetNode.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ForgetConfig<T = any> {\n onCancel?: () => void\n onComplete?: (result: [T | undefined, Error | undefined]) => void\n onException?: (error: Error) => void\n timeout?: number\n}\n\nexport const defaultForgetConfig: ForgetConfig<unknown> = { timeout: 30_000 }\n","import { defaultForgetConfig, type ForgetConfig } from './ForgetConfig.ts'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ForgetNodeConfig<T = any> extends ForgetConfig<T> {\n terminateOnException?: boolean // terminate the process on an exception that happens outside of the promise being forgotten\n terminateOnTimeout?: boolean // terminate the process if the promise times out\n}\n\nexport const defaultForgetNodeConfig: ForgetNodeConfig<unknown> = {\n ...defaultForgetConfig,\n terminateOnTimeout: false,\n terminateOnException: false,\n}\n","import { delay } from '@xylabs/delay'\nimport { isPromise, type Promisable } from '@xylabs/promise'\nimport { isNumber } from '@xylabs/typeof'\n\nimport { defaultForgetConfig, type ForgetConfig } from './ForgetConfig.ts'\n\n// eslint-disable-next-line unicorn/no-static-only-class\nexport class ForgetPromise {\n static activeForgets = 0\n static exceptedForgets = 0\n\n static get active() {\n return this.activeForgets > 0\n }\n\n static async awaitInactive(interval = 100, timeout?: number) {\n let timeoutRemaining = timeout\n while (this.active) {\n await delay(interval)\n if (timeoutRemaining !== undefined) {\n timeoutRemaining -= interval\n if (timeoutRemaining <= 0) {\n return this.activeForgets\n }\n }\n }\n return 0\n }\n\n static exceptionHandler(error: Error, _config: ForgetConfig) {\n console.error(`forget promise handler excepted: ${error.message}`, error)\n }\n\n /**\n * Used to explicitly launch an async function (or Promise) with awaiting it\n * @param promise The promise to forget\n * @param config Configuration of forget settings\n */\n static forget<T>(promise: Promisable<T>, config?: ForgetConfig<T>) {\n // default | global | provided priorities for config (not deep merge)\n const resolvedConfig = {\n ...defaultForgetConfig, ...globalThis.xy?.forget?.config, ...config,\n }\n if (isPromise(promise)) {\n try {\n let completed = false\n this.activeForgets++\n\n const promiseWrapper = async () => {\n await promise\n .then((result: T) => {\n this.activeForgets--\n completed = true\n resolvedConfig?.onComplete?.([result, undefined])\n })\n .catch((error) => {\n this.activeForgets--\n completed = true\n resolvedConfig?.onComplete?.([undefined, error])\n })\n }\n\n const promises = [promiseWrapper()]\n\n // if there is a timeout, add it to the race\n const timeout = resolvedConfig.timeout ?? defaultForgetConfig.timeout\n if (isNumber(timeout)) {\n const timeoutFunc = async () => {\n await delay(timeout)\n if (!completed) {\n resolvedConfig.onCancel?.()\n this.timeoutHandler(timeout, resolvedConfig)\n }\n }\n promises.push(timeoutFunc())\n }\n\n const all = Promise.race(promises)\n\n all\n .then(() => {\n return\n })\n .catch(() => {\n return\n })\n } catch (ex) {\n this.exceptedForgets += 1\n resolvedConfig?.onException?.(ex as Error)\n this.exceptionHandler(ex as Error, resolvedConfig)\n }\n } else {\n return (promise as () => void)()\n }\n }\n\n static timeoutHandler(time: number, _config: ForgetConfig) {\n console.error(`forget promise timeout out after ${time}ms [Cancelling]`)\n }\n}\n","/// <reference types=\"node\" />\n\nimport type { Promisable } from '@xylabs/promise'\n\nimport { defaultForgetNodeConfig, type ForgetNodeConfig } from './ForgetNodeConfig.ts'\nimport { ForgetPromise } from './ForgetPromise.ts'\n\nexport const getStackTrace = () => {\n try {\n throw new Error('Getting stack trace')\n } catch (ex) {\n const error = ex as Error\n return error.stack\n }\n}\n\nexport class ForgetPromiseNode extends ForgetPromise {\n static override exceptionHandler(error: Error, config: ForgetNodeConfig) {\n // default | global | provided priorities for config (not deep merge)\n super.exceptionHandler(error, config)\n console.warn(getStackTrace())\n if (config?.terminateOnException === true) {\n console.log('Attempting to terminate process...')\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1)\n }\n }\n\n static override forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) {\n const resolvedConfig = {\n ...defaultForgetNodeConfig, ...globalThis.xy?.forget?.config, ...config,\n }\n super.forget(promise, resolvedConfig)\n }\n\n static override timeoutHandler(time: number, config: ForgetNodeConfig) {\n super.timeoutHandler(time, config)\n console.warn(getStackTrace())\n if (config?.terminateOnTimeout === true) {\n console.log('Attempting to terminate process...')\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(2)\n }\n }\n}\n","import { type Promisable } from '@xylabs/promise'\n\nimport type { ForgetNodeConfig } from './ForgetNodeConfig.ts'\nimport { ForgetPromiseNode } from './ForgetPromiseNode.ts'\n\n// used to explicitly launch an async function (or Promise) with awaiting it\nexport const forgetNode = <T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) => {\n ForgetPromiseNode.forget<T>(promise, config)\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type Promisable } from '@xylabs/promise';
|
|
2
2
|
import { type ForgetConfig } from './ForgetConfig.ts';
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
awaitInactive(interval?: number, timeout?: number): Promise<number>;
|
|
3
|
+
export declare class ForgetPromise {
|
|
4
|
+
static activeForgets: number;
|
|
5
|
+
static exceptedForgets: number;
|
|
6
|
+
static get active(): boolean;
|
|
7
|
+
static awaitInactive(interval?: number, timeout?: number): Promise<number>;
|
|
8
|
+
static exceptionHandler(error: Error, _config: ForgetConfig): void;
|
|
10
9
|
/**
|
|
11
10
|
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
12
11
|
* @param promise The promise to forget
|
|
13
12
|
* @param config Configuration of forget settings
|
|
14
13
|
*/
|
|
15
|
-
forget<T>(promise: Promisable<T>, config?: ForgetConfig<T>): void;
|
|
16
|
-
|
|
14
|
+
static forget<T>(promise: Promisable<T>, config?: ForgetConfig<T>): void;
|
|
15
|
+
static timeoutHandler(time: number, _config: ForgetConfig): void;
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=ForgetPromise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgetPromise.d.ts","sourceRoot":"","sources":["../../src/ForgetPromise.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5D,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"ForgetPromise.d.ts","sourceRoot":"","sources":["../../src/ForgetPromise.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5D,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAG1E,qBAAa,aAAa;IACxB,MAAM,CAAC,aAAa,SAAI;IACxB,MAAM,CAAC,eAAe,SAAI;IAE1B,MAAM,KAAK,MAAM,YAEhB;WAEY,aAAa,CAAC,QAAQ,SAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAc3D,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY;IAI3D;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;IA0DjE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;CAG1D"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type { Promisable } from '@xylabs/promise';
|
|
2
2
|
import { type ForgetNodeConfig } from './ForgetNodeConfig.ts';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>): void;
|
|
12
|
-
active: boolean;
|
|
13
|
-
activeForgets: number;
|
|
14
|
-
exceptedForgets: number;
|
|
15
|
-
awaitInactive(interval?: number, timeout?: number): Promise<number>;
|
|
16
|
-
};
|
|
3
|
+
import { ForgetPromise } from './ForgetPromise.ts';
|
|
4
|
+
export declare const getStackTrace: () => string | undefined;
|
|
5
|
+
export declare class ForgetPromiseNode extends ForgetPromise {
|
|
6
|
+
static exceptionHandler(error: Error, config: ForgetNodeConfig): void;
|
|
7
|
+
static forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>): void;
|
|
8
|
+
static timeoutHandler(time: number, config: ForgetNodeConfig): void;
|
|
9
|
+
}
|
|
17
10
|
//# sourceMappingURL=ForgetPromiseNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgetPromiseNode.d.ts","sourceRoot":"","sources":["../../src/ForgetPromiseNode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"ForgetPromiseNode.d.ts","sourceRoot":"","sources":["../../src/ForgetPromiseNode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,eAAO,MAAM,aAAa,0BAOzB,CAAA;AAED,qBAAa,iBAAkB,SAAQ,aAAa;WAClC,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB;WAWvD,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC;WAO9D,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB;CAStE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Promisable } from '@xylabs/promise';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const forgetNode: <T>(promise: Promisable<T>, config?:
|
|
2
|
+
import type { ForgetNodeConfig } from './ForgetNodeConfig.ts';
|
|
3
|
+
export declare const forgetNode: <T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) => void;
|
|
4
4
|
//# sourceMappingURL=forgetNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgetNode.d.ts","sourceRoot":"","sources":["../../src/forgetNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"forgetNode.d.ts","sourceRoot":"","sources":["../../src/forgetNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,SAEjF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACtD,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAE,iBAAiB,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/forget",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.4",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"forget",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"default": "./dist/node/index-node.mjs"
|
|
34
34
|
},
|
|
35
35
|
"types": "./dist/types/index.d.ts",
|
|
36
|
-
"default": "./dist/
|
|
36
|
+
"default": "./dist/node/index-node.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./package.json": "./package.json"
|
|
39
39
|
},
|
|
40
|
-
"module": "./dist/
|
|
40
|
+
"module": "./dist/node/index-node.mjs",
|
|
41
41
|
"types": "./dist/types/index.d.ts",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@xylabs/delay": "^4.11.
|
|
44
|
-
"@xylabs/promise": "^4.11.
|
|
45
|
-
"@xylabs/typeof": "^4.11.
|
|
43
|
+
"@xylabs/delay": "^4.11.4",
|
|
44
|
+
"@xylabs/promise": "^4.11.4",
|
|
45
|
+
"@xylabs/typeof": "^4.11.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@xylabs/ts-scripts-yarn3": "^6.5.7",
|
package/src/ForgetNodeConfig.ts
CHANGED
|
@@ -8,6 +8,6 @@ export interface ForgetNodeConfig<T = any> extends ForgetConfig<T> {
|
|
|
8
8
|
|
|
9
9
|
export const defaultForgetNodeConfig: ForgetNodeConfig<unknown> = {
|
|
10
10
|
...defaultForgetConfig,
|
|
11
|
-
terminateOnTimeout:
|
|
12
|
-
terminateOnException:
|
|
11
|
+
terminateOnTimeout: false,
|
|
12
|
+
terminateOnException: false,
|
|
13
13
|
}
|
package/src/ForgetPromise.ts
CHANGED
|
@@ -4,23 +4,16 @@ import { isNumber } from '@xylabs/typeof'
|
|
|
4
4
|
|
|
5
5
|
import { defaultForgetConfig, type ForgetConfig } from './ForgetConfig.ts'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
activeForgets: 0,
|
|
13
|
-
exceptedForgets: 0,
|
|
7
|
+
// eslint-disable-next-line unicorn/no-static-only-class
|
|
8
|
+
export class ForgetPromise {
|
|
9
|
+
static activeForgets = 0
|
|
10
|
+
static exceptedForgets = 0
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
timeoutHandler: (time: number, _config: ForgetConfig) => {
|
|
20
|
-
console.error(`forget promise timeout out after ${time}ms [Cancelling]`)
|
|
21
|
-
},
|
|
12
|
+
static get active() {
|
|
13
|
+
return this.activeForgets > 0
|
|
14
|
+
}
|
|
22
15
|
|
|
23
|
-
async awaitInactive(interval = 100, timeout?: number) {
|
|
16
|
+
static async awaitInactive(interval = 100, timeout?: number) {
|
|
24
17
|
let timeoutRemaining = timeout
|
|
25
18
|
while (this.active) {
|
|
26
19
|
await delay(interval)
|
|
@@ -32,14 +25,18 @@ export const ForgetPromise = {
|
|
|
32
25
|
}
|
|
33
26
|
}
|
|
34
27
|
return 0
|
|
35
|
-
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static exceptionHandler(error: Error, _config: ForgetConfig) {
|
|
31
|
+
console.error(`forget promise handler excepted: ${error.message}`, error)
|
|
32
|
+
}
|
|
36
33
|
|
|
37
34
|
/**
|
|
38
35
|
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
39
36
|
* @param promise The promise to forget
|
|
40
37
|
* @param config Configuration of forget settings
|
|
41
38
|
*/
|
|
42
|
-
forget<T>(promise: Promisable<T>, config?: ForgetConfig<T>) {
|
|
39
|
+
static forget<T>(promise: Promisable<T>, config?: ForgetConfig<T>) {
|
|
43
40
|
// default | global | provided priorities for config (not deep merge)
|
|
44
41
|
const resolvedConfig = {
|
|
45
42
|
...defaultForgetConfig, ...globalThis.xy?.forget?.config, ...config,
|
|
@@ -95,5 +92,9 @@ export const ForgetPromise = {
|
|
|
95
92
|
} else {
|
|
96
93
|
return (promise as () => void)()
|
|
97
94
|
}
|
|
98
|
-
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static timeoutHandler(time: number, _config: ForgetConfig) {
|
|
98
|
+
console.error(`forget promise timeout out after ${time}ms [Cancelling]`)
|
|
99
|
+
}
|
|
99
100
|
}
|
package/src/ForgetPromiseNode.ts
CHANGED
|
@@ -5,34 +5,41 @@ import type { Promisable } from '@xylabs/promise'
|
|
|
5
5
|
import { defaultForgetNodeConfig, type ForgetNodeConfig } from './ForgetNodeConfig.ts'
|
|
6
6
|
import { ForgetPromise } from './ForgetPromise.ts'
|
|
7
7
|
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export const getStackTrace = () => {
|
|
9
|
+
try {
|
|
10
|
+
throw new Error('Getting stack trace')
|
|
11
|
+
} catch (ex) {
|
|
12
|
+
const error = ex as Error
|
|
13
|
+
return error.stack
|
|
14
|
+
}
|
|
15
|
+
}
|
|
13
16
|
|
|
17
|
+
export class ForgetPromiseNode extends ForgetPromise {
|
|
18
|
+
static override exceptionHandler(error: Error, config: ForgetNodeConfig) {
|
|
19
|
+
// default | global | provided priorities for config (not deep merge)
|
|
20
|
+
super.exceptionHandler(error, config)
|
|
21
|
+
console.warn(getStackTrace())
|
|
14
22
|
if (config?.terminateOnException === true) {
|
|
23
|
+
console.log('Attempting to terminate process...')
|
|
15
24
|
// eslint-disable-next-line unicorn/no-process-exit
|
|
16
25
|
process.exit(1)
|
|
17
26
|
}
|
|
18
|
-
}
|
|
19
|
-
timeoutHandler: (time: number, config: ForgetNodeConfig) => {
|
|
20
|
-
ForgetPromise.timeoutHandler(time, config)
|
|
21
|
-
if (config?.terminateOnTimeout === true) {
|
|
22
|
-
// eslint-disable-next-line unicorn/no-process-exit
|
|
23
|
-
process.exit(2)
|
|
24
|
-
}
|
|
25
|
-
},
|
|
27
|
+
}
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
29
|
-
* @param promise The promise to forget
|
|
30
|
-
* @param config Configuration of forget settings
|
|
31
|
-
*/
|
|
32
|
-
forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) {
|
|
29
|
+
static override forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) {
|
|
33
30
|
const resolvedConfig = {
|
|
34
31
|
...defaultForgetNodeConfig, ...globalThis.xy?.forget?.config, ...config,
|
|
35
32
|
}
|
|
36
|
-
|
|
37
|
-
}
|
|
33
|
+
super.forget(promise, resolvedConfig)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static override timeoutHandler(time: number, config: ForgetNodeConfig) {
|
|
37
|
+
super.timeoutHandler(time, config)
|
|
38
|
+
console.warn(getStackTrace())
|
|
39
|
+
if (config?.terminateOnTimeout === true) {
|
|
40
|
+
console.log('Attempting to terminate process...')
|
|
41
|
+
// eslint-disable-next-line unicorn/no-process-exit
|
|
42
|
+
process.exit(2)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
38
45
|
}
|
package/src/forgetNode.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Promisable } from '@xylabs/promise'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { ForgetNodeConfig } from './ForgetNodeConfig.ts'
|
|
4
4
|
import { ForgetPromiseNode } from './ForgetPromiseNode.ts'
|
|
5
5
|
|
|
6
6
|
// used to explicitly launch an async function (or Promise) with awaiting it
|
|
7
|
-
export const forgetNode = <T>(promise: Promisable<T>, config?:
|
|
7
|
+
export const forgetNode = <T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) => {
|
|
8
8
|
ForgetPromiseNode.forget<T>(promise, config)
|
|
9
9
|
}
|
package/src/index-node.ts
CHANGED