Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/react-query/lib/core/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.QueryCache = void 0;
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _utils = require("./utils");
var _query = require("./query");
var _notifyManager = require("./notifyManager");
var _subscribable = require("./subscribable");
// CLASS
var QueryCache = /*#__PURE__*/function (_Subscribable) {
(0, _inheritsLoose2.default)(QueryCache, _Subscribable);
function QueryCache(config) {
var _this;
_this = _Subscribable.call(this) || this;
_this.config = config || {};
_this.queries = [];
_this.queriesMap = {};
return _this;
}
var _proto = QueryCache.prototype;
_proto.build = function build(client, options, state) {
var _options$queryHash;
var queryKey = options.queryKey;
var queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : (0, _utils.hashQueryKeyByOptions)(queryKey, options);
var query = this.get(queryHash);
if (!query) {
query = new _query.Query({
cache: this,
queryKey: queryKey,
queryHash: queryHash,
options: client.defaultQueryOptions(options),
state: state,
defaultOptions: client.getQueryDefaults(queryKey)
});
this.add(query);
}
return query;
};
_proto.add = function add(query) {
if (!this.queriesMap[query.queryHash]) {
this.queriesMap[query.queryHash] = query;
this.queries.push(query);
this.notify({
type: 'queryAdded',
query: query
});
}
};
_proto.remove = function remove(query) {
var queryInMap = this.queriesMap[query.queryHash];
if (queryInMap) {
query.destroy();
this.queries = this.queries.filter(function (x) {
return x !== query;
});
if (queryInMap === query) {
delete this.queriesMap[query.queryHash];
}
this.notify({
type: 'queryRemoved',
query: query
});
}
};
_proto.clear = function clear() {
var _this2 = this;
_notifyManager.notifyManager.batch(function () {
_this2.queries.forEach(function (query) {
_this2.remove(query);
});
});
};
_proto.get = function get(queryHash) {
return this.queriesMap[queryHash];
};
_proto.getAll = function getAll() {
return this.queries;
};
_proto.find = function find(arg1, arg2) {
var _parseFilterArgs = (0, _utils.parseFilterArgs)(arg1, arg2),
filters = _parseFilterArgs[0];
if (typeof filters.exact === 'undefined') {
filters.exact = true;
}
return this.queries.find(function (query) {
return (0, _utils.matchQuery)(filters, query);
});
};
_proto.findAll = function findAll(arg1, arg2) {
var _parseFilterArgs2 = (0, _utils.parseFilterArgs)(arg1, arg2),
filters = _parseFilterArgs2[0];
return filters ? this.queries.filter(function (query) {
return (0, _utils.matchQuery)(filters, query);
}) : this.queries;
};
_proto.notify = function notify(event) {
var _this3 = this;
_notifyManager.notifyManager.batch(function () {
_this3.listeners.forEach(function (listener) {
listener(event);
});
});
};
_proto.onFocus = function onFocus() {
var _this4 = this;
_notifyManager.notifyManager.batch(function () {
_this4.queries.forEach(function (query) {
query.onFocus();
});
});
};
_proto.onOnline = function onOnline() {
var _this5 = this;
_notifyManager.notifyManager.batch(function () {
_this5.queries.forEach(function (query) {
query.onOnline();
});
});
};
return QueryCache;
}(_subscribable.Subscribable);
exports.QueryCache = QueryCache; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.021 ]-- |