@nsshunt/ststestrunner 1.0.63 → 1.0.64
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.mjs +383 -499
- package/dist/ststestrunner.mjs.map +1 -1
- package/dist/ststestrunner.umd.js +383 -499
- package/dist/ststestrunner.umd.js.map +1 -1
- package/package.json +6 -6
- package/types/setupFhirTestResources.d.ts.map +1 -1
- package/types/startUpDelFhirResources.d.ts.map +1 -1
- package/types/testCaseFhir01.d.ts +5 -9
- package/types/testCaseFhir01.d.ts.map +1 -1
- package/types/testCaseFhir02.d.ts +5 -9
- package/types/testCaseFhir02.d.ts.map +1 -1
- package/types/testCaseFhir03.d.ts +5 -9
- package/types/testCaseFhir03.d.ts.map +1 -1
- package/types/testCaseFhir04.d.ts +5 -9
- package/types/testCaseFhir04.d.ts.map +1 -1
- package/types/testCaseFhir05.d.ts +5 -9
- package/types/testCaseFhir05.d.ts.map +1 -1
- package/types/testCaseFhir06.d.ts +2 -2
- package/types/testCaseFhir06.d.ts.map +1 -1
- package/types/testCaseFhir07.d.ts +2 -2
- package/types/testCaseFhir07.d.ts.map +1 -1
- package/types/testCaseFhir08.d.ts +2 -2
- package/types/testCaseFhir08.d.ts.map +1 -1
- package/types/testCaseFhir09.d.ts +5 -9
- package/types/testCaseFhir09.d.ts.map +1 -1
- package/types/testCaseFhirBase.d.ts +0 -2
- package/types/testCaseFhirBase.d.ts.map +1 -1
- package/types/testCaseFhirQueryBase.d.ts +3 -2
- package/types/testCaseFhirQueryBase.d.ts.map +1 -1
package/dist/ststestrunner.mjs
CHANGED
|
@@ -17,7 +17,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
17
17
|
return __privateGet(obj, member, getter);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
var _runner, _workerInstance, _logMessageDataSet, _publishTelemetryTimeout, _publishTelemetryCount, _maxBufferSize, _publishTelemetryTimeoutVal, _color, _randomPastelColour, _TestCase01_instances, GetRandomHexColor_fn, _GetRandomPastelColor, _debug2, _GenLogMessage, _SetupTimeout, _PublishTelemetryData, _ForcePublishTelemetryData, _PublishTelemetry, _OutputLogMessage, _options4,
|
|
20
|
+
var _runner, _workerInstance, _logMessageDataSet, _publishTelemetryTimeout, _publishTelemetryCount, _maxBufferSize, _publishTelemetryTimeoutVal, _color, _randomPastelColour, _TestCase01_instances, GetRandomHexColor_fn, _GetRandomPastelColor, _debug2, _GenLogMessage, _SetupTimeout, _PublishTelemetryData, _ForcePublishTelemetryData, _PublishTelemetry, _OutputLogMessage, _options4, _randomDataRecordset, _runner2, _workerInstance2, _fhirClient, _accesssToken, _clientId, _clientSecret, _publishTelemetryCount2, _maxBufferSize2, _publishTelemetryTimeout2, _publishTelemetryTimeoutVal2, _originRegex, _LogMessage, _PublishTelemetryData2, _ForcePublishTelemetryData2, _SetupTimeout2, _OutputLogMessage2, _ResetAgent, _CheckResetAgent, _debug3, _debug4, _error2, _GetPersonRecord, _runner3, _workerInstance3, _logMessageDataSet2, _publishTelemetryTimeout3, _publishTelemetryCount3, _maxBufferSize3, _publishTelemetryTimeoutVal3, _color2, _randomPastelColour2, _TestStartUp_instances, GetRandomHexColor_fn2, _GetRandomPastelColor2, _debug5, _GenLogMessage2, _SetupTimeout3, _PublishTelemetryData3, _ForcePublishTelemetryData3, _PublishTelemetry2, _OutputLogMessage3, _runner4, _workerInstance4, _logMessageDataSet3, _publishTelemetryTimeout4, _publishTelemetryCount4, _maxBufferSize4, _publishTelemetryTimeoutVal4, _color3, _randomPastelColour3, _TestShutDown_instances, GetRandomHexColor_fn3, _GetRandomPastelColor3, _debug6, _GenLogMessage3, _SetupTimeout4, _PublishTelemetryData4, _ForcePublishTelemetryData4, _PublishTelemetry3, _OutputLogMessage4, _options5, _id2, _clientName2, _wm, _socketUtils2, _debug7, _error3, _info2, _GetKeyPayloadData, _LogPayloadEventRetVal, _EmitStateChange, _SetupRunnerEventHandlers, _HandleAddRunner, _SetupWSSClient2, _OnSocketConnected2, _RegisterSocketEvents, _EmitEvent, _GetSocketEventHandlers;
|
|
21
21
|
import { defaultLogger, Sleep, STSAxiosConfig, AgentManager } from "@nsshunt/stsutils";
|
|
22
22
|
import "@nsshunt/stsobservability";
|
|
23
23
|
import http from "node:http";
|
|
@@ -6929,41 +6929,7 @@ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Ca
|
|
|
6929
6929
|
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6930
6930
|
var __privateAdd$1 = (obj, member, value2) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value2);
|
|
6931
6931
|
var __privateSet$1 = (obj, member, value2, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value2), value2);
|
|
6932
|
-
var _socketUtils, _id, _options2, _clientName, _debug, _error, _info, _SetupWSSClient, _OnSocketConnected, _options3, _DUMMY_USER,
|
|
6933
|
-
const byteToHex$1 = [];
|
|
6934
|
-
for (let i = 0; i < 256; ++i) {
|
|
6935
|
-
byteToHex$1.push((i + 256).toString(16).slice(1));
|
|
6936
|
-
}
|
|
6937
|
-
function unsafeStringify$1(arr, offset = 0) {
|
|
6938
|
-
return (byteToHex$1[arr[offset + 0]] + byteToHex$1[arr[offset + 1]] + byteToHex$1[arr[offset + 2]] + byteToHex$1[arr[offset + 3]] + "-" + byteToHex$1[arr[offset + 4]] + byteToHex$1[arr[offset + 5]] + "-" + byteToHex$1[arr[offset + 6]] + byteToHex$1[arr[offset + 7]] + "-" + byteToHex$1[arr[offset + 8]] + byteToHex$1[arr[offset + 9]] + "-" + byteToHex$1[arr[offset + 10]] + byteToHex$1[arr[offset + 11]] + byteToHex$1[arr[offset + 12]] + byteToHex$1[arr[offset + 13]] + byteToHex$1[arr[offset + 14]] + byteToHex$1[arr[offset + 15]]).toLowerCase();
|
|
6939
|
-
}
|
|
6940
|
-
let getRandomValues$1;
|
|
6941
|
-
const rnds8$1 = new Uint8Array(16);
|
|
6942
|
-
function rng$1() {
|
|
6943
|
-
if (!getRandomValues$1) {
|
|
6944
|
-
if (typeof crypto === "undefined" || !crypto.getRandomValues) {
|
|
6945
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
6946
|
-
}
|
|
6947
|
-
getRandomValues$1 = crypto.getRandomValues.bind(crypto);
|
|
6948
|
-
}
|
|
6949
|
-
return getRandomValues$1(rnds8$1);
|
|
6950
|
-
}
|
|
6951
|
-
const randomUUID$1 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
6952
|
-
const native$1 = { randomUUID: randomUUID$1 };
|
|
6953
|
-
function v4$1(options, buf, offset) {
|
|
6954
|
-
var _a2;
|
|
6955
|
-
if (native$1.randomUUID && true && !options) {
|
|
6956
|
-
return native$1.randomUUID();
|
|
6957
|
-
}
|
|
6958
|
-
options = options || {};
|
|
6959
|
-
const rnds = options.random ?? ((_a2 = options.rng) == null ? void 0 : _a2.call(options)) ?? rng$1();
|
|
6960
|
-
if (rnds.length < 16) {
|
|
6961
|
-
throw new Error("Random bytes length must be >= 16");
|
|
6962
|
-
}
|
|
6963
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
6964
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
6965
|
-
return unsafeStringify$1(rnds);
|
|
6966
|
-
}
|
|
6932
|
+
var _socketUtils, _id, _options2, _clientName, _debug, _error, _info, _SetupWSSClient, _OnSocketConnected, _options3, _DUMMY_USER, _stsfhirapiroot, _fhirSocketClient, _LogDebugMessage, _HandleError, _BuildQueryString, _InvokeResourceAPI;
|
|
6967
6933
|
const isNode$1 = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
|
6968
6934
|
function getDefaultExportFromCjs(x2) {
|
|
6969
6935
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -11938,6 +11904,40 @@ EstablishSocketConnect_fn$1 = function(name, socketIoCustomPath, onConnectCallBa
|
|
|
11938
11904
|
}
|
|
11939
11905
|
});
|
|
11940
11906
|
};
|
|
11907
|
+
const byteToHex$1 = [];
|
|
11908
|
+
for (let i = 0; i < 256; ++i) {
|
|
11909
|
+
byteToHex$1.push((i + 256).toString(16).slice(1));
|
|
11910
|
+
}
|
|
11911
|
+
function unsafeStringify$1(arr, offset = 0) {
|
|
11912
|
+
return (byteToHex$1[arr[offset + 0]] + byteToHex$1[arr[offset + 1]] + byteToHex$1[arr[offset + 2]] + byteToHex$1[arr[offset + 3]] + "-" + byteToHex$1[arr[offset + 4]] + byteToHex$1[arr[offset + 5]] + "-" + byteToHex$1[arr[offset + 6]] + byteToHex$1[arr[offset + 7]] + "-" + byteToHex$1[arr[offset + 8]] + byteToHex$1[arr[offset + 9]] + "-" + byteToHex$1[arr[offset + 10]] + byteToHex$1[arr[offset + 11]] + byteToHex$1[arr[offset + 12]] + byteToHex$1[arr[offset + 13]] + byteToHex$1[arr[offset + 14]] + byteToHex$1[arr[offset + 15]]).toLowerCase();
|
|
11913
|
+
}
|
|
11914
|
+
let getRandomValues$1;
|
|
11915
|
+
const rnds8$1 = new Uint8Array(16);
|
|
11916
|
+
function rng$1() {
|
|
11917
|
+
if (!getRandomValues$1) {
|
|
11918
|
+
if (typeof crypto === "undefined" || !crypto.getRandomValues) {
|
|
11919
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
11920
|
+
}
|
|
11921
|
+
getRandomValues$1 = crypto.getRandomValues.bind(crypto);
|
|
11922
|
+
}
|
|
11923
|
+
return getRandomValues$1(rnds8$1);
|
|
11924
|
+
}
|
|
11925
|
+
const randomUUID$1 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
11926
|
+
const native$1 = { randomUUID: randomUUID$1 };
|
|
11927
|
+
function v4$1(options, buf, offset) {
|
|
11928
|
+
var _a2;
|
|
11929
|
+
if (native$1.randomUUID && true && !options) {
|
|
11930
|
+
return native$1.randomUUID();
|
|
11931
|
+
}
|
|
11932
|
+
options = options || {};
|
|
11933
|
+
const rnds = options.random ?? ((_a2 = options.rng) == null ? void 0 : _a2.call(options)) ?? rng$1();
|
|
11934
|
+
if (rnds.length < 16) {
|
|
11935
|
+
throw new Error("Random bytes length must be >= 16");
|
|
11936
|
+
}
|
|
11937
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
11938
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
11939
|
+
return unsafeStringify$1(rnds);
|
|
11940
|
+
}
|
|
11941
11941
|
class FhirSocketClient {
|
|
11942
11942
|
constructor(options) {
|
|
11943
11943
|
__privateAdd$1(this, _socketUtils);
|
|
@@ -12263,25 +12263,84 @@ _error = /* @__PURE__ */ new WeakMap();
|
|
|
12263
12263
|
_info = /* @__PURE__ */ new WeakMap();
|
|
12264
12264
|
_SetupWSSClient = /* @__PURE__ */ new WeakMap();
|
|
12265
12265
|
_OnSocketConnected = /* @__PURE__ */ new WeakMap();
|
|
12266
|
+
function sleep(ms) {
|
|
12267
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12268
|
+
}
|
|
12269
|
+
function getJitteredDelay(base, jitter) {
|
|
12270
|
+
const random = Math.floor(Math.random() * jitter);
|
|
12271
|
+
return base + random;
|
|
12272
|
+
}
|
|
12273
|
+
function createRetryAxiosClient(retryConfig) {
|
|
12274
|
+
const {
|
|
12275
|
+
maxRetries = 3,
|
|
12276
|
+
retryDelayMs = 300,
|
|
12277
|
+
retryJitterMs = 100,
|
|
12278
|
+
retryMethods = ["get", "head", "put", "delete", "options"],
|
|
12279
|
+
// post, patch
|
|
12280
|
+
retryStatusCodes = [408, 429, 500, 502, 503, 504],
|
|
12281
|
+
retryErrorCodes = [
|
|
12282
|
+
"ECONNRESET",
|
|
12283
|
+
"ETIMEDOUT",
|
|
12284
|
+
"EAI_AGAIN",
|
|
12285
|
+
"ECONNREFUSED",
|
|
12286
|
+
"ENOTFOUND",
|
|
12287
|
+
"EHOSTUNREACH",
|
|
12288
|
+
"EPIPE"
|
|
12289
|
+
],
|
|
12290
|
+
maxRetryDurationMs = 1e4,
|
|
12291
|
+
onRetryAttempt,
|
|
12292
|
+
stsAxiosConfig
|
|
12293
|
+
} = retryConfig || {};
|
|
12294
|
+
const instance = axios.create();
|
|
12295
|
+
instance.interceptors.request.use((config) => {
|
|
12296
|
+
const now = Date.now();
|
|
12297
|
+
config.metadata = {
|
|
12298
|
+
startTime: now,
|
|
12299
|
+
__retryCount: 0
|
|
12300
|
+
};
|
|
12301
|
+
if (stsAxiosConfig) {
|
|
12302
|
+
Object.assign(config, stsAxiosConfig.config);
|
|
12303
|
+
}
|
|
12304
|
+
return config;
|
|
12305
|
+
});
|
|
12306
|
+
instance.interceptors.response.use(
|
|
12307
|
+
(response) => response,
|
|
12308
|
+
async (error) => {
|
|
12309
|
+
var _a2;
|
|
12310
|
+
const config = error.config;
|
|
12311
|
+
if (!config || !config.method || !config.metadata) {
|
|
12312
|
+
return Promise.reject(error);
|
|
12313
|
+
}
|
|
12314
|
+
const now = Date.now();
|
|
12315
|
+
const elapsed = now - config.metadata.startTime;
|
|
12316
|
+
const method = config.method.toLowerCase();
|
|
12317
|
+
const status = (_a2 = error.response) == null ? void 0 : _a2.status;
|
|
12318
|
+
const code = error.code;
|
|
12319
|
+
const isRetryable = retryMethods.includes(method) && (retryErrorCodes.includes(code || "") || retryStatusCodes.includes(status || 0));
|
|
12320
|
+
if (config.metadata.__retryCount < maxRetries && isRetryable && elapsed < maxRetryDurationMs) {
|
|
12321
|
+
config.metadata.__retryCount += 1;
|
|
12322
|
+
const delayBase = retryDelayMs * Math.pow(2, config.metadata.__retryCount - 1);
|
|
12323
|
+
const jitteredDelay = getJitteredDelay(delayBase, retryJitterMs);
|
|
12324
|
+
if (onRetryAttempt) {
|
|
12325
|
+
onRetryAttempt(config.metadata.__retryCount, error, jitteredDelay);
|
|
12326
|
+
}
|
|
12327
|
+
await sleep(jitteredDelay);
|
|
12328
|
+
return instance(config);
|
|
12329
|
+
}
|
|
12330
|
+
return Promise.reject(error);
|
|
12331
|
+
}
|
|
12332
|
+
);
|
|
12333
|
+
return instance;
|
|
12334
|
+
}
|
|
12266
12335
|
class FhirClient {
|
|
12267
12336
|
constructor(options) {
|
|
12268
12337
|
__privateAdd$1(this, _options3);
|
|
12269
12338
|
__privateAdd$1(this, _DUMMY_USER, "USR_user01@stsmda.com.au");
|
|
12270
|
-
__privateAdd$1(this, _invokeMethods, {});
|
|
12271
|
-
__privateAdd$1(this, _maxRetries, 5);
|
|
12272
|
-
__privateAdd$1(this, _sleepDuration, [50, 100, 200, 500, 1e3, 2e3, 5e3]);
|
|
12273
|
-
__privateAdd$1(this, _NoRetryStatusCodes, [
|
|
12274
|
-
StatusCodes.NOT_FOUND,
|
|
12275
|
-
StatusCodes.CONFLICT
|
|
12276
|
-
]);
|
|
12277
12339
|
__privateAdd$1(this, _stsfhirapiroot, "/stsfhir/r5");
|
|
12278
12340
|
__privateAdd$1(this, _fhirSocketClient);
|
|
12279
12341
|
__privateAdd$1(this, _LogDebugMessage, (message) => {
|
|
12280
12342
|
__privateGet$1(this, _options3).logger.debug(message);
|
|
12281
12343
|
});
|
|
12282
|
-
__privateAdd$1(this, _LogErrorMessage, (message) => {
|
|
12283
|
-
__privateGet$1(this, _options3).logger.error(message);
|
|
12284
|
-
});
|
|
12285
12344
|
__privateAdd$1(this, _HandleError, (error) => {
|
|
12286
12345
|
__privateGet$1(this, _LogDebugMessage).call(this, chalk.red(`HandleError(): Error: [${error}]`));
|
|
12287
12346
|
let responseCode = 500;
|
|
@@ -12296,116 +12355,55 @@ class FhirClient {
|
|
|
12296
12355
|
}
|
|
12297
12356
|
return responseCode;
|
|
12298
12357
|
});
|
|
12299
|
-
__privateAdd$1(this,
|
|
12300
|
-
const
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
testFailIndexBefore: 1,
|
|
12305
|
-
url: url2,
|
|
12306
|
-
httpVerb,
|
|
12307
|
-
domainResource,
|
|
12308
|
-
filters,
|
|
12309
|
-
searchParams,
|
|
12310
|
-
errorCb
|
|
12311
|
-
};
|
|
12312
|
-
const InvokeAPI = async (id2) => {
|
|
12313
|
-
const metadataRecord = __privateGet$1(this, _invokeMethods)[id2];
|
|
12314
|
-
let performRetry = false;
|
|
12315
|
-
const returnData = await __privateGet$1(this, ___InvokeResourceAPI).call(this, metadataRecord, (statusCode, error) => {
|
|
12316
|
-
console.error(chalk.red(`#InvokeResourceAPI(): Error: [${error}], Attempt: [${metadataRecord.retries + 1}]`));
|
|
12317
|
-
const noRetryIndex = __privateGet$1(this, _NoRetryStatusCodes).indexOf(statusCode);
|
|
12318
|
-
if (noRetryIndex === -1) {
|
|
12319
|
-
if (statusCode === StatusCodes.UNAUTHORIZED) {
|
|
12320
|
-
console.error(chalk.red(`#InvokeResourceAPI(): Authentication error, resetting access_token (to null).`));
|
|
12321
|
-
__privateGet$1(this, _options3).ResetAccessToken();
|
|
12322
|
-
if (__privateGet$1(this, _options3).clientTelemetryEvents) {
|
|
12323
|
-
__privateGet$1(this, _options3).clientTelemetryEvents.AuthenticationErrorInc();
|
|
12324
|
-
}
|
|
12325
|
-
}
|
|
12326
|
-
if (isNode$1 && __privateGet$1(this, _options3).agentManager) {
|
|
12327
|
-
console.error(chalk.red(`#InvokeResourceAPI(): Resetting https agent (to null).`));
|
|
12328
|
-
__privateGet$1(this, _options3).agentManager.ResetAgent();
|
|
12329
|
-
}
|
|
12330
|
-
performRetry = true;
|
|
12331
|
-
}
|
|
12332
|
-
});
|
|
12333
|
-
return {
|
|
12334
|
-
response: returnData,
|
|
12335
|
-
retry: performRetry
|
|
12336
|
-
};
|
|
12337
|
-
};
|
|
12338
|
-
let retVal = null;
|
|
12339
|
-
while (__privateGet$1(this, _invokeMethods)[id].retries < __privateGet$1(this, _maxRetries)) {
|
|
12340
|
-
retVal = await InvokeAPI(id);
|
|
12341
|
-
if (retVal.retry === false) {
|
|
12342
|
-
delete __privateGet$1(this, _invokeMethods)[id];
|
|
12343
|
-
break;
|
|
12344
|
-
} else {
|
|
12345
|
-
console.log(`Going to retry. Current attempts: [${__privateGet$1(this, _invokeMethods)[id].retries + 1}]`);
|
|
12346
|
-
console.log(`Sleeping: [${__privateGet$1(this, _sleepDuration)[__privateGet$1(this, _invokeMethods)[id].retries]}]`);
|
|
12347
|
-
await Sleep(__privateGet$1(this, _sleepDuration)[__privateGet$1(this, _invokeMethods)[id].retries]);
|
|
12348
|
-
__privateGet$1(this, _invokeMethods)[id].retries++;
|
|
12349
|
-
if (__privateGet$1(this, _options3).clientTelemetryEvents) {
|
|
12350
|
-
__privateGet$1(this, _options3).clientTelemetryEvents.RetryInc();
|
|
12351
|
-
}
|
|
12352
|
-
}
|
|
12353
|
-
}
|
|
12354
|
-
if (retVal) {
|
|
12355
|
-
if (retVal.retry === true) {
|
|
12356
|
-
errorCb(new Error(`#InvokeResourceAPI(): Max retries exceeded. Max Retries: [${__privateGet$1(this, _invokeMethods)[id].retries}]`));
|
|
12357
|
-
delete __privateGet$1(this, _invokeMethods)[id];
|
|
12358
|
-
return null;
|
|
12359
|
-
} else {
|
|
12360
|
-
return retVal.response;
|
|
12361
|
-
}
|
|
12362
|
-
} else {
|
|
12363
|
-
return null;
|
|
12364
|
-
}
|
|
12365
|
-
});
|
|
12366
|
-
__privateAdd$1(this, _TestMode, (metaData, errorCb) => {
|
|
12367
|
-
const { id, url: url2, httpVerb, filters, retries } = metaData;
|
|
12368
|
-
if (retries < 1) {
|
|
12369
|
-
errorCb(401, new Error(`Testing Error Only. Error Code: [401], Message ID: [${id}, url: [${url2}], httpVerb: [${httpVerb}], filters: [${filters}], Retries: [${retries}]`));
|
|
12370
|
-
return true;
|
|
12371
|
-
}
|
|
12372
|
-
if (retries < 2) {
|
|
12373
|
-
errorCb(500, new Error(`Testing Error Only. Error Code: [500], Message ID: [${id}, url: [${url2}], httpVerb: [${httpVerb}], filters: [${filters}], Retries: [${retries}]`));
|
|
12374
|
-
return true;
|
|
12375
|
-
}
|
|
12376
|
-
return false;
|
|
12358
|
+
__privateAdd$1(this, _BuildQueryString, (baseUrl, queryParams) => {
|
|
12359
|
+
const url2 = new URL(baseUrl);
|
|
12360
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
12361
|
+
url2.search = searchParams.toString();
|
|
12362
|
+
return url2.toString();
|
|
12377
12363
|
});
|
|
12378
|
-
__privateAdd$1(this,
|
|
12379
|
-
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12364
|
+
__privateAdd$1(this, _InvokeResourceAPI, async (url2, httpVerb, domainResource, filters) => {
|
|
12365
|
+
const accessToken = await __privateGet$1(this, _options3).GetAccessToken();
|
|
12366
|
+
const requestConfig = new STSAxiosConfig(url2, httpVerb).withAuthHeaders(accessToken, __privateGet$1(this, _DUMMY_USER)).withData(filters ? filters : domainResource ? domainResource : void 0);
|
|
12367
|
+
if (isNode$1 && __privateGet$1(this, _options3).agentManager) {
|
|
12368
|
+
requestConfig.withAgentManager(__privateGet$1(this, _options3).agentManager);
|
|
12369
|
+
}
|
|
12370
|
+
const api = createRetryAxiosClient({
|
|
12371
|
+
maxRetries: 4,
|
|
12372
|
+
retryDelayMs: 300,
|
|
12373
|
+
retryJitterMs: 150,
|
|
12374
|
+
maxRetryDurationMs: 5e3,
|
|
12375
|
+
onRetryAttempt: (attempt, error, delayMs) => {
|
|
12376
|
+
var _a2;
|
|
12377
|
+
console.warn(`Retry #${attempt} after ${delayMs}ms due to ${error.code || ((_a2 = error.response) == null ? void 0 : _a2.status)}`);
|
|
12390
12378
|
}
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
return null;
|
|
12396
|
-
}
|
|
12379
|
+
// Below works also ...
|
|
12380
|
+
//stsAxiosConfig: requestConfig
|
|
12381
|
+
});
|
|
12382
|
+
return await api(url2, requestConfig.config);
|
|
12397
12383
|
});
|
|
12398
|
-
__publicField2(this, "GetResource", async (resource, id, filters
|
|
12384
|
+
__publicField2(this, "GetResource", async (resource, id, filters) => {
|
|
12399
12385
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12386
|
+
try {
|
|
12387
|
+
const retVal = await __privateGet$1(this, _fhirSocketClient).GetResource(resource, id);
|
|
12388
|
+
if (retVal.status === StatusCodes.OK) {
|
|
12389
|
+
return retVal.value;
|
|
12390
|
+
} else {
|
|
12391
|
+
const errorResponse = new Error(`GetResource(): Invalid response status code: [${retVal.status}] expected: [${StatusCodes.OK}]`);
|
|
12392
|
+
errorResponse.response = {
|
|
12393
|
+
status: retVal.status
|
|
12394
|
+
};
|
|
12395
|
+
throw errorResponse;
|
|
12396
|
+
}
|
|
12397
|
+
} catch (error) {
|
|
12398
|
+
const errorResponse = new Error(`GetResource(): Error: [${error}]`);
|
|
12399
|
+
errorResponse.response = {
|
|
12400
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12401
|
+
};
|
|
12402
|
+
throw errorResponse;
|
|
12405
12403
|
}
|
|
12406
12404
|
} else {
|
|
12407
12405
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}/${id}`;
|
|
12408
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "get", null, filters
|
|
12406
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "get", null, filters);
|
|
12409
12407
|
if (response) {
|
|
12410
12408
|
return response.data;
|
|
12411
12409
|
} else {
|
|
@@ -12413,21 +12411,23 @@ class FhirClient {
|
|
|
12413
12411
|
}
|
|
12414
12412
|
}
|
|
12415
12413
|
});
|
|
12416
|
-
|
|
12417
|
-
const url2 = new URL(baseUrl);
|
|
12418
|
-
const searchParams = new URLSearchParams(queryParams);
|
|
12419
|
-
url2.search = searchParams.toString();
|
|
12420
|
-
return url2.toString();
|
|
12421
|
-
});
|
|
12422
|
-
__publicField2(this, "GetResources", async (resource, filters, searchParams, errorCb) => {
|
|
12414
|
+
__publicField2(this, "GetResources", async (resource, filters, searchParams) => {
|
|
12423
12415
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12424
|
-
|
|
12416
|
+
try {
|
|
12417
|
+
return __privateGet$1(this, _fhirSocketClient).GetResources(resource, searchParams);
|
|
12418
|
+
} catch (error) {
|
|
12419
|
+
const errorResponse = new Error(`GetResources(): Error: [${error}]`);
|
|
12420
|
+
errorResponse.response = {
|
|
12421
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12422
|
+
};
|
|
12423
|
+
throw errorResponse;
|
|
12424
|
+
}
|
|
12425
12425
|
} else {
|
|
12426
12426
|
let url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}`;
|
|
12427
12427
|
if (searchParams) {
|
|
12428
12428
|
url2 = __privateGet$1(this, _BuildQueryString).call(this, url2, searchParams);
|
|
12429
12429
|
}
|
|
12430
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "get", null, filters
|
|
12430
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "get", null, filters);
|
|
12431
12431
|
if (response) {
|
|
12432
12432
|
return response.data;
|
|
12433
12433
|
} else {
|
|
@@ -12435,36 +12435,54 @@ class FhirClient {
|
|
|
12435
12435
|
}
|
|
12436
12436
|
}
|
|
12437
12437
|
});
|
|
12438
|
-
__publicField2(this, "CreateResource", async (resource, domainResource
|
|
12438
|
+
__publicField2(this, "CreateResource", async (resource, domainResource) => {
|
|
12439
12439
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12440
|
-
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12440
|
+
try {
|
|
12441
|
+
const retVal = await __privateGet$1(this, _fhirSocketClient).CreateResource(resource, domainResource);
|
|
12442
|
+
if (retVal.status === StatusCodes.CREATED) {
|
|
12443
|
+
return retVal.value;
|
|
12444
|
+
} else {
|
|
12445
|
+
const errorResponse = new Error(`CreateResource(): Invalid response status code: [${retVal.status}] expected: [${StatusCodes.CREATED}]`);
|
|
12446
|
+
errorResponse.response = {
|
|
12447
|
+
status: retVal.status
|
|
12448
|
+
};
|
|
12449
|
+
throw errorResponse;
|
|
12450
|
+
}
|
|
12451
|
+
} catch (error) {
|
|
12452
|
+
const errorResponse = new Error(`CreateResource(): Error: [${error}]`);
|
|
12453
|
+
errorResponse.response = {
|
|
12454
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12455
|
+
};
|
|
12456
|
+
throw errorResponse;
|
|
12446
12457
|
}
|
|
12447
12458
|
} else {
|
|
12448
12459
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}`;
|
|
12449
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "post", domainResource, null
|
|
12460
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "post", domainResource, null);
|
|
12450
12461
|
if (response) {
|
|
12451
12462
|
if (response.status === StatusCodes.CREATED) {
|
|
12452
12463
|
return response.data;
|
|
12453
12464
|
} else {
|
|
12454
|
-
|
|
12455
|
-
return null;
|
|
12465
|
+
throw new Error(`CreateResource(): Invalid response status code: [${response.status}] expected: [${StatusCodes.CREATED}]`);
|
|
12456
12466
|
}
|
|
12457
12467
|
} else {
|
|
12458
12468
|
return null;
|
|
12459
12469
|
}
|
|
12460
12470
|
}
|
|
12461
12471
|
});
|
|
12462
|
-
__publicField2(this, "UpdateResource", async (resource, domainResource
|
|
12472
|
+
__publicField2(this, "UpdateResource", async (resource, domainResource) => {
|
|
12463
12473
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12464
|
-
|
|
12474
|
+
try {
|
|
12475
|
+
return __privateGet$1(this, _fhirSocketClient).UpdateResource(resource, domainResource);
|
|
12476
|
+
} catch (error) {
|
|
12477
|
+
const errorResponse = new Error(`UpdateResource(): Error: [${error}]`);
|
|
12478
|
+
errorResponse.response = {
|
|
12479
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12480
|
+
};
|
|
12481
|
+
throw errorResponse;
|
|
12482
|
+
}
|
|
12465
12483
|
} else {
|
|
12466
12484
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
|
|
12467
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "put", domainResource, null
|
|
12485
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "put", domainResource, null);
|
|
12468
12486
|
if (response) {
|
|
12469
12487
|
return response.data;
|
|
12470
12488
|
} else {
|
|
@@ -12472,12 +12490,20 @@ class FhirClient {
|
|
|
12472
12490
|
}
|
|
12473
12491
|
}
|
|
12474
12492
|
});
|
|
12475
|
-
__publicField2(this, "UpdateResources", async (resource, domainResources
|
|
12493
|
+
__publicField2(this, "UpdateResources", async (resource, domainResources) => {
|
|
12476
12494
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12477
|
-
|
|
12495
|
+
try {
|
|
12496
|
+
return __privateGet$1(this, _fhirSocketClient).UpdateResources(resource, domainResources);
|
|
12497
|
+
} catch (error) {
|
|
12498
|
+
const errorResponse = new Error(`UpdateResources(): Error: [${error}]`);
|
|
12499
|
+
errorResponse.response = {
|
|
12500
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12501
|
+
};
|
|
12502
|
+
throw errorResponse;
|
|
12503
|
+
}
|
|
12478
12504
|
} else {
|
|
12479
12505
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}`;
|
|
12480
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "put", domainResources, null
|
|
12506
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "put", domainResources, null);
|
|
12481
12507
|
if (response) {
|
|
12482
12508
|
return response.data;
|
|
12483
12509
|
} else {
|
|
@@ -12485,12 +12511,20 @@ class FhirClient {
|
|
|
12485
12511
|
}
|
|
12486
12512
|
}
|
|
12487
12513
|
});
|
|
12488
|
-
__publicField2(this, "PatchResource", async (resource, domainResource
|
|
12514
|
+
__publicField2(this, "PatchResource", async (resource, domainResource) => {
|
|
12489
12515
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12490
|
-
|
|
12516
|
+
try {
|
|
12517
|
+
return __privateGet$1(this, _fhirSocketClient).PatchResource(resource, domainResource);
|
|
12518
|
+
} catch (error) {
|
|
12519
|
+
const errorResponse = new Error(`PatchResource(): Error: [${error}]`);
|
|
12520
|
+
errorResponse.response = {
|
|
12521
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12522
|
+
};
|
|
12523
|
+
throw errorResponse;
|
|
12524
|
+
}
|
|
12491
12525
|
} else {
|
|
12492
12526
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
|
|
12493
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "patch", domainResource, null
|
|
12527
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "patch", domainResource, null);
|
|
12494
12528
|
if (response) {
|
|
12495
12529
|
return response.data;
|
|
12496
12530
|
} else {
|
|
@@ -12498,12 +12532,20 @@ class FhirClient {
|
|
|
12498
12532
|
}
|
|
12499
12533
|
}
|
|
12500
12534
|
});
|
|
12501
|
-
__publicField2(this, "PatchResources", async (resource, domainResources
|
|
12535
|
+
__publicField2(this, "PatchResources", async (resource, domainResources) => {
|
|
12502
12536
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12503
|
-
|
|
12537
|
+
try {
|
|
12538
|
+
return __privateGet$1(this, _fhirSocketClient).PatchResources(resource, domainResources);
|
|
12539
|
+
} catch (error) {
|
|
12540
|
+
const errorResponse = new Error(`PatchResources(): Error: [${error}]`);
|
|
12541
|
+
errorResponse.response = {
|
|
12542
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12543
|
+
};
|
|
12544
|
+
throw errorResponse;
|
|
12545
|
+
}
|
|
12504
12546
|
} else {
|
|
12505
12547
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}`;
|
|
12506
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "patch", domainResources, null
|
|
12548
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "patch", domainResources, null);
|
|
12507
12549
|
if (response) {
|
|
12508
12550
|
return response.data;
|
|
12509
12551
|
} else {
|
|
@@ -12511,12 +12553,20 @@ class FhirClient {
|
|
|
12511
12553
|
}
|
|
12512
12554
|
}
|
|
12513
12555
|
});
|
|
12514
|
-
__publicField2(this, "DeleteResource", async (resource, id
|
|
12556
|
+
__publicField2(this, "DeleteResource", async (resource, id) => {
|
|
12515
12557
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12516
|
-
|
|
12558
|
+
try {
|
|
12559
|
+
return __privateGet$1(this, _fhirSocketClient).DeleteResource(resource, id);
|
|
12560
|
+
} catch (error) {
|
|
12561
|
+
const errorResponse = new Error(`DeleteResource(): Error: [${error}]`);
|
|
12562
|
+
errorResponse.response = {
|
|
12563
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12564
|
+
};
|
|
12565
|
+
throw errorResponse;
|
|
12566
|
+
}
|
|
12517
12567
|
} else {
|
|
12518
12568
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}/${id}`;
|
|
12519
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "delete", null, null
|
|
12569
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "delete", null, null);
|
|
12520
12570
|
if (response) {
|
|
12521
12571
|
return response.data;
|
|
12522
12572
|
} else {
|
|
@@ -12524,12 +12574,20 @@ class FhirClient {
|
|
|
12524
12574
|
}
|
|
12525
12575
|
}
|
|
12526
12576
|
});
|
|
12527
|
-
__publicField2(this, "DeleteResources", async (resource, domainResources
|
|
12577
|
+
__publicField2(this, "DeleteResources", async (resource, domainResources) => {
|
|
12528
12578
|
if (__privateGet$1(this, _options3).useSocketClient === true && __privateGet$1(this, _fhirSocketClient)) {
|
|
12529
|
-
|
|
12579
|
+
try {
|
|
12580
|
+
return __privateGet$1(this, _fhirSocketClient).DeleteResources(resource, domainResources);
|
|
12581
|
+
} catch (error) {
|
|
12582
|
+
const errorResponse = new Error(`DeleteResources(): Error: [${error}]`);
|
|
12583
|
+
errorResponse.response = {
|
|
12584
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR
|
|
12585
|
+
};
|
|
12586
|
+
throw errorResponse;
|
|
12587
|
+
}
|
|
12530
12588
|
} else {
|
|
12531
12589
|
const url2 = `${__privateGet$1(this, _options3).fhirEndpoint}${__privateGet$1(this, _stsfhirapiroot)}/${resource}`;
|
|
12532
|
-
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "delete", domainResources, null
|
|
12590
|
+
const response = await __privateGet$1(this, _InvokeResourceAPI).call(this, url2, "delete", domainResources, null);
|
|
12533
12591
|
if (response) {
|
|
12534
12592
|
return response.data;
|
|
12535
12593
|
} else {
|
|
@@ -12544,7 +12602,17 @@ class FhirClient {
|
|
|
12544
12602
|
if (isNode$1 && __privateGet$1(this, _options3).agentManager) {
|
|
12545
12603
|
requestConfig.withAgentManager(__privateGet$1(this, _options3).agentManager);
|
|
12546
12604
|
}
|
|
12547
|
-
|
|
12605
|
+
const api = createRetryAxiosClient({
|
|
12606
|
+
maxRetries: 4,
|
|
12607
|
+
retryDelayMs: 300,
|
|
12608
|
+
retryJitterMs: 150,
|
|
12609
|
+
maxRetryDurationMs: 5e3,
|
|
12610
|
+
onRetryAttempt: (attempt, error, delayMs) => {
|
|
12611
|
+
var _a2;
|
|
12612
|
+
console.warn(`Retry #${attempt} after ${delayMs}ms due to ${error.code || ((_a2 = error.response) == null ? void 0 : _a2.status)}`);
|
|
12613
|
+
}
|
|
12614
|
+
});
|
|
12615
|
+
return await api(url2, requestConfig.config);
|
|
12548
12616
|
} catch (error) {
|
|
12549
12617
|
__privateGet$1(this, _HandleError).call(this, error);
|
|
12550
12618
|
}
|
|
@@ -12568,19 +12636,12 @@ class FhirClient {
|
|
|
12568
12636
|
}
|
|
12569
12637
|
_options3 = /* @__PURE__ */ new WeakMap();
|
|
12570
12638
|
_DUMMY_USER = /* @__PURE__ */ new WeakMap();
|
|
12571
|
-
_invokeMethods = /* @__PURE__ */ new WeakMap();
|
|
12572
|
-
_maxRetries = /* @__PURE__ */ new WeakMap();
|
|
12573
|
-
_sleepDuration = /* @__PURE__ */ new WeakMap();
|
|
12574
|
-
_NoRetryStatusCodes = /* @__PURE__ */ new WeakMap();
|
|
12575
12639
|
_stsfhirapiroot = /* @__PURE__ */ new WeakMap();
|
|
12576
12640
|
_fhirSocketClient = /* @__PURE__ */ new WeakMap();
|
|
12577
12641
|
_LogDebugMessage = /* @__PURE__ */ new WeakMap();
|
|
12578
|
-
_LogErrorMessage = /* @__PURE__ */ new WeakMap();
|
|
12579
12642
|
_HandleError = /* @__PURE__ */ new WeakMap();
|
|
12580
|
-
_InvokeResourceAPI = /* @__PURE__ */ new WeakMap();
|
|
12581
|
-
_TestMode = /* @__PURE__ */ new WeakMap();
|
|
12582
|
-
___InvokeResourceAPI = /* @__PURE__ */ new WeakMap();
|
|
12583
12643
|
_BuildQueryString = /* @__PURE__ */ new WeakMap();
|
|
12644
|
+
_InvokeResourceAPI = /* @__PURE__ */ new WeakMap();
|
|
12584
12645
|
class TestCaseFhirBase {
|
|
12585
12646
|
/*
|
|
12586
12647
|
#FHIR_SOCKET_CLIENT_USE = true;
|
|
@@ -12591,8 +12652,6 @@ class TestCaseFhirBase {
|
|
|
12591
12652
|
*/
|
|
12592
12653
|
constructor(workerInstance, runner) {
|
|
12593
12654
|
__privateAdd(this, _options4);
|
|
12594
|
-
//#authUtilsNode: AuthUtilsNode;
|
|
12595
|
-
__privateAdd(this, _agentManager);
|
|
12596
12655
|
__privateAdd(this, _randomDataRecordset, []);
|
|
12597
12656
|
__privateAdd(this, _runner2);
|
|
12598
12657
|
__privateAdd(this, _workerInstance2);
|
|
@@ -12749,6 +12808,9 @@ class TestCaseFhirBase {
|
|
|
12749
12808
|
return __privateGet(this, _accesssToken);
|
|
12750
12809
|
} catch (error) {
|
|
12751
12810
|
const errorTime = performance.now() - startTime;
|
|
12811
|
+
if (__privateGet(this, _fhirClient).options.agentManager) {
|
|
12812
|
+
__privateGet(this, _fhirClient).options.agentManager.ResetAgent();
|
|
12813
|
+
}
|
|
12752
12814
|
__privateGet(this, _runner2).instrumentData.authenticationErrorCount++;
|
|
12753
12815
|
__privateGet(this, _runner2).instrumentData.message.push(chalk$1.red(`GetAccessToken Fail Time: [${errorTime.toString()}]`));
|
|
12754
12816
|
__privateGet(this, _runner2).instrumentData.message.push(chalk$1.red(error.toString()));
|
|
@@ -12793,10 +12855,7 @@ class TestCaseFhirBase {
|
|
|
12793
12855
|
const blocksToLoad = 20;
|
|
12794
12856
|
for (let i = 0; i < blocksToLoad; i++) {
|
|
12795
12857
|
const recordId = `stsres_${blockNum + i}`;
|
|
12796
|
-
const retVal = await __privateGet(this, _fhirClient).GetResource("Person", recordId, null
|
|
12797
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
12798
|
-
console.error(chalk$1.red(`StartTestDataLoad(): Error: [${error}]`));
|
|
12799
|
-
});
|
|
12858
|
+
const retVal = await __privateGet(this, _fhirClient).GetResource("Person", recordId, null);
|
|
12800
12859
|
if (retVal) {
|
|
12801
12860
|
const recordsetData = retVal.address;
|
|
12802
12861
|
const zzz = recordsetData[0];
|
|
@@ -12968,9 +13027,6 @@ class TestCaseFhirBase {
|
|
|
12968
13027
|
*/
|
|
12969
13028
|
}));
|
|
12970
13029
|
}
|
|
12971
|
-
get agentManager() {
|
|
12972
|
-
return __privateGet(this, _agentManager);
|
|
12973
|
-
}
|
|
12974
13030
|
get accesssToken() {
|
|
12975
13031
|
return __privateGet(this, _accesssToken);
|
|
12976
13032
|
}
|
|
@@ -13218,7 +13274,6 @@ class TestCaseFhirBase {
|
|
|
13218
13274
|
*/
|
|
13219
13275
|
}
|
|
13220
13276
|
_options4 = new WeakMap();
|
|
13221
|
-
_agentManager = new WeakMap();
|
|
13222
13277
|
_randomDataRecordset = new WeakMap();
|
|
13223
13278
|
_runner2 = new WeakMap();
|
|
13224
13279
|
_workerInstance2 = new WeakMap();
|
|
@@ -13236,62 +13291,42 @@ _PublishTelemetryData2 = new WeakMap();
|
|
|
13236
13291
|
_ForcePublishTelemetryData2 = new WeakMap();
|
|
13237
13292
|
_SetupTimeout2 = new WeakMap();
|
|
13238
13293
|
_OutputLogMessage2 = new WeakMap();
|
|
13239
|
-
class
|
|
13294
|
+
class TestCaseFhirQueryBase extends TestCaseFhirBase {
|
|
13240
13295
|
constructor(workerInstance, runner) {
|
|
13241
13296
|
super(workerInstance, runner);
|
|
13242
|
-
__publicField(this, "
|
|
13243
|
-
|
|
13244
|
-
|
|
13297
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13298
|
+
return null;
|
|
13299
|
+
});
|
|
13300
|
+
__privateAdd(this, _ResetAgent, (reason) => {
|
|
13301
|
+
if (this.fhirClient.options.agentManager) {
|
|
13302
|
+
const resetMessage = chalk$1.rgb(50, 100, 50)`Iteration: [${this.runner.iteration} #authUtilsNode(): Agent Reset, reason: [${reason}]`;
|
|
13303
|
+
this.runner.instrumentData.message.push(resetMessage);
|
|
13304
|
+
console.log(resetMessage);
|
|
13305
|
+
this.fhirClient.options.agentManager.ResetAgent();
|
|
13245
13306
|
}
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
this.runner.instrumentData.
|
|
13249
|
-
|
|
13250
|
-
this.runner.instrumentData.message.push(chalk$1.green(`Iteration: [${this.runner.iteration} #authUtilsNode(): Agent Reset`));
|
|
13307
|
+
});
|
|
13308
|
+
__privateAdd(this, _CheckResetAgent, () => {
|
|
13309
|
+
if (this.runner.instrumentData.requestCount % this.runner.options.agentResetMod === 0) {
|
|
13310
|
+
__privateGet(this, _ResetAgent).call(this, "agentResetMod triggered");
|
|
13251
13311
|
}
|
|
13252
|
-
const retVal = await this.GetAccessToken();
|
|
13253
|
-
this.Debug(`ExecuteRunner(): RetVal: [${retVal}]`);
|
|
13254
|
-
this.accesssToken = null;
|
|
13255
|
-
this.runner.instrumentData.coreCount = 1;
|
|
13256
|
-
this.runner.instrumentData.requestCount++;
|
|
13257
|
-
this.runner.instrumentData.velocity++;
|
|
13258
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
13259
|
-
const end = performance.now();
|
|
13260
|
-
const diff = end - start;
|
|
13261
|
-
this.runner.instrumentData.duration = diff;
|
|
13262
|
-
await this.PublishTelemetry();
|
|
13263
|
-
return true;
|
|
13264
13312
|
});
|
|
13265
|
-
if (this.agentManager) {
|
|
13266
|
-
this.agentManager.agentResetCount = runner.options.agentResetMod;
|
|
13267
|
-
}
|
|
13268
|
-
}
|
|
13269
|
-
}
|
|
13270
|
-
class TestCaseFhir02 extends TestCaseFhirBase {
|
|
13271
|
-
constructor(workerInstance, runner) {
|
|
13272
|
-
super(workerInstance, runner);
|
|
13273
13313
|
__publicField(this, "ExecuteRunner", async () => {
|
|
13274
13314
|
if (this.runner.iteration % 100 === 0) {
|
|
13275
|
-
this.Debug(
|
|
13315
|
+
this.Debug(`${this.runner.options.testType} -->> Iteration: ${this.runner.iteration}`);
|
|
13276
13316
|
}
|
|
13277
|
-
const iteration = this.runner.iteration;
|
|
13278
|
-
const start = performance.now();
|
|
13279
|
-
const options = this.runner.options;
|
|
13280
13317
|
if (this.runner.iteration === 0) {
|
|
13281
13318
|
await this.StartTestDataLoad();
|
|
13282
13319
|
}
|
|
13320
|
+
const start = performance.now();
|
|
13283
13321
|
this.runner.instrumentData.activeRequestCount++;
|
|
13284
|
-
|
|
13285
|
-
this.runner.instrumentData.message.push(chalk$1.green(`Iteration: [${iteration} #authUtilsNode(): Agent Reset`));
|
|
13286
|
-
}
|
|
13287
|
-
const personRecord = this.GetPersonRecord(`${options.personPrefix}`, iteration);
|
|
13322
|
+
__privateGet(this, _CheckResetAgent).call(this);
|
|
13288
13323
|
try {
|
|
13289
|
-
|
|
13290
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13291
|
-
this.runner.instrumentData.errorCount++;
|
|
13292
|
-
});
|
|
13324
|
+
await this.ExecuteQuery();
|
|
13293
13325
|
} catch (error) {
|
|
13294
13326
|
this.runner.instrumentData.errorCount++;
|
|
13327
|
+
const message = `TestCaseFhirQueryBase:ExecuteRunner(): TestType: [${this.runner.options.testType}], Error: [${error}]`;
|
|
13328
|
+
this.LogErrorMessage(message);
|
|
13329
|
+
__privateGet(this, _ResetAgent).call(this, message);
|
|
13295
13330
|
}
|
|
13296
13331
|
this.runner.instrumentData.coreCount = 1;
|
|
13297
13332
|
this.runner.instrumentData.requestCount++;
|
|
@@ -13303,76 +13338,49 @@ class TestCaseFhir02 extends TestCaseFhirBase {
|
|
|
13303
13338
|
await this.PublishTelemetry();
|
|
13304
13339
|
return true;
|
|
13305
13340
|
});
|
|
13306
|
-
if (this.agentManager) {
|
|
13307
|
-
this.agentManager.agentResetCount = runner.options.agentResetMod;
|
|
13308
|
-
}
|
|
13309
13341
|
}
|
|
13310
13342
|
}
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
}
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13343
|
+
_ResetAgent = new WeakMap();
|
|
13344
|
+
_CheckResetAgent = new WeakMap();
|
|
13345
|
+
class TestCaseFhir01 extends TestCaseFhirQueryBase {
|
|
13346
|
+
constructor() {
|
|
13347
|
+
super(...arguments);
|
|
13348
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13349
|
+
await this.GetAccessToken();
|
|
13350
|
+
this.accesssToken = null;
|
|
13351
|
+
return null;
|
|
13352
|
+
});
|
|
13353
|
+
}
|
|
13354
|
+
}
|
|
13355
|
+
class TestCaseFhir02 extends TestCaseFhirQueryBase {
|
|
13356
|
+
constructor() {
|
|
13357
|
+
super(...arguments);
|
|
13358
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13359
|
+
return await this.fhirClient.CreateResource("Person", this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration));
|
|
13360
|
+
});
|
|
13361
|
+
}
|
|
13362
|
+
}
|
|
13363
|
+
class TestCaseFhir03 extends TestCaseFhirQueryBase {
|
|
13364
|
+
constructor() {
|
|
13365
|
+
super(...arguments);
|
|
13366
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13367
|
+
const personRecord = this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration);
|
|
13368
|
+
const retVal = await this.fhirClient.GetResource("Person", personRecord.id, null);
|
|
13333
13369
|
const p1 = JSON.stringify(personRecord);
|
|
13334
13370
|
const p2 = JSON.stringify(retVal);
|
|
13335
|
-
|
|
13336
|
-
if (compareReocrds !== 0) {
|
|
13371
|
+
if (p1.localeCompare(p2) !== 0) {
|
|
13337
13372
|
this.runner.instrumentData.errorCount++;
|
|
13338
13373
|
}
|
|
13339
|
-
|
|
13340
|
-
this.runner.instrumentData.requestCount++;
|
|
13341
|
-
this.runner.instrumentData.velocity++;
|
|
13342
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
13343
|
-
const end = performance.now();
|
|
13344
|
-
const diff = end - start;
|
|
13345
|
-
this.runner.instrumentData.duration = diff;
|
|
13346
|
-
await this.PublishTelemetry();
|
|
13347
|
-
return true;
|
|
13374
|
+
return retVal;
|
|
13348
13375
|
});
|
|
13349
|
-
if (this.agentManager) {
|
|
13350
|
-
this.agentManager.agentResetCount = runner.options.agentResetMod;
|
|
13351
|
-
}
|
|
13352
13376
|
}
|
|
13353
13377
|
}
|
|
13354
|
-
class TestCaseFhir04 extends
|
|
13355
|
-
constructor(
|
|
13356
|
-
super(
|
|
13357
|
-
__publicField(this, "
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
}
|
|
13361
|
-
const iteration = this.runner.iteration;
|
|
13362
|
-
const start = performance.now();
|
|
13363
|
-
const options = this.runner.options;
|
|
13364
|
-
if (this.runner.iteration === 0) {
|
|
13365
|
-
await this.StartTestDataLoad();
|
|
13366
|
-
}
|
|
13367
|
-
this.runner.instrumentData.activeRequestCount++;
|
|
13368
|
-
if (this.runner.instrumentData.requestCount % options.agentResetMod === 0) {
|
|
13369
|
-
this.runner.instrumentData.message.push(chalk$1.green(`Iteration: [${iteration} #authUtilsNode(): Agent Reset`));
|
|
13370
|
-
}
|
|
13371
|
-
const personRecord = this.GetPersonRecord(`${options.personPrefix}`, iteration);
|
|
13372
|
-
const originalPersonRecord = await this.fhirClient.GetResource("Person", personRecord.id, null, (error) => {
|
|
13373
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13374
|
-
this.runner.instrumentData.errorCount++;
|
|
13375
|
-
});
|
|
13378
|
+
class TestCaseFhir04 extends TestCaseFhirQueryBase {
|
|
13379
|
+
constructor() {
|
|
13380
|
+
super(...arguments);
|
|
13381
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13382
|
+
const personRecord = this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration);
|
|
13383
|
+
const originalPersonRecord = await this.fhirClient.GetResource("Person", personRecord.id, null);
|
|
13376
13384
|
const p1 = JSON.stringify(personRecord);
|
|
13377
13385
|
const p2 = JSON.stringify(originalPersonRecord);
|
|
13378
13386
|
const compareRecords = p1.localeCompare(p2);
|
|
@@ -13380,132 +13388,52 @@ class TestCaseFhir04 extends TestCaseFhirBase {
|
|
|
13380
13388
|
this.runner.instrumentData.errorCount++;
|
|
13381
13389
|
}
|
|
13382
13390
|
if (originalPersonRecord && originalPersonRecord.text) {
|
|
13383
|
-
originalPersonRecord.text.div = `Updated record ${iteration}`;
|
|
13384
|
-
const retVal = await this.fhirClient.UpdateResource("Person", originalPersonRecord
|
|
13385
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13386
|
-
this.runner.instrumentData.errorCount++;
|
|
13387
|
-
});
|
|
13391
|
+
originalPersonRecord.text.div = `Updated record ${this.runner.iteration}`;
|
|
13392
|
+
const retVal = await this.fhirClient.UpdateResource("Person", originalPersonRecord);
|
|
13388
13393
|
const p12 = JSON.stringify(retVal);
|
|
13389
13394
|
const p22 = JSON.stringify(originalPersonRecord);
|
|
13390
13395
|
const compareRecords2 = p12.localeCompare(p22);
|
|
13391
13396
|
if (compareRecords2 !== 0) {
|
|
13392
13397
|
this.runner.instrumentData.errorCount++;
|
|
13393
13398
|
}
|
|
13399
|
+
return retVal;
|
|
13394
13400
|
} else {
|
|
13395
13401
|
this.runner.instrumentData.errorCount++;
|
|
13402
|
+
return null;
|
|
13396
13403
|
}
|
|
13397
|
-
this.runner.instrumentData.coreCount = 1;
|
|
13398
|
-
this.runner.instrumentData.requestCount++;
|
|
13399
|
-
this.runner.instrumentData.velocity++;
|
|
13400
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
13401
|
-
const end = performance.now();
|
|
13402
|
-
const diff = end - start;
|
|
13403
|
-
this.runner.instrumentData.duration = diff;
|
|
13404
|
-
await this.PublishTelemetry();
|
|
13405
|
-
return true;
|
|
13406
13404
|
});
|
|
13407
|
-
if (this.agentManager) {
|
|
13408
|
-
this.agentManager.agentResetCount = runner.options.agentResetMod;
|
|
13409
|
-
}
|
|
13410
13405
|
}
|
|
13411
13406
|
}
|
|
13412
|
-
class TestCaseFhir05 extends
|
|
13413
|
-
constructor(
|
|
13414
|
-
super(
|
|
13415
|
-
__publicField(this, "
|
|
13416
|
-
|
|
13417
|
-
this.Debug(`TestCaseFhir05(): -->> Iteration: ${this.runner.iteration}`);
|
|
13418
|
-
}
|
|
13419
|
-
const iteration = this.runner.iteration;
|
|
13420
|
-
const start = performance.now();
|
|
13421
|
-
const options = this.runner.options;
|
|
13422
|
-
if (this.runner.iteration === 0) {
|
|
13423
|
-
await this.StartTestDataLoad();
|
|
13424
|
-
}
|
|
13425
|
-
this.runner.instrumentData.activeRequestCount++;
|
|
13426
|
-
if (this.runner.instrumentData.requestCount % options.agentResetMod === 0) {
|
|
13427
|
-
this.runner.instrumentData.message.push(chalk$1.green(`Iteration: [${iteration} #authUtilsNode(): Agent Reset`));
|
|
13428
|
-
}
|
|
13429
|
-
const personRecord = this.GetPersonRecord(`${options.personPrefix}`, iteration);
|
|
13407
|
+
class TestCaseFhir05 extends TestCaseFhirQueryBase {
|
|
13408
|
+
constructor() {
|
|
13409
|
+
super(...arguments);
|
|
13410
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13411
|
+
const personRecord = this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration);
|
|
13430
13412
|
if (personRecord && personRecord.text) {
|
|
13431
|
-
personRecord.text.div = `Updated record ${iteration}`;
|
|
13432
|
-
const retVal = await this.fhirClient.UpdateResource("Person", personRecord
|
|
13433
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13434
|
-
this.runner.instrumentData.errorCount++;
|
|
13435
|
-
});
|
|
13413
|
+
personRecord.text.div = `Updated record ${this.runner.iteration}`;
|
|
13414
|
+
const retVal = await this.fhirClient.UpdateResource("Person", personRecord);
|
|
13436
13415
|
const p1 = JSON.stringify(retVal);
|
|
13437
13416
|
const p2 = JSON.stringify(personRecord);
|
|
13438
13417
|
const compareRecords = p1.localeCompare(p2);
|
|
13439
13418
|
if (compareRecords !== 0) {
|
|
13440
13419
|
this.runner.instrumentData.errorCount++;
|
|
13441
13420
|
}
|
|
13421
|
+
return retVal;
|
|
13442
13422
|
} else {
|
|
13443
13423
|
this.runner.instrumentData.errorCount++;
|
|
13424
|
+
return null;
|
|
13444
13425
|
}
|
|
13445
|
-
this.runner.instrumentData.coreCount = 1;
|
|
13446
|
-
this.runner.instrumentData.requestCount++;
|
|
13447
|
-
this.runner.instrumentData.velocity++;
|
|
13448
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
13449
|
-
const end = performance.now();
|
|
13450
|
-
const diff = end - start;
|
|
13451
|
-
this.runner.instrumentData.duration = diff;
|
|
13452
|
-
await this.PublishTelemetry();
|
|
13453
|
-
return true;
|
|
13454
|
-
});
|
|
13455
|
-
if (this.agentManager) {
|
|
13456
|
-
this.agentManager.agentResetCount = runner.options.agentResetMod;
|
|
13457
|
-
}
|
|
13458
|
-
}
|
|
13459
|
-
}
|
|
13460
|
-
class TestCaseFhirQueryBase extends TestCaseFhirBase {
|
|
13461
|
-
constructor(workerInstance, runner) {
|
|
13462
|
-
super(workerInstance, runner);
|
|
13463
|
-
__publicField(this, "ExecuteQuery", async (iteration, fhirClient) => {
|
|
13464
|
-
return null;
|
|
13465
|
-
});
|
|
13466
|
-
__publicField(this, "ExecuteRunner", async () => {
|
|
13467
|
-
if (this.runner.iteration % 100 === 0) {
|
|
13468
|
-
this.Debug(`-->> Iteration: ${this.runner.iteration}`);
|
|
13469
|
-
}
|
|
13470
|
-
const start = performance.now();
|
|
13471
|
-
const options = this.runner.options;
|
|
13472
|
-
this.runner.instrumentData.activeRequestCount++;
|
|
13473
|
-
if (this.runner.instrumentData.requestCount % options.agentResetMod === 0) {
|
|
13474
|
-
this.runner.instrumentData.message.push(chalk$1.green(`Iteration: [${this.runner.iteration} #authUtilsNode(): Agent Reset`));
|
|
13475
|
-
}
|
|
13476
|
-
const retVal = await this.ExecuteQuery(this.runner.iteration, this.fhirClient);
|
|
13477
|
-
if ((retVal == null ? void 0 : retVal.length) === 0) {
|
|
13478
|
-
this.runner.instrumentData.errorCount++;
|
|
13479
|
-
}
|
|
13480
|
-
this.runner.instrumentData.coreCount = 1;
|
|
13481
|
-
this.runner.instrumentData.requestCount++;
|
|
13482
|
-
this.runner.instrumentData.velocity++;
|
|
13483
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
13484
|
-
const end = performance.now();
|
|
13485
|
-
const diff = end - start;
|
|
13486
|
-
this.runner.instrumentData.duration = diff;
|
|
13487
|
-
await this.PublishTelemetry();
|
|
13488
|
-
return true;
|
|
13489
13426
|
});
|
|
13490
|
-
if (this.agentManager) {
|
|
13491
|
-
this.agentManager.agentResetCount = runner.options.agentResetMod;
|
|
13492
|
-
}
|
|
13493
13427
|
}
|
|
13494
13428
|
}
|
|
13495
13429
|
class TestCaseFhir06 extends TestCaseFhirQueryBase {
|
|
13496
13430
|
constructor() {
|
|
13497
13431
|
super(...arguments);
|
|
13498
|
-
__publicField(this, "ExecuteQuery", async (
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
}
|
|
13502
|
-
const searchLetter = String.fromCharCode(65 + iteration % 26);
|
|
13503
|
-
const retVal = await fhirClient.GetResources("Person", null, {
|
|
13432
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13433
|
+
const searchLetter = String.fromCharCode(65 + this.runner.iteration % 26);
|
|
13434
|
+
const retVal = await this.fhirClient.GetResources("Person", null, {
|
|
13504
13435
|
given: searchLetter,
|
|
13505
13436
|
family: searchLetter
|
|
13506
|
-
}, (error) => {
|
|
13507
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13508
|
-
this.runner.instrumentData.errorCount++;
|
|
13509
13437
|
});
|
|
13510
13438
|
return retVal;
|
|
13511
13439
|
});
|
|
@@ -13514,16 +13442,10 @@ class TestCaseFhir06 extends TestCaseFhirQueryBase {
|
|
|
13514
13442
|
class TestCaseFhir07 extends TestCaseFhirQueryBase {
|
|
13515
13443
|
constructor() {
|
|
13516
13444
|
super(...arguments);
|
|
13517
|
-
__publicField(this, "ExecuteQuery", async (
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
}
|
|
13521
|
-
const searchLetter = String.fromCharCode(65 + iteration % 26);
|
|
13522
|
-
const retVal = await fhirClient.GetResources("Person", null, {
|
|
13445
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13446
|
+
const searchLetter = String.fromCharCode(65 + this.runner.iteration % 26);
|
|
13447
|
+
const retVal = await this.fhirClient.GetResources("Person", null, {
|
|
13523
13448
|
given: searchLetter
|
|
13524
|
-
}, (error) => {
|
|
13525
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13526
|
-
this.runner.instrumentData.errorCount++;
|
|
13527
13449
|
});
|
|
13528
13450
|
return retVal;
|
|
13529
13451
|
});
|
|
@@ -13532,60 +13454,27 @@ class TestCaseFhir07 extends TestCaseFhirQueryBase {
|
|
|
13532
13454
|
class TestCaseFhir08 extends TestCaseFhirQueryBase {
|
|
13533
13455
|
constructor() {
|
|
13534
13456
|
super(...arguments);
|
|
13535
|
-
__publicField(this, "ExecuteQuery", async (
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
}
|
|
13539
|
-
const searchLetter = String.fromCharCode(65 + iteration % 26);
|
|
13540
|
-
const retVal = await fhirClient.GetResources("Person", null, {
|
|
13457
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13458
|
+
const searchLetter = String.fromCharCode(65 + this.runner.iteration % 26);
|
|
13459
|
+
const retVal = await this.fhirClient.GetResources("Person", null, {
|
|
13541
13460
|
family: searchLetter
|
|
13542
|
-
}, (error) => {
|
|
13543
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13544
|
-
this.runner.instrumentData.errorCount++;
|
|
13545
13461
|
});
|
|
13546
13462
|
return retVal;
|
|
13547
13463
|
});
|
|
13548
13464
|
}
|
|
13549
13465
|
}
|
|
13550
|
-
class TestCaseFhir09 extends
|
|
13551
|
-
constructor(
|
|
13552
|
-
super(
|
|
13553
|
-
__publicField(this, "
|
|
13554
|
-
|
|
13555
|
-
this.Debug(`TestCaseFhir09(): -->> Iteration: ${this.runner.iteration}`);
|
|
13556
|
-
}
|
|
13557
|
-
const iteration = this.runner.iteration;
|
|
13558
|
-
const start = performance.now();
|
|
13559
|
-
const options = this.runner.options;
|
|
13560
|
-
if (this.runner.iteration === 0) {
|
|
13561
|
-
await this.StartTestDataLoad();
|
|
13562
|
-
}
|
|
13563
|
-
this.runner.instrumentData.activeRequestCount++;
|
|
13564
|
-
if (this.runner.instrumentData.requestCount % options.agentResetMod === 0) {
|
|
13565
|
-
this.runner.instrumentData.message.push(chalk$1.green(`Iteration: [${iteration} #authUtilsNode(): Agent Reset`));
|
|
13566
|
-
}
|
|
13567
|
-
const personRecord = this.GetPersonRecord(`${options.personPrefix}`, iteration);
|
|
13466
|
+
class TestCaseFhir09 extends TestCaseFhirQueryBase {
|
|
13467
|
+
constructor() {
|
|
13468
|
+
super(...arguments);
|
|
13469
|
+
__publicField(this, "ExecuteQuery", async () => {
|
|
13470
|
+
const personRecord = this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration);
|
|
13568
13471
|
if (personRecord.text) {
|
|
13569
|
-
await this.fhirClient.DeleteResource("Person", personRecord.id
|
|
13570
|
-
this.LogErrorMessage(`test(POST /stsresource and query using filter): ${error}`);
|
|
13571
|
-
this.runner.instrumentData.errorCount++;
|
|
13572
|
-
});
|
|
13472
|
+
return await this.fhirClient.DeleteResource("Person", personRecord.id);
|
|
13573
13473
|
} else {
|
|
13574
13474
|
this.runner.instrumentData.errorCount++;
|
|
13475
|
+
return null;
|
|
13575
13476
|
}
|
|
13576
|
-
this.runner.instrumentData.coreCount = 1;
|
|
13577
|
-
this.runner.instrumentData.requestCount++;
|
|
13578
|
-
this.runner.instrumentData.velocity++;
|
|
13579
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
13580
|
-
const end = performance.now();
|
|
13581
|
-
const diff = end - start;
|
|
13582
|
-
this.runner.instrumentData.duration = diff;
|
|
13583
|
-
await this.PublishTelemetry();
|
|
13584
|
-
return true;
|
|
13585
13477
|
});
|
|
13586
|
-
if (this.agentManager) {
|
|
13587
|
-
this.agentManager.agentResetCount = runner.options.agentResetMod;
|
|
13588
|
-
}
|
|
13589
13478
|
}
|
|
13590
13479
|
}
|
|
13591
13480
|
class StartUpDelFhirResources extends TestCaseFhirBase {
|
|
@@ -13603,55 +13492,52 @@ class StartUpDelFhirResources extends TestCaseFhirBase {
|
|
|
13603
13492
|
this.runner.instrumentData.rx += 65e5;
|
|
13604
13493
|
let complete = false;
|
|
13605
13494
|
let totalRecordsDelete = 0;
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
this.LogErrorMessage(chalk$1.red(`ExecuteRunner():GetResources: Error: [${error}]`));
|
|
13614
|
-
const duration2 = (performance.now() - start2) / 1e3;
|
|
13615
|
-
__privateGet(this, _debug3).call(this, chalk$1.magenta(`ExecuteRunner() - post GetResources() - Total Duration (error): [${duration2}]`));
|
|
13616
|
-
});
|
|
13617
|
-
const duration = (performance.now() - start2) / 1e3;
|
|
13618
|
-
__privateGet(this, _debug3).call(this, chalk$1.magenta(`ExecuteRunner() - post GetResources() - Total Duration: [${duration}]`));
|
|
13619
|
-
__privateGet(this, _debug3).call(this, retVal);
|
|
13620
|
-
if (retVal) {
|
|
13621
|
-
__privateGet(this, _debug3).call(this, `Records already exist - going to delete ...`);
|
|
13622
|
-
__privateGet(this, _debug3).call(this, retVal.length);
|
|
13623
|
-
const start3 = performance.now();
|
|
13624
|
-
const delRetVal = await this.fhirClient.DeleteResources("Person", retVal, (error) => {
|
|
13625
|
-
this.LogErrorMessage(chalk$1.red(`test(POST /stsresource and query using filter): ${error}`));
|
|
13626
|
-
const duration3 = (performance.now() - start3) / 1e3;
|
|
13627
|
-
__privateGet(this, _debug3).call(this, chalk$1.magenta(`ExecuteRunner() - post DeleteResources() - Total Duration (error): [${duration3}]`));
|
|
13495
|
+
try {
|
|
13496
|
+
while (!complete) {
|
|
13497
|
+
const start2 = performance.now();
|
|
13498
|
+
__privateGet(this, _debug3).call(this, chalk$1.magenta(`ExecuteRunner() - pre GetResources()`));
|
|
13499
|
+
const retVal = await this.fhirClient.GetResources("Person", null, {
|
|
13500
|
+
limit: options.batchDeleteSize,
|
|
13501
|
+
prefix: options.personPrefix
|
|
13628
13502
|
});
|
|
13629
|
-
const
|
|
13630
|
-
__privateGet(this, _debug3).call(this, chalk$1.magenta(`ExecuteRunner() - post
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13503
|
+
const duration = (performance.now() - start2) / 1e3;
|
|
13504
|
+
__privateGet(this, _debug3).call(this, chalk$1.magenta(`ExecuteRunner() - post GetResources() - Total Duration: [${duration}]`));
|
|
13505
|
+
__privateGet(this, _debug3).call(this, retVal);
|
|
13506
|
+
if (retVal) {
|
|
13507
|
+
__privateGet(this, _debug3).call(this, `Records already exist - going to delete ...`);
|
|
13508
|
+
__privateGet(this, _debug3).call(this, retVal.length);
|
|
13509
|
+
const start3 = performance.now();
|
|
13510
|
+
const delRetVal = await this.fhirClient.DeleteResources("Person", retVal);
|
|
13511
|
+
const duration2 = (performance.now() - start3) / 1e3;
|
|
13512
|
+
__privateGet(this, _debug3).call(this, chalk$1.magenta(`ExecuteRunner() - post DeleteResources() - Total Duration: [${duration2}]`));
|
|
13513
|
+
if (delRetVal) {
|
|
13514
|
+
if (delRetVal.length === 0) {
|
|
13515
|
+
complete = true;
|
|
13516
|
+
} else {
|
|
13517
|
+
__privateGet(this, _debug3).call(this, `Records deleted ...`);
|
|
13518
|
+
__privateGet(this, _debug3).call(this, delRetVal.length);
|
|
13519
|
+
totalRecordsDelete += delRetVal.length;
|
|
13520
|
+
__privateGet(this, _debug3).call(this, chalk$1.red(`total records delete = ${totalRecordsDelete}`));
|
|
13521
|
+
}
|
|
13634
13522
|
} else {
|
|
13635
|
-
|
|
13636
|
-
__privateGet(this, _debug3).call(this, delRetVal.length);
|
|
13637
|
-
totalRecordsDelete += delRetVal.length;
|
|
13638
|
-
__privateGet(this, _debug3).call(this, chalk$1.red(`total records delete = ${totalRecordsDelete}`));
|
|
13523
|
+
complete = true;
|
|
13639
13524
|
}
|
|
13640
13525
|
} else {
|
|
13641
13526
|
complete = true;
|
|
13642
13527
|
}
|
|
13643
|
-
|
|
13644
|
-
complete = true;
|
|
13528
|
+
await Sleep(1);
|
|
13645
13529
|
}
|
|
13646
|
-
|
|
13530
|
+
__privateGet(this, _debug3).call(this, chalk$1.red(`total records delete = ${totalRecordsDelete}`));
|
|
13531
|
+
this.runner.instrumentData.activeRequestCount--;
|
|
13532
|
+
const end = performance.now();
|
|
13533
|
+
const diff = end - start;
|
|
13534
|
+
this.runner.instrumentData.duration = diff;
|
|
13535
|
+
await this.PublishTelemetry();
|
|
13536
|
+
return true;
|
|
13537
|
+
} catch (error) {
|
|
13538
|
+
console.error(`StartUpDelFhirResources:ExecuteRunner(): Error: [${error}]`);
|
|
13539
|
+
return false;
|
|
13647
13540
|
}
|
|
13648
|
-
__privateGet(this, _debug3).call(this, chalk$1.red(`total records delete = ${totalRecordsDelete}`));
|
|
13649
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
13650
|
-
const end = performance.now();
|
|
13651
|
-
const diff = end - start;
|
|
13652
|
-
this.runner.instrumentData.duration = diff;
|
|
13653
|
-
await this.PublishTelemetry();
|
|
13654
|
-
return true;
|
|
13655
13541
|
});
|
|
13656
13542
|
}
|
|
13657
13543
|
}
|
|
@@ -15707,9 +15593,7 @@ class SetupFhirTestResources extends TestCaseFhirBase {
|
|
|
15707
15593
|
const personRecord = __privateGet(this, _GetPersonRecord).call(this, options.testBlocksPrefix, options.personPrefix, this.runner.iteration, options.blockSize);
|
|
15708
15594
|
__privateGet(this, _debug4).call(this, chalk$1.yellow(`ExecuteRunner(): Record Length: [${JSON.stringify(personRecord).length}]`));
|
|
15709
15595
|
try {
|
|
15710
|
-
const retVal = await this.fhirClient.CreateResource("Person", personRecord
|
|
15711
|
-
this.LogErrorMessage(`ExecuteRunner():CreateResource: Error: [${error}]`);
|
|
15712
|
-
});
|
|
15596
|
+
const retVal = await this.fhirClient.CreateResource("Person", personRecord);
|
|
15713
15597
|
__privateGet(this, _debug4).call(this, chalk$1.yellow(`ExecuteRunner():CreateResource: Return ID: [${retVal == null ? void 0 : retVal.id}]`));
|
|
15714
15598
|
} catch (error) {
|
|
15715
15599
|
__privateGet(this, _error2).call(this, chalk$1.red(`ExecuteRunner():CreateResource: Error: [${error}]`));
|