@azrico/webobject 1.4.128 → 1.4.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/index.js CHANGED
@@ -1,104 +1,9 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _SimpleObject = require("./structs/SimpleObject");
7
- Object.keys(_SimpleObject).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _SimpleObject[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _SimpleObject[key];
14
- }
15
- });
16
- });
17
- var _ObjectArray = require("./structs/ObjectArray");
18
- Object.keys(_ObjectArray).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _ObjectArray[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _ObjectArray[key];
25
- }
26
- });
27
- });
28
- var _MapableObject = require("./structs/MapableObject");
29
- Object.keys(_MapableObject).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _MapableObject[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function get() {
35
- return _MapableObject[key];
36
- }
37
- });
38
- });
39
- var _MetaObject = require("./structs/MetaObject");
40
- Object.keys(_MetaObject).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _MetaObject[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function get() {
46
- return _MetaObject[key];
47
- }
48
- });
49
- });
50
- var _DummyObject = require("./structs/DummyObject");
51
- Object.keys(_DummyObject).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _DummyObject[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function get() {
57
- return _DummyObject[key];
58
- }
59
- });
60
- });
61
- var _ObjectManager = require("./structs/ObjectManager");
62
- Object.keys(_ObjectManager).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _ObjectManager[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function get() {
68
- return _ObjectManager[key];
69
- }
70
- });
71
- });
72
- var _WebObjectManager = require("./WebObjects/WebObjectManager");
73
- Object.keys(_WebObjectManager).forEach(function (key) {
74
- if (key === "default" || key === "__esModule") return;
75
- if (key in exports && exports[key] === _WebObjectManager[key]) return;
76
- Object.defineProperty(exports, key, {
77
- enumerable: true,
78
- get: function get() {
79
- return _WebObjectManager[key];
80
- }
81
- });
82
- });
83
- var _WebObject = require("./WebObjects/WebObject");
84
- Object.keys(_WebObject).forEach(function (key) {
85
- if (key === "default" || key === "__esModule") return;
86
- if (key in exports && exports[key] === _WebObject[key]) return;
87
- Object.defineProperty(exports, key, {
88
- enumerable: true,
89
- get: function get() {
90
- return _WebObject[key];
91
- }
92
- });
93
- });
94
- var _ParentWebObject = require("./WebObjects/ParentWebObject");
95
- Object.keys(_ParentWebObject).forEach(function (key) {
96
- if (key === "default" || key === "__esModule") return;
97
- if (key in exports && exports[key] === _ParentWebObject[key]) return;
98
- Object.defineProperty(exports, key, {
99
- enumerable: true,
100
- get: function get() {
101
- return _ParentWebObject[key];
102
- }
103
- });
104
- });
1
+ export * from "./structs/SimpleObject";
2
+ export * from "./structs/ObjectArray";
3
+ export * from "./structs/MapableObject";
4
+ export * from "./structs/MetaObject";
5
+ export * from "./structs/DummyObject";
6
+ export * from "./structs/ObjectManager";
7
+ export * from "./WebObjects/WebObjectManager";
8
+ export * from "./WebObjects/WebObject";
9
+ export * from "./WebObjects/ParentWebObject";
@@ -1,35 +1,8 @@
1
- "use strict";
2
-
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = exports.DummyObject = void 0;
8
- var _SimpleObject2 = require("./SimpleObject");
9
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
- 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
15
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
- 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); }; }
17
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
18
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
19
- 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; } }
20
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
- var DummyObject = /*#__PURE__*/function (_SimpleObject) {
22
- _inherits(DummyObject, _SimpleObject);
23
- var _super = _createSuper(DummyObject);
24
- function DummyObject(initObject) {
25
- var _this;
26
- _classCallCheck(this, DummyObject);
27
- _this = _super.call(this, false);
28
- _this.loadValues(initObject, true);
29
- return _this;
30
- }
31
- return _createClass(DummyObject);
32
- }(_SimpleObject2.SimpleObject);
33
- exports.DummyObject = DummyObject;
34
- var _default = DummyObject;
35
- exports["default"] = _default;
1
+ import { SimpleObject } from "./SimpleObject";
2
+ export class DummyObject extends SimpleObject {
3
+ constructor(initObject) {
4
+ super(false);
5
+ this.loadValues(initObject, true);
6
+ }
7
+ }
8
+ export default DummyObject;
@@ -1,128 +1,78 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.MapableObject = void 0;
7
- var _object = require("@azrico/object");
8
- var _ObjectArray = _interopRequireDefault(require("./ObjectArray"));
9
- var _string = require("@azrico/string");
10
- var _uid = require("@azrico/uid");
11
- var _ObjectWithTemp2 = _interopRequireDefault(require("./ObjectWithTemp"));
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
- 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
18
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
19
- 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); }; }
20
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
21
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
- 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; } }
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
+ import { object_ensure, object_isEmpty } from "@azrico/object";
2
+ import ObjectArray from "./ObjectArray";
3
+ import { string_equals_ignorecase } from "@azrico/string";
4
+ import { uid } from "@azrico/uid";
5
+ import ObjectWithTemp from "./ObjectWithTemp";
27
6
  /**
28
7
  * This object can be mapped and converted
29
- */
30
- var MapableObject = /*#__PURE__*/function (_ObjectWithTemp) {
31
- _inherits(MapableObject, _ObjectWithTemp);
32
- var _super = _createSuper(MapableObject);
33
- function MapableObject() {
34
- var _this;
35
- _classCallCheck(this, MapableObject);
36
- _this = _super.call(this);
37
- _defineProperty(_assertThisInitialized(_this), "__uid", void 0);
38
- _defineProperty(_assertThisInitialized(_this), "__data_id", void 0);
39
- _defineProperty(_assertThisInitialized(_this), "__table_id", void 0);
40
- _defineProperty(_assertThisInitialized(_this), "__parent__table_id", void 0);
41
- _defineProperty(_assertThisInitialized(_this), "__row_number", void 0);
42
- _this.__uid = _uid.uid.localuid();
43
- _this.__table_id = _this.__uid;
44
- return _this;
45
- }
46
- _createClass(MapableObject, [{
47
- key: "getUID",
48
- value: function getUID() {
49
- return MapableObject.getUID(this);
50
- }
51
- /* -------------------------------------------------------------------------- */
52
- }], [{
53
- key: "getUID",
54
- value: function getUID(o) {
55
- return o.__uid;
56
- }
57
- }, {
58
- key: "mapto",
59
- value: function mapto(maptoType, objectlist) {
60
- var _this2 = this;
61
- var is_readonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
62
- for (var _len = arguments.length, p = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
63
- p[_key - 3] = arguments[_key];
64
- }
65
- if (objectlist === undefined) {
66
- if (maptoType === undefined) return [];
67
- if (maptoType instanceof Object) return [];
68
- objectlist = maptoType;
69
- maptoType = this;
70
- }
71
- if ((0, _object.object_isEmpty)(objectlist)) return [];
72
- if (objectlist instanceof _ObjectArray["default"]) objectlist = objectlist.getObjects();
73
- if (!Array.isArray(objectlist)) {
74
- objectlist = [objectlist];
75
- }
76
- return objectlist.map(function (r) {
77
- return _this2.ensure.apply(_this2, [maptoType, r, is_readonly].concat(p));
78
- });
79
- }
80
- }, {
81
- key: "ensure",
82
- value: function ensure(maptoType, object, is_readonly) {
83
- if (object === undefined) {
84
- object = maptoType;
85
- maptoType = this;
86
- }
87
- for (var _len2 = arguments.length, p = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
88
- p[_key2 - 3] = arguments[_key2];
89
- }
90
- return _object.object_ensure.apply(void 0, [maptoType, object, is_readonly].concat(p));
91
- }
92
- /* -------------------------------------------------------------------------- */
93
- }, {
94
- key: "map_rowindex",
95
- value: function map_rowindex(objectlist) {
96
- var _objectlist$map;
97
- var index = 0;
98
- return (_objectlist$map = objectlist === null || objectlist === void 0 ? void 0 : objectlist.map(function (r, i) {
99
- r.__row_number = ++index;
100
- return r;
101
- })) !== null && _objectlist$map !== void 0 ? _objectlist$map : [];
102
- }
103
- }, {
104
- key: "map_tableid",
105
- value: function map_tableid(objectlist) {
106
- var _objectlist$map2;
107
- var index = 0;
108
- return (_objectlist$map2 = objectlist === null || objectlist === void 0 ? void 0 : objectlist.map(function (r, i) {
109
- var _r$__uid;
110
- r.__table_id = (_r$__uid = r.__uid) !== null && _r$__uid !== void 0 ? _r$__uid : String(++index);
111
- return r;
112
- })) !== null && _objectlist$map2 !== void 0 ? _objectlist$map2 : [];
113
- }
114
- }, {
115
- key: "equals",
116
- value: function equals(a, b) {
117
- console.warn("Dont use the default equals method !");
118
- if (a == undefined || b == undefined) return false;
119
- if (_typeof(a) === "object") a = a.__uid;
120
- if (_typeof(b) === "object") b = b.__uid;
121
- return (0, _string.string_equals_ignorecase)(a, b);
122
- }
123
- }]);
124
- return MapableObject;
125
- }(_ObjectWithTemp2["default"]);
126
- exports.MapableObject = MapableObject;
127
- var _default = MapableObject;
128
- exports["default"] = _default;
8
+ */
9
+ export class MapableObject extends ObjectWithTemp {
10
+ __uid;
11
+ __data_id;
12
+ __table_id;
13
+ __parent__table_id;
14
+ __row_number;
15
+ constructor() {
16
+ super();
17
+ this.__uid = uid.localuid();
18
+ this.__table_id = this.__uid;
19
+ }
20
+ getUID() {
21
+ return MapableObject.getUID(this);
22
+ }
23
+ /* -------------------------------------------------------------------------- */
24
+ static getUID(o) {
25
+ return o.__uid;
26
+ }
27
+ static mapto(maptoType, objectlist, is_readonly = true, ...p) {
28
+ if (objectlist === undefined) {
29
+ if (maptoType === undefined)
30
+ return [];
31
+ if (maptoType instanceof Object)
32
+ return [];
33
+ objectlist = maptoType;
34
+ maptoType = this;
35
+ }
36
+ if (object_isEmpty(objectlist))
37
+ return [];
38
+ if (objectlist instanceof ObjectArray)
39
+ objectlist = objectlist.getObjects();
40
+ if (!Array.isArray(objectlist)) {
41
+ objectlist = [objectlist];
42
+ }
43
+ return objectlist.map((r) => this.ensure(maptoType, r, is_readonly, ...p));
44
+ }
45
+ static ensure(maptoType, object, is_readonly, ...p) {
46
+ if (object === undefined) {
47
+ object = maptoType;
48
+ maptoType = this;
49
+ }
50
+ return object_ensure(maptoType, object, is_readonly, ...p);
51
+ }
52
+ /* -------------------------------------------------------------------------- */
53
+ static map_rowindex(objectlist) {
54
+ let index = 0;
55
+ return (objectlist?.map((r, i) => {
56
+ r.__row_number = ++index;
57
+ return r;
58
+ }) ?? []);
59
+ }
60
+ static map_tableid(objectlist) {
61
+ let index = 0;
62
+ return (objectlist?.map((r, i) => {
63
+ r.__table_id = r.__uid ?? String(++index);
64
+ return r;
65
+ }) ?? []);
66
+ }
67
+ static equals(a, b) {
68
+ console.warn("Dont use the default equals method !");
69
+ if (a == undefined || b == undefined)
70
+ return false;
71
+ if (typeof a === "object")
72
+ a = a.__uid;
73
+ if (typeof b === "object")
74
+ b = b.__uid;
75
+ return string_equals_ignorecase(a, b);
76
+ }
77
+ }
78
+ export default MapableObject;
@@ -1,113 +1,35 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.MetaObject = void 0;
7
- var _object = require("@azrico/object");
8
- var _SimpleObject2 = _interopRequireDefault(require("./SimpleObject"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
- 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
18
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
19
- 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); }; }
20
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
21
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
- 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; } }
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
27
- var MetaObject = /*#__PURE__*/function (_SimpleObject, _get_saveObject, _Prepare, _get_saveObject2) {
28
- _inherits(MetaObject, _SimpleObject);
29
- var _super = _createSuper(MetaObject);
30
- function MetaObject(initObject, value) {
31
- var _this;
32
- _classCallCheck(this, MetaObject);
33
- _this = _super.call(this, false);
34
- _defineProperty(_assertThisInitialized(_this), "id", void 0);
35
- _defineProperty(_assertThisInitialized(_this), "key", "");
36
- _defineProperty(_assertThisInitialized(_this), "value", void 0);
37
- if (_typeof(initObject) === "object") {
38
- _this.id = initObject.id;
39
- _this.key = initObject.key;
40
- _this.value = initObject.value;
41
- } else if (typeof initObject === "string") {
42
- _this.key = initObject;
43
- _this.value = value;
44
- }
45
- _this.setOriginal();
46
- return _this;
47
- }
48
- _createClass(MetaObject, [{
49
- key: "get_saveObject",
50
- value: function get_saveObject() {
51
- return (_get_saveObject = _get_saveObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
52
- return _regeneratorRuntime().wrap(function _callee$(_context) {
53
- while (1) switch (_context.prev = _context.next) {
54
- case 0:
55
- _context.next = 2;
56
- return MetaObject.get_saveObject(this);
57
- case 2:
58
- return _context.abrupt("return", _context.sent);
59
- case 3:
60
- case "end":
61
- return _context.stop();
62
- }
63
- }, _callee, this);
64
- }))).apply(this, arguments);
65
- }
66
- }, {
67
- key: "Prepare",
68
- value: function Prepare() {
69
- return (_Prepare = _Prepare || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
70
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
71
- while (1) switch (_context2.prev = _context2.next) {
72
- case 0:
73
- this.key = String(this.key);
74
- _context2.next = 3;
75
- return Promise.resolve(true);
76
- case 3:
77
- return _context2.abrupt("return", _context2.sent);
78
- case 4:
79
- case "end":
80
- return _context2.stop();
81
- }
82
- }, _callee2, this);
83
- }))).apply(this, arguments);
84
- }
85
- }, {
86
- key: "isNew",
87
- get: function get() {
88
- return this.id == null || Number(this.id) <= 0;
89
- }
90
- }, {
91
- key: "isDeleted",
92
- get: function get() {
93
- return (0, _object.object_isExactlyEmpty)(this.value);
94
- }
95
- }], [{
96
- key: "get_saveObject",
97
- value: function get_saveObject(_x) {
98
- return (_get_saveObject2 = _get_saveObject2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(obj) {
99
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
100
- while (1) switch (_context3.prev = _context3.next) {
101
- case 0:
102
- case "end":
103
- return _context3.stop();
104
- }
105
- }, _callee3);
106
- }))).apply(this, arguments);
107
- }
108
- }]);
109
- return MetaObject;
110
- }(_SimpleObject2["default"]);
111
- exports.MetaObject = MetaObject;
112
- var _default = MetaObject;
113
- exports["default"] = _default;
1
+ import { object_isExactlyEmpty } from "@azrico/object";
2
+ import SimpleObject from "./SimpleObject";
3
+ export class MetaObject extends SimpleObject {
4
+ id;
5
+ key = "";
6
+ value;
7
+ constructor(initObject, value) {
8
+ super(false);
9
+ if (typeof initObject === "object") {
10
+ this.id = initObject.id;
11
+ this.key = initObject.key;
12
+ this.value = initObject.value;
13
+ }
14
+ else if (typeof initObject === "string") {
15
+ this.key = initObject;
16
+ this.value = value;
17
+ }
18
+ this.setOriginal();
19
+ }
20
+ async get_saveObject() {
21
+ return await MetaObject.get_saveObject(this);
22
+ }
23
+ static async get_saveObject(obj) { }
24
+ async Prepare() {
25
+ this.key = String(this.key);
26
+ return await Promise.resolve(true);
27
+ }
28
+ get isNew() {
29
+ return this.id == null || Number(this.id) <= 0;
30
+ }
31
+ get isDeleted() {
32
+ return object_isExactlyEmpty(this.value);
33
+ }
34
+ }
35
+ export default MetaObject;