oro-sdk-apis 1.8.3 → 1.8.4

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.
@@ -1750,6 +1750,7 @@ var GuardService = /*#__PURE__*/function () {
1750
1750
  this.api = api;
1751
1751
  this.baseURL = baseURL;
1752
1752
  this.api.setAuthRefreshFn(this.authRefresh.bind(this));
1753
+ this.identityCache = {};
1753
1754
  this.whoAmICache = {};
1754
1755
  }
1755
1756
  /**
@@ -2029,6 +2030,7 @@ var GuardService = /*#__PURE__*/function () {
2029
2030
  * without authentication
2030
2031
  *
2031
2032
  * @param identityID Unique id of the identity to retrieve
2033
+ * @param skipCache (default: false) will skip identity cache (not even update it)
2032
2034
  * @returns IdentityResponse
2033
2035
  */
2034
2036
  ;
@@ -2036,18 +2038,46 @@ var GuardService = /*#__PURE__*/function () {
2036
2038
  _proto.identityGet =
2037
2039
  /*#__PURE__*/
2038
2040
  function () {
2039
- var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(identityID) {
2041
+ var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(identityID, skipCache) {
2042
+ var _tokens$accessToken, _tokens$refreshToken;
2043
+
2044
+ var tokens, cacheKey, identity;
2040
2045
  return runtime_1.wrap(function _callee6$(_context6) {
2041
2046
  while (1) {
2042
2047
  switch (_context6.prev = _context6.next) {
2043
2048
  case 0:
2044
- _context6.next = 2;
2049
+ if (skipCache === void 0) {
2050
+ skipCache = false;
2051
+ }
2052
+
2053
+ tokens = this.api.getTokens();
2054
+ cacheKey = ((_tokens$accessToken = tokens.accessToken) != null ? _tokens$accessToken : '') + ((_tokens$refreshToken = tokens.refreshToken) != null ? _tokens$refreshToken : '') + identityID;
2055
+
2056
+ if (!(skipCache || !tokens.accessToken || !this.identityCache[cacheKey])) {
2057
+ _context6.next = 10;
2058
+ break;
2059
+ }
2060
+
2061
+ _context6.next = 6;
2045
2062
  return this.api.get(this.baseURL + "/v1/identities/" + identityID);
2046
2063
 
2047
- case 2:
2048
- return _context6.abrupt("return", _context6.sent);
2064
+ case 6:
2065
+ identity = _context6.sent;
2049
2066
 
2050
- case 3:
2067
+ if (!skipCache) {
2068
+ _context6.next = 9;
2069
+ break;
2070
+ }
2071
+
2072
+ return _context6.abrupt("return", identity);
2073
+
2074
+ case 9:
2075
+ this.identityCache[cacheKey] = identity;
2076
+
2077
+ case 10:
2078
+ return _context6.abrupt("return", this.identityCache[cacheKey]);
2079
+
2080
+ case 11:
2051
2081
  case "end":
2052
2082
  return _context6.stop();
2053
2083
  }
@@ -2055,7 +2085,7 @@ var GuardService = /*#__PURE__*/function () {
2055
2085
  }, _callee6, this);
2056
2086
  }));
2057
2087
 
2058
- function identityGet(_x5) {
2088
+ function identityGet(_x5, _x6) {
2059
2089
  return _identityGet.apply(this, arguments);
2060
2090
  }
2061
2091
 
@@ -2108,7 +2138,7 @@ var GuardService = /*#__PURE__*/function () {
2108
2138
  }, _callee7, this);
2109
2139
  }));
2110
2140
 
2111
- function whoAmI(_x6) {
2141
+ function whoAmI(_x7) {
2112
2142
  return _whoAmI.apply(this, arguments);
2113
2143
  }
2114
2144
 
@@ -2141,7 +2171,7 @@ var GuardService = /*#__PURE__*/function () {
2141
2171
  }, _callee8, this);
2142
2172
  }));
2143
2173
 
2144
- function identityUpdate(_x7, _x8) {
2174
+ function identityUpdate(_x8, _x9) {
2145
2175
  return _identityUpdate.apply(this, arguments);
2146
2176
  }
2147
2177
 
@@ -2183,7 +2213,7 @@ var GuardService = /*#__PURE__*/function () {
2183
2213
  }, _callee9, this);
2184
2214
  }));
2185
2215
 
2186
- function identityMFAQRCode(_x9, _x10) {
2216
+ function identityMFAQRCode(_x10, _x11) {
2187
2217
  return _identityMFAQRCode.apply(this, arguments);
2188
2218
  }
2189
2219
 
@@ -2215,7 +2245,7 @@ var GuardService = /*#__PURE__*/function () {
2215
2245
  }, _callee10, this);
2216
2246
  }));
2217
2247
 
2218
- function identitySendConfirmEmail(_x11) {
2248
+ function identitySendConfirmEmail(_x12) {
2219
2249
  return _identitySendConfirmEmail.apply(this, arguments);
2220
2250
  }
2221
2251