@gudhub/core 1.1.146 → 1.1.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GUDHUB/AppProcessor/AppProcessor.js +1 -1
- package/GUDHUB/FileManager/FileManager.js +8 -1
- package/GUDHUB/FileManager/file_manager.test.js +12 -1
- package/GUDHUB/gudhub.js +5 -1
- package/fake_server/fake_server_data/fake_server_data.js +30 -0
- package/package.json +1 -1
- package/umd/library.min.js +3 -3
- package/umd/library.min.js.map +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export class FileManager {
|
|
2
|
-
constructor(storage, pipeService, req, appProcessor) {
|
|
2
|
+
constructor(storage, pipeService, req, appProcessor, fieldProcessor) {
|
|
3
3
|
this.storage = storage;
|
|
4
4
|
this.pipeService = pipeService;
|
|
5
5
|
this.req = req;
|
|
6
6
|
this.appProcessor = appProcessor;
|
|
7
|
+
this.fieldProcessor = fieldProcessor;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
//********************* UPLOAD FILE *********************//
|
|
@@ -200,6 +201,12 @@ async getFiles(app_id, filesId = []) {
|
|
|
200
201
|
return file;
|
|
201
202
|
}
|
|
202
203
|
|
|
204
|
+
async uploadFileFromStringWithSetValue(fileObject) {
|
|
205
|
+
const file = await this.uploadFileFromString(fileObject);
|
|
206
|
+
await this.fieldProcessor.setFieldValue(file.app_id, file.item_id, fileObject.element_id, file.file_id);
|
|
207
|
+
return file;
|
|
208
|
+
}
|
|
209
|
+
|
|
203
210
|
async updateFileFromString(data, file_id, file_name, extension, format, alt, title) {
|
|
204
211
|
const file = await this.updateFileFromStringApi(
|
|
205
212
|
data,
|
|
@@ -39,5 +39,16 @@ describe("FILE MANAGER", function () {
|
|
|
39
39
|
file.extension.should.equals('html');
|
|
40
40
|
file.url.should.equals('https://app.gudhub.com/userdata/28818/943217.html');
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
it("UPLOAD FILE FROM STRING WITH SET VALUE", async function() {
|
|
44
|
+
let fileToUpload = {"format":"html","source":"test","file_name":"document","extension":"html","app_id":"28818","item_id":"3103065","element_id":"679784"}
|
|
45
|
+
|
|
46
|
+
let file = await gudhub.uploadFileFromStringWithSetValue(fileToUpload);
|
|
47
|
+
|
|
48
|
+
file.file_id.should.equals(943217);
|
|
49
|
+
|
|
50
|
+
let value = await gudhub.fieldProcessor.getFieldValue(file.app_id, file.item_id, fileToUpload.element_id);
|
|
51
|
+
value.should.equals(file.file_id);
|
|
52
|
+
});
|
|
53
|
+
|
|
43
54
|
});
|
package/GUDHUB/gudhub.js
CHANGED
|
@@ -89,7 +89,7 @@ export class GudHub {
|
|
|
89
89
|
this.itemProcessor,
|
|
90
90
|
this.pipeService
|
|
91
91
|
);
|
|
92
|
-
this.fileManager = new FileManager(this.storage, this.pipeService, this.req, this.appProcessor);
|
|
92
|
+
this.fileManager = new FileManager(this.storage, this.pipeService, this.req, this.appProcessor, this.fieldProcessor);
|
|
93
93
|
this.documentManager = new DocumentManager(this.req, this.pipeService);
|
|
94
94
|
this.websocketsemitter = new WebSocketEmitter(this);
|
|
95
95
|
|
|
@@ -416,6 +416,10 @@ export class GudHub {
|
|
|
416
416
|
);
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
uploadFileFromStringWithSetValue(fileObject) {
|
|
420
|
+
return this.fileManager.uploadFileFromStringWithSetValue(fileObject);
|
|
421
|
+
}
|
|
422
|
+
|
|
419
423
|
updateFileFromString(data, file_id, file_name, extension, format, alt, title) {
|
|
420
424
|
return this.fileManager.updateFileFromString(
|
|
421
425
|
data,
|
|
@@ -5,6 +5,35 @@ import {app_8263} from './app_8263.js';
|
|
|
5
5
|
import {bcacjbgqorherqmtykrj_8263} from './chunks_mocks/bcacjbgqorherqmtykrj_8263.js';
|
|
6
6
|
import {bcjyuoqaewybudfyhir_8263} from './chunks_mocks/bcjyuoqaewybudfyhir_8263.js';
|
|
7
7
|
import {tpajkpolmzklodcba_8263} from './chunks_mocks/tpajkpolmzklodcba_8263.js';
|
|
8
|
+
export const app_28818 = {
|
|
9
|
+
"app_id": 28818,
|
|
10
|
+
"app_name": "File Upload Test App",
|
|
11
|
+
"field_list": [
|
|
12
|
+
{
|
|
13
|
+
"app_id": 28818,
|
|
14
|
+
"field_id": 679784,
|
|
15
|
+
"element_id": 679784,
|
|
16
|
+
"field_name": "File",
|
|
17
|
+
"trash": false
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"items_list": [
|
|
21
|
+
{
|
|
22
|
+
"item_id": 3103065,
|
|
23
|
+
"trash": false,
|
|
24
|
+
"fields": [
|
|
25
|
+
{
|
|
26
|
+
"field_id": 679784,
|
|
27
|
+
"element_id": 679784,
|
|
28
|
+
"field_value": ""
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"views_list": [],
|
|
34
|
+
"file_list": []
|
|
35
|
+
}
|
|
36
|
+
|
|
8
37
|
export const apps = [app_214, app_16259, app_132, app_8263]
|
|
9
38
|
|
|
10
39
|
export const data = {
|
|
@@ -12,6 +41,7 @@ export const data = {
|
|
|
12
41
|
'16259' : app_16259,
|
|
13
42
|
'132' : app_132,
|
|
14
43
|
'8263' : app_8263,
|
|
44
|
+
'28818' : app_28818,
|
|
15
45
|
'bcacjbgqorherqmtykrj_8263' : bcacjbgqorherqmtykrj_8263,
|
|
16
46
|
'bcjyuoqaewybudfyhir_8263' : bcjyuoqaewybudfyhir_8263,
|
|
17
47
|
'tpajkpolmzklodcba_8263' : tpajkpolmzklodcba_8263,
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -317,13 +317,13 @@ var t=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
|
317
317
|
},{"axios":"O4Aa","./../consts.js":"UV2u"}],"Htuh":[function(require,module,exports) {
|
|
318
318
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GHConstructor=void 0;var t=n(require("./createAngularModuleInstance.js")),e=n(require("./createClassInstance.js"));function n(t){return t&&t.__esModule?t:{default:t}}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,o,i){var a=r&&r.prototype instanceof s?r:s,f=Object.create(a.prototype);return u(f,"_invoke",function(n,r,o){var u,i,a,s=0,f=o||[],l=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return u=e,i=0,a=t,h.n=n,c}};function y(n,r){for(i=n,a=r,e=0;!l&&s&&!o&&e<f.length;e++){var o,u=f[e],y=h.p,p=u[2];n>3?(o=p===r)&&(a=u[(i=u[4])?5:(i=3,3)],u[4]=u[5]=t):u[0]<=y&&((o=n<2&&y<u[1])?(i=0,h.v=r,h.n=u[1]):y<p&&(o=n<3||u[0]>r||r>p)&&(u[4]=n,u[5]=r,h.n=p,i=0))}if(o||n>1)return c;throw l=!0,r}return function(o,f,p){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,p),i=f,a=p;(e=i<2?t:a)||!l;){u||(i?i<3?(i>1&&(h.n=-1),y(i,a)):h.n=a:h.v=a);try{if(s=2,u){if(i||(o="next"),e=u[o]){if(!(e=e.call(u,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,i<2&&(i=0)}else 1===i&&(e=u.return)&&e.call(u),i<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),i=1);u=t}else if((e=(l=h.n<0)?a:n.call(r,h))!==c)break}catch(e){u=t,i=1,a=e}finally{s=1}}return{value:e,done:l}}}(n,o,i),!0),f}var c={};function s(){}function f(){}function l(){}e=Object.getPrototypeOf;var h=[][r]?e(e([][r]())):(u(e={},r,function(){return this}),e),y=l.prototype=s.prototype=Object.create(h);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,u(t,i,"GeneratorFunction")),t.prototype=Object.create(y),t}return f.prototype=l,u(y,"constructor",l),u(l,"constructor",f),f.displayName="GeneratorFunction",u(l,i,"GeneratorFunction"),u(y),u(y,i,"Generator"),u(y,r,function(){return this}),u(y,"toString",function(){return"[object Generator]"}),(o=function(){return{w:a,m:p}})()}function u(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}(u=function(t,e,n,r){function i(e,n){u(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))})(t,e,n,r)}function i(t,e,n,r,o,u,i){try{var a=t[u](i),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function a(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var u=t.apply(e,n);function a(t){i(u,r,o,a,c,"next",t)}function c(t){i(u,r,o,a,c,"throw",t)}a(void 0)})}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function f(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var e=h(t,"string");return"symbol"==r(e)?e:e+""}function h(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var y=exports.GHConstructor=function(){return f(function t(e){c(this,t),this.gudhub=e,this.cache={},this.modulesQueue={},this.angularInjector,this.nodeWindow},[{key:"getInstance",value:function(){var t=a(o().m(function t(e){return o().w(function(t){for(;;)switch(t.n){case 0:if(!this.getCached(e)){t.n=1;break}return t.a(2,this.getCached(e));case 1:if(!this.modulesQueue[e]){t.n=3;break}return t.n=2,this.modulesQueue[e];case 2:t.n=4;break;case 3:return this.modulesQueue[e]=this.createInstance(e),t.n=4,this.modulesQueue[e];case 4:return t.a(2,this.getCached(e))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"pupToCache",value:function(t,e){this.cache[t]=e}},{key:"getCached",value:function(t){return this.cache[t]}},{key:"initAngularInjector",value:function(t){this.angularInjector=t}},{key:"initJsdomWindow",value:function(t){this.nodeWindow=t}},{key:"createInstance",value:function(){var n=a(o().m(function n(r){var u,i;return o().w(function(n){for(;;)switch(n.n){case 0:if(u=this.gudhub.storage.getModuleUrl(r)){n.n=1;break}return console.log("Cannot find module: ".concat(r)),n.a(2);case 1:if("gh_element"!==u.type){n.n=5;break}if("angular"!==u.technology){n.n=3;break}return n.n=2,(0,t.default)(this.gudhub,r,u.url,this.angularInjector,this.nodeWindow);case 2:i=n.v,n.n=5;break;case 3:if("class"!==u.technology){n.n=5;break}return n.n=4,(0,e.default)(this.gudhub,r,u.js,u.css,this.nodeWindow);case 4:i=n.v;case 5:return i&&this.pupToCache(r,i),n.a(2,i)}},n,this)}));return function(t){return n.apply(this,arguments)}}()}])}();
|
|
319
319
|
},{"./createAngularModuleInstance.js":"osSN","./createClassInstance.js":"DsUm"}],"q0my":[function(require,module,exports) {
|
|
320
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppProcessor=void 0;var t=require("../consts.js"),e=require("../utils.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return p(t)||a(t)||f(t)||i()}function i(){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 a(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function p(t){if(Array.isArray(t))return l(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){u(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function u(t,e,r){return(e=w(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=f(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,p=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return p=t.done,t},e:function(t){o=!0,a=t},f:function(){try{p||null==r.return||r.return()}finally{if(o)throw a}}}}function f(t,e){if(t){if("string"==typeof t)return l(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function h(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var s=n&&n.prototype instanceof o?n:o,u=Object.create(s.prototype);return v(u,"_invoke",function(r,n,i){var a,o,s,u=0,c=i||[],f=!1,l={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,r){return a=e,o=0,s=t,l.n=r,p}};function h(r,n){for(o=r,s=n,e=0;!f&&u&&!i&&e<c.length;e++){var i,a=c[e],h=l.p,v=a[2];r>3?(i=v===n)&&(s=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=t):a[0]<=h&&((i=r<2&&h<a[1])?(o=0,l.v=n,l.n=a[1]):h<v&&(i=r<3||a[0]>n||n>v)&&(a[4]=r,a[5]=n,l.n=v,o=0))}if(i||r>1)return p;throw f=!0,n}return function(i,c,v){if(u>1)throw TypeError("Generator is already running");for(f&&1===c&&h(c,v),o=c,s=v;(e=o<2?t:s)||!f;){a||(o?o<3?(o>1&&(l.n=-1),h(o,s)):l.n=s:l.v=s);try{if(u=2,a){if(o||(i="next"),e=a[i]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,o<2&&(o=0)}else 1===o&&(e=a.return)&&e.call(a),o<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=t}else if((e=(f=l.n<0)?s:r.call(n,l))!==p)break}catch(e){a=t,o=1,s=e}finally{u=1}}return{value:e,done:f}}}(r,i,a),!0),u}var p={};function o(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(v(e={},n,function(){return this}),e),f=u.prototype=o.prototype=Object.create(c);function l(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,v(t,i,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=u,v(f,"constructor",u),v(u,"constructor",s),s.displayName="GeneratorFunction",v(u,i,"GeneratorFunction"),v(f),v(f,i,"Generator"),v(f,n,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:a,m:l}})()}function v(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(v=function(t,e,r,n){function a(e,r){v(t,e,function(t){return this._invoke(e,r,t)})}e?i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))})(t,e,r,n)}function d(t,e,r,n,i,a,p){try{var o=t[a](p),s=o.value}catch(t){return void r(t)}o.done?e(s):Promise.resolve(s).then(n,i)}function _(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var a=t.apply(e,r);function p(t){d(a,n,i,p,o,"next",t)}function o(t){d(a,n,i,p,o,"throw",t)}p(void 0)})}}function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,w(n.key),n)}}function y(t,e,r){return e&&m(t.prototype,e),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function w(t){var e=A(t,"string");return"symbol"==r(e)?e:e+""}function A(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var b=exports.AppProcessor=function(){return y(function t(e,r,n,i,a,p,o){g(this,t),this.storage=e,this.pipeService=r,this.req=n,this.ws=i,this.applistReceived=!1,this.activateSW=o,this.chunksManager=a,this.util=p,this.appListeners(),this.appRequestCache=new Map},[{key:"createNewAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/create",form:{app:JSON.stringify(e)}});case 1:return(r=t.v).from_apps_list=!0,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/update",form:{app:JSON.stringify(e)}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/delete",form:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListApi",value:function(){var t=_(h().m(function t(){var e,r;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/applist/get"});case 1:return e=t.v,t.a(2,e.apps_list.map(function(t){return t.from_apps_list=!0,t}));case 2:return t.p=2,r=t.v,console.log(r),t.a(2,null)}},t,this,[[0,2]])}));return function(){return t.apply(this,arguments)}}()},{key:"getAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/app/get",params:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListFromStorage",value:function(){return this.storage.getAppsList()}},{key:"getAppFromStorage",value:function(t){var e=this.storage.getApp(t);return e&&e.field_list.length?e:null}},{key:"addNewAppToStorage",value:function(t){return this.storage.getAppsList().push(t)}},{key:"saveAppInStorage",value:function(t){t.items_object={};for(var e=0;e<t.items_list.length;e++){t.items_object[t.items_list[e].item_id]={};for(var r=0;r<t.items_list[e].fields.length;r++)t.items_object[t.items_list[e].item_id][t.items_list[e].fields[r].field_id]=t.items_list[e].fields[r]}var n=this.storage.getApp(t.app_id);return n?(t.from_apps_list=n.from_apps_list,t.permission=n.permission,this.storage.updateApp(t)):(t.from_apps_list=!1,this.addNewAppToStorage(t)),this.getAppFromStorage(t.app_id)}},{key:"updateAppFieldsAndViews",value:function(t){var e=this,r=this.getAppFromStorage(t.app_id);t.items_list=r.items_list,t.file_list=r.file_list,t.from_apps_list=r.from_apps_list,t.items_object=r.items_object,this.storage.updateApp(t),this.pipeService.emit("gh_app_views_update",{app_id:t.app_id},t.views_list),t.field_list.forEach(function(r){e.pipeService.emit("gh_model_update",{app_id:t.app_id,field_id:r.field_id},r)})}},{key:"updateAppInStorage",value:function(t){this.storage.getApp(t.app_id)?(this.storage.updateApp(t),this.pipeService.emit("gh_app_update",{app_id:t.app_id},t),this.pipeService.emit("gh_items_update",{app_id:t.app_id},t.items_list)):this.addNewAppToStorage(t)}},{key:"deletingAppFromStorage",value:function(t){var e=this.storage.getAppsList();return e.forEach(function(r,n){r.app_id==t&&e.splice(n)}),e}},{key:"updateAppsListInStorage",value:function(){var t,e=c(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var r=t.value,n=this.storage.getApp(r.app_id);n?(n.from_apps_list=r.from_apps_list,n.permission=r.permission):this.addNewAppToStorage(r)}}catch(i){e.e(i)}finally{e.f()}}},{key:"refreshApps",value:function(){var t=_(h().m(function t(){var e,r,n,i,a,p,o,s,u,f=arguments;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:e=f.length>0&&void 0!==f[0]?f[0]:[],r=c(e),t.p=1,r.s();case 2:if((n=r.n()).done){t.n=7;break}if(null==(i=n.value)){t.n=6;break}return t.p=3,t.n=4,this.getAppApi(i);case 4:if(a=t.v){for(a.items_object={},p=0;p<a.items_list.length;p++)for(a.items_object[a.items_list[p].item_id]={},o=0;o<a.items_list[p].fields.length;o++)a.items_object[a.items_list[p].item_id][a.items_list[p].fields[o].field_id]=a.items_list[p].fields[o];this.updateAppInStorage(a),this.pipeService.emit("gh_app_views_update",{app_id:a.app_id},a.views_list)}t.n=6;break;case 5:t.p=5,s=t.v,console.log(s);case 6:t.n=2;break;case 7:t.n=9;break;case 8:t.p=8,u=t.v,r.e(u);case 9:return t.p=9,r.f(),t.f(9);case 10:console.log("Apps refreshed: ",JSON.stringify(e));case 11:return t.a(2)}},t,this,[[3,5],[1,8,9,10]])}));return function(){return t.apply(this,arguments)}}()},{key:"refreshAppsList",value:function(){var t=_(h().m(function t(){var e,r,n;return h().w(function(t){for(;;)switch(t.n){case 0:return e=this.getAppListFromStorage(),t.n=1,this.getAppListApi();case 1:r=t.v,n=r.map(function(t){return s(s({},t),e.find(function(e){return e.app_id===t.app_id}))}),this.updateAppsListInStorage(n),this.pipeService.emit("gh_apps_list_refreshed",{});case 2:return t.a(2)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppsList",value:function(){var t=_(h().m(function t(){var e,r;return h().w(function(t){for(;;)switch(t.n){case 0:if(e=this.getAppListFromStorage(),this.applistReceived){t.n=3;break}return t.n=1,this.getAppListApi();case 1:if(r=t.v){t.n=2;break}return t.a(2,null);case 2:this.updateAppsListInStorage(r),this.applistReceived=!0,e=r,this.getApp(this.storage.getUser().app_init);case 3:return t.a(2,e)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppInfo",value:function(){var t=_(h().m(function t(e){var r;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getAppsList();case 1:return r=t.v,t.a(2,r?r.find(function(t){return t.app_id==e}):null)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteApp",value:function(){var t=_(h().m(function t(e){return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.deleteAppApi(e);case 1:return t.a(2,this.deletingAppFromStorage(e))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getApp",value:function(){var t=_(h().m(function t(r){var i,a,p,o=this;return h().w(function(t){for(;;)switch(t.n){case 0:if(r){t.n=1;break}return t.a(2,null);case 1:if(!(i=this.getAppFromStorage(r))){t.n=2;break}return t.a(2,i);case 2:if(!this.appRequestCache.has(r)){t.n=3;break}return t.a(2,this.appRequestCache.get(r));case 3:return a=this,p=new Promise(function(){var t=_(h().m(function t(i,p){var s,u,c;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,o.getAppApi(r);case 1:if((s=t.v)||p(),!s.chunks||!s.chunks.length){t.n=3;break}return t.n=2,a.chunksManager.getChunks(r,s.chunks);case 2:u=t.v,s.items_list=a.util.mergeChunks([].concat(n(u),[s]));case 3:c=(0,e.trashFilter)(s),a.saveAppInStorage(s),a.ws.addSubscription(r),i(c),t.n=5;break;case 4:t.p=4,t.v,p();case 5:return t.a(2)}},t,null,[[0,4]])}));return function(e,r){return t.apply(this,arguments)}}()),a.appRequestCache.set(r,p),t.a(2,p)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateApp",value:function(){var t=_(h().m(function t(r){var n,i;return h().w(function(t){for(;;)switch(t.n){case 0:if(r.views_list&&r.views_list.length&&r.show){t.n=2;break}return t.n=1,this.getApp(r.app_id);case 1:n=t.v,r.views_list&&r.views_list.length||(r.views_list=n.views_list),void 0===r.show&&(r.show=n.show);case 2:return t.n=3,this.updateAppApi(r);case 3:return(i=t.v).field_list=(0,e.trashFilter)(i).field_list,this.updateAppFieldsAndViews(i),t.a(2,i)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppInfo",value:function(){var t=_(h().m(function t(){var e,r=arguments;return h().w(function(t){for(;;)switch(t.n){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:{},this.pipeService.emit("gh_app_info_update",{app_id:e.app_id},e),t.a(2,this.updateApp(e))}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"createNewApp",value:function(){var t=_(h().m(function t(e){var r;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.createNewAppApi(e);case 1:return(r=t.v).items_object={},this.addNewAppToStorage(r),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppViews",value:function(){var t=_(h().m(function t(e){var r;return h().w(function(t){for(;;)switch(t.n){case 0:if(!e){t.n=2;break}return t.n=1,this.getApp(e);case 1:return r=t.v,t.a(2,r.views_list);case 2:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"clearAppProcessor",value:function(){this.getAppListPromises=null,this.getAppPromises={},this.applistReceived=!1}},{key:"appListeners",value:function(){var e=this;this.pipeService.onRoot("gh_app_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:if(!n||!n.app_id){t.n=2;break}return t.n=1,e.getApp(n.app_id);case 1:i=t.v,e.pipeService.emit("gh_app_get",n,i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_apps_list_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppsList();case 1:i=t.v,e.pipeService.emit("gh_apps_list_get",n,i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_delete_app",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.deleteApp(n.app_id);case 1:i=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_update",{},function(){var t=_(h().m(function t(r,n){var i,a;return h().w(function(t){for(;;)switch(t.n){case 0:return n.app.items_list=[],n.app.file_list=[],t.n=1,e.updateApp(n.app);case 1:return i=t.v,e.pipeService.emit("gh_app_views_update",{app_id:i.app_id},i.views_list),t.n=2,e.getAppsList();case 2:a=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},a),i.field_list.forEach(function(t){e.pipeService.emit("gh_model_update",{app_id:i.app_id,field_id:t.field_id},t)});case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_view_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:if(!n||!n.app_id){t.n=2;break}return t.n=1,e.getApp(n.app_id);case 1:(i=t.v).views_list.forEach(function(t,r){t.view_id==n.view_id&&e.pipeService.emit("gh_app_view_get",n,i.views_list[r])});case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppInfo(n.app_id);case 1:(i=t.v)&&e.pipeService.emit("gh_app_info_get",n,i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_update",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:if(!n||!n.app){t.n=2;break}return t.n=1,e.updateAppInfo(n.app);case 1:i=t.v,e.pipeService.emit("gh_app_info_update",{app_id:n.app.app_id},i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_create",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.createNewApp(n.app);case 1:return t.n=2,e.getAppsList();case 2:i=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),t.IS_WEB&&this.activateSW&&navigator.serviceWorker.addEventListener("message",function(){var t=_(h().m(function t(r){var n;return h().w(function(t){for(;;)switch(t.n){case 0:if("refresh app"!==r.data.type){t.n=2;break}return t.n=1,e.getApp(r.data.payload.app_id);case 1:(n=t.v)&&e.util.compareAppsItemsLists(n.items_list,r.data.payload.items_list.filter(function(t){return!t.trash}),function(t){var n=t.diff_fields_items,i=t.diff_fields_items_Ids,a=t.diff_items,p=t.newItems,o=t.deletedItems;(a.length||p.length||o.length)&&(e.pipeService.emit("gh_items_update",{app_id:r.data.payload.app_id},r.data.payload.items_list.filter(function(t){return!t.trash})),a.forEach(function(t){return e.pipeService.emit("gh_item_update",{app_id:r.data.payload.app_id,item_id:t.item_id},t)})),i.forEach(function(t){var i=n[t];i&&i.forEach(function(n){e.pipeService.emit("gh_value_update",{app_id:r.data.payload.app_id,item_id:t,field_id:n.field_id},n.field_value)})})}),r.data.payload.items_list=e.util.mergeChunks([n,r.data.payload]),e.saveAppInStorage(r.data.payload);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}}])}();
|
|
320
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppProcessor=void 0;var t=require("../consts.js"),e=require("../utils.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return p(t)||a(t)||f(t)||i()}function i(){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 a(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function p(t){if(Array.isArray(t))return l(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){u(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function u(t,e,r){return(e=w(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=f(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,p=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return p=t.done,t},e:function(t){o=!0,a=t},f:function(){try{p||null==r.return||r.return()}finally{if(o)throw a}}}}function f(t,e){if(t){if("string"==typeof t)return l(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function h(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var s=n&&n.prototype instanceof o?n:o,u=Object.create(s.prototype);return v(u,"_invoke",function(r,n,i){var a,o,s,u=0,c=i||[],f=!1,l={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,r){return a=e,o=0,s=t,l.n=r,p}};function h(r,n){for(o=r,s=n,e=0;!f&&u&&!i&&e<c.length;e++){var i,a=c[e],h=l.p,v=a[2];r>3?(i=v===n)&&(s=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=t):a[0]<=h&&((i=r<2&&h<a[1])?(o=0,l.v=n,l.n=a[1]):h<v&&(i=r<3||a[0]>n||n>v)&&(a[4]=r,a[5]=n,l.n=v,o=0))}if(i||r>1)return p;throw f=!0,n}return function(i,c,v){if(u>1)throw TypeError("Generator is already running");for(f&&1===c&&h(c,v),o=c,s=v;(e=o<2?t:s)||!f;){a||(o?o<3?(o>1&&(l.n=-1),h(o,s)):l.n=s:l.v=s);try{if(u=2,a){if(o||(i="next"),e=a[i]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,o<2&&(o=0)}else 1===o&&(e=a.return)&&e.call(a),o<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=t}else if((e=(f=l.n<0)?s:r.call(n,l))!==p)break}catch(e){a=t,o=1,s=e}finally{u=1}}return{value:e,done:f}}}(r,i,a),!0),u}var p={};function o(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(v(e={},n,function(){return this}),e),f=u.prototype=o.prototype=Object.create(c);function l(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,v(t,i,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=u,v(f,"constructor",u),v(u,"constructor",s),s.displayName="GeneratorFunction",v(u,i,"GeneratorFunction"),v(f),v(f,i,"Generator"),v(f,n,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:a,m:l}})()}function v(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(v=function(t,e,r,n){function a(e,r){v(t,e,function(t){return this._invoke(e,r,t)})}e?i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))})(t,e,r,n)}function d(t,e,r,n,i,a,p){try{var o=t[a](p),s=o.value}catch(t){return void r(t)}o.done?e(s):Promise.resolve(s).then(n,i)}function _(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var a=t.apply(e,r);function p(t){d(a,n,i,p,o,"next",t)}function o(t){d(a,n,i,p,o,"throw",t)}p(void 0)})}}function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,w(n.key),n)}}function y(t,e,r){return e&&m(t.prototype,e),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function w(t){var e=A(t,"string");return"symbol"==r(e)?e:e+""}function A(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var b=exports.AppProcessor=function(){return y(function t(e,r,n,i,a,p,o){g(this,t),this.storage=e,this.pipeService=r,this.req=n,this.ws=i,this.applistReceived=!1,this.activateSW=o,this.chunksManager=a,this.util=p,this.appListeners(),this.appRequestCache=new Map},[{key:"createNewAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/create",form:{app:JSON.stringify(e)}});case 1:return(r=t.v).from_apps_list=!0,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/update",form:{app:JSON.stringify(e)}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/delete",form:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListApi",value:function(){var t=_(h().m(function t(){var e,r;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/applist/get"});case 1:return e=t.v,t.a(2,e.apps_list.map(function(t){return t.from_apps_list=!0,t}));case 2:return t.p=2,r=t.v,console.log(r),t.a(2,null)}},t,this,[[0,2]])}));return function(){return t.apply(this,arguments)}}()},{key:"getAppApi",value:function(){var t=_(h().m(function t(e){var r,n;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/app/get",params:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListFromStorage",value:function(){return this.storage.getAppsList()}},{key:"getAppFromStorage",value:function(t){var e=this.storage.getApp(t);return e&&e.field_list.length?e:null}},{key:"addNewAppToStorage",value:function(t){return this.storage.getAppsList().push(t)}},{key:"saveAppInStorage",value:function(t){t.items_object={};for(var e=0;e<t.items_list.length;e++){t.items_object[t.items_list[e].item_id]={};for(var r=0;r<t.items_list[e].fields.length;r++)t.items_object[t.items_list[e].item_id][t.items_list[e].fields[r].field_id]=t.items_list[e].fields[r]}var n=this.storage.getApp(t.app_id);return n?(t.from_apps_list=n.from_apps_list,t.permission=n.permission,this.storage.updateApp(t)):(t.from_apps_list=!1,this.addNewAppToStorage(t)),this.getAppFromStorage(t.app_id)}},{key:"updateAppFieldsAndViews",value:function(t){var e=this,r=this.getAppFromStorage(t.app_id);t.items_list=r.items_list,t.file_list=r.file_list,t.from_apps_list=r.from_apps_list,t.items_object=r.items_object,this.storage.updateApp(t),this.pipeService.emit("gh_app_views_update",{app_id:t.app_id},t.views_list),t.field_list.forEach(function(r){e.pipeService.emit("gh_model_update",{app_id:t.app_id,field_id:r.field_id},r)})}},{key:"updateAppInStorage",value:function(t){this.storage.getApp(t.app_id)?(this.storage.updateApp(t),this.pipeService.emit("gh_app_update",{app_id:t.app_id},t),this.pipeService.emit("gh_items_update",{app_id:t.app_id},t.items_list)):this.addNewAppToStorage(t)}},{key:"deletingAppFromStorage",value:function(t){var e=this.storage.getAppsList();return e.forEach(function(r,n){r.app_id==t&&e.splice(n)}),e}},{key:"updateAppsListInStorage",value:function(){var t,e=c(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var r=t.value,n=this.storage.getApp(r.app_id);n?(n.from_apps_list=r.from_apps_list,n.permission=r.permission):this.addNewAppToStorage(r)}}catch(i){e.e(i)}finally{e.f()}}},{key:"refreshApps",value:function(){var t=_(h().m(function t(){var e,r,n,i,a,p,o,s,u,f=arguments;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:e=f.length>0&&void 0!==f[0]?f[0]:[],r=c(e),t.p=1,r.s();case 2:if((n=r.n()).done){t.n=7;break}if(null==(i=n.value)){t.n=6;break}return t.p=3,t.n=4,this.getAppApi(i);case 4:if(a=t.v){for(a.items_object={},p=0;p<a.items_list.length;p++)for(a.items_object[a.items_list[p].item_id]={},o=0;o<a.items_list[p].fields.length;o++)a.items_object[a.items_list[p].item_id][a.items_list[p].fields[o].field_id]=a.items_list[p].fields[o];this.updateAppInStorage(a),this.pipeService.emit("gh_app_views_update",{app_id:a.app_id},a.views_list)}t.n=6;break;case 5:t.p=5,s=t.v,console.log(s);case 6:t.n=2;break;case 7:t.n=9;break;case 8:t.p=8,u=t.v,r.e(u);case 9:return t.p=9,r.f(),t.f(9);case 10:console.log("Apps refreshed: ",JSON.stringify(e));case 11:return t.a(2)}},t,this,[[3,5],[1,8,9,10]])}));return function(){return t.apply(this,arguments)}}()},{key:"refreshAppsList",value:function(){var t=_(h().m(function t(){var e,r,n;return h().w(function(t){for(;;)switch(t.n){case 0:return e=this.getAppListFromStorage(),t.n=1,this.getAppListApi();case 1:r=t.v,n=r.map(function(t){return s(s({},t),e.find(function(e){return e.app_id===t.app_id}))}),this.updateAppsListInStorage(n),this.pipeService.emit("gh_apps_list_refreshed",{});case 2:return t.a(2)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppsList",value:function(){var t=_(h().m(function t(){var e,r;return h().w(function(t){for(;;)switch(t.n){case 0:if(e=this.getAppListFromStorage(),this.applistReceived){t.n=3;break}return t.n=1,this.getAppListApi();case 1:if(r=t.v){t.n=2;break}return t.a(2,null);case 2:this.updateAppsListInStorage(r),this.applistReceived=!0,e=r,this.getApp(this.storage.getUser().app_init);case 3:return t.a(2,e)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppInfo",value:function(){var t=_(h().m(function t(e){var r;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getAppsList();case 1:return r=t.v,t.a(2,r?r.find(function(t){return t.app_id==e}):null)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteApp",value:function(){var t=_(h().m(function t(e){return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.deleteAppApi(e);case 1:return t.a(2,this.deletingAppFromStorage(e))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getApp",value:function(){var t=_(h().m(function t(r){var i,a,p,o=this;return h().w(function(t){for(;;)switch(t.n){case 0:if(r){t.n=1;break}return t.a(2,null);case 1:if(!(i=this.getAppFromStorage(r))){t.n=2;break}return t.a(2,i);case 2:if(!this.appRequestCache.has(r)){t.n=3;break}return t.a(2,this.appRequestCache.get(r));case 3:return a=this,p=new Promise(function(){var t=_(h().m(function t(i,p){var s,u,c;return h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,o.getAppApi(r);case 1:if((s=t.v)||p(),!s.chunks||!s.chunks.length){t.n=3;break}return t.n=2,a.chunksManager.getChunks(r,s.chunks);case 2:u=t.v,s.items_list=a.util.mergeChunks([].concat(n(u),[s]));case 3:c=(0,e.trashFilter)(s),a.saveAppInStorage(c),a.ws.addSubscription(r),i(c),t.n=5;break;case 4:t.p=4,t.v,p();case 5:return t.a(2)}},t,null,[[0,4]])}));return function(e,r){return t.apply(this,arguments)}}()),a.appRequestCache.set(r,p),t.a(2,p)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateApp",value:function(){var t=_(h().m(function t(r){var n,i;return h().w(function(t){for(;;)switch(t.n){case 0:if(r.views_list&&r.views_list.length&&r.show){t.n=2;break}return t.n=1,this.getApp(r.app_id);case 1:n=t.v,r.views_list&&r.views_list.length||(r.views_list=n.views_list),void 0===r.show&&(r.show=n.show);case 2:return t.n=3,this.updateAppApi(r);case 3:return(i=t.v).field_list=(0,e.trashFilter)(i).field_list,this.updateAppFieldsAndViews(i),t.a(2,i)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppInfo",value:function(){var t=_(h().m(function t(){var e,r=arguments;return h().w(function(t){for(;;)switch(t.n){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:{},this.pipeService.emit("gh_app_info_update",{app_id:e.app_id},e),t.a(2,this.updateApp(e))}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"createNewApp",value:function(){var t=_(h().m(function t(e){var r;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.createNewAppApi(e);case 1:return(r=t.v).items_object={},this.addNewAppToStorage(r),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppViews",value:function(){var t=_(h().m(function t(e){var r;return h().w(function(t){for(;;)switch(t.n){case 0:if(!e){t.n=2;break}return t.n=1,this.getApp(e);case 1:return r=t.v,t.a(2,r.views_list);case 2:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"clearAppProcessor",value:function(){this.getAppListPromises=null,this.getAppPromises={},this.applistReceived=!1}},{key:"appListeners",value:function(){var e=this;this.pipeService.onRoot("gh_app_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:if(!n||!n.app_id){t.n=2;break}return t.n=1,e.getApp(n.app_id);case 1:i=t.v,e.pipeService.emit("gh_app_get",n,i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_apps_list_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppsList();case 1:i=t.v,e.pipeService.emit("gh_apps_list_get",n,i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_delete_app",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.deleteApp(n.app_id);case 1:i=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_update",{},function(){var t=_(h().m(function t(r,n){var i,a;return h().w(function(t){for(;;)switch(t.n){case 0:return n.app.items_list=[],n.app.file_list=[],t.n=1,e.updateApp(n.app);case 1:return i=t.v,e.pipeService.emit("gh_app_views_update",{app_id:i.app_id},i.views_list),t.n=2,e.getAppsList();case 2:a=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},a),i.field_list.forEach(function(t){e.pipeService.emit("gh_model_update",{app_id:i.app_id,field_id:t.field_id},t)});case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_view_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:if(!n||!n.app_id){t.n=2;break}return t.n=1,e.getApp(n.app_id);case 1:(i=t.v).views_list.forEach(function(t,r){t.view_id==n.view_id&&e.pipeService.emit("gh_app_view_get",n,i.views_list[r])});case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_get",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppInfo(n.app_id);case 1:(i=t.v)&&e.pipeService.emit("gh_app_info_get",n,i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_update",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:if(!n||!n.app){t.n=2;break}return t.n=1,e.updateAppInfo(n.app);case 1:i=t.v,e.pipeService.emit("gh_app_info_update",{app_id:n.app.app_id},i);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_create",{},function(){var t=_(h().m(function t(r,n){var i;return h().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.createNewApp(n.app);case 1:return t.n=2,e.getAppsList();case 2:i=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),t.IS_WEB&&this.activateSW&&navigator.serviceWorker.addEventListener("message",function(){var t=_(h().m(function t(r){var n;return h().w(function(t){for(;;)switch(t.n){case 0:if("refresh app"!==r.data.type){t.n=2;break}return t.n=1,e.getApp(r.data.payload.app_id);case 1:(n=t.v)&&e.util.compareAppsItemsLists(n.items_list,r.data.payload.items_list.filter(function(t){return!t.trash}),function(t){var n=t.diff_fields_items,i=t.diff_fields_items_Ids,a=t.diff_items,p=t.newItems,o=t.deletedItems;(a.length||p.length||o.length)&&(e.pipeService.emit("gh_items_update",{app_id:r.data.payload.app_id},r.data.payload.items_list.filter(function(t){return!t.trash})),a.forEach(function(t){return e.pipeService.emit("gh_item_update",{app_id:r.data.payload.app_id,item_id:t.item_id},t)})),i.forEach(function(t){var i=n[t];i&&i.forEach(function(n){e.pipeService.emit("gh_value_update",{app_id:r.data.payload.app_id,item_id:t,field_id:n.field_id},n.field_value)})})}),r.data.payload.items_list=e.util.mergeChunks([n,r.data.payload]),e.saveAppInStorage(r.data.payload);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}}])}();
|
|
321
321
|
},{"../consts.js":"UV2u","../utils.js":"EgeI"}],"UUd3":[function(require,module,exports) {
|
|
322
322
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemProcessor=void 0;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 r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function i(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function n(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,o){var a=i&&i.prototype instanceof c?i:c,p=Object.create(a.prototype);return u(p,"_invoke",function(r,i,n){var o,u,a,c=0,p=n||[],f=!1,l={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,r){return o=t,u=0,a=e,l.n=r,s}};function m(r,i){for(u=r,a=i,t=0;!f&&c&&!n&&t<p.length;t++){var n,o=p[t],m=l.p,d=o[2];r>3?(n=d===i)&&(a=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=m&&((n=r<2&&m<o[1])?(u=0,l.v=i,l.n=o[1]):m<d&&(n=r<3||o[0]>i||i>d)&&(o[4]=r,o[5]=i,l.n=d,u=0))}if(n||r>1)return s;throw f=!0,i}return function(n,p,d){if(c>1)throw TypeError("Generator is already running");for(f&&1===p&&m(p,d),u=p,a=d;(t=u<2?e:a)||!f;){o||(u?u<3?(u>1&&(l.n=-1),m(u,a)):l.n=a:l.v=a);try{if(c=2,o){if(u||(n="next"),t=o[n]){if(!(t=t.call(o,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(a=TypeError("The iterator does not provide a '"+n+"' method"),u=1);o=e}else if((t=(f=l.n<0)?a:r.call(i,l))!==s)break}catch(t){o=e,u=1,a=t}finally{c=1}}return{value:t,done:f}}}(r,n,o),!0),p}var s={};function c(){}function p(){}function f(){}t=Object.getPrototypeOf;var l=[][i]?t(t([][i]())):(u(t={},i,function(){return this}),t),m=f.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,u(e,n,"GeneratorFunction")),e.prototype=Object.create(m),e}return p.prototype=f,u(m,"constructor",f),u(f,"constructor",p),p.displayName="GeneratorFunction",u(f,n,"GeneratorFunction"),u(m),u(m,n,"Generator"),u(m,i,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(o=function(){return{w:a,m:d}})()}function u(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}(u=function(e,t,r,i){function o(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))})(e,t,r,i)}function a(e,t,r,i,n,o,u){try{var a=e[o](u),s=a.value}catch(e){return void r(e)}a.done?t(s):Promise.resolve(s).then(i,n)}function s(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function u(e){a(o,i,n,u,s,"next",e)}function s(e){a(o,i,n,u,s,"throw",e)}u(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(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,l(i.key),i)}}function f(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e){var r=m(e,"string");return"symbol"==t(r)?r:r+""}function m(e,r){if("object"!=t(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,r||"default");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}var d=exports.ItemProcessor=function(){return f(function e(t,r,i,n,o){c(this,e),this.storage=t,this.pipeService=r,this.req=i,this.appProcessor=n,this.util=o,this.itemListeners()},[{key:"addItemsApi",value:function(){var e=s(o().m(function e(t,r){var i,n;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.req.post({url:"/api/items/add",form:{items:JSON.stringify(r),app_id:t}});case 1:return i=e.v,e.a(2,i);case 2:return e.p=2,n=e.v,console.log(n),e.a(2,null)}},e,this,[[0,2]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"updateItemsApi",value:function(){var e=s(o().m(function e(t,r){var i,n;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.req.post({url:"/api/items/update",form:{items:JSON.stringify(r),app_id:t}});case 1:return i=e.v,e.a(2,i);case 2:return e.p=2,n=e.v,console.log(n),e.a(2,null)}},e,this,[[0,2]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"deleteItemsApi",value:function(e){try{var t=this.req.post({url:"/api/items/delete",form:{items_ids:JSON.stringify(e)}});return t.from_apps_list=!0,t}catch(r){return console.log(r),null}}},{key:"addItemsToStorage",value:function(){var e=s(o().m(function e(t,r){var i,n=this;return o().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.appProcessor.getApp(t);case 1:return(i=e.v)&&(r.forEach(function(e){i.items_list.push(e),i.items_object[e.item_id]={};for(var r=0;r<e.fields.length;r++)i.items_object[e.item_id][e.fields[r].field_id]=e.fields[r];n.pipeService.emit("gh_item_add",{app_id:t},[e])}),this.pipeService.emit("gh_items_update",{app_id:t},i.items_list),this.storage.updateApp(i)),e.a(2,i)}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"updateItemsInStorage",value:function(){var e=s(o().m(function e(t,r,i){var n,u=this;return o().w(function(e){for(;;)switch(e.n){case 0:return this.pipeService.emit("gh_items_update",{app_id:t},r),e.n=1,this.appProcessor.getApp(t);case 1:return(n=e.v)&&r&&r.forEach(function(e){var r={app_id:t};u.pipeService.emit("gh_item_update",r,[e],i),r.item_id=e.item_id,u.pipeService.emit("gh_item_update",r,e,i);var o=n.items_list.find(function(t){return t.item_id==e.item_id})||n.trash_items.find(function(t){return t.item_id==e.item_id});o&&(e.fields.forEach(function(e){var t=o.fields.find(function(t){return t.field_id==e.field_id});r.field_id=e.field_id,t?t.field_value!=e.field_value&&(t.field_value=e.field_value,n.items_object[o.item_id][t.field_id]=t,u.pipeService.emit("gh_value_update",r,e.field_value,i)):(o.fields.push(e),n.items_object[o.item_id][e.field_id]=e,u.pipeService.emit("gh_value_update",r,e.field_value,i))}),n.items_list.some(function(e){return e.item_id===o.item_id})||(n.trash_items=n.trash_items.filter(function(e){return e.item_id!==o.item_id}),n.items_list.push(o)))}),e.a(2,r)}},e,this)}));return function(t,r,i){return e.apply(this,arguments)}}()},{key:"deleteItemsFromStorage",value:function(){var e=s(o().m(function e(t){var r,n,u=arguments;return o().w(function(e){for(;;)switch(e.n){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:[],e.n=1,this.appProcessor.getApp(t);case 1:(n=e.v)&&(n.items_list=n.items_list.filter(function(e){return!r.find(function(t){return e.item_id==t.item_id})||(null!=n&&n.trash_items||(n.trash_items=[]),null==n||n.trash_items.push(i(i({},e),{},{trash:!0,last_update:Date.now()})),delete n.items_object[e.item_id],!1)}),this.pipeService.emit("gh_items_update",{app_id:t},n.items_list),this.storage.updateApp(n));case 2:return e.a(2)}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getItems",value:function(){var e=s(o().m(function e(t){var r,i=arguments;return o().w(function(e){for(;;)switch(e.n){case 0:return i.length>1&&void 0!==i[1]&&i[1],e.n=1,this.appProcessor.getApp(t);case 1:if(r=e.v){e.n=2;break}return e.a(2,null);case 2:return e.a(2,r.items_list)}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(){var t=s(o().m(function t(r,n){var u,a;return o().w(function(t){for(;;)switch(t.n){case 0:return u=n.map(function(t){return i(i({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.n=1,this.addItemsApi(r,u);case 1:return a=t.v,t.n=2,this.addItemsToStorage(r,a);case 2:return this.pipeService.emit("gh_items_add",{app_id:r},a),t.a(2,a)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"updateItems",value:function(){var t=s(o().m(function t(r,n){var u,a;return o().w(function(t){for(;;)switch(t.n){case 0:return u=n.map(function(t){return i(i({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.n=1,this.updateItemsApi(r,u);case 1:return a=t.v,t.n=2,this.updateItemsInStorage(r,a);case 2:return t.a(2,t.v)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItems",value:function(){var e=s(o().m(function e(t,r){var i=this;return o().w(function(e){for(;;)switch(e.n){case 0:return e.a(2,this.deleteItemsApi(r).then(function(){var e=s(o().m(function e(r){return o().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i.deleteItemsFromStorage(t,r);case 1:return e.a(2,e.v)}},e)}));return function(t){return e.apply(this,arguments)}}()))}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"restoreItems",value:function(){var e=s(o().m(function e(t,r){var i;return o().w(function(e){for(;;)switch(e.n){case 0:return i=r.map(function(e){return{item_id:e,trash:!1}}),e.n=1,this.updateItems(t,i);case 1:return e.a(2,e.v)}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"itemListeners",value:function(){var e=this;this.pipeService.onRoot("gh_items_get",{},function(){var t=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getItems(i.app_id);case 1:(n=t.v)?e.pipeService.emit("gh_items_get",i,n):e.pipeService.emit("gh_items_get",i,[]);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_add",{},function(){var t=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!(i&&i.app_id&&i.items)){t.n=2;break}return t.n=1,e.addNewItems(i.app_id,i.items);case 1:(n=t.v)?e.pipeService.emit("gh_items_add",i,n):e.pipeService.emit("gh_items_add",i,[]);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_update",{},function(){var t=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!(i&&i.app_id&&i.items)){t.n=2;break}return t.n=1,e.updateItems(i.app_id,i.items);case 1:(n=t.v)?e.pipeService.emit("gh_items_update",i,n):e.pipeService.emit("gh_items_update",i,[]);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_item_get",{},function(){var t=s(o().m(function t(r,i){var n,u;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getItems(i.app_id);case 1:n=t.v,u=n.find(function(e){return e.item_id==i.item_id}),e.pipeService.emit("gh_item_get",i,u);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filtered_items_get",{},function(){var t=s(o().m(function t(r,i){var n,u;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.element_app_id){t.n=3;break}return t.n=1,e.getItems(i.element_app_id);case 1:return n=t.v,t.n=2,e.util.getFilteredItems(n,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 2:u=t.v,e.pipeService.emit("gh_filtered_items_get",i,u);case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filter_items",{},function(){var t=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.items){t.n=2;break}return t.n=1,e.util.getFilteredItems(i.items,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 1:n=t.v,e.pipeService.emit("gh_filter_items",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}())}}])}();
|
|
323
323
|
},{"../utils.js":"EgeI"}],"PoPF":[function(require,module,exports) {
|
|
324
324
|
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(){var e,n,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",u=i.toStringTag||"@@toStringTag";function a(t,i,o,u){var a=i&&i.prototype instanceof l?i:l,s=Object.create(a.prototype);return r(s,"_invoke",function(t,r,i){var o,u,a,l=0,s=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return o=t,u=0,a=e,p.n=r,c}};function d(t,r){for(u=t,a=r,n=0;!f&&l&&!i&&n<s.length;n++){var i,o=s[n],d=p.p,v=o[2];t>3?(i=v===r)&&(a=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=t<2&&d<o[1])?(u=0,p.v=r,p.n=o[1]):d<v&&(i=t<3||o[0]>r||r>v)&&(o[4]=t,o[5]=r,p.n=v,u=0))}if(i||t>1)return c;throw f=!0,r}return function(i,s,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,v),u=s,a=v;(n=u<2?e:a)||!f;){o||(u?u<3?(u>1&&(p.n=-1),d(u,a)):p.n=a:p.v=a);try{if(l=2,o){if(u||(i="next"),n=o[i]){if(!(n=n.call(o,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,u<2&&(u=0)}else 1===u&&(n=o.return)&&n.call(o),u<2&&(a=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((n=(f=p.n<0)?a:t.call(r,p))!==c)break}catch(n){o=e,u=1,a=n}finally{l=1}}return{value:n,done:f}}}(t,o,u),!0),s}var c={};function l(){}function s(){}function f(){}n=Object.getPrototypeOf;var p=[][o]?n(n([][o]())):(r(n={},o,function(){return this}),n),d=f.prototype=l.prototype=Object.create(p);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,r(e,u,"GeneratorFunction")),e.prototype=Object.create(d),e}return s.prototype=f,r(d,"constructor",f),r(f,"constructor",s),s.displayName="GeneratorFunction",r(f,u,"GeneratorFunction"),r(d),r(d,u,"Generator"),r(d,o,function(){return this}),r(d,"toString",function(){return"[object Generator]"}),(t=function(){return{w:a,m:v}})()}function r(e,t,n,i){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(r=function(e,t,n,i){function u(t,n){r(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(u("next",0),u("throw",1),u("return",2))})(e,t,n,i)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t,r,n,i,o,u){try{var a=e[o](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){u(o,n,i,a,c,"next",e)}function c(e){u(o,n,i,a,c,"throw",e)}a(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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,f(n.key),n)}}function s(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(t){var r=p(t,"string");return"symbol"==e(r)?r:r+""}function p(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FieldProcessor=void 0;var d=exports.FieldProcessor=function(){return s(function e(t,r,n,i,o){c(this,e),this.storage=t,this.req=r,this.appProcessor=n,this.itemProcessor=i,this.pipeService=o,this.fieldListeners()},[{key:"deleteFieldApi",value:function(e){return this.req.post({url:"/api/app/delete-field",form:{field_id:e}})}},{key:"updatedFieldApi",value:function(){var e=a(t().m(function e(r){var n,o,u,a=arguments;return t().w(function(e){for(;;)switch(e.n){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},e.n=1,this.appProcessor.getApp(r);case 1:return o=e.v,u={app_id:r,app_name:o.app_name,group_id:o.group_id,icon:o.icon,field_list:o.field_list.map(function(e){return e.field_id==n.field_id?i(i({},e),n):e}),views_list:o.views_list},e.a(2,this.appProcessor.updateApp(u))}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"setFieldValueApi",value:function(e,t,r,n){var i=[{item_id:t,fields:[{field_id:r,field_value:n}]}];return this.itemProcessor.updateItems(e,i)}},{key:"deleteFieldInStorage",value:function(e,t){var r=this.storage.getApp(e);return r.field_list=r.field_list.filter(function(e){return e.field_id!=t}),r.items_list=r.items_list.map(function(e){return e.fields=e.fields.filter(function(e){return e.field_id!=t}),e}),this.storage.updateApp(r),!0}},{key:"updateFieldInStorage",value:function(e,t){var r=this.storage.getApp(e);return r.field_list=r.field_list.map(function(e){return e.field_id==t.field_id?i(i({},e),t):e}),this.storage.updateApp(r),t}},{key:"updateFieldValue",value:function(e,t,r,n){var i=this.storage.getApp(e);return i.items_list.forEach(function(e){e.item_id==t&&e.fields.forEach(function(t){t.field_id==r&&(t.field_value=n,i.items_object[e.item_id][t.field_id]=t)})}),this.storage.updateApp(i),n}},{key:"getField",value:function(){var e=a(t().m(function e(r,n){var i,o;return t().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.appProcessor.getApp(r);case 1:if(i=e.v){e.n=2;break}return e.a(2,null);case 2:o=0;case 3:if(!(o<i.field_list.length)){e.n=5;break}if(i.field_list[o].field_id!=n){e.n=4;break}return e.a(2,i.field_list[o]);case 4:o++,e.n=3;break;case 5:return e.a(2,null)}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getFieldIdByNameSpace",value:function(){var e=a(t().m(function e(r,n){var i,o;return t().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.appProcessor.getApp(r);case 1:if(i=e.v){e.n=2;break}return e.a(2,null);case 2:o=0;case 3:if(!(o<i.field_list.length)){e.n=5;break}if(i.field_list[o].name_space!=n){e.n=4;break}return e.a(2,i.field_list[o].field_id);case 4:o++,e.n=3;break;case 5:return e.a(2,null)}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getFieldModels",value:function(){var e=a(t().m(function e(r){var n;return t().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.appProcessor.getApp(r);case 1:if(n=e.v){e.n=2;break}return e.a(2,null);case 2:return e.a(2,n.field_list)}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateField",value:function(){var e=a(t().m(function e(r,n){var i;return t().w(function(e){for(;;)switch(e.n){case 0:if(r&&n){e.n=1;break}return e.a(2);case 1:return e.n=2,this.updatedFieldApi(r,n);case 2:return i=e.v,e.a(2,this.updateFieldInStorage(r,i))}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"deleteField",value:function(){var e=a(t().m(function e(r,n){return t().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.deleteFieldApi(n);case 1:return e.a(2,this.deleteFieldInStorage(r,n))}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getFieldValue",value:function(){var e=a(t().m(function e(r,n,i){var o,u;return t().w(function(e){for(;;)switch(e.n){case 0:return o=null,e.n=1,this.appProcessor.getApp(r);case 1:u=e.v;try{o=u.items_object[n][i].field_value}catch(t){}return e.a(2,o)}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"setFieldValue",value:function(){var e=a(t().m(function e(r,n,i,o){return t().w(function(e){for(;;)switch(e.n){case 0:if(r&&n&&i){e.n=1;break}return e.a(2);case 1:return e.n=2,this.setFieldValueApi(r,n,i,o);case 2:return e.a(2,this.updateFieldValue(r,n,i,o))}},e,this)}));return function(t,r,n,i){return e.apply(this,arguments)}}()},{key:"fieldListeners",value:function(){var e=this;this.pipeService.onRoot("gh_value_get",{},function(){var r=a(t().m(function r(n,i){var o;return t().w(function(t){for(;;)switch(t.n){case 0:if(!(i.app_id&&i.item_id&&i.field_id)){t.n=2;break}return t.n=1,e.getFieldValue(i.app_id,i.item_id,i.field_id);case 1:o=t.v,e.pipeService.emit("gh_value_get",i,o);case 2:return t.a(2)}},r)}));return function(e,t){return r.apply(this,arguments)}}()),this.pipeService.onRoot("gh_value_set",{},function(){var r=a(t().m(function r(n,i){return t().w(function(t){for(;;)switch(t.n){case 0:i.item_id&&(e.setFieldValue(i.app_id,i.item_id,i.field_id,i.new_value),delete i.new_value);case 1:return t.a(2)}},r)}));return function(e,t){return r.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_get",{},function(){var r=a(t().m(function r(n,i){var o,u;return t().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,e.getField(i.app_id,i.field_id);case 1:o=t.v,e.pipeService.emit("gh_model_get",i,o),t.n=3;break;case 2:t.p=2,u=t.v,console.log("Field model: ",u);case 3:return t.a(2)}},r,null,[[0,2]])}));return function(e,t){return r.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_update",{},function(){var r=a(t().m(function r(n,i){var o;return t().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.updateField(i.app_id,i.field_model);case 1:o=t.v,e.pipeService.emit("gh_model_update",{app_id:i.app_id,field_id:i.field_id},o);case 2:return t.a(2)}},r)}));return function(e,t){return r.apply(this,arguments)}}()),this.pipeService.onRoot("gh_models_get",{},function(){var r=a(t().m(function r(n,i){var o;return t().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getFieldModels(i.app_id);case 1:o=t.v,e.pipeService.emit("gh_models_get",i,o);case 2:return t.a(2)}},r)}));return function(e,t){return r.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_delete",{},function(){var r=a(t().m(function r(n,i){var o;return t().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.deleteField(i.app_id,i.field_id);case 1:o=t.v,e.pipeService.emit("gh_model_delete",i,o);case 2:return t.a(2)}},r)}));return function(e,t){return r.apply(this,arguments)}}())}}])}();
|
|
325
325
|
},{}],"XUT2":[function(require,module,exports) {
|
|
326
|
-
"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t){return o(t)||i(t)||n(t)||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 n(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}function i(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function o(t){if(Array.isArray(t))return u(t)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var a=n&&n.prototype instanceof l?n:l,f=Object.create(a.prototype);return c(f,"_invoke",function(r,n,i){var o,a,c,l=0,f=i||[],s=!1,p={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(e,r){return o=e,a=0,c=t,p.n=r,u}};function v(r,n){for(a=r,c=n,e=0;!s&&l&&!i&&e<f.length;e++){var i,o=f[e],v=p.p,h=o[2];r>3?(i=h===n)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=v&&((i=r<2&&v<o[1])?(a=0,p.v=n,p.n=o[1]):v<h&&(i=r<3||o[0]>n||n>h)&&(o[4]=r,o[5]=n,p.n=h,a=0))}if(i||r>1)return u;throw s=!0,n}return function(i,f,h){if(l>1)throw TypeError("Generator is already running");for(s&&1===f&&v(f,h),a=f,c=h;(e=a<2?t:c)||!s;){o||(a?a<3?(a>1&&(p.n=-1),v(a,c)):p.n=c:p.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(s=p.n<0)?c:r.call(n,p))!==u)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:s}}}(r,i,o),!0),f}var u={};function l(){}function f(){}function s(){}e=Object.getPrototypeOf;var p=[][n]?e(e([][n]())):(c(e={},n,function(){return this}),e),v=s.prototype=l.prototype=Object.create(p);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,c(t,i,"GeneratorFunction")),t.prototype=Object.create(v),t}return f.prototype=s,c(v,"constructor",s),c(s,"constructor",f),f.displayName="GeneratorFunction",c(s,i,"GeneratorFunction"),c(v),c(v,i,"Generator"),c(v,n,function(){return this}),c(v,"toString",function(){return"[object Generator]"}),(a=function(){return{w:o,m:h}})()}function c(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(c=function(t,e,r,n){function o(e,r){c(t,e,function(t){return this._invoke(e,r,t)})}e?i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))})(t,e,r,n)}function l(t,e,r,n,i,o,u){try{var a=t[o](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,i)}function f(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function u(t){l(o,n,i,u,a,"next",t)}function a(t){l(o,n,i,u,a,"throw",t)}u(void 0)})}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,h(n.key),n)}}function v(t,e,r){return e&&p(t.prototype,e),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function h(e){var r=d(e,"string");return"symbol"==t(r)?r:r+""}function d(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,r||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileManager=void 0;var y=exports.FileManager=function(){return v(function t(e,r,n,i){s(this,t),this.storage=e,this.pipeService=r,this.req=n,this.appProcessor=i},[{key:"uploadFileApi",value:function(){var t=f(a().m(function t(e,r,n){var i,o,u;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,i={"file-0":e,app_id:r,item_id:n},t.n=1,this.req.post({url:"/file/formupload",form:i});case 1:return o=t.v,t.a(2,o);case 2:return t.p=2,u=t.v,console.log(u),t.a(2,null)}},t,this,[[0,2]])}));return function(e,r,n){return t.apply(this,arguments)}}()},{key:"uploadFileFromStringApi",value:function(){var t=f(a().m(function t(e){var r,n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/file/upload",form:{file:JSON.stringify(e)}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateFileFromStringApi",value:function(){var t=f(a().m(function t(e,r,n,i,o,u,c){var l,f,s;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,l={file_name:n,extension:i,file_id:r,format:o,source:e,alt:u,title:c},t.n=1,this.req.post({url:"/file/update",form:{file:JSON.stringify(l)}});case 1:return f=t.v,t.a(2,f);case 2:return t.p=2,s=t.v,console.log(s),t.a(2,null)}},t,this,[[0,2]])}));return function(e,r,n,i,o,u,a){return t.apply(this,arguments)}}()},{key:"duplicateFileApi",value:function(){var t=f(a().m(function t(e){return a().w(function(t){for(;;)switch(t.n){case 0:return t.a(2,this.req.post({url:"/api/new/file/duplicate",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{files:JSON.stringify(e)}}))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"downloadFileFromString",value:function(){var t=f(a().m(function t(e,r){var n,i;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.isFileExists(e,r);case 1:if(!t.v){t.n=4;break}return t.n=2,this.getFile(e,r);case 2:return n=t.v,t.n=3,this.req.get({url:n.url+"?timestamp="+n.last_update,externalResource:!0});case 3:return i=t.v,t.a(2,{file:n,data:i,type:"file"});case 4:return t.a(2,!1);case 5:return t.a(2)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"duplicateFile",value:function(){var t=f(a().m(function t(e){var r,n=this;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.duplicateFileApi(e);case 1:return(r=t.v).forEach(function(t){n.addFileToStorage(t.app_id,t)}),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteFileApi",value:function(){var t=f(a().m(function t(e){var r,n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/file/delete?file_id=".concat(e)});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"addFileToStorage",value:function(t,e){var r=this.storage.getApp(t);r&&(r.file_list.push(e),this.storage.updateApp(r),this.pipeService.emit("gh_file_upload",{app_id:t,item_id:e.item_id,file_id:e.file_id},e))}},{key:"addFilesToStorage",value:function(t,r){var n,i=this,o=this.storage.getApp(t);o&&((n=o.file_list).push.apply(n,e(r)),this.storage.updateApp(o),r.forEach(function(e){i.pipeService.emit("gh_file_upload",{app_id:t,item_id:e.item_id,file_id:e.file_id},e)}))}},{key:"deleteFileFromStorage",value:function(t,e){var r,n=this.storage.getApp(e);n&&(n.file_list=n.file_list.filter(function(e){return e.file_id!=t||(r=e,!1)}),this.storage.updateApp(n),this.pipeService.emit("gh_file_delete",{file_id:t},r))}},{key:"updateFileInStorage",value:function(t,e,r){var n=this.storage.getApp(e);n&&(n.file_list=n.file_list.map(function(e){return e.file_id==t?r:e}),this.storage.updateApp(n),this.pipeService.emit("gh_file_update",{file_id:t}))}},{key:"getFile",value:function(){var t=f(a().m(function t(e,r){var n;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.appProcessor.getApp(e);case 1:return n=t.v,t.a(2,new Promise(function(t,e){var i=n.file_list.find(function(t){return t.file_id==r});t(i||"")}))}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"getFiles",value:function(){var t=f(a().m(function t(e){var r,n,i=arguments;return a().w(function(t){for(;;)switch(t.n){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:[],t.n=1,this.appProcessor.getApp(e);case 1:return n=t.v,t.a(2,new Promise(function(t,e){var i=n.file_list.filter(function(t){return r.some(function(e){return e==t.file_id})});t(i||"")}))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"uploadFile",value:function(){var t=f(a().m(function t(e,r,n){var i;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.uploadFileApi(e,r,n);case 1:return i=t.v,this.addFileToStorage(r,i),t.a(2,i)}},t,this)}));return function(e,r,n){return t.apply(this,arguments)}}()},{key:"uploadFileFromString",value:function(){var t=f(a().m(function t(e){var r;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.uploadFileFromStringApi(e);case 1:return r=t.v,this.addFileToStorage(r.app_id,r),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateFileFromString",value:function(){var t=f(a().m(function t(e,r,n,i,o,u,c){var l;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.updateFileFromStringApi(e,r,n,i,o,u,c);case 1:return l=t.v,this.updateFileInStorage(r,l.app_id,l),t.a(2,l)}},t,this)}));return function(e,r,n,i,o,u,a){return t.apply(this,arguments)}}()},{key:"deleteFile",value:function(){var t=f(a().m(function t(e,r){return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.deleteFileApi(e);case 1:return this.deleteFileFromStorage(e,r),t.a(2,!0)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"isFileExists",value:function(){var t=f(a().m(function t(e,r){var n,i;return a().w(function(t){for(;;)switch(t.n){case 0:if(n=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:\d+)?([\/\w \.-]*)*\/?$/,!Boolean(r)){t.n=4;break}return t.n=1,this.getFile(e,r);case 1:if(i=t.v,!Boolean(i)){t.n=2;break}return t.a(2,n.test(i.url));case 2:return t.a(2,!1);case 3:t.n=5;break;case 4:return t.a(2,!1);case 5:return t.a(2)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()}])}();
|
|
326
|
+
"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t){return o(t)||i(t)||n(t)||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 n(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}function i(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function o(t){if(Array.isArray(t))return u(t)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var a=n&&n.prototype instanceof l?n:l,s=Object.create(a.prototype);return c(s,"_invoke",function(r,n,i){var o,a,c,l=0,s=i||[],f=!1,p={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,r){return o=e,a=0,c=t,p.n=r,u}};function h(r,n){for(a=r,c=n,e=0;!f&&l&&!i&&e<s.length;e++){var i,o=s[e],h=p.p,v=o[2];r>3?(i=v===n)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=h&&((i=r<2&&h<o[1])?(a=0,p.v=n,p.n=o[1]):h<v&&(i=r<3||o[0]>n||n>v)&&(o[4]=r,o[5]=n,p.n=v,a=0))}if(i||r>1)return u;throw f=!0,n}return function(i,s,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&h(s,v),a=s,c=v;(e=a<2?t:c)||!f;){o||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(f=p.n<0)?c:r.call(n,p))!==u)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:f}}}(r,i,o),!0),s}var u={};function l(){}function s(){}function f(){}e=Object.getPrototypeOf;var p=[][n]?e(e([][n]())):(c(e={},n,function(){return this}),e),h=f.prototype=l.prototype=Object.create(p);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,c(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=f,c(h,"constructor",f),c(f,"constructor",s),s.displayName="GeneratorFunction",c(f,i,"GeneratorFunction"),c(h),c(h,i,"Generator"),c(h,n,function(){return this}),c(h,"toString",function(){return"[object Generator]"}),(a=function(){return{w:o,m:v}})()}function c(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(c=function(t,e,r,n){function o(e,r){c(t,e,function(t){return this._invoke(e,r,t)})}e?i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))})(t,e,r,n)}function l(t,e,r,n,i,o,u){try{var a=t[o](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,i)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function u(t){l(o,n,i,u,a,"next",t)}function a(t){l(o,n,i,u,a,"throw",t)}u(void 0)})}}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,v(n.key),n)}}function h(t,e,r){return e&&p(t.prototype,e),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v(e){var r=d(e,"string");return"symbol"==t(r)?r:r+""}function d(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,r||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileManager=void 0;var y=exports.FileManager=function(){return h(function t(e,r,n,i,o){f(this,t),this.storage=e,this.pipeService=r,this.req=n,this.appProcessor=i,this.fieldProcessor=o},[{key:"uploadFileApi",value:function(){var t=s(a().m(function t(e,r,n){var i,o,u;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,i={"file-0":e,app_id:r,item_id:n},t.n=1,this.req.post({url:"/file/formupload",form:i});case 1:return o=t.v,t.a(2,o);case 2:return t.p=2,u=t.v,console.log(u),t.a(2,null)}},t,this,[[0,2]])}));return function(e,r,n){return t.apply(this,arguments)}}()},{key:"uploadFileFromStringApi",value:function(){var t=s(a().m(function t(e){var r,n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/file/upload",form:{file:JSON.stringify(e)}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateFileFromStringApi",value:function(){var t=s(a().m(function t(e,r,n,i,o,u,c){var l,s,f;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,l={file_name:n,extension:i,file_id:r,format:o,source:e,alt:u,title:c},t.n=1,this.req.post({url:"/file/update",form:{file:JSON.stringify(l)}});case 1:return s=t.v,t.a(2,s);case 2:return t.p=2,f=t.v,console.log(f),t.a(2,null)}},t,this,[[0,2]])}));return function(e,r,n,i,o,u,a){return t.apply(this,arguments)}}()},{key:"duplicateFileApi",value:function(){var t=s(a().m(function t(e){return a().w(function(t){for(;;)switch(t.n){case 0:return t.a(2,this.req.post({url:"/api/new/file/duplicate",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{files:JSON.stringify(e)}}))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"downloadFileFromString",value:function(){var t=s(a().m(function t(e,r){var n,i;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.isFileExists(e,r);case 1:if(!t.v){t.n=4;break}return t.n=2,this.getFile(e,r);case 2:return n=t.v,t.n=3,this.req.get({url:n.url+"?timestamp="+n.last_update,externalResource:!0});case 3:return i=t.v,t.a(2,{file:n,data:i,type:"file"});case 4:return t.a(2,!1);case 5:return t.a(2)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"duplicateFile",value:function(){var t=s(a().m(function t(e){var r,n=this;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.duplicateFileApi(e);case 1:return(r=t.v).forEach(function(t){n.addFileToStorage(t.app_id,t)}),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteFileApi",value:function(){var t=s(a().m(function t(e){var r,n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/file/delete?file_id=".concat(e)});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,n=t.v,console.log(n),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"addFileToStorage",value:function(t,e){var r=this.storage.getApp(t);r&&(r.file_list.push(e),this.storage.updateApp(r),this.pipeService.emit("gh_file_upload",{app_id:t,item_id:e.item_id,file_id:e.file_id},e))}},{key:"addFilesToStorage",value:function(t,r){var n,i=this,o=this.storage.getApp(t);o&&((n=o.file_list).push.apply(n,e(r)),this.storage.updateApp(o),r.forEach(function(e){i.pipeService.emit("gh_file_upload",{app_id:t,item_id:e.item_id,file_id:e.file_id},e)}))}},{key:"deleteFileFromStorage",value:function(t,e){var r,n=this.storage.getApp(e);n&&(n.file_list=n.file_list.filter(function(e){return e.file_id!=t||(r=e,!1)}),this.storage.updateApp(n),this.pipeService.emit("gh_file_delete",{file_id:t},r))}},{key:"updateFileInStorage",value:function(t,e,r){var n=this.storage.getApp(e);n&&(n.file_list=n.file_list.map(function(e){return e.file_id==t?r:e}),this.storage.updateApp(n),this.pipeService.emit("gh_file_update",{file_id:t}))}},{key:"getFile",value:function(){var t=s(a().m(function t(e,r){var n;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.appProcessor.getApp(e);case 1:return n=t.v,t.a(2,new Promise(function(t,e){var i=n.file_list.find(function(t){return t.file_id==r});t(i||"")}))}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"getFiles",value:function(){var t=s(a().m(function t(e){var r,n,i=arguments;return a().w(function(t){for(;;)switch(t.n){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:[],t.n=1,this.appProcessor.getApp(e);case 1:return n=t.v,t.a(2,new Promise(function(t,e){var i=n.file_list.filter(function(t){return r.some(function(e){return e==t.file_id})});t(i||"")}))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"uploadFile",value:function(){var t=s(a().m(function t(e,r,n){var i;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.uploadFileApi(e,r,n);case 1:return i=t.v,this.addFileToStorage(r,i),t.a(2,i)}},t,this)}));return function(e,r,n){return t.apply(this,arguments)}}()},{key:"uploadFileFromString",value:function(){var t=s(a().m(function t(e){var r;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.uploadFileFromStringApi(e);case 1:return r=t.v,this.addFileToStorage(r.app_id,r),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"uploadFileFromStringWithSetValue",value:function(){var t=s(a().m(function t(e){var r;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.uploadFileFromString(e);case 1:return r=t.v,t.n=2,this.fieldProcessor.setFieldValue(r.app_id,r.item_id,e.element_id,r.file_id);case 2:return t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateFileFromString",value:function(){var t=s(a().m(function t(e,r,n,i,o,u,c){var l;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.updateFileFromStringApi(e,r,n,i,o,u,c);case 1:return l=t.v,this.updateFileInStorage(r,l.app_id,l),t.a(2,l)}},t,this)}));return function(e,r,n,i,o,u,a){return t.apply(this,arguments)}}()},{key:"deleteFile",value:function(){var t=s(a().m(function t(e,r){return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.deleteFileApi(e);case 1:return this.deleteFileFromStorage(e,r),t.a(2,!0)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"isFileExists",value:function(){var t=s(a().m(function t(e,r){var n,i;return a().w(function(t){for(;;)switch(t.n){case 0:if(n=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:\d+)?([\/\w \.-]*)*\/?$/,!Boolean(r)){t.n=4;break}return t.n=1,this.getFile(e,r);case 1:if(i=t.v,!Boolean(i)){t.n=2;break}return t.a(2,n.test(i.url));case 2:return t.a(2,!1);case 3:t.n=5;break;case 4:return t.a(2,!1);case 5:return t.a(2)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()}])}();
|
|
327
327
|
},{}],"KHGc":[function(require,module,exports) {
|
|
328
328
|
"use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(){var t,e,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.toStringTag||"@@toStringTag";function a(n,o,i,u){var a=o&&o.prototype instanceof s?o:s,f=Object.create(a.prototype);return r(f,"_invoke",function(n,r,o){var i,u,a,s=0,f=o||[],p=!1,l={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(n,r){return i=n,u=0,a=t,l.n=r,c}};function h(n,r){for(u=n,a=r,e=0;!p&&s&&!o&&e<f.length;e++){var o,i=f[e],h=l.p,v=i[2];n>3?(o=v===r)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=h&&((o=n<2&&h<i[1])?(u=0,l.v=r,l.n=i[1]):h<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,l.n=v,u=0))}if(o||n>1)return c;throw p=!0,r}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(p&&1===f&&h(f,v),u=f,a=v;(e=u<2?t:a)||!p;){i||(u?u<3?(u>1&&(l.n=-1),h(u,a)):l.n=a:l.v=a);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(p=l.n<0)?a:n.call(r,l))!==c)break}catch(e){i=t,u=1,a=e}finally{s=1}}return{value:e,done:p}}}(n,i,u),!0),f}var c={};function s(){}function f(){}function p(){}e=Object.getPrototypeOf;var l=[][i]?e(e([][i]())):(r(e={},i,function(){return this}),e),h=p.prototype=s.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,r(t,u,"GeneratorFunction")),t.prototype=Object.create(h),t}return f.prototype=p,r(h,"constructor",p),r(p,"constructor",f),f.displayName="GeneratorFunction",r(p,u,"GeneratorFunction"),r(h),r(h,u,"Generator"),r(h,i,function(){return this}),r(h,"toString",function(){return"[object Generator]"}),(n=function(){return{w:a,m:v}})()}function r(t,n,e,o){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(r=function(t,n,e,o){function u(n,e){r(t,n,function(t){return this._invoke(n,e,t)})}n?i?i(t,n,{value:e,enumerable:!o,configurable:!o,writable:!o}):t[n]=e:(u("next",0),u("throw",1),u("return",2))})(t,n,e,o)}function e(t,n,r,e,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?n(c):Promise.resolve(c).then(e,o)}function o(t){return function(){var n=this,r=arguments;return new Promise(function(o,i){var u=t.apply(n,r);function a(t){e(u,o,i,a,c,"next",t)}function c(t){e(u,o,i,a,c,"throw",t)}a(void 0)})}}function i(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function u(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,c(e.key),e)}}function a(t,n,r){return n&&u(t.prototype,n),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(n){var r=s(n,"string");return"symbol"==t(r)?r:r+""}function s(n,r){if("object"!=t(n)||!n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var o=e.call(n,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(n)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChunksManager=void 0;var f=exports.ChunksManager=function(){return a(function t(n,r,e,o){i(this,t),this.storage=n,this.pipeService=r,this.req=e,this.util=o,this.itemListeners()},[{key:"getChunkApi",value:function(){var t=o(n().m(function t(r,e){var o,i;return n().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.axiosRequest({url:"".concat(this.req.root,"/api/get-items-chunk/").concat(r,"/").concat(e),method:"GET"});case 1:return o=t.v,t.a(2,o);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(n,r){return t.apply(this,arguments)}}()},{key:"getLastChunkApi",value:function(){var t=o(n().m(function t(r){var e,o;return n().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.axiosRequest({url:"".concat(this.req.root,"/api/get-last-items-chunk/").concat(r),method:"GET"});case 1:return e=t.v,t.a(2,e);case 2:return t.p=2,o=t.v,console.log(o),t.a(2,null)}},t,this,[[0,2]])}));return function(n){return t.apply(this,arguments)}}()},{key:"getChunk",value:function(t,n){return this.getChunkApi(t,n)}},{key:"getChunks",value:function(){var t=o(n().m(function t(r,e){var o,i=this;return n().w(function(t){for(;;)switch(t.n){case 0:if(o=[],!e){t.n=2;break}return t.n=1,Promise.all(e.map(function(t){return i.getChunkApi(r,t)}));case 1:o=t.v;case 2:return t.a(2,o)}},t)}));return function(n,r){return t.apply(this,arguments)}}()},{key:"getLastChunk",value:function(){var t=o(n().m(function t(r){var e;return n().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getLastChunkApi(r);case 1:return e=t.v,t.a(2,e)}},t,this)}));return function(n){return t.apply(this,arguments)}}()},{key:"itemListeners",value:function(){}},{key:"getApp",value:function(){var t=o(n().m(function t(r){var e;return n().w(function(t){for(;;)switch(t.n){case 0:if(r){t.n=1;break}return t.a(2,null);case 1:if(e=this.getAppFromStorage(r)){t.n=5;break}if(!this.getAppPromises[r]){t.n=2;break}return t.a(2,this.getAppPromises[r]);case 2:return this.getAppPromises[r]=this.getAppApi(r),t.n=3,this.getAppPromises[r];case 3:if(!(e=t.v)){t.n=4;break}this.saveAppInStorage(e),this.ws.addSubscription(r),t.n=5;break;case 4:return t.a(2,null);case 5:return t.a(2,e)}},t,this)}));return function(n){return t.apply(this,arguments)}}()}])}();
|
|
329
329
|
},{}],"K1Gs":[function(require,module,exports) {
|
|
@@ -345,7 +345,7 @@ var t=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
|
345
345
|
},{}],"quyV":[function(require,module,exports) {
|
|
346
346
|
"use strict";function t(){var e,n,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.toStringTag||"@@toStringTag";function a(t,o,i,u){var a=o&&o.prototype instanceof f?o:f,s=Object.create(a.prototype);return r(s,"_invoke",function(t,r,o){var i,u,a,f=0,s=o||[],p=!1,l={p:0,n:0,v:e,a:y,f:y.bind(e,4),d:function(t,r){return i=t,u=0,a=e,l.n=r,c}};function y(t,r){for(u=t,a=r,n=0;!p&&f&&!o&&n<s.length;n++){var o,i=s[n],y=l.p,b=i[2];t>3?(o=b===r)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=y&&((o=t<2&&y<i[1])?(u=0,l.v=r,l.n=i[1]):y<b&&(o=t<3||i[0]>r||r>b)&&(i[4]=t,i[5]=r,l.n=b,u=0))}if(o||t>1)return c;throw p=!0,r}return function(o,s,b){if(f>1)throw TypeError("Generator is already running");for(p&&1===s&&y(s,b),u=s,a=b;(n=u<2?e:a)||!p;){i||(u?u<3?(u>1&&(l.n=-1),y(u,a)):l.n=a:l.v=a);try{if(f=2,i){if(u||(o="next"),n=i[o]){if(!(n=n.call(i,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,u<2&&(u=0)}else 1===u&&(n=i.return)&&n.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((n=(p=l.n<0)?a:t.call(r,l))!==c)break}catch(n){i=e,u=1,a=n}finally{f=1}}return{value:n,done:p}}}(t,i,u),!0),s}var c={};function f(){}function s(){}function p(){}n=Object.getPrototypeOf;var l=[][i]?n(n([][i]())):(r(n={},i,function(){return this}),n),y=p.prototype=f.prototype=Object.create(l);function b(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,r(t,u,"GeneratorFunction")),t.prototype=Object.create(y),t}return s.prototype=p,r(y,"constructor",p),r(p,"constructor",s),s.displayName="GeneratorFunction",r(p,u,"GeneratorFunction"),r(y),r(y,u,"Generator"),r(y,i,function(){return this}),r(y,"toString",function(){return"[object Generator]"}),(t=function(){return{w:a,m:b}})()}function r(t,e,n,o){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(r=function(t,e,n,o){function u(e,n){r(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!o,configurable:!o,writable:!o}):t[e]=n:(u("next",0),u("throw",1),u("return",2))})(t,e,n,o)}function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise(function(o,i){var u=t.apply(r,e);function a(t){n(u,o,i,a,c,"next",t)}function c(t){n(u,o,i,a,c,"throw",t)}a(void 0)})}}function i(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function u(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function a(t,r,e){return r&&u(t.prototype,r),e&&u(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t){var r=f(t,"string");return"symbol"==e(r)?r:r+""}function f(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebSocketEmitter=void 0;var s=exports.WebSocketEmitter=function(){return a(function t(r){i(this,t),this.gudhub=r},[{key:"emitToUser",value:function(){var r=o(t().m(function r(n,o){var i,u;return t().w(function(t){for(;;)switch(t.n){case 0:return i={user_id:n,data:"object"===e(o)?JSON.stringify(o):o},t.n=1,this.gudhub.req.post({url:"/ws/emit-to-user",form:i});case 1:return u=t.v,t.a(2,u)}},r,this)}));return function(t,e){return r.apply(this,arguments)}}()},{key:"broadcastToAppSubscribers",value:function(){var r=o(t().m(function r(e,n,o){var i,u;return t().w(function(t){for(;;)switch(t.n){case 0:return i={app_id:e,data:JSON.stringify({data_type:n,data:o})},t.n=1,this.gudhub.req.post({url:"/ws/broadcast-to-app-subscribers",form:i});case 1:return u=t.v,t.a(2,u)}},r,this)}));return function(t,e,n){return r.apply(this,arguments)}}()}])}();
|
|
347
347
|
},{}],"U9gy":[function(require,module,exports) {
|
|
348
|
-
"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"),o=require("./Utils/Utils.js"),u=require("./Auth/Auth.js"),s=require("./GHConstructor/ghconstructor.js"),a=require("./AppProcessor/AppProcessor.js"),c=require("./ItemProcessor/ItemProcessor.js"),l=require("./FieldProcessor/FieldProcessor.js"),p=require("./FileManager/FileManager.js"),h=require("./ChunksManager/ChunksManager.js"),f=require("./DocumentManager/DocumentManager.js"),d=require("./GHConstructor/interpritate.js"),v=require("./consts.js"),g=require("./WebSocket/WebsocketHandler.js"),y=require("./Utils/sharing/GroupSharing.js"),k=require("./Utils/sharing/GroupInvitation.js"),m=require("./Utils/sharing/Sharing.js"),b=require("./WebSocket/WebSocketEmitter.js");function S(e){return(S="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 w(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var a=i&&i.prototype instanceof s?i:s,c=Object.create(a.prototype);return P(c,"_invoke",function(r,i,n){var o,s,a,c=0,l=n||[],p=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,r){return o=t,s=0,a=e,h.n=r,u}};function f(r,i){for(s=r,a=i,t=0;!p&&c&&!n&&t<l.length;t++){var n,o=l[t],f=h.p,d=o[2];r>3?(n=d===i)&&(a=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((n=r<2&&f<o[1])?(s=0,h.v=i,h.n=o[1]):f<d&&(n=r<3||o[0]>i||i>d)&&(o[4]=r,o[5]=i,h.n=d,s=0))}if(n||r>1)return u;throw p=!0,i}return function(n,l,d){if(c>1)throw TypeError("Generator is already running");for(p&&1===l&&f(l,d),s=l,a=d;(t=s<2?e:a)||!p;){o||(s?s<3?(s>1&&(h.n=-1),f(s,a)):h.n=a:h.v=a);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(a=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(p=h.n<0)?a:r.call(i,h))!==u)break}catch(t){o=e,s=1,a=t}finally{c=1}}return{value:t,done:p}}}(r,n,o),!0),c}var u={};function s(){}function a(){}function c(){}t=Object.getPrototypeOf;var l=[][i]?t(t([][i]())):(P(t={},i,function(){return this}),t),p=c.prototype=s.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,P(e,n,"GeneratorFunction")),e.prototype=Object.create(p),e}return a.prototype=c,P(p,"constructor",c),P(c,"constructor",a),a.displayName="GeneratorFunction",P(c,n,"GeneratorFunction"),P(p),P(p,n,"Generator"),P(p,i,function(){return this}),P(p,"toString",function(){return"[object Generator]"}),(w=function(){return{w:o,m:h}})()}function P(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}(P=function(e,t,r,i){function o(t,r){P(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))})(e,t,r,i)}function F(e,t,r,i,n,o,u){try{var s=e[o](u),a=s.value}catch(e){return void r(e)}s.done?t(a):Promise.resolve(a).then(i,n)}function I(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function u(e){F(o,i,n,u,s,"next",e)}function s(e){F(o,i,n,u,s,"throw",e)}u(void 0)})}}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(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,W(i.key),i)}}function q(e,t,r){return t&&j(e.prototype,t),r&&j(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function W(e){var t=A(e,"string");return"symbol"==S(t)?t:t+""}function A(e,t){if("object"!=S(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=S(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var M=exports.GudHub=function(){return q(function v(S){var w=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{server_url:n.server_url,wss_url:n.wss_url,node_server_url:n.node_server_url,initWebsocket:!1,activateSW:!1,swLink:"",async_modules_path:n.async_modules_path,file_server_url:n.file_server_url,automation_modules_path:n.automation_modules_path,accesstoken:this.accesstoken,expirydate:this.expirydate};_(this,v),this.config=w,this.ghconstructor=new s.GHConstructor(this),this.interpritate=new d.Interpritate(this),this.pipeService=new t.PipeService,this.storage=new r.Storage(w.async_modules_path,w.file_server_url,w.automation_modules_path),this.util=new o.Utils(this),this.req=new e.GudHubHttpsService(w.server_url),this.auth=new u.Auth(this.req,this.storage),this.sharing=new m.Sharing(this,this.req),this.groupSharing=new y.GroupSharing(this,this.req,this.pipeService),this.groupInvitation=new k.GroupInvitation(this,this.req),S?this.storage.setUser({auth_key:S}):w.accesstoken&&w.expirydate&&this.storage.setUser({accesstoken:w.accesstoken,expirydate:w.expirydate}),this.req.init(this.auth.getToken.bind(this.auth)),this.ws=new i.WebSocketApi(w.wss_url,this.auth),this.chunksManager=new h.ChunksManager(this.storage,this.pipeService,this.req,this.util),this.appProcessor=new a.AppProcessor(this.storage,this.pipeService,this.req,this.ws,this.chunksManager,this.util,w.activateSW),this.itemProcessor=new c.ItemProcessor(this.storage,this.pipeService,this.req,this.appProcessor,this.util),this.fieldProcessor=new l.FieldProcessor(this.storage,this.req,this.appProcessor,this.itemProcessor,this.pipeService),this.fileManager=new p.FileManager(this.storage,this.pipeService,this.req,this.appProcessor),this.documentManager=new f.DocumentManager(this.req,this.pipeService),this.websocketsemitter=new b.WebSocketEmitter(this),w.initWebsocket&&this.ws.initWebSocket(g.WebsocketHandler.bind(this,this),this.appProcessor.refreshApps.bind(this.appProcessor));w.activateSW&&this.activateSW(w.swLink)},[{key:"activateSW",value:function(){var e=I(w().m(function e(t){var r,i;return w().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(v.IS_WEB&&"serviceWorker"in window.navigator)){e.n=5;break}return e.p=1,e.n=2,window.navigator.serviceWorker.register(t);case 2:(r=e.v).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.n=4;break;case 3:e.p=3,i=e.v,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;",i);case 4:e.n=6;break;case 5:console.log("%cSW ->>> ServiceWorkers not supported","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;");case 6:return e.a(2)}},e,null,[[1,3]])}));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){return this.util.prefilter(e,t)}},{key:"debounce",value:function(e,t){return this.util.debounce(e,t)}},{key:"emitToUser",value:function(e,t){return this.websocketsemitter.emitToUser(e,t)}},{key:"broadcastToAppSubscribers",value:function(e,t,r){return this.websocketsemitter.broadcastToAppSubscribers(e,t,r)}},{key:"getInterpretation",value:function(e,t,r,i,n,o,u){return this.interpritate.getInterpretation(e,t,r,i,n,o,u)}},{key:"getInterpretationById",value:function(e,t,r,i,n,o){return this.interpritate.getInterpretationById(e,t,r,i,n,o)}},{key:"filter",value:function(e,t){return this.util.filter(e,t)}},{key:"mergeFilters",value:function(e,t){return this.util.mergeFilters(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:"sortItems",value:function(e,t){return this.util.sortItems(e,t)}},{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,o){return this.util.populateWithItemRef(e,t,r,i,n,o)}},{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,i){return this.util.jsonConstructor(e,t,r,i)}},{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=I(w().m(function e(t,r){var i;return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.getItems(t);case 1:if(!(i=e.v)){e.n=2;break}return e.a(2,i.find(function(e){return e.item_id==r}));case 2:return e.a(2)}},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:"restoreItems",value:function(e,t){return this.itemProcessor.restoreItems(e,t)}},{key:"getField",value:function(e,t){return this.fieldProcessor.getField(e,t)}},{key:"getFieldIdByNameSpace",value:function(e,t){return this.fieldProcessor.getFieldIdByNameSpace(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:"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,o,u){return this.fileManager.uploadFileFromString(e,t,r,i,n,o,u)}},{key:"updateFileFromString",value:function(e,t,r,i,n,o,u){return this.fileManager.updateFileFromString(e,t,r,i,n,o,u)}},{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:"loginWithToken",value:function(e){return this.auth.loginWithToken(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)}}])}();
|
|
348
|
+
"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"),o=require("./Utils/Utils.js"),u=require("./Auth/Auth.js"),s=require("./GHConstructor/ghconstructor.js"),a=require("./AppProcessor/AppProcessor.js"),c=require("./ItemProcessor/ItemProcessor.js"),l=require("./FieldProcessor/FieldProcessor.js"),p=require("./FileManager/FileManager.js"),h=require("./ChunksManager/ChunksManager.js"),f=require("./DocumentManager/DocumentManager.js"),d=require("./GHConstructor/interpritate.js"),v=require("./consts.js"),g=require("./WebSocket/WebsocketHandler.js"),y=require("./Utils/sharing/GroupSharing.js"),k=require("./Utils/sharing/GroupInvitation.js"),m=require("./Utils/sharing/Sharing.js"),b=require("./WebSocket/WebSocketEmitter.js");function S(e){return(S="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 w(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var a=i&&i.prototype instanceof s?i:s,c=Object.create(a.prototype);return P(c,"_invoke",function(r,i,n){var o,s,a,c=0,l=n||[],p=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,r){return o=t,s=0,a=e,h.n=r,u}};function f(r,i){for(s=r,a=i,t=0;!p&&c&&!n&&t<l.length;t++){var n,o=l[t],f=h.p,d=o[2];r>3?(n=d===i)&&(a=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((n=r<2&&f<o[1])?(s=0,h.v=i,h.n=o[1]):f<d&&(n=r<3||o[0]>i||i>d)&&(o[4]=r,o[5]=i,h.n=d,s=0))}if(n||r>1)return u;throw p=!0,i}return function(n,l,d){if(c>1)throw TypeError("Generator is already running");for(p&&1===l&&f(l,d),s=l,a=d;(t=s<2?e:a)||!p;){o||(s?s<3?(s>1&&(h.n=-1),f(s,a)):h.n=a:h.v=a);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(a=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(p=h.n<0)?a:r.call(i,h))!==u)break}catch(t){o=e,s=1,a=t}finally{c=1}}return{value:t,done:p}}}(r,n,o),!0),c}var u={};function s(){}function a(){}function c(){}t=Object.getPrototypeOf;var l=[][i]?t(t([][i]())):(P(t={},i,function(){return this}),t),p=c.prototype=s.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,P(e,n,"GeneratorFunction")),e.prototype=Object.create(p),e}return a.prototype=c,P(p,"constructor",c),P(c,"constructor",a),a.displayName="GeneratorFunction",P(c,n,"GeneratorFunction"),P(p),P(p,n,"Generator"),P(p,i,function(){return this}),P(p,"toString",function(){return"[object Generator]"}),(w=function(){return{w:o,m:h}})()}function P(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}(P=function(e,t,r,i){function o(t,r){P(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))})(e,t,r,i)}function F(e,t,r,i,n,o,u){try{var s=e[o](u),a=s.value}catch(e){return void r(e)}s.done?t(a):Promise.resolve(a).then(i,n)}function I(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function u(e){F(o,i,n,u,s,"next",e)}function s(e){F(o,i,n,u,s,"throw",e)}u(void 0)})}}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(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,q(i.key),i)}}function W(e,t,r){return t&&j(e.prototype,t),r&&j(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function q(e){var t=A(e,"string");return"symbol"==S(t)?t:t+""}function A(e,t){if("object"!=S(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=S(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var M=exports.GudHub=function(){return W(function v(S){var w=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{server_url:n.server_url,wss_url:n.wss_url,node_server_url:n.node_server_url,initWebsocket:!1,activateSW:!1,swLink:"",async_modules_path:n.async_modules_path,file_server_url:n.file_server_url,automation_modules_path:n.automation_modules_path,accesstoken:this.accesstoken,expirydate:this.expirydate};_(this,v),this.config=w,this.ghconstructor=new s.GHConstructor(this),this.interpritate=new d.Interpritate(this),this.pipeService=new t.PipeService,this.storage=new r.Storage(w.async_modules_path,w.file_server_url,w.automation_modules_path),this.util=new o.Utils(this),this.req=new e.GudHubHttpsService(w.server_url),this.auth=new u.Auth(this.req,this.storage),this.sharing=new m.Sharing(this,this.req),this.groupSharing=new y.GroupSharing(this,this.req,this.pipeService),this.groupInvitation=new k.GroupInvitation(this,this.req),S?this.storage.setUser({auth_key:S}):w.accesstoken&&w.expirydate&&this.storage.setUser({accesstoken:w.accesstoken,expirydate:w.expirydate}),this.req.init(this.auth.getToken.bind(this.auth)),this.ws=new i.WebSocketApi(w.wss_url,this.auth),this.chunksManager=new h.ChunksManager(this.storage,this.pipeService,this.req,this.util),this.appProcessor=new a.AppProcessor(this.storage,this.pipeService,this.req,this.ws,this.chunksManager,this.util,w.activateSW),this.itemProcessor=new c.ItemProcessor(this.storage,this.pipeService,this.req,this.appProcessor,this.util),this.fieldProcessor=new l.FieldProcessor(this.storage,this.req,this.appProcessor,this.itemProcessor,this.pipeService),this.fileManager=new p.FileManager(this.storage,this.pipeService,this.req,this.appProcessor,this.fieldProcessor),this.documentManager=new f.DocumentManager(this.req,this.pipeService),this.websocketsemitter=new b.WebSocketEmitter(this),w.initWebsocket&&this.ws.initWebSocket(g.WebsocketHandler.bind(this,this),this.appProcessor.refreshApps.bind(this.appProcessor));w.activateSW&&this.activateSW(w.swLink)},[{key:"activateSW",value:function(){var e=I(w().m(function e(t){var r,i;return w().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(v.IS_WEB&&"serviceWorker"in window.navigator)){e.n=5;break}return e.p=1,e.n=2,window.navigator.serviceWorker.register(t);case 2:(r=e.v).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.n=4;break;case 3:e.p=3,i=e.v,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;",i);case 4:e.n=6;break;case 5:console.log("%cSW ->>> ServiceWorkers not supported","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;");case 6:return e.a(2)}},e,null,[[1,3]])}));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){return this.util.prefilter(e,t)}},{key:"debounce",value:function(e,t){return this.util.debounce(e,t)}},{key:"emitToUser",value:function(e,t){return this.websocketsemitter.emitToUser(e,t)}},{key:"broadcastToAppSubscribers",value:function(e,t,r){return this.websocketsemitter.broadcastToAppSubscribers(e,t,r)}},{key:"getInterpretation",value:function(e,t,r,i,n,o,u){return this.interpritate.getInterpretation(e,t,r,i,n,o,u)}},{key:"getInterpretationById",value:function(e,t,r,i,n,o){return this.interpritate.getInterpretationById(e,t,r,i,n,o)}},{key:"filter",value:function(e,t){return this.util.filter(e,t)}},{key:"mergeFilters",value:function(e,t){return this.util.mergeFilters(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:"sortItems",value:function(e,t){return this.util.sortItems(e,t)}},{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,o){return this.util.populateWithItemRef(e,t,r,i,n,o)}},{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,i){return this.util.jsonConstructor(e,t,r,i)}},{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=I(w().m(function e(t,r){var i;return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.getItems(t);case 1:if(!(i=e.v)){e.n=2;break}return e.a(2,i.find(function(e){return e.item_id==r}));case 2:return e.a(2)}},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:"restoreItems",value:function(e,t){return this.itemProcessor.restoreItems(e,t)}},{key:"getField",value:function(e,t){return this.fieldProcessor.getField(e,t)}},{key:"getFieldIdByNameSpace",value:function(e,t){return this.fieldProcessor.getFieldIdByNameSpace(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:"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,o,u){return this.fileManager.uploadFileFromString(e,t,r,i,n,o,u)}},{key:"uploadFileFromStringWithSetValue",value:function(e){return this.fileManager.uploadFileFromStringWithSetValue(e)}},{key:"updateFileFromString",value:function(e,t,r,i,n,o,u){return this.fileManager.updateFileFromString(e,t,r,i,n,o,u)}},{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:"loginWithToken",value:function(e){return this.auth.loginWithToken(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)}}])}();
|
|
349
349
|
},{"./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","./GHConstructor/ghconstructor.js":"Htuh","./AppProcessor/AppProcessor.js":"q0my","./ItemProcessor/ItemProcessor.js":"UUd3","./FieldProcessor/FieldProcessor.js":"PoPF","./FileManager/FileManager.js":"XUT2","./ChunksManager/ChunksManager.js":"KHGc","./DocumentManager/DocumentManager.js":"K1Gs","./GHConstructor/interpritate.js":"X4Dt","./consts.js":"UV2u","./WebSocket/WebsocketHandler.js":"sPce","./Utils/sharing/GroupSharing.js":"LS0j","./Utils/sharing/GroupInvitation.js":"kPfD","./Utils/sharing/Sharing.js":"XaHW","./WebSocket/WebSocketEmitter.js":"quyV"}],"iRRN":[function(require,module,exports) {
|
|
350
350
|
"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=exports.default=e.GudHub;
|
|
351
351
|
},{"regenerator-runtime/runtime.js":"KA2S","./GUDHUB/gudhub.js":"U9gy"}]},{},["iRRN"], "GudHubLibrary")
|