@gudhub/core 1.1.31 → 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) {
@@ -60,36 +60,6 @@ export class GudHubHttpsService {
60
60
  return promise;
61
61
  }
62
62
 
63
-
64
- //********************* GET ***********************//
65
- async simpleGet(request) {
66
- const hesh = this.getHashCode(request);
67
-
68
- if (this.requestPromises[hesh]) {
69
- return this.requestPromises[hesh].promise;
70
- }
71
-
72
- const promise = new Promise((resolve, reject) => {
73
- const url = this.root + request.url;
74
-
75
- axios.get(url).then(function (response) {
76
- // handle success
77
- resolve(response.data);
78
- })
79
- .catch(function (err) {
80
- console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :", err.message);
81
- console.log("Request message: ", request);
82
- reject(err);
83
- });
84
-
85
- });
86
-
87
- this.pushPromise(promise, hesh);
88
-
89
- return promise;
90
- }
91
-
92
-
93
63
  //********************* POST ***********************//
94
64
  async post(request) {
95
65
  const hesh = this.getHashCode(request);
@@ -124,36 +94,35 @@ export class GudHubHttpsService {
124
94
  return promise;
125
95
  }
126
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
127
101
 
128
- //********************* SIMPLE POST ***********************//
129
- async simplePost(request) {
102
+ axiosRequest(request) {
130
103
  const hesh = this.getHashCode(request);
131
104
 
132
105
  if (this.requestPromises[hesh]) {
133
106
  return this.requestPromises[hesh].promise;
134
107
  }
135
108
 
136
- 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;
137
112
 
138
- axios.post(
139
- this.root + request.url,
140
- qs.stringify(request.form),
141
- {
142
- headers: request.headers || {
143
- "Content-Type": "application/x-www-form-urlencoded",
144
- },
145
- }
146
- ).then(function (response) {
147
- // handle success
148
- resolve(response.data);
149
- }).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) {
150
120
  console.log("ERROR -> GUDHUB HTTP SERVICE -> SIMPLE POST :", error.message);
151
121
  console.log("Request message: ", request);
152
122
  reject(error);
153
- });
154
-
123
+ }
155
124
  });
156
-
125
+
157
126
  this.pushPromise(promise, hesh);
158
127
 
159
128
  return promise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.1.31",
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),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:"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) {
@@ -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,7 +195,7 @@ 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) {