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