@nsshunt/stsrunnerframework 1.0.78 → 1.0.79

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.
@@ -13,7 +13,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
13
13
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
14
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
15
15
 
16
- var _collectorCollectorPort, _runners, _options, _workerId, _debug, _error, _processLoopExecutor, _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, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _processLoopExecutor2, _debug2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _BroadcastCommandToAllRunners, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _BroadcastUpdateCommandToAllRunners, _UpdateOptionsWorker, _TerminateWorker, _UpdateOptions2;
16
+ var _collectorCollectorPort, _runners, _options, _workerId, _debug, _error, _processLoopExecutor, _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, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _processLoopExecutor2, _debug2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateOptionsRunner, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _BroadcastCommandToAllRunners, _TerminateWorker, _HandleAllWorkers;
17
17
  const URI_BASE_VUEUTILS = "/";
18
18
  const STS_RF_RES_PREFIX = "STS_R_RF_";
19
19
  const STS_RF_RES_ENT_PREFIX = "STS_RE_RF_";
@@ -2107,7 +2107,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2107
2107
  TerminateRunner: (runner) => __privateGet(this, _TerminateRunner2).call(this, stsWorkerEx, runner),
2108
2108
  ResetRunner: (runner) => __privateGet(this, _ResetRunner2).call(this, stsWorkerEx, runner),
2109
2109
  ExecuteRunner: (runner) => __privateGet(this, _ExecuteRunner2).call(this, stsWorkerEx, runner),
2110
- UpdateOptionsRunner: (runner, executionProfile) => __privateGet(this, _UpdateOptions2).call(this, stsWorkerEx, runner, executionProfile),
2110
+ UpdateOptionsRunner: (runner, executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, stsWorkerEx, runner, executionProfile),
2111
2111
  // Commands to execute on all runners
2112
2112
  Start: async () => __privateGet(this, _StartWorker).call(this, stsWorkerEx),
2113
2113
  Stop: async () => __privateGet(this, _StopWorker).call(this, stsWorkerEx),
@@ -2320,7 +2320,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2320
2320
  Reset: async () => __privateGet(this, _ResetRunner2).call(this, workerEx, runnerEx),
2321
2321
  Execute: async () => __privateGet(this, _ExecuteRunner2).call(this, workerEx, runnerEx),
2322
2322
  Terminate: async () => __privateGet(this, _TerminateRunner2).call(this, workerEx, runnerEx),
2323
- UpdateOptions: async (executionProfile) => __privateGet(this, _UpdateOptions2).call(this, workerEx, runnerEx, executionProfile),
2323
+ UpdateOptions: async (executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, workerEx, runnerEx, executionProfile),
2324
2324
  on: (eventName, cb) => {
2325
2325
  if (!workerEx.runnersEvents[runnerEx.id]) {
2326
2326
  workerEx.runnersEvents[runnerEx.id] = [];
@@ -2390,24 +2390,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2390
2390
  });
2391
2391
  return true;
2392
2392
  });
2393
- __privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, options) => {
2394
- try {
2395
- const promArray = [];
2396
- const ids = Object.keys(workerEx.runnersEx);
2397
- ids.forEach((id) => {
2398
- const runnerEx = workerEx.runnersEx[id];
2399
- if (options) {
2400
- promArray.push(command(workerEx, runnerEx, options));
2401
- } else {
2402
- promArray.push(command(workerEx, runnerEx));
2403
- }
2404
- });
2405
- await Promise.all(promArray);
2406
- return true;
2407
- } catch (error) {
2408
- console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
2409
- return false;
2410
- }
2393
+ __privateAdd(this, _UpdateOptionsRunner, async (workerEx, runnerEx, executionProfile) => {
2394
+ runnerEx.options.executionProfile = { ...executionProfile };
2395
+ __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2396
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2397
+ });
2398
+ return true;
2411
2399
  });
2412
2400
  __privateAdd(this, _PauseWorker, async (workerEx) => {
2413
2401
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _PauseRunner2));
@@ -2427,51 +2415,43 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2427
2415
  __privateAdd(this, _ExecuteWorker, async (workerEx) => {
2428
2416
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _ExecuteRunner2));
2429
2417
  });
2430
- __privateAdd(this, _BroadcastUpdateCommandToAllRunners, async (workerEx, command, executionProfile) => {
2418
+ // IExecutionProfile
2419
+ __privateAdd(this, _UpdateOptionsWorker, async (workerEx, executionProfile) => {
2420
+ return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _UpdateOptionsRunner), executionProfile);
2421
+ });
2422
+ __privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, executionProfile) => {
2431
2423
  try {
2432
- const promArray = [];
2433
- const ids = Object.keys(workerEx.runnersEx);
2434
- ids.forEach((id) => {
2435
- const runnerEx = workerEx.runnersEx[id];
2436
- if (executionProfile) {
2437
- promArray.push(command(workerEx, runnerEx, executionProfile));
2438
- } else {
2439
- promArray.push(command(workerEx, runnerEx));
2440
- }
2441
- });
2442
- await Promise.all(promArray);
2443
- return true;
2424
+ const executeCommand = async (runnerEx) => {
2425
+ const result = executionProfile ? await command(workerEx, runnerEx, executionProfile) : await command(workerEx, runnerEx);
2426
+ return {
2427
+ workerManagerId: __privateGet(this, _id),
2428
+ workerId: workerEx.id,
2429
+ runnerId: runnerEx.id,
2430
+ result
2431
+ };
2432
+ };
2433
+ const promises = Object.values(workerEx.runnersEx).map((runnerEx) => executeCommand(runnerEx));
2434
+ return await Promise.all(promises);
2444
2435
  } catch (error) {
2445
- console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
2446
- return false;
2436
+ console.error(`Error in STSTestWorker:WorkerCommand: [${error}]`);
2437
+ return [];
2447
2438
  }
2448
2439
  });
2449
- // IExecutionProfile
2450
- __privateAdd(this, _UpdateOptionsWorker, async (workerEx, executionProfile) => {
2451
- return __privateGet(this, _BroadcastUpdateCommandToAllRunners).call(this, workerEx, __privateGet(this, _UpdateOptions2), executionProfile);
2452
- });
2453
2440
  __privateAdd(this, _TerminateWorker, async (workerEx) => {
2454
2441
  try {
2455
- await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2442
+ const retVal = await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2456
2443
  if (workerEx.worker) {
2457
2444
  workerEx.worker.terminate();
2458
2445
  __privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
2459
2446
  delete __privateGet(this, _workersEx)[workerEx.id];
2460
2447
  } else {
2461
2448
  }
2462
- return true;
2449
+ return retVal;
2463
2450
  } catch (error) {
2464
2451
  console.log(`Error in STSTestWorker:TerminateWorker: [${error}]`);
2465
- return false;
2452
+ return [];
2466
2453
  }
2467
2454
  });
2468
- __privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
2469
- runnerEx.options.executionProfile = { ...executionProfile };
2470
- __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2471
- runner: this.CreateRunnerCopyNoHistory(runnerEx)
2472
- });
2473
- return true;
2474
- });
2475
2455
  __publicField(this, "GetNextAvailableWorker", () => {
2476
2456
  let leastRunnerWorker = null;
2477
2457
  for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
@@ -2498,61 +2478,48 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2498
2478
  }
2499
2479
  return busyWorker;
2500
2480
  });
2481
+ // IExecuteRunnerActionResult[]
2482
+ __privateAdd(this, _HandleAllWorkers, async (action, options) => {
2483
+ const promises = Object.values(this.WorkersEx).map(async (worker) => {
2484
+ if (action === "UpdateOptions") {
2485
+ return {
2486
+ workerManagerId: __privateGet(this, _id),
2487
+ workerId: worker.id,
2488
+ executeRunnerActionResults: await worker[action](options)
2489
+ };
2490
+ } else {
2491
+ return {
2492
+ workerManagerId: __privateGet(this, _id),
2493
+ workerId: worker.id,
2494
+ executeRunnerActionResults: await worker[action]()
2495
+ };
2496
+ }
2497
+ });
2498
+ return Promise.all(promises);
2499
+ });
2501
2500
  __publicField(this, "StartAllWorkers", async () => {
2502
- const promArray = [];
2503
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2504
- promArray.push(stsWorker.Start());
2505
- }
2506
- return await Promise.all(promArray);
2501
+ return __privateGet(this, _HandleAllWorkers).call(this, "Start");
2507
2502
  });
2508
- __publicField(this, "StopAllWorkers", async () => {
2509
- const promArray = [];
2510
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2511
- promArray.push(stsWorker.Stop());
2512
- }
2513
- return await Promise.all(promArray);
2503
+ __publicField(this, "StopAllWorkers", () => {
2504
+ return __privateGet(this, _HandleAllWorkers).call(this, "Stop");
2514
2505
  });
2515
- __publicField(this, "PauseAllWorkers", async () => {
2516
- const promArray = [];
2517
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2518
- promArray.push(stsWorker.Pause());
2519
- }
2520
- return await Promise.all(promArray);
2506
+ __publicField(this, "PauseAllWorkers", () => {
2507
+ return __privateGet(this, _HandleAllWorkers).call(this, "Pause");
2521
2508
  });
2522
2509
  __publicField(this, "ResumeAllWorkers", async () => {
2523
- const promArray = [];
2524
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2525
- promArray.push(stsWorker.Resume());
2526
- }
2527
- return await Promise.all(promArray);
2510
+ return __privateGet(this, _HandleAllWorkers).call(this, "Resume");
2528
2511
  });
2529
2512
  __publicField(this, "ExecuteAllWorkers", async () => {
2530
- const promArray = [];
2531
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2532
- promArray.push(stsWorker.Execute());
2533
- }
2534
- return await Promise.all(promArray);
2513
+ return __privateGet(this, _HandleAllWorkers).call(this, "Execute");
2535
2514
  });
2536
2515
  __publicField(this, "ResetAllWorkers", async () => {
2537
- const promArray = [];
2538
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2539
- promArray.push(stsWorker.Reset());
2540
- }
2541
- return await Promise.all(promArray);
2542
- });
2543
- __publicField(this, "UpdateAllWorkers", async (options) => {
2544
- const promArray = [];
2545
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2546
- promArray.push(stsWorker.UpdateOptions(options));
2547
- }
2548
- return await Promise.all(promArray);
2516
+ return __privateGet(this, _HandleAllWorkers).call(this, "Reset");
2549
2517
  });
2550
2518
  __publicField(this, "TerminateAllWorkers", async () => {
2551
- const promArray = [];
2552
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2553
- promArray.push(stsWorker.Terminate());
2554
- }
2555
- return await Promise.all(promArray);
2519
+ return __privateGet(this, _HandleAllWorkers).call(this, "Terminate");
2520
+ });
2521
+ __publicField(this, "UpdateAllWorkers", async (options) => {
2522
+ return __privateGet(this, _HandleAllWorkers).call(this, "UpdateOptions", options);
2556
2523
  });
2557
2524
  __privateSet(this, _id, v4());
2558
2525
  if (options) {
@@ -2644,17 +2611,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2644
2611
  _TerminateRunner2 = new WeakMap();
2645
2612
  _PauseRunner2 = new WeakMap();
2646
2613
  _ResumeRunner2 = new WeakMap();
2647
- _BroadcastCommandToAllRunners = new WeakMap();
2614
+ _UpdateOptionsRunner = new WeakMap();
2648
2615
  _PauseWorker = new WeakMap();
2649
2616
  _ResumeWorker = new WeakMap();
2650
2617
  _StopWorker = new WeakMap();
2651
2618
  _StartWorker = new WeakMap();
2652
2619
  _ResetWorker = new WeakMap();
2653
2620
  _ExecuteWorker = new WeakMap();
2654
- _BroadcastUpdateCommandToAllRunners = new WeakMap();
2655
2621
  _UpdateOptionsWorker = new WeakMap();
2622
+ _BroadcastCommandToAllRunners = new WeakMap();
2656
2623
  _TerminateWorker = new WeakMap();
2657
- _UpdateOptions2 = new WeakMap();
2624
+ _HandleAllWorkers = new WeakMap();
2658
2625
  exports2.IRunnerState = IRunnerState;
2659
2626
  exports2.IWorkerState = IWorkerState;
2660
2627
  exports2.PublishMessageCommandsTestRunner = PublishMessageCommandsTestRunner;