import * as tslib_1 from "tslib";
import _concat from 'lodash/concat';
import _cloneDeep from 'lodash/cloneDeep';
import _isEmpty from 'lodash/isEmpty';
import _isNil from 'lodash/isNil';
import _isEqual from 'lodash/isEqual';
import _keyBy from 'lodash/keyBy';
import { StoreModule } from '@/StoreModule/StoreModule';
import { Action, Getter, Mutation, State } from '@/StoreModule/annotations';
export class AbstractCRUDRepository extends StoreModule {
    // ----------- Constructor ------------
    constructor(api) {
        super();
        this.api = api;
        // ----------- State ------------
        this.added = [];
        this.edited = [];
        this.deleted = [];
    }
    // ----------- Getters ------------
    get hasList() {
        return !_isNil(this.list);
    }
    get isListEmpty() {
        return _isEmpty(this.list);
    }
    get isLocalListEmpty() {
        return _isEmpty(this.localList);
    }
    get localList() {
        return this.getLocalList();
    }
    get addedIndex() {
        return (instance) => this.added.findIndex(addedInstance => addedInstance === instance);
    }
    get deletedIndex() {
        return (instance) => this.deleted.findIndex(deletedInstance => deletedInstance === instance);
    }
    get deletedIndexById() {
        return (id) => this.deleted.findIndex(deletedInstance => deletedInstance.id === id);
    }
    get editedIndex() {
        return (instance) => this.edited.findIndex(editedInstance => editedInstance === instance);
    }
    get editedIndexById() {
        return (id) => this.edited.findIndex(editedInstance => editedInstance.id === id);
    }
    get listFirstItem() {
        return this.listItemByIndex(0);
    }
    get listLastItem() {
        return this.listItemByIndex(this.listLastIndex);
    }
    get listLastIndex() {
        return this.listLength - 1;
    }
    get listLength() {
        this.throwErrorIfHasntList();
        return this.list.length;
    }
    get listItemByIndex() {
        return (index) => {
            this.throwErrorIfHasntList();
            return this.list[index];
        };
    }
    get listItemById() {
        return (id) => {
            this.throwErrorIfHasntList();
            return this.list.find(instance => instance.id === id);
        };
    }
    get listIndex() {
        return (instance) => {
            this.throwErrorIfHasntList();
            return this.list.findIndex((listInstance) => listInstance === instance);
        };
    }
    get listIndexById() {
        return (id) => {
            this.throwErrorIfHasntList();
            return this.list.findIndex((listInstance) => listInstance.id === id);
        };
    }
    get first() {
        return this.localListFirstItem;
    }
    get last() {
        return this.localListLastItem;
    }
    get localListFirstItem() {
        return this.localListItemByIndex(0);
    }
    get localListLastItem() {
        return this.localListItemByIndex(this.localListLastIndex);
    }
    get localListLastIndex() {
        return this.localListLength - 1;
    }
    get localListLength() {
        return this.localList.length;
    }
    get localListItemByIndex() {
        return (index) => {
            this.throwErrorIfHasntList();
            return this.localList[index];
        };
    }
    get localListItemById() {
        return (id) => {
            this.throwErrorIfHasntList();
            return this.localList.find(instance => instance.id === id);
        };
    }
    get localListIndex() {
        return (instance) => {
            this.throwErrorIfHasntList();
            return this.localList.findIndex((localListInstance) => localListInstance === instance);
        };
    }
    get localListIndexById() {
        return (id) => {
            this.throwErrorIfHasntList();
            return this.localList.findIndex((localListInstance) => localListInstance.id === id);
        };
    }
    get deletedMap() {
        return _keyBy(this.deleted, 'id');
    }
    get addedMap() {
        return _keyBy(this.added, 'id');
    }
    get editedMap() {
        return _keyBy(this.edited, 'id');
    }
    get listMap() {
        return _keyBy(this.list, 'id');
    }
    get localListMap() {
        return _keyBy(this.localList, 'id');
    }
    get hasAdded() {
        return !_isEmpty(this.added);
    }
    get isAdded() {
        return (instance) => this.added.includes(instance);
    }
    get addedById() {
        return (id) => this.addedMap[id];
    }
    get isAddedById() {
        return (id) => this.addedMap[id] !== undefined;
    }
    get hasEdited() {
        return !_isEmpty(this.edited);
    }
    get isEdited() {
        return (instance) => this.edited.includes(instance);
    }
    get editedById() {
        return (id) => this.editedMap[id];
    }
    get isEditedById() {
        return (id) => this.editedById(id) !== undefined;
    }
    get hasDeleted() {
        return !_isEmpty(this.deleted);
    }
    get isDeleted() {
        return (instance) => this.deleted.includes(instance);
    }
    get deletedById() {
        return (id) => this.deletedMap[id];
    }
    get isDeletedById() {
        return (id) => this.deletedMap[id] !== undefined;
    }
    get hasActive() {
        return !_isEmpty(this.active);
    }
    get isActive() {
        return (instance) => this.active === instance;
    }
    get isActiveNew() {
        return this.active !== undefined && this.isAdded(this.active);
    }
    get isActiveById() {
        return (id) => this.hasActive && this.active.id === id;
    }
    get listIds() {
        this.throwErrorIfHasntList();
        return this.list.map((item) => item.id);
    }
    get localListIds() {
        return this.localList.map((item) => item.id);
    }
    get isActiveChangedAfterActivation() {
        return this.hasActive && !_isEqual(this.activeInitialCopy, this.active);
    }
    // ----------- Mutations ------------
    // Active
    activate(instance) {
        this.active = instance;
        this.setActiveInitialCopy(instance);
        return this;
    }
    deactivate() {
        this.active = undefined;
        this.clearActiveInitialCopy();
        return this;
    }
    activateFirst() {
        this.activate(this.localListFirstItem);
        return this;
    }
    activateLast() {
        this.activate(this.localListLastItem);
        return this;
    }
    activateByIndex(index) {
        this.activate(this.localListItemByIndex(index));
        return this;
    }
    activateInstead(insteadInstance, instanceToActivate) {
        if (this.isActive(insteadInstance))
            this.activate(instanceToActivate);
        return this;
    }
    activateInsteadById(id, instanceToActivate) {
        if (this.isActiveById(id))
            this.activate(instanceToActivate);
        return this;
    }
    deactivateIfActive(instance) {
        if (this.isActive(instance))
            this.deactivate();
        return this;
    }
    resetActiveToInitialState() {
        this.throwErrorIfHasntActive();
        const activeInitialCopyClone = _cloneDeep(this.activeInitialCopy);
        this.smartReplace(this.active, activeInitialCopyClone);
        this.activate(activeInitialCopyClone);
        return this;
    }
    // List
    setList(list) {
        this.list = list;
        return this;
    }
    // Local add
    addLocal(instance) {
        this.added.unshift(instance);
        return this;
    }
    deleteAdded(instance) {
        const index = this.addedIndex(instance);
        if (index !== -1) {
            this.deactivateIfActive(instance);
            this.added.splice(index, 1);
        }
        return this;
    }
    deleteAllAdded() {
        this.added = [];
        return this;
    }
    // Local edit
    editLocal(instance) {
        const index = this.editedIndex(instance);
        index === -1 ? this.edited.push(instance) : this.edited.splice(index, 1, instance);
        return this;
    }
    deleteEdited(instance) {
        this.edited.splice(this.editedIndex(instance), 1);
        return this;
    }
    deleteAllEdited() {
        this.edited = [];
        return this;
    }
    // Local delete
    deleteLocal(instance) {
        this.deleted.push(instance);
        this.deactivateIfActive(instance);
        return this;
    }
    deleteActiveLocal() {
        this.throwErrorIfHasntActive();
        this.deleteLocal(this.active);
        return this;
    }
    deleteDeleted(instance) {
        this.deleted.splice(this.deletedIndex(instance), 1);
        return this;
    }
    deleteAllDeleted() {
        this.deleted = [];
        return this;
    }
    clear() {
        this.clearList();
        this.deleteAllAdded();
        this.deleteAllEdited();
        this.deleteAllDeleted();
        this.deactivate();
        return this;
    }
    clearList() {
        this.list = undefined;
        return this;
    }
    // Send requests
    async sendUpsertReq(instance) {
        const resp = _isNil(instance.id)
            ? await this.sendAddReq(instance)
            : await this.sendEditReq(instance);
        return resp;
    }
    // Flush
    async flushAdded(instance) {
        if (!this.isAdded(instance))
            throw new Error('Item is not added locally');
        const resp = await this.sendAddReq(instance);
        this.deleteAdded(instance);
        this.addToList(resp);
        this.activateInstead(instance, resp);
        return resp;
    }
    async flushAllAdded() {
        return await Promise.all(this.added.map(async (addedInstance) => {
            return this.flushAdded(addedInstance);
        }));
    }
    async flushEdited(instance) {
        if (!this.isEdited(instance))
            throw new Error('Item is not edited locally');
        const resp = await this.sendEditReq(instance);
        this.deleteEdited(instance);
        this.editInList(resp);
        this.activateInstead(instance, resp);
        return resp;
    }
    async flushAllEdited() {
        return await Promise.all(this.edited.map(async (editedInstance) => {
            return this.flushEdited(editedInstance);
        }));
    }
    async flushDeleted(instance) {
        if (!this.isDeleted(instance))
            throw new Error('Item is not deleted locally');
        await this.sendDeleteReq(instance);
        this.deleteDeleted(instance);
        this.deleteFromList(instance);
    }
    async flushAllDeleted() {
        return await Promise.all(this.deleted.map(async (deletedInstance) => {
            return this.flushDeleted(deletedInstance);
        }));
    }
    async flush() {
        await Promise.all([
            this.flushAllAdded(),
            this.flushAllEdited(),
            this.flushAllDeleted()
        ]);
    }
    // Remote changing. Change on server and then in list
    async add(instance) {
        const resp = await this.sendAddReq(instance);
        if (this.hasList)
            this.addToList(resp);
        return resp;
    }
    async addAndActivate(instance) {
        const resp = await this.add(instance);
        this.activate(resp);
        return resp;
    }
    async edit(instance) {
        const resp = await this.sendEditReq(instance);
        if (this.hasList)
            this.editInList(resp);
        this.activateInstead(instance, resp);
        return resp;
    }
    async upsert(instance) {
        const resp = _isNil(instance.id)
            ? this.add(instance)
            : this.edit(instance);
        return resp;
    }
    async upsertAndActivate(instance) {
        const resp = await this.upsert(instance);
        this.activate(resp);
        return resp;
    }
    async upsertActive() {
        this.throwErrorIfHasntActive();
        return await this.upsert(this.active);
    }
    async delete(instance) {
        await this.sendDeleteReq(instance);
        if (this.hasList)
            this.deleteFromList(instance);
        this.deactivateIfActive(instance);
    }
    async deleteActive() {
        this.throwErrorIfHasntActive();
        return await this.delete(this.active);
    }
    async deleteByIndex(index) {
        return await this.delete(this.localList[index]);
    }
    // Smart methods
    async smartUpsert(instance) {
        if (this.isAdded(instance)) {
            return await this.flushAdded(instance);
        }
        else if (this.isEdited(instance)) {
            return await this.flushEdited(instance);
        }
        else {
            return await this.upsert(instance);
        }
    }
    async smartUpsertActive() {
        this.throwErrorIfHasntActive();
        return await this.smartUpsert(this.active);
    }
    async smartDelete(instance) {
        if (this.isAdded(instance)) {
            this.deleteAdded(instance);
            this.deactivateIfActive(instance);
        }
        else {
            await this.delete(instance);
        }
    }
    async smartDeleteActive() {
        this.throwErrorIfHasntActive();
        await this.smartDelete(this.active);
    }
    async smartUpsertAndActivate(instance) {
        const resp = await this.smartUpsert(instance);
        this.activate(resp);
        return resp;
    }
    // List
    async updateList(...reqParams) {
        const resp = await this.sendListReq(reqParams);
        this.setList(resp);
        return resp;
    }
    // Get
    async getAndActivate(id) {
        const resp = await this.sendGetReq(id);
        this.activate(resp);
        return resp;
    }
    async refreshItem(instance) {
        const resp = await this.sendGetReq(instance.id);
        this.smartReplace(instance, resp);
        return resp;
    }
    async refreshItemById(id) {
        const item = this.localListItemById(id);
        if (item === undefined)
            throw new Error(`There is no item with id ${id} in localList`);
        return await this.refreshItem(item);
    }
    // Other methods
    getLocalList() {
        const withoutDeleted = this.list === undefined ? [] : this.list.filter(item => !this.isDeleted(item));
        return _concat(this.added, withoutDeleted.map(item => this.isEditedById(item.id) ? this.editedById(item.id) : item));
    }
    addToList(instance) {
        this.throwErrorIfHasntList();
        this.list.unshift(instance);
        return this;
    }
    editInList(instance) {
        this.throwErrorIfHasntList();
        const index = this.listIndexById(instance.id);
        if (index === -1)
            throw new Error(`There is no instance with id ${instance.id} in list`);
        this.list.splice(index, 1, instance);
        return this;
    }
    deleteFromList(instance) {
        const index = this.localListIndex(instance);
        this.activateInstead(this.localList[index], instance);
        if (this.list !== undefined) {
            this.list.splice(index, 1);
        }
        return this;
    }
    deleteActiveFromList() {
        this.throwErrorIfHasntActive();
        this.deleteFromList(this.active);
        return this;
    }
    smartReplace(replaceableInstance, replacingInstance) {
        this.activateInstead(replaceableInstance, replacingInstance);
        if (this.isAdded(replaceableInstance)) {
            this.replaceAdded(replaceableInstance, replacingInstance);
        }
        else if (this.isEdited(replaceableInstance)) {
            this.replaceEdited(replaceableInstance, replacingInstance);
        }
        else {
            this.replaceInList(replaceableInstance, replacingInstance);
        }
        return this;
    }
    replaceAdded(replaceableInstance, replacingInstance) {
        this.added.splice(this.addedIndex(replaceableInstance), 1, replacingInstance);
        return this;
    }
    replaceEdited(replaceableInstance, replacingInstance) {
        this.edited.splice(this.editedIndex(replaceableInstance), 1, replacingInstance);
        return this;
    }
    replaceDeleted(replaceableInstance, replacingInstance) {
        this.deleted.splice(this.deletedIndex(replaceableInstance), 1, replacingInstance);
        return this;
    }
    replaceInList(replaceableInstance, replacingInstance) {
        const index = this.listIndex(replaceableInstance);
        if (index === undefined || this.list === undefined)
            return this;
        this.list.splice(index, 1, replacingInstance);
        return this;
    }
    setActiveInitialCopy(instance) {
        this.activeInitialCopy = _cloneDeep(instance);
        return this;
    }
    clearActiveInitialCopy() {
        this.activeInitialCopy = undefined;
        return this;
    }
    throwErrorIfHasntList() {
        if (this.list === undefined)
            throw new Error('There is no list');
    }
    throwErrorIfHasntActive() {
        if (this.list === undefined)
            throw new Error('There is no active item');
    }
}
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "hasList", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isListEmpty", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isLocalListEmpty", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localList", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "addedIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "deletedIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "deletedIndexById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "editedIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "editedIndexById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listFirstItem", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listLastItem", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listLastIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listLength", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listItemByIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listItemById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listIndexById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "first", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "last", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListFirstItem", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListLastItem", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListLastIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListLength", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListItemByIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListItemById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListIndex", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListIndexById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "deletedMap", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "addedMap", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "editedMap", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listMap", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListMap", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "hasAdded", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isAdded", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "addedById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isAddedById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "hasEdited", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isEdited", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "editedById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isEditedById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "hasDeleted", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isDeleted", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "deletedById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isDeletedById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "hasActive", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isActive", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isActiveNew", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isActiveById", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "listIds", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "localListIds", null);
tslib_1.__decorate([
    Getter()
], AbstractCRUDRepository.prototype, "isActiveChangedAfterActivation", null);
tslib_1.__decorate([
    State()
], AbstractCRUDRepository.prototype, "added", void 0);
tslib_1.__decorate([
    State()
], AbstractCRUDRepository.prototype, "edited", void 0);
tslib_1.__decorate([
    State()
], AbstractCRUDRepository.prototype, "deleted", void 0);
tslib_1.__decorate([
    State()
], AbstractCRUDRepository.prototype, "list", void 0);
tslib_1.__decorate([
    State()
], AbstractCRUDRepository.prototype, "active", void 0);
tslib_1.__decorate([
    State()
], AbstractCRUDRepository.prototype, "activeInitialCopy", void 0);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "activate", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deactivate", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "activateFirst", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "activateLast", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "activateByIndex", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "activateInstead", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "activateInsteadById", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deactivateIfActive", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "resetActiveToInitialState", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "setList", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "addLocal", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteAdded", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteAllAdded", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "editLocal", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteEdited", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteAllEdited", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteLocal", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteActiveLocal", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteDeleted", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "deleteAllDeleted", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "clear", null);
tslib_1.__decorate([
    Mutation()
], AbstractCRUDRepository.prototype, "clearList", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "sendUpsertReq", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "flushAdded", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "flushAllAdded", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "flushEdited", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "flushAllEdited", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "flushDeleted", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "flushAllDeleted", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "flush", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "add", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "addAndActivate", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "edit", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "upsert", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "upsertAndActivate", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "upsertActive", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "delete", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "deleteActive", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "deleteByIndex", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "smartUpsert", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "smartUpsertActive", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "smartDelete", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "smartDeleteActive", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "smartUpsertAndActivate", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "updateList", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "getAndActivate", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "refreshItem", null);
tslib_1.__decorate([
    Action()
], AbstractCRUDRepository.prototype, "refreshItemById", null);
//# sourceMappingURL=AbstractCRUDRepository.js.map