@gudhub/core 1.1.147 → 1.1.149
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/FileManager/FileManager.js +8 -1
- package/GUDHUB/FileManager/file_manager.test.js +12 -1
- package/GUDHUB/Utils/AppsTemplateService/AppsTemplateService.js +6 -0
- 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
|
});
|
|
@@ -408,6 +408,12 @@ export default class AppsTemplateService {
|
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
+
// field_id_for_item_name lives on the app root, outside field_list, so the crawl below never visits it
|
|
412
|
+
if (app.field_id_for_item_name) {
|
|
413
|
+
const itemNameField = appsConnectingMap.fields.find(field => field.old_field_id == app.field_id_for_item_name);
|
|
414
|
+
if (itemNameField) app.field_id_for_item_name = itemNameField.new_field_id;
|
|
415
|
+
}
|
|
416
|
+
|
|
411
417
|
this._crawling(app.field_list, (prop, value, parent) => {
|
|
412
418
|
const fieldProps = ['field_id', 'FieldId', 'destination_field', 'element_id'];
|
|
413
419
|
const appProps = ['app_id', 'AppId', 'destination_app'];
|
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
|
@@ -293,7 +293,7 @@ function o(e){return module.exports=o="function"==typeof Symbol&&"symbol"==typeo
|
|
|
293
293
|
},{}],"nKaW":[function(require,module,exports) {
|
|
294
294
|
"use strict";function t(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 e(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function r(t){return u(t)||o(t)||i(t)||n()}function n(){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 i(t,e){if(t){if("string"==typeof t)return a(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)?a(t,e):void 0}}function o(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function u(t){if(Array.isArray(t))return a(t)}function a(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 c(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}}function f(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var c=n&&n.prototype instanceof a?n:a,f=Object.create(c.prototype);return s(f,"_invoke",function(r,n,i){var o,a,c,f=0,s=i||[],l=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return o=e,a=0,c=t,p.n=r,u}};function d(r,n){for(a=r,c=n,e=0;!l&&f&&!i&&e<s.length;e++){var i,o=s[e],d=p.p,y=o[2];r>3?(i=y===n)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=r<2&&d<o[1])?(a=0,p.v=n,p.n=o[1]):d<y&&(i=r<3||o[0]>n||n>y)&&(o[4]=r,o[5]=n,p.n=y,a=0))}if(i||r>1)return u;throw l=!0,n}return function(i,s,y){if(f>1)throw TypeError("Generator is already running");for(l&&1===s&&d(s,y),a=s,c=y;(e=a<2?t:c)||!l;){o||(a?a<3?(a>1&&(p.n=-1),d(a,c)):p.n=c:p.v=c);try{if(f=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=(l=p.n<0)?c:r.call(n,p))!==u)break}catch(e){o=t,a=1,c=e}finally{f=1}}return{value:e,done:l}}}(r,i,o),!0),f}var u={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var p=[][n]?e(e([][n]())):(s(e={},n,function(){return this}),e),d=l.prototype=a.prototype=Object.create(p);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,s(t,i,"GeneratorFunction")),t.prototype=Object.create(d),t}return c.prototype=l,s(d,"constructor",l),s(l,"constructor",c),c.displayName="GeneratorFunction",s(l,i,"GeneratorFunction"),s(d),s(d,i,"Generator"),s(d,n,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(f=function(){return{w:o,m:y}})()}function s(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(s=function(t,e,r,n){function o(e,r){s(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){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p(t){var e=d(t,"string");return"symbol"==y(e)?e:e+""}function d(t,e){if("object"!=y(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function y(t){return(y="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 b(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 v(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function u(t){b(o,n,i,u,a,"next",t)}function a(t){b(o,n,i,u,a,"throw",t)}u(void 0)})}}function m(t,n,i,o,u){function a(t,e,r){return s.apply(this,arguments)}function s(){return(s=v(f().m(function t(e,r,n){var i,o,u,s,d,v,m,h,w;return f().w(function(t){for(;;)switch(t.n){case 0:if(i=null,"array"!==e.type){t.n=4;break}if(!Number(e.is_static)){t.n=2;break}return v=Array,t.n=1,_(e.childs,r,n);case 1:m=t.v,i=new v(m),t.n=4;break;case 2:return t.n=3,p(e,r,n);case 3:i=t.v;case 4:if("object"!==e.type){t.n=8;break}if(!Number(e.current_item)){t.n=6;break}return t.n=5,b(e,r);case 5:i=t.v,t.n=8;break;case 6:return t.n=7,_(e.childs,r,n);case 7:i=t.v;case 8:if("property"!==e.type){t.n=10;break}return t.n=9,g(e,r,n);case 9:i=t.v;case 10:if("object"!==y(e)||void 0!==e.type){t.n=15;break}o={},h=c(e);case 11:if((w=h()).done){t.n=14;break}if(u=w.value,!e.hasOwnProperty(u)){t.n=13;break}return s=e[u],t.n=12,a(s,r,n);case 12:d=t.v,o[u]=d[s.property_name];case 13:t.n=11;break;case 14:return t.a(2,o);case 15:return t.a(2,l({},e.property_name,i))}},t)}))).apply(this,arguments)}function p(t,e,r){return d.apply(this,arguments)}function d(){return(d=v(f().m(function t(e,n,u){var a,c,s,l,p,d,y;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i.gudhub.getApp(Number(e.app_id));case 1:return a=t.v,t.n=2,S(e.filter,a.items_list,u,n);case 2:return c=t.v,e.isSortable&&e.field_id_to_sort&&""!==e.field_id_to_sort&&(s=c.flatMap(function(t){var r=t.fields.find(function(t){return t.field_id==e.field_id_to_sort});return r&&""!=r.field_value?t:[]}),l=c.filter(function(t){if(!s.includes(t))return t}),s=s.sort(function(t,r){return"desc"==e.sortType?r.fields.find(function(t){return t.field_id==e.field_id_to_sort}).field_value-t.fields.find(function(t){return t.field_id==e.field_id_to_sort}).field_value:t.fields.find(function(t){return t.field_id==e.field_id_to_sort}).field_value-r.fields.find(function(t){return t.field_id==e.field_id_to_sort}).field_value}),c=[].concat(r(s),r(l))),e.offset&&(p=e.use_variables_for_limit_and_offset&&o?o[e.offset]:/^[0-9]+$/.test(e.offset)?e.offset:0,c=c.slice(p)),e.limit&&0!==(d=e.use_variables_for_limit_and_offset&&o?o[e.limit]:/^[0-9]+$/.test(e.limit)||0)&&(c=c.slice(0,d)),y=c.map(function(){var t=v(f().m(function t(r){return f().w(function(t){for(;;)switch(t.n){case 0:return t.a(2,_(e.childs,r,a.app_id))}},t)}));return function(e){return t.apply(this,arguments)}}()),t.a(2,Promise.all(y))}},t)}))).apply(this,arguments)}function b(t,e){return m.apply(this,arguments)}function m(){return(m=v(f().m(function t(e,r){var n,o;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i.gudhub.getApp(e.app_id);case 1:return n=t.v,o=n.items_list||[],t.a(2,_(e.childs,r||o[0],n.app_id))}},t)}))).apply(this,arguments)}function _(t,e,r){return h.apply(this,arguments)}function h(){return(h=v(f().m(function t(r,n,i){var o,u;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.map(function(){var t=v(f().m(function t(e){return f().w(function(t){for(;;)switch(t.n){case 0:return t.a(2,a(e,n,i))}},t)}));return function(e){return t.apply(this,arguments)}}());case 1:return o=t.v,t.n=2,Promise.all(o);case 2:return u=t.v,t.a(2,u.reduce(function(t,r){return e(e({},t),r)},{}))}},t)}))).apply(this,arguments)}function g(t,e,r){return w.apply(this,arguments)}function w(){return(w=v(f().m(function t(e,n,o){var u,a,c,s,l,p,d;return f().w(function(t){for(;;)switch(t.n){case 0:p=e.property_type,t.n="static"===p?1:"variable"===p?2:"field_id"===p?5:"function"===p?6:9;break;case 1:return t.a(2,e.static_field_value);case 2:d=e.variable_type,t.n="app_id"===d?3:4;break;case 3:return t.a(2,o);case 4:return t.a(2,"".concat(o,".").concat(n.item_id));case 5:return t.a(2,e.field_id);case 6:if("function"!=typeof e.function){t.n=7;break}return u=e.function.apply(e,[n,o,i.gudhub].concat(r(e.args))),t.a(2,u);case 7:return a=new Function("item, appId, gudhub","return (async "+e.function+")(item, appId, gudhub)"),t.n=8,a(n,o,i.gudhub);case 8:return c=t.v,t.a(2,c);case 9:if(e.field_id||!e.name_space){t.n=11;break}return t.n=10,i.gudhub.getFieldIdByNameSpace(o,e.name_space);case 10:e.field_id=t.v;case 11:if(!Boolean(Number(e.interpretation))){t.n=13;break}return t.n=12,i.gudhub.getInterpretationById(Number(o),Number(n.item_id),Number(e.field_id),"value");case 12:return s=t.v,t.a(2,s);case 13:return t.n=14,i.gudhub.getFieldValue(Number(o),Number(n.item_id),Number(e.field_id));case 14:return l=t.v,t.a(2,l);case 15:return t.a(2)}},t)}))).apply(this,arguments)}function O(t,e,r,n,i){return j.apply(this,arguments)}function j(){return(j=v(f().m(function t(n,u,a,c,s){var l;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i.gudhub.prefilter(JSON.parse(JSON.stringify(n)),e({element_app_id:u,app_id:a,item_id:c},o));case 1:return l=t.v,t.a(2,i.gudhub.filter(s,[].concat(r(l),r(n))))}},t)}))).apply(this,arguments)}function S(){return P.apply(this,arguments)}function P(){return(P=v(f().m(function t(){var e,n,i,o,u=arguments;return f().w(function(t){for(;;)switch(t.n){case 0:return e=u.length>0&&void 0!==u[0]?u[0]:[],n=u.length>1&&void 0!==u[1]?u[1]:[],i=u.length>2&&void 0!==u[2]?u[2]:"",o=u.length>3&&void 0!==u[3]?u[3]:{},t.a(2,e.length?O(e,i,i,o.item_id,n):r(n))}},t)}))).apply(this,arguments)}return a(t,n,u,o)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compiler=m;
|
|
295
295
|
},{}],"zqOZ":[function(require,module,exports) {
|
|
296
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("../../gudhub.js");function n(e){if(null!=e){var n=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],t=0;if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}}throw new TypeError(u(e)+" is not iterable")}function t(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=r(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return u=e.done,e},e:function(e){l=!0,o=e},f:function(){try{u||null==t.return||t.return()}finally{if(l)throw o}}}}function r(e,n){if(e){if("string"==typeof e)return i(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,n):void 0}}function i(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function a(){var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function u(t,r,i,a){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return o(s,"_invoke",function(t,r,i){var a,o,u,c=0,s=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(n,t){return a=n,o=0,u=e,p.n=t,l}};function d(t,r){for(o=t,u=r,n=0;!f&&c&&!i&&n<s.length;n++){var i,a=s[n],d=p.p,_=a[2];t>3?(i=_===r)&&(u=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=t<2&&d<a[1])?(o=0,p.v=r,p.n=a[1]):d<_&&(i=t<3||a[0]>r||r>_)&&(a[4]=t,a[5]=r,p.n=_,o=0))}if(i||t>1)return l;throw f=!0,r}return function(i,s,_){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,_),o=s,u=_;(n=o<2?e:u)||!f;){a||(o?o<3?(o>1&&(p.n=-1),d(o,u)):p.n=u:p.v=u);try{if(c=2,a){if(o||(i="next"),n=a[i]){if(!(n=n.call(a,u)))throw TypeError("iterator result is not an object");if(!n.done)return n;u=n.value,o<2&&(o=0)}else 1===o&&(n=a.return)&&n.call(a),o<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=e}else if((n=(f=p.n<0)?u:t.call(r,p))!==l)break}catch(n){a=e,o=1,u=n}finally{c=1}}return{value:n,done:f}}}(t,i,a),!0),s}var l={};function c(){}function s(){}function f(){}n=Object.getPrototypeOf;var p=[][r]?n(n([][r]())):(o(n={},r,function(){return this}),n),d=f.prototype=c.prototype=Object.create(p);function _(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return s.prototype=f,o(d,"constructor",f),o(f,"constructor",s),s.displayName="GeneratorFunction",o(f,i,"GeneratorFunction"),o(d),o(d,i,"Generator"),o(d,r,function(){return this}),o(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:u,m:_}})()}function o(e,n,t,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(o=function(e,n,t,r){function a(n,t){o(e,n,function(e){return this._invoke(n,t,e)})}n?i?i(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(a("next",0),a("throw",1),a("return",2))})(e,n,t,r)}function u(e){return(u="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 l(e,n,t,r,i,a,o){try{var u=e[a](o),l=u.value}catch(e){return void t(e)}u.done?n(l):Promise.resolve(l).then(r,i)}function c(e){return function(){var n=this,t=arguments;return new Promise(function(r,i){var a=e.apply(n,t);function o(e){l(a,r,i,o,u,"next",e)}function u(e){l(a,r,i,o,u,"throw",e)}o(void 0)})}}function s(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function f(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function p(e,n,t){return n&&f(e.prototype,n),t&&f(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e){var n=_(e,"string");return"symbol"==u(n)?n:n+""}function _(e,n){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}var v=exports.default=function(){return p(function e(n){s(this,e),this.gudhub=n,this.appsConnectingMap={apps:[],fields:[],items:[],views:[]}},[{key:"createAppsFromTemplate",value:function(){var n=c(a().m(function n(t,r,i,o,l,c){var s,f,p,d,_,v,h,y;return a().w(function(n){for(;;)switch(n.n){case 0:if(s=6*t.apps.length,f=100/s,p=0,d=o?new e.GudHub(i,{server_url:"".concat(r,"/GudHub")}):null,!o){n.n=2;break}return n.n=1,d.getAppsList();case 1:y=n.v,n.n=3;break;case 2:y=null;case 3:return y,_=function(e){p+=1,null==c||c({percent:p*f,status:e})},v=function(e){"string"==typeof e?(p+=1,null==c||c({percent:p*f,status:e})):"object"===u(e)&&(null==c||c({status:"Done",apps:e}))},n.n=4,this._createApps(t,r,i,o,d,_);case 4:return h=n.v,n.n=5,this._createItems(h,r,i,o,d,l,v);case 5:return n.a(2)}},n,this)}));return function(e,t,r,i,a,o){return n.apply(this,arguments)}}()},{key:"_createApps",value:function(){var e=c(a().m(function e(n,r,i,o,u,l){var c,s,f,p,d,_,v,h,y,m,b,w,g,k,A,O,P;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(c={},s=[],f=[],p=null,!o){e.n=2;break}return e.n=1,this.gudhub.req.axiosRequest({method:"POST",url:"".concat(r,"/GudHub/auth/login"),form:{auth_key:i}});case 1:d=e.v,p=d.accesstoken;case 2:_=t(n.apps),e.p=3,_.s();case 4:if((v=_.n()).done){e.n=12;break}if(h=v.value,y=void 0,!o){e.n=6;break}return e.n=5,this.gudhub.req.axiosRequest({url:"".concat(r,"/GudHub/api/app/get?token=").concat(p,"&app_id=").concat(h),method:"GET"});case 5:y=e.v,e.n=8;break;case 6:return e.n=7,this.gudhub.getApp(h);case 7:y=e.v;case 8:if(y){e.n=9;break}throw new Error("Failed to get app: ".concat(h));case 9:return null==l||l("GET APP: ".concat(y.app_name," (App steps)")),m=JSON.parse(JSON.stringify(y)),c[m.app_id]=m,(b=this._prepareAppTemplate(m)).privacy=1,n.data_to_change&&(n.data_to_change.name&&(b.app_name=n.data_to_change.name),n.data_to_change.icon&&(b.icon=n.data_to_change.icon)),this._resetViewsIds(b),e.n=10,this.gudhub.createNewApp(b);case 10:w=e.v,null==l||l("CREATE NEW APP: ".concat(y.app_name," (App steps)")),s.push(w),this._mapApp(m,w,this.appsConnectingMap);case 11:e.n=4;break;case 12:e.n=14;break;case 13:e.p=13,P=e.v,_.e(P);case 14:return e.p=14,_.f(),e.f(14);case 15:this._connectApps(s,this.appsConnectingMap,c),g=0,k=s;case 16:if(!(g<k.length)){e.n=19;break}return A=k[g],e.n=17,this.gudhub.updateApp(A);case 17:O=e.v,null==l||l("UPDATE APP: ".concat(O.app_name," (App steps)")),f.push(O);case 18:g++,e.n=16;break;case 19:return e.a(2,f)}},e,this,[[3,13,14,15]])}));return function(n,t,r,i,a,o){return e.apply(this,arguments)}}()},{key:"_createItems",value:function(){var e=c(a().m(function e(n,r,i,o,u,l,s){var f,p,d,_,v,h,y,m,b,w,g,k,A,O,P,S,j=this;return a().w(function(e){for(;;)switch(e.n){case 0:if(f=null!=l?l:1e5,p=null,!o){e.n=2;break}return e.n=1,this.gudhub.req.axiosRequest({method:"POST",url:"".concat(r,"/GudHub/auth/login"),form:{auth_key:i}});case 1:d=e.v,p=d.accesstoken;case 2:return e.n=3,Promise.all(n.map(function(){var e=c(a().m(function e(n){var t,i,u,l;return a().w(function(e){for(;;)switch(e.n){case 0:if(!o){e.n=2;break}return e.n=1,j.gudhub.req.axiosRequest({url:"".concat(r,"/GudHub/api/app/get?token=").concat(p,"&app_id=").concat(j._searchOldAppId(n.app_id,j.appsConnectingMap.apps)),method:"GET"});case 1:t=e.v,e.n=4;break;case 2:return e.n=3,j.gudhub.getApp(j._searchOldAppId(n.app_id,j.appsConnectingMap.apps));case 3:t=e.v;case 4:if(t){e.n=5;break}throw new Error("Failed to get app in createItems: ".concat(n.app_id));case 5:return null==s||s("GET APP: ".concat(t.app_name," (Items steps)")),i=JSON.parse(JSON.stringify(t)),u=i.items_list.map(function(e){return{index_number:e.index_number,item_id:0,fields:[]}}).filter(function(e,n){return n<=f}),e.n=6,j.gudhub.addNewItems(n.app_id,u);case 6:return l=e.v,null==s||s("ADD NEW ITEMS: ".concat(t.app_name," (Items steps)")),n.items_list=l,j._updateMap(n.items_list,i.items_list),j._addFieldValue(i.items_list,n.items_list,j.appsConnectingMap),e.a(2,n)}},e)}));return function(n){return e.apply(this,arguments)}}()));case 3:_=e.v,v=t(_);try{for(v.s();!(h=v.n()).done;){y=h.value,m=t(y.items_list);try{for(m.s();!(b=m.n()).done;){w=b.value,g=t(w.fields);try{for(g.s();!(k=g.n()).done;){A=k.value,O=t(this.appsConnectingMap.fields);try{for(O.s();!(P=O.n()).done;)S=P.value,A.field_id===S.old_field_id&&(A.field_id=S.new_field_id,A.element_id=S.new_field_id)}catch(I){O.e(I)}finally{O.f()}}}catch(I){g.e(I)}finally{g.f()}}}catch(I){m.e(I)}finally{m.f()}}}catch(I){v.e(I)}finally{v.f()}return this._deleteField(_),e.n=4,this._replaceValue(_,this.appsConnectingMap,o,u);case 4:return e.n=5,Promise.all(_.map(function(){var e=c(a().m(function e(n){var t;return a().w(function(e){for(;;)switch(e.n){case 0:return t=n.items_list.map(function(e){return e.fields.forEach(function(e){delete e.data_id}),e}),e.n=1,j.gudhub.updateItems(n.app_id,t);case 1:null==s||s("REPLACE VALUE: ".concat(n.app_name," (Items steps)"));case 2:return e.a(2)}},e)}));return function(n){return e.apply(this,arguments)}}()));case 5:null==s||s(_);case 6:return e.a(2)}},e,this)}));return function(n,t,r,i,a,o,u){return e.apply(this,arguments)}}()},{key:"_deleteField",value:function(e){var n,r=t(e);try{var i=function(){var e,r=n.value,i=t(r.items_list);try{for(i.s();!(e=i.n()).done;){var a=e.value;a.fields=a.fields.filter(function(e){return r.field_list.findIndex(function(n){return n.field_id==e.field_id})>-1})}}catch(o){i.e(o)}finally{i.f()}};for(r.s();!(n=r.n()).done;)i()}catch(a){r.e(a)}finally{r.f()}}},{key:"_replaceValue",value:function(){var e=c(a().m(function e(r,i,o,u){var l,s,f,p,d,_,v=this;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:l=[],s=null==i?void 0:i.apps,f=t(r),e.p=1,d=a().m(function e(){var r,f,d,_,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:r=p.value,f=t(r.field_list),e.p=1,_=a().m(function e(){var n;return a().w(function(e){for(;;)switch(e.n){case 0:"item_ref"===(n=d.value).data_type&&v._replaceValueItemRef(r,n,i),l.push(v.gudhub.ghconstructor.getInstance(n.data_type).then(function(){var e=c(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:if(void 0!==t){e.n=1;break}return e.a(2,{type:n.data_type});case 1:if("file"!==t.getTemplate().constructor){e.n=2;break}return e.a(2,v.gudhub.util.fileInstallerHelper(s,r.app_id,r.items_list,n.field_id,o,u));case 2:if("document"!==t.getTemplate().constructor){e.n=4;break}return e.n=3,v._documentInstallerHelper(r.app_id,r.items_list,n.field_id);case 3:case 4:return e.a(2,t)}},e)}));return function(n){return e.apply(this,arguments)}}()));case 1:return e.a(2)}},e)}),f.s();case 2:if((d=f.n()).done){e.n=4;break}return e.d(n(_()),3);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,h=e.v,f.e(h);case 6:return e.p=6,f.f(),e.f(6);case 7:return e.a(2)}},e,null,[[1,5,6,7]])}),f.s();case 2:if((p=f.n()).done){e.n=4;break}return e.d(n(d()),3);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,_=e.v,f.e(_);case 6:return e.p=6,f.f(),e.f(6);case 7:if(!(l.length>0)){e.n=8;break}return e.a(2,Promise.all(l));case 8:return e.a(2)}},e,null,[[1,5,6,7]])}));return function(n,t,r,i){return e.apply(this,arguments)}}()},{key:"_documentInstallerHelper",value:function(){var e=c(a().m(function e(n,r,i){var o,u,l,c,s,f,p,d,_;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:o=[],u=t(r),e.p=1,u.s();case 2:if((l=u.n()).done){e.n=6;break}if(s=l.value,!((null==(f=s.fields.find(function(e){return e.element_id===i}))||null===(c=f.field_value)||void 0===c?void 0:c.length)>0)){e.n=5;break}return e.n=3,this.gudhub.getDocument({_id:f.field_value});case 3:if(null==(p=e.v)||!p.data){e.n=5;break}return e.n=4,this.gudhub.createDocument({app_id:n,item_id:s.item_id,element_id:i,data:p.data});case 4:d=e.v,f.field_value=d._id,o.push(s);case 5:e.n=2;break;case 6:e.n=8;break;case 7:e.p=7,_=e.v,u.e(_);case 8:return e.p=8,u.f(),e.f(8);case 9:return e.a(2,o)}},e,this,[[1,7,8,9]])}));return function(n,t,r){return e.apply(this,arguments)}}()},{key:"_replaceValueItemRef",value:function(e,n,r){var i,a=t(e.items_list);try{for(a.s();!(i=a.n()).done;){var o,u=t(i.value.fields);try{for(u.s();!(o=u.n()).done;){var l=o.value;if(l.field_id===n.field_id&&l.field_value){var c=l.field_value.split(",").map(function(e){var n,i=e.split("."),a=t(r.apps);try{for(a.s();!(n=a.n()).done;){var o=n.value;i[0]==o.old_app_id&&(i[0]=o.new_app_id)}}catch(s){a.e(s)}finally{a.f()}var u,l=t(r.items);try{for(l.s();!(u=l.n()).done;){var c=u.value;i[1]==c.old_item_id&&(i[1]=c.new_item_id)}}catch(s){l.e(s)}finally{l.f()}return i.join(".")});l.field_value=c.join(",")}}}catch(s){u.e(s)}finally{u.f()}}}catch(s){a.e(s)}finally{a.f()}}},{key:"_addFieldValue",value:function(e,n,r){var i,a=t(n);try{for(a.s();!(i=a.n()).done;){var o,u=i.value,l=t(r.items);try{for(l.s();!(o=l.n()).done;){var c=o.value;if(u.item_id===c.new_item_id){var s,f=t(e);try{for(f.s();!(s=f.n()).done;){var p=s.value;c.old_item_id===p.item_id&&(u.fields=p.fields)}}catch(d){f.e(d)}finally{f.f()}}}}catch(d){l.e(d)}finally{l.f()}}}catch(d){a.e(d)}finally{a.f()}}},{key:"_updateMap",value:function(e,n){var r,i=t(n);try{for(i.s();!(r=i.n()).done;){var a,o=r.value,u=t(e);try{for(u.s();!(a=u.n()).done;){var l=a.value;o.index_number===l.index_number&&this.appsConnectingMap.items.push({old_item_id:o.item_id,new_item_id:l.item_id})}}catch(c){u.e(c)}finally{u.f()}}}catch(c){i.e(c)}finally{i.f()}}},{key:"_searchOldAppId",value:function(e,n){var t,r;return null!==(t=null===(r=n.find(function(n){return n.new_app_id===e}))||void 0===r?void 0:r.old_app_id)&&void 0!==t?t:0}},{key:"_mapApp",value:function(e,n,r){r.apps.push({old_app_id:e.app_id,new_app_id:n.app_id,old_view_init:e.view_init,new_view_init:n.view_init});var i,a=t(e.field_list);try{for(a.s();!(i=a.n()).done;){var o,u=i.value,l=t(n.field_list);try{for(l.s();!(o=l.n()).done;){var c=o.value;u.name_space===c.name_space&&r.fields.push({name_space:u.name_space,old_field_id:u.field_id,new_field_id:c.field_id})}}catch(h){l.e(h)}finally{l.f()}}}catch(h){a.e(h)}finally{a.f()}var s,f=t(e.views_list);try{for(f.s();!(s=f.n()).done;){var p,d=s.value,_=t(n.views_list);try{for(_.s();!(p=_.n()).done;){var v=p.value;d.name===v.name&&r.views.push({name:d.name,old_view_id:d.view_id,new_view_id:v.view_id})}}catch(h){_.e(h)}finally{_.f()}}}catch(h){f.e(h)}finally{f.f()}}},{key:"_crawling",value:function(e,n){if(null!==e)for(var t=0,r=Object.keys(e);t<r.length;t++){var i=r[t],a=e[i];void 0!==a&&"string"!=typeof e&&(n(i,a,e),this._crawling(a,n))}}},{key:"_resetViewsIds",value:function(e){e.view_init=0,this._crawling(e.views_list,function(e,n,t){"view_id"!==e&&"container_id"!==e||(t[e]=0)})}},{key:"_connectApps",value:function(e,n,r){var i,a=this,o=function(e,n){return n.some(function(n){return-1!==e.indexOf(n)})},u=t(e);try{var l=function(){var e,u=i.value,l=t(n.apps);try{for(l.s();!(e=l.n()).done;){var c=e.value;if(u.view_init===c.new_view_init){var s,f=t(n.views);try{for(f.s();!(s=f.n()).done;){var p=s.value;c.old_view_init===p.old_view_id&&(u.view_init=p.new_view_id)}}catch(d){f.e(d)}finally{f.f()}}}}catch(d){l.e(d)}finally{l.f()}a._crawling(u.field_list,function(e,i,l){var c;if(o(e,["field_id","FieldId","destination_field","element_id"])){var s,f=String(i).split(","),p=[],_=t(n.fields);try{for(_.s();!(s=_.n()).done;){var v,h=s.value,y=t(f);try{for(y.s();!(v=y.n()).done;){v.value==h.old_field_id&&p.push(h.new_field_id)}}catch(d){y.e(d)}finally{y.f()}}}catch(d){_.e(d)}finally{_.f()}p.length&&(l[e]=p.join(","))}if(o(e,["app_id","AppId","destination_app"])){var m,b=t(n.apps);try{for(b.s();!(m=b.n()).done;){var w=m.value;i==w.old_app_id&&(l[e]=w.new_app_id)}}catch(d){b.e(d)}finally{b.f()}}if(o(e,["view_id"])){var g,k=t(n.views);try{for(k.s();!(g=k.n()).done;){var A=g.value;i==A.old_view_id&&(l[e]=A.new_view_id)}}catch(d){k.e(d)}finally{k.f()}}if(o(e,["src"])&&isFinite(i)){var O=n.apps.find(function(e){return e.new_app_id===u.app_id}).old_app_id,P=a._findPath(r[O].views_list,"container_id",i);l[e]="".concat(a._getValueByPath(u.views_list,P,"container_id"))}if(-1!==e.indexOf("trigger")&&null!==(c=i.model)&&void 0!==c&&c.nodes){var S=i.model.nodes;for(var j in S)for(var I=0,E=["inputs","outputs"];I<E.length;I++){var T,N=E[I],x=S[j],G=t(Object.keys(x[N]).filter(function(e){return""!==e&&!isNaN(e)}));try{var M=function(){var e=T.value,r=n.fields.find(function(n){return n.old_field_id==e});if(null!=r&&r.new_field_id){var i,a=r.new_field_id.toString(),o=x[N][e],u=t(o.connections);try{for(u.s();!(i=u.n()).done;){var l=i.value;l.input==e&&(l.input=a),l.output==e&&(l.output=a)}}catch(d){u.e(d)}finally{u.f()}delete x[N][e],x[N][a]=o}};for(G.s();!(T=G.n()).done;)M()}catch(d){G.e(d)}finally{G.f()}}}})};for(u.s();!(i=u.n()).done;)l()}catch(c){u.e(c)}finally{u.f()}return e}},{key:"_getValueByPath",value:function(e,n,r){var i,a=e,o=t(n.split("."));try{for(o.s();!(i=o.n()).done;){a=a[i.value]}}catch(u){o.e(u)}finally{o.f()}return a[r]}},{key:"_findPath",value:function(e,n,t){var r=!1,i=!1,a=[];return this._crawling(e,function(e,o,l){i&&a.reverse().forEach(function(e){i&&(e.delete=!0,e.parent===l&&(i=!1,(a=a.filter(function(e){return!e.delete})).reverse()))}),r||("object"===u(l[e])&&a.push({prop:e,parent:l}),o==t&&n===e?r=!0:Object.keys(l).pop()===e&&"object"!==u(l[e])&&(i=!0))}),a.map(function(e){return e.prop}).join(".")}},{key:"_prepareAppTemplate",value:function(e){var n=JSON.parse(JSON.stringify(e));this._crawling(n.views_list,function(e,n,t){"element_id"===e&&(t.element_id=-Number(n),t.create_element=-Number(n))});var r,i=t(n.field_list);try{for(i.s();!(r=i.n()).done;){var a=r.value;a.create_field=-Number(a.field_id),a.element_id=-Number(a.field_id),a.field_id=-Number(a.field_id),a.field_value=""}}catch(o){i.e(o)}finally{i.f()}return n.items_list=[],delete n.app_id,delete n.icon.id,delete n.group_id,delete n.trash,delete n.last_update,delete n.file_list,n}}])}();
|
|
296
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("../../gudhub.js");function n(e){if(null!=e){var n=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],t=0;if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}}throw new TypeError(u(e)+" is not iterable")}function t(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=r(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return u=e.done,e},e:function(e){l=!0,o=e},f:function(){try{u||null==t.return||t.return()}finally{if(l)throw o}}}}function r(e,n){if(e){if("string"==typeof e)return i(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,n):void 0}}function i(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function a(){var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function u(t,r,i,a){var u=r&&r.prototype instanceof c?r:c,f=Object.create(u.prototype);return o(f,"_invoke",function(t,r,i){var a,o,u,c=0,f=i||[],s=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(n,t){return a=n,o=0,u=e,d.n=t,l}};function p(t,r){for(o=t,u=r,n=0;!s&&c&&!i&&n<f.length;n++){var i,a=f[n],p=d.p,_=a[2];t>3?(i=_===r)&&(u=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=p&&((i=t<2&&p<a[1])?(o=0,d.v=r,d.n=a[1]):p<_&&(i=t<3||a[0]>r||r>_)&&(a[4]=t,a[5]=r,d.n=_,o=0))}if(i||t>1)return l;throw s=!0,r}return function(i,f,_){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&p(f,_),o=f,u=_;(n=o<2?e:u)||!s;){a||(o?o<3?(o>1&&(d.n=-1),p(o,u)):d.n=u:d.v=u);try{if(c=2,a){if(o||(i="next"),n=a[i]){if(!(n=n.call(a,u)))throw TypeError("iterator result is not an object");if(!n.done)return n;u=n.value,o<2&&(o=0)}else 1===o&&(n=a.return)&&n.call(a),o<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=e}else if((n=(s=d.n<0)?u:t.call(r,d))!==l)break}catch(n){a=e,o=1,u=n}finally{c=1}}return{value:n,done:s}}}(t,i,a),!0),f}var l={};function c(){}function f(){}function s(){}n=Object.getPrototypeOf;var d=[][r]?n(n([][r]())):(o(n={},r,function(){return this}),n),p=s.prototype=c.prototype=Object.create(d);function _(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,o(e,i,"GeneratorFunction")),e.prototype=Object.create(p),e}return f.prototype=s,o(p,"constructor",s),o(s,"constructor",f),f.displayName="GeneratorFunction",o(s,i,"GeneratorFunction"),o(p),o(p,i,"Generator"),o(p,r,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:u,m:_}})()}function o(e,n,t,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(o=function(e,n,t,r){function a(n,t){o(e,n,function(e){return this._invoke(n,t,e)})}n?i?i(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(a("next",0),a("throw",1),a("return",2))})(e,n,t,r)}function u(e){return(u="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 l(e,n,t,r,i,a,o){try{var u=e[a](o),l=u.value}catch(e){return void t(e)}u.done?n(l):Promise.resolve(l).then(r,i)}function c(e){return function(){var n=this,t=arguments;return new Promise(function(r,i){var a=e.apply(n,t);function o(e){l(a,r,i,o,u,"next",e)}function u(e){l(a,r,i,o,u,"throw",e)}o(void 0)})}}function f(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function s(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function d(e,n,t){return n&&s(e.prototype,n),t&&s(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e){var n=_(e,"string");return"symbol"==u(n)?n:n+""}function _(e,n){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}var v=exports.default=function(){return d(function e(n){f(this,e),this.gudhub=n,this.appsConnectingMap={apps:[],fields:[],items:[],views:[]}},[{key:"createAppsFromTemplate",value:function(){var n=c(a().m(function n(t,r,i,o,l,c){var f,s,d,p,_,v,h,y;return a().w(function(n){for(;;)switch(n.n){case 0:if(f=6*t.apps.length,s=100/f,d=0,p=o?new e.GudHub(i,{server_url:"".concat(r,"/GudHub")}):null,!o){n.n=2;break}return n.n=1,p.getAppsList();case 1:y=n.v,n.n=3;break;case 2:y=null;case 3:return y,_=function(e){d+=1,null==c||c({percent:d*s,status:e})},v=function(e){"string"==typeof e?(d+=1,null==c||c({percent:d*s,status:e})):"object"===u(e)&&(null==c||c({status:"Done",apps:e}))},n.n=4,this._createApps(t,r,i,o,p,_);case 4:return h=n.v,n.n=5,this._createItems(h,r,i,o,p,l,v);case 5:return n.a(2)}},n,this)}));return function(e,t,r,i,a,o){return n.apply(this,arguments)}}()},{key:"_createApps",value:function(){var e=c(a().m(function e(n,r,i,o,u,l){var c,f,s,d,p,_,v,h,y,m,b,w,g,k,A,O,P;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(c={},f=[],s=[],d=null,!o){e.n=2;break}return e.n=1,this.gudhub.req.axiosRequest({method:"POST",url:"".concat(r,"/GudHub/auth/login"),form:{auth_key:i}});case 1:p=e.v,d=p.accesstoken;case 2:_=t(n.apps),e.p=3,_.s();case 4:if((v=_.n()).done){e.n=12;break}if(h=v.value,y=void 0,!o){e.n=6;break}return e.n=5,this.gudhub.req.axiosRequest({url:"".concat(r,"/GudHub/api/app/get?token=").concat(d,"&app_id=").concat(h),method:"GET"});case 5:y=e.v,e.n=8;break;case 6:return e.n=7,this.gudhub.getApp(h);case 7:y=e.v;case 8:if(y){e.n=9;break}throw new Error("Failed to get app: ".concat(h));case 9:return null==l||l("GET APP: ".concat(y.app_name," (App steps)")),m=JSON.parse(JSON.stringify(y)),c[m.app_id]=m,(b=this._prepareAppTemplate(m)).privacy=1,n.data_to_change&&(n.data_to_change.name&&(b.app_name=n.data_to_change.name),n.data_to_change.icon&&(b.icon=n.data_to_change.icon)),this._resetViewsIds(b),e.n=10,this.gudhub.createNewApp(b);case 10:w=e.v,null==l||l("CREATE NEW APP: ".concat(y.app_name," (App steps)")),f.push(w),this._mapApp(m,w,this.appsConnectingMap);case 11:e.n=4;break;case 12:e.n=14;break;case 13:e.p=13,P=e.v,_.e(P);case 14:return e.p=14,_.f(),e.f(14);case 15:this._connectApps(f,this.appsConnectingMap,c),g=0,k=f;case 16:if(!(g<k.length)){e.n=19;break}return A=k[g],e.n=17,this.gudhub.updateApp(A);case 17:O=e.v,null==l||l("UPDATE APP: ".concat(O.app_name," (App steps)")),s.push(O);case 18:g++,e.n=16;break;case 19:return e.a(2,s)}},e,this,[[3,13,14,15]])}));return function(n,t,r,i,a,o){return e.apply(this,arguments)}}()},{key:"_createItems",value:function(){var e=c(a().m(function e(n,r,i,o,u,l,f){var s,d,p,_,v,h,y,m,b,w,g,k,A,O,P,S,j=this;return a().w(function(e){for(;;)switch(e.n){case 0:if(s=null!=l?l:1e5,d=null,!o){e.n=2;break}return e.n=1,this.gudhub.req.axiosRequest({method:"POST",url:"".concat(r,"/GudHub/auth/login"),form:{auth_key:i}});case 1:p=e.v,d=p.accesstoken;case 2:return e.n=3,Promise.all(n.map(function(){var e=c(a().m(function e(n){var t,i,u,l;return a().w(function(e){for(;;)switch(e.n){case 0:if(!o){e.n=2;break}return e.n=1,j.gudhub.req.axiosRequest({url:"".concat(r,"/GudHub/api/app/get?token=").concat(d,"&app_id=").concat(j._searchOldAppId(n.app_id,j.appsConnectingMap.apps)),method:"GET"});case 1:t=e.v,e.n=4;break;case 2:return e.n=3,j.gudhub.getApp(j._searchOldAppId(n.app_id,j.appsConnectingMap.apps));case 3:t=e.v;case 4:if(t){e.n=5;break}throw new Error("Failed to get app in createItems: ".concat(n.app_id));case 5:return null==f||f("GET APP: ".concat(t.app_name," (Items steps)")),i=JSON.parse(JSON.stringify(t)),u=i.items_list.map(function(e){return{index_number:e.index_number,item_id:0,fields:[]}}).filter(function(e,n){return n<=s}),e.n=6,j.gudhub.addNewItems(n.app_id,u);case 6:return l=e.v,null==f||f("ADD NEW ITEMS: ".concat(t.app_name," (Items steps)")),n.items_list=l,j._updateMap(n.items_list,i.items_list),j._addFieldValue(i.items_list,n.items_list,j.appsConnectingMap),e.a(2,n)}},e)}));return function(n){return e.apply(this,arguments)}}()));case 3:_=e.v,v=t(_);try{for(v.s();!(h=v.n()).done;){y=h.value,m=t(y.items_list);try{for(m.s();!(b=m.n()).done;){w=b.value,g=t(w.fields);try{for(g.s();!(k=g.n()).done;){A=k.value,O=t(this.appsConnectingMap.fields);try{for(O.s();!(P=O.n()).done;)S=P.value,A.field_id===S.old_field_id&&(A.field_id=S.new_field_id,A.element_id=S.new_field_id)}catch(I){O.e(I)}finally{O.f()}}}catch(I){g.e(I)}finally{g.f()}}}catch(I){m.e(I)}finally{m.f()}}}catch(I){v.e(I)}finally{v.f()}return this._deleteField(_),e.n=4,this._replaceValue(_,this.appsConnectingMap,o,u);case 4:return e.n=5,Promise.all(_.map(function(){var e=c(a().m(function e(n){var t;return a().w(function(e){for(;;)switch(e.n){case 0:return t=n.items_list.map(function(e){return e.fields.forEach(function(e){delete e.data_id}),e}),e.n=1,j.gudhub.updateItems(n.app_id,t);case 1:null==f||f("REPLACE VALUE: ".concat(n.app_name," (Items steps)"));case 2:return e.a(2)}},e)}));return function(n){return e.apply(this,arguments)}}()));case 5:null==f||f(_);case 6:return e.a(2)}},e,this)}));return function(n,t,r,i,a,o,u){return e.apply(this,arguments)}}()},{key:"_deleteField",value:function(e){var n,r=t(e);try{var i=function(){var e,r=n.value,i=t(r.items_list);try{for(i.s();!(e=i.n()).done;){var a=e.value;a.fields=a.fields.filter(function(e){return r.field_list.findIndex(function(n){return n.field_id==e.field_id})>-1})}}catch(o){i.e(o)}finally{i.f()}};for(r.s();!(n=r.n()).done;)i()}catch(a){r.e(a)}finally{r.f()}}},{key:"_replaceValue",value:function(){var e=c(a().m(function e(r,i,o,u){var l,f,s,d,p,_,v=this;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:l=[],f=null==i?void 0:i.apps,s=t(r),e.p=1,p=a().m(function e(){var r,s,p,_,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:r=d.value,s=t(r.field_list),e.p=1,_=a().m(function e(){var n;return a().w(function(e){for(;;)switch(e.n){case 0:"item_ref"===(n=p.value).data_type&&v._replaceValueItemRef(r,n,i),l.push(v.gudhub.ghconstructor.getInstance(n.data_type).then(function(){var e=c(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:if(void 0!==t){e.n=1;break}return e.a(2,{type:n.data_type});case 1:if("file"!==t.getTemplate().constructor){e.n=2;break}return e.a(2,v.gudhub.util.fileInstallerHelper(f,r.app_id,r.items_list,n.field_id,o,u));case 2:if("document"!==t.getTemplate().constructor){e.n=4;break}return e.n=3,v._documentInstallerHelper(r.app_id,r.items_list,n.field_id);case 3:case 4:return e.a(2,t)}},e)}));return function(n){return e.apply(this,arguments)}}()));case 1:return e.a(2)}},e)}),s.s();case 2:if((p=s.n()).done){e.n=4;break}return e.d(n(_()),3);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,h=e.v,s.e(h);case 6:return e.p=6,s.f(),e.f(6);case 7:return e.a(2)}},e,null,[[1,5,6,7]])}),s.s();case 2:if((d=s.n()).done){e.n=4;break}return e.d(n(p()),3);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,_=e.v,s.e(_);case 6:return e.p=6,s.f(),e.f(6);case 7:if(!(l.length>0)){e.n=8;break}return e.a(2,Promise.all(l));case 8:return e.a(2)}},e,null,[[1,5,6,7]])}));return function(n,t,r,i){return e.apply(this,arguments)}}()},{key:"_documentInstallerHelper",value:function(){var e=c(a().m(function e(n,r,i){var o,u,l,c,f,s,d,p,_;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:o=[],u=t(r),e.p=1,u.s();case 2:if((l=u.n()).done){e.n=6;break}if(f=l.value,!((null==(s=f.fields.find(function(e){return e.element_id===i}))||null===(c=s.field_value)||void 0===c?void 0:c.length)>0)){e.n=5;break}return e.n=3,this.gudhub.getDocument({_id:s.field_value});case 3:if(null==(d=e.v)||!d.data){e.n=5;break}return e.n=4,this.gudhub.createDocument({app_id:n,item_id:f.item_id,element_id:i,data:d.data});case 4:p=e.v,s.field_value=p._id,o.push(f);case 5:e.n=2;break;case 6:e.n=8;break;case 7:e.p=7,_=e.v,u.e(_);case 8:return e.p=8,u.f(),e.f(8);case 9:return e.a(2,o)}},e,this,[[1,7,8,9]])}));return function(n,t,r){return e.apply(this,arguments)}}()},{key:"_replaceValueItemRef",value:function(e,n,r){var i,a=t(e.items_list);try{for(a.s();!(i=a.n()).done;){var o,u=t(i.value.fields);try{for(u.s();!(o=u.n()).done;){var l=o.value;if(l.field_id===n.field_id&&l.field_value){var c=l.field_value.split(",").map(function(e){var n,i=e.split("."),a=t(r.apps);try{for(a.s();!(n=a.n()).done;){var o=n.value;i[0]==o.old_app_id&&(i[0]=o.new_app_id)}}catch(f){a.e(f)}finally{a.f()}var u,l=t(r.items);try{for(l.s();!(u=l.n()).done;){var c=u.value;i[1]==c.old_item_id&&(i[1]=c.new_item_id)}}catch(f){l.e(f)}finally{l.f()}return i.join(".")});l.field_value=c.join(",")}}}catch(f){u.e(f)}finally{u.f()}}}catch(f){a.e(f)}finally{a.f()}}},{key:"_addFieldValue",value:function(e,n,r){var i,a=t(n);try{for(a.s();!(i=a.n()).done;){var o,u=i.value,l=t(r.items);try{for(l.s();!(o=l.n()).done;){var c=o.value;if(u.item_id===c.new_item_id){var f,s=t(e);try{for(s.s();!(f=s.n()).done;){var d=f.value;c.old_item_id===d.item_id&&(u.fields=d.fields)}}catch(p){s.e(p)}finally{s.f()}}}}catch(p){l.e(p)}finally{l.f()}}}catch(p){a.e(p)}finally{a.f()}}},{key:"_updateMap",value:function(e,n){var r,i=t(n);try{for(i.s();!(r=i.n()).done;){var a,o=r.value,u=t(e);try{for(u.s();!(a=u.n()).done;){var l=a.value;o.index_number===l.index_number&&this.appsConnectingMap.items.push({old_item_id:o.item_id,new_item_id:l.item_id})}}catch(c){u.e(c)}finally{u.f()}}}catch(c){i.e(c)}finally{i.f()}}},{key:"_searchOldAppId",value:function(e,n){var t,r;return null!==(t=null===(r=n.find(function(n){return n.new_app_id===e}))||void 0===r?void 0:r.old_app_id)&&void 0!==t?t:0}},{key:"_mapApp",value:function(e,n,r){r.apps.push({old_app_id:e.app_id,new_app_id:n.app_id,old_view_init:e.view_init,new_view_init:n.view_init});var i,a=t(e.field_list);try{for(a.s();!(i=a.n()).done;){var o,u=i.value,l=t(n.field_list);try{for(l.s();!(o=l.n()).done;){var c=o.value;u.name_space===c.name_space&&r.fields.push({name_space:u.name_space,old_field_id:u.field_id,new_field_id:c.field_id})}}catch(h){l.e(h)}finally{l.f()}}}catch(h){a.e(h)}finally{a.f()}var f,s=t(e.views_list);try{for(s.s();!(f=s.n()).done;){var d,p=f.value,_=t(n.views_list);try{for(_.s();!(d=_.n()).done;){var v=d.value;p.name===v.name&&r.views.push({name:p.name,old_view_id:p.view_id,new_view_id:v.view_id})}}catch(h){_.e(h)}finally{_.f()}}}catch(h){s.e(h)}finally{s.f()}}},{key:"_crawling",value:function(e,n){if(null!==e)for(var t=0,r=Object.keys(e);t<r.length;t++){var i=r[t],a=e[i];void 0!==a&&"string"!=typeof e&&(n(i,a,e),this._crawling(a,n))}}},{key:"_resetViewsIds",value:function(e){e.view_init=0,this._crawling(e.views_list,function(e,n,t){"view_id"!==e&&"container_id"!==e||(t[e]=0)})}},{key:"_connectApps",value:function(e,n,r){var i,a=this,o=function(e,n){return n.some(function(n){return-1!==e.indexOf(n)})},u=t(e);try{var l=function(){var e,u=i.value,l=t(n.apps);try{for(l.s();!(e=l.n()).done;){var c=e.value;if(u.view_init===c.new_view_init){var f,s=t(n.views);try{for(s.s();!(f=s.n()).done;){var d=f.value;c.old_view_init===d.old_view_id&&(u.view_init=d.new_view_id)}}catch(_){s.e(_)}finally{s.f()}}}}catch(_){l.e(_)}finally{l.f()}if(u.field_id_for_item_name){var p=n.fields.find(function(e){return e.old_field_id==u.field_id_for_item_name});p&&(u.field_id_for_item_name=p.new_field_id)}a._crawling(u.field_list,function(e,i,l){var c;if(o(e,["field_id","FieldId","destination_field","element_id"])){var f,s=String(i).split(","),d=[],p=t(n.fields);try{for(p.s();!(f=p.n()).done;){var v,h=f.value,y=t(s);try{for(y.s();!(v=y.n()).done;){v.value==h.old_field_id&&d.push(h.new_field_id)}}catch(_){y.e(_)}finally{y.f()}}}catch(_){p.e(_)}finally{p.f()}d.length&&(l[e]=d.join(","))}if(o(e,["app_id","AppId","destination_app"])){var m,b=t(n.apps);try{for(b.s();!(m=b.n()).done;){var w=m.value;i==w.old_app_id&&(l[e]=w.new_app_id)}}catch(_){b.e(_)}finally{b.f()}}if(o(e,["view_id"])){var g,k=t(n.views);try{for(k.s();!(g=k.n()).done;){var A=g.value;i==A.old_view_id&&(l[e]=A.new_view_id)}}catch(_){k.e(_)}finally{k.f()}}if(o(e,["src"])&&isFinite(i)){var O=n.apps.find(function(e){return e.new_app_id===u.app_id}).old_app_id,P=a._findPath(r[O].views_list,"container_id",i);l[e]="".concat(a._getValueByPath(u.views_list,P,"container_id"))}if(-1!==e.indexOf("trigger")&&null!==(c=i.model)&&void 0!==c&&c.nodes){var S=i.model.nodes;for(var j in S)for(var I=0,E=["inputs","outputs"];I<E.length;I++){var T,N=E[I],x=S[j],G=t(Object.keys(x[N]).filter(function(e){return""!==e&&!isNaN(e)}));try{var M=function(){var e=T.value,r=n.fields.find(function(n){return n.old_field_id==e});if(null!=r&&r.new_field_id){var i,a=r.new_field_id.toString(),o=x[N][e],u=t(o.connections);try{for(u.s();!(i=u.n()).done;){var l=i.value;l.input==e&&(l.input=a),l.output==e&&(l.output=a)}}catch(_){u.e(_)}finally{u.f()}delete x[N][e],x[N][a]=o}};for(G.s();!(T=G.n()).done;)M()}catch(_){G.e(_)}finally{G.f()}}}})};for(u.s();!(i=u.n()).done;)l()}catch(c){u.e(c)}finally{u.f()}return e}},{key:"_getValueByPath",value:function(e,n,r){var i,a=e,o=t(n.split("."));try{for(o.s();!(i=o.n()).done;){a=a[i.value]}}catch(u){o.e(u)}finally{o.f()}return a[r]}},{key:"_findPath",value:function(e,n,t){var r=!1,i=!1,a=[];return this._crawling(e,function(e,o,l){i&&a.reverse().forEach(function(e){i&&(e.delete=!0,e.parent===l&&(i=!1,(a=a.filter(function(e){return!e.delete})).reverse()))}),r||("object"===u(l[e])&&a.push({prop:e,parent:l}),o==t&&n===e?r=!0:Object.keys(l).pop()===e&&"object"!==u(l[e])&&(i=!0))}),a.map(function(e){return e.prop}).join(".")}},{key:"_prepareAppTemplate",value:function(e){var n=JSON.parse(JSON.stringify(e));this._crawling(n.views_list,function(e,n,t){"element_id"===e&&(t.element_id=-Number(n),t.create_element=-Number(n))});var r,i=t(n.field_list);try{for(i.s();!(r=i.n()).done;){var a=r.value;a.create_field=-Number(a.field_id),a.element_id=-Number(a.field_id),a.field_id=-Number(a.field_id),a.field_value=""}}catch(o){i.e(o)}finally{i.f()}return n.items_list=[],delete n.app_id,delete n.icon.id,delete n.group_id,delete n.trash,delete n.last_update,delete n.file_list,n}}])}();
|
|
297
297
|
},{"../../gudhub.js":"U9gy"}],"E7yc":[function(require,module,exports) {
|
|
298
298
|
"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(t){if(null!=t){var r=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(e(t)+" is not iterable")}function r(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 n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}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 i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function a(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof f?n:f,l=Object.create(a.prototype);return u(l,"_invoke",function(r,n,o){var i,a,u,f=0,l=o||[],s=!1,p={p:0,n:0,v:e,a:y,f:y.bind(e,4),d:function(t,r){return i=t,a=0,u=e,p.n=r,c}};function y(r,n){for(a=r,u=n,t=0;!s&&f&&!o&&t<l.length;t++){var o,i=l[t],y=p.p,b=i[2];r>3?(o=b===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=y&&((o=r<2&&y<i[1])?(a=0,p.v=n,p.n=i[1]):y<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,p.n=b,a=0))}if(o||r>1)return c;throw s=!0,n}return function(o,l,b){if(f>1)throw TypeError("Generator is already running");for(s&&1===l&&y(l,b),a=l,u=b;(t=a<2?e:u)||!s;){i||(a?a<3?(a>1&&(p.n=-1),y(a,u)):p.n=u:p.v=u);try{if(f=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(s=p.n<0)?u:r.call(n,p))!==c)break}catch(t){i=e,a=1,u=t}finally{f=1}}return{value:t,done:s}}}(r,o,i),!0),l}var c={};function f(){}function l(){}function s(){}t=Object.getPrototypeOf;var p=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),y=s.prototype=f.prototype=Object.create(p);function b(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,u(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e}return l.prototype=s,u(y,"constructor",s),u(s,"constructor",l),l.displayName="GeneratorFunction",u(s,o,"GeneratorFunction"),u(y),u(y,o,"Generator"),u(y,n,function(){return this}),u(y,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:b}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(u=function(e,t,r,n){function i(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))})(e,t,r,n)}function c(e){return p(e)||s(e)||l(e)||f()}function f(){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 l(e,t){if(e){if("string"==typeof e)return y(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(e,t):void 0}}function s(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(e){if(Array.isArray(e))return y(e)}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){b(i,n,o,a,u,"next",e)}function u(e){b(i,n,o,a,u,"throw",e)}a(void 0)})}}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(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,g(n.key),n)}}function h(e,t,r){return t&&m(e.prototype,t),r&&m(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function g(t){var r=w(t,"string");return"symbol"==e(r)?r:r+""}function w(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.FileHelper=void 0;var _=exports.FileHelper=function(){return h(function e(t){v(this,e),this.gudhub=t},[{key:"fileInstallerHelper",value:function(){var e=d(a().m(function e(t,r,n,o,i,u){var f,l,s,p,y,b;return a().w(function(e){for(;;)switch(e.n){case 0:f=[[]],l=[],n.forEach(function(e){var t=e.item_id,n=e.fields.find(function(e){return e.element_id===o});null!=n&&n.field_value&&n.field_value.split(".").forEach(function(e){var n={source:e,destination:{app_id:r,item_id:t,element_id:o}};10!==f[f.length-1].length?f[f.length-1].push(n):f.push([n])})}),s=0,p=f;case 1:if(!(s<p.length)){e.n=8;break}if((y=p[s]).length){e.n=2;break}return e.a(3,7);case 2:if(b=void 0,!i){e.n=4;break}return e.n=3,this._copyFilesFromRemoteServer(t,y,u);case 3:b=e.v,e.n=6;break;case 4:return e.n=5,this.gudhub.duplicateFile(y);case 5:b=e.v;case 6:l=[].concat(c(l),c(b));case 7:s++,e.n=1;break;case 8:n.forEach(function(e){var t=e.item_id,r=e.fields.find(function(e){return e.element_id===o});null!=r&&r.field_value&&(r.field_value="",l.forEach(function(e){e.item_id===t&&(r.field_value=r.field_value.split(",").filter(function(e){return e}).concat(e.file_id).join(","))}))});case 9:return e.a(2)}},e,this)}));return function(t,r,n,o,i,a){return e.apply(this,arguments)}}()},{key:"_copyFilesFromRemoteServer",value:function(){var e=d(a().m(function e(r,o,u){var c,f,l,s,p,y=this;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:c=[],f=i(o),e.p=1,s=a().m(function e(){var t,o,f,s,p,b,d,v,m,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=l.value,o=String(t.source).split(",").map(function(e){return e.trim()}).filter(Boolean),f=r.find(function(e){return e.new_app_id===t.destination.app_id})){e.n=1;break}return console.warn("App mapping not found for:",t.destination.app_id),e.a(2,1);case 1:s=f.old_app_id,p=i(o),e.p=2,p.s();case 3:if((b=p.n()).done){e.n=7;break}return d=b.value,e.n=4,u.getFile(s,d);case 4:return v=e.v,e.n=5,y.gudhub.uploadFileFromString(n(n({},v),{},{app_id:t.destination.app_id,item_id:t.destination.item_id,element_id:t.destination.element_id}));case 5:m=e.v,c.push(m);case 6:e.n=3;break;case 7:e.n=9;break;case 8:e.p=8,h=e.v,p.e(h);case 9:return e.p=9,p.f(),e.f(9);case 10:return e.a(2)}},e,null,[[2,8,9,10]])}),f.s();case 2:if((l=f.n()).done){e.n=5;break}return e.d(t(s()),3);case 3:if(!e.v){e.n=4;break}return e.a(3,4);case 4:e.n=2;break;case 5:e.n=7;break;case 6:e.p=6,p=e.v,f.e(p);case 7:return e.p=7,f.f(),e.f(7);case 8:return e.a(2,c)}},e,null,[[1,6,7,8]])}));return function(t,r,n){return e.apply(this,arguments)}}()}])}();
|
|
299
299
|
},{}],"AefJ":[function(require,module,exports) {
|
|
@@ -323,7 +323,7 @@ var t=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
|
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")
|