UNPKG

globalstorage

Version:

Global Storage is a Global Distributed Data Warehouse

568 lines (440 loc) 14.9 kB
'use strict'; function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _require$default$opti = require('metaschema').default.options, decorators = _require$default$opti.decorators, localDecorators = _require$default$opti.localDecorators; var _require = require('../log'), LogStatus = _require.LogStatusDecorator; var Decorator = function Decorator(def) { _classCallCheck(this, Decorator); Object.assign(this, def); }; var RelationDecorator = /*#__PURE__*/ function (_Decorator) { _inherits(RelationDecorator, _Decorator); function RelationDecorator(def) { _classCallCheck(this, RelationDecorator); if (typeof def === 'string') { def = { category: def }; } return _possibleConstructorReturn(this, _getPrototypeOf(RelationDecorator).call(this, def)); } return RelationDecorator; }(Decorator); var _Many = /*#__PURE__*/ function (_RelationDecorator) { _inherits(Many, _RelationDecorator); function Many() { _classCallCheck(this, Many); return _possibleConstructorReturn(this, _getPrototypeOf(Many).apply(this, arguments)); } return Many; }(RelationDecorator); var _Master = /*#__PURE__*/ function (_RelationDecorator2) { _inherits(Master, _RelationDecorator2); function Master(def) { _classCallCheck(this, Master); if (typeof def === 'string') { def = { category: def, required: true }; } else { def.required = true; } return _possibleConstructorReturn(this, _getPrototypeOf(Master).call(this, def)); } return Master; }(RelationDecorator); var _Include = /*#__PURE__*/ function (_RelationDecorator3) { _inherits(Include, _RelationDecorator3); function Include(def) { _classCallCheck(this, Include); if (typeof def === 'string') { def = { category: def, required: true }; } else { def.required = true; } return _possibleConstructorReturn(this, _getPrototypeOf(Include).call(this, def)); } return Include; }(RelationDecorator); var _Hierarchy3 = /*#__PURE__*/ function (_RelationDecorator4) { _inherits(Hierarchy, _RelationDecorator4); function Hierarchy(def) { _classCallCheck(this, Hierarchy); def.index = true; return _possibleConstructorReturn(this, _getPrototypeOf(Hierarchy).call(this, def)); } return Hierarchy; }(RelationDecorator); var _Catalog = /*#__PURE__*/ function (_Hierarchy) { _inherits(Catalog, _Hierarchy); function Catalog(def) { _classCallCheck(this, Catalog); if (!def.category) { def.category = 'Catalog'; } def.required = true; return _possibleConstructorReturn(this, _getPrototypeOf(Catalog).call(this, def)); } return Catalog; }(_Hierarchy3); var _Subsystem = /*#__PURE__*/ function (_Hierarchy2) { _inherits(Subsystem, _Hierarchy2); function Subsystem(def) { _classCallCheck(this, Subsystem); if (!def.category) { def.category = 'Subsystem'; } def.required = true; return _possibleConstructorReturn(this, _getPrototypeOf(Subsystem).call(this, def)); } return Subsystem; }(_Hierarchy3); var _Index2 = function Index(fields) { _classCallCheck(this, Index); this.fields = fields; }; var _Unique = /*#__PURE__*/ function (_Index) { _inherits(Unique, _Index); function Unique() { _classCallCheck(this, Unique); return _possibleConstructorReturn(this, _getPrototypeOf(Unique).apply(this, arguments)); } return Unique; }(_Index2); var _Registry = /*#__PURE__*/ function (_Decorator2) { _inherits(Registry, _Decorator2); function Registry() { _classCallCheck(this, Registry); return _possibleConstructorReturn(this, _getPrototypeOf(Registry).apply(this, arguments)); } return Registry; }(Decorator); var _Dictionary = /*#__PURE__*/ function (_Decorator3) { _inherits(Dictionary, _Decorator3); function Dictionary() { _classCallCheck(this, Dictionary); return _possibleConstructorReturn(this, _getPrototypeOf(Dictionary).apply(this, arguments)); } return Dictionary; }(Decorator); var _System = /*#__PURE__*/ function (_Decorator4) { _inherits(System, _Decorator4); function System() { _classCallCheck(this, System); return _possibleConstructorReturn(this, _getPrototypeOf(System).apply(this, arguments)); } return System; }(Decorator); var _Log = /*#__PURE__*/ function (_Decorator5) { _inherits(Log, _Decorator5); function Log() { _classCallCheck(this, Log); return _possibleConstructorReturn(this, _getPrototypeOf(Log).apply(this, arguments)); } return Log; }(Decorator); var _Local = /*#__PURE__*/ function (_Decorator6) { _inherits(Local, _Decorator6); function Local() { _classCallCheck(this, Local); return _possibleConstructorReturn(this, _getPrototypeOf(Local).apply(this, arguments)); } return Local; }(Decorator); var _Table = /*#__PURE__*/ function (_Decorator7) { _inherits(Table, _Decorator7); function Table(def, config) { var _this; _classCallCheck(this, Table); _this = _possibleConstructorReturn(this, _getPrototypeOf(Table).call(this, def)); Object.assign(_assertThisInitialized(_this), config); return _this; } return Table; }(Decorator); var _History = /*#__PURE__*/ function (_Decorator8) { _inherits(History, _Decorator8); function History() { _classCallCheck(this, History); return _possibleConstructorReturn(this, _getPrototypeOf(History).apply(this, arguments)); } return History; }(Decorator); var _Execute = function Execute(def) { _classCallCheck(this, Execute); if (typeof def === 'string') { this.Action = def; } else { Object.assign(this, def); } }; var _Action = function Action(def) { _classCallCheck(this, Action); if (typeof def === 'function') { this.Execute = def; } else { Object.assign(this, def); } if (!this.Args) this.Args = {}; if (!this.Returns) this.Returns = {}; }; var _View = /*#__PURE__*/ function (_Decorator9) { _inherits(View, _Decorator9); function View() { _classCallCheck(this, View); return _possibleConstructorReturn(this, _getPrototypeOf(View).apply(this, arguments)); } return View; }(Decorator); var _Memory = /*#__PURE__*/ function (_Decorator10) { _inherits(Memory, _Decorator10); function Memory() { _classCallCheck(this, Memory); return _possibleConstructorReturn(this, _getPrototypeOf(Memory).apply(this, arguments)); } return Memory; }(Decorator); var _Form = /*#__PURE__*/ function (_Decorator11) { _inherits(Form, _Decorator11); function Form(def) { var _this2; _classCallCheck(this, Form); _this2 = _possibleConstructorReturn(this, _getPrototypeOf(Form).call(this, def)); if (!_this2.Fields) { _this2.Fields = {}; } return _this2; } return Form; }(Decorator); // Form layout decorators var LayoutDecorator = function LayoutDecorator(name) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, LayoutDecorator); Object.assign(this, _objectSpread({}, config, { name: name })); }; var _Group = /*#__PURE__*/ function (_LayoutDecorator) { _inherits(Group, _LayoutDecorator); function Group(name, config, children) { var _this3; _classCallCheck(this, Group); _this3 = _possibleConstructorReturn(this, _getPrototypeOf(Group).call(this, name, config)); _this3.children = children; return _this3; } return Group; }(LayoutDecorator); var _Input = /*#__PURE__*/ function (_LayoutDecorator2) { _inherits(Input, _LayoutDecorator2); function Input() { _classCallCheck(this, Input); return _possibleConstructorReturn(this, _getPrototypeOf(Input).apply(this, arguments)); } return Input; }(LayoutDecorator); var _Label = /*#__PURE__*/ function (_LayoutDecorator3) { _inherits(Label, _LayoutDecorator3); function Label() { _classCallCheck(this, Label); return _possibleConstructorReturn(this, _getPrototypeOf(Label).apply(this, arguments)); } return Label; }(LayoutDecorator); var _Application = /*#__PURE__*/ function (_Decorator12) { _inherits(Application, _Decorator12); function Application() { _classCallCheck(this, Application); return _possibleConstructorReturn(this, _getPrototypeOf(Application).apply(this, arguments)); } return Application; }(Decorator); var AppMenuGroup = function AppMenuGroup(name, children) { _classCallCheck(this, AppMenuGroup); this.name = name; this.children = children; }; module.exports = { decorators: decorators, localDecorators: { domains: localDecorators.domains, category: { Registry: function Registry(def) { return new _Registry(def); }, Dictionary: function Dictionary(def) { return new _Dictionary(def); }, System: function System(def) { return new _System(def); }, Log: function Log(def) { return new _Log(def); }, Local: function Local(def) { return new _Local(def); }, Table: function Table(def, config) { return new _Table(def, config); }, History: function History(def) { return new _History(def); }, View: function View(def) { return new _View(def); }, Memory: function Memory(def) { return new _Memory(def); }, Many: function Many(def) { return new _Many(def); }, Master: function Master(def) { return new _Master(def); }, Include: function Include(def) { return new _Include(def); }, Hierarchy: function Hierarchy() { var def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new _Hierarchy3(def); }, Catalog: function Catalog() { var def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new _Catalog(def); }, Subsystem: function Subsystem() { var def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new _Subsystem(def); }, // Index decorators Index: function Index() { for (var _len = arguments.length, fields = new Array(_len), _key = 0; _key < _len; _key++) { fields[_key] = arguments[_key]; } return new _Index2(fields); }, Unique: function Unique() { for (var _len2 = arguments.length, fields = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { fields[_key2] = arguments[_key2]; } return new _Unique(fields); }, // Function decorators Execute: function Execute(def) { return new _Execute(def); }, Action: function Action(def) { return new _Action(def); }, LogStatus: LogStatus }, action: { // Function decorators Execute: function Execute(def) { return new _Execute(def); }, Action: function Action(def) { return new _Action(def); }, Hierarchy: function Hierarchy() { var def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new _Hierarchy3(def); }, Catalog: function Catalog() { var def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new _Catalog(def); }, Subsystem: function Subsystem() { var def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new _Subsystem(def); }, LogStatus: LogStatus }, form: { Form: function Form(def) { return new _Form(def); }, Group: function Group(name, config) { for (var _len3 = arguments.length, children = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { children[_key3 - 2] = arguments[_key3]; } return new _Group(name, config, children); }, Input: function Input(name) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return new _Input(name, config); }, Label: function Label(name) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return new _Label(name, config); } }, application: { Application: function Application(def) { return new _Application(def); }, Group: function Group(name, children) { return new AppMenuGroup(name, children); } } } };