@nsshunt/stsrunnerframework 1.0.62 → 1.0.63

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.
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value2) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value2);
10
10
  var __privateSet = (obj, member, value2, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value2) : member.set(obj, value2), value2);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _collectorCollectorPort, _runners, _options3, _workerId, _debug, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options4, _STSInstrumentController, _telemetryProcessor, _debug2, _STSWorkerManager_instances, CreateRunnerCopy_fn, _SetRunnerIntoWorker, _ProcessTelemetry, _RunnerStateChange, _ProcessCompleted, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _BroadcastCommandToAllRunners, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _BroadcastUpdateCommandToAllRunners, _UpdateOptionsWorker, _TerminateWorker, _UpdateOptions2, _options5, _rest01Client, _accessToken2, _agentManager, _authUtilsNode, _GetAccessToken;
12
+ var _collectorCollectorPort, _runners, _options3, _workerId, _debug, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options4, _STSInstrumentController, _telemetryProcessor, _debug2, _STSWorkerManager_instances, CreateRunnerCopy_fn, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitEvent, _RunnerStateChange, _ProcessCompleted, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _BroadcastCommandToAllRunners, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _BroadcastUpdateCommandToAllRunners, _UpdateOptionsWorker, _TerminateWorker, _UpdateOptions2, _options5, _rest01Client, _accessToken2, _agentManager, _authUtilsNode, _GetAccessToken;
13
13
  import { Sleep, ModelDelimeter, STSAxiosConfig, GetErrorPayload, AgentManager, defaultLogger } from "@nsshunt/stsutils";
14
14
  import { Gauge } from "@nsshunt/stsobservability";
15
15
  import { accessSync, constants as constants$2, readFileSync } from "node:fs";
@@ -2174,14 +2174,17 @@ class STSWorkerManager {
2174
2174
  runnerEx.instrumentData.message = [];
2175
2175
  }
2176
2176
  __privateGet(this, _telemetryProcessor).ProcessTelemetry(runnerEx.publishInstrumentController, runnerEx.instrumentData);
2177
- if (workerEx.runnersEvents[runner.id]) {
2178
- const runnersEvents = workerEx.runnersEvents[runner.id];
2179
- runnersEvents.forEach((ev) => {
2180
- if (ev.eventName.localeCompare("Telemetry") === 0) {
2181
- ev.cb(runnerEx.instrumentData);
2182
- }
2183
- });
2184
- }
2177
+ __privateGet(this, _EmitEvent).call(this, "Telemetry", workerEx, runner.id);
2178
+ }
2179
+ });
2180
+ __privateAdd(this, _EmitEvent, (eventName, workerEx, runnerId) => {
2181
+ if (workerEx.runnersEvents[runnerId]) {
2182
+ const runnersEvents = workerEx.runnersEvents[runnerId];
2183
+ runnersEvents.forEach((ev) => {
2184
+ if (ev.eventName.localeCompare(eventName) === 0) {
2185
+ ev.cb(workerEx.runnersEx[runnerId]);
2186
+ }
2187
+ });
2185
2188
  }
2186
2189
  });
2187
2190
  //@@ make this have an event
@@ -2192,18 +2195,12 @@ class STSWorkerManager {
2192
2195
  if (workerEx.runnersEx[runner.id]) {
2193
2196
  const runnerEx = workerEx.runnersEx[runner.id];
2194
2197
  runnerEx.state = runner.state;
2198
+ __privateGet(this, _EmitEvent).call(this, "StateChange", workerEx, runner.id);
2195
2199
  }
2196
2200
  });
2197
2201
  __privateAdd(this, _ProcessCompleted, (workerEx, payloadContents) => {
2198
2202
  const { runner } = payloadContents;
2199
- if (workerEx.runnersEvents[runner.id]) {
2200
- const runnersEvents = workerEx.runnersEvents[runner.id];
2201
- runnersEvents.forEach((ev) => {
2202
- if (ev.eventName.localeCompare("Completed") === 0) {
2203
- ev.cb(workerEx.runnersEx[runner.id].instrumentData);
2204
- }
2205
- });
2206
- }
2203
+ __privateGet(this, _EmitEvent).call(this, "Completed", workerEx, runner.id);
2207
2204
  console.log(chalk$1.green(`ProcessCompleted: [${JSON.stringify(runner)}]`));
2208
2205
  });
2209
2206
  __privateAdd(this, _CreateAsyncRunner, (workerEx, runnerOptions) => {
@@ -2502,6 +2499,7 @@ CreateRunnerCopy_fn = function(runnerEx) {
2502
2499
  };
2503
2500
  _SetRunnerIntoWorker = new WeakMap();
2504
2501
  _ProcessTelemetry = new WeakMap();
2502
+ _EmitEvent = new WeakMap();
2505
2503
  _RunnerStateChange = new WeakMap();
2506
2504
  _ProcessCompleted = new WeakMap();
2507
2505
  _CreateAsyncRunner = new WeakMap();