@nsshunt/stsrunnerframework 1.0.78 → 1.0.80

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, _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;
12
+ 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;
13
13
  import { defaultLogger, Sleep, ModelDelimeter } from "@nsshunt/stsutils";
14
14
  import { Gauge } from "@nsshunt/stsobservability";
15
15
  const URI_BASE_VUEUTILS = "/";
@@ -2105,7 +2105,7 @@ class STSWorkerManager {
2105
2105
  TerminateRunner: (runner) => __privateGet(this, _TerminateRunner2).call(this, stsWorkerEx, runner),
2106
2106
  ResetRunner: (runner) => __privateGet(this, _ResetRunner2).call(this, stsWorkerEx, runner),
2107
2107
  ExecuteRunner: (runner) => __privateGet(this, _ExecuteRunner2).call(this, stsWorkerEx, runner),
2108
- UpdateOptionsRunner: (runner, executionProfile) => __privateGet(this, _UpdateOptions2).call(this, stsWorkerEx, runner, executionProfile),
2108
+ UpdateOptionsRunner: (runner, executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, stsWorkerEx, runner, executionProfile),
2109
2109
  // Commands to execute on all runners
2110
2110
  Start: async () => __privateGet(this, _StartWorker).call(this, stsWorkerEx),
2111
2111
  Stop: async () => __privateGet(this, _StopWorker).call(this, stsWorkerEx),
@@ -2318,7 +2318,7 @@ class STSWorkerManager {
2318
2318
  Reset: async () => __privateGet(this, _ResetRunner2).call(this, workerEx, runnerEx),
2319
2319
  Execute: async () => __privateGet(this, _ExecuteRunner2).call(this, workerEx, runnerEx),
2320
2320
  Terminate: async () => __privateGet(this, _TerminateRunner2).call(this, workerEx, runnerEx),
2321
- UpdateOptions: async (executionProfile) => __privateGet(this, _UpdateOptions2).call(this, workerEx, runnerEx, executionProfile),
2321
+ UpdateOptions: async (executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, workerEx, runnerEx, executionProfile),
2322
2322
  on: (eventName, cb) => {
2323
2323
  if (!workerEx.runnersEvents[runnerEx.id]) {
2324
2324
  workerEx.runnersEvents[runnerEx.id] = [];
@@ -2350,62 +2350,90 @@ class STSWorkerManager {
2350
2350
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StartRunner, {
2351
2351
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2352
2352
  });
2353
- return true;
2353
+ return {
2354
+ workerManagerId: __privateGet(this, _id),
2355
+ workerId: workerEx.id,
2356
+ runnerId: runnerEx.id,
2357
+ result: true
2358
+ };
2354
2359
  });
2355
2360
  __privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
2356
2361
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResetRunner, {
2357
2362
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2358
2363
  });
2359
- return true;
2364
+ return {
2365
+ workerManagerId: __privateGet(this, _id),
2366
+ workerId: workerEx.id,
2367
+ runnerId: runnerEx.id,
2368
+ result: true
2369
+ };
2360
2370
  });
2361
2371
  __privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
2362
2372
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ExecuteRunner, {
2363
2373
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2364
2374
  });
2365
- return true;
2375
+ return {
2376
+ workerManagerId: __privateGet(this, _id),
2377
+ workerId: workerEx.id,
2378
+ runnerId: runnerEx.id,
2379
+ result: true
2380
+ };
2366
2381
  });
2367
2382
  __privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
2368
2383
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StopRunner, {
2369
2384
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2370
2385
  });
2371
- return true;
2386
+ return {
2387
+ workerManagerId: __privateGet(this, _id),
2388
+ workerId: workerEx.id,
2389
+ runnerId: runnerEx.id,
2390
+ result: true
2391
+ };
2372
2392
  });
2373
2393
  __privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
2374
2394
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.TerminateRunner, {
2375
2395
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2376
2396
  });
2377
- return true;
2397
+ return {
2398
+ workerManagerId: __privateGet(this, _id),
2399
+ workerId: workerEx.id,
2400
+ runnerId: runnerEx.id,
2401
+ result: true
2402
+ };
2378
2403
  });
2379
2404
  __privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
2380
2405
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.PauseRunner, {
2381
2406
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2382
2407
  });
2383
- return true;
2408
+ return {
2409
+ workerManagerId: __privateGet(this, _id),
2410
+ workerId: workerEx.id,
2411
+ runnerId: runnerEx.id,
2412
+ result: true
2413
+ };
2384
2414
  });
2385
2415
  __privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
2386
2416
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResumeRunner, {
2387
2417
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2388
2418
  });
2389
- return true;
2419
+ return {
2420
+ workerManagerId: __privateGet(this, _id),
2421
+ workerId: workerEx.id,
2422
+ runnerId: runnerEx.id,
2423
+ result: true
2424
+ };
2390
2425
  });
2391
- __privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, options) => {
2392
- try {
2393
- const promArray = [];
2394
- const ids = Object.keys(workerEx.runnersEx);
2395
- ids.forEach((id) => {
2396
- const runnerEx = workerEx.runnersEx[id];
2397
- if (options) {
2398
- promArray.push(command(workerEx, runnerEx, options));
2399
- } else {
2400
- promArray.push(command(workerEx, runnerEx));
2401
- }
2402
- });
2403
- await Promise.all(promArray);
2404
- return true;
2405
- } catch (error) {
2406
- console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
2407
- return false;
2408
- }
2426
+ __privateAdd(this, _UpdateOptionsRunner, async (workerEx, runnerEx, executionProfile) => {
2427
+ runnerEx.options.executionProfile = { ...executionProfile };
2428
+ __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2429
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2430
+ });
2431
+ return {
2432
+ workerManagerId: __privateGet(this, _id),
2433
+ workerId: workerEx.id,
2434
+ runnerId: runnerEx.id,
2435
+ result: true
2436
+ };
2409
2437
  });
2410
2438
  __privateAdd(this, _PauseWorker, async (workerEx) => {
2411
2439
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _PauseRunner2));
@@ -2425,51 +2453,43 @@ class STSWorkerManager {
2425
2453
  __privateAdd(this, _ExecuteWorker, async (workerEx) => {
2426
2454
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _ExecuteRunner2));
2427
2455
  });
2428
- __privateAdd(this, _BroadcastUpdateCommandToAllRunners, async (workerEx, command, executionProfile) => {
2456
+ // IExecutionProfile
2457
+ __privateAdd(this, _UpdateOptionsWorker, async (workerEx, executionProfile) => {
2458
+ return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _UpdateOptionsRunner), executionProfile);
2459
+ });
2460
+ __privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, executionProfile) => {
2429
2461
  try {
2430
- const promArray = [];
2431
- const ids = Object.keys(workerEx.runnersEx);
2432
- ids.forEach((id) => {
2433
- const runnerEx = workerEx.runnersEx[id];
2434
- if (executionProfile) {
2435
- promArray.push(command(workerEx, runnerEx, executionProfile));
2436
- } else {
2437
- promArray.push(command(workerEx, runnerEx));
2438
- }
2439
- });
2440
- await Promise.all(promArray);
2441
- return true;
2462
+ const executeCommand = async (runnerEx) => {
2463
+ const result = executionProfile ? await command(workerEx, runnerEx, executionProfile) : await command(workerEx, runnerEx);
2464
+ return {
2465
+ workerManagerId: __privateGet(this, _id),
2466
+ workerId: workerEx.id,
2467
+ runnerId: runnerEx.id,
2468
+ result
2469
+ };
2470
+ };
2471
+ const promises = Object.values(workerEx.runnersEx).map((runnerEx) => executeCommand(runnerEx));
2472
+ return await Promise.all(promises);
2442
2473
  } catch (error) {
2443
- console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
2444
- return false;
2474
+ console.error(`Error in STSTestWorker:WorkerCommand: [${error}]`);
2475
+ return [];
2445
2476
  }
2446
2477
  });
2447
- // IExecutionProfile
2448
- __privateAdd(this, _UpdateOptionsWorker, async (workerEx, executionProfile) => {
2449
- return __privateGet(this, _BroadcastUpdateCommandToAllRunners).call(this, workerEx, __privateGet(this, _UpdateOptions2), executionProfile);
2450
- });
2451
2478
  __privateAdd(this, _TerminateWorker, async (workerEx) => {
2452
2479
  try {
2453
- await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2480
+ const retVal = await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2454
2481
  if (workerEx.worker) {
2455
2482
  workerEx.worker.terminate();
2456
2483
  __privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
2457
2484
  delete __privateGet(this, _workersEx)[workerEx.id];
2458
2485
  } else {
2459
2486
  }
2460
- return true;
2487
+ return retVal;
2461
2488
  } catch (error) {
2462
2489
  console.log(`Error in STSTestWorker:TerminateWorker: [${error}]`);
2463
- return false;
2490
+ return [];
2464
2491
  }
2465
2492
  });
2466
- __privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
2467
- runnerEx.options.executionProfile = { ...executionProfile };
2468
- __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2469
- runner: this.CreateRunnerCopyNoHistory(runnerEx)
2470
- });
2471
- return true;
2472
- });
2473
2493
  __publicField(this, "GetNextAvailableWorker", () => {
2474
2494
  let leastRunnerWorker = null;
2475
2495
  for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
@@ -2496,61 +2516,48 @@ class STSWorkerManager {
2496
2516
  }
2497
2517
  return busyWorker;
2498
2518
  });
2519
+ // IExecuteRunnerActionResult[]
2520
+ __privateAdd(this, _HandleAllWorkers, async (action, options) => {
2521
+ const promises = Object.values(this.WorkersEx).map(async (worker) => {
2522
+ if (action === "UpdateOptions") {
2523
+ return {
2524
+ workerManagerId: __privateGet(this, _id),
2525
+ workerId: worker.id,
2526
+ executeRunnerActionResults: await worker[action](options)
2527
+ };
2528
+ } else {
2529
+ return {
2530
+ workerManagerId: __privateGet(this, _id),
2531
+ workerId: worker.id,
2532
+ executeRunnerActionResults: await worker[action]()
2533
+ };
2534
+ }
2535
+ });
2536
+ return Promise.all(promises);
2537
+ });
2499
2538
  __publicField(this, "StartAllWorkers", async () => {
2500
- const promArray = [];
2501
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2502
- promArray.push(stsWorker.Start());
2503
- }
2504
- return await Promise.all(promArray);
2539
+ return __privateGet(this, _HandleAllWorkers).call(this, "Start");
2505
2540
  });
2506
- __publicField(this, "StopAllWorkers", async () => {
2507
- const promArray = [];
2508
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2509
- promArray.push(stsWorker.Stop());
2510
- }
2511
- return await Promise.all(promArray);
2541
+ __publicField(this, "StopAllWorkers", () => {
2542
+ return __privateGet(this, _HandleAllWorkers).call(this, "Stop");
2512
2543
  });
2513
- __publicField(this, "PauseAllWorkers", async () => {
2514
- const promArray = [];
2515
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2516
- promArray.push(stsWorker.Pause());
2517
- }
2518
- return await Promise.all(promArray);
2544
+ __publicField(this, "PauseAllWorkers", () => {
2545
+ return __privateGet(this, _HandleAllWorkers).call(this, "Pause");
2519
2546
  });
2520
2547
  __publicField(this, "ResumeAllWorkers", async () => {
2521
- const promArray = [];
2522
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2523
- promArray.push(stsWorker.Resume());
2524
- }
2525
- return await Promise.all(promArray);
2548
+ return __privateGet(this, _HandleAllWorkers).call(this, "Resume");
2526
2549
  });
2527
2550
  __publicField(this, "ExecuteAllWorkers", async () => {
2528
- const promArray = [];
2529
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2530
- promArray.push(stsWorker.Execute());
2531
- }
2532
- return await Promise.all(promArray);
2551
+ return __privateGet(this, _HandleAllWorkers).call(this, "Execute");
2533
2552
  });
2534
2553
  __publicField(this, "ResetAllWorkers", async () => {
2535
- const promArray = [];
2536
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2537
- promArray.push(stsWorker.Reset());
2538
- }
2539
- return await Promise.all(promArray);
2540
- });
2541
- __publicField(this, "UpdateAllWorkers", async (options) => {
2542
- const promArray = [];
2543
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2544
- promArray.push(stsWorker.UpdateOptions(options));
2545
- }
2546
- return await Promise.all(promArray);
2554
+ return __privateGet(this, _HandleAllWorkers).call(this, "Reset");
2547
2555
  });
2548
2556
  __publicField(this, "TerminateAllWorkers", async () => {
2549
- const promArray = [];
2550
- for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
2551
- promArray.push(stsWorker.Terminate());
2552
- }
2553
- return await Promise.all(promArray);
2557
+ return __privateGet(this, _HandleAllWorkers).call(this, "Terminate");
2558
+ });
2559
+ __publicField(this, "UpdateAllWorkers", async (options) => {
2560
+ return __privateGet(this, _HandleAllWorkers).call(this, "UpdateOptions", options);
2554
2561
  });
2555
2562
  __privateSet(this, _id, v4());
2556
2563
  if (options) {
@@ -2642,17 +2649,17 @@ _StopRunner2 = new WeakMap();
2642
2649
  _TerminateRunner2 = new WeakMap();
2643
2650
  _PauseRunner2 = new WeakMap();
2644
2651
  _ResumeRunner2 = new WeakMap();
2645
- _BroadcastCommandToAllRunners = new WeakMap();
2652
+ _UpdateOptionsRunner = new WeakMap();
2646
2653
  _PauseWorker = new WeakMap();
2647
2654
  _ResumeWorker = new WeakMap();
2648
2655
  _StopWorker = new WeakMap();
2649
2656
  _StartWorker = new WeakMap();
2650
2657
  _ResetWorker = new WeakMap();
2651
2658
  _ExecuteWorker = new WeakMap();
2652
- _BroadcastUpdateCommandToAllRunners = new WeakMap();
2653
2659
  _UpdateOptionsWorker = new WeakMap();
2660
+ _BroadcastCommandToAllRunners = new WeakMap();
2654
2661
  _TerminateWorker = new WeakMap();
2655
- _UpdateOptions2 = new WeakMap();
2662
+ _HandleAllWorkers = new WeakMap();
2656
2663
  export {
2657
2664
  IRunnerState,
2658
2665
  IWorkerState,