@azrico/webobject 1.3.2 → 1.3.4

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/README.md CHANGED
@@ -1,52 +1,52 @@
1
- # deus-object
2
-
3
- > Some useful object functions
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install --save deus-object
9
- ```
10
-
11
- ## Functions
12
-
13
- ```js
14
- object_clone(object);
15
- object_first(object);
16
- object_update(a, b);
17
- object_delta(a, b);
18
- object_has_delta(object);
19
- object_equals(a, b);
20
- isEmpty(object);
21
- ```
22
-
23
- ## Usage
24
-
25
- ```js
26
- import React, { Component } from 'react'
27
- import { View } from 'react-native'
28
- import FuncObject from 'deus-object'
29
-
30
- class Example extends Component {
31
-
32
- let eq1=FuncObject.object_equals({a:"b"},{a:"b"});//true
33
- let eq2=FuncObject.object_equals({a:"b"},{a:"c"});//false
34
-
35
- let ie1=FuncObject.isEmpty({}); //true
36
- let ie2=FuncObject.isEmpty([]); //true
37
- let ie3=FuncObject.isEmpty(null);//true
38
- let ie4=FuncObject.isEmpty({test:"a"});//false
39
-
40
- let if1=FuncObject.object_first({a:"a",b:"b",c:"c"});// a:"a"
41
- let if2=FuncObject.object_first([1,2,3,4]);//1
42
-
43
-
44
- render() {
45
- return <View></View>
46
- }
47
- }
48
- ```
49
-
50
- ## License
51
-
52
- MIT © [](https://github.com/)
1
+ # deus-object
2
+
3
+ > Some useful object functions
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save deus-object
9
+ ```
10
+
11
+ ## Functions
12
+
13
+ ```js
14
+ object_clone(object);
15
+ object_first(object);
16
+ object_update(a, b);
17
+ object_delta(a, b);
18
+ object_has_delta(object);
19
+ object_equals(a, b);
20
+ isEmpty(object);
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```js
26
+ import React, { Component } from 'react'
27
+ import { View } from 'react-native'
28
+ import FuncObject from 'deus-object'
29
+
30
+ class Example extends Component {
31
+
32
+ let eq1=FuncObject.object_equals({a:"b"},{a:"b"});//true
33
+ let eq2=FuncObject.object_equals({a:"b"},{a:"c"});//false
34
+
35
+ let ie1=FuncObject.isEmpty({}); //true
36
+ let ie2=FuncObject.isEmpty([]); //true
37
+ let ie3=FuncObject.isEmpty(null);//true
38
+ let ie4=FuncObject.isEmpty({test:"a"});//false
39
+
40
+ let if1=FuncObject.object_first({a:"a",b:"b",c:"c"});// a:"a"
41
+ let if2=FuncObject.object_first([1,2,3,4]);//1
42
+
43
+
44
+ render() {
45
+ return <View></View>
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## License
51
+
52
+ MIT © [](https://github.com/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";
package/dist/index.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _index = require("./src/index");
7
- Object.keys(_index).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _index[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _index[key];
14
- }
15
- });
16
- });
@@ -1,10 +0,0 @@
1
- import WebObject from "./WebObject";
2
- /**
3
- * This web object contains some more webobjects
4
- */
5
- export declare class ParentWebObject extends WebObject {
6
- constructor(is_readonly?: boolean);
7
- __children: WebObject[] | undefined;
8
- set_children(val: WebObject[] | undefined): void;
9
- }
10
- export default ParentWebObject;
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.ParentWebObject = void 0;
7
- var _WebObject2 = _interopRequireDefault(require("./WebObject"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
- 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); }
17
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
22
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
23
- /**
24
- * This web object contains some more webobjects
25
- */
26
- var ParentWebObject = /*#__PURE__*/function (_WebObject) {
27
- _inherits(ParentWebObject, _WebObject);
28
- var _super = _createSuper(ParentWebObject);
29
- function ParentWebObject() {
30
- var _this;
31
- var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
32
- _classCallCheck(this, ParentWebObject);
33
- _this = _super.call(this, is_readonly);
34
- _defineProperty(_assertThisInitialized(_this), "__children", undefined);
35
- return _this;
36
- }
37
- _createClass(ParentWebObject, [{
38
- key: "set_children",
39
- value: function set_children(val) {
40
- if (Array.isArray(val)) {
41
- var selftableid = this.__table_id;
42
- val.forEach(function (v) {
43
- v.__parent__table_id = selftableid;
44
- });
45
- } else val = [];
46
- this.__children = val;
47
- }
48
- }]);
49
- return ParentWebObject;
50
- }(_WebObject2["default"]);
51
- exports.ParentWebObject = ParentWebObject;
52
- var _default = ParentWebObject;
53
- exports["default"] = _default;
@@ -1,86 +0,0 @@
1
- import SimpleObject, { sendChangesType } from "../structs/SimpleObject";
2
- import MetaObject from "../structs/MetaObject";
3
- import WebObjectManager from "./WebObjectManager";
4
- export type deltaParams = {
5
- type?: string;
6
- isChild?: boolean;
7
- useDelta?: boolean;
8
- allProperties?: boolean;
9
- extraProperties?: boolean;
10
- };
11
- export declare class WebObject extends SimpleObject {
12
- #private;
13
- static readonly __web_path: string;
14
- static readonly __web_type: string;
15
- meta_data: MetaObject[];
16
- _id: string;
17
- _created_date: string;
18
- constructor(is_readonly?: boolean);
19
- /**
20
- * Update meta value of this object , meta data is stored in meta_data variable
21
- * @param key
22
- * @param value
23
- * @param createIfNotExists should we create a new meta if key does not exist
24
- * @param sendChange
25
- * @returns
26
- */
27
- setMetaValue(key: string, value: any, createIfNotExists?: boolean, sendChange?: sendChangesType): boolean;
28
- /**
29
- * Get meta object by key
30
- * @param key
31
- * @returns meta object
32
- */
33
- getMeta(key: string): any;
34
- /**
35
- * Get meta value by key
36
- * @param key
37
- * @returns value or undefined
38
- */
39
- getMetaValue(key: string): any;
40
- /**
41
- * Get meta object by key
42
- * @param o
43
- * @param key
44
- * @returns meta object
45
- */
46
- static getMeta(o: WebObject | null | undefined, key: string): any;
47
- /**
48
- * Get meta value by key
49
- * @param o
50
- * @param key
51
- * @returns value or undefined
52
- */
53
- static getMetaValue(o: WebObject | null | undefined, key: string): any;
54
- Save(): Promise<boolean>;
55
- Delete(): Promise<boolean>;
56
- canSave(deltaObj?: any): true | string;
57
- deltaIsValid(d: any): true | string;
58
- static isResultValid(result_object: any): boolean;
59
- /**
60
- * You will post this to the server for saving
61
- * automatically removes unchangable fields
62
- * @returns
63
- */
64
- get_deltaObject(p?: deltaParams): Promise<any>;
65
- get __web_path(): string;
66
- get __web_type(): string;
67
- get_webtype: () => string;
68
- get_webpath: () => string;
69
- static get_webname(): string | undefined;
70
- get manager(): WebObjectManager<any> | null;
71
- get_managerClass: () => WebObjectManager<any> | null;
72
- onLoad(...p: any): Promise<any>;
73
- onSave(...p: any): Promise<any>;
74
- onNew(...p: any): Promise<any>;
75
- /**
76
- * get a single web object
77
- * default order of parameters : search,readonly,fetchID
78
- */
79
- static get_single<T extends WebObject>(...p: any[]): Promise<T | any | undefined>;
80
- /**
81
- * Get a list of web objects
82
- * default order of parameters : search,readonly,fetchID
83
- */
84
- static get_list(...p: any[]): Promise<WebObject[]>;
85
- }
86
- export default WebObject;