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