@aitianyu.cn/tianyu-store
Version:
tianyu storage for nodejs.
69 lines • 3.4 kB
JavaScript
"use strict";
/**@format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.TianyuStoreRedoUndoExpose = exports.TianyuStoreEntityExpose = void 0;
const InterfaceUtils_1 = require("./utils/InterfaceUtils");
const Defs_1 = require("./types/Defs");
const RedoUndoActionImpl_1 = require("./store/storage/RedoUndoActionImpl");
const SelectorFactor_1 = require("./store/SelectorFactor");
const ActionFactor_1 = require("./store/ActionFactor");
const CreateAction = ActionFactor_1.ActionFactor.makeCreateStoreAction();
const DestroyAction = ActionFactor_1.ActionFactor.makeDestroyStoreAction();
const CleanStackAction = ActionFactor_1.ActionFactor.makeVirtualAction();
const CreateInstanceIfNotExist = ActionFactor_1.ActionFactor.makeVirtualAction();
const DestroyInstanceIfExist = ActionFactor_1.ActionFactor.makeVirtualAction();
const GetRedoAvailable = SelectorFactor_1.SelectorFactor.makeVirtualSelector();
const GetUndoAvailable = SelectorFactor_1.SelectorFactor.makeVirtualSelector();
const GetRedoUndoEnabledSelector = SelectorFactor_1.SelectorFactor.makeVirtualSelector();
const GetInstanceExist = SelectorFactor_1.SelectorFactor.makeVirtualParameterSelector();
const GetParentInstance = SelectorFactor_1.SelectorFactor.makeVirtualParameterSelector();
const GetChildInstances = SelectorFactor_1.SelectorFactor.makeVirtualParameterSelector();
/**
* Tianyu Store default operator
*/
exports.TianyuStoreEntityExpose = {
core: {
/** To create a new store entity */
creator: CreateAction,
/** To delete a exist store entity */
destroy: DestroyAction,
},
action: {
/** To create a new instance if the instance does not exist */
createInstanceIfNotExist: CreateInstanceIfNotExist,
/** To delete a instance if the instance does exist */
destroyInstanceIfExist: DestroyInstanceIfExist,
},
selector: {
/** Get the specified instance does exist */
getInstanceExist: GetInstanceExist,
instance: {
/** Get the parent of specified instance */
parent: GetParentInstance,
/** Get all children of specified instance */
children: GetChildInstances,
},
},
utils: {
toBoolean: SelectorFactor_1.SelectorFactor.makeVirtualConstantSelector(),
},
};
exports.TianyuStoreRedoUndoExpose = {
stack: {
redoAction: (0, RedoUndoActionImpl_1.storeRedoActionCreatorImpl)(),
undoAction: (0, RedoUndoActionImpl_1.storeUndoActionCreatorImpl)(),
/** Get current redo action is valid */
getRedoAvailable: GetRedoAvailable,
/** Get current undo action is valid */
getUndoAvailable: GetUndoAvailable,
/** Get redo/undo operation is enabled in current store entity */
getRedoUndoEnabled: GetRedoUndoEnabledSelector,
/** Clean all redo/undo stack in current store entity */
cleanStackAction: CleanStackAction,
},
};
// to ensure the entity type
exports.TianyuStoreEntityExpose;
(0, InterfaceUtils_1.registerExpose)(exports.TianyuStoreEntityExpose, Defs_1.TIANYU_STORE_INSTANCE_BASE_ENTITY_STORE_TYPE);
(0, InterfaceUtils_1.registerExpose)(exports.TianyuStoreRedoUndoExpose, Defs_1.TIANYU_STORE_INSTANCE_BASE_ENTITY_STORE_TYPE);
//# sourceMappingURL=InterfacesExpose.js.map