@nsshunt/stsrunnerframework 2.0.26 → 2.0.28

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
@@ -7040,7 +7040,6 @@ var globalThisShim = (() => {
7040
7040
  else return Function("return this")();
7041
7041
  })();
7042
7042
  var defaultBinaryType = "arraybuffer";
7043
- function createCookieJar() {}
7044
7043
  //#endregion
7045
7044
  //#region node_modules/engine.io-client/build/esm/util.js
7046
7045
  function pick(obj, ...attr) {
@@ -7907,7 +7906,7 @@ var SocketWithoutUpgrade = class SocketWithoutUpgrade extends Emitter {
7907
7906
  OFFLINE_EVENT_LISTENERS.push(this._offlineEventListener);
7908
7907
  }
7909
7908
  }
7910
- if (this.opts.withCredentials) this._cookieJar = /* @__PURE__ */ createCookieJar();
7909
+ if (this.opts.withCredentials) this._cookieJar = void 0;
7911
7910
  this._open();
7912
7911
  }
7913
7912
  /**
@@ -10146,6 +10145,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
10146
10145
  };
10147
10146
  //#endregion
10148
10147
  //#region src/wsevents.ts
10148
+ var RUNNER_FRAMEWORK_GLOBAL_ROOM = "__sts_global_stsrunnerframework";
10149
10149
  var IEventReturnValueBaseType = /* @__PURE__ */ function(IEventReturnValueBaseType) {
10150
10150
  IEventReturnValueBaseType["serviceDetails"] = "serviceDetails";
10151
10151
  IEventReturnValueBaseType["workers"] = "workers";
@@ -10183,21 +10183,36 @@ var IEventRequestCommand = /* @__PURE__ */ function(IEventRequestCommand) {
10183
10183
  return IEventRequestCommand;
10184
10184
  }({});
10185
10185
  //#endregion
10186
- //#region src/workerManagerProxy.ts
10187
- var WorkerManagerProxy = class extends SocketIoClient {
10186
+ //#region src/nodeAgent.ts
10187
+ chalk.level = 3;
10188
+ var NodeAgent = class extends SocketIoClient {
10188
10189
  _options;
10189
10190
  _id = globalThis.crypto.randomUUID();
10190
10191
  _clientName = "";
10191
10192
  _wm;
10192
- #debug = (message) => this._options.logger.debug(message);
10193
- #error = (error) => this._options.logger.error(error);
10194
- #info = (message) => this._options.logger.info(message);
10193
+ _heartBeatTimeout = void 0;
10194
+ _heartBeatInterval = 1e3;
10195
+ _colIndex;
10196
+ _GetColorFromIndex = () => {
10197
+ switch (this._colIndex % 5) {
10198
+ case 0: return chalk.rgb(10, 200, 50);
10199
+ case 1: return chalk.rgb(62, 62, 97);
10200
+ case 2: return chalk.rgb(214, 112, 168);
10201
+ case 3: return chalk.rgb(118, 139, 22);
10202
+ case 4: return chalk.rgb(165, 79, 199);
10203
+ }
10204
+ return chalk.yellow;
10205
+ };
10206
+ #debug = (message) => this._options.logger.debug(this._GetColorFromIndex()(`NodeAgent:${this._id}:${this._clientName}: ${message}`));
10207
+ #error = (error) => this._options.logger.error(this._GetColorFromIndex()(`NodeAgent:${this._id}:${this._clientName}: ${error}`));
10208
+ #info = (message) => this._options.logger.info(this._GetColorFromIndex()(`NodeAgent:${this._id}:${this._clientName}: ${message}`));
10195
10209
  constructor(options) {
10196
10210
  super(options.name);
10197
10211
  this._options = options;
10198
10212
  this._clientName = options.name;
10213
+ this._colIndex = options.colIndex;
10199
10214
  this._wm = this._options.CreateSTSWorkerManager();
10200
- this.#info(chalk.yellow(`Worker Manager ID: [${this._wm.id}]`));
10215
+ this.#info(chalk.yellow(`constructor(): Worker Manager ID: [${this._wm.id}]`));
10201
10216
  this._Start();
10202
10217
  }
10203
10218
  get workerManager() {
@@ -10212,7 +10227,7 @@ var WorkerManagerProxy = class extends SocketIoClient {
10212
10227
  this._OnSocketConnected(socket, this.name, []);
10213
10228
  }
10214
10229
  SocketError(error) {
10215
- this.#error(`${this.name}: SetupClientSideSocket call back: [${error}]`);
10230
+ this.#error(`SetupClientSideSocket call back: [${error}]`);
10216
10231
  }
10217
10232
  SetupSocketEvents(socket) {
10218
10233
  this._RegisterSocketEvents(socket, this.name);
@@ -10229,18 +10244,43 @@ var WorkerManagerProxy = class extends SocketIoClient {
10229
10244
  _LogPayloadEventRetVal = (retVal) => {
10230
10245
  return retVal;
10231
10246
  };
10247
+ _HeartBeat = async () => {
10248
+ const workers = [];
10249
+ const workersCore = await this._GetWorkersCore({
10250
+ useZip: false,
10251
+ states: []
10252
+ });
10253
+ for (const [key, workerCoreData] of Object.entries(workersCore.workerCores)) workers.push({
10254
+ workerId: workerCoreData.id,
10255
+ runnerCount: Object.keys(workerCoreData.runners).length,
10256
+ state: "unknown",
10257
+ maxRunners: 5
10258
+ });
10259
+ const start = performance.now();
10260
+ const payload = {
10261
+ nodeId: this.id,
10262
+ sentAt: Date.now(),
10263
+ workers,
10264
+ enabled: true,
10265
+ labels: ["somelabel"]
10266
+ };
10267
+ this.socket?.emit("HeartBeat", payload, (data) => {
10268
+ const end = performance.now();
10269
+ const nextTimeoutInterval = this._heartBeatInterval - (end - start);
10270
+ this._heartBeatTimeout = setTimeout(this._HeartBeat, nextTimeoutInterval);
10271
+ });
10272
+ };
10232
10273
  _Start = async () => {
10233
10274
  this._EmitEvent("Starting", {});
10234
- this.WithAddress(this._options.ststccendpoint).WithLogger(defaultLogger).WithSocketIoCustomPath("");
10275
+ this.WithAddress(this._options.nodeAgentEndpoint).WithLogger(defaultLogger).WithSocketIoCustomPath(this._options.nodeAgentSocketIoCustomPath).WithAckTimeout(5e3);
10235
10276
  if (this._options.agentManager) this.WithAgentManager(this._options.agentManager);
10236
- this.#info(chalk.yellow(`STS Test Runner Service Instance.`));
10237
- this.#info(chalk.yellow(`This service instance emulates instances of the ststestrunnernode service.`));
10238
- this.#info(chalk.yellow(`Service Instance ID: [${this._id}]`));
10239
- this.#info(chalk.yellow(`Service Instance Name: [${this._options.name}]`));
10240
- this.#info(chalk.yellow(`Options: [${JSON.stringify(this._options)}]`));
10277
+ this.#info(chalk.yellow(`_Start():STS Test Runner Service Instance.`));
10278
+ this.#info(chalk.yellow(`_Start():This service instance emulates instances of the ststestrunnernode service.`));
10279
+ this.#info(chalk.yellow(`_Start():Service Instance ID: [${this._id}]`));
10280
+ this.#info(chalk.yellow(`_Start():Service Instance Name: [${this._options.name}]`));
10241
10281
  this.SetupSocket();
10242
10282
  const start = async () => {
10243
- for (let i = 0; i < this._options.workers; i++) await this._AddWorker({
10283
+ for (let i = 0; i < this._options.workers; i++) await this._AddWorker({ workerOptions: {
10244
10284
  tags: [""],
10245
10285
  userData: {},
10246
10286
  mocked: false,
@@ -10248,42 +10288,38 @@ var WorkerManagerProxy = class extends SocketIoClient {
10248
10288
  agentId: "agent01",
10249
10289
  userAgent: globalThis.crypto.randomUUID(),
10250
10290
  logLevel: 4
10251
- });
10291
+ } });
10252
10292
  this._EmitEvent("Started", {});
10253
10293
  };
10254
10294
  await start();
10295
+ this._heartBeatTimeout = setTimeout(this._HeartBeat, this._heartBeatInterval);
10255
10296
  };
10256
10297
  Stop = async () => {
10257
- this._EmitEvent("Stopping ...", {});
10258
- this.#debug(chalk.magenta(`Stop(): Stopping Service.`));
10298
+ this._EmitEvent("NodeAgent:Stop():Stopping ...", {});
10299
+ if (this._heartBeatTimeout) clearTimeout(this._heartBeatTimeout);
10300
+ this.#debug(chalk.magenta(`Stop(): Stopping Service...`));
10259
10301
  await this._wm.TerminateWorkers([]);
10260
- this.#debug(`Stop(): Workers terminated`);
10302
+ this.#debug(chalk.magenta(`Stop(): Workers terminated`));
10261
10303
  if (this.socket) {
10262
- this.#debug(`Stop(): Going to disconnect socket ...`);
10304
+ this.#debug(chalk.magenta(`Stop(): Going to disconnect socket ...`));
10263
10305
  this.socket.disconnect();
10264
- this.#debug(`Stop(): Socket disconnected.`);
10306
+ this.#debug(chalk.magenta(`Stop(): Socket disconnected.`));
10265
10307
  }
10266
- this.#debug(`Stop(): Sleeping (500ms) ...`);
10308
+ this.#debug(chalk.magenta(`Stop(): Sleeping (500ms) ...`));
10267
10309
  await Sleep(500);
10268
10310
  this.#debug(chalk.magenta(`Stop(): Service Stopped.`));
10269
10311
  this._EmitEvent("Stopped", {});
10270
10312
  };
10271
- _GetService = async () => {
10313
+ _GetService = async (args) => {
10272
10314
  const raw = this._EmitEvent("GetService", this._LogPayloadEventRetVal({
10273
10315
  ...this._GetKeyPayloadData(IEventRequestCommand.GetService, IEventReturnValueBaseType.serviceDetails),
10274
10316
  serviceDetails: await this._options.GetServiceDetails()
10275
10317
  }));
10276
- raw.serviceDetails = gzipSync(strToU8(JSON.stringify(raw.serviceDetails)));
10318
+ if (args.useZip === true) raw.serviceDetails = gzipSync(strToU8(JSON.stringify(raw.serviceDetails)));
10277
10319
  return raw;
10278
10320
  };
10279
- _GetServiceNoZip = async () => {
10280
- return this._EmitEvent("GetService", this._LogPayloadEventRetVal({
10281
- ...this._GetKeyPayloadData(IEventRequestCommand.GetService, IEventReturnValueBaseType.serviceDetails),
10282
- serviceDetails: await this._options.GetServiceDetails()
10283
- }));
10284
- };
10285
10321
  _EmitStateChange = (runnerEx) => {
10286
- this.#debug(chalk.rgb(10, 50, 200)(`WorkerManagerProxy:_EmitStateChange(): ==>> Runner State Change: WorkerId: [${runnerEx.workerId}] RunnerId: [${runnerEx.id}] State: [${runnerEx.state}]`));
10322
+ this.#debug(chalk.rgb(10, 50, 200)(`_EmitStateChange(): ==>> Runner State Change: WorkerId: [${runnerEx.workerId}] RunnerId: [${runnerEx.id}] State: [${runnerEx.state}]`));
10287
10323
  const stateChangeRetVal = {
10288
10324
  eventRequestCommand: "StateChange",
10289
10325
  type: IEventReturnValueBaseType.runner,
@@ -10296,9 +10332,8 @@ var WorkerManagerProxy = class extends SocketIoClient {
10296
10332
  this.socket?.emit("StateChange", stateChangeRetVal);
10297
10333
  };
10298
10334
  _EmitTelemetry = (runnerEx) => {
10299
- this.#debug(chalk.rgb(10, 50, 200)(`WorkerManagerProxy:_EmitTelemetry(): ==>> WorkerId: [${runnerEx.workerId}] RunnerId: [${runnerEx.id}] State: [${runnerEx.state}]`));
10300
10335
  const telemetryRetVal = {
10301
- eventRequestCommand: "StateChange",
10336
+ eventRequestCommand: "Telemetry",
10302
10337
  type: IEventReturnValueBaseType.runner,
10303
10338
  workerManagerId: this._wm.id,
10304
10339
  id: this._id,
@@ -10313,21 +10348,21 @@ var WorkerManagerProxy = class extends SocketIoClient {
10313
10348
  runnerEx.on("Telemetry", this._EmitTelemetry);
10314
10349
  };
10315
10350
  _OnSocketConnected = (socket, clientName, joinRooms) => {
10316
- this.#debug(chalk.green(`${this._id} ${clientName}: --> connected`));
10351
+ this.#debug(chalk.green(`_OnSocketConnected(): ${this._id} ${clientName}: --> connected`));
10352
+ const rooms = [
10353
+ RUNNER_FRAMEWORK_GLOBAL_ROOM,
10354
+ `node_${this._id}`,
10355
+ ...joinRooms
10356
+ ];
10317
10357
  this._EmitEvent("SocketConnected", {
10318
10358
  id: this._id,
10319
10359
  clientName,
10320
- joinRooms: [
10321
- ...joinRooms,
10322
- "ststrnservices",
10323
- this._id
10324
- ]
10360
+ joinRooms: rooms
10325
10361
  });
10326
- if (joinRooms.length > 0) socket.emit("__STSjoinRoom", joinRooms);
10327
- socket.emit("__STSjoinRoom", ["ststrnservices"]).emit("__STSjoinRoom", [this._id]);
10362
+ socket.emit("__STSjoinRoom", rooms);
10328
10363
  };
10329
- _AddWorker = async (options) => {
10330
- const workerEx = await this._wm.AddWorker(options);
10364
+ _AddWorker = async (args) => {
10365
+ const workerEx = await this._wm.AddWorker(args.workerOptions);
10331
10366
  if (workerEx) return this._EmitEvent("AddWorker", this._LogPayloadEventRetVal({
10332
10367
  ...this._GetKeyPayloadData(IEventRequestCommand.AddWorker, IEventReturnValueBaseType.worker),
10333
10368
  worker: workerEx.toWorker()
@@ -10337,151 +10372,133 @@ var WorkerManagerProxy = class extends SocketIoClient {
10337
10372
  worker: {}
10338
10373
  }));
10339
10374
  };
10340
- _GetArchiveList = async (runnerSearchFilters) => {
10375
+ _GetArchiveList = async (args) => {
10341
10376
  const raw = this._EmitEvent("GetArchiveList", this._LogPayloadEventRetVal({
10342
10377
  ...this._GetKeyPayloadData(IEventRequestCommand.GetArchiveList, IEventReturnValueBaseType.archiveList),
10343
- archiveList: await this._wm.GetArchiveList(runnerSearchFilters)
10378
+ archiveList: await this._wm.GetArchiveList(args.runnerSearchFilters)
10344
10379
  }));
10345
- raw.archiveList = gzipSync(strToU8(JSON.stringify(raw.archiveList)));
10380
+ if (args.useZip === true) raw.archiveList = gzipSync(strToU8(JSON.stringify(raw.archiveList)));
10346
10381
  return raw;
10347
10382
  };
10348
- _GetArchiveListNoZip = async (runnerSearchFilters) => {
10349
- return this._EmitEvent("GetArchiveList", this._LogPayloadEventRetVal({
10350
- ...this._GetKeyPayloadData(IEventRequestCommand.GetArchiveList, IEventReturnValueBaseType.archiveList),
10351
- archiveList: await this._wm.GetArchiveList(runnerSearchFilters)
10352
- }));
10353
- };
10354
- _GetWorkers = async () => {
10383
+ _GetWorkers = async (args) => {
10355
10384
  const raw = this._EmitEvent("GetWorkers", this._LogPayloadEventRetVal({
10356
10385
  ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkers, IEventReturnValueBaseType.workers),
10357
10386
  workers: await this._wm.GetWorkers()
10358
10387
  }));
10359
- raw.workers = gzipSync(strToU8(JSON.stringify(raw.workers)));
10388
+ if (args.useZip === true) raw.workers = gzipSync(strToU8(JSON.stringify(raw.workers)));
10360
10389
  return raw;
10361
10390
  };
10362
- _GetWorkersNoZip = async () => {
10363
- return this._EmitEvent("GetWorkers", this._LogPayloadEventRetVal({
10364
- ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkers, IEventReturnValueBaseType.workers),
10365
- workers: await this._wm.GetWorkers()
10366
- }));
10367
- };
10368
- _GetWorkersCore = async (states) => {
10391
+ _GetWorkersCore = async (args) => {
10369
10392
  const raw = this._EmitEvent("GetWorkersCore", this._LogPayloadEventRetVal({
10370
10393
  ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkersCore, IEventReturnValueBaseType.workers),
10371
- workerCores: await this._wm.GetWorkersCore(states)
10394
+ workerCores: await this._wm.GetWorkersCore(args.states)
10372
10395
  }));
10373
- raw.workers = gzipSync(strToU8(JSON.stringify(raw.workers)));
10396
+ if (args.useZip === true) raw.workerCores = gzipSync(strToU8(JSON.stringify(raw.workerCores)));
10374
10397
  return raw;
10375
10398
  };
10376
- _GetWorkersCoreNoZip = async (states) => {
10377
- return this._EmitEvent("GetWorkersCore", this._LogPayloadEventRetVal({
10378
- ...this._GetKeyPayloadData(IEventRequestCommand.GetWorkersCore, IEventReturnValueBaseType.workers),
10379
- workerCores: await this._wm.GetWorkersCore(states)
10380
- }));
10381
- };
10382
- _StartWorkers = async (workerIds) => {
10399
+ _StartWorkers = async (args) => {
10383
10400
  return this._EmitEvent("StartWorkers", this._LogPayloadEventRetVal({
10384
10401
  ...this._GetKeyPayloadData(IEventRequestCommand.StartWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10385
- executeWorkerActionResult: await this._wm.StartWorkers(workerIds)
10402
+ executeWorkerActionResult: await this._wm.StartWorkers(args.workerIds)
10386
10403
  }));
10387
10404
  };
10388
- _StopWorkers = async (workerIds) => {
10405
+ _StopWorkers = async (args) => {
10389
10406
  return this._EmitEvent("StopWorkers", this._LogPayloadEventRetVal({
10390
10407
  ...this._GetKeyPayloadData(IEventRequestCommand.StopWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10391
- executeWorkerActionResult: await this._wm.StopWorkers(workerIds)
10408
+ executeWorkerActionResult: await this._wm.StopWorkers(args.workerIds)
10392
10409
  }));
10393
10410
  };
10394
- _PauseWorkers = async (workerIds) => {
10411
+ _PauseWorkers = async (args) => {
10395
10412
  return this._EmitEvent("PauseWorkers", this._LogPayloadEventRetVal({
10396
10413
  ...this._GetKeyPayloadData(IEventRequestCommand.PauseWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10397
- executeWorkerActionResult: await this._wm.PauseWorkers(workerIds)
10414
+ executeWorkerActionResult: await this._wm.PauseWorkers(args.workerIds)
10398
10415
  }));
10399
10416
  };
10400
- _ResumeWorkers = async (workerIds) => {
10417
+ _ResumeWorkers = async (args) => {
10401
10418
  return this._EmitEvent("ResumeWorkers", this._LogPayloadEventRetVal({
10402
10419
  ...this._GetKeyPayloadData(IEventRequestCommand.ResumeWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10403
- executeWorkerActionResult: await this._wm.ResumeWorkers(workerIds)
10420
+ executeWorkerActionResult: await this._wm.ResumeWorkers(args.workerIds)
10404
10421
  }));
10405
10422
  };
10406
- _ExecuteWorkers = async (workerIds) => {
10423
+ _ExecuteWorkers = async (args) => {
10407
10424
  return this._EmitEvent("ExecuteWorkers", this._LogPayloadEventRetVal({
10408
10425
  ...this._GetKeyPayloadData(IEventRequestCommand.ExecuteWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10409
- executeWorkerActionResult: await this._wm.ExecuteWorkers(workerIds)
10426
+ executeWorkerActionResult: await this._wm.ExecuteWorkers(args.workerIds)
10410
10427
  }));
10411
10428
  };
10412
- _ResetWorkers = async (workerIds) => {
10429
+ _ResetWorkers = async (args) => {
10413
10430
  return this._EmitEvent("ResetWorkers", this._LogPayloadEventRetVal({
10414
10431
  ...this._GetKeyPayloadData(IEventRequestCommand.ResetWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10415
- executeWorkerActionResult: await this._wm.ResetWorkers(workerIds)
10432
+ executeWorkerActionResult: await this._wm.ResetWorkers(args.workerIds)
10416
10433
  }));
10417
10434
  };
10418
- _TerminateWorkers = async (workerIds) => {
10435
+ _TerminateWorkers = async (args) => {
10419
10436
  return this._EmitEvent("TerminateWorkers", this._LogPayloadEventRetVal({
10420
10437
  ...this._GetKeyPayloadData(IEventRequestCommand.TerminateWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10421
- executeWorkerActionResult: await this._wm.TerminateWorkers(workerIds)
10438
+ executeWorkerActionResult: await this._wm.TerminateWorkers(args.workerIds)
10422
10439
  }));
10423
10440
  };
10424
- _UpdateWorkers = async (workerIds, options) => {
10441
+ _UpdateWorkers = async (args) => {
10425
10442
  return this._EmitEvent("UpdateWorkers", this._LogPayloadEventRetVal({
10426
10443
  ...this._GetKeyPayloadData(IEventRequestCommand.UpdateWorkers, IEventReturnValueBaseType.executeWorkerActionResult),
10427
- executeWorkerActionResult: await this._wm.UpdateWorkers(workerIds, options)
10444
+ executeWorkerActionResult: await this._wm.UpdateWorkers(args.workerIds, args.runnerOptionsPartial)
10428
10445
  }));
10429
10446
  };
10430
- _StopRunners = async (workerId, runnerIds) => {
10431
- return this._EmitEvent("StopRunners", this._LogPayloadEventRetVal({
10432
- ...this._GetKeyPayloadData(IEventRequestCommand.StopRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10433
- executeRunnerActionResult: await this._wm.StopRunners(workerId, runnerIds)
10434
- }));
10435
- };
10436
- _StartRunners = async (workerId, runnerIds) => {
10447
+ _StartRunners = async (args) => {
10437
10448
  return this._EmitEvent("StartRunners", this._LogPayloadEventRetVal({
10438
10449
  ...this._GetKeyPayloadData(IEventRequestCommand.StartRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10439
- executeRunnerActionResult: await this._wm.StartRunners(workerId, runnerIds)
10450
+ executeRunnerActionResult: await this._wm.StartRunners(args.workerId, args.runnerIds)
10451
+ }));
10452
+ };
10453
+ _StopRunners = async (args) => {
10454
+ return this._EmitEvent("StopRunners", this._LogPayloadEventRetVal({
10455
+ ...this._GetKeyPayloadData(IEventRequestCommand.StopRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10456
+ executeRunnerActionResult: await this._wm.StopRunners(args.workerId, args.runnerIds)
10440
10457
  }));
10441
10458
  };
10442
- _PauseRunners = async (workerId, runnerIds) => {
10459
+ _PauseRunners = async (args) => {
10443
10460
  return this._EmitEvent("PauseRunners", this._LogPayloadEventRetVal({
10444
10461
  ...this._GetKeyPayloadData(IEventRequestCommand.PauseRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10445
- executeRunnerActionResult: await this._wm.PauseRunners(workerId, runnerIds)
10462
+ executeRunnerActionResult: await this._wm.PauseRunners(args.workerId, args.runnerIds)
10446
10463
  }));
10447
10464
  };
10448
- _ResumeRunners = async (workerId, runnerIds) => {
10465
+ _ResumeRunners = async (args) => {
10449
10466
  return this._EmitEvent("ResumeRunners", this._LogPayloadEventRetVal({
10450
10467
  ...this._GetKeyPayloadData(IEventRequestCommand.ResumeRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10451
- executeRunnerActionResult: await this._wm.ResumeRunners(workerId, runnerIds)
10468
+ executeRunnerActionResult: await this._wm.ResumeRunners(args.workerId, args.runnerIds)
10452
10469
  }));
10453
10470
  };
10454
- _ExecuteRunners = async (workerId, runnerIds) => {
10471
+ _ExecuteRunners = async (args) => {
10455
10472
  return this._EmitEvent("ExecuteRunners", this._LogPayloadEventRetVal({
10456
10473
  ...this._GetKeyPayloadData(IEventRequestCommand.ExecuteRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10457
- executeRunnerActionResult: await this._wm.ExecuteRunners(workerId, runnerIds)
10474
+ executeRunnerActionResult: await this._wm.ExecuteRunners(args.workerId, args.runnerIds)
10458
10475
  }));
10459
10476
  };
10460
- _ResetRunners = async (workerId, runnerIds) => {
10477
+ _ResetRunners = async (args) => {
10461
10478
  return this._EmitEvent("ResetRunners", this._LogPayloadEventRetVal({
10462
10479
  ...this._GetKeyPayloadData(IEventRequestCommand.ResetRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10463
- executeRunnerActionResult: await this._wm.ResetRunners(workerId, runnerIds)
10480
+ executeRunnerActionResult: await this._wm.ResetRunners(args.workerId, args.runnerIds)
10464
10481
  }));
10465
10482
  };
10466
- _TerminateRunners = async (workerId, runnerIds) => {
10483
+ _TerminateRunners = async (args) => {
10467
10484
  return this._EmitEvent("TerminateRunners", this._LogPayloadEventRetVal({
10468
10485
  ...this._GetKeyPayloadData(IEventRequestCommand.TerminateRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10469
- executeRunnerActionResult: await this._wm.TerminateRunners(workerId, runnerIds)
10486
+ executeRunnerActionResult: await this._wm.TerminateRunners(args.workerId, args.runnerIds)
10470
10487
  }));
10471
10488
  };
10472
- _UpdateRunners = async (workerId, runnerIds, options) => {
10489
+ _UpdateRunners = async (args) => {
10473
10490
  return this._EmitEvent("UpdateRunners", this._LogPayloadEventRetVal({
10474
10491
  ...this._GetKeyPayloadData(IEventRequestCommand.UpdateRunners, IEventReturnValueBaseType.executeRunnerActionResult),
10475
- executeRunnerActionResult: await this._wm.UpdateRunners(workerId, runnerIds, options)
10492
+ executeRunnerActionResult: await this._wm.UpdateRunners(args.workerId, args.runnerIds, args.runnerOptionsPartial)
10476
10493
  }));
10477
10494
  };
10478
- _AddRunner = async (options) => {
10479
- this.#debug(chalk.yellow(`${this._id} ${this._clientName}: --> AddRunner: [${JSON.stringify(options)}]`));
10480
- const runnerEx = await this._wm.AddRunner(options);
10495
+ _AddRunner = async (args) => {
10496
+ this.#debug(chalk.yellow(`_AddRunner(): ${this._id} ${this._clientName}: --> AddRunner: [${JSON.stringify(args.runnerOptions)}]`));
10497
+ const runnerEx = await this._wm.AddRunner(args.runnerOptions);
10481
10498
  let runner = {};
10482
10499
  if (runnerEx) {
10483
10500
  this._SetupRunnerEventHandlers(runnerEx);
10484
- this.#debug(chalk.yellow(`${this._clientName}: AddRunner: WorkerId: [${runnerEx.workerId}] RunnerId: [${runnerEx.id}]`));
10501
+ this.#debug(chalk.yellow(`_AddRunner: WorkerId: [${runnerEx.workerId}] RunnerId: [${runnerEx.id}]`));
10485
10502
  runner = runnerEx.toRunner();
10486
10503
  }
10487
10504
  return this._EmitEvent(IEventRequestCommand.AddRunner, this._LogPayloadEventRetVal({
@@ -10489,13 +10506,13 @@ var WorkerManagerProxy = class extends SocketIoClient {
10489
10506
  runner
10490
10507
  }));
10491
10508
  };
10492
- _AddRunnerToWorkerByWorkerId = async (workerId, options) => {
10493
- this.#debug(chalk.yellow(`${this._id} ${this._clientName}: --> AddRunner: [${JSON.stringify(options)}]`));
10494
- const runnerEx = await this._wm.AddRunnerToWorkerByWorkerId(workerId, options);
10509
+ _AddRunnerToWorkerByWorkerId = async (args) => {
10510
+ this.#debug(chalk.yellow(`_AddRunnerToWorkerByWorkerId(): ${this._id} ${this._clientName}: --> _AddRunnerToWorkerByWorkerId: workerId: [${args.workerId}], options: [${JSON.stringify(args.runnerOptions)}]`));
10511
+ const runnerEx = await this._wm.AddRunnerToWorkerByWorkerId(args.workerId, args.runnerOptions);
10495
10512
  let runner = {};
10496
10513
  if (runnerEx) {
10497
10514
  this._SetupRunnerEventHandlers(runnerEx);
10498
- this.#debug(chalk.yellow(`${this._clientName}: AddRunnerToWorker: WorkerId: [${runnerEx.workerId}] RunnerId: [${runnerEx.id}]`));
10515
+ this.#debug(chalk.yellow(`_AddRunnerToWorker: WorkerId: [${runnerEx.workerId}] RunnerId: [${runnerEx.id}]`));
10499
10516
  runner = runnerEx.toRunner();
10500
10517
  }
10501
10518
  return this._EmitEvent(IEventRequestCommand.AddRunnerToWorker, this._LogPayloadEventRetVal({
@@ -10508,12 +10525,14 @@ var WorkerManagerProxy = class extends SocketIoClient {
10508
10525
  const handlers = this._GetSocketEventHandlers(socket, clientName);
10509
10526
  for (const [event, handler] of Object.entries(handlers)) {
10510
10527
  const wrappedHandler = async (...args) => {
10528
+ this.#debug(chalk.yellow(` --> ${event}: ${JSON.stringify(args, null, 2)}`));
10511
10529
  return handler(...args);
10512
10530
  };
10513
10531
  socket.on(event, wrappedHandler);
10514
10532
  }
10515
10533
  };
10516
10534
  _EmitEvent = (eventName, data) => {
10535
+ data.eventRequestCommand;
10517
10536
  this.emit(eventName, data);
10518
10537
  return data;
10519
10538
  };
@@ -10522,48 +10541,48 @@ var WorkerManagerProxy = class extends SocketIoClient {
10522
10541
  return {
10523
10542
  "disconnect": (reason) => {
10524
10543
  this._EmitEvent("disconnect", reason);
10525
- this.#error(`#disconnect(): [${reason}]`);
10544
+ this.#error(`_GetSocketEventHandlers:disconnect: [${reason}]`);
10526
10545
  },
10527
10546
  "connect_error": (error) => {
10528
10547
  this._EmitEvent("connect_error", error);
10529
- if (!socket.active) this.#error(error.message);
10548
+ if (!socket.active) this.#error(`_GetSocketEventHandlers:connect_error: [${error.message}]`);
10530
10549
  },
10531
10550
  "error": (error) => {
10532
10551
  this._EmitEvent("error", error);
10533
- this.#error(`#GetSocketEventHandlers(): [${error}]`);
10552
+ this.#error(`_GetSocketEventHandlers:error: [${error.message}]`);
10534
10553
  },
10535
10554
  "__STSdisconnect": (reason) => {
10536
10555
  this._EmitEvent("__STSdisconnect", reason);
10537
- this.#debug(chalk.magenta(`${logPrefix}: [${socket.id}] [${reason}]`));
10556
+ this.#debug(chalk.magenta(`_GetSocketEventHandlers:__STSdisconnect: ${logPrefix}: [${socket.id}] [${reason}]`));
10538
10557
  this.Stop();
10539
10558
  },
10540
- "GetService": async (cb) => cb(await this._GetService()),
10541
- "GetWorkers": async (cb) => cb(await this._GetWorkers()),
10542
- "GetWorkersCore": async (states, cb) => cb(await this._GetWorkersCore(states)),
10543
- "GetArchiveList": async (runnerSearchFilters, cb) => cb(await this._GetArchiveList(runnerSearchFilters)),
10544
- "AddRunner": async (options, cb) => cb(await this._AddRunner(options)),
10545
- "AddRunnerToWorkerByWorkerId": async (workerId, options, cb) => cb(await this._AddRunnerToWorkerByWorkerId(workerId, options)),
10546
- "AddWorker": async (options, cb) => cb(await this._AddWorker(options)),
10547
- "StartWorkers": async (workerIds, cb) => cb(await this._StartWorkers(workerIds)),
10548
- "StopWorkers": async (workerIds, cb) => cb(await this._StopWorkers(workerIds)),
10549
- "PauseWorkers": async (workerIds, cb) => cb(await this._PauseWorkers(workerIds)),
10550
- "ResumeWorkers": async (workerIds, cb) => cb(await this._ResumeWorkers(workerIds)),
10551
- "ExecuteWorkers": async (workerIds, cb) => cb(await this._ExecuteWorkers(workerIds)),
10552
- "ResetWorkers": async (workerIds, cb) => cb(await this._ResetWorkers(workerIds)),
10553
- "TerminateWorkers": async (workerIds, cb) => cb(await this._TerminateWorkers(workerIds)),
10554
- "UpdateWorkers": async (workerIds, options, cb) => cb(await this._UpdateWorkers(workerIds, options)),
10555
- "StartRunners": async (workerId, runnerIds, cb) => cb(await this._StartRunners(workerId, runnerIds)),
10556
- "StopRunners": async (workerId, runnerIds, cb) => cb(await this._StopRunners(workerId, runnerIds)),
10557
- "PauseRunners": async (workerId, runnerIds, cb) => cb(await this._PauseRunners(workerId, runnerIds)),
10558
- "ResumeRunners": async (workerId, runnerIds, cb) => cb(await this._ResumeRunners(workerId, runnerIds)),
10559
- "ExecuteRunners": async (workerId, runnerIds, cb) => cb(await this._ExecuteRunners(workerId, runnerIds)),
10560
- "ResetRunners": async (workerId, runnerIds, cb) => cb(await this._ResetRunners(workerId, runnerIds)),
10561
- "TerminateRunners": async (workerId, runnerIds, cb) => cb(await this._TerminateRunners(workerId, runnerIds)),
10562
- "UpdateRunners": async (workerId, runnerIds, options, cb) => cb(await this._UpdateRunners(workerId, runnerIds, options))
10559
+ "GetService": async (args, cb) => cb(await this._GetService(args)),
10560
+ "GetWorkers": async (args, cb) => cb(await this._GetWorkers(args)),
10561
+ "GetWorkersCore": async (args, cb) => cb(await this._GetWorkersCore(args)),
10562
+ "GetArchiveList": async (args, cb) => cb(await this._GetArchiveList(args)),
10563
+ "AddRunner": async (args, cb) => cb(await this._AddRunner(args)),
10564
+ "AddRunnerToWorkerByWorkerId": async (args, cb) => cb(await this._AddRunnerToWorkerByWorkerId(args)),
10565
+ "AddWorker": async (args, cb) => cb(await this._AddWorker(args)),
10566
+ "StartWorkers": async (args, cb) => cb(await this._StartWorkers(args)),
10567
+ "StopWorkers": async (args, cb) => cb(await this._StopWorkers(args)),
10568
+ "PauseWorkers": async (args, cb) => cb(await this._PauseWorkers(args)),
10569
+ "ResumeWorkers": async (args, cb) => cb(await this._ResumeWorkers(args)),
10570
+ "ExecuteWorkers": async (args, cb) => cb(await this._ExecuteWorkers(args)),
10571
+ "ResetWorkers": async (args, cb) => cb(await this._ResetWorkers(args)),
10572
+ "TerminateWorkers": async (args, cb) => cb(await this._TerminateWorkers(args)),
10573
+ "UpdateWorkers": async (args, cb) => cb(await this._UpdateWorkers(args)),
10574
+ "StartRunners": async (args, cb) => cb(await this._StartRunners(args)),
10575
+ "StopRunners": async (args, cb) => cb(await this._StopRunners(args)),
10576
+ "PauseRunners": async (args, cb) => cb(await this._PauseRunners(args)),
10577
+ "ResumeRunners": async (args, cb) => cb(await this._ResumeRunners(args)),
10578
+ "ExecuteRunners": async (args, cb) => cb(await this._ExecuteRunners(args)),
10579
+ "ResetRunners": async (args, cb) => cb(await this._ResetRunners(args)),
10580
+ "TerminateRunners": async (args, cb) => cb(await this._TerminateRunners(args)),
10581
+ "UpdateRunners": async (args, cb) => cb(await this._UpdateRunners(args))
10563
10582
  };
10564
10583
  };
10565
10584
  };
10566
10585
  //#endregion
10567
- export { AbstractRunnerExecutionWorker, IEventRequestCommand, IEventReturnValueBaseType, IRunnerState, IWorkerState, PublishMessageCommandsTestRunner, STSWorkerManager, WorkerManagerProxy, eIWMessageCommands };
10586
+ export { AbstractRunnerExecutionWorker, IEventRequestCommand, IEventReturnValueBaseType, IRunnerState, IWorkerState, NodeAgent, PublishMessageCommandsTestRunner, RUNNER_FRAMEWORK_GLOBAL_ROOM, STSWorkerManager, eIWMessageCommands };
10568
10587
 
10569
10588
  //# sourceMappingURL=index.mjs.map