@castore/event-storage-adapter-redux
Version:
DRY Castore EventStorageAdapter implementation using a Redux store
53 lines (37 loc) • 2.73 kB
JavaScript
import _createClass from "@babel/runtime/helpers/createClass";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import { eventAlreadyExistsErrorCode } from '@castore/core';
export var ReduxStoreEventAlreadyExistsError = /*#__PURE__*/function (_Error) {
_inherits(ReduxStoreEventAlreadyExistsError, _Error);
var _super = _createSuper(ReduxStoreEventAlreadyExistsError);
function ReduxStoreEventAlreadyExistsError(_ref) {
var _this;
var _ref$eventStoreId = _ref.eventStoreId,
eventStoreId = _ref$eventStoreId === void 0 ? '' : _ref$eventStoreId,
aggregateId = _ref.aggregateId,
version = _ref.version;
_classCallCheck(this, ReduxStoreEventAlreadyExistsError);
_this = _super.call(this, "Event already exists for ".concat(eventStoreId, " aggregate ").concat(aggregateId, " and version ").concat(version));
_defineProperty(_assertThisInitialized(_this), "code", void 0);
_defineProperty(_assertThisInitialized(_this), "eventStoreId", void 0);
_defineProperty(_assertThisInitialized(_this), "aggregateId", void 0);
_defineProperty(_assertThisInitialized(_this), "version", void 0);
_this.code = eventAlreadyExistsErrorCode;
if (eventStoreId) {
_this.eventStoreId = eventStoreId;
}
_this.aggregateId = aggregateId;
_this.version = version;
return _this;
}
return _createClass(ReduxStoreEventAlreadyExistsError);
}( /*#__PURE__*/_wrapNativeSuper(Error));
//# sourceMappingURL=reduxStoreEventAlreadyExists.js.map