@gudhub/core 1.1.113 → 1.1.114
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.
|
@@ -221,7 +221,7 @@ async getFiles(app_id, filesId = []) {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
async isFileExists(app_id, file_id) {
|
|
224
|
-
let urlPattern = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
|
|
224
|
+
let urlPattern = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:\d+)?([\/\w \.-]*)*\/?$/;
|
|
225
225
|
if(Boolean(file_id)) {
|
|
226
226
|
let file = await this.getFile(app_id, file_id);
|
|
227
227
|
if(Boolean(file)) {
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -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){if(t)o?o(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n;else{var u=function(t,n){r(e,t,function(e){return this._invoke(t,n,e)})};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.file_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.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){if(e)i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r;else{var o=function(e,r){c(t,e,function(t){return this._invoke(e,r,t)})};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.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.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.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.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})([\/\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,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){if(e)i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r;else{var o=function(e,r){c(t,e,function(t){return this._invoke(e,r,t)})};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.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.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.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.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)}}()}])}();
|
|
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){if(n)i?i(t,n,{value:e,enumerable:!o,configurable:!o,writable:!o}):t[n]=e;else{var u=function(n,e){r(t,n,function(t){return this._invoke(n,e,t)})};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.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.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) {
|