"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ColumnSizesService = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
class ColumnSizesService {
  constructor(params) {
    (0, _defineProperty2.default)(this, "storage", void 0);
    (0, _defineProperty2.default)(this, "fqdn", void 0);
    (0, _defineProperty2.default)(this, "errorHandler", void 0);
    (0, _defineProperty2.default)(this, "storageKey", void 0);
    this.storage = params.storage;
    this.fqdn = params.fqdn;
    this.errorHandler = params.errorHandler;
    this.storageKey = `cairo-column-sizes`;
  }
  async fetchColumnSizes() {
    const {
      storage,
      storageKey
    } = this;
    try {
      const data = await storage.getItem(storageKey);
      return data;
    } catch (error) {
      return null;
    }
  }
  async updateColumnWidths(columnWidths) {
    const {
      storage,
      storageKey,
      errorHandler
    } = this;
    await errorHandler.withErrorHandler(() => {
      return storage.setItem(storageKey, {
        columnWidths
      });
    }, {});
  }
}
exports.ColumnSizesService = ColumnSizesService;
//# sourceMappingURL=columnSizesService.js.map