@nsshunt/ststestrunner 1.1.146 → 1.1.147
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
CHANGED
|
@@ -37015,43 +37015,20 @@ var AuthHelper = class extends import_tiny_emitter.TinyEmitter {
|
|
|
37015
37015
|
}
|
|
37016
37016
|
};
|
|
37017
37017
|
GetAccessToken = async () => {
|
|
37018
|
-
let timeout = void 0;
|
|
37019
37018
|
const start = performance.now();
|
|
37020
37019
|
try {
|
|
37021
37020
|
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
37021
|
const scopes = `api://fb6513e4-16fe-4931-bed8-33b82b404a14/_.stsfhir5:All`.split(" ").sort().join(" ");
|
|
37040
37022
|
const authendpointUrl = `${this._options.authOptions.asendpoint}:${this._options.authOptions.asport}`;
|
|
37041
|
-
const
|
|
37023
|
+
const retVal = await this.GetAPITokenFromAuthServerUsingScope({
|
|
37042
37024
|
clientId: "d8277fce-bb48-44c2-bbf1-257fe13a444b",
|
|
37043
37025
|
authClientSecret: "64e3ef37-c7b8-4cb1-880a-e6ad3ab36e3c",
|
|
37044
37026
|
scope: scopes,
|
|
37045
37027
|
endPoint: authendpointUrl
|
|
37046
37028
|
});
|
|
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);
|
|
37029
|
+
this.#accesssToken = retVal;
|
|
37052
37030
|
return this.#accesssToken;
|
|
37053
37031
|
} catch (error) {
|
|
37054
|
-
if (timeout) clearTimeout(timeout);
|
|
37055
37032
|
error.message = `GetAccessToken(): Error: [${error}], Duration until error: [${performance.now() - start}]`;
|
|
37056
37033
|
this.Error(error);
|
|
37057
37034
|
return "";
|