@nsshunt/stsrunnerframework 2.0.3 → 2.0.5

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,3 +1,4 @@
1
+ import isNode from "detect-node";
1
2
  import { ModelDelimeter, Sleep, defaultLogger } from "@nsshunt/stsutils";
2
3
  import { Gauge } from "@nsshunt/stsobservability";
3
4
  //#region \0rolldown/runtime.js
@@ -89,11 +90,6 @@ var PublishMessageCommandsTestRunner = {
89
90
  ExecuteRefreshTokenResponse: "__ExecuteRefreshTokenResponse"
90
91
  };
91
92
  //#endregion
92
- //#region node_modules/detect-node/browser.js
93
- var require_browser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
94
- module.exports = false;
95
- }));
96
- //#endregion
97
93
  //#region node_modules/color-name/index.js
98
94
  var require_color_name = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99
95
  module.exports = {
@@ -1997,8 +1993,8 @@ var require_templates = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1997
1993
  };
1998
1994
  }));
1999
1995
  //#endregion
2000
- //#region node_modules/chalk/source/index.js
2001
- var require_source = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1996
+ //#region src/abstractRunnerExecutionWorker.ts
1997
+ var import_source = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
2002
1998
  var ansiStyles = require_ansi_styles();
2003
1999
  var { stdout: stdoutColor, stderr: stderrColor } = require_browser();
2004
2000
  var { stringReplaceAll, stringEncaseCRLFWithFirstIndex } = require_util();
@@ -2142,11 +2138,7 @@ var require_source = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2142
2138
  chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
2143
2139
  chalk.stderr.supportsColor = stderrColor;
2144
2140
  module.exports = chalk;
2145
- }));
2146
- //#endregion
2147
- //#region src/abstractRunnerExecutionWorker.ts
2148
- var import_browser = /* @__PURE__ */ __toESM(require_browser$1());
2149
- var import_source = /* @__PURE__ */ __toESM(require_source());
2141
+ })))());
2150
2142
  import_source.default.level = 3;
2151
2143
  /**
2152
2144
  * Abstract worker-runtime base class.
@@ -2293,7 +2285,7 @@ var AbstractRunnerExecutionWorker = class {
2293
2285
  this.#debug(import_source.default.grey(`WorkerInstance:#processLoopExecutor(): Removing runners from collection: [${removeList}]`));
2294
2286
  for (let i = 0; i < removeList.length; i++) {
2295
2287
  this.#runners[removeList[i]].archived = true;
2296
- if (this.#archiveDeleteTimeout !== 0) if (import_browser.default) setTimeout(() => delete this.#runners[removeList[i]], this.#archiveDeleteTimeout * 1e3).unref();
2288
+ if (this.#archiveDeleteTimeout !== 0) if (isNode) setTimeout(() => delete this.#runners[removeList[i]], this.#archiveDeleteTimeout * 1e3).unref();
2297
2289
  else setTimeout(() => delete this.#runners[removeList[i]], this.#archiveDeleteTimeout * 1e3);
2298
2290
  }
2299
2291
  const message = `WorkerInstance:#processLoopExecutor(): Remaining Runner Count: [${Object.keys(this.#runners).length}]`;
@@ -2366,7 +2358,7 @@ var AbstractRunnerExecutionWorker = class {
2366
2358
  #SetMessagePort = (workerMessagePort) => {
2367
2359
  try {
2368
2360
  this.#collectorCollectorPort = workerMessagePort.port;
2369
- if (import_browser.default) this.#collectorCollectorPort.on("message", (data) => {
2361
+ if (isNode) this.#collectorCollectorPort.on("message", (data) => {
2370
2362
  this.#silly(`collectorCollectorPort on('message'): ${JSON.stringify(data)}`);
2371
2363
  });
2372
2364
  else this.#collectorCollectorPort.addEventListener("message", (data) => {
@@ -4884,7 +4876,7 @@ var STSMessageBroker = class {
4884
4876
  * @param cb Callback used to handle unsolicited inbound messages.
4885
4877
  */
4886
4878
  SetupMessagePortListener = (stsWorkerEx, cb) => {
4887
- if (import_browser.default) stsWorkerEx.messagePort.on("message", (data) => {
4879
+ if (isNode) stsWorkerEx.messagePort.on("message", (data) => {
4888
4880
  this._processInboundMessage(data, cb);
4889
4881
  });
4890
4882
  else stsWorkerEx.messagePort.addEventListener("message", (data) => {
@@ -5115,7 +5107,7 @@ var STSMessageBroker = class {
5115
5107
  */
5116
5108
  GetPorts = () => {
5117
5109
  const { port1, port2 } = new MessageChannel();
5118
- if (!import_browser.default) port1.start();
5110
+ if (!isNode) port1.start();
5119
5111
  return {
5120
5112
  port1,
5121
5113
  port2
@@ -5740,7 +5732,7 @@ var ArchiveManager = class {
5740
5732
  /**
5741
5733
  * In Node.js, unref the timer so it does not keep the process alive.
5742
5734
  */
5743
- if (import_browser.default) this.archiveDelTimeout.unref();
5735
+ if (isNode) this.archiveDelTimeout.unref();
5744
5736
  }
5745
5737
  }
5746
5738
  }
@@ -5756,15 +5748,15 @@ var ArchiveManager = class {
5756
5748
  * Schedule the next archive scan.
5757
5749
  */
5758
5750
  this.timeout = setTimeout(() => this.ProcessLoopExecutor(), 1e3);
5759
- if (import_browser.default) this.timeout.unref();
5751
+ if (isNode) this.timeout.unref();
5760
5752
  }, 100);
5761
- if (import_browser.default) startTimeout.unref();
5753
+ if (isNode) startTimeout.unref();
5762
5754
  } else {
5763
5755
  /**
5764
5756
  * No archive candidates found; just schedule the next scan.
5765
5757
  */
5766
5758
  this.timeout = setTimeout(() => this.ProcessLoopExecutor(), 1e3);
5767
- if (import_browser.default) this.timeout.unref();
5759
+ if (isNode) this.timeout.unref();
5768
5760
  }
5769
5761
  } catch (error) {
5770
5762
  this.options.logger.error(`_processLoopExecutor(): Error: [${error}]`);
@@ -6394,7 +6386,7 @@ var WorkerInstanceManager = class {
6394
6386
  * @param stsWorkerEx Manager-side worker instance whose underlying actual worker should be monitored.
6395
6387
  */
6396
6388
  SetupWorkerSystemEvents = (stsWorkerEx) => {
6397
- if (import_browser.default) {
6389
+ if (isNode) {
6398
6390
  /**
6399
6391
  * Node.js worker thread exit event.
6400
6392
  *