UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

101 lines (79 loc) 2.3 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"]; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = exports.AttachmentStore = void 0; var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _promiseMerger = _interopRequireDefault(require("../promise-merger")); var _utils = require("./utils"); var publicKey = Symbol('PUBLIC_KEY'); var AttachmentStore = /*#__PURE__*/function () { function AttachmentStore() { (0, _classCallCheck2["default"])(this, AttachmentStore); this.batchCallback = function (uuids, args) { var _getGlobalConfig = (0, _utils.getGlobalConfig)('attachment', args && args[0]), batchFetchCount = _getGlobalConfig.batchFetchCount; if (batchFetchCount) { return batchFetchCount(uuids, { isPublic: args && args[1] }); } return Promise.resolve({}); }; this.merger = new _promiseMerger["default"](this.batchCallback, { maxAge: 60000, max: 100 }); } (0, _createClass2["default"])(AttachmentStore, [{ key: "fetchCountInBatch", value: function fetchCountInBatch(uuid, field, isPublic) { return this.merger.add(uuid, function (privateKey) { return isPublic ? publicKey : privateKey; }, [field, isPublic]); } /** * @deprecated */ }, { key: "get", value: function get(_uuid) { return undefined; } /** * @deprecated */ }, { key: "set", value: function set(_uuid, _cache) {} /** * @deprecated */ }, { key: "getCount", value: function getCount(_uuid) { return undefined; } /** * @deprecated */ }, { key: "getAttachments", value: function getAttachments(_uuid) { return undefined; } /** * @deprecated */ }, { key: "clearCache", value: function clearCache(_codes) {} }]); return AttachmentStore; }(); exports.AttachmentStore = AttachmentStore; var _default = new AttachmentStore(); exports["default"] = _default; //# sourceMappingURL=AttachmentStore.js.map