@azrico/webobject 1.4.158 → 1.4.161
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/WebObjects/WebObject.d.ts +3 -5
- package/dist/src/WebObjects/WebObject.js +11 -17
- package/dist/src/WebObjects/WebObjectManager.d.ts +4 -4
- package/dist/src/WebObjects/WebObjectManager.js +33 -19
- package/dist/src/WebObjects/WebObjectPathHelper.js +4 -4
- package/dist/src/WebObjects/WebObjectPathHelper.test.js +6 -6
- package/dist/src/structs/ObjectManager.d.ts +3 -1
- package/dist/src/structs/ObjectManager.js +27 -32
- package/dist/src/structs/SimpleObject.d.ts +4 -2
- package/dist/src/structs/SimpleObject.js +17 -10
- package/package.json +1 -1
|
@@ -11,7 +11,6 @@ export type deltaParams = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare class WebObject extends SimpleObject {
|
|
13
13
|
static readonly __web_path: string;
|
|
14
|
-
static readonly __web_type: string;
|
|
15
14
|
static readonly __protectedProperties: string[];
|
|
16
15
|
static readonly __requiredProperties: never[];
|
|
17
16
|
meta_data: {
|
|
@@ -84,11 +83,10 @@ export declare class WebObject extends SimpleObject {
|
|
|
84
83
|
* @returns
|
|
85
84
|
*/
|
|
86
85
|
get_deltaObject(p?: deltaParams): Promise<any>;
|
|
87
|
-
get __web_path(): string;
|
|
88
|
-
get __web_type(): string;
|
|
89
86
|
get manager(): WebObjectManager<any> | undefined;
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
get __web_path(): string;
|
|
88
|
+
get_webpath(): string;
|
|
89
|
+
static get_webpath(): string;
|
|
92
90
|
onDelete(...p: any): Promise<any>;
|
|
93
91
|
onArchive(...p: any): Promise<any>;
|
|
94
92
|
onUnArchive(...p: any): Promise<any>;
|
|
@@ -655,24 +655,19 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
655
655
|
return get_deltaObject;
|
|
656
656
|
}() /* --------------------------------- Getters -------------------------------- */)
|
|
657
657
|
}, {
|
|
658
|
-
key: "
|
|
659
|
-
get: function get() {
|
|
660
|
-
return this.constructor["__web_path"] || this.constructor["__web_type"];
|
|
661
|
-
}
|
|
662
|
-
}, {
|
|
663
|
-
key: "__web_type",
|
|
658
|
+
key: "manager",
|
|
664
659
|
get: function get() {
|
|
665
|
-
return this.
|
|
660
|
+
return this.get_managerClass() || undefined;
|
|
666
661
|
}
|
|
667
662
|
}, {
|
|
668
|
-
key: "
|
|
663
|
+
key: "__web_path",
|
|
669
664
|
get: function get() {
|
|
670
|
-
return this.
|
|
665
|
+
return this.constructor["__web_path"] || this.__db_name;
|
|
671
666
|
}
|
|
672
667
|
}, {
|
|
673
|
-
key: "
|
|
674
|
-
value: function
|
|
675
|
-
return this.__web_path || this.
|
|
668
|
+
key: "get_webpath",
|
|
669
|
+
value: function get_webpath() {
|
|
670
|
+
return this.__web_path || this.__db_name || "";
|
|
676
671
|
}
|
|
677
672
|
}, {
|
|
678
673
|
key: "onDelete",
|
|
@@ -1059,7 +1054,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1059
1054
|
if (!extraOptions) extraOptions = {};
|
|
1060
1055
|
chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
|
|
1061
1056
|
delete extraOptions.chunksize;
|
|
1062
|
-
putAddress = this.
|
|
1057
|
+
putAddress = this.get_webpath();
|
|
1063
1058
|
index = 0;
|
|
1064
1059
|
case 6:
|
|
1065
1060
|
if (!(index < chunks.length)) {
|
|
@@ -1153,9 +1148,9 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1153
1148
|
return saveList;
|
|
1154
1149
|
}()
|
|
1155
1150
|
}, {
|
|
1156
|
-
key: "
|
|
1157
|
-
value: function
|
|
1158
|
-
return this.__web_path || this.
|
|
1151
|
+
key: "get_webpath",
|
|
1152
|
+
value: function get_webpath() {
|
|
1153
|
+
return this.__web_path || this.__db_name || "";
|
|
1159
1154
|
}
|
|
1160
1155
|
}, {
|
|
1161
1156
|
key: "saveResultHasID",
|
|
@@ -1318,7 +1313,6 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1318
1313
|
return WebObject;
|
|
1319
1314
|
}(_index3.SimpleObject);
|
|
1320
1315
|
_defineProperty(WebObject, "__web_path", "");
|
|
1321
|
-
_defineProperty(WebObject, "__web_type", "");
|
|
1322
1316
|
_defineProperty(WebObject, "__protectedProperties", ["_users"]);
|
|
1323
1317
|
//you cant create a new weboject without these properties
|
|
1324
1318
|
_defineProperty(WebObject, "__requiredProperties", []);
|
|
@@ -7,8 +7,6 @@ import ObjectManager from "../structs/ObjectManager";
|
|
|
7
7
|
export declare class WebObjectManager<T extends WebObject> extends ObjectManager<T> {
|
|
8
8
|
static readonly __object_type: ClassType<WebObject>;
|
|
9
9
|
static readonly __save_message: boolean;
|
|
10
|
-
protected __last_web_path: string;
|
|
11
|
-
protected __last_web_type: string;
|
|
12
10
|
constructor(defaultObject?: T);
|
|
13
11
|
setObject(toObj: T | undefined): boolean;
|
|
14
12
|
/**
|
|
@@ -30,8 +28,10 @@ export declare class WebObjectManager<T extends WebObject> extends ObjectManager
|
|
|
30
28
|
UnArchive(): Promise<any>;
|
|
31
29
|
Load(search: any, ...p: any[]): Promise<WebObject | undefined>;
|
|
32
30
|
get __web_path(): string;
|
|
33
|
-
get
|
|
34
|
-
|
|
31
|
+
get __db_name(): string;
|
|
32
|
+
get __object_name(): string;
|
|
33
|
+
get_webpath(): string;
|
|
34
|
+
private __getObjectData;
|
|
35
35
|
/**
|
|
36
36
|
* Use this when you load new Object
|
|
37
37
|
* @param p
|
|
@@ -17,8 +17,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
17
17
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
18
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
19
19
|
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); }
|
|
20
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
20
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
22
|
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
23
23
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
24
24
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
@@ -37,10 +37,8 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
37
37
|
var _this;
|
|
38
38
|
_classCallCheck(this, WebObjectManager);
|
|
39
39
|
_this = _callSuper(this, WebObjectManager, [defaultObject]);
|
|
40
|
-
/* ---------------- should we display a message after saving ? -------------- */
|
|
41
|
-
_defineProperty(_assertThisInitialized(_this), "__last_web_path", "");
|
|
42
|
-
_defineProperty(_assertThisInitialized(_this), "__last_web_type", "");
|
|
43
40
|
if (_this.constructor["__save_message"]) {
|
|
41
|
+
/* ---------------- should we display a message after saving ? -------------- */
|
|
44
42
|
_this.event_add("on_save", "on_save-sendmsg", /*#__PURE__*/function () {
|
|
45
43
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(srt) {
|
|
46
44
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -193,9 +191,13 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
193
191
|
key: "setObject",
|
|
194
192
|
value: function setObject(toObj) {
|
|
195
193
|
var res = _get(_getPrototypeOf(WebObjectManager.prototype), "setObject", this).call(this, toObj);
|
|
196
|
-
if (this.__currentObject instanceof _index.SimpleObject) {
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
if (this.__currentObject && this.__currentObject instanceof _index.SimpleObject) {
|
|
195
|
+
var checkKeys = ["__web_path", "__db_name", "__object_name"];
|
|
196
|
+
for (var index = 0; index < checkKeys.length; index++) {
|
|
197
|
+
var k = checkKeys[index];
|
|
198
|
+
if (!this.__last_object_data) this.__last_object_data = {};
|
|
199
|
+
if (this.__currentObject[k] != null) this.__last_object_data[k] = this.__currentObject[k];
|
|
200
|
+
}
|
|
199
201
|
}
|
|
200
202
|
return res;
|
|
201
203
|
}
|
|
@@ -479,21 +481,33 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
479
481
|
}, {
|
|
480
482
|
key: "__web_path",
|
|
481
483
|
get: function get() {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
484
|
+
return this.__getObjectData(["__web_path", "__db_name"]);
|
|
485
|
+
}
|
|
486
|
+
}, {
|
|
487
|
+
key: "__db_name",
|
|
488
|
+
get: function get() {
|
|
489
|
+
return this.__getObjectData(["__db_name", "__web_path"]);
|
|
485
490
|
}
|
|
486
491
|
}, {
|
|
487
|
-
key: "
|
|
492
|
+
key: "__object_name",
|
|
488
493
|
get: function get() {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
494
|
+
return this.__getObjectData(["__object_name", "__db_name"]);
|
|
495
|
+
}
|
|
496
|
+
}, {
|
|
497
|
+
key: "get_webpath",
|
|
498
|
+
value: function get_webpath() {
|
|
499
|
+
return this.__getObjectData(["__web_path", "__db_name"]);
|
|
492
500
|
}
|
|
493
501
|
}, {
|
|
494
|
-
key: "
|
|
495
|
-
value: function
|
|
496
|
-
|
|
502
|
+
key: "__getObjectData",
|
|
503
|
+
value: function __getObjectData(checkKeys) {
|
|
504
|
+
for (var index = 0; index < checkKeys.length; index++) {
|
|
505
|
+
var _this$obj10, _this$constructor$__o;
|
|
506
|
+
var k = checkKeys[index];
|
|
507
|
+
var v = ((_this$obj10 = this.obj) === null || _this$obj10 === void 0 ? void 0 : _this$obj10[k]) || ((_this$constructor$__o = this.constructor["__object_type"]) === null || _this$constructor$__o === void 0 ? void 0 : _this$constructor$__o[k]) || this.__last_object_data[k];
|
|
508
|
+
if (v) return v;
|
|
509
|
+
}
|
|
510
|
+
return "";
|
|
497
511
|
}
|
|
498
512
|
/* -------------------------------------------------------------------------- */
|
|
499
513
|
/* Default Events */
|
|
@@ -507,12 +521,12 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
507
521
|
key: "onNew",
|
|
508
522
|
value: (function () {
|
|
509
523
|
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
510
|
-
var _this$
|
|
524
|
+
var _this$obj11;
|
|
511
525
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
512
526
|
while (1) switch (_context14.prev = _context14.next) {
|
|
513
527
|
case 0:
|
|
514
528
|
if (this.canModify) {
|
|
515
|
-
(_this$
|
|
529
|
+
(_this$obj11 = this.obj) === null || _this$obj11 === void 0 || _this$obj11.setOriginal();
|
|
516
530
|
}
|
|
517
531
|
_context14.next = 3;
|
|
518
532
|
return this.event_run("on_new");
|
|
@@ -36,7 +36,7 @@ var WebObjectPathHelper = exports.WebObjectPathHelper = /*#__PURE__*/function ()
|
|
|
36
36
|
while (1) switch (_context.prev = _context.next) {
|
|
37
37
|
case 0:
|
|
38
38
|
action = String(action).toLowerCase();
|
|
39
|
-
wn = obj.
|
|
39
|
+
wn = obj.get_webpath();
|
|
40
40
|
wp = obj.__web_path;
|
|
41
41
|
usepath = "";
|
|
42
42
|
if (WebObjectPathHelper.pathOverrides[wn] && WebObjectPathHelper.pathOverrides[wn][action]) {
|
|
@@ -111,10 +111,10 @@ var WebObjectPathHelper = exports.WebObjectPathHelper = /*#__PURE__*/function ()
|
|
|
111
111
|
/* ------------------------------ find webname ------------------------------ */
|
|
112
112
|
if (typeof obj === "string") {
|
|
113
113
|
wn = obj;
|
|
114
|
-
} else if (typeof obj.
|
|
115
|
-
wn = obj.
|
|
114
|
+
} else if (typeof obj.get_webpath === "function") {
|
|
115
|
+
wn = obj.get_webpath();
|
|
116
116
|
} else {
|
|
117
|
-
console.error("[override_path]", "given object has no
|
|
117
|
+
console.error("[override_path]", "given object has no get_webpath");
|
|
118
118
|
wn = obj.__web_path || obj.__web_type;
|
|
119
119
|
}
|
|
120
120
|
if (wn) {
|
|
@@ -45,19 +45,19 @@ describe("WebObjectPathHelper", function () {
|
|
|
45
45
|
return _WebObjectPathHelper["default"].get_path(wobj, "save");
|
|
46
46
|
case 3:
|
|
47
47
|
_context.t1 = _context.sent;
|
|
48
|
-
(0, _context.t0)(_context.t1).toBe(wobj.
|
|
48
|
+
(0, _context.t0)(_context.t1).toBe(wobj.get_webpath() + "/" + wobj.getID());
|
|
49
49
|
_context.t2 = expect;
|
|
50
50
|
_context.next = 8;
|
|
51
51
|
return _WebObjectPathHelper["default"].get_path(wobj, "new");
|
|
52
52
|
case 8:
|
|
53
53
|
_context.t3 = _context.sent;
|
|
54
|
-
(0, _context.t2)(_context.t3).toBe(wobj.
|
|
54
|
+
(0, _context.t2)(_context.t3).toBe(wobj.get_webpath());
|
|
55
55
|
_context.t4 = expect;
|
|
56
56
|
_context.next = 13;
|
|
57
57
|
return _WebObjectPathHelper["default"].get_path(wobj, "lock");
|
|
58
58
|
case 13:
|
|
59
59
|
_context.t5 = _context.sent;
|
|
60
|
-
(0, _context.t4)(_context.t5).toBe("".concat(wobj.
|
|
60
|
+
(0, _context.t4)(_context.t5).toBe("".concat(wobj.get_webpath(), "/").concat(wobj.getID(), "/lock"));
|
|
61
61
|
case 15:
|
|
62
62
|
case "end":
|
|
63
63
|
return _context.stop();
|
|
@@ -69,7 +69,7 @@ describe("WebObjectPathHelper", function () {
|
|
|
69
69
|
while (1) switch (_context2.prev = _context2.next) {
|
|
70
70
|
case 0:
|
|
71
71
|
_context2.next = 2;
|
|
72
|
-
return _WebObjectPathHelper["default"].override_path(wobj.
|
|
72
|
+
return _WebObjectPathHelper["default"].override_path(wobj.get_webpath(), "save", "blah");
|
|
73
73
|
case 2:
|
|
74
74
|
_context2.t0 = expect;
|
|
75
75
|
_context2.next = 5;
|
|
@@ -78,7 +78,7 @@ describe("WebObjectPathHelper", function () {
|
|
|
78
78
|
_context2.t1 = _context2.sent;
|
|
79
79
|
(0, _context2.t0)(_context2.t1).toBe("blah");
|
|
80
80
|
_context2.next = 9;
|
|
81
|
-
return _WebObjectPathHelper["default"].override_path(wobj.
|
|
81
|
+
return _WebObjectPathHelper["default"].override_path(wobj.get_webpath(), "save", "{id}");
|
|
82
82
|
case 9:
|
|
83
83
|
_context2.t2 = expect;
|
|
84
84
|
_context2.next = 12;
|
|
@@ -91,7 +91,7 @@ describe("WebObjectPathHelper", function () {
|
|
|
91
91
|
return _WebObjectPathHelper["default"].get_path(wobj, "new");
|
|
92
92
|
case 17:
|
|
93
93
|
_context2.t5 = _context2.sent;
|
|
94
|
-
(0, _context2.t4)(_context2.t5).toBe(wobj.
|
|
94
|
+
(0, _context2.t4)(_context2.t5).toBe(wobj.get_webpath());
|
|
95
95
|
case 19:
|
|
96
96
|
case "end":
|
|
97
97
|
return _context2.stop();
|
|
@@ -11,6 +11,9 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
|
|
|
11
11
|
__eventPrefix?: string;
|
|
12
12
|
__stopEvents?: boolean;
|
|
13
13
|
static readonly __object_type: ClassType<SimpleObject>;
|
|
14
|
+
protected __last_object_data: {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
};
|
|
14
17
|
protected __currentObject?: ObjType | null;
|
|
15
18
|
protected __options?: object;
|
|
16
19
|
__object_nullable: boolean;
|
|
@@ -40,7 +43,6 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
|
|
|
40
43
|
get canModify(): boolean;
|
|
41
44
|
get isNew(): boolean;
|
|
42
45
|
get isSaved(): boolean;
|
|
43
|
-
get __cache_name(): string;
|
|
44
46
|
getSaveResult(): any | null;
|
|
45
47
|
getSaveResultType(): saveResultType | null;
|
|
46
48
|
setSaveResult(toObj: any, type: saveResultType): saveResultType | undefined;
|
|
@@ -42,6 +42,7 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
42
42
|
_defineProperty(_assertThisInitialized(_this), "__eventList", {});
|
|
43
43
|
_defineProperty(_assertThisInitialized(_this), "__eventPrefix", void 0);
|
|
44
44
|
_defineProperty(_assertThisInitialized(_this), "__stopEvents", void 0);
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "__last_object_data", {});
|
|
45
46
|
_defineProperty(_assertThisInitialized(_this), "__currentObject", void 0);
|
|
46
47
|
_defineProperty(_assertThisInitialized(_this), "__options", void 0);
|
|
47
48
|
//can the current object be set to null safely?
|
|
@@ -170,35 +171,29 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
170
171
|
var _this$obj3;
|
|
171
172
|
return ((_this$obj3 = this.obj) === null || _this$obj3 === void 0 ? void 0 : _this$obj3.isSaved) || false;
|
|
172
173
|
}
|
|
173
|
-
}, {
|
|
174
|
-
key: "__cache_name",
|
|
175
|
-
get: function get() {
|
|
176
|
-
var _this$obj4, _this$constructor$__o;
|
|
177
|
-
return ((_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.__cache_name) || ((_this$constructor$__o = this.constructor["__object_type"]) === null || _this$constructor$__o === void 0 ? void 0 : _this$constructor$__o.__cache_name) || "";
|
|
178
|
-
}
|
|
179
174
|
}, {
|
|
180
175
|
key: "getSaveResult",
|
|
181
176
|
value: function getSaveResult() {
|
|
182
|
-
var _this$
|
|
183
|
-
return ((_this$
|
|
177
|
+
var _this$obj4;
|
|
178
|
+
return ((_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.getSaveResult()) || null;
|
|
184
179
|
}
|
|
185
180
|
}, {
|
|
186
181
|
key: "getSaveResultType",
|
|
187
182
|
value: function getSaveResultType() {
|
|
188
|
-
var _this$
|
|
189
|
-
return ((_this$
|
|
183
|
+
var _this$obj5;
|
|
184
|
+
return ((_this$obj5 = this.obj) === null || _this$obj5 === void 0 ? void 0 : _this$obj5.getSaveResultType()) || null;
|
|
190
185
|
}
|
|
191
186
|
}, {
|
|
192
187
|
key: "setSaveResult",
|
|
193
188
|
value: function setSaveResult(toObj, type) {
|
|
194
|
-
var _this$
|
|
195
|
-
return (_this$
|
|
189
|
+
var _this$obj6;
|
|
190
|
+
return (_this$obj6 = this.obj) === null || _this$obj6 === void 0 ? void 0 : _this$obj6.setSaveResult(toObj, type);
|
|
196
191
|
}
|
|
197
192
|
}, {
|
|
198
193
|
key: "apply_changes",
|
|
199
194
|
value: function apply_changes() {
|
|
200
|
-
var _this$
|
|
201
|
-
return ((_this$
|
|
195
|
+
var _this$obj7;
|
|
196
|
+
return ((_this$obj7 = this.obj) === null || _this$obj7 === void 0 ? void 0 : _this$obj7.apply_changes()) || false;
|
|
202
197
|
}
|
|
203
198
|
}, {
|
|
204
199
|
key: "getValue",
|
|
@@ -268,12 +263,12 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
268
263
|
key: "setSubValue",
|
|
269
264
|
value: (function () {
|
|
270
265
|
var _setSubValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, objKey, subvalue) {
|
|
271
|
-
var _yield$this$obj$setSu, _this$
|
|
266
|
+
var _yield$this$obj$setSu, _this$obj8;
|
|
272
267
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
273
268
|
while (1) switch (_context3.prev = _context3.next) {
|
|
274
269
|
case 0:
|
|
275
270
|
_context3.next = 2;
|
|
276
|
-
return (_this$
|
|
271
|
+
return (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.setSubValue(key, objKey, subvalue);
|
|
277
272
|
case 2:
|
|
278
273
|
_context3.t1 = _yield$this$obj$setSu = _context3.sent;
|
|
279
274
|
_context3.t0 = _context3.t1 !== null;
|
|
@@ -310,12 +305,12 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
310
305
|
key: "pushValue",
|
|
311
306
|
value: function () {
|
|
312
307
|
var _pushValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, value) {
|
|
313
|
-
var _yield$this$obj$pushV, _this$
|
|
308
|
+
var _yield$this$obj$pushV, _this$obj9;
|
|
314
309
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
315
310
|
while (1) switch (_context4.prev = _context4.next) {
|
|
316
311
|
case 0:
|
|
317
312
|
_context4.next = 2;
|
|
318
|
-
return (_this$
|
|
313
|
+
return (_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.pushValue(key, value);
|
|
319
314
|
case 2:
|
|
320
315
|
_context4.t1 = _yield$this$obj$pushV = _context4.sent;
|
|
321
316
|
_context4.t0 = _context4.t1 !== null;
|
|
@@ -379,7 +374,7 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
379
374
|
key: "setObjectTemp",
|
|
380
375
|
value: function () {
|
|
381
376
|
var _setObjectTemp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key, value) {
|
|
382
|
-
var _yield$this$obj$setTe, _this$
|
|
377
|
+
var _yield$this$obj$setTe, _this$obj10;
|
|
383
378
|
var sendChanges,
|
|
384
379
|
_args6 = arguments;
|
|
385
380
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -387,7 +382,7 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
387
382
|
case 0:
|
|
388
383
|
sendChanges = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : false;
|
|
389
384
|
_context6.next = 3;
|
|
390
|
-
return (_this$
|
|
385
|
+
return (_this$obj10 = this.obj) === null || _this$obj10 === void 0 ? void 0 : _this$obj10.setTemp(key, value, sendChanges);
|
|
391
386
|
case 3:
|
|
392
387
|
_context6.t1 = _yield$this$obj$setTe = _context6.sent;
|
|
393
388
|
_context6.t0 = _context6.t1 !== null;
|
|
@@ -422,27 +417,27 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
422
417
|
}, {
|
|
423
418
|
key: "getObjectTemp",
|
|
424
419
|
value: function getObjectTemp(key) {
|
|
425
|
-
var _this$obj$getTemp, _this$
|
|
426
|
-
return (_this$obj$getTemp = (_this$
|
|
420
|
+
var _this$obj$getTemp, _this$obj11;
|
|
421
|
+
return (_this$obj$getTemp = (_this$obj11 = this.obj) === null || _this$obj11 === void 0 ? void 0 : _this$obj11.getTemp(key)) !== null && _this$obj$getTemp !== void 0 ? _this$obj$getTemp : undefined;
|
|
427
422
|
}
|
|
428
423
|
/* -------------------------------------------------------------------------- */
|
|
429
424
|
}, {
|
|
430
425
|
key: "getIndexOrID",
|
|
431
426
|
value: function getIndexOrID() {
|
|
432
|
-
var _this$
|
|
433
|
-
return ((_this$
|
|
427
|
+
var _this$obj12;
|
|
428
|
+
return ((_this$obj12 = this.obj) === null || _this$obj12 === void 0 ? void 0 : _this$obj12.getIndexOrID()) || -1;
|
|
434
429
|
}
|
|
435
430
|
}, {
|
|
436
431
|
key: "getIndex",
|
|
437
432
|
value: function getIndex() {
|
|
438
|
-
var _this$
|
|
439
|
-
return ((_this$
|
|
433
|
+
var _this$obj13;
|
|
434
|
+
return ((_this$obj13 = this.obj) === null || _this$obj13 === void 0 ? void 0 : _this$obj13.getIndex()) || -1;
|
|
440
435
|
}
|
|
441
436
|
}, {
|
|
442
437
|
key: "getID",
|
|
443
438
|
value: function getID() {
|
|
444
|
-
var _this$
|
|
445
|
-
return ((_this$
|
|
439
|
+
var _this$obj14;
|
|
440
|
+
return ((_this$obj14 = this.obj) === null || _this$obj14 === void 0 ? void 0 : _this$obj14.getID()) || "";
|
|
446
441
|
}
|
|
447
442
|
/* -------------------------------------------------------------------------- */
|
|
448
443
|
/* Events */
|
|
@@ -550,14 +545,14 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
550
545
|
}, {
|
|
551
546
|
key: "clear_changes",
|
|
552
547
|
value: function clear_changes() {
|
|
553
|
-
var _this$
|
|
554
|
-
return (_this$
|
|
548
|
+
var _this$obj15;
|
|
549
|
+
return (_this$obj15 = this.obj) === null || _this$obj15 === void 0 ? void 0 : _this$obj15.clear_changes();
|
|
555
550
|
}
|
|
556
551
|
}, {
|
|
557
552
|
key: "clear_cache",
|
|
558
553
|
value: function clear_cache() {
|
|
559
|
-
var _this$
|
|
560
|
-
return (_this$
|
|
554
|
+
var _this$obj16;
|
|
555
|
+
return (_this$obj16 = this.obj) === null || _this$obj16 === void 0 ? void 0 : _this$obj16.clear_cache();
|
|
561
556
|
}
|
|
562
557
|
}, {
|
|
563
558
|
key: "toggleOption",
|
|
@@ -9,7 +9,8 @@ export type WithManager<T extends SimpleObject> = Ensure<T, "manager">;
|
|
|
9
9
|
export type WithManagerOrNot<T extends SimpleObject> = T | WithManager<T>;
|
|
10
10
|
export declare class SimpleObject extends MapableObject {
|
|
11
11
|
#private;
|
|
12
|
-
static readonly
|
|
12
|
+
static readonly __db_name: string;
|
|
13
|
+
static readonly __object_name: string;
|
|
13
14
|
static readonly __unchangeables?: string[];
|
|
14
15
|
static readonly __changeables?: string[];
|
|
15
16
|
static readonly __protectedProperties?: string[];
|
|
@@ -189,6 +190,8 @@ export declare class SimpleObject extends MapableObject {
|
|
|
189
190
|
*/
|
|
190
191
|
static setReadonly(objs?: SimpleObject[] | SimpleObject, readonlyval?: boolean, clearChanges?: boolean): void;
|
|
191
192
|
static setThrowErrors(objs?: SimpleObject[] | SimpleObject, throwErr?: boolean): void;
|
|
193
|
+
get __object_name(): string;
|
|
194
|
+
get __db_name(): string;
|
|
192
195
|
get isChanged(): boolean;
|
|
193
196
|
get isArchived(): boolean;
|
|
194
197
|
set isArchived(v: boolean);
|
|
@@ -199,7 +202,6 @@ export declare class SimpleObject extends MapableObject {
|
|
|
199
202
|
get d(): Partial<this>;
|
|
200
203
|
get allproperties(): Partial<this>;
|
|
201
204
|
get canModify(): boolean;
|
|
202
|
-
get __cache_name(): string;
|
|
203
205
|
get __changeables(): string[];
|
|
204
206
|
get __unchangeables(): string[];
|
|
205
207
|
get __use_delta(): boolean;
|
|
@@ -815,11 +815,22 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
815
815
|
* @param clearChanges should we clean the changes after setting readonly
|
|
816
816
|
*/
|
|
817
817
|
}, {
|
|
818
|
-
key: "
|
|
818
|
+
key: "__object_name",
|
|
819
819
|
get: /* -------------------------------------------------------------------------- */
|
|
820
820
|
/* Get/Check */
|
|
821
821
|
/* -------------------------------------------------------------------------- */
|
|
822
822
|
function get() {
|
|
823
|
+
return this.constructor["__object_name"] || this.__db_name;
|
|
824
|
+
}
|
|
825
|
+
}, {
|
|
826
|
+
key: "__db_name",
|
|
827
|
+
get: function get() {
|
|
828
|
+
return this.constructor["__db_name"] || this.constructor["__web_path"];
|
|
829
|
+
}
|
|
830
|
+
/* -------------------------------------------------------------------------- */
|
|
831
|
+
}, {
|
|
832
|
+
key: "isChanged",
|
|
833
|
+
get: function get() {
|
|
823
834
|
var _this3 = this;
|
|
824
835
|
////const deltaIsBlank = object_isEmpty(this.__delta);
|
|
825
836
|
////if (!deltaIsBlank) return true; //delta is not blank, definitely changed
|
|
@@ -887,11 +898,6 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
887
898
|
get: function get() {
|
|
888
899
|
return !Boolean(this.__is_readonly);
|
|
889
900
|
}
|
|
890
|
-
}, {
|
|
891
|
-
key: "__cache_name",
|
|
892
|
-
get: function get() {
|
|
893
|
-
return this.constructor["__cache_name"];
|
|
894
|
-
}
|
|
895
901
|
}, {
|
|
896
902
|
key: "__changeables",
|
|
897
903
|
get: function get() {
|
|
@@ -1457,7 +1463,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1457
1463
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1458
1464
|
while (1) switch (_context17.prev = _context17.next) {
|
|
1459
1465
|
case 0:
|
|
1460
|
-
if (this.
|
|
1466
|
+
if (this.__db_name) {
|
|
1461
1467
|
_context17.next = 2;
|
|
1462
1468
|
break;
|
|
1463
1469
|
}
|
|
@@ -1468,12 +1474,12 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1468
1474
|
break;
|
|
1469
1475
|
}
|
|
1470
1476
|
_context17.next = 5;
|
|
1471
|
-
return _global.gcache.delete_session_cache(this.
|
|
1477
|
+
return _global.gcache.delete_session_cache(this.__db_name);
|
|
1472
1478
|
case 5:
|
|
1473
1479
|
_context17.next = 10;
|
|
1474
1480
|
break;
|
|
1475
1481
|
case 7:
|
|
1476
|
-
cacheKey = "".concat(this.
|
|
1482
|
+
cacheKey = "".concat(this.__db_name, "-").concat(context);
|
|
1477
1483
|
_context17.next = 10;
|
|
1478
1484
|
return _global.gcache.delete_session_cache(cacheKey);
|
|
1479
1485
|
case 10:
|
|
@@ -1569,7 +1575,8 @@ function _setSaveResultObject2(toObj) {
|
|
|
1569
1575
|
this.__saveResultObject = toObj;
|
|
1570
1576
|
return true;
|
|
1571
1577
|
}
|
|
1572
|
-
_defineProperty(SimpleObject, "
|
|
1578
|
+
_defineProperty(SimpleObject, "__db_name", "");
|
|
1579
|
+
_defineProperty(SimpleObject, "__object_name", "");
|
|
1573
1580
|
//these properties should not be changed and are usually set by server
|
|
1574
1581
|
_defineProperty(SimpleObject, "__unchangeables", void 0);
|
|
1575
1582
|
//these properties can be directly changed and are included in deltaObject
|