@nsshunt/ststestrunner 1.1.53 → 1.1.55
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.
- package/dist/ststestrunner.cjs +25 -107
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +25 -107
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +1 -1
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -1
- package/types/libmodule/workerFhirTestCases.d.ts +1 -2
- package/types/libmodule/workerFhirTestCases.d.ts.map +1 -1
- package/types/libmodule/workerTestCaseLogPublisher.d.ts +0 -20
- package/types/libmodule/workerTestCaseLogPublisher.d.ts.map +0 -1
- package/types/libmodule/workerTestCaseLogger.d.ts +0 -22
- package/types/libmodule/workerTestCaseLogger.d.ts.map +0 -1
package/dist/ststestrunner.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { STSAxiosConfig, Sleep, createAgentManager, isNode } from "@nsshunt/stsu
|
|
|
4
4
|
import { FhirRESTClient, FhirSocketClientAllInOne, FhirSocketClientIndividual, createRetryAxiosClient } from "@nsshunt/stsfhirclient";
|
|
5
5
|
import http from "node:http";
|
|
6
6
|
import https from "node:https";
|
|
7
|
-
import { SocketIoClient } from "@nsshunt/stssocketioutils";
|
|
8
7
|
//#region \0rolldown/runtime.js
|
|
9
8
|
var __defProp = Object.defineProperty;
|
|
10
9
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -424,13 +423,23 @@ var TestCaseFhirBase = class {
|
|
|
424
423
|
StopRunner = async () => {
|
|
425
424
|
await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
|
|
426
425
|
await this.#ForcePublishTelemetryData();
|
|
427
|
-
this.
|
|
426
|
+
if (this.fhirClient) {
|
|
427
|
+
this.Debug(`TestCaseFhirBase:StopRunner(): Calling: [fhirClient.ResetSocket()]`);
|
|
428
|
+
this.fhirClient.ResetSocket();
|
|
429
|
+
await Sleep(100);
|
|
430
|
+
this.fhirClient = null;
|
|
431
|
+
}
|
|
428
432
|
return true;
|
|
429
433
|
};
|
|
430
434
|
TerminateRunner = async () => {
|
|
431
435
|
await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
|
|
432
436
|
await this.#ForcePublishTelemetryData();
|
|
433
|
-
this.
|
|
437
|
+
if (this.fhirClient) {
|
|
438
|
+
this.Debug(`TestCaseFhirBase:TerminateRunner(): Calling: [fhirClient.ResetSocket()]`);
|
|
439
|
+
this.fhirClient.ResetSocket();
|
|
440
|
+
await Sleep(100);
|
|
441
|
+
this.fhirClient = null;
|
|
442
|
+
}
|
|
434
443
|
return true;
|
|
435
444
|
};
|
|
436
445
|
Completed = async () => {
|
|
@@ -438,7 +447,12 @@ var TestCaseFhirBase = class {
|
|
|
438
447
|
this.runner.instrumentData.timer = performance.now() - start;
|
|
439
448
|
await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
|
|
440
449
|
await this.#ForcePublishTelemetryData();
|
|
441
|
-
this.
|
|
450
|
+
if (this.fhirClient) {
|
|
451
|
+
this.Debug(`TestCaseFhirBase:Completed(): Calling: [fhirClient.ResetSocket()]`);
|
|
452
|
+
this.fhirClient.ResetSocket();
|
|
453
|
+
await Sleep(100);
|
|
454
|
+
this.fhirClient = null;
|
|
455
|
+
}
|
|
442
456
|
return true;
|
|
443
457
|
};
|
|
444
458
|
PauseRunner = async () => {
|
|
@@ -454,6 +468,12 @@ var TestCaseFhirBase = class {
|
|
|
454
468
|
ResetRunner = async () => {
|
|
455
469
|
await this.#OutputLogMessage(`ResetRunner [${this.#runner.id}]`);
|
|
456
470
|
await this.#ForcePublishTelemetryData();
|
|
471
|
+
if (this.fhirClient) {
|
|
472
|
+
this.Debug(`TestCaseFhirBase:ResetRunner(): Calling: [fhirClient.ResetSocket()]`);
|
|
473
|
+
this.fhirClient.ResetSocket();
|
|
474
|
+
await Sleep(100);
|
|
475
|
+
this.fhirClient = null;
|
|
476
|
+
}
|
|
457
477
|
return true;
|
|
458
478
|
};
|
|
459
479
|
UpdateRunner = async () => {
|
|
@@ -35779,122 +35799,20 @@ var ResourceDataGenerator = class {
|
|
|
35779
35799
|
};
|
|
35780
35800
|
};
|
|
35781
35801
|
//#endregion
|
|
35782
|
-
//#region src/libmodule/workerTestCaseLogPublisher.ts
|
|
35783
|
-
var WorkerTestCaseLogPublisher = class extends SocketIoClient {
|
|
35784
|
-
#id;
|
|
35785
|
-
#options;
|
|
35786
|
-
constructor(options) {
|
|
35787
|
-
super("ststestrunner:SocketClientLogPublisher");
|
|
35788
|
-
this.#id = crypto.randomUUID();
|
|
35789
|
-
this.#options = options;
|
|
35790
|
-
}
|
|
35791
|
-
Start = (im_endpoint, im_port, im_namespace) => {
|
|
35792
|
-
this.LogDebugMessage(chalk.cyan(`${this.logPrefix}Start()`));
|
|
35793
|
-
const url = `${im_endpoint}:${im_port}/${im_namespace}/`;
|
|
35794
|
-
this.LogDebugMessage(chalk.cyan(`${this.logPrefix}SetupSocket() url: [${url}]`));
|
|
35795
|
-
this.WithAddress(url).WithLogger(this.#options.logger).SetupSocket();
|
|
35796
|
-
};
|
|
35797
|
-
get id() {
|
|
35798
|
-
return this.#id;
|
|
35799
|
-
}
|
|
35800
|
-
get logPrefix() {
|
|
35801
|
-
return `ststestrunner:SocketClientLogPublisher:`;
|
|
35802
|
-
}
|
|
35803
|
-
SocketConnect(socket) {
|
|
35804
|
-
this.LogDebugMessage(chalk.magenta(`${this.logPrefix}SocketConnect(): Socket ID: [${socket.id}], Joining Room: [${this.#options.rooms}]`));
|
|
35805
|
-
socket.emit("__STSjoinRoom", this.#options.rooms);
|
|
35806
|
-
}
|
|
35807
|
-
SocketError(error) {
|
|
35808
|
-
this.LogErrorMessage(chalk.red(`${this.logPrefix}SocketError(): Error: [${error}]`));
|
|
35809
|
-
}
|
|
35810
|
-
SetupSocketEvents(socket) {
|
|
35811
|
-
this.LogDebugMessage(chalk.magenta(`${this.logPrefix}SetupSocketEvents(): Socket ID: [${socket.id}]`));
|
|
35812
|
-
}
|
|
35813
|
-
SocketConnectError(error) {
|
|
35814
|
-
this.LogErrorMessage(chalk.red(`${this.logPrefix}SocketConnectError(): Error: [${error}]`));
|
|
35815
|
-
}
|
|
35816
|
-
SocketDisconnect(reason) {
|
|
35817
|
-
this.LogErrorMessage(chalk.red(`${this.logPrefix}SocketDisconnect(): reason: [${reason}]`));
|
|
35818
|
-
}
|
|
35819
|
-
};
|
|
35820
|
-
//#endregion
|
|
35821
|
-
//#region src/libmodule/workerTestCaseLogger.ts
|
|
35822
|
-
var WorkerTestCaseLogger = class {
|
|
35823
|
-
#options;
|
|
35824
|
-
#socketIoClient;
|
|
35825
|
-
constructor(opts) {
|
|
35826
|
-
this.#options = opts;
|
|
35827
|
-
this.#socketIoClient = new WorkerTestCaseLogPublisher({
|
|
35828
|
-
rooms: this.#options.rooms,
|
|
35829
|
-
logger: this
|
|
35830
|
-
});
|
|
35831
|
-
this.#socketIoClient.Start(opts.imendpoint, opts.import, opts.imsocketnamespace);
|
|
35832
|
-
}
|
|
35833
|
-
UsePrefix = (message) => {
|
|
35834
|
-
return `[][] ==>> ${message}`;
|
|
35835
|
-
};
|
|
35836
|
-
error = (message) => {
|
|
35837
|
-
this.log(0, message);
|
|
35838
|
-
this.#options.additionalLogger.error(this.UsePrefix(message));
|
|
35839
|
-
};
|
|
35840
|
-
warn = (message) => {
|
|
35841
|
-
this.log(1, message);
|
|
35842
|
-
this.#options.additionalLogger.warn(this.UsePrefix(message));
|
|
35843
|
-
};
|
|
35844
|
-
info = (message) => {
|
|
35845
|
-
this.log(2, message);
|
|
35846
|
-
this.#options.additionalLogger.info(this.UsePrefix(message));
|
|
35847
|
-
};
|
|
35848
|
-
http = (message) => {
|
|
35849
|
-
this.log(3, message);
|
|
35850
|
-
this.#options.additionalLogger.http(this.UsePrefix(message));
|
|
35851
|
-
};
|
|
35852
|
-
verbose = (message) => {
|
|
35853
|
-
this.log(4, message);
|
|
35854
|
-
this.#options.additionalLogger.verbose(this.UsePrefix(message));
|
|
35855
|
-
};
|
|
35856
|
-
debug = (message) => {
|
|
35857
|
-
this.log(5, message);
|
|
35858
|
-
this.#options.additionalLogger.debug(this.UsePrefix(message));
|
|
35859
|
-
};
|
|
35860
|
-
silly = (message) => {
|
|
35861
|
-
this.log(6, message);
|
|
35862
|
-
this.#options.additionalLogger.silly(this.UsePrefix(message));
|
|
35863
|
-
};
|
|
35864
|
-
log = (level, message) => {
|
|
35865
|
-
this.#socketIoClient.socket?.emit("__STSsendToRoom", this.#options.rooms, {
|
|
35866
|
-
command: "logmessage",
|
|
35867
|
-
payload: {
|
|
35868
|
-
level,
|
|
35869
|
-
message,
|
|
35870
|
-
dateTime: Date.now()
|
|
35871
|
-
}
|
|
35872
|
-
});
|
|
35873
|
-
};
|
|
35874
|
-
};
|
|
35875
|
-
//#endregion
|
|
35876
35802
|
//#region src/libmodule/workerFhirTestCases.ts
|
|
35877
35803
|
var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
|
|
35878
35804
|
_options;
|
|
35879
35805
|
_resourceDataGenerator;
|
|
35880
|
-
_workerTestCaseLogger;
|
|
35881
35806
|
constructor(options) {
|
|
35882
35807
|
super();
|
|
35883
35808
|
this._options = options;
|
|
35884
35809
|
this._resourceDataGenerator = new ResourceDataGenerator();
|
|
35885
|
-
this._workerTestCaseLogger = new WorkerTestCaseLogger({
|
|
35886
|
-
additionalLogger: this._options.additionalLogger,
|
|
35887
|
-
imendpoint: this._options.imendpoint,
|
|
35888
|
-
import: this._options.import,
|
|
35889
|
-
imsocketnamespace: this._options.imsocketnamespace,
|
|
35890
|
-
rooms: [...this._options.rooms]
|
|
35891
|
-
});
|
|
35892
35810
|
}
|
|
35893
35811
|
get resourceDataGenerator() {
|
|
35894
35812
|
return this._resourceDataGenerator;
|
|
35895
35813
|
}
|
|
35896
35814
|
get logger() {
|
|
35897
|
-
return this.
|
|
35815
|
+
return this._options.logger;
|
|
35898
35816
|
}
|
|
35899
35817
|
CreateAsyncRunner = async (testRunnerTelemetryPayload) => {
|
|
35900
35818
|
return AsyncRunnerFactory.CreateAsyncRunner(this, testRunnerTelemetryPayload);
|