@azrico/webobject 1.3.23 → 1.3.26

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.
@@ -1,53 +1,115 @@
1
- import ObjectManager from "../structs/ObjectManager";
2
- import { gfunc } from "@azrico/global";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.WebObjectManager = void 0;
7
+ var _ObjectManager2 = _interopRequireDefault(require("../structs/ObjectManager"));
8
+ var _global = require("@azrico/global");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
12
+ 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); } }
13
+ 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); }); }; }
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); }
3
27
  /**
4
28
  * This class manages the events of an Simple Object
5
- */
6
- export class WebObjectManager extends ObjectManager {
7
- //we use this as backup
8
- static __web_path = "";
9
- static __web_type = "";
10
- static __save_message = true;
11
- /* -------------------------------------------------------------------------- */
12
- constructor() {
13
- super();
14
- /* ---------------- should we display a message after saving ? -------------- */
15
- if (this.constructor["__save_message"]) {
16
- this.event_add("on_save", "onsave_sendmsg", async () => {
17
- switch (this.getSaveResultType()) {
18
- case "nothing":
19
- return await gfunc.run_action("show_message", {
20
- message: "Nothing to save",
21
- type: "info",
22
- });
23
- case "normal":
24
- return await gfunc.run_action("show_message", {
25
- message: "Saved",
26
- type: "success",
27
- });
28
- default:
29
- return await gfunc.run_action("show_message", {
30
- message: "Not saved",
31
- type: "error",
32
- });
33
- }
34
- });
35
- }
36
- }
37
- /* -------------------------------------------------------------------------- */
38
- /* Options */
39
- /* -------------------------------------------------------------------------- */
40
- /**
41
- * use an option and detect its changes in real time. similar to recat state
42
- * @param key name of the option
43
- * @returns value of the option
44
- */
45
- async useOption(key) {
46
- return this.event_use("on_option_change", () => Boolean(this.getOption(key)), [key], false);
47
- }
48
- /* -------------------------------------------------------------------------- */
49
- /* Meta data */
50
- /* -------------------------------------------------------------------------- */
29
+ */
30
+ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
31
+ _inherits(WebObjectManager, _ObjectManager);
32
+ var _super = _createSuper(WebObjectManager);
33
+ /* -------------------------------------------------------------------------- */
34
+ function WebObjectManager() {
35
+ var _this;
36
+ _classCallCheck(this, WebObjectManager);
37
+ _this = _super.call(this);
38
+ /* ---------------- should we display a message after saving ? -------------- */
39
+ if (_this.constructor["__save_message"]) {
40
+ _this.event_add("on_save", "onsave_sendmsg", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
41
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
42
+ while (1) switch (_context.prev = _context.next) {
43
+ case 0:
44
+ _context.t0 = _this.getSaveResultType();
45
+ _context.next = _context.t0 === "nothing" ? 3 : _context.t0 === "normal" ? 6 : 9;
46
+ break;
47
+ case 3:
48
+ _context.next = 5;
49
+ return _global.gfunc.run_action("show_message", {
50
+ message: "Nothing to save",
51
+ type: "info"
52
+ });
53
+ case 5:
54
+ return _context.abrupt("return", _context.sent);
55
+ case 6:
56
+ _context.next = 8;
57
+ return _global.gfunc.run_action("show_message", {
58
+ message: "Saved",
59
+ type: "success"
60
+ });
61
+ case 8:
62
+ return _context.abrupt("return", _context.sent);
63
+ case 9:
64
+ _context.next = 11;
65
+ return _global.gfunc.run_action("show_message", {
66
+ message: "Not saved",
67
+ type: "error"
68
+ });
69
+ case 11:
70
+ return _context.abrupt("return", _context.sent);
71
+ case 12:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }, _callee);
76
+ })));
77
+ }
78
+ return _this;
79
+ }
80
+ /* -------------------------------------------------------------------------- */
81
+ /* Options */
82
+ /* -------------------------------------------------------------------------- */
83
+ /**
84
+ * use an option and detect its changes in real time. similar to recat state
85
+ * @param key name of the option
86
+ * @returns value of the option
87
+ */
88
+ _createClass(WebObjectManager, [{
89
+ key: "useOption",
90
+ value: function () {
91
+ var _useOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key) {
92
+ var _this2 = this;
93
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
94
+ while (1) switch (_context2.prev = _context2.next) {
95
+ case 0:
96
+ return _context2.abrupt("return", this.event_use("on_option_change", function () {
97
+ return Boolean(_this2.getOption(key));
98
+ }, [key], false));
99
+ case 1:
100
+ case "end":
101
+ return _context2.stop();
102
+ }
103
+ }, _callee2, this);
104
+ }));
105
+ function useOption(_x) {
106
+ return _useOption.apply(this, arguments);
107
+ }
108
+ return useOption;
109
+ }()
110
+ /* -------------------------------------------------------------------------- */
111
+ /* Meta data */
112
+ /* -------------------------------------------------------------------------- */
51
113
  /**
52
114
  * Update meta value of this object , meta data is stored in meta_data variable
53
115
  * @param key
@@ -55,96 +117,295 @@ export class WebObjectManager extends ObjectManager {
55
117
  * @param createIfNotExists should we create a new meta if key does not exist
56
118
  * @param sendChange
57
119
  * @returns
58
- */
59
- setMetaValue(key, value, createIfNotExists = true, sendChange = "auto") {
60
- return this.obj?.setMetaValue(key, value, createIfNotExists, sendChange);
61
- }
62
- getMeta(key) {
63
- return this.obj?.getMeta(key);
64
- }
65
- getMetaValue(key) {
66
- return this.obj?.getMetaValue(key);
67
- }
68
- /* -------------------------------------------------------------------------- */
69
- async get_deltaObject() {
70
- return (await this.obj?.get_deltaObject()) || {};
71
- }
72
- /* ------------------------------ save and load ----------------------------- */
73
- async Save() {
74
- return (await this.obj?.Save()) || false;
75
- }
76
- async Load(search, ...p) {
77
- throw Error("load not implented");
78
- }
79
- /* -------------------------------------------------------------------------- */
80
- /* Child Functions */
81
- /* -------------------------------------------------------------------------- */
82
- get __web_path() {
83
- return this.obj?.__web_path || this.constructor["__web_path"] || "";
84
- }
85
- get __web_type() {
86
- return this.obj?.__web_type || this.constructor["__web_type"] || "";
87
- }
88
- get_webname() {
89
- return this.__web_path || this.__web_type || this.__cache_name || "";
90
- }
91
- /* -------------------------------------------------------------------------- */
92
- /* Default Events */
93
- /* -------------------------------------------------------------------------- */
120
+ */
121
+ }, {
122
+ key: "setMetaValue",
123
+ value: function setMetaValue(key, value) {
124
+ var _this$obj;
125
+ var createIfNotExists = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
126
+ var sendChange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
127
+ return (_this$obj = this.obj) === null || _this$obj === void 0 ? void 0 : _this$obj.setMetaValue(key, value, createIfNotExists, sendChange);
128
+ }
129
+ }, {
130
+ key: "getMeta",
131
+ value: function getMeta(key) {
132
+ var _this$obj2;
133
+ return (_this$obj2 = this.obj) === null || _this$obj2 === void 0 ? void 0 : _this$obj2.getMeta(key);
134
+ }
135
+ }, {
136
+ key: "getMetaValue",
137
+ value: function getMetaValue(key) {
138
+ var _this$obj3;
139
+ return (_this$obj3 = this.obj) === null || _this$obj3 === void 0 ? void 0 : _this$obj3.getMetaValue(key);
140
+ }
141
+ /* -------------------------------------------------------------------------- */
142
+ }, {
143
+ key: "get_deltaObject",
144
+ value: function () {
145
+ var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
146
+ var _this$obj4;
147
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
148
+ while (1) switch (_context3.prev = _context3.next) {
149
+ case 0:
150
+ _context3.next = 2;
151
+ return (_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.get_deltaObject();
152
+ case 2:
153
+ _context3.t0 = _context3.sent;
154
+ if (_context3.t0) {
155
+ _context3.next = 5;
156
+ break;
157
+ }
158
+ _context3.t0 = {};
159
+ case 5:
160
+ return _context3.abrupt("return", _context3.t0);
161
+ case 6:
162
+ case "end":
163
+ return _context3.stop();
164
+ }
165
+ }, _callee3, this);
166
+ }));
167
+ function get_deltaObject() {
168
+ return _get_deltaObject.apply(this, arguments);
169
+ }
170
+ return get_deltaObject;
171
+ }() /* ------------------------------ save and load ----------------------------- */
172
+ }, {
173
+ key: "Save",
174
+ value: function () {
175
+ var _Save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
176
+ var _this$obj5;
177
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
178
+ while (1) switch (_context4.prev = _context4.next) {
179
+ case 0:
180
+ _context4.next = 2;
181
+ return (_this$obj5 = this.obj) === null || _this$obj5 === void 0 ? void 0 : _this$obj5.Save();
182
+ case 2:
183
+ _context4.t0 = _context4.sent;
184
+ if (_context4.t0) {
185
+ _context4.next = 5;
186
+ break;
187
+ }
188
+ _context4.t0 = false;
189
+ case 5:
190
+ return _context4.abrupt("return", _context4.t0);
191
+ case 6:
192
+ case "end":
193
+ return _context4.stop();
194
+ }
195
+ }, _callee4, this);
196
+ }));
197
+ function Save() {
198
+ return _Save.apply(this, arguments);
199
+ }
200
+ return Save;
201
+ }()
202
+ }, {
203
+ key: "Load",
204
+ value: function () {
205
+ var _Load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(search) {
206
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
207
+ while (1) switch (_context5.prev = _context5.next) {
208
+ case 0:
209
+ throw Error("load not implented");
210
+ case 1:
211
+ case "end":
212
+ return _context5.stop();
213
+ }
214
+ }, _callee5);
215
+ }));
216
+ function Load(_x2) {
217
+ return _Load.apply(this, arguments);
218
+ }
219
+ return Load;
220
+ }()
221
+ /* -------------------------------------------------------------------------- */
222
+ /* Child Functions */
223
+ /* -------------------------------------------------------------------------- */
224
+ }, {
225
+ key: "__web_path",
226
+ get: function get() {
227
+ var _this$obj6;
228
+ return ((_this$obj6 = this.obj) === null || _this$obj6 === void 0 ? void 0 : _this$obj6.__web_path) || this.constructor["__web_path"] || "";
229
+ }
230
+ }, {
231
+ key: "__web_type",
232
+ get: function get() {
233
+ var _this$obj7;
234
+ return ((_this$obj7 = this.obj) === null || _this$obj7 === void 0 ? void 0 : _this$obj7.__web_type) || this.constructor["__web_type"] || "";
235
+ }
236
+ }, {
237
+ key: "get_webname",
238
+ value: function get_webname() {
239
+ return this.__web_path || this.__web_type || this.__cache_name || "";
240
+ }
241
+ /* -------------------------------------------------------------------------- */
242
+ /* Default Events */
243
+ /* -------------------------------------------------------------------------- */
94
244
  /**
95
245
  * Use this when you load new Object
96
246
  * @param p
97
247
  * @returns
98
- */
99
- async onNew(...p) {
100
- if (this.canModify) {
101
- this.obj?.setOriginal();
102
- }
103
- await this.event_run("on_new");
104
- await this.event_run("on_change", true);
105
- await this.event_run("on_after_new");
106
- return await Promise.resolve(true);
107
- }
248
+ */
249
+ }, {
250
+ key: "onNew",
251
+ value: function () {
252
+ var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
253
+ var _this$obj8;
254
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
255
+ while (1) switch (_context6.prev = _context6.next) {
256
+ case 0:
257
+ if (this.canModify) {
258
+ (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.setOriginal();
259
+ }
260
+ _context6.next = 3;
261
+ return this.event_run("on_new");
262
+ case 3:
263
+ _context6.next = 5;
264
+ return this.event_run("on_change", true);
265
+ case 5:
266
+ _context6.next = 7;
267
+ return this.event_run("on_after_new");
268
+ case 7:
269
+ _context6.next = 9;
270
+ return Promise.resolve(true);
271
+ case 9:
272
+ return _context6.abrupt("return", _context6.sent);
273
+ case 10:
274
+ case "end":
275
+ return _context6.stop();
276
+ }
277
+ }, _callee6, this);
278
+ }));
279
+ function onNew() {
280
+ return _onNew.apply(this, arguments);
281
+ }
282
+ return onNew;
283
+ }()
108
284
  /**
109
285
  * Use this when you delete Object
110
286
  * @param p
111
287
  * @returns
112
- */
113
- async onDelete(...p) {
114
- if (this.obj) {
115
- this.obj.isDeleted = true;
116
- }
117
- await this.event_run("on_delete");
118
- await this.event_run("on_after_delete");
119
- return await Promise.resolve(true);
120
- }
288
+ */
289
+ }, {
290
+ key: "onDelete",
291
+ value: function () {
292
+ var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
293
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
294
+ while (1) switch (_context7.prev = _context7.next) {
295
+ case 0:
296
+ if (this.obj) {
297
+ this.obj.isDeleted = true;
298
+ }
299
+ _context7.next = 3;
300
+ return this.event_run("on_delete");
301
+ case 3:
302
+ _context7.next = 5;
303
+ return this.event_run("on_after_delete");
304
+ case 5:
305
+ _context7.next = 7;
306
+ return Promise.resolve(true);
307
+ case 7:
308
+ return _context7.abrupt("return", _context7.sent);
309
+ case 8:
310
+ case "end":
311
+ return _context7.stop();
312
+ }
313
+ }, _callee7, this);
314
+ }));
315
+ function onDelete() {
316
+ return _onDelete.apply(this, arguments);
317
+ }
318
+ return onDelete;
319
+ }()
121
320
  /**
122
321
  * Use this when you load data to the object
123
322
  * @param p
124
323
  * @returns
125
- */
126
- async onLoad(...p) {
127
- if (this.canModify && this.obj) {
128
- this.obj.isDeleted = false;
129
- this.obj.setOriginal();
130
- }
131
- await this.event_run("on_load");
132
- await this.event_run("on_change", true);
133
- await this.event_run("on_after_load");
134
- await this.event_run("on_load_finished");
135
- return await Promise.resolve(true);
136
- }
324
+ */
325
+ }, {
326
+ key: "onLoad",
327
+ value: function () {
328
+ var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
329
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
330
+ while (1) switch (_context8.prev = _context8.next) {
331
+ case 0:
332
+ if (this.canModify && this.obj) {
333
+ this.obj.isDeleted = false;
334
+ this.obj.setOriginal();
335
+ }
336
+ _context8.next = 3;
337
+ return this.event_run("on_load");
338
+ case 3:
339
+ _context8.next = 5;
340
+ return this.event_run("on_change", true);
341
+ case 5:
342
+ _context8.next = 7;
343
+ return this.event_run("on_after_load");
344
+ case 7:
345
+ _context8.next = 9;
346
+ return this.event_run("on_load_finished");
347
+ case 9:
348
+ _context8.next = 11;
349
+ return Promise.resolve(true);
350
+ case 11:
351
+ return _context8.abrupt("return", _context8.sent);
352
+ case 12:
353
+ case "end":
354
+ return _context8.stop();
355
+ }
356
+ }, _callee8, this);
357
+ }));
358
+ function onLoad() {
359
+ return _onLoad.apply(this, arguments);
360
+ }
361
+ return onLoad;
362
+ }()
137
363
  /**
138
364
  * Use this after succesful save to Database
139
365
  * @param p
140
366
  * @returns
141
- */
142
- async onSave(...p) {
143
- await this.event_run("on_save");
144
- await this.event_run("on_change", true);
145
- await this.event_run("on_after_save");
146
- await this.event_run("on_save_finished");
147
- return await Promise.resolve(true);
148
- }
149
- }
150
- export default WebObjectManager;
367
+ */
368
+ }, {
369
+ key: "onSave",
370
+ value: function () {
371
+ var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
372
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
373
+ while (1) switch (_context9.prev = _context9.next) {
374
+ case 0:
375
+ _context9.next = 2;
376
+ return this.event_run("on_save");
377
+ case 2:
378
+ _context9.next = 4;
379
+ return this.event_run("on_change", true);
380
+ case 4:
381
+ _context9.next = 6;
382
+ return this.event_run("on_after_save");
383
+ case 6:
384
+ _context9.next = 8;
385
+ return this.event_run("on_save_finished");
386
+ case 8:
387
+ _context9.next = 10;
388
+ return Promise.resolve(true);
389
+ case 10:
390
+ return _context9.abrupt("return", _context9.sent);
391
+ case 11:
392
+ case "end":
393
+ return _context9.stop();
394
+ }
395
+ }, _callee9, this);
396
+ }));
397
+ function onSave() {
398
+ return _onSave.apply(this, arguments);
399
+ }
400
+ return onSave;
401
+ }()
402
+ }]);
403
+ return WebObjectManager;
404
+ }(_ObjectManager2["default"]);
405
+ exports.WebObjectManager = WebObjectManager;
406
+ //we use this as backup
407
+ _defineProperty(WebObjectManager, "__web_path", "");
408
+ _defineProperty(WebObjectManager, "__web_type", "");
409
+ _defineProperty(WebObjectManager, "__save_message", true);
410
+ var _default = WebObjectManager;
411
+ exports["default"] = _default;