"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lowdb_1 = require("./lowdb");
const uuid = require('@lukeed/uuid');
class RegisterComponent {
    constructor() {
        this.version = '0.0.2';
    }
    init() {
        const version = lowdb_1.default.get('components.version').value();
        if (!version || version !== this.version) {
            lowdb_1.default.set('components.version', this.version).write();
            /**
             *  {
                  id: uuid(),
                  key: '', // 组件名
                  path: '', // 位置
                  des: '', // 描述
                  keywords: '', // 搜索关键词
                  children: [], // 种类
                  ascription: [ // 归属于哪种容器
                    'form'
                  ]
                }
             */
            lowdb_1.default.set('components.list', [
                {
                    id: uuid(),
                    key: 'SaveButton',
                    label: '保存',
                    path: '../../component/BaseForm/SaveButton',
                    des: '表单保存按钮',
                    keywords: '表单保存, 按钮, 表单',
                    ascription: [
                        'BaseForm'
                    ]
                },
                {
                    id: uuid(),
                    key: 'ResetButton',
                    label: '重置',
                    path: '../../component/BaseForm/ResetButton',
                    des: '表单保存按钮',
                    keywords: '表单保存, 按钮, 表单',
                    ascription: [
                        'BaseForm'
                    ]
                }
            ]).write();
        }
    }
    getCompByAscriptionData(box) {
        const list = lowdb_1.default.get('components.list').filter(item => {
            return item.ascription.includes(box);
        }).value();
    }
}
const instance = new RegisterComponent();
exports.default = instance;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVnaXN0ZXJDb21wLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi9SZWdpc3RlckNvbXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBNEI7QUFDNUIsTUFBTSxJQUFJLEdBQUcsT0FBTyxDQUFDLGNBQWMsQ0FBQyxDQUFDO0FBRXJDLE1BQU0saUJBQWlCO0lBRXJCO1FBRFEsWUFBTyxHQUFHLE9BQU8sQ0FBQztJQUNWLENBQUM7SUFFVixJQUFJO1FBQ1QsTUFBTSxPQUFPLEdBQUcsZUFBSyxDQU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