@nsshunt/stsrunnerframework 2.0.23 → 2.0.25

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/index.mjs CHANGED
@@ -3796,15 +3796,53 @@ var AsyncRunnerInstanceManager = class {
3796
3796
  * - distributed runtime traceability
3797
3797
  */
3798
3798
  const asyncRunnerContext = {
3799
+ /**
3800
+ * Hierarchical node identifier.
3801
+ *
3802
+ * Format:
3803
+ * [level1]@[level2]^[level3]|[level4]
3804
+ *
3805
+ * Concrete layout:
3806
+ * [hostName]@[agentId]-[userAgent]^[workerId]|[runnerId]
3807
+ */
3799
3808
  nid: `\
3800
3809
  ${workerEx.options.hostName}${ModelDelimeter.COMPONENT_SEPERATOR}${workerEx.options.agentId}-${workerEx.options.userAgent}\
3801
3810
  ${ModelDelimeter.NID_SEPERATOR}\
3802
3811
  ${workerEx.id}\
3803
3812
  ${ModelDelimeter.SEPERATOR}\
3804
3813
  ${runnerId}`,
3814
+ /**
3815
+ * Level 1: host identity.
3816
+ *
3817
+ * Example:
3818
+ * - machine name
3819
+ * - physical host
3820
+ * - logical host/runtime name
3821
+ */
3805
3822
  hostName: workerEx.options.hostName,
3823
+ /**
3824
+ * Level 2: agent identity.
3825
+ *
3826
+ * Constructed as:
3827
+ * `${agentId}-${userAgent}`
3828
+ *
3829
+ * This typically identifies:
3830
+ * - browser session
3831
+ * - tab instance
3832
+ * - client/service instance
3833
+ */
3806
3834
  agentName: `${workerEx.options.agentId}-${workerEx.options.userAgent}`,
3835
+ /**
3836
+ * Level 3: worker/thread identity.
3837
+ *
3838
+ * This identifies the worker hosting the runner.
3839
+ */
3807
3840
  threadId: `${workerEx.id}`,
3841
+ /**
3842
+ * Level 4: runner identity.
3843
+ *
3844
+ * This identifies the specific async runner within the worker.
3845
+ */
3808
3846
  id: runnerId
3809
3847
  };
3810
3848
  return new RunnerInstance({
@@ -4884,7 +4922,9 @@ var WorkerRegistry = class {
4884
4922
  if (runnersMap) {
4885
4923
  if (runnersMap[runnerId]) {
4886
4924
  delete runnersMap[runnerId];
4887
- this.options.logger.debug(`DeleteRunner(): RunnerId: [${runnerId}] has been removed from this workerId: [${workerId}], Remaining Runners: [${Object.keys(worker.GetAllRunnersExMap()).length}]`);
4925
+ try {
4926
+ this.options.logger.debug(`DeleteRunner(): RunnerId: [${runnerId}] has been removed from this workerId: [${workerId}], Remaining Runners: [${Object.keys(worker.GetAllRunnersExMap()).length}]`);
4927
+ } catch (error) {}
4888
4928
  }
4889
4929
  }
4890
4930
  }
@@ -6597,8 +6637,8 @@ var STSWorkerManager = class {
6597
6637
  };
6598
6638
  };
6599
6639
  //#endregion
6600
- //#region node_modules/@nsshunt/stssocketioutils/dist/tiny-emitter-DB59cw42.js
6601
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
6640
+ //#region node_modules/@nsshunt/stssocketioutils/dist/tiny-emitter-DcZ69ZvJ.js
6641
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
6602
6642
  var require_tiny_emitter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6603
6643
  function E() {}
6604
6644
  E.prototype = {
@@ -9939,6 +9979,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
9939
9979
  #authToken;
9940
9980
  #socket;
9941
9981
  #reconnectTimeout = 2e3;
9982
+ #ackTimeout = 5e3;
9942
9983
  constructor(name) {
9943
9984
  super();
9944
9985
  this.#name = name;
@@ -9979,6 +10020,13 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
9979
10020
  get socket() {
9980
10021
  return this.#socket;
9981
10022
  }
10023
+ get ackTimeout() {
10024
+ return this.#ackTimeout;
10025
+ }
10026
+ WithAckTimeout(ackTimeout) {
10027
+ this.#ackTimeout = ackTimeout;
10028
+ return this;
10029
+ }
9982
10030
  WithAddress(address) {
9983
10031
  this.#address = address;
9984
10032
  return this;
@@ -10028,6 +10076,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
10028
10076
  socketOptions.agent = this.#agentManager.GetAgent(this.#address);
10029
10077
  }
10030
10078
  } else socketOptions = { transports: ["websocket"] };
10079
+ socketOptions.ackTimeout = this.#ackTimeout;
10031
10080
  if (this.#authToken) socketOptions.auth = (cb) => {
10032
10081
  cb({ token: this.#authToken });
10033
10082
  };
@@ -10113,7 +10162,7 @@ var IEventRequestCommand = /* @__PURE__ */ function(IEventRequestCommand) {
10113
10162
  IEventRequestCommand["AddWorker"] = "AddWorker";
10114
10163
  IEventRequestCommand["GetService"] = "GetService";
10115
10164
  IEventRequestCommand["GetWorkers"] = "GetWorkers";
10116
- IEventRequestCommand["GetWorkersSmall"] = "GetWorkersSmall";
10165
+ IEventRequestCommand["GetWorkersCore"] = "GetWorkersCore";
10117
10166
  IEventRequestCommand["GetArchiveList"] = "GetArchiveList";
10118
10167
  IEventRequestCommand["StartWorkers"] = "StartWorkers";
10119
10168
  IEventRequestCommand["StopWorkers"] = "StopWorkers";
@@ -10316,17 +10365,17 @@ var WorkerManagerProxy = class extends SocketIoClient {
10316
10365
  workers: await this._wm.GetWorkers()
10317
10366
  }));
10318
10367
  };
10319
- _GetWorkersSmall = async (states) => {
10320
- const raw = this._EmitEvent("GetWorkersSmall", this._LogPayloadEventRetVal({
10321
- ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkersSmall, IEventReturnValueBaseType.workers),
10368
+ _GetWorkersCore = async (states) => {
10369
+ const raw = this._EmitEvent("GetWorkersCore", this._LogPayloadEventRetVal({
10370
+ ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkersCore, IEventReturnValueBaseType.workers),
10322
10371
  workerCores: await this._wm.GetWorkersCore(states)
10323
10372
  }));
10324
10373
  raw.workers = gzipSync(strToU8(JSON.stringify(raw.workers)));
10325
10374
  return raw;
10326
10375
  };
10327
- _GetWorkersSmallNoZip = async (states) => {
10328
- return this._EmitEvent("GetWorkersSmall", this._LogPayloadEventRetVal({
10329
- ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkersSmall, IEventReturnValueBaseType.workers),
10376
+ _GetWorkersCoreNoZip = async (states) => {
10377
+ return this._EmitEvent("GetWorkersCore", this._LogPayloadEventRetVal({
10378
+ ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkersCore, IEventReturnValueBaseType.workers),
10330
10379
  workerCores: await this._wm.GetWorkersCore(states)
10331
10380
  }));
10332
10381
  };
@@ -10490,7 +10539,7 @@ var WorkerManagerProxy = class extends SocketIoClient {
10490
10539
  },
10491
10540
  "GetService": async (cb) => cb(await this._GetService()),
10492
10541
  "GetWorkers": async (cb) => cb(await this._GetWorkers()),
10493
- "GetWorkersSmall": async (states, cb) => cb(await this._GetWorkersSmall(states)),
10542
+ "GetWorkersCore": async (states, cb) => cb(await this._GetWorkersCore(states)),
10494
10543
  "GetArchiveList": async (runnerSearchFilters, cb) => cb(await this._GetArchiveList(runnerSearchFilters)),
10495
10544
  "AddRunner": async (options, cb) => cb(await this._AddRunner(options)),
10496
10545
  "AddRunnerToWorkerByWorkerId": async (workerId, options, cb) => cb(await this._AddRunnerToWorkerByWorkerId(workerId, options)),