@gudhub/core 1.0.47 → 1.0.50

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.
@@ -107,22 +107,22 @@ export class FileManager {
107
107
  }
108
108
  }
109
109
 
110
- addFileToStorage(app_id, file) {
110
+ addFileToStorage(app_id, element_id, file) {
111
111
  const app = this.storage.getApp(app_id);
112
112
  if (app) {
113
113
  app.file_list.push(file);
114
114
  this.storage.updateApp(app);
115
- this.pipeService.emit("gh_file_upload", { app_id }, file);
115
+ this.pipeService.emit("gh_file_upload", { app_id, item_id: file.item_id, element_id }, file);
116
116
  }
117
117
  }
118
118
 
119
- addFilesToStorage(app_id, files) {
119
+ addFilesToStorage(app_id, element_id, files) {
120
120
  const app = this.storage.getApp(app_id);
121
121
  if (app) {
122
122
  app.file_list.push(...files);
123
123
  this.storage.updateApp(app);
124
124
  files.forEach(file => {
125
- this.pipeService.emit("gh_file_upload", { app_id }, file);
125
+ this.pipeService.emit("gh_file_upload", { app_id, item_id: file.item_id, element_id }, file);
126
126
  });
127
127
  }
128
128
  }
@@ -194,7 +194,7 @@ async getFiles(app_id, filesId = []) {
194
194
 
195
195
  async uploadFileFromString(fileObject) {
196
196
  const file = await this.uploadFileFromStringApi(fileObject);
197
- this.addFileToStorage(file.app_id, file);
197
+ this.addFileToStorage(file.app_id, fileObject.element_id, file);
198
198
  return file;
199
199
  }
200
200
 
@@ -9,7 +9,7 @@ import {
9
9
  import { group } from "./filter/group.js";
10
10
  import { searchValue } from "./filter/utils.js";
11
11
  import populateItems from "./populate_items/populate_items.js";
12
- import { populateWithDate, getDate } from "./get_date/get_date.js";
12
+ import { populateWithDate, getDate, checkRecurringDate } from "./get_date/get_date.js";
13
13
  import { mergeObjects } from "./merge_objects/merge_objects.js";
14
14
  import { mergeChunks } from "./merge_chunks/merge_chunks.js";
15
15
  import { getInterpretedValue } from "./interpretation/interpretation.js";
@@ -85,6 +85,10 @@ export class Utils {
85
85
  return getDate(queryKey);
86
86
  }
87
87
 
88
+ checkRecurringDate(date, option) {
89
+ return checkRecurringDate(date, option);
90
+ }
91
+
88
92
  populateItems(items, model, keep_data) {
89
93
  return populateItems(items, model, keep_data);
90
94
  }
@@ -171,6 +171,13 @@ class Checker {
171
171
  );
172
172
  };
173
173
  break;
174
+ case "recurring_date":
175
+ this._checkFn = function (data, filtersValues) {
176
+ return filtersValues.some((_filter) =>
177
+ data.some((_dataItem) => gudhub.checkRecurringDate(_dataItem, _filter))
178
+ );
179
+ };
180
+ break;
174
181
  }
175
182
  return this;
176
183
  }
@@ -236,6 +243,16 @@ class BooleanFetchStrategy {
236
243
  }
237
244
  }
238
245
 
246
+ class RecurringDateStrategy {
247
+ convert(val) {
248
+ return [Number(val)];
249
+ }
250
+
251
+ convertFilterValue(val) {
252
+ return String(val);
253
+ }
254
+ }
255
+
239
256
  class Aggregate {
240
257
  constructor() {
241
258
  this._strategies = {
@@ -244,6 +261,7 @@ class Aggregate {
244
261
  booleanStrategy: new BooleanFetchStrategy(),
245
262
  rangeStrategy: new RangeFetchStrategy(),
246
263
  dateStrategy: new dateFetchStrategy(),
264
+ recurringDateStrategy: new RecurringDateStrategy()
247
265
  };
248
266
  }
249
267
 
@@ -277,6 +295,8 @@ class Aggregate {
277
295
  case "value":
278
296
  this._currentStrategy = this._strategies.booleanStrategy;
279
297
  break;
298
+ case "recurring_date":
299
+ this._currentStrategy = this._strategies.recurringDateStrategy
280
300
  }
281
301
  return this;
282
302
  }
@@ -88,3 +88,45 @@ export function getDate(queryKey) {
88
88
  return date.getTime();
89
89
  }
90
90
  }
91
+
92
+ //********************** CHECK RECURRING DATE ************************//
93
+
94
+ export function checkRecurringDate(date, option) {
95
+
96
+ date = new Date(date);
97
+
98
+ let currentDate = new Date();
99
+
100
+ switch (option) {
101
+ case 'day':
102
+ if(date.getDate() + '.' + date.getMonth() === currentDate.getDate() + '.' + currentDate.getMonth()) {
103
+ return true;
104
+ } else {
105
+ return false;
106
+ }
107
+ case 'week':
108
+ if(getWeek(currentDate) === getWeek(date)) {
109
+ return true;
110
+ } else {
111
+ return false;
112
+ }
113
+ case 'month':
114
+ if(date.getMonth() === currentDate.getMonth()) {
115
+ return true;
116
+ } else {
117
+ return false;
118
+ }
119
+ default:
120
+ return true;
121
+ }
122
+
123
+ function getWeek(date) {
124
+ let d = new Date(date.getFullYear(), date.getMonth(), date.getDate());
125
+ let dayNumber = d.getDay();
126
+ d.setDate(d.getDate() + 4 - dayNumber);
127
+ let firstJanuary = new Date(date.getFullYear(), 0, 1);
128
+ let weekNumber = Math.ceil((((d- firstJanuary) / 86400000) + 1) / 7);
129
+ return weekNumber;
130
+ }
131
+
132
+ }
@@ -50,4 +50,37 @@ describe("GET DATE", function () {
50
50
  let day = gudhub.getDate('this_saturday');
51
51
  day.getDay().should.equal(6);
52
52
  });
53
+
54
+ it("CHECK IF DATE TODAY", function() {
55
+ let today = new Date();
56
+ let result = gudhub.checkRecurringDate(today, 'day');
57
+ result.should.equal(true);
58
+
59
+ let tommorow = new Date();
60
+ tommorow.setDate(tommorow.getDate() + 1);
61
+ result = gudhub.checkRecurringDate(tommorow, 'day');
62
+ result.should.equal(false);
63
+ })
64
+
65
+ it("CHECK IF DATE IN THIS WEEK", function() {
66
+ let today = new Date();
67
+ let result = gudhub.checkRecurringDate(today, 'week');
68
+ result.should.equal(true);
69
+
70
+ let twoWeeksLater = new Date();
71
+ twoWeeksLater.setDate(twoWeeksLater.getDate() + 14);
72
+ result = gudhub.checkRecurringDate(twoWeeksLater, 'week');
73
+ result.should.equal(false);
74
+ });
75
+
76
+ it("CHECK IF DATE IN THIS MONTH", function() {
77
+ let today = new Date();
78
+ let result = gudhub.checkRecurringDate(today, 'month');
79
+ result.should.equal(true);
80
+
81
+ let twoMonthsLater = new Date();
82
+ twoMonthsLater.setDate(twoMonthsLater.getDate() + 60);
83
+ result = gudhub.checkRecurringDate(twoMonthsLater, 'month');
84
+ result.should.equal(false);
85
+ });
53
86
  });
package/GUDHUB/gudhub.js CHANGED
@@ -178,6 +178,10 @@ export class GudHub {
178
178
  return this.util.populateWithDate(items, model);
179
179
  }
180
180
 
181
+ checkRecurringDate(date, option) {
182
+ return this.util.checkRecurringDate(date, option);
183
+ }
184
+
181
185
  populateItems(items, model, keep_data) {
182
186
  return this.util.populateItems(items, model, keep_data);
183
187
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.0.47",
3
+ "version": "1.0.50",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -118,7 +118,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
118
118
  },{}],"zsiC":[function(require,module,exports) {
119
119
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDate=c,exports.getDistanceFromLatLonInKm=l,exports.isSimilarStrings=g,exports.searchValue=d;var e=t(require("fuse.js"));function t(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return i(e)||u(e,t)||a(e,t)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}function o(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 u(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],u=!0,i=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(l){i=!0,a=l}finally{try{u||null==r.return||r.return()}finally{if(i)throw a}}return o}}function i(e){if(Array.isArray(e))return e}function l(e,t){var n=r(e.split(":"),3),a=n[0],o=n[1],u=n[2],i=r(t.split(":"),2),l=i[0],c=i[1],f=s(l-a),h=s(c-o),d=Math.sin(f/2)*Math.sin(f/2)+Math.cos(s(a))*Math.cos(s(l))*Math.sin(h/2)*Math.sin(h/2),v=6371*(2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)));return Number(u)>=v}function s(e){return e*(Math.PI/180)}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.type,n=e.date,a=void 0===n?0:n,o=e.match,u=void 0===o||o,i=arguments.length>1?arguments[1]:void 0;if(!i&&t)return!1;var l=new Date,s=!0;switch(t){case"day":var c=h(a),d=h(a+1);s=c<=i&&i<d;break;case"days":if(a<0){var v=h(1);s=h(-6)<=i&&i<v}else{var g=h(),y=h(7);s=g<=i&&i<y}break;case"day_week":s=a===new Date(i).getDay();break;case"week":var w=l.getDate()-l.getDay(),p=w+6,b=r(f(l.setDate(w+7*a),l.setDate(p+7*a)),2),D=b[0],m=b[1];s=D<=i&&i<=m;break;case"month":if(l.getFullYear()!==new Date(i).getFullYear())return!1;s=l.getMonth()+a===new Date(i).getMonth();break;case"year":s=l.getFullYear()+a===new Date(i).getFullYear();break;default:return!0}return u?s:!s}function f(e,t){return[new Date(e),new Date(t)]}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e).valueOf()}function d(e,t){if(e&&e.length)return t?e.filter(function(e){return e.fields.find(function(e){return e.index_value&&-1!==e.index_value.toLowerCase().indexOf(t.toLowerCase())})}):e}var v=new e.default([]);function g(e,t){return v.setCollection(t),Boolean(v.search(e).length)}
120
120
  },{"fuse.js":"jqRt"}],"mbGN":[function(require,module,exports) {
121
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=b;var e=require("./utils.js");function t(e){return(t="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 n(e,t){return c(e)||i(e,t)||u(e,t)||r()}function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,u,o=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(a){c=!0,u=a}finally{try{i||null==n.return||n.return()}finally{if(c)throw u}}return o}}function c(e){if(Array.isArray(e))return e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=y();return function(){var n,r=_(e);if(t){var u=_(this).constructor;n=Reflect.construct(r,arguments,u)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(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 g(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e,t){var n=new O,r=new k;return e&&e.length?e.filter(function(e){return t.filter(function(e){return e.valuesArray.length}).every(function(t){var u=e.fields.find(function(e){return t.field_id==e.field_id});return n.setStrategy(t.search_type).setEntity(u&&null!=u.field_value?u.field_value:null).setFilterValues(t.valuesArray),r.check(n)})}):[]}var k=function(){function t(){p(this,t)}return g(t,[{key:"changeBehavior",value:function(t){switch(t){case"contain_or":this._checkFn=function(e,t){return t.some(function(t){return e.some(function(e){return-1!==e.indexOf(t)})})};break;case"contain_and":this._checkFn=function(e,t){return t.every(function(t){return e.some(function(e){return-1!==e.indexOf(t)})})};break;case"not_contain_or":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return-1===e.indexOf(t)})})};break;case"not_contain_and":this._checkFn=function(e,t){return t.every(function(t){return e.every(function(e){return-1===e.indexOf(t)})})};break;case"equal_or":this._checkFn=function(e,t){return!!e.length&&e.some(function(e){return t.some(function(t){return e==t})})};break;case"equal_and":this._checkFn=function(e,t){if(!e.length)return!1;for(var n=new Set(t);e.length&&n.size;){var r=e.pop();n.has(r)&&n.delete(r)}return!n.size};break;case"not_equal_or":this._checkFn=function(e,t){if(!e.length)return!0;for(var n=new Set(t);e.length&&n.size;){var r=e.pop();if(!n.has(r))return!0}return!1};break;case"not_equal_and":this._checkFn=function(e,t){for(var n=new Set(t);e.length&&n.size;){var r=e.pop();if(n.has(r))return!1}return!0};break;case"bigger":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return e>t})})};break;case"lower":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return e<t})})};break;case"range":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return t.start<=e&&e<t.end})})};break;case"value":this._checkFn=function(e,t){return t.some(function(t){return e.some(function(e){return e==t})})};break;case"search":this._checkFn=function(t,n){return n.some(function(n){return(0,e.isSimilarStrings)(n,t)})};break;case"phone_equal_or":this._checkFn=function(e,t){return!!e.length&&t.some(function(t){return e.some(function(e){return-1!==e.replace(/[^0-9]/g,"").indexOf(t.replace(/[^0-9]/g,""))})})};break;case"distance":this._checkFn=function(t,n){return n.some(function(n){return t.some(function(t){return(0,e.getDistanceFromLatLonInKm)(n,t)})})};break;case"date_in":case"date_out":this._checkFn=function(t,n){return n.some(function(n){return t.some(function(t){return(0,e.getDate)(n,t)})})}}return this}},{key:"check",value:function(e){return this.changeBehavior(e.getCheckOption())._checkFn(e.getEntity(),e.getFilterValues())}}]),t}(),d=function(){function e(){p(this,e)}return g(e,[{key:"convert",value:function(e){return[Number(e)]}},{key:"convertFilterValue",value:function(e){return Number(e)}}]),e}(),m=function(e){a(n,d);var t=f(n);function n(){return p(this,n),t.apply(this,arguments)}return g(n,[{key:"convertFilterValue",value:function(e){return{start:Number(e.split(":")[0]),end:Number(e.split(":")[1])}}}]),n}(),S=function(){function e(){p(this,e)}return g(e,[{key:"convert",value:function(e){return String(null!=e?e:"").toLowerCase().split(",")}},{key:"convertFilterValue",value:function(e){return 0===e?"0":String(e||"").toLowerCase()}}]),e}(),w=function(e){a(r,d);var t=f(r);function r(){return p(this,r),t.apply(this,arguments)}return g(r,[{key:"convertFilterValue",value:function(e){var t=n(e.split(":"),3),r=t[0],u=t[1],o=t[2];return{type:r,date:Number(u),match:!!Number(o)}}}]),r}(),F=function(){function e(){p(this,e)}return g(e,[{key:"convert",value:function(e){return[String(Boolean(e))]}},{key:"convertFilterValue",value:function(e){return String(e)}}]),e}(),O=function(){function e(){p(this,e),this._strategies={stringStrategy:new S,numberStrategy:new d,booleanStrategy:new F,rangeStrategy:new m,dateStrategy:new w}}return g(e,[{key:"setStrategy",value:function(e){switch(this._checkOption=e,e){case"contain_or":case"contain_and":case"not_contain_or":case"not_contain_and":case"equal_or":case"equal_and":case"not_equal_or":case"not_equal_and":case"phone_equal_or":case"distance":case"search":this._currentStrategy=this._strategies.stringStrategy;break;case"bigger":case"lower":this._currentStrategy=this._strategies.numberStrategy;break;case"range":this._currentStrategy=this._strategies.rangeStrategy;break;case"date_in":case"date_out":this._currentStrategy=this._strategies.dateStrategy;break;case"value":this._currentStrategy=this._strategies.booleanStrategy}return this}},{key:"setEntity",value:function(e){return this._entity=this._currentStrategy.convert(e),this}},{key:"getEntity",value:function(){return this._entity}},{key:"setFilterValues",value:function(e){var t=this,n=Array.isArray(e)?e:[e];return this._filterValues=n.map(function(e){return t._currentStrategy.convertFilterValue(e)}),this}},{key:"getFilterValues",value:function(){return this._filterValues}},{key:"getCheckOption",value:function(){return this._checkOption}}]),e}();
121
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=b;var e=require("./utils.js");function t(e){return(t="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 n(e,t){return c(e)||o(e,t)||u(e,t)||r()}function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){if(e){if("string"==typeof e)return i(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)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,u,i=[],o=!0,c=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(a){c=!0,u=a}finally{try{o||null==n.return||n.return()}finally{if(c)throw u}}return i}}function c(e){if(Array.isArray(e))return e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=y();return function(){var n,r=_(e);if(t){var u=_(this).constructor;n=Reflect.construct(r,arguments,u)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(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 p(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e,t){var n=new j,r=new k;return e&&e.length?e.filter(function(e){return t.filter(function(e){return e.valuesArray.length}).every(function(t){var u=e.fields.find(function(e){return t.field_id==e.field_id});return n.setStrategy(t.search_type).setEntity(u&&null!=u.field_value?u.field_value:null).setFilterValues(t.valuesArray),r.check(n)})}):[]}var k=function(){function t(){g(this,t)}return p(t,[{key:"changeBehavior",value:function(t){switch(t){case"contain_or":this._checkFn=function(e,t){return t.some(function(t){return e.some(function(e){return-1!==e.indexOf(t)})})};break;case"contain_and":this._checkFn=function(e,t){return t.every(function(t){return e.some(function(e){return-1!==e.indexOf(t)})})};break;case"not_contain_or":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return-1===e.indexOf(t)})})};break;case"not_contain_and":this._checkFn=function(e,t){return t.every(function(t){return e.every(function(e){return-1===e.indexOf(t)})})};break;case"equal_or":this._checkFn=function(e,t){return!!e.length&&e.some(function(e){return t.some(function(t){return e==t})})};break;case"equal_and":this._checkFn=function(e,t){if(!e.length)return!1;for(var n=new Set(t);e.length&&n.size;){var r=e.pop();n.has(r)&&n.delete(r)}return!n.size};break;case"not_equal_or":this._checkFn=function(e,t){if(!e.length)return!0;for(var n=new Set(t);e.length&&n.size;){var r=e.pop();if(!n.has(r))return!0}return!1};break;case"not_equal_and":this._checkFn=function(e,t){for(var n=new Set(t);e.length&&n.size;){var r=e.pop();if(n.has(r))return!1}return!0};break;case"bigger":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return e>t})})};break;case"lower":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return e<t})})};break;case"range":this._checkFn=function(e,t){return t.some(function(t){return e.every(function(e){return t.start<=e&&e<t.end})})};break;case"value":this._checkFn=function(e,t){return t.some(function(t){return e.some(function(e){return e==t})})};break;case"search":this._checkFn=function(t,n){return n.some(function(n){return(0,e.isSimilarStrings)(n,t)})};break;case"phone_equal_or":this._checkFn=function(e,t){return!!e.length&&t.some(function(t){return e.some(function(e){return-1!==e.replace(/[^0-9]/g,"").indexOf(t.replace(/[^0-9]/g,""))})})};break;case"distance":this._checkFn=function(t,n){return n.some(function(n){return t.some(function(t){return(0,e.getDistanceFromLatLonInKm)(n,t)})})};break;case"date_in":case"date_out":this._checkFn=function(t,n){return n.some(function(n){return t.some(function(t){return(0,e.getDate)(n,t)})})};break;case"recurring_date":this._checkFn=function(e,t){return t.some(function(t){return e.some(function(e){return gudhub.checkRecurringDate(e,t)})})}}return this}},{key:"check",value:function(e){return this.changeBehavior(e.getCheckOption())._checkFn(e.getEntity(),e.getFilterValues())}}]),t}(),d=function(){function e(){g(this,e)}return p(e,[{key:"convert",value:function(e){return[Number(e)]}},{key:"convertFilterValue",value:function(e){return Number(e)}}]),e}(),m=function(e){a(n,d);var t=f(n);function n(){return g(this,n),t.apply(this,arguments)}return p(n,[{key:"convertFilterValue",value:function(e){return{start:Number(e.split(":")[0]),end:Number(e.split(":")[1])}}}]),n}(),S=function(){function e(){g(this,e)}return p(e,[{key:"convert",value:function(e){return String(null!=e?e:"").toLowerCase().split(",")}},{key:"convertFilterValue",value:function(e){return 0===e?"0":String(e||"").toLowerCase()}}]),e}(),w=function(e){a(r,d);var t=f(r);function r(){return g(this,r),t.apply(this,arguments)}return p(r,[{key:"convertFilterValue",value:function(e){var t=n(e.split(":"),3),r=t[0],u=t[1],i=t[2];return{type:r,date:Number(u),match:!!Number(i)}}}]),r}(),F=function(){function e(){g(this,e)}return p(e,[{key:"convert",value:function(e){return[String(Boolean(e))]}},{key:"convertFilterValue",value:function(e){return String(e)}}]),e}(),O=function(){function e(){g(this,e)}return p(e,[{key:"convert",value:function(e){return[Number(e)]}},{key:"convertFilterValue",value:function(e){return String(e)}}]),e}(),j=function(){function e(){g(this,e),this._strategies={stringStrategy:new S,numberStrategy:new d,booleanStrategy:new F,rangeStrategy:new m,dateStrategy:new w,recurringDateStrategy:new O}}return p(e,[{key:"setStrategy",value:function(e){switch(this._checkOption=e,e){case"contain_or":case"contain_and":case"not_contain_or":case"not_contain_and":case"equal_or":case"equal_and":case"not_equal_or":case"not_equal_and":case"phone_equal_or":case"distance":case"search":this._currentStrategy=this._strategies.stringStrategy;break;case"bigger":case"lower":this._currentStrategy=this._strategies.numberStrategy;break;case"range":this._currentStrategy=this._strategies.rangeStrategy;break;case"date_in":case"date_out":this._currentStrategy=this._strategies.dateStrategy;break;case"value":this._currentStrategy=this._strategies.booleanStrategy;break;case"recurring_date":this._currentStrategy=this._strategies.recurringDateStrategy}return this}},{key:"setEntity",value:function(e){return this._entity=this._currentStrategy.convert(e),this}},{key:"getEntity",value:function(){return this._entity}},{key:"setFilterValues",value:function(e){var t=this,n=Array.isArray(e)?e:[e];return this._filterValues=n.map(function(e){return t._currentStrategy.convertFilterValue(e)}),this}},{key:"getFilterValues",value:function(){return this._filterValues}},{key:"getCheckOption",value:function(){return this._checkOption}}]),e}();
122
122
  },{"./utils.js":"zsiC"}],"h8f7":[function(require,module,exports) {
123
123
  var define;
124
124
  var global = arguments[3];
@@ -147,7 +147,7 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
147
147
  },{"../addDays/index.js":"gKTe","../addMonths/index.js":"aD4K","../toDate/index.js":"dYQD","../_lib/requiredArgs/index.js":"wNNf","../_lib/toInteger/index.js":"Rltm"}],"kCXN":[function(require,module,exports) {
148
148
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=a;var e=n(require("../addDays/index.js")),t=n(require("../toDate/index.js")),r=n(require("../_lib/toInteger/index.js")),u=n(require("../_lib/requiredArgs/index.js"));function n(e){return e&&e.__esModule?e:{default:e}}function a(n,a,l){(0,u.default)(2,arguments);var s=l||{},d=s.locale,i=d&&d.options&&d.options.weekStartsOn,o=null==i?0:(0,r.default)(i),f=null==s.weekStartsOn?o:(0,r.default)(s.weekStartsOn);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var x=(0,t.default)(n),p=(0,r.default)(a),w=x.getDay(),c=7-f,_=p<0||p>6?p-(w+c)%7:((p%7+7)%7+c)%7-(w+c)%7;return(0,e.default)(x,_)}module.exports=exports.default;
149
149
  },{"../addDays/index.js":"gKTe","../toDate/index.js":"dYQD","../_lib/toInteger/index.js":"Rltm","../_lib/requiredArgs/index.js":"wNNf"}],"VzfS":[function(require,module,exports) {
150
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDate=s,exports.populateWithDate=r;var e=a(require("date-fns/add/index.js")),t=a(require("date-fns/setDay/index.js"));function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return e.forEach(function(e){t.forEach(function(t){var a=e.fields.find(function(e){return e.element_id==t.element_id});a?a.field_value=s(t.date_type):e.fields.push({field_id:t.element_id,element_id:t.element_id,field_value:s(t.date_type)})})}),e}function s(a){var r=new Date;switch(a){case"next_day":return(0,e.default)(r,{days:1}).getTime();case"two_days_after":return(0,e.default)(r,{days:2}).getTime();case"three_days_after":return(0,e.default)(r,{days:3}).getTime();case"four_days_after":return(0,e.default)(r,{days:4}).getTime();case"next_week":return(0,e.default)(r,{weeks:1}).getTime();case"two_weeks_after":return(0,e.default)(r,{weeks:2}).getTime();case"three_weeks_after":return(0,e.default)(r,{weeks:3}).getTime();case"this_sunday":return(0,t.default)(r,0,{weekStartsOn:1});case"this_monday":return(0,t.default)(r,1,{weekStartsOn:1});case"this_tuesday":return(0,t.default)(r,2,{weekStartsOn:1});case"this_wednesday":return(0,t.default)(r,3,{weekStartsOn:1});case"this_thursday":return(0,t.default)(r,4,{weekStartsOn:1});case"this_friday":return(0,t.default)(r,5,{weekStartsOn:1});case"this_saturday":return(0,t.default)(r,6,{weekStartsOn:1});case"now":default:return r.getTime()}}
150
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkRecurringDate=s,exports.getDate=n,exports.populateWithDate=r;var e=a(require("date-fns/add/index.js")),t=a(require("date-fns/setDay/index.js"));function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return e.forEach(function(e){t.forEach(function(t){var a=e.fields.find(function(e){return e.element_id==t.element_id});a?a.field_value=n(t.date_type):e.fields.push({field_id:t.element_id,element_id:t.element_id,field_value:n(t.date_type)})})}),e}function n(a){var r=new Date;switch(a){case"next_day":return(0,e.default)(r,{days:1}).getTime();case"two_days_after":return(0,e.default)(r,{days:2}).getTime();case"three_days_after":return(0,e.default)(r,{days:3}).getTime();case"four_days_after":return(0,e.default)(r,{days:4}).getTime();case"next_week":return(0,e.default)(r,{weeks:1}).getTime();case"two_weeks_after":return(0,e.default)(r,{weeks:2}).getTime();case"three_weeks_after":return(0,e.default)(r,{weeks:3}).getTime();case"this_sunday":return(0,t.default)(r,0,{weekStartsOn:1});case"this_monday":return(0,t.default)(r,1,{weekStartsOn:1});case"this_tuesday":return(0,t.default)(r,2,{weekStartsOn:1});case"this_wednesday":return(0,t.default)(r,3,{weekStartsOn:1});case"this_thursday":return(0,t.default)(r,4,{weekStartsOn:1});case"this_friday":return(0,t.default)(r,5,{weekStartsOn:1});case"this_saturday":return(0,t.default)(r,6,{weekStartsOn:1});case"now":default:return r.getTime()}}function s(e,t){e=new Date(e);var a=new Date;switch(t){case"day":return e.getDate()+"."+e.getMonth()==a.getDate()+"."+a.getMonth();case"week":return r(a)===r(e);case"month":return e.getMonth()===a.getMonth();default:return!0}function r(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate()),a=t.getDay();t.setDate(t.getDate()+4-a);var r=new Date(e.getFullYear(),0,1);return Math.ceil(((t-r)/864e5+1)/7)}}
151
151
  },{"date-fns/add/index.js":"YNMJ","date-fns/setDay/index.js":"kCXN"}],"EE1j":[function(require,module,exports) {
152
152
  "use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(t)}function t(r,t,e){return i(r,t,e)}function e(t){return t&&"object"===r(t)&&"[object RegExp]"!==Object.prototype.toString.call(t)&&"[object Date]"!==Object.prototype.toString.call(t)}function n(r){return Array.isArray(r)?[]:{}}function o(r,t){return t&&!0===t.clone&&e(r)?i(n(r),r,t):r}function c(r,t,n){var c=r.slice();return t.forEach(function(t,u){void 0===c[u]?c[u]=o(t,n):e(t)?c[u]=i(r[u],t,n):-1===r.indexOf(t)&&c.push(o(t,n))}),c}function u(r,t,n){var c={};return e(r)&&Object.keys(r).forEach(function(t){c[t]=o(r[t],n)}),Object.keys(t).forEach(function(u){e(t[u])&&r[u]?c[u]=i(r[u],t[u],n):c[u]=o(t[u],n)}),c}function i(r,t,e){var n=Array.isArray(t),i=(e||{arrayMerge:c}).arrayMerge||c;return n?Array.isArray(r)?i(r,t,e):o(t,e):u(r,t,e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.mergeObjects=t,i.all=function(r,t){if(!Array.isArray(r)||r.length<2)throw new Error("first argument should be an array with at least two elements");return r.reduce(function(r,e){return i(r,e,t)})};
153
153
  },{}],"AMYJ":[function(require,module,exports) {
@@ -161,7 +161,7 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
161
161
  },{}],"nKaW":[function(require,module,exports) {
162
162
  "use strict";function e(e){return u(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 u(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 i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach(function(r){c(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e,r,t,n,u,a,i){try{var o=e[a](i),c=o.value}catch(p){return void t(p)}o.done?r(c):Promise.resolve(c).then(n,u)}function s(e){return function(){var r=this,t=arguments;return new Promise(function(n,u){var a=e.apply(r,t);function i(e){p(a,n,u,i,o,"next",e)}function o(e){p(a,n,u,i,o,"throw",e)}i(void 0)})}}function f(r,t,n,u){function a(e,r,t){return i.apply(this,arguments)}function i(){return(i=s(regeneratorRuntime.mark(function e(r,t,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(u=null,"array"!==r.type){e.next=13;break}if(!Number(r.is_static)){e.next=10;break}return e.t0=Array,e.next=6,m(r.childs,t,n);case 6:e.t1=e.sent,u=new e.t0(e.t1),e.next=13;break;case 10:return e.next=12,p(r,t,n);case 12:u=e.sent;case 13:if("object"!==r.type){e.next=23;break}if(!Number(r.current_item)){e.next=20;break}return e.next=17,l(r,t);case 17:u=e.sent,e.next=23;break;case 20:return e.next=22,m(r.childs,t,n);case 22:u=e.sent;case 23:if("property"!==r.type){e.next=27;break}return e.next=26,y(r,t,n);case 26:u=e.sent;case 27:return e.abrupt("return",c({},r.property_name,u));case 28:case"end":return e.stop()}},e)}))).apply(this,arguments)}function p(e,r,t){return f.apply(this,arguments)}function f(){return(f=s(regeneratorRuntime.mark(function e(r,t,u){var a,i,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.gudhub.getApp(Number(r.app_id));case 2:return a=e.sent,e.next=5,x(r.filter,a.items_list,u,t);case 5:return i=e.sent,o=i.map(function(){var e=s(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",m(r.childs,t,a));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}()),e.abrupt("return",Promise.all(o));case 8:case"end":return e.stop()}},e)}))).apply(this,arguments)}function l(e,r){return b.apply(this,arguments)}function b(){return(b=s(regeneratorRuntime.mark(function e(r,t){var u,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.gudhub.getApp(r.app_id);case 2:return u=e.sent,a=u.items_list||[],e.abrupt("return",m(r.childs,t||a[0],u));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(e,r,t){return d.apply(this,arguments)}function d(){return(d=s(regeneratorRuntime.mark(function e(r,t,n){var u,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.map(function(){var e=s(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a(r,t,n));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}());case 2:return u=e.sent,e.next=5,Promise.all(u);case 5:return i=e.sent,e.abrupt("return",i.reduce(function(e,r){return o(o({},e),r)},{}));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function y(e,r,t){return h.apply(this,arguments)}function h(){return(h=s(regeneratorRuntime.mark(function e(r,t,u){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.property_type,e.next="static"===e.t0?3:"variable"===e.t0?4:"field_id"===e.t0?9:(e.t0,10);break;case 3:return e.abrupt("return",r.static_field_value);case 4:e.t1=r.variable_type,e.next="app_id"===e.t1?7:(e.t1,8);break;case 7:return e.abrupt("return",u.app_id);case 8:return e.abrupt("return","".concat(u.app_id,".").concat(t.item_id));case 9:return e.abrupt("return",r.field_id);case 10:if(!Boolean(Number(r.interpretation))){e.next=14;break}return e.abrupt("return",n.gudhub.getInterpretedValue(Number(u.app_id),Number(t.item_id),Number(r.field_id)));case 14:return e.abrupt("return",n.gudhub.getFieldValue(Number(u.app_id),Number(t.item_id),Number(r.field_id)));case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}function g(e,r,t,n){return v.apply(this,arguments)}function v(){return(v=s(regeneratorRuntime.mark(function r(t,a,i,o){var c;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.gudhub.prefilter(t,a,i,u);case 2:return c=r.sent,r.abrupt("return",n.gudhub.filter(o,[].concat(e(c),e(t))));case 4:case"end":return r.stop()}},r)}))).apply(this,arguments)}function x(){return w.apply(this,arguments)}function w(){return(w=s(regeneratorRuntime.mark(function r(){var t,n,u,a,i=arguments;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:[],n=i.length>1&&void 0!==i[1]?i[1]:[],u=i.length>2&&void 0!==i[2]?i[2]:{},a=i.length>3&&void 0!==i[3]?i[3]:{},r.abrupt("return",t.length?g(t,u.app_id,a.item_id,n):e(n));case 5:case"end":return r.stop()}},r)}))).apply(this,arguments)}return a(r,t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compiler=f;
163
163
  },{}],"mWlG":[function(require,module,exports) {
164
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=v(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"),o=require("./filter/utils.js"),u=v(require("./populate_items/populate_items.js")),a=require("./get_date/get_date.js"),s=require("./merge_objects/merge_objects.js"),l=require("./merge_chunks/merge_chunks.js"),c=require("./interpretation/interpretation.js"),f=require("./nested_list/nested_list.js"),p=require("./compare_items_lists_worker/compare_items_lists.worker.js"),m=require("./json_constructor/json_constructor.js");function v(e){return e&&e.__esModule?e:{default:e}}function h(e){return _(e)||y(e)||d(e)||g()}function g(){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 d(e,t){if(e){if("string"==typeof e)return j(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)?j(e,t):void 0}}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _(e){if(Array.isArray(e))return j(e)}function j(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 k(e,t,r,n,i,o,u){try{var a=e[o](u),s=a.value}catch(l){return void r(l)}a.done?t(s):Promise.resolve(s).then(n,i)}function b(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function u(e){k(o,n,i,u,a,"next",e)}function a(e){k(o,n,i,u,a,"throw",e)}u(void 0)})}}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(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 q(e,t,r){return t&&I(e.prototype,t),r&&I(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var A=function(){function v(e){w(this,v),this.gudhub=e}return q(v,[{key:"prefilter",value:function(t,r,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return(0,e.filterPreparation)(t,r,n,i,this.gudhub.storage,this.gudhub.pipeService,o)}},{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=b(regeneratorRuntime.mark(function e(){var t,r,n,i,u,a,s,l,c,f,p,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,u=m.length>4?m[4]:void 0,a=m.length>5&&void 0!==m[5]?m[5]:"",s=m.length>6?m[6]:void 0,l=m.length>7?m[7]:void 0,e.next=10,this.prefilter(r,n,i,u);case 10:return c=e.sent,f=this.filter(t,[].concat(h(r),h(c))),p=this.group(a,f),e.abrupt("return",p.filter(function(e){return!s||1===(0,o.searchValue)([e],s).length}).filter(function(e){return!l||1===(0,o.searchValue)([e],l).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,a.getDate)(e)}},{key:"populateItems",value:function(e,t,r){return(0,u.default)(e,t,r)}},{key:"getInterpretedValue",value:function(e,t,r){return(0,c.getInterpretedValue)(this.gudhub,e,t,r)}},{key:"populateWithDate",value:function(e,t){return(0,a.populateWithDate)(e,t)}},{key:"populateWithItemRef",value:function(e,t,r,i,o,u){return(0,n.populateWithItemRef)(e,t,r,i,o,u)}},{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,s.mergeObjects)(e,t,r)}},{key:"makeNestedList",value:function(e,t,r,n,i){return(0,f.makeNestedList)(e,t,r,n,i)}},{key:"mergeChunks",value:function(e){return(0,l.mergeChunks)(e)}},{key:"jsonConstructor",value:function(e,t,r){return(0,m.compiler)(e,t,this,r)}},{key:"compareAppsItemsLists",value:function(e,t,r){var n=new Blob([(0,p.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)})}}]),v}();exports.Utils=A;
164
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=v(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"),o=v(require("./populate_items/populate_items.js")),a=require("./get_date/get_date.js"),s=require("./merge_objects/merge_objects.js"),l=require("./merge_chunks/merge_chunks.js"),c=require("./interpretation/interpretation.js"),f=require("./nested_list/nested_list.js"),p=require("./compare_items_lists_worker/compare_items_lists.worker.js"),m=require("./json_constructor/json_constructor.js");function v(e){return e&&e.__esModule?e:{default:e}}function h(e){return k(e)||y(e)||d(e)||g()}function g(){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 d(e,t){if(e){if("string"==typeof e)return _(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)?_(e,t):void 0}}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function k(e){if(Array.isArray(e))return _(e)}function _(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 j(e,t,r,n,i,u,o){try{var a=e[u](o),s=a.value}catch(l){return void r(l)}a.done?t(s):Promise.resolve(s).then(n,i)}function b(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var u=e.apply(t,r);function o(e){j(u,n,i,o,a,"next",e)}function a(e){j(u,n,i,o,a,"throw",e)}o(void 0)})}}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(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 q(e,t,r){return t&&I(e.prototype,t),r&&I(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var A=function(){function v(e){w(this,v),this.gudhub=e}return q(v,[{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=b(regeneratorRuntime.mark(function e(){var t,r,n,i,o,a,s,l,c,f,p,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,o=m.length>4?m[4]:void 0,a=m.length>5&&void 0!==m[5]?m[5]:"",s=m.length>6?m[6]:void 0,l=m.length>7?m[7]:void 0,e.next=10,this.prefilter(r,n,i,o);case 10:return c=e.sent,f=this.filter(t,[].concat(h(r),h(c))),p=this.group(a,f),e.abrupt("return",p.filter(function(e){return!s||1===(0,u.searchValue)([e],s).length}).filter(function(e){return!l||1===(0,u.searchValue)([e],l).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,a.getDate)(e)}},{key:"checkRecurringDate",value:function(e,t){return(0,a.checkRecurringDate)(e,t)}},{key:"populateItems",value:function(e,t,r){return(0,o.default)(e,t,r)}},{key:"getInterpretedValue",value:function(e,t,r){return(0,c.getInterpretedValue)(this.gudhub,e,t,r)}},{key:"populateWithDate",value:function(e,t){return(0,a.populateWithDate)(e,t)}},{key:"populateWithItemRef",value:function(e,t,r,i,u,o){return(0,n.populateWithItemRef)(e,t,r,i,u,o)}},{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,s.mergeObjects)(e,t,r)}},{key:"makeNestedList",value:function(e,t,r,n,i){return(0,f.makeNestedList)(e,t,r,n,i)}},{key:"mergeChunks",value:function(e){return(0,l.mergeChunks)(e)}},{key:"jsonConstructor",value:function(e,t,r){return(0,m.compiler)(e,t,this,r)}},{key:"compareAppsItemsLists",value:function(e,t,r){var n=new Blob([(0,p.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)})}}]),v}();exports.Utils=A;
165
165
  },{"./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","./interpretation/interpretation.js":"pMyP","./nested_list/nested_list.js":"S7Iy","./compare_items_lists_worker/compare_items_lists.worker.js":"xR4c","./json_constructor/json_constructor.js":"nKaW"}],"rK64":[function(require,module,exports) {
166
166
  "use strict";function e(e,t,r,n,u,a,s){try{var i=e[a](s),o=i.value}catch(c){return void r(c)}i.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 s=t.apply(r,n);function i(t){e(s,u,a,i,o,"next",t)}function o(t){e(s,u,a,i,o,"throw",t)}i(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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.username,r=e.password;return this.req.simplePost({url:"/auth/login",form:{username:t,password:r}})}},{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(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;
167
167
  },{}],"UV2u":[function(require,module,exports) {
@@ -177,13 +177,13 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
177
177
  },{"./AppProcessor/AppProcessor.js":"I3sf","./ItemProcessor/ItemProcessor.js":"EQyW","./FieldProcessor/FieldProcessor.js":"eGYU"}],"gVik":[function(require,module,exports) {
178
178
  "use strict";function e(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function n(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(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.DocumentManager=void 0;var r=function(){function n(t){e(this,n),this.req=t}return t(n,[{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:"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)}})}}]),n}();exports.DocumentManager=r;
179
179
  },{}],"ndt3":[function(require,module,exports) {
180
- "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},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},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(r);case 2:return this.deleteFileFromStorage(r,t),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;
180
+ "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,t){var n=this.storage.getApp(e);n&&(n.file_list.push(t),this.storage.updateApp(n),this.pipeService.emit("gh_file_upload",{app_id:e,item_id:t.item_id,element_id:r},t))}},{key:"addFilesToStorage",value:function(r,t,n){var i,a=this,u=this.storage.getApp(r);u&&((i=u.file_list).push.apply(i,e(n)),this.storage.updateApp(u),n.forEach(function(e){a.pipeService.emit("gh_file_upload",{app_id:r,item_id:e.item_id,element_id:t},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,r.element_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(r);case 2:return this.deleteFileFromStorage(r,t),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;
181
181
  },{}],"yYLL":[function(require,module,exports) {
182
182
  "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;
183
183
  },{}],"WyOa":[function(require,module,exports) {
184
184
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ChunksManager",{enumerable:!0,get:function(){return n.ChunksManager}}),Object.defineProperty(exports,"DocumentManager",{enumerable:!0,get:function(){return e.DocumentManager}}),Object.defineProperty(exports,"FileManager",{enumerable:!0,get:function(){return r.FileManager}});var e=require("./DocumentManager/DocumentManager.js"),r=require("./FileManager/FileManager.js"),n=require("./ChunksManager/ChunksManager.js");
185
185
  },{"./DocumentManager/DocumentManager.js":"gVik","./FileManager/FileManager.js":"ndt3","./ChunksManager/ChunksManager.js":"yYLL"}],"U9gy":[function(require,module,exports) {
186
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHub=void 0;var e=require("./gudhub-https-service.js"),t=require("./PipeService/PipeService.js"),r=require("./Storage/Storage.js"),i=require("./WebSocket/WebSocket.js"),n=require("./config.js"),s=require("./Utils/Utils.js"),o=require("./Auth/Auth.js"),u=require("./Processors/processors.js"),a=require("./Managers/managers.js"),l=require("./consts.js");function c(e,t,r,i,n,s,o){try{var u=e[s](o),a=u.value}catch(l){return void r(l)}u.done?t(a):Promise.resolve(a).then(i,n)}function p(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var s=e.apply(t,r);function o(e){c(s,i,n,o,u,"next",e)}function u(e){c(s,i,n,o,u,"throw",e)}o(void 0)})}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=function(){function c(l){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{server_url:n.server_url,wss_url:n.wss_url,initWebsocket:!1,activateSW:!1,swLink:""};d(this,c),this.pipeService=new t.PipeService,this.storage=new r.Storage(this.pipeService),this.util=new s.Utils(this),this.req=new e.GudHubHttpsService(p.server_url),this.auth=new o.Auth(this.req,this.storage),l&&this.storage.setUser({auth_key:l}),this.req.init(this.auth.getToken.bind(this.auth)),this.ws=new i.WebSocketApi(p.wss_url,this.auth),this.chunksManager=new a.ChunksManager(this.storage,this.pipeService,this.req,this.util),this.appProcessor=new u.AppProcessor(this.storage,this.pipeService,this.req,this.ws,this.chunksManager,this.util,p.activateSW),this.itemProcessor=new u.ItemProcessor(this.storage,this.pipeService,this.req,this.appProcessor,this.util),this.fieldProcessor=new u.FieldProcessor(this.storage,this.req,this.appProcessor,this.itemProcessor),this.fileManager=new a.FileManager(this.storage,this.pipeService,this.req,this.appProcessor),this.documentManager=new a.DocumentManager(this.req),p.initWebsocket&&this.ws.initWebSocket(this.websocketHandler.bind(this),this.appProcessor.refreshApps.bind(this.appProcessor)),p.activateSW&&this.activateSW(p.swLink)}return h(c,[{key:"activateSW",value:function(){var e=p(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(l.IS_WEB&&"serviceWorker"in window.navigator)){e.next=14;break}return e.prev=1,e.next=4,window.navigator.serviceWorker.register(t);case 4:(r=e.sent).update().then(function(){return console.log("%cSW ->>> Service worker successful updated","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;")}).catch(function(){return console.warn("SW ->>> Service worker is not updated")}),console.log("%cSW ->>> Service worker is registered","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",r),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.warn("%cSW ->>> Service worker is not registered","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",e.t0);case 12:e.next=15;break;case 14:console.log("%cSW ->>> ServiceWorkers not supported","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;");case 15:case"end":return e.stop()}},e,null,[[1,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"on",value:function(e,t,r){return this.pipeService.on(e,t,r),this}},{key:"emit",value:function(e,t,r,i){return this.pipeService.emit(e,t,r,i),this}},{key:"destroy",value:function(e,t,r){return this.pipeService.destroy(e,t,r),this}},{key:"prefilter",value:function(e,t,r,i,n){return this.util.prefilter(e,t,r,i,n)}},{key:"filter",value:function(e,t){return this.util.filter(e,t)}},{key:"group",value:function(e,t){return this.util.group(e,t)}},{key:"getFilteredItems",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.util.getFilteredItems(e,t,r.element_app_id,r.app_id,r.item_id,r.field_group,r.search,r.search_params)}},{key:"jsonToItems",value:function(e,t){return this.util.jsonToItems(e,t)}},{key:"getDate",value:function(e){return this.util.getDate(e)}},{key:"populateWithDate",value:function(e,t){return this.util.populateWithDate(e,t)}},{key:"populateItems",value:function(e,t,r){return this.util.populateItems(e,t,r)}},{key:"populateWithItemRef",value:function(e,t,r,i,n,s){return this.util.populateWithItemRef(e,t,r,i,n,s)}},{key:"compareItems",value:function(e,t,r){return this.util.compareItems(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return this.util.mergeItems(e,t,r)}},{key:"mergeObjects",value:function(e,t){return this.util.mergeObjects(e,t)}},{key:"makeNestedList",value:function(e,t,r,i,n){return this.util.makeNestedList(e,t,r,i,n)}},{key:"jsonConstructor",value:function(e,t,r){return this.util.jsonConstructor(e,t,r)}},{key:"getAppsList",value:function(){return this.appProcessor.getAppsList()}},{key:"getAppInfo",value:function(e){return this.appProcessor.getAppInfo(e)}},{key:"deleteApp",value:function(e){return this.appProcessor.deleteApp(e)}},{key:"getApp",value:function(e){return this.appProcessor.getApp(e)}},{key:"updateApp",value:function(e){return this.appProcessor.updateApp(e)}},{key:"updateAppInfo",value:function(e){return this.appProcessor.updateAppInfo(e)}},{key:"createNewApp",value:function(e){return this.appProcessor.createNewApp(e)}},{key:"getItems",value:function(e){return this.itemProcessor.getItems(e)}},{key:"getItem",value:function(){var e=p(regeneratorRuntime.mark(function e(t,r){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getItems(t);case 2:if(!(i=e.sent)){e.next=5;break}return e.abrupt("return",i.find(function(e){return e.item_id==r}));case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(e,t){return this.itemProcessor.addNewItems(e,t)}},{key:"updateItems",value:function(e,t){return this.itemProcessor.updateItems(e,t)}},{key:"deleteItems",value:function(e,t){return this.itemProcessor.deleteItems(e,t)}},{key:"getField",value:function(e,t){return this.fieldProcessor.getField(e,t)}},{key:"getFieldModels",value:function(e){return this.fieldProcessor.getFieldModels(e)}},{key:"updateField",value:function(e,t){return this.fieldProcessor.updateField(e,t)}},{key:"deleteField",value:function(e,t){return this.fieldProcessor.deleteField(e,t)}},{key:"getFieldValue",value:function(e,t,r){return this.fieldProcessor.getFieldValue(e,t,r)}},{key:"getInterpretedValue",value:function(e,t,r){return this.util.getInterpretedValue(e,t,r)}},{key:"setFieldValue",value:function(e,t,r,i){return this.fieldProcessor.setFieldValue(e,t,r,i)}},{key:"getFile",value:function(e,t){return this.fileManager.getFile(e,t)}},{key:"getFiles",value:function(e,t){return this.fileManager.getFiles(e,t)}},{key:"uploadFile",value:function(e,t,r){return this.fileManager.uploadFile(e,t,r)}},{key:"uploadFileFromString",value:function(e,t,r,i,n,s,o){return this.fileManager.uploadFileFromString(e,t,r,i,n,s,o)}},{key:"updateFileFromString",value:function(e,t,r,i,n){return this.fileManager.updateFileFromString(e,t,r,i,n)}},{key:"deleteFile",value:function(e,t){return this.fileManager.deleteFile(e,t)}},{key:"duplicateFile",value:function(e){return this.fileManager.duplicateFile(e)}},{key:"downloadFileFromString",value:function(e,t){return this.fileManager.downloadFileFromString(e,t)}},{key:"createDocument",value:function(e){return this.documentManager.createDocument(e)}},{key:"getDocument",value:function(e){return this.documentManager.getDocument(e)}},{key:"getDocuments",value:function(e){return this.documentManager.getDocuments(e)}},{key:"deleteDocument",value:function(e){return this.documentManager.deleteDocument(e)}},{key:"login",value:function(e){return this.auth.login(e)}},{key:"logout",value:function(e){return this.appProcessor.clearAppProcessor(),this.auth.logout(e)}},{key:"signup",value:function(e){return this.auth.signup(e)}},{key:"getUsersList",value:function(e){return this.auth.getUsersList(e)}},{key:"updateToken",value:function(e){return this.auth.updateToken(e)}},{key:"avatarUploadApi",value:function(e){return this.auth.avatarUploadApi(e)}},{key:"getVersion",value:function(){return this.auth.getVersion()}},{key:"getUserById",value:function(e){return this.auth.getUserById(e)}},{key:"getToken",value:function(){return this.auth.getToken()}},{key:"updateUser",value:function(e){return this.auth.updateUser(e)}},{key:"updateAvatar",value:function(e){return this.auth.updateAvatar(e)}},{key:"websocketHandler",value:function(e){switch(e.api){case"/items/update":console.log("/items/update - ",e),this.itemProcessor.updateItemsInStorage(e.app_id,e.response);break;case"/items/add":console.log("/items/add - ",e),this.itemProcessor.addItemsToStorage(e.app_id,e.response);break;case"/items/delete":console.log("/items/delete - ",e),this.itemProcessor.deleteItemsFromStorage(e.app_id,e.response);break;case"/app/update":console.log("/app/update - ",e),this.appProcessor.updatingAppInStorage(e.response);break;case"/file/delete":console.log("file/delete - ",e),this.fileManager.deleteFileFromStorage(e.response.file_id,e.app_id);break;case"/file/upload":console.log("file/upload - ",e),this.fileManager.addFileToStorage(e.app_id,e.response);break;case"/file/formupload":console.log("file/formupload - ",e);break;case"/file/update":this.fileManager.updateFileInStorage(e.response.file_id,e.response.app_id,e.response),console.log("file/update - ",e);break;case"/new/file/duplicate":this.fileManager.addFilesToStorage(e.app_id,e.response),console.log("new/file/duplicate - ",e);break;default:console.warn("WEBSOCKETS is not process this API:",e.api)}}}]),c}();exports.GudHub=g;
186
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHub=void 0;var e=require("./gudhub-https-service.js"),t=require("./PipeService/PipeService.js"),r=require("./Storage/Storage.js"),i=require("./WebSocket/WebSocket.js"),n=require("./config.js"),s=require("./Utils/Utils.js"),o=require("./Auth/Auth.js"),u=require("./Processors/processors.js"),a=require("./Managers/managers.js"),l=require("./consts.js");function c(e,t,r,i,n,s,o){try{var u=e[s](o),a=u.value}catch(l){return void r(l)}u.done?t(a):Promise.resolve(a).then(i,n)}function p(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var s=e.apply(t,r);function o(e){c(s,i,n,o,u,"next",e)}function u(e){c(s,i,n,o,u,"throw",e)}o(void 0)})}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function f(e,t,r){return t&&h(e.prototype,t),r&&h(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=function(){function c(l){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{server_url:n.server_url,wss_url:n.wss_url,initWebsocket:!1,activateSW:!1,swLink:""};d(this,c),this.pipeService=new t.PipeService,this.storage=new r.Storage(this.pipeService),this.util=new s.Utils(this),this.req=new e.GudHubHttpsService(p.server_url),this.auth=new o.Auth(this.req,this.storage),l&&this.storage.setUser({auth_key:l}),this.req.init(this.auth.getToken.bind(this.auth)),this.ws=new i.WebSocketApi(p.wss_url,this.auth),this.chunksManager=new a.ChunksManager(this.storage,this.pipeService,this.req,this.util),this.appProcessor=new u.AppProcessor(this.storage,this.pipeService,this.req,this.ws,this.chunksManager,this.util,p.activateSW),this.itemProcessor=new u.ItemProcessor(this.storage,this.pipeService,this.req,this.appProcessor,this.util),this.fieldProcessor=new u.FieldProcessor(this.storage,this.req,this.appProcessor,this.itemProcessor),this.fileManager=new a.FileManager(this.storage,this.pipeService,this.req,this.appProcessor),this.documentManager=new a.DocumentManager(this.req),p.initWebsocket&&this.ws.initWebSocket(this.websocketHandler.bind(this),this.appProcessor.refreshApps.bind(this.appProcessor)),p.activateSW&&this.activateSW(p.swLink)}return f(c,[{key:"activateSW",value:function(){var e=p(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(l.IS_WEB&&"serviceWorker"in window.navigator)){e.next=14;break}return e.prev=1,e.next=4,window.navigator.serviceWorker.register(t);case 4:(r=e.sent).update().then(function(){return console.log("%cSW ->>> Service worker successful updated","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;")}).catch(function(){return console.warn("SW ->>> Service worker is not updated")}),console.log("%cSW ->>> Service worker is registered","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",r),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.warn("%cSW ->>> Service worker is not registered","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",e.t0);case 12:e.next=15;break;case 14:console.log("%cSW ->>> ServiceWorkers not supported","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;");case 15:case"end":return e.stop()}},e,null,[[1,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"on",value:function(e,t,r){return this.pipeService.on(e,t,r),this}},{key:"emit",value:function(e,t,r,i){return this.pipeService.emit(e,t,r,i),this}},{key:"destroy",value:function(e,t,r){return this.pipeService.destroy(e,t,r),this}},{key:"prefilter",value:function(e,t,r,i,n){return this.util.prefilter(e,t,r,i,n)}},{key:"filter",value:function(e,t){return this.util.filter(e,t)}},{key:"group",value:function(e,t){return this.util.group(e,t)}},{key:"getFilteredItems",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.util.getFilteredItems(e,t,r.element_app_id,r.app_id,r.item_id,r.field_group,r.search,r.search_params)}},{key:"jsonToItems",value:function(e,t){return this.util.jsonToItems(e,t)}},{key:"getDate",value:function(e){return this.util.getDate(e)}},{key:"populateWithDate",value:function(e,t){return this.util.populateWithDate(e,t)}},{key:"checkRecurringDate",value:function(e,t){return this.util.checkRecurringDate(e,t)}},{key:"populateItems",value:function(e,t,r){return this.util.populateItems(e,t,r)}},{key:"populateWithItemRef",value:function(e,t,r,i,n,s){return this.util.populateWithItemRef(e,t,r,i,n,s)}},{key:"compareItems",value:function(e,t,r){return this.util.compareItems(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return this.util.mergeItems(e,t,r)}},{key:"mergeObjects",value:function(e,t){return this.util.mergeObjects(e,t)}},{key:"makeNestedList",value:function(e,t,r,i,n){return this.util.makeNestedList(e,t,r,i,n)}},{key:"jsonConstructor",value:function(e,t,r){return this.util.jsonConstructor(e,t,r)}},{key:"getAppsList",value:function(){return this.appProcessor.getAppsList()}},{key:"getAppInfo",value:function(e){return this.appProcessor.getAppInfo(e)}},{key:"deleteApp",value:function(e){return this.appProcessor.deleteApp(e)}},{key:"getApp",value:function(e){return this.appProcessor.getApp(e)}},{key:"updateApp",value:function(e){return this.appProcessor.updateApp(e)}},{key:"updateAppInfo",value:function(e){return this.appProcessor.updateAppInfo(e)}},{key:"createNewApp",value:function(e){return this.appProcessor.createNewApp(e)}},{key:"getItems",value:function(e){return this.itemProcessor.getItems(e)}},{key:"getItem",value:function(){var e=p(regeneratorRuntime.mark(function e(t,r){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getItems(t);case 2:if(!(i=e.sent)){e.next=5;break}return e.abrupt("return",i.find(function(e){return e.item_id==r}));case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(e,t){return this.itemProcessor.addNewItems(e,t)}},{key:"updateItems",value:function(e,t){return this.itemProcessor.updateItems(e,t)}},{key:"deleteItems",value:function(e,t){return this.itemProcessor.deleteItems(e,t)}},{key:"getField",value:function(e,t){return this.fieldProcessor.getField(e,t)}},{key:"getFieldModels",value:function(e){return this.fieldProcessor.getFieldModels(e)}},{key:"updateField",value:function(e,t){return this.fieldProcessor.updateField(e,t)}},{key:"deleteField",value:function(e,t){return this.fieldProcessor.deleteField(e,t)}},{key:"getFieldValue",value:function(e,t,r){return this.fieldProcessor.getFieldValue(e,t,r)}},{key:"getInterpretedValue",value:function(e,t,r){return this.util.getInterpretedValue(e,t,r)}},{key:"setFieldValue",value:function(e,t,r,i){return this.fieldProcessor.setFieldValue(e,t,r,i)}},{key:"getFile",value:function(e,t){return this.fileManager.getFile(e,t)}},{key:"getFiles",value:function(e,t){return this.fileManager.getFiles(e,t)}},{key:"uploadFile",value:function(e,t,r){return this.fileManager.uploadFile(e,t,r)}},{key:"uploadFileFromString",value:function(e,t,r,i,n,s,o){return this.fileManager.uploadFileFromString(e,t,r,i,n,s,o)}},{key:"updateFileFromString",value:function(e,t,r,i,n){return this.fileManager.updateFileFromString(e,t,r,i,n)}},{key:"deleteFile",value:function(e,t){return this.fileManager.deleteFile(e,t)}},{key:"duplicateFile",value:function(e){return this.fileManager.duplicateFile(e)}},{key:"downloadFileFromString",value:function(e,t){return this.fileManager.downloadFileFromString(e,t)}},{key:"createDocument",value:function(e){return this.documentManager.createDocument(e)}},{key:"getDocument",value:function(e){return this.documentManager.getDocument(e)}},{key:"getDocuments",value:function(e){return this.documentManager.getDocuments(e)}},{key:"deleteDocument",value:function(e){return this.documentManager.deleteDocument(e)}},{key:"login",value:function(e){return this.auth.login(e)}},{key:"logout",value:function(e){return this.appProcessor.clearAppProcessor(),this.auth.logout(e)}},{key:"signup",value:function(e){return this.auth.signup(e)}},{key:"getUsersList",value:function(e){return this.auth.getUsersList(e)}},{key:"updateToken",value:function(e){return this.auth.updateToken(e)}},{key:"avatarUploadApi",value:function(e){return this.auth.avatarUploadApi(e)}},{key:"getVersion",value:function(){return this.auth.getVersion()}},{key:"getUserById",value:function(e){return this.auth.getUserById(e)}},{key:"getToken",value:function(){return this.auth.getToken()}},{key:"updateUser",value:function(e){return this.auth.updateUser(e)}},{key:"updateAvatar",value:function(e){return this.auth.updateAvatar(e)}},{key:"websocketHandler",value:function(e){switch(e.api){case"/items/update":console.log("/items/update - ",e),this.itemProcessor.updateItemsInStorage(e.app_id,e.response);break;case"/items/add":console.log("/items/add - ",e),this.itemProcessor.addItemsToStorage(e.app_id,e.response);break;case"/items/delete":console.log("/items/delete - ",e),this.itemProcessor.deleteItemsFromStorage(e.app_id,e.response);break;case"/app/update":console.log("/app/update - ",e),this.appProcessor.updatingAppInStorage(e.response);break;case"/file/delete":console.log("file/delete - ",e),this.fileManager.deleteFileFromStorage(e.response.file_id,e.app_id);break;case"/file/upload":console.log("file/upload - ",e),this.fileManager.addFileToStorage(e.app_id,e.response);break;case"/file/formupload":console.log("file/formupload - ",e);break;case"/file/update":this.fileManager.updateFileInStorage(e.response.file_id,e.response.app_id,e.response),console.log("file/update - ",e);break;case"/new/file/duplicate":this.fileManager.addFilesToStorage(e.app_id,e.response),console.log("new/file/duplicate - ",e);break;default:console.warn("WEBSOCKETS is not process this API:",e.api)}}}]),c}();exports.GudHub=g;
187
187
  },{"./gudhub-https-service.js":"hDvy","./PipeService/PipeService.js":"E3xI","./Storage/Storage.js":"CSHe","./WebSocket/WebSocket.js":"pHMV","./config.js":"TPH7","./Utils/Utils.js":"mWlG","./Auth/Auth.js":"rK64","./Processors/processors.js":"WIY5","./Managers/managers.js":"WyOa","./consts.js":"UV2u"}],"iRRN":[function(require,module,exports) {
188
188
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"GudHub",{enumerable:!0,get:function(){return e.GudHub}}),exports.default=void 0,require("regenerator-runtime/runtime.js");var e=require("./GUDHUB/gudhub.js"),r=e.GudHub;exports.default=r;
189
189
  },{"regenerator-runtime/runtime.js":"KA2S","./GUDHUB/gudhub.js":"U9gy"}]},{},["iRRN"], "GudHubLibrary")