@nsshunt/stsrunnerframework 2.0.4 → 2.0.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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@nsshunt/stsutils"), require("@nsshunt/stsobservability")) : typeof define === "function" && define.amd ? define([
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("detect-node"), require("@nsshunt/stsutils"), require("@nsshunt/stsobservability")) : typeof define === "function" && define.amd ? define([
|
|
3
3
|
"exports",
|
|
4
|
+
"detect-node",
|
|
4
5
|
"@nsshunt/stsutils",
|
|
5
6
|
"@nsshunt/stsobservability"
|
|
6
|
-
], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nsshunt/stsrunnerframework"] = {}, global._nsshunt_stsutils, global._nsshunt_stsobservability));
|
|
7
|
-
})(this, function(exports, _nsshunt_stsutils, _nsshunt_stsobservability) {
|
|
7
|
+
], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nsshunt/stsrunnerframework"] = {}, global.detect_node, global._nsshunt_stsutils, global._nsshunt_stsobservability));
|
|
8
|
+
})(this, function(exports, detect_node, _nsshunt_stsutils, _nsshunt_stsobservability) {
|
|
8
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
10
|
//#region \0rolldown/runtime.js
|
|
10
11
|
var __create = Object.create;
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
enumerable: true
|
|
30
31
|
}) : target, mod));
|
|
31
32
|
//#endregion
|
|
33
|
+
detect_node = __toESM(detect_node);
|
|
32
34
|
//#region src/commonTypes.ts
|
|
33
35
|
/**
|
|
34
36
|
* Inter-Worker (IW) message commands.
|
|
@@ -95,11 +97,6 @@
|
|
|
95
97
|
ExecuteRefreshTokenResponse: "__ExecuteRefreshTokenResponse"
|
|
96
98
|
};
|
|
97
99
|
//#endregion
|
|
98
|
-
//#region node_modules/detect-node/browser.js
|
|
99
|
-
var require_browser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
100
|
-
module.exports = false;
|
|
101
|
-
}));
|
|
102
|
-
//#endregion
|
|
103
100
|
//#region node_modules/color-name/index.js
|
|
104
101
|
var require_color_name = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
105
102
|
module.exports = {
|
|
@@ -2003,8 +2000,8 @@
|
|
|
2003
2000
|
};
|
|
2004
2001
|
}));
|
|
2005
2002
|
//#endregion
|
|
2006
|
-
//#region
|
|
2007
|
-
var
|
|
2003
|
+
//#region src/abstractRunnerExecutionWorker.ts
|
|
2004
|
+
var import_source = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2008
2005
|
var ansiStyles = require_ansi_styles();
|
|
2009
2006
|
var { stdout: stdoutColor, stderr: stderrColor } = require_browser();
|
|
2010
2007
|
var { stringReplaceAll, stringEncaseCRLFWithFirstIndex } = require_util();
|
|
@@ -2148,11 +2145,7 @@
|
|
|
2148
2145
|
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
2149
2146
|
chalk.stderr.supportsColor = stderrColor;
|
|
2150
2147
|
module.exports = chalk;
|
|
2151
|
-
}));
|
|
2152
|
-
//#endregion
|
|
2153
|
-
//#region src/abstractRunnerExecutionWorker.ts
|
|
2154
|
-
var import_browser = /* @__PURE__ */ __toESM(require_browser$1());
|
|
2155
|
-
var import_source = /* @__PURE__ */ __toESM(require_source());
|
|
2148
|
+
})))());
|
|
2156
2149
|
import_source.default.level = 3;
|
|
2157
2150
|
/**
|
|
2158
2151
|
* Abstract worker-runtime base class.
|
|
@@ -2299,7 +2292,7 @@
|
|
|
2299
2292
|
this.#debug(import_source.default.grey(`WorkerInstance:#processLoopExecutor(): Removing runners from collection: [${removeList}]`));
|
|
2300
2293
|
for (let i = 0; i < removeList.length; i++) {
|
|
2301
2294
|
this.#runners[removeList[i]].archived = true;
|
|
2302
|
-
if (this.#archiveDeleteTimeout !== 0) if (
|
|
2295
|
+
if (this.#archiveDeleteTimeout !== 0) if (detect_node.default) setTimeout(() => delete this.#runners[removeList[i]], this.#archiveDeleteTimeout * 1e3).unref();
|
|
2303
2296
|
else setTimeout(() => delete this.#runners[removeList[i]], this.#archiveDeleteTimeout * 1e3);
|
|
2304
2297
|
}
|
|
2305
2298
|
const message = `WorkerInstance:#processLoopExecutor(): Remaining Runner Count: [${Object.keys(this.#runners).length}]`;
|
|
@@ -2372,7 +2365,7 @@
|
|
|
2372
2365
|
#SetMessagePort = (workerMessagePort) => {
|
|
2373
2366
|
try {
|
|
2374
2367
|
this.#collectorCollectorPort = workerMessagePort.port;
|
|
2375
|
-
if (
|
|
2368
|
+
if (detect_node.default) this.#collectorCollectorPort.on("message", (data) => {
|
|
2376
2369
|
this.#silly(`collectorCollectorPort on('message'): ${JSON.stringify(data)}`);
|
|
2377
2370
|
});
|
|
2378
2371
|
else this.#collectorCollectorPort.addEventListener("message", (data) => {
|
|
@@ -4890,7 +4883,7 @@
|
|
|
4890
4883
|
* @param cb Callback used to handle unsolicited inbound messages.
|
|
4891
4884
|
*/
|
|
4892
4885
|
SetupMessagePortListener = (stsWorkerEx, cb) => {
|
|
4893
|
-
if (
|
|
4886
|
+
if (detect_node.default) stsWorkerEx.messagePort.on("message", (data) => {
|
|
4894
4887
|
this._processInboundMessage(data, cb);
|
|
4895
4888
|
});
|
|
4896
4889
|
else stsWorkerEx.messagePort.addEventListener("message", (data) => {
|
|
@@ -5121,7 +5114,7 @@
|
|
|
5121
5114
|
*/
|
|
5122
5115
|
GetPorts = () => {
|
|
5123
5116
|
const { port1, port2 } = new MessageChannel();
|
|
5124
|
-
if (!
|
|
5117
|
+
if (!detect_node.default) port1.start();
|
|
5125
5118
|
return {
|
|
5126
5119
|
port1,
|
|
5127
5120
|
port2
|
|
@@ -5618,7 +5611,7 @@ ${runnerId}`,
|
|
|
5618
5611
|
* This is stored so the loop can be stopped later via {@link Terminate}.
|
|
5619
5612
|
*/
|
|
5620
5613
|
timeout;
|
|
5621
|
-
archiveDelTimeout;
|
|
5614
|
+
archiveDelTimeout = {};
|
|
5622
5615
|
/**
|
|
5623
5616
|
* Construct a new archive manager.
|
|
5624
5617
|
*
|
|
@@ -5736,17 +5729,21 @@ ${runnerId}`,
|
|
|
5736
5729
|
* This removes the runner from the active runtime graph after a delay.
|
|
5737
5730
|
*/
|
|
5738
5731
|
if (this.archiveDeleteTimeout !== 0) {
|
|
5739
|
-
|
|
5732
|
+
const delTimeoutId = v4();
|
|
5733
|
+
const delTimeout = setTimeout(() => {
|
|
5740
5734
|
try {
|
|
5741
5735
|
this.options.workerRegistry.DeleteRunner(workerEx.id, removeList[i].runnerId);
|
|
5742
5736
|
} catch (error) {
|
|
5743
5737
|
this.options.logger.error(`Error in: this.options.workerRegistry.DeleteRunner(${workerEx.id}, ${removeList[i].runnerId})`);
|
|
5744
5738
|
}
|
|
5739
|
+
delete this.archiveDelTimeout[delTimeoutId];
|
|
5745
5740
|
}, this.archiveDeleteTimeout * 1e3);
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5741
|
+
if (detect_node.default) delTimeout.unref();
|
|
5742
|
+
this.archiveDelTimeout[delTimeoutId] = {
|
|
5743
|
+
workerId: workerEx.id,
|
|
5744
|
+
runnerId: removeList[i].runnerId,
|
|
5745
|
+
delTimeout
|
|
5746
|
+
};
|
|
5750
5747
|
}
|
|
5751
5748
|
}
|
|
5752
5749
|
}
|
|
@@ -5762,15 +5759,15 @@ ${runnerId}`,
|
|
|
5762
5759
|
* Schedule the next archive scan.
|
|
5763
5760
|
*/
|
|
5764
5761
|
this.timeout = setTimeout(() => this.ProcessLoopExecutor(), 1e3);
|
|
5765
|
-
if (
|
|
5762
|
+
if (detect_node.default) this.timeout.unref();
|
|
5766
5763
|
}, 100);
|
|
5767
|
-
if (
|
|
5764
|
+
if (detect_node.default) startTimeout.unref();
|
|
5768
5765
|
} else {
|
|
5769
5766
|
/**
|
|
5770
5767
|
* No archive candidates found; just schedule the next scan.
|
|
5771
5768
|
*/
|
|
5772
5769
|
this.timeout = setTimeout(() => this.ProcessLoopExecutor(), 1e3);
|
|
5773
|
-
if (
|
|
5770
|
+
if (detect_node.default) this.timeout.unref();
|
|
5774
5771
|
}
|
|
5775
5772
|
} catch (error) {
|
|
5776
5773
|
this.options.logger.error(`_processLoopExecutor(): Error: [${error}]`);
|
|
@@ -5825,13 +5822,14 @@ ${runnerId}`,
|
|
|
5825
5822
|
*/
|
|
5826
5823
|
Terminate = () => {
|
|
5827
5824
|
this.options.logger.debug(`ArchiveManager:Terminate()`);
|
|
5825
|
+
this.options.logger.debug(`Runtime context: isNode = [${detect_node.default}]`);
|
|
5828
5826
|
if (this.timeout) {
|
|
5829
5827
|
this.options.logger.debug(`ArchiveManager:Terminate() - this.timeout cleared ...`);
|
|
5830
5828
|
clearTimeout(this.timeout);
|
|
5831
5829
|
}
|
|
5832
|
-
if (this.archiveDelTimeout) {
|
|
5833
|
-
this.options.logger.debug(`ArchiveManager:Terminate() - this.archiveDelTimeout cleared
|
|
5834
|
-
clearTimeout(
|
|
5830
|
+
if (this.archiveDelTimeout) for (const [delKey, delTimeoutRecord] of Object.entries(this.archiveDelTimeout)) {
|
|
5831
|
+
this.options.logger.debug(`ArchiveManager:Terminate() - this.archiveDelTimeout: [${delKey}] cleared for workerId: [${delTimeoutRecord.workerId}] runnerId: [${delTimeoutRecord.runnerId}]`);
|
|
5832
|
+
clearTimeout(delTimeoutRecord.delTimeout);
|
|
5835
5833
|
}
|
|
5836
5834
|
};
|
|
5837
5835
|
};
|
|
@@ -6400,7 +6398,7 @@ ${runnerId}`,
|
|
|
6400
6398
|
* @param stsWorkerEx Manager-side worker instance whose underlying actual worker should be monitored.
|
|
6401
6399
|
*/
|
|
6402
6400
|
SetupWorkerSystemEvents = (stsWorkerEx) => {
|
|
6403
|
-
if (
|
|
6401
|
+
if (detect_node.default) {
|
|
6404
6402
|
/**
|
|
6405
6403
|
* Node.js worker thread exit event.
|
|
6406
6404
|
*
|