@nsshunt/stsrunnerframework 1.0.73 → 1.0.75

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, _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;
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, _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_";
@@ -2021,7 +2021,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2021
2021
  chalk.level = 3;
2022
2022
  class STSWorkerManager {
2023
2023
  constructor(options) {
2024
- __privateAdd(this, _STSWorkerManager_instances);
2025
2024
  //#agentSession: string = null;
2026
2025
  __privateAdd(this, _workersEx, {});
2027
2026
  __privateAdd(this, _options2);
@@ -2054,7 +2053,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2054
2053
  await runnerEx.publishInstrumentController.EndPublish();
2055
2054
  await stsutils.Sleep(250);
2056
2055
  }
2057
- const runner = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx);
2056
+ const runner = this.CreateRunnerCopy(runnerEx);
2058
2057
  __privateGet(this, _archiveList).push(runner);
2059
2058
  if (__privateGet(this, _archiveList).length > __privateGet(this, _options2).maxArchiveListLength) {
2060
2059
  __privateGet(this, _archiveList).shift();
@@ -2075,7 +2074,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2075
2074
  __privateAdd(this, _debug2, (message) => {
2076
2075
  console.log(chalk.cyan(`pid: [${process.pid}] STSWorkerManager::${message}`));
2077
2076
  });
2078
- __publicField(this, "AddWorker", async (useWorkerFactory) => {
2077
+ __publicField(this, "AddWorker", async (workerOptions, useWorkerFactory) => {
2079
2078
  let workerFactory;
2080
2079
  if (useWorkerFactory) {
2081
2080
  workerFactory = useWorkerFactory;
@@ -2093,7 +2092,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2093
2092
  id: workerId,
2094
2093
  worker: workerFactory.createWorkerThreadWorker(),
2095
2094
  messagePort: port1,
2096
- workerThreadWorkerOptions: workerFactory.workerThreadWorkerOptions,
2095
+ options: workerOptions,
2097
2096
  runnersEx: {},
2098
2097
  runnersEvents: {},
2099
2098
  GetRunner: (id) => __privateGet(this, _workersEx)[workerId].GetRunner(id),
@@ -2122,13 +2121,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2122
2121
  }
2123
2122
  __privateGet(this, _debug2).call(this, `Adding worker: [${stsWorkerEx.id}]`);
2124
2123
  __privateGet(this, _debug2).call(this, `AddWorker::workerThreadWorkerOptions: [${stsWorkerEx.id}]`);
2125
- if (stsWorkerEx.workerThreadWorkerOptions.mocked) {
2124
+ if (stsWorkerEx.options.mocked) {
2126
2125
  stsWorkerEx.worker.SetPort({
2127
2126
  command: eIWMessageCommands.MessagePort,
2128
2127
  payload: {
2129
2128
  port: port2,
2130
2129
  options: {
2131
- ...stsWorkerEx.workerThreadWorkerOptions
2130
+ ...stsWorkerEx.options
2132
2131
  },
2133
2132
  workerId
2134
2133
  }
@@ -2138,12 +2137,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2138
2137
  port: port2,
2139
2138
  //applicationStoreState: stateCopy,
2140
2139
  options: {
2141
- ...stsWorkerEx.workerThreadWorkerOptions
2140
+ ...stsWorkerEx.options
2142
2141
  },
2143
2142
  workerId
2144
2143
  }, port2);
2145
2144
  }
2146
- if (!stsWorkerEx.workerThreadWorkerOptions.mocked) {
2145
+ if (!stsWorkerEx.options.mocked) {
2147
2146
  if (isNode) {
2148
2147
  stsWorkerEx.worker.on("exit", (code) => {
2149
2148
  console.log(chalk.magenta(`STSWorkerManager:stsWorkerEx.worker.on(exit): Worker exited with code: ${code}`));
@@ -2208,7 +2207,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2208
2207
  });
2209
2208
  __privateAdd(this, _SetRunnerIntoWorker, (workerEx, runnerEx) => {
2210
2209
  const payload = {
2211
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2210
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2212
2211
  };
2213
2212
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.AddRunner, payload);
2214
2213
  });
@@ -2274,10 +2273,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2274
2273
  const asyncRunnerContext = {
2275
2274
  // [level1]@[level2]^[level3]|[level4]
2276
2275
  // [hostName]@[agentId]-[userAgent]^[workerId]|[runnerId]
2277
- nid: `${workerEx.workerThreadWorkerOptions.hostName}${stsutils.ModelDelimeter.COMPONENT_SEPERATOR}${workerEx.workerThreadWorkerOptions.agentId}-${workerEx.workerThreadWorkerOptions.userAgent}${stsutils.ModelDelimeter.NID_SEPERATOR}${workerEx.id}${stsutils.ModelDelimeter.SEPERATOR}${runnerId}`,
2278
- hostName: workerEx.workerThreadWorkerOptions.hostName,
2276
+ nid: `${workerEx.options.hostName}${stsutils.ModelDelimeter.COMPONENT_SEPERATOR}${workerEx.options.agentId}-${workerEx.options.userAgent}${stsutils.ModelDelimeter.NID_SEPERATOR}${workerEx.id}${stsutils.ModelDelimeter.SEPERATOR}${runnerId}`,
2277
+ hostName: workerEx.options.hostName,
2279
2278
  // level 1 (e.g. host name)
2280
- agentName: `${workerEx.workerThreadWorkerOptions.agentId}-${workerEx.workerThreadWorkerOptions.userAgent}`,
2279
+ agentName: `${workerEx.options.agentId}-${workerEx.options.userAgent}`,
2281
2280
  // level 2 (e.g. service instance ID or user agent type and tab or instance)
2282
2281
  threadId: `${workerEx.id}`,
2283
2282
  // level 3 (web worker)
@@ -2348,43 +2347,43 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2348
2347
  });
2349
2348
  __privateAdd(this, _StartRunner2, async (workerEx, runnerEx) => {
2350
2349
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StartRunner, {
2351
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2350
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2352
2351
  });
2353
2352
  return true;
2354
2353
  });
2355
2354
  __privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
2356
2355
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResetRunner, {
2357
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2356
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2358
2357
  });
2359
2358
  return true;
2360
2359
  });
2361
2360
  __privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
2362
2361
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ExecuteRunner, {
2363
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2362
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2364
2363
  });
2365
2364
  return true;
2366
2365
  });
2367
2366
  __privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
2368
2367
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StopRunner, {
2369
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2368
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2370
2369
  });
2371
2370
  return true;
2372
2371
  });
2373
2372
  __privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
2374
2373
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.TerminateRunner, {
2375
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2374
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2376
2375
  });
2377
2376
  return true;
2378
2377
  });
2379
2378
  __privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
2380
2379
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.PauseRunner, {
2381
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2380
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2382
2381
  });
2383
2382
  return true;
2384
2383
  });
2385
2384
  __privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
2386
2385
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResumeRunner, {
2387
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2386
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2388
2387
  });
2389
2388
  return true;
2390
2389
  });
@@ -2466,7 +2465,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2466
2465
  __privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
2467
2466
  runnerEx.options.executionProfile = { ...executionProfile };
2468
2467
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2469
- runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
2468
+ runner: this.CreateRunnerCopyNoHistory(runnerEx)
2470
2469
  });
2471
2470
  return true;
2472
2471
  });
@@ -2563,10 +2562,40 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2563
2562
  }
2564
2563
  __privateGet(this, _processLoopExecutor2).call(this);
2565
2564
  }
2565
+ CreateRunnerCopyNoHistory(runnerEx) {
2566
+ return {
2567
+ id: runnerEx.id,
2568
+ asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
2569
+ instrumentData: { ...runnerEx.instrumentData },
2570
+ iteration: runnerEx.iteration,
2571
+ options: { ...runnerEx.options },
2572
+ state: runnerEx.state,
2573
+ workerId: runnerEx.workerId
2574
+ };
2575
+ }
2576
+ CreateRunnerCopy(runnerEx) {
2577
+ const retVal = this.CreateRunnerCopyNoHistory(runnerEx);
2578
+ if (runnerEx.runnerHistory) {
2579
+ retVal.runnerHistory = [...runnerEx.runnerHistory];
2580
+ }
2581
+ return retVal;
2582
+ }
2583
+ CreateWorkerCopy(workerEx) {
2584
+ const { id, options, runnersEx } = workerEx;
2585
+ const workerCopy = {
2586
+ id,
2587
+ options: { ...options },
2588
+ runners: {}
2589
+ };
2590
+ for (const [, runnerEx] of Object.entries(runnersEx)) {
2591
+ workerCopy.runners[runnerEx.id] = this.CreateRunnerCopy(runnerEx);
2592
+ }
2593
+ return workerCopy;
2594
+ }
2566
2595
  get Workers() {
2567
2596
  const retVal = {};
2568
2597
  for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
2569
- retVal[workerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateWorkerCopy_fn).call(this, workerEx);
2598
+ retVal[workerEx.id] = this.CreateWorkerCopy(workerEx);
2570
2599
  }
2571
2600
  return retVal;
2572
2601
  }
@@ -2588,37 +2617,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2588
2617
  _STSInstrumentController = new WeakMap();
2589
2618
  _telemetryProcessor = new WeakMap();
2590
2619
  _archiveList = new WeakMap();
2591
- _STSWorkerManager_instances = new WeakSet();
2592
- CreateRunnerCopyNoHistory_fn = function(runnerEx) {
2593
- return {
2594
- id: runnerEx.id,
2595
- asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
2596
- instrumentData: { ...runnerEx.instrumentData },
2597
- iteration: runnerEx.iteration,
2598
- options: { ...runnerEx.options },
2599
- state: runnerEx.state,
2600
- workerId: runnerEx.workerId
2601
- };
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
2620
  _processLoopExecutor2 = new WeakMap();
2623
2621
  _debug2 = new WeakMap();
2624
2622
  _SetRunnerIntoWorker = new WeakMap();