@azrico/webobject 1.5.56 → 1.5.58
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/package.json +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -16
- package/dist/src/WebObjects/ParentWebObject.d.ts +0 -24
- package/dist/src/WebObjects/ParentWebObject.js +0 -121
- package/dist/src/WebObjects/WebObject.d.ts +0 -153
- package/dist/src/WebObjects/WebObject.js +0 -1624
- package/dist/src/WebObjects/WebObjectHelper.d.ts +0 -9
- package/dist/src/WebObjects/WebObjectHelper.js +0 -38
- package/dist/src/WebObjects/WebObjectHelper.test.d.ts +0 -1
- package/dist/src/WebObjects/WebObjectHelper.test.js +0 -67
- package/dist/src/WebObjects/WebObjectManager.d.ts +0 -68
- package/dist/src/WebObjects/WebObjectManager.js +0 -889
- package/dist/src/WebObjects/WebObjectPathHelper.d.ts +0 -36
- package/dist/src/WebObjects/WebObjectPathHelper.js +0 -155
- package/dist/src/WebObjects/WebObjectPathHelper.test.d.ts +0 -1
- package/dist/src/WebObjects/WebObjectPathHelper.test.js +0 -122
- package/dist/src/index.d.ts +0 -10
- package/dist/src/index.js +0 -115
- package/dist/src/structs/DummyObject.d.ts +0 -5
- package/dist/src/structs/DummyObject.js +0 -32
- package/dist/src/structs/MapableObject.d.ts +0 -43
- package/dist/src/structs/MapableObject.js +0 -123
- package/dist/src/structs/MetaObject.d.ts +0 -15
- package/dist/src/structs/MetaObject.js +0 -121
- package/dist/src/structs/ObjectArray.d.ts +0 -10
- package/dist/src/structs/ObjectArray.js +0 -68
- package/dist/src/structs/ObjectManager.d.ts +0 -135
- package/dist/src/structs/ObjectManager.js +0 -790
- package/dist/src/structs/ObjectWithTemp.d.ts +0 -11
- package/dist/src/structs/ObjectWithTemp.js +0 -66
- package/dist/src/structs/SimpleObject.d.ts +0 -305
- package/dist/src/structs/SimpleObject.js +0 -1750
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This object supports temp values
|
|
3
|
-
*/
|
|
4
|
-
export declare class ObjectWithTemp {
|
|
5
|
-
#private;
|
|
6
|
-
protected __temp: any;
|
|
7
|
-
constructor();
|
|
8
|
-
getTemp: (key: string) => any;
|
|
9
|
-
setTemp(key: string, value: any): Promise<boolean>;
|
|
10
|
-
}
|
|
11
|
-
export default ObjectWithTemp;
|
|
@@ -1,66 +0,0 @@
|
|
|
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.ObjectWithTemp = void 0;
|
|
8
|
-
var _object = require("@azrico/object");
|
|
9
|
-
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 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 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 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; }
|
|
10
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
11
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
12
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
13
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
14
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
15
|
-
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
16
|
-
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
17
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
-
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
21
|
-
/**
|
|
22
|
-
* This object supports temp values
|
|
23
|
-
*/
|
|
24
|
-
var _ObjectWithTemp_brand = /*#__PURE__*/new WeakSet();
|
|
25
|
-
var ObjectWithTemp = exports.ObjectWithTemp = /*#__PURE__*/function () {
|
|
26
|
-
function ObjectWithTemp() {
|
|
27
|
-
_classCallCheck(this, ObjectWithTemp);
|
|
28
|
-
/* ---------------------------------- temp ---------------------------------- */
|
|
29
|
-
_classPrivateMethodInitSpec(this, _ObjectWithTemp_brand);
|
|
30
|
-
_defineProperty(this, "__temp", undefined);
|
|
31
|
-
_defineProperty(this, "getTemp", _assertClassBrand(_ObjectWithTemp_brand, this, _getTempProperty));
|
|
32
|
-
}
|
|
33
|
-
return _createClass(ObjectWithTemp, [{
|
|
34
|
-
key: "setTemp",
|
|
35
|
-
value: function () {
|
|
36
|
-
var _setTemp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
|
|
37
|
-
var isValueChanged;
|
|
38
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
39
|
-
while (1) switch (_context.prev = _context.next) {
|
|
40
|
-
case 0:
|
|
41
|
-
isValueChanged = false;
|
|
42
|
-
isValueChanged = _assertClassBrand(_ObjectWithTemp_brand, this, _getTempProperty).call(this, key) != value;
|
|
43
|
-
_assertClassBrand(_ObjectWithTemp_brand, this, _setTempProperty).call(this, key, value);
|
|
44
|
-
return _context.abrupt("return", isValueChanged);
|
|
45
|
-
case 4:
|
|
46
|
-
case "end":
|
|
47
|
-
return _context.stop();
|
|
48
|
-
}
|
|
49
|
-
}, _callee, this);
|
|
50
|
-
}));
|
|
51
|
-
function setTemp(_x, _x2) {
|
|
52
|
-
return _setTemp.apply(this, arguments);
|
|
53
|
-
}
|
|
54
|
-
return setTemp;
|
|
55
|
-
}()
|
|
56
|
-
}]);
|
|
57
|
-
}();
|
|
58
|
-
function _getTempProperty(key) {
|
|
59
|
-
if (this.__temp == null) return undefined;
|
|
60
|
-
return (0, _object.object_get)(this.__temp, key);
|
|
61
|
-
}
|
|
62
|
-
function _setTempProperty(key, value) {
|
|
63
|
-
if (this.__temp == null) this.__temp = {};
|
|
64
|
-
return (0, _object.object_set)(this.__temp, key, value);
|
|
65
|
-
}
|
|
66
|
-
var _default = exports["default"] = ObjectWithTemp;
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { PropType, WriteablePropOf, PropOf, Ensure, PropPrefixedOf, PropOnlyPrefixedOf } from "@azrico/types";
|
|
2
|
-
import { formatObject } from "@azrico/convert";
|
|
3
|
-
import { MapableObject } from "./MapableObject";
|
|
4
|
-
import ObjectManager from "./ObjectManager";
|
|
5
|
-
export type saveResultType = "normal" | "nothing" | "error" | "canceled";
|
|
6
|
-
export type saveType = "normal" | "quick";
|
|
7
|
-
export type sendChangesType = boolean | "auto";
|
|
8
|
-
export type WithManager<T extends SimpleObject> = Ensure<T, "manager">;
|
|
9
|
-
export type WithManagerOrNot<T extends SimpleObject> = T | WithManager<T>;
|
|
10
|
-
export type deltaParams = {
|
|
11
|
-
type?: string;
|
|
12
|
-
useDelta?: boolean;
|
|
13
|
-
isChild?: boolean;
|
|
14
|
-
changeableKeys?: string[];
|
|
15
|
-
allProperties?: boolean;
|
|
16
|
-
extraProperties?: boolean;
|
|
17
|
-
tempProperties?: boolean;
|
|
18
|
-
bypassProtected?: boolean;
|
|
19
|
-
needId?: boolean;
|
|
20
|
-
clean?: boolean;
|
|
21
|
-
applyFilter?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export declare class SimpleObject extends MapableObject {
|
|
24
|
-
#private;
|
|
25
|
-
static readonly __db_name: string;
|
|
26
|
-
static readonly __object_name: string;
|
|
27
|
-
static readonly __unchangeables: string[];
|
|
28
|
-
static readonly __changeables: string[];
|
|
29
|
-
static readonly __extraProperties: string[];
|
|
30
|
-
static readonly __tempProperties: string[];
|
|
31
|
-
static readonly __protectedProperties: string[];
|
|
32
|
-
static readonly __functionProperties: string[];
|
|
33
|
-
static readonly __formatList?: formatObject;
|
|
34
|
-
static readonly __childTypes?: any[];
|
|
35
|
-
static readonly __importColumns?: string[];
|
|
36
|
-
static readonly __checkProperties: string[];
|
|
37
|
-
static readonly __use_delta: boolean;
|
|
38
|
-
_static(): Function;
|
|
39
|
-
protected __originalobject?: this;
|
|
40
|
-
protected __delta: Partial<this>;
|
|
41
|
-
protected __lastChanged?: string;
|
|
42
|
-
protected __is_readonly?: boolean;
|
|
43
|
-
protected __throw_errors?: boolean;
|
|
44
|
-
_deleted?: boolean;
|
|
45
|
-
_archived?: boolean;
|
|
46
|
-
_deletedBy?: string;
|
|
47
|
-
_locked?: boolean;
|
|
48
|
-
protected __errors?: any[];
|
|
49
|
-
protected __showErrors?: boolean;
|
|
50
|
-
protected __refresh_functions?: {
|
|
51
|
-
[key: string]: any;
|
|
52
|
-
};
|
|
53
|
-
protected __saveResultObject?: any;
|
|
54
|
-
protected __saveResultIsSuccess: boolean;
|
|
55
|
-
protected __saveResultType?: saveResultType;
|
|
56
|
-
readonly __initialized?: boolean;
|
|
57
|
-
_id: string;
|
|
58
|
-
_index_key: string;
|
|
59
|
-
_index_value: number;
|
|
60
|
-
constructor(is_readonly?: boolean);
|
|
61
|
-
init(): void;
|
|
62
|
-
get<MKey extends PropOf<this>>(key: MKey, original?: boolean): PropType<this, MKey>;
|
|
63
|
-
get<MKey extends PropOnlyPrefixedOf<this>>(key: MKey, original?: boolean): any;
|
|
64
|
-
/**
|
|
65
|
-
* static get method for SimpleObject
|
|
66
|
-
* @param obj
|
|
67
|
-
* @param key
|
|
68
|
-
* @param original
|
|
69
|
-
* @returns
|
|
70
|
-
*/
|
|
71
|
-
static get<T extends SimpleObject, MKey extends PropOf<T>>(obj: T, key: MKey, original?: boolean): PropType<T, MKey> | undefined;
|
|
72
|
-
getSubValue: (key: PropOf<this>, subkey: string, original?: boolean) => any;
|
|
73
|
-
/**
|
|
74
|
-
* set value and run the event handlers if needed
|
|
75
|
-
* @param key
|
|
76
|
-
* @param value
|
|
77
|
-
* @param shouldNotify
|
|
78
|
-
* @param autoApply if the field is not in delta, instantly calls the `apply` function to remove from delta
|
|
79
|
-
* @returns
|
|
80
|
-
*/
|
|
81
|
-
set<MKey extends PropPrefixedOf<this>>(key: MKey, value: any, shouldNotify?: sendChangesType, autoApply?: boolean): Promise<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated use `set`
|
|
84
|
-
* set value and run the event handlers if needed
|
|
85
|
-
* @return true if changed , false otherwise
|
|
86
|
-
*/
|
|
87
|
-
setValue: <MKey extends PropPrefixedOf<this>>(key: MKey, value: any, shouldNotify?: sendChangesType, autoApply?: boolean) => Promise<boolean>;
|
|
88
|
-
/**
|
|
89
|
-
* set value and run the event handlers if needed
|
|
90
|
-
*
|
|
91
|
-
* if the field is not in delta instantly calls the `apply` function to remove from delta
|
|
92
|
-
* @param key
|
|
93
|
-
* @param value
|
|
94
|
-
*/
|
|
95
|
-
setPreferApply(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType): Promise<boolean>;
|
|
96
|
-
/**
|
|
97
|
-
* set key of subObject
|
|
98
|
-
* @param key
|
|
99
|
-
* @param value
|
|
100
|
-
* @param subvalue
|
|
101
|
-
* @param sendChanges
|
|
102
|
-
* @return true if changed , false otherwise
|
|
103
|
-
*/
|
|
104
|
-
setSubValue<MKey extends PropOf<this>>(key: MKey, objKey: string, subvalue: any, sendChanges?: sendChangesType): Promise<boolean>;
|
|
105
|
-
setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* load all properties in `initObject` into the current object
|
|
108
|
-
* @param initObject
|
|
109
|
-
* @param fullUpdate
|
|
110
|
-
* @returns
|
|
111
|
-
*/
|
|
112
|
-
loadValues(initObject: any, fullUpdate?: boolean): boolean;
|
|
113
|
-
static loadValues(obj: SimpleObject, initObject: any, fullUpdate?: boolean): boolean;
|
|
114
|
-
clearRefreshFunction(): Promise<void>;
|
|
115
|
-
setRefreshFunction(new_fnc: any): Promise<any>;
|
|
116
|
-
addRefreshFunction(new_fnc: any): any;
|
|
117
|
-
runRefreshFunction(...params: any): Promise<void>;
|
|
118
|
-
/**
|
|
119
|
-
* calls `set` function for all props of `setObj`
|
|
120
|
-
* @param setObj
|
|
121
|
-
* @param changeablesOnly only updates the `__changeables` fields
|
|
122
|
-
* @returns
|
|
123
|
-
*/
|
|
124
|
-
setAll<K extends WriteablePropOf<this>>(setObj: Partial<{
|
|
125
|
-
[key in K]: any;
|
|
126
|
-
}>, changeablesOnly?: boolean): Promise<boolean>;
|
|
127
|
-
/**
|
|
128
|
-
* set value of a key only if the value is empty (null,undef,"")
|
|
129
|
-
* @param key
|
|
130
|
-
* @param value
|
|
131
|
-
* @returns
|
|
132
|
-
*/
|
|
133
|
-
setDefaultValue(key: WriteablePropOf<this>, value: any): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* set value of a key to now date time
|
|
136
|
-
* @param key
|
|
137
|
-
* @param value
|
|
138
|
-
* @returns
|
|
139
|
-
*/
|
|
140
|
-
setDefaultValueNow: (key: PropOf<this>) => boolean;
|
|
141
|
-
/**
|
|
142
|
-
* set value of a key only if the value is empty (null,undef,"")
|
|
143
|
-
* @param key
|
|
144
|
-
* @param value
|
|
145
|
-
* @returns
|
|
146
|
-
*/
|
|
147
|
-
setDefault: (key: WriteablePropOf<this>, value: any) => boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Push a single value to array property
|
|
150
|
-
* @param key
|
|
151
|
-
* @param value
|
|
152
|
-
* @param sendChanges
|
|
153
|
-
* @returns
|
|
154
|
-
*/
|
|
155
|
-
pushValue<MKey extends PropOf<this>>(key: MKey, value: any, sendChanges?: sendChangesType): Promise<this[MKey] | false>;
|
|
156
|
-
/**
|
|
157
|
-
* Push a list of values to array property
|
|
158
|
-
* @param key
|
|
159
|
-
* @param values
|
|
160
|
-
* @param sendChanges
|
|
161
|
-
* @returns
|
|
162
|
-
*/
|
|
163
|
-
pushValues<MKey extends PropOf<this>>(key: MKey, values: any[], sendChanges?: sendChangesType): Promise<this[MKey] | false>;
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* @param type
|
|
167
|
-
* @param key
|
|
168
|
-
* @param value
|
|
169
|
-
* @param subvalue
|
|
170
|
-
* @returns true if manager was notified. false otherwise
|
|
171
|
-
*/
|
|
172
|
-
notifyChanged<MKey extends PropOf<this>>(type: string, key: MKey | string, value: any, subvalue?: any): Promise<false | any[] | undefined>;
|
|
173
|
-
/**
|
|
174
|
-
* get a list of all keys that can be changed in given objcet
|
|
175
|
-
* @param object
|
|
176
|
-
* @param options
|
|
177
|
-
* @returns
|
|
178
|
-
*/
|
|
179
|
-
static getChangeableKeys(object: SimpleObject, options: deltaParams): any[];
|
|
180
|
-
/**
|
|
181
|
-
* check if a key can be changed on an object
|
|
182
|
-
* @param object the object we are checking
|
|
183
|
-
* @param key key of the object
|
|
184
|
-
* @param useExtraProps should we check extra props?
|
|
185
|
-
* @returns
|
|
186
|
-
*/
|
|
187
|
-
static canChangeKey(object: SimpleObject, key: string, options: deltaParams): boolean;
|
|
188
|
-
static hasIllegalChanges(referenceObject: any, changesObject: any, updaterUser: any): boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Apply all the changes and empty the delta object
|
|
191
|
-
*/
|
|
192
|
-
apply_changes(): boolean;
|
|
193
|
-
/**
|
|
194
|
-
* apply changes for the given fields
|
|
195
|
-
* @param key
|
|
196
|
-
* @returns
|
|
197
|
-
*/
|
|
198
|
-
apply(keylist: PropOf<this> | Array<PropOf<this>>): boolean;
|
|
199
|
-
/**
|
|
200
|
-
* set the value to its original
|
|
201
|
-
* @param key
|
|
202
|
-
*/
|
|
203
|
-
discard(key: WriteablePropOf<this>, shouldNotify?: sendChangesType): Promise<boolean>;
|
|
204
|
-
/**
|
|
205
|
-
* reset all values back to their original
|
|
206
|
-
*
|
|
207
|
-
* this function also calls `on_change` and then `clear_changes`
|
|
208
|
-
* @param key
|
|
209
|
-
*/
|
|
210
|
-
discardAll(shouldNotify?: sendChangesType): Promise<boolean>;
|
|
211
|
-
/**
|
|
212
|
-
* clear and discard all changes
|
|
213
|
-
*
|
|
214
|
-
* does not call `on_change` functions
|
|
215
|
-
* @returns
|
|
216
|
-
*/
|
|
217
|
-
clear_changes(): boolean;
|
|
218
|
-
/**
|
|
219
|
-
* clear and discard all temp values
|
|
220
|
-
* @returns
|
|
221
|
-
*/
|
|
222
|
-
clear_cache(): boolean;
|
|
223
|
-
/**
|
|
224
|
-
* Sets readonly property on given objects
|
|
225
|
-
* @param objs array of given objects or a single object
|
|
226
|
-
* @param readonlyval readonly
|
|
227
|
-
* @param clearChanges should we clean the changes after setting readonly
|
|
228
|
-
*/
|
|
229
|
-
static setReadonly(objs?: SimpleObject[] | SimpleObject, readonlyval?: boolean, clearChanges?: boolean): void;
|
|
230
|
-
static setThrowErrors(objs?: SimpleObject[] | SimpleObject, throwErr?: boolean): void;
|
|
231
|
-
get __object_name(): string;
|
|
232
|
-
get __db_name(): string;
|
|
233
|
-
get isChanged(): boolean;
|
|
234
|
-
get isArchived(): boolean;
|
|
235
|
-
set isArchived(v: boolean);
|
|
236
|
-
get isDeleted(): boolean;
|
|
237
|
-
get isLocked(): boolean;
|
|
238
|
-
get objectColor(): string;
|
|
239
|
-
set isLocked(v: boolean);
|
|
240
|
-
set isDeleted(v: boolean);
|
|
241
|
-
get d(): Partial<this>;
|
|
242
|
-
get allproperties(): Partial<this>;
|
|
243
|
-
get canModify(): boolean;
|
|
244
|
-
get __changeables(): string[];
|
|
245
|
-
get __unchangeables(): string[];
|
|
246
|
-
get __use_delta(): boolean;
|
|
247
|
-
get isSaved(): boolean;
|
|
248
|
-
get isNew(): boolean;
|
|
249
|
-
get lastChanged(): string;
|
|
250
|
-
get manager(): ObjectManager<any> | undefined;
|
|
251
|
-
get_managerClass: () => ObjectManager<any> | undefined;
|
|
252
|
-
/**
|
|
253
|
-
* @deprecated use setManager
|
|
254
|
-
* @param mng
|
|
255
|
-
*/
|
|
256
|
-
set_managerClass(mng: any): boolean | undefined;
|
|
257
|
-
/**
|
|
258
|
-
* update the manager class for this object
|
|
259
|
-
* @param mng
|
|
260
|
-
*/
|
|
261
|
-
setManager(mng: any): boolean | undefined;
|
|
262
|
-
static isDeleted<T extends SimpleObject>(obj: T): boolean;
|
|
263
|
-
getIndexOrID(): number | string;
|
|
264
|
-
getIndex(): number;
|
|
265
|
-
getID(): string;
|
|
266
|
-
static getIndexOrID(o: any): number;
|
|
267
|
-
static getIndex(o: any): number;
|
|
268
|
-
static getID(obj: any): string;
|
|
269
|
-
event_run(eventName: string, ...params: any): Promise<any[] | undefined>;
|
|
270
|
-
event_use(name: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): any;
|
|
271
|
-
event_remove(name: string, uname: string): boolean | undefined;
|
|
272
|
-
event_add(name: string, uname: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): Promise<void>;
|
|
273
|
-
getOriginal(): this | undefined;
|
|
274
|
-
setOriginal(toObj?: null | 0 | any): this | undefined;
|
|
275
|
-
static setOriginal<T>(obj: T, toObj?: null | 0 | any): T | undefined;
|
|
276
|
-
static getOriginal<T extends SimpleObject>(obj: T): T | undefined;
|
|
277
|
-
addError(title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
|
|
278
|
-
clearErrors(): boolean;
|
|
279
|
-
getErrors(): any[];
|
|
280
|
-
static addError(o?: SimpleObject, title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
|
|
281
|
-
static getErrors(o: SimpleObject): any[];
|
|
282
|
-
static clearErrors(o: SimpleObject): boolean;
|
|
283
|
-
/**
|
|
284
|
-
* Checks if the given object is a valid and truthy save result
|
|
285
|
-
* @param result_object
|
|
286
|
-
* @returns
|
|
287
|
-
*/
|
|
288
|
-
static isResultValid(result_object: any, depth?: number): boolean;
|
|
289
|
-
/**
|
|
290
|
-
* set the response of last save from site
|
|
291
|
-
* and its type
|
|
292
|
-
* @param toObj
|
|
293
|
-
*/
|
|
294
|
-
setSaveResult(toObj: any, type?: saveResultType | "auto", registerErrors?: boolean): saveResultType;
|
|
295
|
-
getSaveResult(original?: boolean): any;
|
|
296
|
-
getSaveResultType(): saveResultType;
|
|
297
|
-
/** did we create on the last save */
|
|
298
|
-
getIsLastSaveCreate(): boolean;
|
|
299
|
-
static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<boolean | undefined>;
|
|
300
|
-
static factoryClear(obj: SimpleObject): void;
|
|
301
|
-
static delete_cache(context?: string): Promise<void>;
|
|
302
|
-
static get_canModify(o: SimpleObject): boolean;
|
|
303
|
-
static equals(a?: SimpleObject | any, b?: SimpleObject | any): boolean;
|
|
304
|
-
}
|
|
305
|
-
export default SimpleObject;
|