@nsshunt/ststestrunner 1.1.146 → 1.1.148

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.
@@ -1449,52 +1449,20 @@ var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
1449
1449
  //#endregion
1450
1450
  //#region src/libmodule/testCaseFhir02.ts
1451
1451
  var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
1452
- bundleBatch;
1453
- personRecords = [];
1454
1452
  PerformExecuteQuery = async () => {
1455
1453
  const __snapshot1 = performance.now();
1456
1454
  const client = await this.GetClient();
1457
1455
  const __snapshot2 = this._CheckOutputLongDurationError(__snapshot1, "await this.GetClient()");
1458
1456
  const prefix = this.runner.options.personPrefix;
1459
- const bundleSize = this.runner.options.bundleSize;
1460
- if (this.runner.iteration === 0) this.bundleBatch = {
1461
- "resourceType": "Bundle",
1462
- "type": "transaction",
1463
- "entry": []
1464
- };
1465
1457
  const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
1466
1458
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1467
- this.personRecords.push(personRecord);
1468
- this.bundleBatch.entry.push({
1469
- fullUrl: personRecord.id,
1470
- resource: personRecord,
1471
- request: {
1472
- method: "POST",
1473
- url: "Person"
1474
- }
1475
- });
1476
- let retVal = void 0;
1477
- if (this.runner.iteration % bundleSize === bundleSize - 1) {
1478
- retVal = await client.ProcessBatchOrTransactionResources(this.bundleBatch);
1479
- this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1480
- this.bundleBatch.entry = [];
1481
- } else if (this.runner.iteration === this.runner.options.executionProfile.iterations - 1) {
1482
- retVal = await client.ProcessBatchOrTransactionResources(this.bundleBatch);
1483
- this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1484
- this.bundleBatch.entry = [];
1485
- }
1486
- if (retVal && retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1487
- if (retVal) {
1488
- for (let i = 0; i < retVal.body.entry.length - 1; i++) {
1489
- const personRecord = this.personRecords[i];
1490
- delete personRecord.meta;
1491
- const retPersonData = { ...retVal.body.entry[i].resource };
1492
- delete retPersonData.meta;
1493
- this.CheckReturnData(personRecord, retPersonData);
1494
- }
1495
- this.personRecords = [];
1496
- }
1497
- return personRecord;
1459
+ const retVal = await client.PostResource("Person", personRecord);
1460
+ this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1461
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1462
+ delete personRecord.meta;
1463
+ delete retVal.body.meta;
1464
+ this.CheckReturnData(personRecord, retVal.body);
1465
+ return retVal.body;
1498
1466
  };
1499
1467
  };
1500
1468
  //#endregion
@@ -37020,43 +36988,20 @@ var AuthHelper = class extends import_tiny_emitter.TinyEmitter {
37020
36988
  }
37021
36989
  };
37022
36990
  GetAccessToken = async () => {
37023
- let timeout = void 0;
37024
36991
  const start = performance.now();
37025
36992
  try {
37026
36993
  if (this.#accesssToken) return this.#accesssToken;
37027
- const lockKey = "GetAccessToken";
37028
- const lockTimeout = 6e4;
37029
- if (this._lockHelper.GetOnHold(lockKey) === true) try {
37030
- performance.now();
37031
- await this._lockHelper.WaitOnHold(lockKey, lockTimeout);
37032
- if (this.#accesssToken) return this.#accesssToken;
37033
- else {
37034
- this.Error(chalk.default.red(`GetAccessToken(): Could not get existing accesssToken (post hold release), lock key: [${lockKey}]`));
37035
- this.Error(chalk.default.red(`GetAccessToken(): continue anyway ...`));
37036
- }
37037
- } catch (error) {
37038
- this.Error(chalk.default.red(`GetAccessToken(): Error: [${error}]`));
37039
- }
37040
- this._lockHelper.SetOnHold(lockKey);
37041
- timeout = setTimeout(() => {
37042
- this.Warning(chalk.default.magenta(`GetAccessToken(): Timeout: [${this._authMaxTimeout}] exceeded for getting access token ...`));
37043
- }, this._authMaxTimeout);
37044
36994
  const scopes = `api://fb6513e4-16fe-4931-bed8-33b82b404a14/_.stsfhir5:All`.split(" ").sort().join(" ");
37045
36995
  const authendpointUrl = `${this._options.authOptions.asendpoint}:${this._options.authOptions.asport}`;
37046
- const workingAaccesssToken = await this.GetAPITokenFromAuthServerUsingScope({
36996
+ const retVal = await this.GetAPITokenFromAuthServerUsingScope({
37047
36997
  clientId: "d8277fce-bb48-44c2-bbf1-257fe13a444b",
37048
36998
  authClientSecret: "64e3ef37-c7b8-4cb1-880a-e6ad3ab36e3c",
37049
36999
  scope: scopes,
37050
37000
  endPoint: authendpointUrl
37051
37001
  });
37052
- if (timeout) clearTimeout(timeout);
37053
- const totalTime = performance.now() - start;
37054
- if (totalTime > this._authMaxTimeout) this.Warning(chalk.default.magenta(`GetAccessToken(): The total time for getting the access token: [${totalTime}]`));
37055
- this.#accesssToken = workingAaccesssToken;
37056
- this._lockHelper.ReleaseOnHold(lockKey);
37002
+ this.#accesssToken = retVal;
37057
37003
  return this.#accesssToken;
37058
37004
  } catch (error) {
37059
- if (timeout) clearTimeout(timeout);
37060
37005
  error.message = `GetAccessToken(): Error: [${error}], Duration until error: [${performance.now() - start}]`;
37061
37006
  this.Error(error);
37062
37007
  return "";