@nsshunt/stsoauth2plugin 1.0.95 → 1.0.97

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.
@@ -1,27 +1,14 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- var __accessCheck = (obj, member, msg) => {
8
- if (!member.has(obj))
9
- throw TypeError("Cannot " + msg);
10
- };
11
- var __privateGet = (obj, member, getter) => {
12
- __accessCheck(obj, member, "read from private field");
13
- return getter ? getter.call(obj) : member.get(obj);
14
- };
15
- var __privateAdd = (obj, member, value) => {
16
- if (member.has(obj))
17
- throw TypeError("Cannot add the same private member more than once");
18
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
19
- };
20
- var __privateSet = (obj, member, value, setter) => {
21
- __accessCheck(obj, member, "write to private field");
22
- setter ? setter.call(obj, value) : member.set(obj, value);
23
- return value;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
24
4
  };
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
25
12
  var __privateWrapper = (obj, member, setter, getter) => ({
26
13
  set _(value) {
27
14
  __privateSet(obj, member, value, setter);
@@ -30,11 +17,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
30
17
  return __privateGet(obj, member, getter);
31
18
  }
32
19
  });
33
- var __privateMethod = (obj, member, method) => {
34
- __accessCheck(obj, member, "access private method");
35
- return method;
36
- };
37
- var _crypto, _router, _cUtils, _qParams, _STORAGE_AUTHORIZE_OPTIONS_KEY, _STORAGE_SESSION_KEY, _aic, _options, _messages, _oauth2ManagerPort, _messageId, _messageHandlers, _messageTimeout, _worker, _transactionStore, _operationSemaphore, _maxSemaphoreRetries, _semaphoreRetrySleep, _LogDebugMessage, LogDebugMessage_fn, _LogInfoMessage, LogInfoMessage_fn, _LogErrorMessage, LogErrorMessage_fn, _ProcessMessageResponse, _PostMessage, _HandleLogEvent, _HandleUpdateInstrumentEvent, _GetStore, _HandleErrorEvent, _HandleAuthenticateEvent, _SetupRoute, _clientSessionStore, _cUtils2, _qParams2, _STORAGE_SESSION_KEY2, _oauthWorkerPort, _options2, _httpsAgent, _logger, _LogDebugMessage2, LogDebugMessage_fn2, _LogInfoMessage2, LogInfoMessage_fn2, _LogErrorMessage2, LogErrorMessage_fn2, _HandleAuthenticateEvent2, _HandleErrorEvent2, _LogMessage, _GetAccessToken, _GetCookies, _UpdateInstrument, _ProcessCommand, _RestoreSession, _Authorize, _HandleRedirect, _GetTokenFromBroker, _GetToken, _RefreshToken, _Logout;
20
+ var _crypto, _router, _cUtils, _qParams, _STORAGE_AUTHORIZE_OPTIONS_KEY, _STORAGE_SESSION_KEY, _aic, _options, _messages, _oauth2ManagerPort, _messageId, _messageHandlers, _messageTimeout, _worker, _transactionStore, _operationSemaphore, _maxSemaphoreRetries, _semaphoreRetrySleep, _STSOAuth2Manager_instances, LogDebugMessage_fn, LogInfoMessage_fn, LogErrorMessage_fn, _ProcessMessageResponse, _PostMessage, _HandleLogEvent, _HandleUpdateInstrumentEvent, _GetStore, _HandleErrorEvent, _HandleAuthenticateEvent, _SetupRoute, _clientSessionStore, _cUtils2, _qParams2, _STORAGE_SESSION_KEY2, _oauthWorkerPort, _options2, _httpsAgent, _logger, _STSOAuth2Worker_instances, LogDebugMessage_fn2, LogInfoMessage_fn2, LogErrorMessage_fn2, _HandleAuthenticateEvent2, _HandleErrorEvent2, _LogMessage, _GetAccessToken, _GetCookies, _UpdateInstrument, _ProcessCommand, _RestoreSession, _Authorize, _HandleRedirect, _GetTokenFromBroker, _GetToken, _RefreshToken, _Logout;
38
21
  import { inject } from "vue";
39
22
  import * as wt from "node:worker_threads";
40
23
  import { OAuth2ParameterType, Sleep } from "@nsshunt/stsutils";
@@ -50,8 +33,7 @@ function getDefaultExportFromCjs(x) {
50
33
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
51
34
  }
52
35
  function getAugmentedNamespace(n) {
53
- if (n.__esModule)
54
- return n;
36
+ if (n.__esModule) return n;
55
37
  var f = n.default;
56
38
  if (typeof f == "function") {
57
39
  var a = function a2() {
@@ -61,8 +43,7 @@ function getAugmentedNamespace(n) {
61
43
  return f.apply(this, arguments);
62
44
  };
63
45
  a.prototype = f.prototype;
64
- } else
65
- a = {};
46
+ } else a = {};
66
47
  Object.defineProperty(a, "__esModule", { value: true });
67
48
  Object.keys(n).forEach(function(k) {
68
49
  var d = Object.getOwnPropertyDescriptor(n, k);
@@ -79,8 +60,7 @@ var ansiStyles$1 = { exports: {} };
79
60
  var colorName;
80
61
  var hasRequiredColorName;
81
62
  function requireColorName() {
82
- if (hasRequiredColorName)
83
- return colorName;
63
+ if (hasRequiredColorName) return colorName;
84
64
  hasRequiredColorName = 1;
85
65
  colorName = {
86
66
  "aliceblue": [240, 248, 255],
@@ -237,8 +217,7 @@ function requireColorName() {
237
217
  var conversions;
238
218
  var hasRequiredConversions;
239
219
  function requireConversions() {
240
- if (hasRequiredConversions)
241
- return conversions;
220
+ if (hasRequiredConversions) return conversions;
242
221
  hasRequiredConversions = 1;
243
222
  const cssKeywords = requireColorName();
244
223
  const reverseKeywords = {};
@@ -910,8 +889,7 @@ function requireConversions() {
910
889
  var route;
911
890
  var hasRequiredRoute;
912
891
  function requireRoute() {
913
- if (hasRequiredRoute)
914
- return route;
892
+ if (hasRequiredRoute) return route;
915
893
  hasRequiredRoute = 1;
916
894
  const conversions2 = requireConversions();
917
895
  function buildGraph() {
@@ -982,8 +960,7 @@ function requireRoute() {
982
960
  var colorConvert;
983
961
  var hasRequiredColorConvert;
984
962
  function requireColorConvert() {
985
- if (hasRequiredColorConvert)
986
- return colorConvert;
963
+ if (hasRequiredColorConvert) return colorConvert;
987
964
  hasRequiredColorConvert = 1;
988
965
  const conversions2 = requireConversions();
989
966
  const route2 = requireRoute();
@@ -1220,8 +1197,7 @@ var util = {
1220
1197
  var templates;
1221
1198
  var hasRequiredTemplates;
1222
1199
  function requireTemplates() {
1223
- if (hasRequiredTemplates)
1224
- return templates;
1200
+ if (hasRequiredTemplates) return templates;
1225
1201
  hasRequiredTemplates = 1;
1226
1202
  const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
1227
1203
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
@@ -1518,8 +1494,7 @@ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
1518
1494
  const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
1519
1495
  var hasRequiredCore;
1520
1496
  function requireCore() {
1521
- if (hasRequiredCore)
1522
- return core.exports;
1497
+ if (hasRequiredCore) return core.exports;
1523
1498
  hasRequiredCore = 1;
1524
1499
  (function(module, exports) {
1525
1500
  (function(root, factory) {
@@ -2343,7 +2318,7 @@ var encBase64Exports = encBase64.exports;
2343
2318
  const Base64 = /* @__PURE__ */ getDefaultExportFromCjs(encBase64Exports);
2344
2319
  class CryptoUtils {
2345
2320
  constructor() {
2346
- __privateAdd(this, _crypto, void 0);
2321
+ __privateAdd(this, _crypto);
2347
2322
  __publicField(this, "DigestMessage", async function(message) {
2348
2323
  const hashDigest = sha256(message);
2349
2324
  return Base64.stringify(hashDigest);
@@ -2388,8 +2363,7 @@ class QueryParams {
2388
2363
  let tmp;
2389
2364
  vars.forEach(function(v) {
2390
2365
  tmp = v.split("=");
2391
- if (tmp.length == 2)
2392
- getVars[tmp[0]] = tmp[1];
2366
+ if (tmp.length == 2) getVars[tmp[0]] = tmp[1];
2393
2367
  });
2394
2368
  retVal = this.DecodeQueryParams(getVars);
2395
2369
  }
@@ -2537,9 +2511,7 @@ const STSOauth2Store = defineStore("__sts__STSOauth2Store", {
2537
2511
  class STSOAuth2Manager {
2538
2512
  // ms
2539
2513
  constructor(app, options) {
2540
- __privateAdd(this, _LogDebugMessage);
2541
- __privateAdd(this, _LogInfoMessage);
2542
- __privateAdd(this, _LogErrorMessage);
2514
+ __privateAdd(this, _STSOAuth2Manager_instances);
2543
2515
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2544
2516
  __privateAdd(this, _router, null);
2545
2517
  __privateAdd(this, _cUtils, new CryptoUtils());
@@ -2547,16 +2519,16 @@ class STSOAuth2Manager {
2547
2519
  __privateAdd(this, _STORAGE_AUTHORIZE_OPTIONS_KEY, "authorize_options.stsmda.com.au");
2548
2520
  __privateAdd(this, _STORAGE_SESSION_KEY, "session.stsmda.com.au");
2549
2521
  __privateAdd(this, _aic, null);
2550
- __privateAdd(this, _options, void 0);
2522
+ __privateAdd(this, _options);
2551
2523
  __privateAdd(this, _messages, {});
2552
- __privateAdd(this, _oauth2ManagerPort, void 0);
2524
+ __privateAdd(this, _oauth2ManagerPort);
2553
2525
  __privateAdd(this, _messageId, 0);
2554
2526
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2555
2527
  __privateAdd(this, _messageHandlers, {});
2556
2528
  // keyed by messageId
2557
2529
  __privateAdd(this, _messageTimeout, 1e4);
2558
- __privateAdd(this, _worker, void 0);
2559
- __privateAdd(this, _transactionStore, void 0);
2530
+ __privateAdd(this, _worker);
2531
+ __privateAdd(this, _transactionStore);
2560
2532
  // Transient transaction data used to establish a session via OAuth2 authorize handshake
2561
2533
  __privateAdd(this, _operationSemaphore, false);
2562
2534
  __privateAdd(this, _maxSemaphoreRetries, 100);
@@ -2564,7 +2536,7 @@ class STSOAuth2Manager {
2564
2536
  __privateAdd(this, _semaphoreRetrySleep, 50);
2565
2537
  __privateAdd(this, _ProcessMessageResponse, (data) => {
2566
2538
  const messageResponse = data;
2567
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#ProcessMessageResponse: message data = [${JSON.stringify(messageResponse)}]`));
2539
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#ProcessMessageResponse: message data = [${JSON.stringify(messageResponse)}]`));
2568
2540
  if (messageResponse.messageId === -1) {
2569
2541
  switch (messageResponse.command) {
2570
2542
  case IOauth2ListenerCommand.AUTHENTICATE_EVENT:
@@ -2601,10 +2573,10 @@ class STSOAuth2Manager {
2601
2573
  __privateGet(this, _messageHandlers)[message.messageId] = (response) => {
2602
2574
  clearTimeout(timeout);
2603
2575
  delete __privateGet(this, _messageHandlers)[message.messageId];
2604
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#PostMessage: resolve callback response= [${JSON.stringify(response)}]`));
2576
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#PostMessage: resolve callback response= [${JSON.stringify(response)}]`));
2605
2577
  resolve(response);
2606
2578
  };
2607
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#PostMessage: posting message = [${JSON.stringify(message)}]`));
2579
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#PostMessage: posting message = [${JSON.stringify(message)}]`));
2608
2580
  __privateGet(this, _oauth2ManagerPort).postMessage(message);
2609
2581
  });
2610
2582
  });
@@ -2612,7 +2584,7 @@ class STSOAuth2Manager {
2612
2584
  if (__privateGet(this, _aic)) {
2613
2585
  __privateGet(this, _aic).LogEx(message);
2614
2586
  }
2615
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, message);
2587
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, message);
2616
2588
  });
2617
2589
  // UpdateInstrument = (instrumentName: Gauge, telemetry: InstrumentBaseTelemetry): void => {
2618
2590
  __privateAdd(this, _HandleUpdateInstrumentEvent, (instrumentName, telemetry) => {
@@ -2625,8 +2597,7 @@ class STSOAuth2Manager {
2625
2597
  });
2626
2598
  // Will come from message channel
2627
2599
  __privateAdd(this, _HandleErrorEvent, (error) => {
2628
- if (isNode)
2629
- ;
2600
+ if (isNode) ;
2630
2601
  else {
2631
2602
  __privateGet(this, _GetStore).call(this).UpdateError({
2632
2603
  // Authorize applications store
@@ -2638,8 +2609,7 @@ class STSOAuth2Manager {
2638
2609
  }
2639
2610
  });
2640
2611
  __privateAdd(this, _HandleAuthenticateEvent, (id_token) => {
2641
- if (isNode)
2642
- ;
2612
+ if (isNode) ;
2643
2613
  else {
2644
2614
  if (__privateGet(this, _options).authenticateEvent) {
2645
2615
  __privateGet(this, _options).authenticateEvent(id_token);
@@ -2648,14 +2618,14 @@ class STSOAuth2Manager {
2648
2618
  }
2649
2619
  });
2650
2620
  __privateAdd(this, _SetupRoute, (app, router) => {
2651
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.gray(`STSOAuth2Manager:#SetupRoute`));
2621
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.gray(`STSOAuth2Manager:#SetupRoute`));
2652
2622
  router.beforeEach(async (to, from, next) => {
2653
2623
  const oAuth2Manager = app.config.globalProperties.$sts[STSOAuth2ManagerPluginKey];
2654
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.gray(`beforeEach: from: [${from.path}], to: [${to.path}]`));
2624
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.gray(`beforeEach: from: [${from.path}], to: [${to.path}]`));
2655
2625
  if (__privateGet(this, _GetStore).call(this).LoggedIn === false) {
2656
- __privateMethod(this, _LogInfoMessage, LogInfoMessage_fn).call(this, `Not logged in`);
2626
+ __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, `Not logged in`);
2657
2627
  if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}authorize`) === 0) {
2658
- __privateMethod(this, _LogInfoMessage, LogInfoMessage_fn).call(this, `to = ${__privateGet(this, _options).uriBase}authorize`);
2628
+ __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, `to = ${__privateGet(this, _options).uriBase}authorize`);
2659
2629
  next();
2660
2630
  return;
2661
2631
  } else if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}consent`) === 0) {
@@ -2682,9 +2652,9 @@ class STSOAuth2Manager {
2682
2652
  }
2683
2653
  const str = to.query;
2684
2654
  if (str[OAuth2ParameterType.CODE] || str[OAuth2ParameterType.ERROR]) {
2685
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:#SetupRoute:Processing redirect: [${JSON.stringify(str)}]`));
2655
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:#SetupRoute:Processing redirect: [${JSON.stringify(str)}]`));
2686
2656
  const retVal = await oAuth2Manager.HandleRedirect(str);
2687
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:#SetupRoute:Redirect result: [${retVal}]`));
2657
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:#SetupRoute:Redirect result: [${retVal}]`));
2688
2658
  if (retVal) {
2689
2659
  next({
2690
2660
  path: `${__privateGet(this, _options).uriBase}`,
@@ -2699,11 +2669,11 @@ class STSOAuth2Manager {
2699
2669
  return;
2700
2670
  }
2701
2671
  }
2702
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, `STSOAuth2Manager:#SetupRoute:Restoring session`);
2672
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, `STSOAuth2Manager:#SetupRoute:Restoring session`);
2703
2673
  const sessionRestored = await oAuth2Manager.RestoreSession();
2704
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, `STSOAuth2Manager:#SetupRoute:Session restored: [${sessionRestored}]`);
2674
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, `STSOAuth2Manager:#SetupRoute:Session restored: [${sessionRestored}]`);
2705
2675
  if (sessionRestored !== true) {
2706
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, `STSOAuth2Manager:#SetupRoute:Session not restored - need to authorize`);
2676
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, `STSOAuth2Manager:#SetupRoute:Session not restored - need to authorize`);
2707
2677
  oAuth2Manager.Authorize();
2708
2678
  next();
2709
2679
  return;
@@ -2740,7 +2710,7 @@ class STSOAuth2Manager {
2740
2710
  throw new Error(`STSOAuth2Manager:ExecuteRefreshToken:maxSemaphoreRetries: [${__privateGet(this, _maxSemaphoreRetries)}] exceeded.`);
2741
2711
  }
2742
2712
  await Sleep(__privateGet(this, _semaphoreRetrySleep));
2743
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.cyan(`STSOAuth2Manager:ExecuteRefreshToken:locked by operationSemaphore, retry count: [${retryCount}]`));
2713
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.cyan(`STSOAuth2Manager:ExecuteRefreshToken:locked by operationSemaphore, retry count: [${retryCount}]`));
2744
2714
  return await this.ExecuteRefreshToken(retryCount + 1);
2745
2715
  } else {
2746
2716
  __privateSet(this, _operationSemaphore, true);
@@ -2756,12 +2726,12 @@ class STSOAuth2Manager {
2756
2726
  });
2757
2727
  __publicField(this, "RestoreSession", async () => {
2758
2728
  try {
2759
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, `STSOAuth2Manager:RestoreSession:postMessage: [${IOauth2ListenerCommand.RESTORE_SESSION}]`);
2729
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, `STSOAuth2Manager:RestoreSession:postMessage: [${IOauth2ListenerCommand.RESTORE_SESSION}]`);
2760
2730
  const response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.RESTORE_SESSION });
2761
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, `STSOAuth2Manager:RestoreSession:response: [${JSON.stringify(response.payload)}]`);
2731
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, `STSOAuth2Manager:RestoreSession:response: [${JSON.stringify(response.payload)}]`);
2762
2732
  return response.payload;
2763
2733
  } catch (error) {
2764
- __privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$1.red(`RestoreSession Error: ${error}`));
2734
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`RestoreSession Error: ${error}`));
2765
2735
  return false;
2766
2736
  }
2767
2737
  });
@@ -2776,18 +2746,18 @@ class STSOAuth2Manager {
2776
2746
  return response.payload.authorizeOptionsClientCopy;
2777
2747
  }
2778
2748
  } catch (error) {
2779
- __privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$1.red(`Authorize Error: ${error}`));
2749
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`Authorize Error: ${error}`));
2780
2750
  }
2781
2751
  return {};
2782
2752
  });
2783
2753
  __publicField(this, "HandleRedirect", async (queryVars) => {
2784
2754
  try {
2785
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect`));
2755
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect`));
2786
2756
  let response = null;
2787
2757
  if (queryVars[OAuth2ParameterType.CODE]) {
2788
2758
  const authorizeOptions = __privateGet(this, _transactionStore).get(__privateGet(this, _STORAGE_AUTHORIZE_OPTIONS_KEY));
2789
2759
  __privateGet(this, _transactionStore).remove(__privateGet(this, _STORAGE_AUTHORIZE_OPTIONS_KEY));
2790
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect: sending HANDLE_REDIRECT command`));
2760
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect: sending HANDLE_REDIRECT command`));
2791
2761
  response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.HANDLE_REDIRECT, payload: {
2792
2762
  queryVars,
2793
2763
  authorizeOptions
@@ -2795,10 +2765,10 @@ class STSOAuth2Manager {
2795
2765
  } else {
2796
2766
  response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.HANDLE_REDIRECT, payload: queryVars });
2797
2767
  }
2798
- __privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect: HANDLE_REDIRECT response: [${JSON.stringify(response)}]`));
2768
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect: HANDLE_REDIRECT response: [${JSON.stringify(response)}]`));
2799
2769
  return response.payload;
2800
2770
  } catch (error) {
2801
- __privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$1.red(`HandleRedirect Error: ${error}`));
2771
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`HandleRedirect Error: ${error}`));
2802
2772
  return false;
2803
2773
  }
2804
2774
  });
@@ -2807,7 +2777,7 @@ class STSOAuth2Manager {
2807
2777
  const response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.LOGOUT });
2808
2778
  return response.payload;
2809
2779
  } catch (error) {
2810
- __privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$1.red(`Logout Error: ${error}`));
2780
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`Logout Error: ${error}`));
2811
2781
  return false;
2812
2782
  }
2813
2783
  });
@@ -2817,7 +2787,7 @@ class STSOAuth2Manager {
2817
2787
  const response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.LOGOUT });
2818
2788
  return response.payload;
2819
2789
  } catch (error) {
2820
- __privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$1.red(`InvokeExternalAPI Error: ${error}`));
2790
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`InvokeExternalAPI Error: ${error}`));
2821
2791
  return null;
2822
2792
  }
2823
2793
  });
@@ -2848,10 +2818,10 @@ class STSOAuth2Manager {
2848
2818
  }
2849
2819
  if (!isNode) {
2850
2820
  __privateGet(this, _worker).onmessage = (data) => {
2851
- __privateMethod(this, _LogInfoMessage, LogInfoMessage_fn).call(this, chalk$1.green(`this.#worker.onmessage = [${data}]`));
2821
+ __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, chalk$1.green(`this.#worker.onmessage = [${data}]`));
2852
2822
  };
2853
2823
  __privateGet(this, _worker).onerror = (error) => {
2854
- __privateMethod(this, _LogInfoMessage, LogInfoMessage_fn).call(this, chalk$1.green(`this.#worker.onerror = [${JSON.stringify(error)}]`));
2824
+ __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, chalk$1.green(`this.#worker.onerror = [${JSON.stringify(error)}]`));
2855
2825
  };
2856
2826
  }
2857
2827
  let workerMessage;
@@ -2908,15 +2878,13 @@ _transactionStore = new WeakMap();
2908
2878
  _operationSemaphore = new WeakMap();
2909
2879
  _maxSemaphoreRetries = new WeakMap();
2910
2880
  _semaphoreRetrySleep = new WeakMap();
2911
- _LogDebugMessage = new WeakSet();
2881
+ _STSOAuth2Manager_instances = new WeakSet();
2912
2882
  LogDebugMessage_fn = function(message) {
2913
2883
  __privateGet(this, _options).logger.debug(message);
2914
2884
  };
2915
- _LogInfoMessage = new WeakSet();
2916
2885
  LogInfoMessage_fn = function(message) {
2917
2886
  __privateGet(this, _options).logger.info(message);
2918
2887
  };
2919
- _LogErrorMessage = new WeakSet();
2920
2888
  LogErrorMessage_fn = function(message) {
2921
2889
  __privateGet(this, _options).logger.error(message);
2922
2890
  };
@@ -2991,22 +2959,17 @@ var StatusCodes;
2991
2959
  })(StatusCodes || (StatusCodes = {}));
2992
2960
  class STSOAuth2Worker {
2993
2961
  constructor(workerPort, options, logger) {
2994
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2995
- __privateAdd(this, _LogDebugMessage2);
2996
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2997
- __privateAdd(this, _LogInfoMessage2);
2998
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2999
- __privateAdd(this, _LogErrorMessage2);
2962
+ __privateAdd(this, _STSOAuth2Worker_instances);
3000
2963
  //#storageManager = null;
3001
- __privateAdd(this, _clientSessionStore, void 0);
2964
+ __privateAdd(this, _clientSessionStore);
3002
2965
  __privateAdd(this, _cUtils2, new CryptoUtils());
3003
2966
  __privateAdd(this, _qParams2, new QueryParams());
3004
2967
  __privateAdd(this, _STORAGE_SESSION_KEY2, "session.stsmda.com.au");
3005
2968
  //@@#aic = null;
3006
- __privateAdd(this, _oauthWorkerPort, void 0);
3007
- __privateAdd(this, _options2, void 0);
2969
+ __privateAdd(this, _oauthWorkerPort);
2970
+ __privateAdd(this, _options2);
3008
2971
  __privateAdd(this, _httpsAgent, null);
3009
- __privateAdd(this, _logger, void 0);
2972
+ __privateAdd(this, _logger);
3010
2973
  // Attempt to restore a previous session using the STSBroker
3011
2974
  /*
3012
2975
  { parameterType: OAuth2ParameterType.CLIENT_ID, errorType: authErrorType.CLIENT_ID_MISMATCH },
@@ -3096,7 +3059,7 @@ class STSOAuth2Worker {
3096
3059
  __publicField(this, "SetupListener", () => {
3097
3060
  __privateGet(this, _oauthWorkerPort).onmessage = async (data) => {
3098
3061
  const auth2ListenerMessage = data.data;
3099
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:SetupListener:onmessage: [${auth2ListenerMessage.command}]`);
3062
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:SetupListener:onmessage: [${auth2ListenerMessage.command}]`);
3100
3063
  switch (auth2ListenerMessage.command) {
3101
3064
  case IOauth2ListenerCommand.RESTORE_SESSION:
3102
3065
  __privateGet(this, _ProcessCommand).call(this, auth2ListenerMessage, await __privateGet(this, _RestoreSession).call(this));
@@ -3138,12 +3101,12 @@ class STSOAuth2Worker {
3138
3101
  const sessionData = __privateGet(this, _clientSessionStore).get(__privateGet(this, _STORAGE_SESSION_KEY2));
3139
3102
  if (sessionData) {
3140
3103
  restoredSessionData = sessionData.tokenResponse;
3141
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "Session restored from client storage.");
3104
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Session restored from client storage.");
3142
3105
  __privateGet(this, _LogMessage).call(this, "Session restored from client storage.");
3143
3106
  } else {
3144
3107
  const url = `${__privateGet(this, _options2).brokerendpoint}:${__privateGet(this, _options2).brokerport}${__privateGet(this, _options2).brokerapiroot}/session`;
3145
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "RestoreSession");
3146
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, url);
3108
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "RestoreSession");
3109
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, url);
3147
3110
  __privateGet(this, _LogMessage).call(this, "RestoreSession.");
3148
3111
  __privateGet(this, _LogMessage).call(this, url);
3149
3112
  try {
@@ -3160,7 +3123,7 @@ class STSOAuth2Worker {
3160
3123
  // Ensure cookies are passed to the service
3161
3124
  timeout: __privateGet(this, _options2).timeout
3162
3125
  };
3163
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#RestoreSession:session request detail: [${JSON.stringify(rConfig)}]`));
3126
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#RestoreSession:session request detail: [${JSON.stringify(rConfig)}]`));
3164
3127
  if (isNode) {
3165
3128
  rConfig.httpsAgent = __privateGet(this, _httpsAgent);
3166
3129
  }
@@ -3175,24 +3138,24 @@ class STSOAuth2Worker {
3175
3138
  newSessionData.brokerCookie = retVal.headers["set-cookie"];
3176
3139
  }
3177
3140
  __privateGet(this, _clientSessionStore).set(__privateGet(this, _STORAGE_SESSION_KEY2), newSessionData);
3178
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "Session restored from server side cookie.");
3141
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Session restored from server side cookie.");
3179
3142
  } else {
3180
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, `Could not restore previous session. No restoredSessionData available.`);
3181
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, JSON.stringify(retVal.data));
3143
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, `Could not restore previous session. No restoredSessionData available.`);
3144
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, JSON.stringify(retVal.data));
3182
3145
  }
3183
3146
  } else {
3184
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, "Could not restore previous session:-");
3185
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, JSON.stringify(retVal.data));
3147
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, "Could not restore previous session:-");
3148
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, JSON.stringify(retVal.data));
3186
3149
  }
3187
3150
  } catch (error) {
3188
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, "Could not restore previous session (error state):-");
3189
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, error);
3190
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, JSON.stringify(error));
3151
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, "Could not restore previous session (error state):-");
3152
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, error);
3153
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, JSON.stringify(error));
3191
3154
  }
3192
3155
  }
3193
3156
  if (restoredSessionData !== null) {
3194
3157
  __privateGet(this, _HandleAuthenticateEvent2).call(this, restoredSessionData.id_token);
3195
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "Refreshing tokens ...");
3158
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Refreshing tokens ...");
3196
3159
  return await __privateGet(this, _RefreshToken).call(this);
3197
3160
  } else {
3198
3161
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
@@ -3200,7 +3163,7 @@ class STSOAuth2Worker {
3200
3163
  }
3201
3164
  });
3202
3165
  __privateAdd(this, _Authorize, async () => {
3203
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "Authorize ...");
3166
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Authorize ...");
3204
3167
  const client_id = __privateGet(this, _options2).client_id;
3205
3168
  const nonce = __privateGet(this, _cUtils2).CreateRandomString();
3206
3169
  const response_type = [AuthorizeOptionsResponseType.CODE];
@@ -3224,9 +3187,9 @@ class STSOAuth2Worker {
3224
3187
  };
3225
3188
  const authorizeOptionsClientCopy = { ...authorizeOptions };
3226
3189
  const url = `${__privateGet(this, _options2).authorizeendpoint}:${__privateGet(this, _options2).authorizeport}${__privateGet(this, _options2).authorizeapiroot}${__privateGet(this, _options2).authorizeapi}?${__privateGet(this, _qParams2).CreateQueryParams(authorizeOptions)}`;
3227
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, url);
3190
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, url);
3228
3191
  authorizeOptions.code_verifier = code_verifier;
3229
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, `Authorize:authorizeOptions: [${JSON.stringify(authorizeOptions)}]`);
3192
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, `Authorize:authorizeOptions: [${JSON.stringify(authorizeOptions)}]`);
3230
3193
  return {
3231
3194
  url,
3232
3195
  authorizeOptions,
@@ -3237,29 +3200,29 @@ class STSOAuth2Worker {
3237
3200
  __privateAdd(this, _HandleRedirect, async (payload) => {
3238
3201
  const queryVars = payload.queryVars;
3239
3202
  const authorizeOptions = payload.authorizeOptions;
3240
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#HandleRedirect: HandleRedirect`));
3241
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#HandleRedirect: HandleRedirect:Query Vars: [${JSON.stringify(queryVars)}]`));
3203
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#HandleRedirect: HandleRedirect`));
3204
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#HandleRedirect: HandleRedirect:Query Vars: [${JSON.stringify(queryVars)}]`));
3242
3205
  if (queryVars[OAuth2ParameterType.CODE]) {
3243
3206
  const response = queryVars;
3244
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, `authorizeOptions from transaction state: [${JSON.stringify(authorizeOptions)}]`);
3207
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, `authorizeOptions from transaction state: [${JSON.stringify(authorizeOptions)}]`);
3245
3208
  const redirectState = response.state;
3246
3209
  const authorizeOptionsState = authorizeOptions.state;
3247
3210
  if (authorizeOptionsState.localeCompare(redirectState) === 0) {
3248
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, chalk$1.green("redirected state (from queryVars) matched previously saved transaction authorizeOptions state"));
3211
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, chalk$1.green("redirected state (from queryVars) matched previously saved transaction authorizeOptions state"));
3249
3212
  return await __privateGet(this, _GetToken).call(this, authorizeOptions, response);
3250
3213
  } else {
3251
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red("redirected state (from queryVars) did NOT match previously saved transaction authorizeOptions state"));
3252
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(`authorizeOptionsState: [${authorizeOptionsState}]`));
3253
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(`redirectState: [${redirectState}]`));
3214
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("redirected state (from queryVars) did NOT match previously saved transaction authorizeOptions state"));
3215
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`authorizeOptionsState: [${authorizeOptionsState}]`));
3216
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`redirectState: [${redirectState}]`));
3254
3217
  __privateGet(this, _HandleErrorEvent2).call(this, { message: "State un-matched" });
3255
3218
  return false;
3256
3219
  }
3257
3220
  } else if (queryVars[OAuth2ParameterType.ERROR]) {
3258
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(`State un-matched (1)`));
3221
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`State un-matched (1)`));
3259
3222
  __privateGet(this, _HandleErrorEvent2).call(this, { message: "State un-matched" });
3260
3223
  return false;
3261
3224
  } else {
3262
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(`State un-matched (2)`));
3225
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`State un-matched (2)`));
3263
3226
  __privateGet(this, _HandleErrorEvent2).call(this, { message: "State un-matched" });
3264
3227
  return false;
3265
3228
  }
@@ -3285,7 +3248,7 @@ class STSOAuth2Worker {
3285
3248
  */
3286
3249
  // Get access_token, refresh_token and id_token using OAuth2 Authorization Code Flow
3287
3250
  __privateAdd(this, _GetTokenFromBroker, async (authorizationCodeFlowParameters) => {
3288
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker`));
3251
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker`));
3289
3252
  __privateGet(this, _clientSessionStore).remove(__privateGet(this, _STORAGE_SESSION_KEY2));
3290
3253
  const url = `${__privateGet(this, _options2).brokerendpoint}:${__privateGet(this, _options2).brokerport}${__privateGet(this, _options2).brokerapiroot}/token`;
3291
3254
  try {
@@ -3297,15 +3260,15 @@ class STSOAuth2Worker {
3297
3260
  // Ensure cookies are passed to the service
3298
3261
  timeout: __privateGet(this, _options2).timeout
3299
3262
  };
3300
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: request config: [${JSON.stringify(rConfig)}]`));
3263
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: request config: [${JSON.stringify(rConfig)}]`));
3301
3264
  if (isNode) {
3302
3265
  rConfig.httpsAgent = __privateGet(this, _httpsAgent);
3303
3266
  }
3304
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: axios API call`));
3267
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: axios API call`));
3305
3268
  const retVal = await axios(rConfig);
3306
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: axios API call result: [${retVal.status}]`));
3269
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: axios API call result: [${retVal.status}]`));
3307
3270
  if (retVal.status === StatusCodes.OK) {
3308
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: storing tokens`));
3271
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: storing tokens`));
3309
3272
  const tokenResponse = retVal.data;
3310
3273
  __privateGet(this, _HandleAuthenticateEvent2).call(this, tokenResponse.id_token);
3311
3274
  const newSessionData = {
@@ -3317,26 +3280,26 @@ class STSOAuth2Worker {
3317
3280
  __privateGet(this, _clientSessionStore).set(__privateGet(this, _STORAGE_SESSION_KEY2), newSessionData);
3318
3281
  return true;
3319
3282
  } else if (retVal.status === StatusCodes.UNAUTHORIZED) {
3320
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: NOT storing tokens, status: [${retVal.status}]`));
3283
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: NOT storing tokens, status: [${retVal.status}]`));
3321
3284
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
3322
3285
  return false;
3323
3286
  } else {
3324
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: NOT storing tokens (general error 1), status: [${retVal.status}]`));
3287
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: NOT storing tokens (general error 1), status: [${retVal.status}]`));
3325
3288
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
3326
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red("Could not obtain access_token from token end-point:-"));
3327
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(retVal.data)));
3289
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("Could not obtain access_token from token end-point:-"));
3290
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(retVal.data)));
3328
3291
  return false;
3329
3292
  }
3330
3293
  } catch (error) {
3331
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(`#GetTokenFromBroker: NOT storing tokens (general error 2), status: [${error}]`));
3294
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`#GetTokenFromBroker: NOT storing tokens (general error 2), status: [${error}]`));
3332
3295
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
3333
3296
  return false;
3334
3297
  }
3335
3298
  });
3336
3299
  // Get access_token, refresh_token and id_token using OAuth2 Authorization Code Flow
3337
3300
  __privateAdd(this, _GetToken, async (authorizeOptions, authorizeResponse) => {
3338
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "#GetToken");
3339
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, authorizeResponse);
3301
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "#GetToken");
3302
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, authorizeResponse);
3340
3303
  __privateGet(this, _clientSessionStore).remove(__privateGet(this, _STORAGE_SESSION_KEY2));
3341
3304
  const authorizationCodeFlowParameters = {
3342
3305
  client_id: __privateGet(this, _options2).client_id,
@@ -3374,10 +3337,10 @@ class STSOAuth2Worker {
3374
3337
  }
3375
3338
  */
3376
3339
  __privateAdd(this, _RefreshToken, async () => {
3377
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.cyan(`STSOAuth2Worker:#RefreshToken:start`));
3340
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.cyan(`STSOAuth2Worker:#RefreshToken:start`));
3378
3341
  const sessionData = __privateGet(this, _clientSessionStore).get(__privateGet(this, _STORAGE_SESSION_KEY2));
3379
3342
  if (sessionData) {
3380
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.cyan(`STSOAuth2Worker:#RefreshToken:sessionData: [${JSON.stringify(sessionData)}]`));
3343
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.cyan(`STSOAuth2Worker:#RefreshToken:sessionData: [${JSON.stringify(sessionData)}]`));
3381
3344
  const currentSessionData = sessionData.tokenResponse;
3382
3345
  const refreshFlowParameters = {
3383
3346
  client_id: __privateGet(this, _options2).client_id,
@@ -3387,7 +3350,7 @@ class STSOAuth2Worker {
3387
3350
  };
3388
3351
  return await __privateGet(this, _GetTokenFromBroker).call(this, refreshFlowParameters);
3389
3352
  } else {
3390
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(`STSOAuth2Worker:#RefreshToken:sessionData not found within clientSessionStore`));
3353
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`STSOAuth2Worker:#RefreshToken:sessionData not found within clientSessionStore`));
3391
3354
  return false;
3392
3355
  }
3393
3356
  });
@@ -3397,18 +3360,18 @@ class STSOAuth2Worker {
3397
3360
  // clear session storage
3398
3361
  // clear all state from $store
3399
3362
  __privateAdd(this, _Logout, async () => {
3400
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "Logout");
3363
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Logout");
3401
3364
  const url = `${__privateGet(this, _options2).brokerendpoint}:${__privateGet(this, _options2).brokerport}${__privateGet(this, _options2).brokerapiroot}/logout`;
3402
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, url);
3365
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, url);
3403
3366
  const sessionData = __privateGet(this, _clientSessionStore).get(__privateGet(this, _STORAGE_SESSION_KEY2));
3404
3367
  if (sessionData) {
3405
3368
  const currentSessionData = sessionData.tokenResponse;
3406
3369
  const refresh_token = currentSessionData.refresh_token;
3407
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, refresh_token);
3370
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, refresh_token);
3408
3371
  const decodedRefreshToken = jwtDecode(refresh_token);
3409
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, decodedRefreshToken);
3372
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, decodedRefreshToken);
3410
3373
  const sessionId = decodedRefreshToken.sts_session;
3411
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, sessionId);
3374
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, sessionId);
3412
3375
  __privateGet(this, _clientSessionStore).remove(__privateGet(this, _STORAGE_SESSION_KEY2));
3413
3376
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
3414
3377
  try {
@@ -3422,7 +3385,7 @@ class STSOAuth2Worker {
3422
3385
  // Ensure cookies are passed to the service
3423
3386
  timeout: __privateGet(this, _options2).timeout
3424
3387
  };
3425
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#Logout: request config: [${rConfig}]`));
3388
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#Logout: request config: [${rConfig}]`));
3426
3389
  if (isNode) {
3427
3390
  rConfig.httpsAgent = __privateGet(this, _httpsAgent);
3428
3391
  }
@@ -3430,27 +3393,27 @@ class STSOAuth2Worker {
3430
3393
  if (retVal.data.status === StatusCodes.OK) {
3431
3394
  return true;
3432
3395
  } else {
3433
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red("Error during logout (1: server side)"));
3434
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(retVal.data)));
3396
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("Error during logout (1: server side)"));
3397
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(retVal.data)));
3435
3398
  return false;
3436
3399
  }
3437
3400
  } catch (error) {
3438
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red("Error during logout (2: server side)"));
3439
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(error));
3440
- __privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(error)));
3401
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("Error during logout (2: server side)"));
3402
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(error));
3403
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(error)));
3441
3404
  return false;
3442
3405
  }
3443
3406
  } else {
3444
- __privateMethod(this, _LogInfoMessage2, LogInfoMessage_fn2).call(this, "Error during logout. Could not restore session from session storage.");
3407
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Error during logout. Could not restore session from session storage.");
3445
3408
  return false;
3446
3409
  }
3447
3410
  });
3448
3411
  __privateSet(this, _options2, options);
3449
3412
  __privateSet(this, _logger, logger);
3450
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:constructor:#options: [${JSON.stringify(__privateGet(this, _options2))}]`);
3413
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:constructor:#options: [${JSON.stringify(__privateGet(this, _options2))}]`);
3451
3414
  __privateSet(this, _clientSessionStore, new ClientStorageFactory({ clientStorageType: ClientStorageType.MEMORY_STORAGE, usePrefix: false }).GetStorage());
3452
3415
  __privateSet(this, _oauthWorkerPort, workerPort);
3453
- __privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:constructor:#oauthWorkerPort: [${JSON.stringify(__privateGet(this, _oauthWorkerPort))}]`);
3416
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:constructor:#oauthWorkerPort: [${JSON.stringify(__privateGet(this, _oauthWorkerPort))}]`);
3454
3417
  if (isNode && __privateGet(this, _options2).agentOptions) {
3455
3418
  __privateSet(this, _httpsAgent, new https.Agent({
3456
3419
  keepAlive: __privateGet(this, _options2).agentOptions.keepAlive,
@@ -3476,15 +3439,16 @@ _oauthWorkerPort = new WeakMap();
3476
3439
  _options2 = new WeakMap();
3477
3440
  _httpsAgent = new WeakMap();
3478
3441
  _logger = new WeakMap();
3479
- _LogDebugMessage2 = new WeakSet();
3442
+ _STSOAuth2Worker_instances = new WeakSet();
3443
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3480
3444
  LogDebugMessage_fn2 = function(message) {
3481
3445
  __privateGet(this, _logger).debug(message);
3482
3446
  };
3483
- _LogInfoMessage2 = new WeakSet();
3447
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3484
3448
  LogInfoMessage_fn2 = function(message) {
3485
3449
  __privateGet(this, _logger).info(message);
3486
3450
  };
3487
- _LogErrorMessage2 = new WeakSet();
3451
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3488
3452
  LogErrorMessage_fn2 = function(message) {
3489
3453
  __privateGet(this, _logger).error(message);
3490
3454
  };