@gudhub/core 1.1.30 → 1.1.32

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.
@@ -5,8 +5,9 @@ export class Auth {
5
5
  }
6
6
 
7
7
  async login({ username, password } = {}) {
8
- let user = await this.req.simplePost({
9
- url: "/auth/login",
8
+ let user = await this.req.axiosRequest({
9
+ method: 'POST',
10
+ url: `${this.req.root}/auth/login`,
10
11
  form: {
11
12
  username,
12
13
  password,
@@ -26,8 +27,9 @@ export class Auth {
26
27
  }
27
28
 
28
29
  signup(user) {
29
- return this.req.simplePost({
30
- url: "/auth/singup",
30
+ return this.req.axiosRequest({
31
+ method: 'POST',
32
+ url: `${this.req.root}/auth/singup`,
31
33
  form: { user: JSON.stringify(user) },
32
34
  });
33
35
  }
@@ -51,8 +53,9 @@ export class Auth {
51
53
  }
52
54
 
53
55
  updateToken(auth_key) {
54
- return this.req.simplePost({
55
- url: "/auth/login",
56
+ return this.req.axiosRequest({
57
+ method: 'POST',
58
+ url: `${this.req.root}/auth/login`,
56
59
  form: {
57
60
  auth_key,
58
61
  },
@@ -11,8 +11,9 @@ export class ChunksManager {
11
11
 
12
12
  async getChunkApi(app_id, chunk_id) {
13
13
  try {
14
- const response = await this.req.simpleGet({
15
- url: `/api/get-items-chunk/${app_id}/${chunk_id}`,
14
+ const response = await this.req.axiosRequest({
15
+ url: `${this.req.root}/api/get-items-chunk/${app_id}/${chunk_id}`,
16
+ method: 'GET'
16
17
  });
17
18
  return response;
18
19
  } catch (err) {
@@ -23,8 +24,9 @@ export class ChunksManager {
23
24
 
24
25
  async getLastChunkApi(app_id) {
25
26
  try {
26
- const response = await this.req.simpleGet({
27
- url: `/api/get-last-items-chunk/${app_id}`,
27
+ const response = await this.req.axiosRequest({
28
+ url: `${this.req.root}/api/get-last-items-chunk/${app_id}`,
29
+ method: 'GET'
28
30
  });
29
31
  return response;
30
32
  } catch (err) {
@@ -37,14 +37,16 @@ export class Interpritate {
37
37
  if (data_type) {
38
38
  /*-- if we have data_type then we construct new data object to interpritate value*/
39
39
  gudhub.ghconstructor.getInstance(data_type).then(function (data) {
40
- var interpretationObj = self.getInterpretationObj(field, data.getTemplate().model, source, containerId);
41
- data.getInterpretation(value, interpretationObj.id, data_type, field, itemId, appId).then(function (result) {
42
- // console.log(result, interpretationObj)
43
-
44
- resolve(gudhub.mergeObjects(result, interpretationObj));
45
- }, function (error) {
46
- reject();
47
- });
40
+ if(data) {
41
+ var interpretationObj = self.getInterpretationObj(field, data.getTemplate().model, source, containerId);
42
+ data.getInterpretation(value, interpretationObj.id, data_type, field, itemId, appId).then(function (result) {
43
+ // console.log(result, interpretationObj)
44
+
45
+ resolve(gudhub.mergeObjects(result, interpretationObj));
46
+ }, function (error) {
47
+ reject();
48
+ });
49
+ }
48
50
  }, function (error) { });
49
51
 
50
52
  } else {
package/GUDHUB/config.js CHANGED
@@ -1,11 +1,11 @@
1
- export const server_url = "https://gudhub.com/GudHub";
1
+ export const server_url = "https://gudhub.com/GudHub_Test";
2
2
  //export const server_url = "https://gudhub.com/GudHub_Temp";
3
3
  //export const server_url = "https://integration.gudhub.com/GudHub_Test";
4
4
  //export const server_url = "http://localhost:9000";
5
5
  export const wss_url = "wss://gudhub.com/GudHub/ws/app/";
6
- export const async_modules_path = 'async_modules/';
7
- export const automation_modules_path = 'automation_modules/'
8
- export const file_server_url = 'http://localhost:9000';
6
+ export const async_modules_path = 'build/latest/async_modules/';
7
+ export const automation_modules_path = 'build/latest/automation_modules/'
8
+ export const file_server_url = 'https://gudhub.com'
9
9
 
10
10
  // FOR TESTS
11
11
  export const port = 9000;
@@ -47,6 +47,9 @@ export class GudHubHttpsService {
47
47
  .catch(function (err) {
48
48
  console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :", err.message);
49
49
  console.log("Request message: ", request);
50
+ if(err.response && err.response.data) {
51
+ console.log('Error response data: ', err.response.data);
52
+ }
50
53
  reject(err);
51
54
  });
52
55
 
@@ -57,36 +60,6 @@ export class GudHubHttpsService {
57
60
  return promise;
58
61
  }
59
62
 
60
-
61
- //********************* GET ***********************//
62
- async simpleGet(request) {
63
- const hesh = this.getHashCode(request);
64
-
65
- if (this.requestPromises[hesh]) {
66
- return this.requestPromises[hesh].promise;
67
- }
68
-
69
- const promise = new Promise((resolve, reject) => {
70
- const url = this.root + request.url;
71
-
72
- axios.get(url).then(function (response) {
73
- // handle success
74
- resolve(response.data);
75
- })
76
- .catch(function (err) {
77
- console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :", err.message);
78
- console.log("Request message: ", request);
79
- reject(err);
80
- });
81
-
82
- });
83
-
84
- this.pushPromise(promise, hesh);
85
-
86
- return promise;
87
- }
88
-
89
-
90
63
  //********************* POST ***********************//
91
64
  async post(request) {
92
65
  const hesh = this.getHashCode(request);
@@ -121,36 +94,35 @@ export class GudHubHttpsService {
121
94
  return promise;
122
95
  }
123
96
 
97
+ /*************** AXIOS REQUEST ***************/
98
+ // It's using to send simple requests to custom urls without token
99
+ // If you want to send application/x-www-form-urlencoded, pass data in 'form' property of request
100
+ // If you wnt to send any other type of data, just pass it to 'body' property of request
124
101
 
125
- //********************* SIMPLE POST ***********************//
126
- async simplePost(request) {
102
+ axiosRequest(request) {
127
103
  const hesh = this.getHashCode(request);
128
104
 
129
105
  if (this.requestPromises[hesh]) {
130
106
  return this.requestPromises[hesh].promise;
131
107
  }
132
108
 
133
- const promise = new Promise((resolve, reject) => {
109
+ let method = request.method.toLowerCase() || 'get';
110
+ let url = request.url;
111
+ let headers = request.form ? {'Content-Type': 'application/x-www-form-urlencoded'} : null;
134
112
 
135
- axios.post(
136
- this.root + request.url,
137
- qs.stringify(request.form),
138
- {
139
- headers: request.headers || {
140
- "Content-Type": "application/x-www-form-urlencoded",
141
- },
142
- }
143
- ).then(function (response) {
144
- // handle success
145
- resolve(response.data);
146
- }).catch(function (error) {
113
+ const promise = new Promise(async (resolve, reject) => {
114
+ try {
115
+ const { data } = await axios[method](url, qs.stringify(request.form) || request.body, {
116
+ headers
117
+ });
118
+ resolve(data);
119
+ } catch(error) {
147
120
  console.log("ERROR -> GUDHUB HTTP SERVICE -> SIMPLE POST :", error.message);
148
121
  console.log("Request message: ", request);
149
122
  reject(error);
150
- });
151
-
123
+ }
152
124
  });
153
-
125
+
154
126
  this.pushPromise(promise, hesh);
155
127
 
156
128
  return promise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -98,7 +98,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
98
98
  },{"./utils":"Qri1"}],"hIRQ":[function(require,module,exports) {
99
99
  "use strict";var r=require("./stringify"),e=require("./parse"),s=require("./formats");module.exports={formats:s,parse:e,stringify:r};
100
100
  },{"./stringify":"mwZo","./parse":"snX5","./formats":"XaX2"}],"hDvy":[function(require,module,exports) {
101
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHubHttpsService=void 0;var e=n(require("axios")),t=require("./utils.js"),r=n(require("qs"));function n(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n,s,o,i){try{var u=e[o](i),a=u.value}catch(c){return void r(c)}u.done?t(a):Promise.resolve(a).then(n,s)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){s(i,n,o,u,a,"next",e)}function a(e){s(i,n,o,u,a,"throw",e)}u(void 0)})}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var c=function(){function n(e){i(this,n),this.root=e,this.requestPromises=[]}return a(n,[{key:"init",value:function(e){this.getToken=e}},{key:"get",value:function(){var r=o(regeneratorRuntime.mark(function r(n){var s,o,i,u=this;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getToken();case 2:if(s=r.sent,o=this.getHashCode(n),!this.requestPromises[o]){r.next=6;break}return r.abrupt("return",this.requestPromises[o].promise);case 6:return i=new Promise(function(r,o){var i;n.externalResource?i=n.url:(i=u.root+n.url,i="".concat(i).concat(/\?/.test(i)?"&":"?","token=").concat(s).concat((0,t.convertObjToUrlParams)(n.params))),e.default.get(i).then(function(e){r(e.data)}).catch(function(e){console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :",e.message),console.log("Request message: ",n),o(e)})}),this.pushPromise(i,o),r.abrupt("return",i);case 9:case"end":return r.stop()}},r,this)}));return function(e){return r.apply(this,arguments)}}()},{key:"simpleGet",value:function(){var t=o(regeneratorRuntime.mark(function t(r){var n,s,o=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.getHashCode(r),!this.requestPromises[n]){t.next=3;break}return t.abrupt("return",this.requestPromises[n].promise);case 3:return s=new Promise(function(t,n){var s=o.root+r.url;e.default.get(s).then(function(e){t(e.data)}).catch(function(e){console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :",e.message),console.log("Request message: ",r),n(e)})}),this.pushPromise(s,n),t.abrupt("return",s);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"post",value:function(){var t=o(regeneratorRuntime.mark(function t(n){var s,o,i=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return s=this.getHashCode(n),t.next=3,this.getToken();case 3:if(n.form.token=t.sent,!this.requestPromises[s]){t.next=6;break}return t.abrupt("return",this.requestPromises[s].promise);case 6:return o=new Promise(function(t,s){e.default.post(i.root+n.url,r.default.stringify(n.form),{headers:n.headers||{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(e){t(e.data)}).catch(function(e){console.log("ERROR -> GUDHUB HTTP SERVICE -> POST :",e.message),console.log("Request message: ",n),s(e)})}),this.pushPromise(o,s),t.abrupt("return",o);case 9:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"simplePost",value:function(){var t=o(regeneratorRuntime.mark(function t(n){var s,o,i=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(s=this.getHashCode(n),!this.requestPromises[s]){t.next=3;break}return t.abrupt("return",this.requestPromises[s].promise);case 3:return o=new Promise(function(t,s){e.default.post(i.root+n.url,r.default.stringify(n.form),{headers:n.headers||{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(e){t(e.data)}).catch(function(e){console.log("ERROR -> GUDHUB HTTP SERVICE -> SIMPLE POST :",e.message),console.log("Request message: ",n),s(e)})}),this.pushPromise(o,s),t.abrupt("return",o);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"pushPromise",value:function(e,t){var r=this;this.requestPromises[t]={promise:e,hesh:t,callback:e.then(function(){r.destroyPromise(t)})}}},{key:"destroyPromise",value:function(e){this.requestPromises=this.requestPromises.filter(function(t){return t.hesh!==e})}},{key:"getHashCode",value:function(e){var t=0,n=r.default.stringify(e);if(0==n.length)return t;for(var s=0;s<n.length;s++){t=(t<<5)-t+n.charCodeAt(s),t&=t}return"h"+t}}]),n}();exports.GudHubHttpsService=c;
101
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHubHttpsService=void 0;var e=n(require("axios")),t=require("./utils.js"),r=n(require("qs"));function n(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n,s,o,i){try{var u=e[o](i),a=u.value}catch(c){return void r(c)}u.done?t(a):Promise.resolve(a).then(n,s)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){s(i,n,o,u,a,"next",e)}function a(e){s(i,n,o,u,a,"throw",e)}u(void 0)})}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var c=function(){function n(e){i(this,n),this.root=e,this.requestPromises=[]}return a(n,[{key:"init",value:function(e){this.getToken=e}},{key:"get",value:function(){var r=o(regeneratorRuntime.mark(function r(n){var s,o,i,u=this;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getToken();case 2:if(s=r.sent,o=this.getHashCode(n),!this.requestPromises[o]){r.next=6;break}return r.abrupt("return",this.requestPromises[o].promise);case 6:return i=new Promise(function(r,o){var i;n.externalResource?i=n.url:(i=u.root+n.url,i="".concat(i).concat(/\?/.test(i)?"&":"?","token=").concat(s).concat((0,t.convertObjToUrlParams)(n.params))),e.default.get(i).then(function(e){r(e.data)}).catch(function(e){console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :",e.message),console.log("Request message: ",n),e.response&&e.response.data&&console.log("Error response data: ",e.response.data),o(e)})}),this.pushPromise(i,o),r.abrupt("return",i);case 9:case"end":return r.stop()}},r,this)}));return function(e){return r.apply(this,arguments)}}()},{key:"post",value:function(){var t=o(regeneratorRuntime.mark(function t(n){var s,o,i=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return s=this.getHashCode(n),t.next=3,this.getToken();case 3:if(n.form.token=t.sent,!this.requestPromises[s]){t.next=6;break}return t.abrupt("return",this.requestPromises[s].promise);case 6:return o=new Promise(function(t,s){e.default.post(i.root+n.url,r.default.stringify(n.form),{headers:n.headers||{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(e){t(e.data)}).catch(function(e){console.log("ERROR -> GUDHUB HTTP SERVICE -> POST :",e.message),console.log("Request message: ",n),s(e)})}),this.pushPromise(o,s),t.abrupt("return",o);case 9:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"axiosRequest",value:function(t){var n=this.getHashCode(t);if(this.requestPromises[n])return this.requestPromises[n].promise;var s=t.method.toLowerCase()||"get",i=t.url,u=t.form?{"Content-Type":"application/x-www-form-urlencoded"}:null,a=new Promise(function(){var n=o(regeneratorRuntime.mark(function n(o,a){var c,f;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.default[s](i,r.default.stringify(t.form)||t.body,{headers:u});case 3:c=n.sent,f=c.data,o(f),n.next=13;break;case 8:n.prev=8,n.t0=n.catch(0),console.log("ERROR -> GUDHUB HTTP SERVICE -> SIMPLE POST :",n.t0.message),console.log("Request message: ",t),a(n.t0);case 13:case"end":return n.stop()}},n,null,[[0,8]])}));return function(e,t){return n.apply(this,arguments)}}());return this.pushPromise(a,n),a}},{key:"pushPromise",value:function(e,t){var r=this;this.requestPromises[t]={promise:e,hesh:t,callback:e.then(function(){r.destroyPromise(t)})}}},{key:"destroyPromise",value:function(e){this.requestPromises=this.requestPromises.filter(function(t){return t.hesh!==e})}},{key:"getHashCode",value:function(e){var t=0,n=r.default.stringify(e);if(0==n.length)return t;for(var s=0;s<n.length;s++){t=(t<<5)-t+n.charCodeAt(s),t&=t}return"h"+t}}]),n}();exports.GudHubHttpsService=c;
102
102
  },{"axios":"O4Aa","./utils.js":"EgeI","qs":"hIRQ"}],"Lc8J":[function(require,module,exports) {
103
103
  "use strict";function o(e){return(o="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})(e)}function e(o){var e="";for(var t in o)o.hasOwnProperty(t)&&o[t]&&(e+="."+o[t]);return e?e.substring(1):"any"}function t(e,t,n){return null==e||"string"!=typeof e?(console.log("Listener type is \"undefined\" or not have actual 'type' for subscribe"),!1):null==t||"object"!==o(t)?(console.log("Listener destination is \"undefined\" or not have actual 'type' for subscribe"),!1):"function"==typeof n||(console.log("Listener is not a function for subscribe!"),!1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkParams=t,exports.createId=e;
104
104
  },{}],"E3xI":[function(require,module,exports) {
@@ -112,7 +112,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
112
112
  },{}],"pHMV":[function(require,module,exports) {
113
113
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebSocketApi=void 0;var e=t(require("ws"));function t(e){return e&&e.__esModule?e:{default:e}}function n(e,t,n,r,o,s,i){try{var a=e[s](i),c=a.value}catch(u){return void n(u)}a.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,s){var i=e.apply(t,r);function a(e){n(i,o,s,a,c,"next",e)}function c(e){n(i,o,s,a,c,"throw",e)}a(void 0)})}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var c=function(){function t(e,n){s(this,t),this.websocket=null,this.connected=!1,this.queue=[],this.url=e,this.auth=n,this.heartBeatTimeStemp=1e13,this.ALLOWED_HEART_BEAT_DELEY=12e3,this.firstHeartBeat=!0,this.reload=!0,this.isBrowser=!["undefined"==typeof window?"undefined":o(window),"undefined"==typeof document?"undefined":o(document)].includes("undefined")}return a(t,[{key:"addSubscription",value:function(){var e=r(regeneratorRuntime.mark(function e(t){var n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auth.getToken();case 2:n=e.sent,r="token=".concat(n,"/~/app_id=").concat(t),this.connected&&this.websocket.send(r),this.queue.push(t);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"onOpen",value:function(){var e=r(regeneratorRuntime.mark(function e(){var t,n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.reload=!0,console.log("websocket opened"),this.connected=!0,e.next=5,this.auth.getToken();case 5:t=e.sent,this.queue.forEach(function(e){var r="token=".concat(t,"/~/app_id=").concat(e);n.websocket.send(r)});case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"onError",value:function(e){console.log("websocket error: ",e),this.websocket.close()}},{key:"onClose",value:function(){console.log("websocket close"),this.connected=!1,this.initWebSocket()}},{key:"onMessage",value:function(){var e=r(regeneratorRuntime.mark(function e(t){var n,r,o,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.isBrowser?t.data:t).match(/HeartBeat/)){e.next=10;break}if(r=(new Date).getTime()-this.heartBeatTimeStemp,!(this.ALLOWED_HEART_BEAT_DELEY<r)){e.next=8;break}return e.next=6,this.onConnectionLost();case 6:e.next=10;break;case 8:this.websocket.send("HeartBeat"),this.heartBeatTimeStemp=(new Date).getTime();case 10:if(this.firstHeartBeat&&(this.connectionChecker(),this.firstHeartBeat=!1),!n.match(/[{}]/)){e.next=17;break}return o=JSON.parse(n),e.next=15,this.auth.getToken();case 15:s=e.sent,o.token!=s&&this.onMassageHandler(o);case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"initWebSocket",value:function(t,n){this.onMassageHandler=t,this.refreshAppsHandler=n,this.isBrowser?(this.websocket=new WebSocket(this.url),this.websocket.onopen=this.onOpen.bind(this),this.websocket.onerror=this.onError.bind(this),this.websocket.onclose=this.onClose.bind(this),this.websocket.onmessage=this.onMessage.bind(this)):(this.websocket=new e.default(this.url),this.websocket.on("open",this.onOpen),this.websocket.on("error",this.onError),this.websocket.on("close",this.onClose),this.websocket.on("message",this.onMessage)),console.log("websocket initialized")}},{key:"connectionChecker",value:function(){var e=this;setInterval(r(regeneratorRuntime.mark(function t(){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(new Date).getTime()-e.heartBeatTimeStemp,!(e.ALLOWED_HEART_BEAT_DELEY<n)){t.next=4;break}return t.next=4,e.onConnectionLost();case 4:case"end":return t.stop()}},t)})),1e3)}},{key:"onConnectionLost",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.auth.getVersion();case 3:this.reload&&(this.reload=!1,console.log("Connected"),this.heartBeatTimeStemp=1e13,this.websocket.close(),this.refreshAppsHandler(this.queue)),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.log(e.t0);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()}]),t}();exports.WebSocketApi=c;
114
114
  },{"ws":"p58b"}],"TPH7":[function(require,module,exports) {
115
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.wss_url=exports.server_url=exports.port=exports.file_server_url=exports.automation_modules_path=exports.async_modules_path=void 0;var e="https://gudhub.com/GudHub";exports.server_url=e;var r="wss://gudhub.com/GudHub/ws/app/";exports.wss_url=r;var s="async_modules/";exports.async_modules_path=s;var o="automation_modules/";exports.automation_modules_path=o;var t="http://localhost:9000";exports.file_server_url=t;var u=9e3;exports.port=u;
115
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.wss_url=exports.server_url=exports.port=exports.file_server_url=exports.automation_modules_path=exports.async_modules_path=void 0;var e="https://gudhub.com/GudHub_Test";exports.server_url=e;var s="wss://gudhub.com/GudHub/ws/app/";exports.wss_url=s;var r="build/latest/async_modules/";exports.async_modules_path=r;var t="build/latest/automation_modules/";exports.automation_modules_path=t;var o="https://gudhub.com";exports.file_server_url=o;var u=9e3;exports.port=u;
116
116
  },{}],"DvAj":[function(require,module,exports) {
117
117
  "use strict";function e(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=t(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var a=0,u=function(){};return{s:u,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw o}}}}function t(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n(e,t,r,n,a,u,o){try{var i=e[u](o),c=i.value}catch(l){return void r(l)}i.done?t(c):Promise.resolve(c).then(n,a)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(a,u){var o=e.apply(t,r);function i(e){n(o,a,u,i,c,"next",e)}function c(e){n(o,a,u,i,c,"throw",e)}i(void 0)})}}function u(e,t,r,n,a,u){return o.apply(this,arguments)}function o(){return(o=a(regeneratorRuntime.mark(function t(r,n,a,u,o,i){var c,l,f,s,p,v,h,b,d,y,g=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(y=function(e){return new Promise(function(t){i.on("gh_value_get",e,function r(n,a){i.destroy("gh_value_get",e,r),t(a)}).emit("gh_value_get",{},e)})},c=g.length>6&&void 0!==g[6]?g[6]:[],l=[],f={variableMethodcurrent_app:function(){return[a]},variableMethodelement_app:function(){return[n]},variableMethodcurrent_item:function(){return["".concat(a,".").concat(u)]},variableMethoduser_id:function(){return[o.getUser().user_id]},variableMethoduser_email:function(e){return[o.getUser().username]},variableMethodtoday:function(e){var t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);return[r.valueOf().toString()+":"+n.valueOf().toString()]},variableMethodvariable:function(){return c}},!r){t.next=40;break}s=e(r),t.prev=6,s.s();case 8:if((p=s.n()).done){t.next=32;break}if(!(v=p.value)){t.next=29;break}t.t0=v.input_type,t.next="variable"===t.t0?14:"field"===t.t0?19:25;break;case 14:return h=v.input_type+"Method"+v.input_value,b=f[h],v.valuesArray="function"==typeof b?b():f.variableMethodvariable(),l.push(v),t.abrupt("break",27);case 19:return t.next=21,y({app_id:a,item_id:u,field_id:v.input_value});case 21:return null!=(d=t.sent)&&v.valuesArray.push(d),l.push(v),t.abrupt("break",27);case 25:return l.push(v),t.abrupt("break",27);case 27:t.next=30;break;case 29:l.push(v);case 30:t.next=8;break;case 32:t.next=37;break;case 34:t.prev=34,t.t1=t.catch(6),s.e(t.t1);case 37:return t.prev=37,s.f(),t.finish(37);case 40:return t.abrupt("return",l);case 41:case"end":return t.stop()}},t,null,[[6,34,37,40]])}))).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterPreparation=u;
118
118
  },{}],"jqRt":[function(require,module,exports) {
@@ -175,7 +175,7 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
175
175
  },{}],"mWlG":[function(require,module,exports) {
176
176
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=g(require("./filter/filter.js")),r=require("./json_to_items/json_to_items.js"),n=require("./merge_compare_items/merge_compare_items.js"),i=require("./filter/group.js"),u=require("./filter/utils.js"),s=g(require("./populate_items/populate_items.js")),o=require("./get_date/get_date.js"),l=require("./merge_objects/merge_objects.js"),a=require("./merge_chunks/merge_chunks.js"),c=require("./nested_list/nested_list.js"),p=g(require("./MergeFields/MergeFields.js")),f=g(require("./ItemsSelection/ItemsSelection.js")),m=require("./compare_items_lists_worker/compare_items_lists.worker.js"),v=require("./json_constructor/json_constructor.js"),h=g(require("./AppsTemplateService/AppsTemplateService.js")),d=require("./FIleHelper/FileHelper.js");function g(e){return e&&e.__esModule?e:{default:e}}function y(e){return _(e)||I(e)||j(e)||k()}function k(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e,t){if(e){if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function I(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _(e){if(Array.isArray(e))return b(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function w(e,t,r,n,i,u,s){try{var o=e[u](s),l=o.value}catch(a){return void r(a)}o.done?t(l):Promise.resolve(l).then(n,i)}function S(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var u=e.apply(t,r);function s(e){w(u,n,i,s,o,"next",e)}function o(e){w(u,n,i,s,o,"throw",e)}s(void 0)})}}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var q=function(){function g(e){F(this,g),this.gudhub=e,this.MergeFields=new p.default(e),this.ItemsSelection=new f.default(e),this.AppsTemplateService=new h.default(e),this.FileHelper=new d.FileHelper(e)}return T(g,[{key:"prefilter",value:function(t,r,n,i){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return(0,e.filterPreparation)(t,r,n,i,this.gudhub.storage,this.gudhub.pipeService,u)}},{key:"filter",value:function(e,r){return(0,t.default)(e,r)}},{key:"group",value:function(e,t){return(0,i.group)(e,t)}},{key:"getFilteredItems",value:function(){var e=S(regeneratorRuntime.mark(function e(){var t,r,n,i,s,o,l,a,c,p,f,m=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=m.length>0&&void 0!==m[0]?m[0]:[],r=m.length>1&&void 0!==m[1]?m[1]:[],n=m.length>2?m[2]:void 0,i=m.length>3?m[3]:void 0,s=m.length>4?m[4]:void 0,o=m.length>5&&void 0!==m[5]?m[5]:"",l=m.length>6?m[6]:void 0,a=m.length>7?m[7]:void 0,e.next=10,this.prefilter(r,n,i,s);case 10:return c=e.sent,p=this.filter(t,[].concat(y(r),y(c))),f=this.group(o,p),e.abrupt("return",f.filter(function(e){return!l||1===(0,u.searchValue)([e],l).length}).filter(function(e){return!a||1===(0,u.searchValue)([e],a).length}));case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"jsonToItems",value:function(e,t){return(0,r.jsonToItems)(e,t)}},{key:"getDate",value:function(e){return(0,o.getDate)(e)}},{key:"checkRecurringDate",value:function(e,t){return(0,o.checkRecurringDate)(e,t)}},{key:"populateItems",value:function(e,t,r){return(0,s.default)(e,t,r)}},{key:"populateWithDate",value:function(e,t){return(0,o.populateWithDate)(e,t)}},{key:"populateWithItemRef",value:function(e,t,r,i,u,s){return(0,n.populateWithItemRef)(e,t,r,i,u,s)}},{key:"compareItems",value:function(e,t,r){return(0,n.compareItems)(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return(0,n.mergeItems)(e,t,r)}},{key:"mergeObjects",value:function(e,t,r){return(0,l.mergeObjects)(e,t,r)}},{key:"makeNestedList",value:function(e,t,r,n,i){return(0,c.makeNestedList)(e,t,r,n,i)}},{key:"mergeChunks",value:function(e){return(0,a.mergeChunks)(e)}},{key:"mergeFieldLists",value:function(e,t){return this.MergeFields.mergeFieldLists(e,t)}},{key:"createFieldsListToView",value:function(e,t){return this.MergeFields.createFieldsListToView(e,t)}},{key:"createFieldsListToViewWithDataType",value:function(e,t){return this.MergeFields.createFieldsListToViewWithDataType(e,t)}},{key:"selectItems",value:function(e,t){return this.ItemsSelection.selectItems(e,t)}},{key:"getSelectedItems",value:function(e){return this.ItemsSelection.getSelectedItems(e)}},{key:"clearSelectedItems",value:function(e){return this.ItemsSelection.clearSelectedItems(e)}},{key:"isItemSelected",value:function(e,t){return this.ItemsSelection.isItemSelected(e,t)}},{key:"jsonConstructor",value:function(e,t,r){return(0,v.compiler)(e,t,this,r)}},{key:"fileInstallerHelper",value:function(e,t,r){return this.FileHelper.fileInstallerHelper(e,t,r)}},{key:"createAppsFromTemplate",value:function(e,t,r){return this.AppsTemplateService.createAppsFromTemplate(e,t,r)}},{key:"createApps",value:function(e){return this.AppsTemplateService.createApps(e)}},{key:"createItems",value:function(e,t){return this.AppsTemplateService.createItems(e,t)}},{key:"compareAppsItemsLists",value:function(e,t,r){var n=new Blob([(0,m.compare_items_lists_Worker)()],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.worker.postMessage({items_list1:e,items_list2:t}),this.worker.addEventListener("message",function(e){var t=e.data.diff;r(t)})}}]),g}();exports.Utils=q;
177
177
  },{"./filter/filterPreparation.js":"DvAj","./filter/filter.js":"mbGN","./json_to_items/json_to_items.js":"UCDv","./merge_compare_items/merge_compare_items.js":"xDLX","./filter/group.js":"VgUi","./filter/utils.js":"zsiC","./populate_items/populate_items.js":"EzAv","./get_date/get_date.js":"VzfS","./merge_objects/merge_objects.js":"EE1j","./merge_chunks/merge_chunks.js":"AMYJ","./nested_list/nested_list.js":"S7Iy","./MergeFields/MergeFields.js":"vno1","./ItemsSelection/ItemsSelection.js":"DfIi","./compare_items_lists_worker/compare_items_lists.worker.js":"xR4c","./json_constructor/json_constructor.js":"nKaW","./AppsTemplateService/AppsTemplateService.js":"zqOZ","./FIleHelper/FileHelper.js":"E7yc"}],"rK64":[function(require,module,exports) {
178
- "use strict";function e(e,r,t,n,u,a,s){try{var i=e[a](s),o=i.value}catch(c){return void t(c)}i.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,a){var s=r.apply(t,n);function i(r){e(s,u,a,i,o,"next",r)}function o(r){e(s,u,a,i,o,"throw",r)}i(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0;var a=function(){function e(r,n){t(this,e),this.req=r,this.storage=n}return u(e,[{key:"login",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r,t,n,u,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:{},t=r.username,n=r.password,e.next=3,this.req.simplePost({url:"/auth/login",form:{username:t,password:n}});case 3:return u=e.sent,this.storage.updateUser(u),e.abrupt("return",u);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"logout",value:function(e){return this.req.post({url:"/auth/logout",form:{token:e}})}},{key:"signup",value:function(e){return this.req.simplePost({url:"/auth/singup",form:{user:JSON.stringify(e)}})}},{key:"getUsersList",value:function(e){return this.req.get({url:"/auth/userlist",params:{keyword:e}})}},{key:"updateUserApi",value:function(e){return this.req.post({url:"/auth/updateuser",form:{user:JSON.stringify(e)}})}},{key:"updateToken",value:function(e){return this.req.simplePost({url:"/auth/login",form:{auth_key:e}})}},{key:"avatarUploadApi",value:function(e){return this.req.post({url:"/auth/avatar-upload",form:{image:e}})}},{key:"getUserByIdApi",value:function(e){return this.req.get({url:"/auth/getuserbyid",params:{id:e}})}},{key:"getVersion",value:function(){return this.req.get({url:"/version"})}},{key:"getUserFromStorage",value:function(e){return this.storage.getUsersList().find(function(r){return r.user_id==e})}},{key:"saveUserToStorage",value:function(e){var r=this.storage.getUsersList(),t=r.find(function(r){return r.user_id==e.user_id});return t||(r.push(e),e)}},{key:"getUserById",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.getUserFromStorage(r)){e.next=9;break}return e.next=4,this.getUserByIdApi(r);case 4:if(n=e.sent){e.next=7;break}return e.abrupt("return",null);case 7:(t=this.getUserFromStorage(r))||(this.saveUserToStorage(n),t=n);case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"getToken",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r,t,n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=new Date(this.storage.getUser().expirydate),t=new Date,n=this.storage.getUser().accesstoken,!(r<t)&&n){e.next=9;break}return e.next=6,this.updateToken(this.storage.getUser().auth_key);case 6:u=e.sent,this.storage.updateUser(u),n=u.accesstoken;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"updateUser",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateUserApi(r);case 2:return t=e.sent,this.storage.updateUser(t),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"updateAvatar",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.avatarUploadApi(r);case 2:return t=e.sent,this.storage.updateUser(t),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()}]),e}();exports.Auth=a;
178
+ "use strict";function e(e,t,r,n,u,a,s){try{var o=e[a](s),i=o.value}catch(c){return void r(c)}o.done?t(i):Promise.resolve(i).then(n,u)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(u,a){var s=t.apply(r,n);function o(t){e(s,u,a,o,i,"next",t)}function i(t){e(s,u,a,o,i,"throw",t)}o(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0;var a=function(){function e(t,n){r(this,e),this.req=t,this.storage=n}return u(e,[{key:"login",value:function(){var e=t(regeneratorRuntime.mark(function e(){var t,r,n,u,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},r=t.username,n=t.password,e.next=3,this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login"),form:{username:r,password:n}});case 3:return u=e.sent,this.storage.updateUser(u),e.abrupt("return",u);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"logout",value:function(e){return this.req.post({url:"/auth/logout",form:{token:e}})}},{key:"signup",value:function(e){return this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/singup"),form:{user:JSON.stringify(e)}})}},{key:"getUsersList",value:function(e){return this.req.get({url:"/auth/userlist",params:{keyword:e}})}},{key:"updateUserApi",value:function(e){return this.req.post({url:"/auth/updateuser",form:{user:JSON.stringify(e)}})}},{key:"updateToken",value:function(e){return this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login"),form:{auth_key:e}})}},{key:"avatarUploadApi",value:function(e){return this.req.post({url:"/auth/avatar-upload",form:{image:e}})}},{key:"getUserByIdApi",value:function(e){return this.req.get({url:"/auth/getuserbyid",params:{id:e}})}},{key:"getVersion",value:function(){return this.req.get({url:"/version"})}},{key:"getUserFromStorage",value:function(e){return this.storage.getUsersList().find(function(t){return t.user_id==e})}},{key:"saveUserToStorage",value:function(e){var t=this.storage.getUsersList(),r=t.find(function(t){return t.user_id==e.user_id});return r||(t.push(e),e)}},{key:"getUserById",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getUserFromStorage(t)){e.next=9;break}return e.next=4,this.getUserByIdApi(t);case 4:if(n=e.sent){e.next=7;break}return e.abrupt("return",null);case 7:(r=this.getUserFromStorage(t))||(this.saveUserToStorage(n),r=n);case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getToken",value:function(){var e=t(regeneratorRuntime.mark(function e(){var t,r,n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=new Date(this.storage.getUser().expirydate),r=new Date,n=this.storage.getUser().accesstoken,!(t<r)&&n){e.next=9;break}return e.next=6,this.updateToken(this.storage.getUser().auth_key);case 6:u=e.sent,this.storage.updateUser(u),n=u.accesstoken;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"updateUser",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateUserApi(t);case 2:return r=e.sent,this.storage.updateUser(r),e.abrupt("return",r);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAvatar",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.avatarUploadApi(t);case 2:return r=e.sent,this.storage.updateUser(r),e.abrupt("return",r);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}();exports.Auth=a;
179
179
  },{}],"UV2u":[function(require,module,exports) {
180
180
  "use strict";function e(o){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(o)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.IS_WEB=void 0;var o=!["undefined"==typeof window?"undefined":e(window),"undefined"==typeof document?"undefined":e(document)].includes("undefined");exports.IS_WEB=o;
181
181
  },{}],"osSN":[function(require,module,exports) {
@@ -195,11 +195,11 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
195
195
  },{}],"XUT2":[function(require,module,exports) {
196
196
  "use strict";function e(e){return i(e)||n(e)||t(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function n(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return a(e)}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function u(e,r,t,n,i,a,u){try{var o=e[a](u),s=o.value}catch(p){return void t(p)}o.done?r(s):Promise.resolve(s).then(n,i)}function o(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var a=e.apply(r,t);function o(e){u(a,n,i,o,s,"next",e)}function s(e){u(a,n,i,o,s,"throw",e)}o(void 0)})}}function s(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function p(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,r,t){return r&&p(e.prototype,r),t&&p(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileManager=void 0;var l=function(){function r(e,t,n,i){s(this,r),this.storage=e,this.pipeService=t,this.req=n,this.appProcessor=i}return c(r,[{key:"uploadFileApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n){var i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i={"file-0":r,app_id:t,item_id:n},e.next=4,this.req.post({url:"/file/formupload",form:i});case 4:return a=e.sent,e.abrupt("return",a);case 8:return e.prev=8,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(r,t,n){return e.apply(this,arguments)}}()},{key:"uploadFileFromStringApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/file/upload",form:{file:JSON.stringify(r)}});case 3:return t=e.sent,e.abrupt("return",t);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(r){return e.apply(this,arguments)}}()},{key:"updateFileFromStringApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n,i,a){var u,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,u={file_name:n,extension:i,file_id:t,format:a,source:r},e.next=4,this.req.post({url:"/file/update",form:{file:JSON.stringify(u)}});case 4:return o=e.sent,e.abrupt("return",o);case 8:return e.prev=8,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(r,t,n,i,a){return e.apply(this,arguments)}}()},{key:"duplicateFileApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.req.post({url:"/api/new/file/duplicate",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{files:JSON.stringify(r)}}));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"downloadFileFromString",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.isFileExists(r,t);case 2:if(!e.sent){e.next=12;break}return e.next=5,this.getFile(r,t);case 5:return n=e.sent,e.next=8,this.req.get({url:n.url+"?timestamp="+n.last_update,externalResource:!0});case 8:return i=e.sent,e.abrupt("return",{file:n,data:i,type:"file"});case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"duplicateFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t,n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.duplicateFileApi(r);case 2:return(t=e.sent).forEach(function(e){n.addFileToStorage(e.app_id,e)}),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"deleteFileApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.get({url:"/file/delete?file_id=".concat(r)});case 3:return t=e.sent,e.abrupt("return",t);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(r){return e.apply(this,arguments)}}()},{key:"addFileToStorage",value:function(e,r){var t=this.storage.getApp(e);t&&(t.file_list.push(r),this.storage.updateApp(t),this.pipeService.emit("gh_file_upload",{app_id:e,item_id:r.item_id,file_id:r.file_id},r))}},{key:"addFilesToStorage",value:function(r,t){var n,i=this,a=this.storage.getApp(r);a&&((n=a.file_list).push.apply(n,e(t)),this.storage.updateApp(a),t.forEach(function(e){i.pipeService.emit("gh_file_upload",{app_id:r,item_id:e.item_id,file_id:e.file_id},e)}))}},{key:"deleteFileFromStorage",value:function(e,r){var t,n=this.storage.getApp(r);n&&(n.file_list=n.file_list.filter(function(r){return r.file_id!=e||(t=r,!1)}),this.storage.updateApp(n),this.pipeService.emit("gh_file_delete",{file_id:e},t))}},{key:"updateFileInStorage",value:function(e,r,t){var n=this.storage.getApp(r);n&&(n.file_list=n.file_list.map(function(r){return r.file_id==e?t:r}),this.storage.updateApp(n),this.pipeService.emit("gh_file_update",{file_id:e}))}},{key:"getFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.appProcessor.getApp(r);case 2:return n=e.sent,e.abrupt("return",new Promise(function(e,r){var i=n.file_list.find(function(e){return e.file_id==t});e(i||"")}));case 4:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"getFiles",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t,n,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>1&&void 0!==i[1]?i[1]:[],e.next=3,this.appProcessor.getApp(r);case 3:return n=e.sent,e.abrupt("return",new Promise(function(e,r){var i=n.file_list.filter(function(e){return t.some(function(r){return r==e.file_id})});e(i||"")}));case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"uploadFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.uploadFileApi(r,t,n);case 2:return i=e.sent,this.addFileToStorage(t,i),e.abrupt("return",i);case 5:case"end":return e.stop()}},e,this)}));return function(r,t,n){return e.apply(this,arguments)}}()},{key:"uploadFileFromString",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.uploadFileFromStringApi(r);case 2:return t=e.sent,this.addFileToStorage(t.app_id,t),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"updateFileFromString",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n,i,a){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateFileFromStringApi(r,t,n,i,a);case 2:return u=e.sent,this.updateFileInStorage(t,u.app_id,u),e.abrupt("return",u);case 5:case"end":return e.stop()}},e,this)}));return function(r,t,n,i,a){return e.apply(this,arguments)}}()},{key:"deleteFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deleteFileApi(t);case 2:return this.deleteFileFromStorage(t,r),e.abrupt("return",!0);case 4:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"isFileExists",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,!Boolean(t)){e.next=12;break}return e.next=4,this.getFile(r,t);case 4:if(i=e.sent,!Boolean(i)){e.next=9;break}return e.abrupt("return",n.test(i.url));case 9:return e.abrupt("return",!1);case 10:e.next=13;break;case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()}]),r}();exports.FileManager=l;
197
197
  },{}],"KHGc":[function(require,module,exports) {
198
- "use strict";function e(e,t,r,n,u,a,i){try{var s=e[a](i),o=s.value}catch(c){return void r(c)}s.done?t(o):Promise.resolve(o).then(n,u)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(u,a){var i=t.apply(r,n);function s(t){e(i,u,a,s,o,"next",t)}function o(t){e(i,u,a,s,o,"throw",t)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChunksManager=void 0;var a=function(){function e(t,n,u,a){r(this,e),this.storage=t,this.pipeService=n,this.req=u,this.util=a,this.itemListeners()}return u(e,[{key:"getChunkApi",value:function(){var e=t(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.simpleGet({url:"/api/get-items-chunk/".concat(t,"/").concat(r)});case 3:return n=e.sent,e.abrupt("return",n);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getLastChunkApi",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.simpleGet({url:"/api/get-last-items-chunk/".concat(t)});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getChunk",value:function(e,t){return this.getChunkApi(e,t)}},{key:"getChunks",value:function(){var e=t(regeneratorRuntime.mark(function e(t,r){var n,u=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=[],!r){e.next=5;break}return e.next=4,Promise.all(r.map(function(e){return u.getChunkApi(t,e)}));case 4:n=e.sent;case 5:return e.abrupt("return",n);case 6:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getLastChunk",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getLastChunkApi(t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"itemListeners",value:function(){}},{key:"getApp",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:if(r=this.getAppFromStorage(t)){e.next=16;break}if(!this.getAppPromises[t]){e.next=6;break}return e.abrupt("return",this.getAppPromises[t]);case 6:return this.getAppPromises[t]=this.getAppApi(t),e.next=9,this.getAppPromises[t];case 9:if(!(r=e.sent)){e.next=15;break}this.saveAppInStorage(r),this.ws.addSubscription(t),e.next=16;break;case 15:return e.abrupt("return",null);case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}();exports.ChunksManager=a;
198
+ "use strict";function e(e,t,r,n,u,a,i){try{var s=e[a](i),o=s.value}catch(c){return void r(c)}s.done?t(o):Promise.resolve(o).then(n,u)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(u,a){var i=t.apply(r,n);function s(t){e(i,u,a,s,o,"next",t)}function o(t){e(i,u,a,s,o,"throw",t)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChunksManager=void 0;var a=function(){function e(t,n,u,a){r(this,e),this.storage=t,this.pipeService=n,this.req=u,this.util=a,this.itemListeners()}return u(e,[{key:"getChunkApi",value:function(){var e=t(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.axiosRequest({url:"".concat(this.req.root,"/api/get-items-chunk/").concat(t,"/").concat(r),method:"GET"});case 3:return n=e.sent,e.abrupt("return",n);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getLastChunkApi",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.axiosRequest({url:"".concat(this.req.root,"/api/get-last-items-chunk/").concat(t),method:"GET"});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getChunk",value:function(e,t){return this.getChunkApi(e,t)}},{key:"getChunks",value:function(){var e=t(regeneratorRuntime.mark(function e(t,r){var n,u=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=[],!r){e.next=5;break}return e.next=4,Promise.all(r.map(function(e){return u.getChunkApi(t,e)}));case 4:n=e.sent;case 5:return e.abrupt("return",n);case 6:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getLastChunk",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getLastChunkApi(t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"itemListeners",value:function(){}},{key:"getApp",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:if(r=this.getAppFromStorage(t)){e.next=16;break}if(!this.getAppPromises[t]){e.next=6;break}return e.abrupt("return",this.getAppPromises[t]);case 6:return this.getAppPromises[t]=this.getAppApi(t),e.next=9,this.getAppPromises[t];case 9:if(!(r=e.sent)){e.next=15;break}this.saveAppInStorage(r),this.ws.addSubscription(t),e.next=16;break;case 15:return e.abrupt("return",null);case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}();exports.ChunksManager=a;
199
199
  },{}],"K1Gs":[function(require,module,exports) {
200
200
  "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.DocumentManager=void 0;var r=function(){function t(n,r){e(this,t),this.req=n,this.pipeService=r}return n(t,[{key:"createDocument",value:function(e){return this.req.post({url:"/api/new/document/insert-one",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}},{key:"emitDocumentInsert",value:function(e){this.pipeService.emit("gh_document_insert_one",{app_id:e.app_id,item_id:e.item_id,element_id:e.element_id})}},{key:"getDocument",value:function(e){return this.req.post({url:"/api/new/document/find-one",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}},{key:"getDocuments",value:function(e){return this.req.post({url:"/api/new/document/find",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}},{key:"deleteDocument",value:function(e){return this.req.post({url:"/api/new/document/remove-one",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}}]),t}();exports.DocumentManager=r;
201
201
  },{}],"X4Dt":[function(require,module,exports) {
202
- "use strict";function t(t,e,n,r,a,u,i){try{var o=t[u](i),c=o.value}catch(s){return void n(s)}o.done?e(c):Promise.resolve(c).then(r,a)}function e(e){return function(){var n=this,r=arguments;return new Promise(function(a,u){var i=e.apply(n,r);function o(e){t(i,a,u,o,c,"next",e)}function c(e){t(i,a,u,o,c,"throw",e)}o(void 0)})}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Interpritate=void 0;var u=function(){function t(e){n(this,t),this.gudhub=e}return a(t,[{key:"getInterpretationObj",value:function(t,e,n,r){var a={},u=e.data_model.interpretation.find(function(t){return t.src==n})||e.data_model.interpretation.find(function(t){return"table"==t.src})||{id:"default"};return t.data_model&&t.data_model.interpretation&&(a=t.data_model.interpretation.find(function(t){return t.src==r})||t.data_model.interpretation.find(function(t){return t.src==n})),gudhub.mergeObjects(u,a)}},{key:"getInterpretation",value:function(t,n,r,a,u,i,o){var c=this,s=this;return new Promise(function(){var f=e(regeneratorRuntime.mark(function e(f,l){var p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(p=n&&n.data_type?n.data_type:r)?gudhub.ghconstructor.getInstance(p).then(function(e){var r=s.getInterpretationObj(n,e.getTemplate().model,a,o);e.getInterpretation(t,r.id,p,n,u,i).then(function(t){f(gudhub.mergeObjects(t,r))},function(t){l()})},function(t){}):f(c.getDefaultInterpretation(t,n));case 2:case"end":return e.stop()}},e)}));return function(t,e){return f.apply(this,arguments)}}())}},{key:"getDefaultInterpretation",value:function(t,e){var n=t;return e&&e.forEach(function(e){e.value==t&&""!=t&&(n=e.name)}),n}},{key:"getInterpretationById",value:function(){var t=e(regeneratorRuntime.mark(function t(e,n,r,a){var u,i,o,c,s,f,l=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(u=l.length>4&&void 0!==l[4]?l[4]:null,i=l.length>5&&void 0!==l[5]?l[5]:null,null!=u){t.next=8;break}return t.next=5,this.gudhub.getFieldValue(e,n,r);case 5:t.t0=t.sent,t.next=9;break;case 8:t.t0=u;case 9:if(o=t.t0,null!=i){t.next=16;break}return t.next=13,this.gudhub.getField(e,r);case 13:t.t1=t.sent,t.next=17;break;case 16:t.t1=i;case 17:if(null!=(c=t.t1)){t.next=20;break}return t.abrupt("return","");case 20:return t.next=22,this.gudhub.ghconstructor.getInstance(c.data_type);case 22:return s=t.sent,t.next=25,s.getInterpretation(o,a,c.data_type,c,n,e);case 25:if("<span>no interpretation</span>"!=(f=t.sent).html){t.next=30;break}return t.abrupt("return",o);case 30:return t.abrupt("return",f.html);case 31:case"end":return t.stop()}},t,this)}));return function(e,n,r,a){return t.apply(this,arguments)}}()}]),t}();exports.Interpritate=u;
202
+ "use strict";function t(t,e,n,r,a,u,i){try{var o=t[u](i),c=o.value}catch(s){return void n(s)}o.done?e(c):Promise.resolve(c).then(r,a)}function e(e){return function(){var n=this,r=arguments;return new Promise(function(a,u){var i=e.apply(n,r);function o(e){t(i,a,u,o,c,"next",e)}function c(e){t(i,a,u,o,c,"throw",e)}o(void 0)})}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Interpritate=void 0;var u=function(){function t(e){n(this,t),this.gudhub=e}return a(t,[{key:"getInterpretationObj",value:function(t,e,n,r){var a={},u=e.data_model.interpretation.find(function(t){return t.src==n})||e.data_model.interpretation.find(function(t){return"table"==t.src})||{id:"default"};return t.data_model&&t.data_model.interpretation&&(a=t.data_model.interpretation.find(function(t){return t.src==r})||t.data_model.interpretation.find(function(t){return t.src==n})),gudhub.mergeObjects(u,a)}},{key:"getInterpretation",value:function(t,n,r,a,u,i,o){var c=this,s=this;return new Promise(function(){var f=e(regeneratorRuntime.mark(function e(f,l){var p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(p=n&&n.data_type?n.data_type:r)?gudhub.ghconstructor.getInstance(p).then(function(e){if(e){var r=s.getInterpretationObj(n,e.getTemplate().model,a,o);e.getInterpretation(t,r.id,p,n,u,i).then(function(t){f(gudhub.mergeObjects(t,r))},function(t){l()})}},function(t){}):f(c.getDefaultInterpretation(t,n));case 2:case"end":return e.stop()}},e)}));return function(t,e){return f.apply(this,arguments)}}())}},{key:"getDefaultInterpretation",value:function(t,e){var n=t;return e&&e.forEach(function(e){e.value==t&&""!=t&&(n=e.name)}),n}},{key:"getInterpretationById",value:function(){var t=e(regeneratorRuntime.mark(function t(e,n,r,a){var u,i,o,c,s,f,l=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(u=l.length>4&&void 0!==l[4]?l[4]:null,i=l.length>5&&void 0!==l[5]?l[5]:null,null!=u){t.next=8;break}return t.next=5,this.gudhub.getFieldValue(e,n,r);case 5:t.t0=t.sent,t.next=9;break;case 8:t.t0=u;case 9:if(o=t.t0,null!=i){t.next=16;break}return t.next=13,this.gudhub.getField(e,r);case 13:t.t1=t.sent,t.next=17;break;case 16:t.t1=i;case 17:if(null!=(c=t.t1)){t.next=20;break}return t.abrupt("return","");case 20:return t.next=22,this.gudhub.ghconstructor.getInstance(c.data_type);case 22:return s=t.sent,t.next=25,s.getInterpretation(o,a,c.data_type,c,n,e);case 25:if("<span>no interpretation</span>"!=(f=t.sent).html){t.next=30;break}return t.abrupt("return",o);case 30:return t.abrupt("return",f.html);case 31:case"end":return t.stop()}},t,this)}));return function(e,n,r,a){return t.apply(this,arguments)}}()}]),t}();exports.Interpritate=u;
203
203
  },{}],"sPce":[function(require,module,exports) {
204
204
  "use strict";function e(e,o){switch(o.api){case"/items/update":console.log("/items/update - ",o),e.itemProcessor.updateItemsInStorage(o.app_id,o.response);break;case"/items/add":console.log("/items/add - ",o),e.itemProcessor.addItemsToStorage(o.app_id,o.response);break;case"/items/delete":console.log("/items/delete - ",o),e.itemProcessor.deleteItemsFromStorage(o.app_id,o.response);break;case"/app/update":console.log("/app/update - ",o),e.appProcessor.updatingAppInStorage(o.response);break;case"/file/delete":console.log("file/delete - ",o),e.fileManager.deleteFileFromStorage(o.response.file_id,o.app_id);break;case"/file/upload":console.log("file/upload - ",o),e.fileManager.addFileToStorage(o.app_id,o.response);break;case"/file/formupload":console.log("file/formupload - ",o);break;case"/file/update":e.fileManager.updateFileInStorage(o.response.file_id,o.response.app_id,o.response),console.log("file/update - ",o);break;case"/new/file/duplicate":e.fileManager.addFilesToStorage(o.app_id,o.response),console.log("new/file/duplicate - ",o);break;case"/api/new/document/insert-one":e.documentManager.emitDocumentInsert(o.response),console.log("/api/new/document/insert-one - ",o);break;default:console.warn("WEBSOCKETS is not process this API:",o.api)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebsocketHandler=e;
205
205
  },{}],"qJXG":[function(require,module,exports) {