@nsshunt/stsrunnerframework 1.0.72 → 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_";
@@ -2054,16 +2054,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
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();
@@ -2102,7 +2093,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2102
2093
  id: workerId,
2103
2094
  worker: workerFactory.createWorkerThreadWorker(),
2104
2095
  messagePort: port1,
2105
- state: IWorkerState.starting,
2106
2096
  workerThreadWorkerOptions: workerFactory.workerThreadWorkerOptions,
2107
2097
  runnersEx: {},
2108
2098
  runnersEvents: {},
@@ -2174,17 +2164,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2174
2164
  const publishMessagePayload2 = data;
2175
2165
  switch (publishMessagePayload2.command) {
2176
2166
  case eIWMessageCommands.MessagePortResponse:
2177
- stsWorkerEx.state = IWorkerState.started;
2167
+ __privateGet(this, _debug2).call(this, `AddWorker:processMessage(): eIWMessageCommands.MessagePortResponse`);
2178
2168
  break;
2179
2169
  case eIWMessageCommands.InstrumentTelemetry:
2180
2170
  __privateGet(this, _ProcessTelemetry).call(this, stsWorkerEx, publishMessagePayload2.payload);
2181
2171
  break;
2182
- /*
2183
- case eIWMessageCommands.Completed :
2184
- //this.#debug(`AddWorker::eIWMessageCommands.InstrumentTelemetry`);
2185
- this.#ProcessCompleted(stsWorkerEx, publishMessagePayload.payload as ITestRunnerTelemetryPayload);
2186
- break;
2187
- */
2188
2172
  case eIWMessageCommands.RunnerStateChange:
2189
2173
  __privateGet(this, _RunnerStateChange).call(this, stsWorkerEx, publishMessagePayload2.payload);
2190
2174
  break;
@@ -2224,7 +2208,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2224
2208
  });
2225
2209
  __privateAdd(this, _SetRunnerIntoWorker, (workerEx, runnerEx) => {
2226
2210
  const payload = {
2227
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2211
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2228
2212
  };
2229
2213
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.AddRunner, payload);
2230
2214
  });
@@ -2262,6 +2246,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2262
2246
  if (workerEx.runnersEx[runner.id]) {
2263
2247
  const runnerEx = workerEx.runnersEx[runner.id];
2264
2248
  runnerEx.state = runner.state;
2249
+ if (!runnerEx.runnerHistory) {
2250
+ runnerEx.runnerHistory = [];
2251
+ }
2265
2252
  runnerEx.runnerHistory.push({
2266
2253
  eventDate: /* @__PURE__ */ new Date(),
2267
2254
  runner: { ...runner }
@@ -2361,61 +2348,59 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2361
2348
  });
2362
2349
  __privateAdd(this, _StartRunner2, async (workerEx, runnerEx) => {
2363
2350
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StartRunner, {
2364
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2351
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2365
2352
  });
2366
2353
  return true;
2367
2354
  });
2368
2355
  __privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
2369
2356
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResetRunner, {
2370
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2357
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2371
2358
  });
2372
2359
  return true;
2373
2360
  });
2374
2361
  __privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
2375
2362
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ExecuteRunner, {
2376
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2363
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2377
2364
  });
2378
2365
  return true;
2379
2366
  });
2380
2367
  __privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
2381
2368
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StopRunner, {
2382
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2369
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2383
2370
  });
2384
2371
  return true;
2385
2372
  });
2386
2373
  __privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
2387
2374
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.TerminateRunner, {
2388
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2375
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2389
2376
  });
2390
2377
  return true;
2391
2378
  });
2392
2379
  __privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
2393
2380
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.PauseRunner, {
2394
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2381
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2395
2382
  });
2396
2383
  return true;
2397
2384
  });
2398
2385
  __privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
2399
2386
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResumeRunner, {
2400
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2387
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2401
2388
  });
2402
2389
  return true;
2403
2390
  });
2404
2391
  __privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, options) => {
2405
2392
  try {
2406
- if (workerEx.state !== IWorkerState.stopped) {
2407
- const promArray = [];
2408
- const ids = Object.keys(workerEx.runnersEx);
2409
- ids.forEach((id) => {
2410
- const runnerEx = workerEx.runnersEx[id];
2411
- if (options) {
2412
- promArray.push(command(workerEx, runnerEx, options));
2413
- } else {
2414
- promArray.push(command(workerEx, runnerEx));
2415
- }
2416
- });
2417
- await Promise.all(promArray);
2418
- }
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);
2419
2404
  return true;
2420
2405
  } catch (error) {
2421
2406
  console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
@@ -2442,19 +2427,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2442
2427
  });
2443
2428
  __privateAdd(this, _BroadcastUpdateCommandToAllRunners, async (workerEx, command, executionProfile) => {
2444
2429
  try {
2445
- if (workerEx.state !== IWorkerState.stopped) {
2446
- const promArray = [];
2447
- const ids = Object.keys(workerEx.runnersEx);
2448
- ids.forEach((id) => {
2449
- const runnerEx = workerEx.runnersEx[id];
2450
- if (executionProfile) {
2451
- promArray.push(command(workerEx, runnerEx, executionProfile));
2452
- } else {
2453
- promArray.push(command(workerEx, runnerEx));
2454
- }
2455
- });
2456
- await Promise.all(promArray);
2457
- }
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);
2458
2441
  return true;
2459
2442
  } catch (error) {
2460
2443
  console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
@@ -2467,14 +2450,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2467
2450
  });
2468
2451
  __privateAdd(this, _TerminateWorker, async (workerEx) => {
2469
2452
  try {
2470
- if (workerEx.state !== IWorkerState.stopped) {
2471
- await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2472
- if (workerEx.worker) {
2473
- workerEx.worker.terminate();
2474
- __privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
2475
- delete __privateGet(this, _workersEx)[workerEx.id];
2476
- } else {
2477
- }
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 {
2478
2459
  }
2479
2460
  return true;
2480
2461
  } catch (error) {
@@ -2485,7 +2466,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2485
2466
  __privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
2486
2467
  runnerEx.options.executionProfile = { ...executionProfile };
2487
2468
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2488
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx)
2469
+ runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2489
2470
  });
2490
2471
  return true;
2491
2472
  });
@@ -2582,6 +2563,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2582
2563
  }
2583
2564
  __privateGet(this, _processLoopExecutor2).call(this);
2584
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
+ }
2585
2573
  get WorkersEx() {
2586
2574
  return __privateGet(this, _workersEx);
2587
2575
  }
@@ -2600,19 +2588,39 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2600
2588
  _STSInstrumentController = new WeakMap();
2601
2589
  _telemetryProcessor = new WeakMap();
2602
2590
  _archiveList = new WeakMap();
2603
- _processLoopExecutor2 = new WeakMap();
2604
- _debug2 = new WeakMap();
2605
2591
  _STSWorkerManager_instances = new WeakSet();
2606
- CreateRunnerCopy_fn = function(runnerEx) {
2592
+ CreateRunnerCopyNoHistory_fn = function(runnerEx) {
2607
2593
  return {
2608
2594
  id: runnerEx.id,
2609
2595
  asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
2610
- options: { ...runnerEx.options },
2611
2596
  instrumentData: { ...runnerEx.instrumentData },
2612
2597
  iteration: runnerEx.iteration,
2613
- state: runnerEx.state
2598
+ options: { ...runnerEx.options },
2599
+ state: runnerEx.state,
2600
+ workerId: runnerEx.workerId
2614
2601
  };
2615
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();
2616
2624
  _SetRunnerIntoWorker = new WeakMap();
2617
2625
  _ProcessTelemetry = new WeakMap();
2618
2626
  _EmitEvent = new WeakMap();