@nsshunt/stsrunnerframework 1.0.159 → 1.0.160

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, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _collectorCollectorPort, _runners, _options, _workerId, _archiveDeleteTimeout, _logMessage, _debug, _error, _warn, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _PostRunnersToWorkerManager, _StartRunner, _StopRunnerByRunnerId, _StopRunner, _TerminateRunner, _SendRunnerCommandResponse, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateRunner, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _messages, _archiveDeleteTimeout2, _logMessage2, _debug2, _error2, _warn2, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn, CreateRunnerCopy_fn, CreateRunnerCopySmall_fn, CreateWorkerCopy_fn, CreateWorkerCopySmall_fn, _processLoopExecutor2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitWorkerEvent, _EmitRunnerEvent, _RunnerStateChange, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _StartRunner2, _StopRunner2, _ResetRunner2, _ExecuteRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateRunner2, _StartWorker, _StopWorker, _PauseWorker, _ResumeWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _TerminateWorker, _ProcessWorkerCommands, _ExecuteVariableCommandOnRunners, GetRunnersResponse_fn, ProcessRunnerResponse_fn, _SyncRunnerData, _SyncWorkerDataFromPayload, _SyncWorkerDataFromWorker, _SyncWorkerDataFromWorkers, _SetupCallbackMessage, _PostMessageToWorkerGetRunners;
12
+ var _collectorCollectorPort, _runners, _options, _workerId, _archiveDeleteTimeout, _logMessage, _debug, _error, _warn, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _PostRunnersToWorkerManager, _StartRunner, _StopRunnerByRunnerId, _StopRunner, _TerminateRunner, _SendRunnerCommandResponse, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateRunner, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _messages, _archiveDeleteTimeout2, _logMessage2, _debug2, _error2, _warn2, _processLoopExecutor2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitWorkerEvent, _EmitRunnerEvent, _RunnerStateChange, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _StartRunner2, _StopRunner2, _ResetRunner2, _ExecuteRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateRunner2, _StartWorker, _StopWorker, _PauseWorker, _ResumeWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _TerminateWorker, _ProcessWorkerCommands, _ExecuteVariableCommandOnRunners, _STSWorkerManager_instances, GetRunnersResponse_fn, ProcessRunnerResponse_fn, _SyncRunnerData, _SyncWorkerDataFromPayload, _SyncWorkerDataFromWorker, _SyncWorkerDataFromWorkers, _SetupCallbackMessage, _PostMessageToWorkerGetRunners;
13
13
  import { defaultLogger, Sleep, ModelDelimeter } from "@nsshunt/stsutils";
14
14
  import { Gauge } from "@nsshunt/stsobservability";
15
15
  var eIWMessageCommands = /* @__PURE__ */ ((eIWMessageCommands2) => {
@@ -2362,7 +2362,7 @@ class STSWorkerManager {
2362
2362
  }
2363
2363
  if (runnerEx.state !== IRunnerState.terminated) {
2364
2364
  __privateGet(this, _debug2).call(this, chalk.grey(`Archive runner: [${JSON.stringify(runnerEx.asyncRunnerContext)}]`));
2365
- const runner = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx);
2365
+ const runner = this.CreateRunnerCopy(runnerEx);
2366
2366
  __privateGet(this, _archiveList).push(runner);
2367
2367
  if (__privateGet(this, _archiveList).length > __privateGet(this, _options2).maxArchiveListLength) {
2368
2368
  __privateGet(this, _archiveList).shift();
@@ -2400,7 +2400,7 @@ class STSWorkerManager {
2400
2400
  await __privateGet(this, _SyncWorkerDataFromWorkers).call(this);
2401
2401
  const retVal = {};
2402
2402
  for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
2403
- retVal[workerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateWorkerCopy_fn).call(this, workerEx);
2403
+ retVal[workerEx.id] = this.CreateWorkerCopy(workerEx);
2404
2404
  }
2405
2405
  return retVal;
2406
2406
  } catch (error) {
@@ -2416,7 +2416,7 @@ class STSWorkerManager {
2416
2416
  await __privateGet(this, _SyncWorkerDataFromWorkers).call(this);
2417
2417
  const retVal = {};
2418
2418
  for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
2419
- retVal[workerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateWorkerCopySmall_fn).call(this, workerEx, states);
2419
+ retVal[workerEx.id] = this.CreateWorkerCopySmall(workerEx, states);
2420
2420
  }
2421
2421
  return retVal;
2422
2422
  } catch (error) {
@@ -2447,7 +2447,7 @@ class STSWorkerManager {
2447
2447
  __privateGet(this, _debug2).call(this, `GetWorker()`);
2448
2448
  try {
2449
2449
  await __privateGet(this, _SyncWorkerDataFromWorker).call(this, __privateGet(this, _workersEx)[workerId]);
2450
- return __privateMethod(this, _STSWorkerManager_instances, CreateWorkerCopy_fn).call(this, __privateGet(this, _workersEx)[workerId]);
2450
+ return this.CreateWorkerCopy(__privateGet(this, _workersEx)[workerId]);
2451
2451
  } catch (error) {
2452
2452
  __privateGet(this, _error2).call(this, `GetWorker(): Error: [${error}]`);
2453
2453
  throw error;
@@ -2457,7 +2457,7 @@ class STSWorkerManager {
2457
2457
  __privateGet(this, _debug2).call(this, `GetRunner()`);
2458
2458
  try {
2459
2459
  await __privateGet(this, _SyncWorkerDataFromWorker).call(this, __privateGet(this, _workersEx)[workerId]);
2460
- return __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, __privateGet(this, _workersEx)[workerId].runnersEx[runnerId]);
2460
+ return this.CreateRunnerCopy(__privateGet(this, _workersEx)[workerId].runnersEx[runnerId]);
2461
2461
  } catch (error) {
2462
2462
  __privateGet(this, _error2).call(this, `GetRunner(): Error: [${error}]`);
2463
2463
  throw error;
@@ -2677,7 +2677,7 @@ class STSWorkerManager {
2677
2677
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2678
2678
  const payload = {
2679
2679
  messageId,
2680
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2680
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2681
2681
  };
2682
2682
  workerEx.messagePort.postMessage({ command, payload });
2683
2683
  } catch (error) {
@@ -2845,7 +2845,7 @@ class STSWorkerManager {
2845
2845
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2846
2846
  const payload = {
2847
2847
  messageId,
2848
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2848
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2849
2849
  };
2850
2850
  workerEx.messagePort.postMessage({ command, payload });
2851
2851
  } catch (error) {
@@ -2861,7 +2861,7 @@ class STSWorkerManager {
2861
2861
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2862
2862
  const payload = {
2863
2863
  messageId,
2864
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2864
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2865
2865
  };
2866
2866
  workerEx.messagePort.postMessage({ command, payload });
2867
2867
  } catch (error) {
@@ -2877,7 +2877,7 @@ class STSWorkerManager {
2877
2877
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2878
2878
  const payload = {
2879
2879
  messageId,
2880
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2880
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2881
2881
  };
2882
2882
  workerEx.messagePort.postMessage({ command, payload });
2883
2883
  } catch (error) {
@@ -2893,7 +2893,7 @@ class STSWorkerManager {
2893
2893
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2894
2894
  const payload = {
2895
2895
  messageId,
2896
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2896
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2897
2897
  };
2898
2898
  workerEx.messagePort.postMessage({ command, payload });
2899
2899
  } catch (error) {
@@ -2909,7 +2909,7 @@ class STSWorkerManager {
2909
2909
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2910
2910
  const payload = {
2911
2911
  messageId,
2912
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2912
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2913
2913
  };
2914
2914
  workerEx.messagePort.postMessage({ command, payload });
2915
2915
  } catch (error) {
@@ -2925,7 +2925,7 @@ class STSWorkerManager {
2925
2925
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2926
2926
  const payload = {
2927
2927
  messageId,
2928
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2928
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2929
2929
  };
2930
2930
  workerEx.messagePort.postMessage({ command, payload });
2931
2931
  } catch (error) {
@@ -2941,7 +2941,7 @@ class STSWorkerManager {
2941
2941
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2942
2942
  const payload = {
2943
2943
  messageId,
2944
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2944
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2945
2945
  };
2946
2946
  workerEx.messagePort.postMessage({ command, payload });
2947
2947
  } catch (error) {
@@ -2972,7 +2972,7 @@ class STSWorkerManager {
2972
2972
  const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
2973
2973
  const payload = {
2974
2974
  messageId,
2975
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2975
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2976
2976
  };
2977
2977
  workerEx.messagePort.postMessage({ command, payload });
2978
2978
  } catch (error) {
@@ -3303,6 +3303,86 @@ class STSWorkerManager {
3303
3303
  }
3304
3304
  __privateGet(this, _processLoopExecutor2).call(this);
3305
3305
  }
3306
+ CreateRunnerCopyNoHistory(runnerEx) {
3307
+ try {
3308
+ return {
3309
+ id: runnerEx.id,
3310
+ asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
3311
+ instrumentData: { ...runnerEx.instrumentData },
3312
+ iteration: runnerEx.iteration,
3313
+ options: { ...runnerEx.options },
3314
+ state: runnerEx.state,
3315
+ workerId: runnerEx.workerId,
3316
+ workerManagerId: __privateGet(this, _id)
3317
+ };
3318
+ } catch (error) {
3319
+ __privateGet(this, _error2).call(this, `CreateRunnerCopyNoHistory(): Error: [${error}]`);
3320
+ throw error;
3321
+ }
3322
+ }
3323
+ CreateRunnerCopy(runnerEx) {
3324
+ try {
3325
+ const retVal = this.CreateRunnerCopyNoHistory(runnerEx);
3326
+ if (runnerEx.runnerHistory) {
3327
+ retVal.runnerHistory = [...runnerEx.runnerHistory];
3328
+ }
3329
+ return retVal;
3330
+ } catch (error) {
3331
+ __privateGet(this, _error2).call(this, `CreateRunnerCopy(): Error: [${error}]`);
3332
+ throw error;
3333
+ }
3334
+ }
3335
+ CreateRunnerCopySmall(runnerEx) {
3336
+ try {
3337
+ const retVal = {
3338
+ id: runnerEx.id,
3339
+ iteration: runnerEx.iteration,
3340
+ state: runnerEx.state
3341
+ };
3342
+ if (runnerEx.options && runnerEx.options.runnerPlan) {
3343
+ retVal.options = {
3344
+ runnerPlan: { ...runnerEx.options.runnerPlan }
3345
+ };
3346
+ }
3347
+ return retVal;
3348
+ } catch (error) {
3349
+ __privateGet(this, _error2).call(this, `CreateRunnerCopy(): Error: [${error}]`);
3350
+ throw error;
3351
+ }
3352
+ }
3353
+ CreateWorkerCopy(workerEx) {
3354
+ try {
3355
+ const { id, options, runnersEx, workerManagerId } = workerEx;
3356
+ const workerCopy = {
3357
+ id,
3358
+ options: { ...options },
3359
+ runners: {},
3360
+ workerManagerId
3361
+ };
3362
+ for (const [, runnerEx] of Object.entries(runnersEx)) {
3363
+ workerCopy.runners[runnerEx.id] = this.CreateRunnerCopy(runnerEx);
3364
+ }
3365
+ return workerCopy;
3366
+ } catch (error) {
3367
+ __privateGet(this, _error2).call(this, `#CreateWorkerCopy(): Error: [${error}]`);
3368
+ throw error;
3369
+ }
3370
+ }
3371
+ CreateWorkerCopySmall(workerEx, states) {
3372
+ try {
3373
+ const workerCopy = {
3374
+ id: workerEx.id,
3375
+ runners: {}
3376
+ };
3377
+ Object.values(workerEx.runnersEx).filter((runnerEx) => states.length === 0 ? true : states.includes(runnerEx.state)).forEach((runnerEx) => {
3378
+ workerCopy.runners[runnerEx.id] = this.CreateRunnerCopySmall(runnerEx);
3379
+ });
3380
+ return workerCopy;
3381
+ } catch (error) {
3382
+ __privateGet(this, _error2).call(this, `CreateWorkerCopySmall(): Error: [${error}]`);
3383
+ throw error;
3384
+ }
3385
+ }
3306
3386
  get id() {
3307
3387
  return __privateGet(this, _id);
3308
3388
  }
@@ -3328,87 +3408,6 @@ _logMessage2 = new WeakMap();
3328
3408
  _debug2 = new WeakMap();
3329
3409
  _error2 = new WeakMap();
3330
3410
  _warn2 = new WeakMap();
3331
- _STSWorkerManager_instances = new WeakSet();
3332
- CreateRunnerCopyNoHistory_fn = function(runnerEx) {
3333
- try {
3334
- return {
3335
- id: runnerEx.id,
3336
- asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
3337
- instrumentData: { ...runnerEx.instrumentData },
3338
- iteration: runnerEx.iteration,
3339
- options: { ...runnerEx.options },
3340
- state: runnerEx.state,
3341
- workerId: runnerEx.workerId,
3342
- workerManagerId: __privateGet(this, _id)
3343
- };
3344
- } catch (error) {
3345
- __privateGet(this, _error2).call(this, `#CreateRunnerCopyNoHistory(): Error: [${error}]`);
3346
- throw error;
3347
- }
3348
- };
3349
- CreateRunnerCopy_fn = function(runnerEx) {
3350
- try {
3351
- const retVal = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx);
3352
- if (runnerEx.runnerHistory) {
3353
- retVal.runnerHistory = [...runnerEx.runnerHistory];
3354
- }
3355
- return retVal;
3356
- } catch (error) {
3357
- __privateGet(this, _error2).call(this, `#CreateRunnerCopy(): Error: [${error}]`);
3358
- throw error;
3359
- }
3360
- };
3361
- CreateRunnerCopySmall_fn = function(runnerEx) {
3362
- try {
3363
- const retVal = {
3364
- id: runnerEx.id,
3365
- iteration: runnerEx.iteration,
3366
- state: runnerEx.state
3367
- };
3368
- if (runnerEx.options && runnerEx.options.runnerPlan) {
3369
- retVal.options = {
3370
- runnerPlan: { ...runnerEx.options.runnerPlan }
3371
- };
3372
- }
3373
- return retVal;
3374
- } catch (error) {
3375
- __privateGet(this, _error2).call(this, `#CreateRunnerCopy(): Error: [${error}]`);
3376
- throw error;
3377
- }
3378
- };
3379
- CreateWorkerCopy_fn = function(workerEx) {
3380
- try {
3381
- const { id, options, runnersEx, workerManagerId } = workerEx;
3382
- const workerCopy = {
3383
- id,
3384
- options: { ...options },
3385
- runners: {},
3386
- workerManagerId
3387
- };
3388
- for (const [, runnerEx] of Object.entries(runnersEx)) {
3389
- workerCopy.runners[runnerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx);
3390
- }
3391
- return workerCopy;
3392
- } catch (error) {
3393
- __privateGet(this, _error2).call(this, `#CreateWorkerCopy(): Error: [${error}]`);
3394
- throw error;
3395
- }
3396
- };
3397
- CreateWorkerCopySmall_fn = function(workerEx, states) {
3398
- try {
3399
- const workerCopy = {
3400
- id: workerEx.id,
3401
- runners: {}
3402
- };
3403
- Object.values(workerEx.runnersEx).filter((runnerEx) => states.length === 0 ? true : states.includes(runnerEx.state)).forEach((runnerEx) => {
3404
- workerCopy.runners[runnerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopySmall_fn).call(this, runnerEx);
3405
- });
3406
- return workerCopy;
3407
- } catch (error) {
3408
- __privateGet(this, _error2).call(this, `CreateWorkerCopySmall(): Error: [${error}]`);
3409
- throw error;
3410
- }
3411
- };
3412
3411
  _processLoopExecutor2 = new WeakMap();
3413
3412
  _SetRunnerIntoWorker = new WeakMap();
3414
3413
  _ProcessTelemetry = new WeakMap();
@@ -3435,6 +3434,7 @@ _UpdateOptionsWorker = new WeakMap();
3435
3434
  _TerminateWorker = new WeakMap();
3436
3435
  _ProcessWorkerCommands = new WeakMap();
3437
3436
  _ExecuteVariableCommandOnRunners = new WeakMap();
3437
+ _STSWorkerManager_instances = new WeakSet();
3438
3438
  GetRunnersResponse_fn = function(stsWorkerEx, payload) {
3439
3439
  try {
3440
3440
  const messageId = payload.messageId;