@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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +0 -16
  4. package/dist/src/WebObjects/ParentWebObject.d.ts +0 -24
  5. package/dist/src/WebObjects/ParentWebObject.js +0 -121
  6. package/dist/src/WebObjects/WebObject.d.ts +0 -153
  7. package/dist/src/WebObjects/WebObject.js +0 -1624
  8. package/dist/src/WebObjects/WebObjectHelper.d.ts +0 -9
  9. package/dist/src/WebObjects/WebObjectHelper.js +0 -38
  10. package/dist/src/WebObjects/WebObjectHelper.test.d.ts +0 -1
  11. package/dist/src/WebObjects/WebObjectHelper.test.js +0 -67
  12. package/dist/src/WebObjects/WebObjectManager.d.ts +0 -68
  13. package/dist/src/WebObjects/WebObjectManager.js +0 -889
  14. package/dist/src/WebObjects/WebObjectPathHelper.d.ts +0 -36
  15. package/dist/src/WebObjects/WebObjectPathHelper.js +0 -155
  16. package/dist/src/WebObjects/WebObjectPathHelper.test.d.ts +0 -1
  17. package/dist/src/WebObjects/WebObjectPathHelper.test.js +0 -122
  18. package/dist/src/index.d.ts +0 -10
  19. package/dist/src/index.js +0 -115
  20. package/dist/src/structs/DummyObject.d.ts +0 -5
  21. package/dist/src/structs/DummyObject.js +0 -32
  22. package/dist/src/structs/MapableObject.d.ts +0 -43
  23. package/dist/src/structs/MapableObject.js +0 -123
  24. package/dist/src/structs/MetaObject.d.ts +0 -15
  25. package/dist/src/structs/MetaObject.js +0 -121
  26. package/dist/src/structs/ObjectArray.d.ts +0 -10
  27. package/dist/src/structs/ObjectArray.js +0 -68
  28. package/dist/src/structs/ObjectManager.d.ts +0 -135
  29. package/dist/src/structs/ObjectManager.js +0 -790
  30. package/dist/src/structs/ObjectWithTemp.d.ts +0 -11
  31. package/dist/src/structs/ObjectWithTemp.js +0 -66
  32. package/dist/src/structs/SimpleObject.d.ts +0 -305
  33. package/dist/src/structs/SimpleObject.js +0 -1750
@@ -1,36 +0,0 @@
1
- import { AnyClassType } from "@azrico/types";
2
- import WebObject from "./WebObject";
3
- type PathFunction<T extends AnyClassType> = string | ((w: InstanceType<T>) => string);
4
- export declare class WebObjectPathHelper {
5
- static readonly defaultPaths: {
6
- lock: string;
7
- unlock: string;
8
- archive: string;
9
- unarchive: string;
10
- delete: string;
11
- new: string;
12
- save: string;
13
- get: string;
14
- };
15
- static readonly pathOverrides: {};
16
- /**
17
- * get path that we use for `action` for the `obj`
18
- * @param obj
19
- * @param action
20
- * @returns
21
- */
22
- static get_path<T extends WebObject | typeof WebObject>(obj: T, action: string): Promise<string>;
23
- /**
24
- * clear all paths that are override by `override_path`
25
- */
26
- static clear_overrides(): Promise<void>;
27
- /**
28
- * override a save path for the gievn webobject
29
- * @param obj
30
- * @param pn
31
- * @param override
32
- * @returns
33
- */
34
- static override_path<T extends AnyClassType>(obj: T | InstanceType<T> | string, pn: string, override: PathFunction<T>): Promise<false | PathFunction<T>>;
35
- }
36
- export default WebObjectPathHelper;
@@ -1,155 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.WebObjectPathHelper = void 0;
7
- var _WebObject = _interopRequireDefault(require("./WebObject"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
- 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); }
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw 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; }
11
- 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); }
12
- 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); }); }; }
13
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
- 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); } }
15
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
- 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; }
17
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
- 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); }
19
- var WebObjectPathHelper = exports.WebObjectPathHelper = /*#__PURE__*/function () {
20
- function WebObjectPathHelper() {
21
- _classCallCheck(this, WebObjectPathHelper);
22
- }
23
- return _createClass(WebObjectPathHelper, null, [{
24
- key: "get_path",
25
- value: (
26
- /**
27
- * get path that we use for `action` for the `obj`
28
- * @param obj
29
- * @param action
30
- * @returns
31
- */
32
- function () {
33
- var _get_path = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(obj, action) {
34
- var wn, wp, usepath;
35
- return _regeneratorRuntime().wrap(function _callee$(_context) {
36
- while (1) switch (_context.prev = _context.next) {
37
- case 0:
38
- action = String(action).toLowerCase();
39
- wn = obj.get_webpath();
40
- wp = obj.__web_path;
41
- usepath = "";
42
- if (WebObjectPathHelper.pathOverrides[wn] && WebObjectPathHelper.pathOverrides[wn][action]) {
43
- usepath = WebObjectPathHelper.pathOverrides[wn][action];
44
- } else {
45
- usepath = WebObjectPathHelper.defaultPaths[action];
46
- }
47
- if (!usepath) usepath = WebObjectPathHelper.defaultPaths["save"];
48
- if (typeof usepath === "function") usepath = String(usepath(obj));
49
- /* ----------------------------- place variables ---------------------------- */
50
- usepath = String(usepath).replaceAll("{wn}", wn).replaceAll("{wp}", wp);
51
- if (obj instanceof _WebObject["default"]) {
52
- usepath = usepath.replaceAll("{id}", obj.getID());
53
- }
54
- /* -------------------------------------------------------------------------- */
55
- return _context.abrupt("return", usepath);
56
- case 10:
57
- case "end":
58
- return _context.stop();
59
- }
60
- }, _callee);
61
- }));
62
- function get_path(_x, _x2) {
63
- return _get_path.apply(this, arguments);
64
- }
65
- return get_path;
66
- }()
67
- /**
68
- * clear all paths that are override by `override_path`
69
- */
70
- )
71
- }, {
72
- key: "clear_overrides",
73
- value: (function () {
74
- var _clear_overrides = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
75
- var key;
76
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
77
- while (1) switch (_context2.prev = _context2.next) {
78
- case 0:
79
- for (key in this.pathOverrides) {
80
- this.pathOverrides[key] = {};
81
- }
82
- case 1:
83
- case "end":
84
- return _context2.stop();
85
- }
86
- }, _callee2, this);
87
- }));
88
- function clear_overrides() {
89
- return _clear_overrides.apply(this, arguments);
90
- }
91
- return clear_overrides;
92
- }()
93
- /**
94
- * override a save path for the gievn webobject
95
- * @param obj
96
- * @param pn
97
- * @param override
98
- * @returns
99
- */
100
- )
101
- }, {
102
- key: "override_path",
103
- value: (function () {
104
- var _override_path = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(obj, pn, override) {
105
- var wn;
106
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
107
- while (1) switch (_context3.prev = _context3.next) {
108
- case 0:
109
- pn = String(pn).toLowerCase();
110
- wn = "";
111
- /* ------------------------------ find webname ------------------------------ */
112
- if (typeof obj === "string") {
113
- wn = obj;
114
- } else if (typeof obj.get_webpath === "function") {
115
- wn = obj.get_webpath();
116
- } else {
117
- console.error("[override_path]", "given object has no get_webpath");
118
- wn = obj.__web_path || obj.__web_type;
119
- }
120
- if (wn) {
121
- _context3.next = 6;
122
- break;
123
- }
124
- console.error("[override_path]", "bad webname");
125
- return _context3.abrupt("return", false);
126
- case 6:
127
- /* --------------------------- apply the override --------------------------- */
128
- if (!WebObjectPathHelper.pathOverrides[wn]) WebObjectPathHelper.pathOverrides[wn] = {};
129
- WebObjectPathHelper.pathOverrides[wn][pn] = override;
130
- return _context3.abrupt("return", override);
131
- case 9:
132
- case "end":
133
- return _context3.stop();
134
- }
135
- }, _callee3);
136
- }));
137
- function override_path(_x3, _x4, _x5) {
138
- return _override_path.apply(this, arguments);
139
- }
140
- return override_path;
141
- }())
142
- }]);
143
- }();
144
- _defineProperty(WebObjectPathHelper, "defaultPaths", {
145
- lock: "{wn}/{id}/lock",
146
- unlock: "{wn}/{id}/unlock",
147
- archive: "{wn}/{id}/archive",
148
- unarchive: "{wn}/{id}/unarchive",
149
- "delete": "{wn}/{id}",
150
- "new": "{wn}",
151
- save: "{wn}/{id}",
152
- get: "{wn}"
153
- });
154
- _defineProperty(WebObjectPathHelper, "pathOverrides", {});
155
- var _default = exports["default"] = WebObjectPathHelper;
@@ -1 +0,0 @@
1
- export {};
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- var _index = require("../index");
4
- var _WebObjectPathHelper = _interopRequireDefault(require("./WebObjectPathHelper"));
5
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
6
- 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); }
7
- 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; }
8
- 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); }
9
- 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); }); }; }
10
- 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); } }
11
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
12
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
13
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
14
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
15
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
16
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
17
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
18
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
19
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
20
- 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; }
21
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
- 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); }
23
- var TestWebObject = /*#__PURE__*/function (_WebObject) {
24
- function TestWebObject() {
25
- _classCallCheck(this, TestWebObject);
26
- return _callSuper(this, TestWebObject, arguments);
27
- }
28
- _inherits(TestWebObject, _WebObject);
29
- return _createClass(TestWebObject);
30
- }(_index.WebObject);
31
- _defineProperty(TestWebObject, "__web_path", "test-wp");
32
- describe("WebObjectPathHelper", function () {
33
- var wobj;
34
- beforeEach(function () {
35
- _WebObjectPathHelper["default"].clear_overrides();
36
- wobj = new TestWebObject();
37
- wobj._id = "test";
38
- });
39
- it("get_path", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
40
- return _regeneratorRuntime().wrap(function _callee$(_context) {
41
- while (1) switch (_context.prev = _context.next) {
42
- case 0:
43
- _context.t0 = expect;
44
- _context.next = 3;
45
- return _WebObjectPathHelper["default"].get_path(wobj, "save");
46
- case 3:
47
- _context.t1 = _context.sent;
48
- (0, _context.t0)(_context.t1).toBe(wobj.get_webpath() + "/" + wobj.getID());
49
- _context.t2 = expect;
50
- _context.next = 8;
51
- return _WebObjectPathHelper["default"].get_path(wobj, "new");
52
- case 8:
53
- _context.t3 = _context.sent;
54
- (0, _context.t2)(_context.t3).toBe(wobj.get_webpath());
55
- _context.t4 = expect;
56
- _context.next = 13;
57
- return _WebObjectPathHelper["default"].get_path(wobj, "lock");
58
- case 13:
59
- _context.t5 = _context.sent;
60
- (0, _context.t4)(_context.t5).toBe("".concat(wobj.get_webpath(), "/").concat(wobj.getID(), "/lock"));
61
- case 15:
62
- case "end":
63
- return _context.stop();
64
- }
65
- }, _callee);
66
- })));
67
- it("override_path", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
68
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
69
- while (1) switch (_context2.prev = _context2.next) {
70
- case 0:
71
- _context2.next = 2;
72
- return _WebObjectPathHelper["default"].override_path(wobj.get_webpath(), "save", "blah");
73
- case 2:
74
- _context2.t0 = expect;
75
- _context2.next = 5;
76
- return _WebObjectPathHelper["default"].get_path(wobj, "save");
77
- case 5:
78
- _context2.t1 = _context2.sent;
79
- (0, _context2.t0)(_context2.t1).toBe("blah");
80
- _context2.next = 9;
81
- return _WebObjectPathHelper["default"].override_path(wobj.get_webpath(), "save", "{id}");
82
- case 9:
83
- _context2.t2 = expect;
84
- _context2.next = 12;
85
- return _WebObjectPathHelper["default"].get_path(wobj, "save");
86
- case 12:
87
- _context2.t3 = _context2.sent;
88
- (0, _context2.t2)(_context2.t3).toBe(wobj.getID());
89
- _context2.t4 = expect;
90
- _context2.next = 17;
91
- return _WebObjectPathHelper["default"].get_path(wobj, "new");
92
- case 17:
93
- _context2.t5 = _context2.sent;
94
- (0, _context2.t4)(_context2.t5).toBe(wobj.get_webpath());
95
- case 19:
96
- case "end":
97
- return _context2.stop();
98
- }
99
- }, _callee2);
100
- })));
101
- it("override_path with function", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
102
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
103
- while (1) switch (_context3.prev = _context3.next) {
104
- case 0:
105
- _context3.next = 2;
106
- return _WebObjectPathHelper["default"].override_path(wobj, "save", function (s) {
107
- return s._id;
108
- });
109
- case 2:
110
- _context3.t0 = expect;
111
- _context3.next = 5;
112
- return _WebObjectPathHelper["default"].get_path(wobj, "save");
113
- case 5:
114
- _context3.t1 = _context3.sent;
115
- (0, _context3.t0)(_context3.t1).toBe(wobj.getID());
116
- case 7:
117
- case "end":
118
- return _context3.stop();
119
- }
120
- }, _callee3);
121
- })));
122
- });
@@ -1,10 +0,0 @@
1
- export * from "./structs/SimpleObject";
2
- export * from "./structs/ObjectArray";
3
- export * from "./structs/MapableObject";
4
- export * from "./structs/MetaObject";
5
- export * from "./structs/DummyObject";
6
- export * from "./structs/ObjectManager";
7
- export * from "./WebObjects/WebObjectManager";
8
- export * from "./WebObjects/WebObject";
9
- export * from "./WebObjects/WebObjectPathHelper";
10
- export * from "./WebObjects/ParentWebObject";
package/dist/src/index.js DELETED
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _SimpleObject = require("./structs/SimpleObject");
7
- Object.keys(_SimpleObject).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _SimpleObject[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _SimpleObject[key];
14
- }
15
- });
16
- });
17
- var _ObjectArray = require("./structs/ObjectArray");
18
- Object.keys(_ObjectArray).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _ObjectArray[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _ObjectArray[key];
25
- }
26
- });
27
- });
28
- var _MapableObject = require("./structs/MapableObject");
29
- Object.keys(_MapableObject).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _MapableObject[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function get() {
35
- return _MapableObject[key];
36
- }
37
- });
38
- });
39
- var _MetaObject = require("./structs/MetaObject");
40
- Object.keys(_MetaObject).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _MetaObject[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function get() {
46
- return _MetaObject[key];
47
- }
48
- });
49
- });
50
- var _DummyObject = require("./structs/DummyObject");
51
- Object.keys(_DummyObject).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _DummyObject[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function get() {
57
- return _DummyObject[key];
58
- }
59
- });
60
- });
61
- var _ObjectManager = require("./structs/ObjectManager");
62
- Object.keys(_ObjectManager).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _ObjectManager[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function get() {
68
- return _ObjectManager[key];
69
- }
70
- });
71
- });
72
- var _WebObjectManager = require("./WebObjects/WebObjectManager");
73
- Object.keys(_WebObjectManager).forEach(function (key) {
74
- if (key === "default" || key === "__esModule") return;
75
- if (key in exports && exports[key] === _WebObjectManager[key]) return;
76
- Object.defineProperty(exports, key, {
77
- enumerable: true,
78
- get: function get() {
79
- return _WebObjectManager[key];
80
- }
81
- });
82
- });
83
- var _WebObject = require("./WebObjects/WebObject");
84
- Object.keys(_WebObject).forEach(function (key) {
85
- if (key === "default" || key === "__esModule") return;
86
- if (key in exports && exports[key] === _WebObject[key]) return;
87
- Object.defineProperty(exports, key, {
88
- enumerable: true,
89
- get: function get() {
90
- return _WebObject[key];
91
- }
92
- });
93
- });
94
- var _WebObjectPathHelper = require("./WebObjects/WebObjectPathHelper");
95
- Object.keys(_WebObjectPathHelper).forEach(function (key) {
96
- if (key === "default" || key === "__esModule") return;
97
- if (key in exports && exports[key] === _WebObjectPathHelper[key]) return;
98
- Object.defineProperty(exports, key, {
99
- enumerable: true,
100
- get: function get() {
101
- return _WebObjectPathHelper[key];
102
- }
103
- });
104
- });
105
- var _ParentWebObject = require("./WebObjects/ParentWebObject");
106
- Object.keys(_ParentWebObject).forEach(function (key) {
107
- if (key === "default" || key === "__esModule") return;
108
- if (key in exports && exports[key] === _ParentWebObject[key]) return;
109
- Object.defineProperty(exports, key, {
110
- enumerable: true,
111
- get: function get() {
112
- return _ParentWebObject[key];
113
- }
114
- });
115
- });
@@ -1,5 +0,0 @@
1
- import { SimpleObject } from "./SimpleObject";
2
- export declare class DummyObject extends SimpleObject {
3
- constructor(initObject: Partial<DummyObject> | null | undefined);
4
- }
5
- export default DummyObject;
@@ -1,32 +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.DummyObject = void 0;
8
- var _SimpleObject2 = require("./SimpleObject");
9
- 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); } }
10
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
- 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); }
13
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
16
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
17
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
19
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
- var DummyObject = exports.DummyObject = /*#__PURE__*/function (_SimpleObject) {
22
- function DummyObject(initObject) {
23
- var _this;
24
- _classCallCheck(this, DummyObject);
25
- _this = _callSuper(this, DummyObject, [false]);
26
- _this.loadValues(initObject, true);
27
- return _this;
28
- }
29
- _inherits(DummyObject, _SimpleObject);
30
- return _createClass(DummyObject);
31
- }(_SimpleObject2.SimpleObject);
32
- var _default = exports["default"] = DummyObject;
@@ -1,43 +0,0 @@
1
- import ObjectWithTemp from "./ObjectWithTemp";
2
- declare type FirstInTuple<T extends any[]> = ((...args: T) => any) extends (arg: infer R, ...rest: infer U) => any ? R : T;
3
- /**
4
- * This object can be mapped and converted
5
- */
6
- export declare class MapableObject extends ObjectWithTemp {
7
- readonly __uid: string;
8
- __table_id?: string;
9
- __parent__table_id?: string;
10
- __row_number?: number;
11
- constructor();
12
- getUID(): string;
13
- static getUID(o: MapableObject): string;
14
- static mapto<T>(maptoType: {
15
- new (...p: any): T;
16
- }, objectlist: any[] | null | undefined, is_readonly?: boolean, ...p: any[]): T[];
17
- static mapto<T extends typeof MapableObject>(objectlist: any[] | null | undefined, is_readonly?: boolean, ...p: any[]): InstanceType<T>[];
18
- /**
19
- * construct a new class from the given first parameter
20
- * @param maptoType class
21
- * @param first_param first parameter
22
- * @returns
23
- */
24
- static ensure<ClassType extends new (...args: any) => any>(maptoType: ClassType, first_param: FirstInTuple<ConstructorParameters<ClassType>>): InstanceType<ClassType>;
25
- /**
26
- * construct a new class from the given parameters
27
- * @param maptoType class
28
- * @param first_param first parameter
29
- * @returns
30
- */
31
- static ensure<ClassType extends new (...args: any) => any>(maptoType: ClassType, ...rest_params: ConstructorParameters<ClassType>): InstanceType<ClassType>;
32
- /**
33
- * make sure the object is instance of class
34
- * @param maptoType class
35
- * @param obj
36
- * @returns
37
- */
38
- static ensure<ClassType extends new (...args: any) => any>(maptoType: ClassType, obj: InstanceType<ClassType>): InstanceType<ClassType>;
39
- static map_rowindex<T extends MapableObject>(objectlist: T[] | null | undefined): T[];
40
- static map_tableid<T extends MapableObject>(objectlist: T[] | null | undefined): T[];
41
- static equals(a?: MapableObject | any, b?: MapableObject | any): boolean;
42
- }
43
- export default MapableObject;