roboto-js 1.6.1 → 1.6.2
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/cjs/rbt_api.cjs +5 -5
- package/dist/esm/rbt_api.js +2 -1
- package/package.json +1 -1
- package/src/rbt_api.js +3 -1
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -893,11 +893,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
893
893
|
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(type) {
|
|
894
894
|
var _this2 = this;
|
|
895
895
|
var params,
|
|
896
|
+
paramsKey,
|
|
896
897
|
defaultOrderBy,
|
|
897
898
|
defaultLimit,
|
|
898
899
|
mergedParams,
|
|
899
900
|
currentTime,
|
|
900
|
-
_paramsKey,
|
|
901
901
|
cacheEntry,
|
|
902
902
|
responsePromise,
|
|
903
903
|
processingPromise,
|
|
@@ -925,8 +925,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
925
925
|
}; // Merge defaults with provided params
|
|
926
926
|
mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params); // Check cache for an existing request
|
|
927
927
|
currentTime = Date.now();
|
|
928
|
-
|
|
929
|
-
cacheEntry = this.requestCache[
|
|
928
|
+
paramsKey = JSON.stringify(mergedParams);
|
|
929
|
+
cacheEntry = this.requestCache[paramsKey];
|
|
930
930
|
if (!(cacheEntry && currentTime - cacheEntry.time < 10000)) {
|
|
931
931
|
_context18.next = 11;
|
|
932
932
|
break;
|
|
@@ -938,11 +938,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
938
938
|
processingPromise = responsePromise.then(function (response) {
|
|
939
939
|
return _this2._processResponseData(response);
|
|
940
940
|
})["catch"](function (e) {
|
|
941
|
-
delete _this2.requestCache[
|
|
941
|
+
delete _this2.requestCache[paramsKey]; // Ensure cache cleanup on failure
|
|
942
942
|
//console.log('RBTAPI.query ERROR (Processing)', paramsKey, e);
|
|
943
943
|
return _this2._handleError(e);
|
|
944
944
|
}); // Store the promise of the processed data in the cache
|
|
945
|
-
this.requestCache[
|
|
945
|
+
this.requestCache[paramsKey] = {
|
|
946
946
|
val: processingPromise,
|
|
947
947
|
time: currentTime
|
|
948
948
|
};
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -470,6 +470,7 @@ export default class RbtApi {
|
|
|
470
470
|
// }
|
|
471
471
|
|
|
472
472
|
async query(type, params = {}) {
|
|
473
|
+
let paramsKey;
|
|
473
474
|
try {
|
|
474
475
|
//console.log('RBTAPI.query INIT', type, params);
|
|
475
476
|
params.type = type;
|
|
@@ -497,7 +498,7 @@ export default class RbtApi {
|
|
|
497
498
|
|
|
498
499
|
// Check cache for an existing request
|
|
499
500
|
const currentTime = Date.now();
|
|
500
|
-
|
|
501
|
+
paramsKey = JSON.stringify(mergedParams);
|
|
501
502
|
const cacheEntry = this.requestCache[paramsKey];
|
|
502
503
|
if (cacheEntry && currentTime - cacheEntry.time < 10000) {
|
|
503
504
|
// 10000 ms = 10 seconds
|
package/package.json
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -566,6 +566,8 @@ export default class RbtApi {
|
|
|
566
566
|
|
|
567
567
|
|
|
568
568
|
async query(type, params = {}) {
|
|
569
|
+
|
|
570
|
+
let paramsKey;
|
|
569
571
|
try {
|
|
570
572
|
//console.log('RBTAPI.query INIT', type, params);
|
|
571
573
|
params.type = type;
|
|
@@ -579,7 +581,7 @@ export default class RbtApi {
|
|
|
579
581
|
|
|
580
582
|
// Check cache for an existing request
|
|
581
583
|
const currentTime = Date.now();
|
|
582
|
-
|
|
584
|
+
paramsKey = JSON.stringify(mergedParams);
|
|
583
585
|
const cacheEntry = this.requestCache[paramsKey];
|
|
584
586
|
if (cacheEntry && (currentTime - cacheEntry.time) < 10000) { // 10000 ms = 10 seconds
|
|
585
587
|
//console.log('RBTAPI.query CACHED', type, paramsKey);
|