@nsshunt/stsrunnerframework 1.0.71 → 1.0.73

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, _processLoopExecutor2, _debug2, _STSWorkerManager_instances, CreateRunnerCopy_fn, _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, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn, CreateRunnerCopy_fn, CreateWorkerCopy_fn, _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;
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_";
@@ -2050,20 +2050,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2050
2050
  const runnerEx = workerEx.runnersEx[removeList[i].runnerId];
2051
2051
  if (runnerEx) {
2052
2052
  if (runnerEx.publishInstrumentController) {
2053
- console.log(chalk.magenta(`Ending publish for runner: [${JSON.stringify(runnerEx.asyncRunnerContext)}]`));
2053
+ __privateGet(this, _debug2).call(this, chalk.grey(`Ending publish for runner: [${JSON.stringify(runnerEx.asyncRunnerContext)}]`));
2054
2054
  await runnerEx.publishInstrumentController.EndPublish();
2055
2055
  await stsutils.Sleep(250);
2056
2056
  }
2057
- const runner = {
2058
- id: runnerEx.id,
2059
- asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
2060
- instrumentData: { ...runnerEx.instrumentData },
2061
- iteration: runnerEx.iteration,
2062
- options: { ...runnerEx.options },
2063
- runnerHistory: [...runnerEx.runnerHistory],
2064
- state: runnerEx.state,
2065
- workerId: runnerEx.workerId
2066
- };
2057
+ const runner = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx);
2067
2058
  __privateGet(this, _archiveList).push(runner);
2068
2059
  if (__privateGet(this, _archiveList).length > __privateGet(this, _options2).maxArchiveListLength) {
2069
2060
  __privateGet(this, _archiveList).shift();
@@ -2072,6 +2063,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2072
2063
  }
2073
2064
  }
2074
2065
  }
2066
+ for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
2067
+ __privateGet(this, _debug2).call(this, chalk.grey(`STSWorkerManager:#processLoopExecutor(): Remaining runners from worker: [${workerEx.id}]: [${Object.keys(workerEx.runnersEx).length}]`));
2068
+ }
2075
2069
  setTimeout(__privateGet(this, _processLoopExecutor2), 1e3);
2076
2070
  }, 100);
2077
2071
  } else {
@@ -2099,7 +2093,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2099
2093
  id: workerId,
2100
2094
  worker: workerFactory.createWorkerThreadWorker(),
2101
2095
  messagePort: port1,
2102
- state: IWorkerState.starting,
2103
2096
  workerThreadWorkerOptions: workerFactory.workerThreadWorkerOptions,
2104
2097
  runnersEx: {},
2105
2098
  runnersEvents: {},
@@ -2171,17 +2164,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2171
2164
  const publishMessagePayload2 = data;
2172
2165
  switch (publishMessagePayload2.command) {
2173
2166
  case eIWMessageCommands.MessagePortResponse:
2174
- stsWorkerEx.state = IWorkerState.started;
2167
+ __privateGet(this, _debug2).call(this, `AddWorker:processMessage(): eIWMessageCommands.MessagePortResponse`);
2175
2168
  break;
2176
2169
  case eIWMessageCommands.InstrumentTelemetry:
2177
2170
  __privateGet(this, _ProcessTelemetry).call(this, stsWorkerEx, publishMessagePayload2.payload);
2178
2171
  break;
2179
- /*
2180
- case eIWMessageCommands.Completed :
2181
- //this.#debug(`AddWorker::eIWMessageCommands.InstrumentTelemetry`);
2182
- this.#ProcessCompleted(stsWorkerEx, publishMessagePayload.payload as ITestRunnerTelemetryPayload);
2183
- break;
2184
- */
2185
2172
  case eIWMessageCommands.RunnerStateChange:
2186
2173
  __privateGet(this, _RunnerStateChange).call(this, stsWorkerEx, publishMessagePayload2.payload);
2187
2174
  break;
@@ -2221,7 +2208,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2221
2208
  });
2222
2209
  __privateAdd(this, _SetRunnerIntoWorker, (workerEx, runnerEx) => {
2223
2210
  const payload = {
2224
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2211
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2225
2212
  };
2226
2213
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.AddRunner, payload);
2227
2214
  });
@@ -2259,6 +2246,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2259
2246
  if (workerEx.runnersEx[runner.id]) {
2260
2247
  const runnerEx = workerEx.runnersEx[runner.id];
2261
2248
  runnerEx.state = runner.state;
2249
+ if (!runnerEx.runnerHistory) {
2250
+ runnerEx.runnerHistory = [];
2251
+ }
2262
2252
  runnerEx.runnerHistory.push({
2263
2253
  eventDate: /* @__PURE__ */ new Date(),
2264
2254
  runner: { ...runner }
@@ -2358,61 +2348,59 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2358
2348
  });
2359
2349
  __privateAdd(this, _StartRunner2, async (workerEx, runnerEx) => {
2360
2350
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StartRunner, {
2361
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2351
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2362
2352
  });
2363
2353
  return true;
2364
2354
  });
2365
2355
  __privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
2366
2356
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResetRunner, {
2367
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2357
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2368
2358
  });
2369
2359
  return true;
2370
2360
  });
2371
2361
  __privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
2372
2362
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ExecuteRunner, {
2373
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2363
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2374
2364
  });
2375
2365
  return true;
2376
2366
  });
2377
2367
  __privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
2378
2368
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StopRunner, {
2379
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2369
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2380
2370
  });
2381
2371
  return true;
2382
2372
  });
2383
2373
  __privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
2384
2374
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.TerminateRunner, {
2385
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2375
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2386
2376
  });
2387
2377
  return true;
2388
2378
  });
2389
2379
  __privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
2390
2380
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.PauseRunner, {
2391
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2381
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2392
2382
  });
2393
2383
  return true;
2394
2384
  });
2395
2385
  __privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
2396
2386
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResumeRunner, {
2397
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2387
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2398
2388
  });
2399
2389
  return true;
2400
2390
  });
2401
2391
  __privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, options) => {
2402
2392
  try {
2403
- if (workerEx.state !== IWorkerState.stopped) {
2404
- const promArray = [];
2405
- const ids = Object.keys(workerEx.runnersEx);
2406
- ids.forEach((id) => {
2407
- const runnerEx = workerEx.runnersEx[id];
2408
- if (options) {
2409
- promArray.push(command(workerEx, runnerEx, options));
2410
- } else {
2411
- promArray.push(command(workerEx, runnerEx));
2412
- }
2413
- });
2414
- await Promise.all(promArray);
2415
- }
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);
2416
2404
  return true;
2417
2405
  } catch (error) {
2418
2406
  console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
@@ -2439,19 +2427,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2439
2427
  });
2440
2428
  __privateAdd(this, _BroadcastUpdateCommandToAllRunners, async (workerEx, command, executionProfile) => {
2441
2429
  try {
2442
- if (workerEx.state !== IWorkerState.stopped) {
2443
- const promArray = [];
2444
- const ids = Object.keys(workerEx.runnersEx);
2445
- ids.forEach((id) => {
2446
- const runnerEx = workerEx.runnersEx[id];
2447
- if (executionProfile) {
2448
- promArray.push(command(workerEx, runnerEx, executionProfile));
2449
- } else {
2450
- promArray.push(command(workerEx, runnerEx));
2451
- }
2452
- });
2453
- await Promise.all(promArray);
2454
- }
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);
2455
2441
  return true;
2456
2442
  } catch (error) {
2457
2443
  console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
@@ -2464,14 +2450,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2464
2450
  });
2465
2451
  __privateAdd(this, _TerminateWorker, async (workerEx) => {
2466
2452
  try {
2467
- if (workerEx.state !== IWorkerState.stopped) {
2468
- await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2469
- if (workerEx.worker) {
2470
- workerEx.worker.terminate();
2471
- __privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
2472
- delete __privateGet(this, _workersEx)[workerEx.id];
2473
- } else {
2474
- }
2453
+ await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2454
+ if (workerEx.worker) {
2455
+ workerEx.worker.terminate();
2456
+ __privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
2457
+ delete __privateGet(this, _workersEx)[workerEx.id];
2458
+ } else {
2475
2459
  }
2476
2460
  return true;
2477
2461
  } catch (error) {
@@ -2482,7 +2466,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2482
2466
  __privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
2483
2467
  runnerEx.options.executionProfile = { ...executionProfile };
2484
2468
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2485
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2469
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2486
2470
  });
2487
2471
  return true;
2488
2472
  });
@@ -2579,6 +2563,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2579
2563
  }
2580
2564
  __privateGet(this, _processLoopExecutor2).call(this);
2581
2565
  }
2566
+ get Workers() {
2567
+ const retVal = {};
2568
+ for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
2569
+ retVal[workerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateWorkerCopy_fn).call(this, workerEx);
2570
+ }
2571
+ return retVal;
2572
+ }
2582
2573
  get WorkersEx() {
2583
2574
  return __privateGet(this, _workersEx);
2584
2575
  }
@@ -2597,19 +2588,39 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2597
2588
  _STSInstrumentController = new WeakMap();
2598
2589
  _telemetryProcessor = new WeakMap();
2599
2590
  _archiveList = new WeakMap();
2600
- _processLoopExecutor2 = new WeakMap();
2601
- _debug2 = new WeakMap();
2602
2591
  _STSWorkerManager_instances = new WeakSet();
2603
- CreateRunnerCopy_fn = function(runnerEx) {
2592
+ CreateRunnerCopyNoHistory_fn = function(runnerEx) {
2604
2593
  return {
2605
2594
  id: runnerEx.id,
2606
2595
  asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
2607
- options: { ...runnerEx.options },
2608
2596
  instrumentData: { ...runnerEx.instrumentData },
2609
2597
  iteration: runnerEx.iteration,
2610
- state: runnerEx.state
2598
+ options: { ...runnerEx.options },
2599
+ state: runnerEx.state,
2600
+ workerId: runnerEx.workerId
2611
2601
  };
2612
2602
  };
2603
+ CreateRunnerCopy_fn = function(runnerEx) {
2604
+ const retVal = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx);
2605
+ if (runnerEx.runnerHistory) {
2606
+ retVal.runnerHistory = [...runnerEx.runnerHistory];
2607
+ }
2608
+ return retVal;
2609
+ };
2610
+ CreateWorkerCopy_fn = function(workerEx) {
2611
+ const { id, workerThreadWorkerOptions, runnersEx } = workerEx;
2612
+ const workerCopy = {
2613
+ id,
2614
+ workerThreadWorkerOptions: { ...workerThreadWorkerOptions },
2615
+ runners: {}
2616
+ };
2617
+ for (const [, runnerEx] of Object.entries(runnersEx)) {
2618
+ workerCopy.runners[runnerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx);
2619
+ }
2620
+ return workerCopy;
2621
+ };
2622
+ _processLoopExecutor2 = new WeakMap();
2623
+ _debug2 = new WeakMap();
2613
2624
  _SetRunnerIntoWorker = new WeakMap();
2614
2625
  _ProcessTelemetry = new WeakMap();
2615
2626
  _EmitEvent = new WeakMap();