@gudhub/core 1.1.135 → 1.1.136
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Websocket from "ws";
|
|
2
|
+
import { IS_BROWSER_MAIN_THREAD } from "../consts.js";
|
|
2
3
|
|
|
3
4
|
export class WebSocketApi {
|
|
4
5
|
constructor(url, auth) {
|
|
@@ -11,7 +12,7 @@ export class WebSocketApi {
|
|
|
11
12
|
this.ALLOWED_HEART_BEAT_DELEY = 12000;
|
|
12
13
|
this.firstHeartBeat = true;
|
|
13
14
|
this.reload = true;
|
|
14
|
-
this.isBrowser =
|
|
15
|
+
this.isBrowser = IS_BROWSER_MAIN_THREAD;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
async addSubscription(app_id) {
|
|
@@ -58,7 +59,8 @@ export class WebSocketApi {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
async onMessage(event) {
|
|
61
|
-
|
|
62
|
+
// Browser WebSocket passes MessageEvent (data in event.data), Node.js ws passes raw Buffer
|
|
63
|
+
const message = this.isBrowser ? event.data : event.toString()
|
|
62
64
|
if (message.match(/HeartBeat/)) {
|
|
63
65
|
const hartBeatDelay = new Date().getTime() - this.heartBeatTimeStemp;
|
|
64
66
|
|
|
@@ -100,13 +102,13 @@ export class WebSocketApi {
|
|
|
100
102
|
this.websocket.onmessage = this.onMessage.bind(this);
|
|
101
103
|
} else {
|
|
102
104
|
this.websocket = new Websocket(this.url);
|
|
103
|
-
this.websocket.on("open", this.onOpen);
|
|
105
|
+
this.websocket.on("open", this.onOpen.bind(this));
|
|
104
106
|
|
|
105
|
-
this.websocket.on("error", this.onError);
|
|
107
|
+
this.websocket.on("error", this.onError.bind(this));
|
|
106
108
|
|
|
107
|
-
this.websocket.on("close", this.onClose);
|
|
109
|
+
this.websocket.on("close", this.onClose.bind(this));
|
|
108
110
|
|
|
109
|
-
this.websocket.on("message", this.onMessage);
|
|
111
|
+
this.websocket.on("message", this.onMessage.bind(this));
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
console.log("websocket initialized");
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -225,9 +225,11 @@ var t=arguments[3],e="function"==typeof Map&&Map.prototype,r=Object.getOwnProper
|
|
|
225
225
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Storage=void 0;var t=e(require("./ModulesList.js"));function e(t){return t&&t.__esModule?t:{default:t}}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return s(t)||u(t)||o(t)||i()}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(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 u(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(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(){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 s?n:s,c=Object.create(a.prototype);return p(c,"_invoke",function(r,n,i){var o,s,a,c=0,p=i||[],f=!1,l={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return o=e,s=0,a=t,l.n=r,u}};function y(r,n){for(s=r,a=n,e=0;!f&&c&&!i&&e<p.length;e++){var i,o=p[e],y=l.p,v=o[2];r>3?(i=v===n)&&(a=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=y&&((i=r<2&&y<o[1])?(s=0,l.v=n,l.n=o[1]):y<v&&(i=r<3||o[0]>n||n>v)&&(o[4]=r,o[5]=n,l.n=v,s=0))}if(i||r>1)return u;throw f=!0,n}return function(i,p,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===p&&y(p,v),s=p,a=v;(e=s<2?t:a)||!f;){o||(s?s<3?(s>1&&(l.n=-1),y(s,a)):l.n=a:l.v=a);try{if(c=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(a=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(f=l.n<0)?a:r.call(n,l))!==u)break}catch(e){o=t,s=1,a=e}finally{c=1}}return{value:e,done:f}}}(r,i,o),!0),c}var u={};function s(){}function a(){}function f(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(p(e={},n,function(){return this}),e),y=f.prototype=s.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,p(t,i,"GeneratorFunction")),t.prototype=Object.create(y),t}return a.prototype=f,p(y,"constructor",f),p(f,"constructor",a),a.displayName="GeneratorFunction",p(f,i,"GeneratorFunction"),p(y),p(y,i,"Generator"),p(y,n,function(){return this}),p(y,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:v}})()}function p(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(p=function(t,e,r,n){function o(e,r){p(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 f(t,e,r,n,i,o,u){try{var s=t[o](u),a=s.value}catch(t){return void r(t)}s.done?e(a):Promise.resolve(a).then(n,i)}function l(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function u(t){f(o,n,i,u,s,"next",t)}function s(t){f(o,n,i,u,s,"throw",t)}u(void 0)})}}function y(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 v(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function h(t,e,r){return(e=_(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_(n.key),n)}}function b(t,e,r){return e&&m(t.prototype,e),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _(t){var e=g(t,"string");return"symbol"==r(e)?e:e+""}function g(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var O=exports.Storage=function(){return b(function e(r,n,i){d(this,e),this.apps_list=[],this.users_list=[],this.user={},this.modulesList=(0,t.default)(r,n,i),this.ghComponentsPromises=[]},[{key:"getMainStorage",value:function(){return this}},{key:"getAppsList",value:function(){return this.apps_list}},{key:"getUser",value:function(){return this.user}},{key:"getUsersList",value:function(){return this.users_list}},{key:"getModulesList",value:function(t,e,r){return void 0===t?this.modulesList:0==e?this.modulesList.filter(function(e){return e.created_for?e.type===t&&e.private&&e.created_for.includes(r):e.type===t&&!e.private}):this.modulesList.filter(function(e){return e.type===t})}},{key:"getModuleUrl",value:function(t){return this.modulesList.find(function(e){return e.data_type==t})}},{key:"setUser",value:function(t){this.user=t,this.users_list.push(t)}},{key:"updateUser",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.avatar_128&&(t.avatar_128=t.avatar_128+"?"+(new Date).getTime()),t.avatar_512&&(t.avatar_512=t.avatar_512+"?"+(new Date).getTime()),this.user=v(v({},this.user),t),this.users_list=this.users_list.filter(function(e){return e.user_id!=t.user_id}),this.users_list.push(this.user)}},{key:"unsetUser",value:function(){this.user={}}},{key:"getApp",value:function(t){for(var e=0;e<this.apps_list.length;e++)if(this.apps_list[e].app_id==t)return this.apps_list[e]}},{key:"unsetApps",value:function(){this.apps_list=[]}},{key:"updateApp",value:function(t){return this.apps_list=this.apps_list.map(function(e){return e.app_id==t.app_id?t:e}),this.apps_list}},{key:"deleteApp",value:function(t){return this.apps_list=this.apps_list.filter(function(e){return e.app_id!=t}),this.apps_list}},{key:"updateItemsInApp",value:function(){var t=l(c().m(function t(e,r){var n;return c().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getApp(r);case 1:return(n=t.v)&&(n.items_list=updateItems(e,n.items_list,this.pipeService.emit.bind(this.pipeService),r),this.updateApp(n)),t.a(2,n)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"addItemsToApp",value:function(){var t=l(c().m(function t(e,r){var i,o;return c().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getApp(r);case 1:return(i=t.v)&&((o=i.items_list).push.apply(o,n(e)),this.updateApp(i),this.pipeService.emit("gh_items_update",{app_id:r},e)),t.a(2,i)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItemsInApp",value:function(){var t=l(c().m(function t(e,r){var n;return c().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getApp(r);case 1:return(n=t.v)&&(n.items_list=n.items_list.filter(function(t){return!e.find(function(e){return e.item_id==t.item_id})}),this.updateApp(n)),t.a(2,n)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()}])}();
|
|
226
226
|
},{"./ModulesList.js":"FJWL"}],"p58b":[function(require,module,exports) {
|
|
227
227
|
"use strict";module.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")};
|
|
228
|
+
},{}],"UV2u":[function(require,module,exports) {
|
|
229
|
+
"use strict";function e(o){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(o)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.IS_WEB=void 0;var o=exports.IS_WEB=!["undefined"==typeof window?"undefined":e(window),"undefined"==typeof document?"undefined":e(document)].includes("undefined");
|
|
228
230
|
},{}],"pHMV":[function(require,module,exports) {
|
|
229
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebSocketApi=void 0;var
|
|
230
|
-
},{"ws":"p58b"}],"TPH7":[function(require,module,exports) {
|
|
231
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebSocketApi=void 0;var t=n(require("ws")),e=require("../consts.js");function n(t){return t&&t.__esModule?t:{default:t}}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function c(n,r,o,s){var c=r&&r.prototype instanceof u?r:u,h=Object.create(c.prototype);return i(h,"_invoke",function(n,r,o){var i,s,c,u=0,h=o||[],f=!1,l={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,s=0,c=t,l.n=n,a}};function p(n,r){for(s=n,c=r,e=0;!f&&u&&!o&&e<h.length;e++){var o,i=h[e],p=l.p,b=i[2];n>3?(o=b===r)&&(c=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=n<2&&p<i[1])?(s=0,l.v=r,l.n=i[1]):p<b&&(o=n<3||i[0]>r||r>b)&&(i[4]=n,i[5]=r,l.n=b,s=0))}if(o||n>1)return a;throw f=!0,r}return function(o,h,b){if(u>1)throw TypeError("Generator is already running");for(f&&1===h&&p(h,b),s=h,c=b;(e=s<2?t:c)||!f;){i||(s?s<3?(s>1&&(l.n=-1),p(s,c)):l.n=c:l.v=c);try{if(u=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=l.n<0)?c:n.call(r,l))!==a)break}catch(e){i=t,s=1,c=e}finally{u=1}}return{value:e,done:f}}}(n,o,s),!0),h}var a={};function u(){}function h(){}function f(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(i(e={},r,function(){return this}),e),p=f.prototype=u.prototype=Object.create(l);function b(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,i(t,s,"GeneratorFunction")),t.prototype=Object.create(p),t}return h.prototype=f,i(p,"constructor",f),i(f,"constructor",h),h.displayName="GeneratorFunction",i(f,s,"GeneratorFunction"),i(p),i(p,s,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:c,m:b}})()}function i(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}(i=function(t,e,n,r){function s(e,n){i(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(s("next",0),s("throw",1),s("return",2))})(t,e,n,r)}function s(t,e,n,r,o,i,s){try{var c=t[i](s),a=c.value}catch(t){return void n(t)}c.done?e(a):Promise.resolve(a).then(r,o)}function c(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function c(t){s(i,r,o,c,a,"next",t)}function a(t){s(i,r,o,c,a,"throw",t)}c(void 0)})}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,f(r.key),r)}}function h(t,e,n){return e&&u(t.prototype,e),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t){var e=l(t,"string");return"symbol"==r(e)?e:e+""}function l(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var p=exports.WebSocketApi=function(){return h(function t(n,r){a(this,t),this.websocket=null,this.connected=!1,this.queue=[],this.url=n,this.auth=r,this.heartBeatTimeStemp=1e13,this.ALLOWED_HEART_BEAT_DELEY=12e3,this.firstHeartBeat=!0,this.reload=!0,this.isBrowser=e.IS_BROWSER_MAIN_THREAD},[{key:"addSubscription",value:function(){var t=c(o().m(function t(e){var n,r;return o().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.auth.getToken();case 1:n=t.v,r="token=".concat(n,"/~/app_id=").concat(e),this.connected&&this.websocket.send(r),this.queue.push(e);case 2:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"onOpen",value:function(){var t=c(o().m(function t(){var e,n=this;return o().w(function(t){for(;;)switch(t.n){case 0:return this.reload=!0,console.log("websocket opened"),this.connected=!0,t.n=1,this.auth.getToken();case 1:e=t.v,this.queue.forEach(function(t){var r="token=".concat(e,"/~/app_id=").concat(t);n.websocket.send(r)});case 2:return t.a(2)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"onError",value:function(t){console.log("websocket error: ",t),this.websocket.close()}},{key:"onClose",value:function(){console.log("websocket close"),this.connected=!1;try{this.initWebSocket(this.onMassageHandler,this.refreshAppsHandler)}catch(t){console.log(t)}}},{key:"onMessage",value:function(){var t=c(o().m(function t(e){var n,r,i,s;return o().w(function(t){for(;;)switch(t.n){case 0:if(!(n=this.isBrowser?e.data:e.toString()).match(/HeartBeat/)){t.n=3;break}if(r=(new Date).getTime()-this.heartBeatTimeStemp,!(this.ALLOWED_HEART_BEAT_DELEY<r)){t.n=2;break}return t.n=1,this.onConnectionLost();case 1:t.n=3;break;case 2:this.websocket.send("HeartBeat"),this.heartBeatTimeStemp=(new Date).getTime();case 3:if(this.firstHeartBeat&&(this.connectionChecker(),this.firstHeartBeat=!1),!n.match(/[{}]/)){t.n=5;break}return i=JSON.parse(n),t.n=4,this.auth.getToken();case 4:s=t.v,i.token!=s&&this.onMassageHandler(i);case 5:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"initWebSocket",value:function(e,n){this.onMassageHandler=e,this.refreshAppsHandler=n,this.isBrowser?(this.websocket=new WebSocket(this.url),this.websocket.onopen=this.onOpen.bind(this),this.websocket.onerror=this.onError.bind(this),this.websocket.onclose=this.onClose.bind(this),this.websocket.onmessage=this.onMessage.bind(this)):(this.websocket=new t.default(this.url),this.websocket.on("open",this.onOpen.bind(this)),this.websocket.on("error",this.onError.bind(this)),this.websocket.on("close",this.onClose.bind(this)),this.websocket.on("message",this.onMessage.bind(this))),console.log("websocket initialized")}},{key:"connectionChecker",value:function(){var t=this;setInterval(c(o().m(function e(){var n;return o().w(function(e){for(;;)switch(e.n){case 0:if(n=(new Date).getTime()-t.heartBeatTimeStemp,!(t.ALLOWED_HEART_BEAT_DELEY<n)){e.n=1;break}return e.n=1,t.onConnectionLost();case 1:return e.a(2)}},e)})),1e3)}},{key:"onConnectionLost",value:function(){var t=c(o().m(function t(){var e;return o().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.auth.getVersion();case 1:this.reload&&(this.reload=!1,console.log("Connected"),this.heartBeatTimeStemp=1e13,this.websocket.close()),t.n=3;break;case 2:t.p=2,e=t.v,console.log(e);case 3:return t.a(2)}},t,this,[[0,2]])}));return function(){return t.apply(this,arguments)}}()}])}();
|
|
232
|
+
},{"ws":"p58b","../consts.js":"UV2u"}],"TPH7":[function(require,module,exports) {
|
|
231
233
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.wss_url=exports.server_url=exports.port=exports.node_server_url=exports.file_server_url=exports.automation_modules_path=exports.async_modules_path=void 0;var e=exports.server_url="https://app.gudhub.com/GudHub",s=exports.wss_url="wss://app.gudhub.com/GudHub/ws/app/",r=exports.node_server_url="https://app.gudhub.com/api/services/prod",t=exports.async_modules_path="build/latest/async_modules_node/",o=exports.automation_modules_path="build/latest/automation_modules/",p=exports.file_server_url="https://app.gudhub.com",u=exports.port=9e3;
|
|
232
234
|
},{}],"DvAj":[function(require,module,exports) {
|
|
233
235
|
"use strict";function e(){var t,n,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.toStringTag||"@@toStringTag";function u(e,o,a,i){var u=o&&o.prototype instanceof l?o:l,f=Object.create(u.prototype);return r(f,"_invoke",function(e,r,o){var a,i,u,l=0,f=o||[],p=!1,s={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(e,r){return a=e,i=0,u=t,s.n=r,c}};function v(e,r){for(i=e,u=r,n=0;!p&&l&&!o&&n<f.length;n++){var o,a=f[n],v=s.p,d=a[2];e>3?(o=d===r)&&(u=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=t):a[0]<=v&&((o=e<2&&v<a[1])?(i=0,s.v=r,s.n=a[1]):v<d&&(o=e<3||a[0]>r||r>d)&&(a[4]=e,a[5]=r,s.n=d,i=0))}if(o||e>1)return c;throw p=!0,r}return function(o,f,d){if(l>1)throw TypeError("Generator is already running");for(p&&1===f&&v(f,d),i=f,u=d;(n=i<2?t:u)||!p;){a||(i?i<3?(i>1&&(s.n=-1),v(i,u)):s.n=u:s.v=u);try{if(l=2,a){if(i||(o="next"),n=a[o]){if(!(n=n.call(a,u)))throw TypeError("iterator result is not an object");if(!n.done)return n;u=n.value,i<2&&(i=0)}else 1===i&&(n=a.return)&&n.call(a),i<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=t}else if((n=(p=s.n<0)?u:e.call(r,s))!==c)break}catch(n){a=t,i=1,u=n}finally{l=1}}return{value:n,done:p}}}(e,a,i),!0),f}var c={};function l(){}function f(){}function p(){}n=Object.getPrototypeOf;var s=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),v=p.prototype=l.prototype=Object.create(s);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,r(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e}return f.prototype=p,r(v,"constructor",p),r(p,"constructor",f),f.displayName="GeneratorFunction",r(p,i,"GeneratorFunction"),r(v),r(v,i,"Generator"),r(v,a,function(){return this}),r(v,"toString",function(){return"[object Generator]"}),(e=function(){return{w:u,m:d}})()}function r(e,t,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(r=function(e,t,n,o){function i(t,n){r(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!o,configurable:!o,writable:!o}):e[t]=n:(i("next",0),i("throw",1),i("return",2))})(e,t,n,o)}function t(e){return a(e)||o(e)||u(e)||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 o(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e){if(Array.isArray(e))return c(e)}function i(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=u(e))||r&&e&&"number"==typeof e.length){t&&(e=t);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 a,i=!0,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==t.return||t.return()}finally{if(c)throw a}}}}function u(e,r){if(e){if("string"==typeof e)return c(e,r);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)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function l(e,r,t,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,o)}function f(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function i(e){l(a,n,o,i,u,"next",e)}function u(e){l(a,n,o,i,u,"throw",e)}i(void 0)})}}function p(e,r,t){return s.apply(this,arguments)}function s(){return(s=f(e().m(function r(n,o,a){var u,c,l,f,p,s,v,d,y,h,b,_,m,g,w,A,M,S=arguments;return e().w(function(e){for(;;)switch(e.p=e.n){case 0:if(w=function(e){return new Promise(function(r){a.on("gh_value_get",e,function t(n,o){a.destroy("gh_value_get",e,t),r(o)}).emit("gh_value_get",{},e)})},u=S.length>3&&void 0!==S[3]?S[3]:{},c=[],l={variableMethodcurrent_app:function(){return[u.current_app_id||u.app_id]},variableMethodelement_app:function(){return[u.element_app_id]},variableMethodcurrent_item:function(){return["".concat(u.current_app_id||u.app_id,".").concat(u.item_id)]},variableMethoduser_id:function(){return[o.getUser().user_id]},variableMethodshared_groups:function(){var e,r;return null!==(e=null===(r=o.user)||void 0===r||null===(r=r.shared_groups)||void 0===r?void 0:r.map(function(e){return null==e?void 0:e.group_id}))&&void 0!==e?e:[]},variableMethoduser_email:function(e){return[o.getUser().username]},variableMethodtoday:function(e){var r=new Date,t=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+1);return[t.valueOf().toString()+":"+n.valueOf().toString()]},variableMethodvariable:function(e){return[u[e]]}},!n){e.n=13;break}f=i(n),e.p=1,f.s();case 2:if((p=f.n()).done){e.n=10;break}if(!(s=p.value)){e.n=8;break}A=s.input_type,e.n="variable"===A?3:"field"===A?4:6;break;case 3:s.valuesArray=[],v=i(null==s?void 0:s.input_value.split(","));try{for(v.s();!(d=v.n()).done;)y=d.value,h=s.input_type+"Method"+y,"function"==typeof(b=l[h])?s.valuesArray?(_=s.valuesArray).push.apply(_,t(b())):s.valuesArray=b():s.valuesArray?(m=s.valuesArray).push.apply(m,t(l.variableMethodvariable(y))):s.valuesArray=l.variableMethodvariable(y)}catch(r){v.e(r)}finally{v.f()}return c.push(s),e.a(3,7);case 4:return e.n=5,w({app_id:u.current_app_id||u.app_id,item_id:u.item_id,field_id:s.input_value});case 5:return null!=(g=e.v)&&s.valuesArray.push(g),c.push(s),e.a(3,7);case 6:return c.push(s),e.a(3,7);case 7:e.n=9;break;case 8:c.push(s);case 9:e.n=2;break;case 10:e.n=12;break;case 11:e.p=11,M=e.v,f.e(M);case 12:return e.p=12,f.f(),e.f(12);case 13:return e.a(2,c)}},r,null,[[1,11,12,13]])}))).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterPreparation=p;
|
|
@@ -306,8 +308,6 @@ function o(e){return module.exports=o="function"==typeof Symbol&&"symbol"==typeo
|
|
|
306
308
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=b(require("./filter/filter.js")),r=require("./filter/mergeFilters.js"),n=require("./json_to_items/json_to_items.js"),i=require("./merge_compare_items/merge_compare_items.js"),o=require("./filter/group.js"),u=require("./filter/utils.js"),s=b(require("./populate_items/populate_items.js")),l=require("./get_date/get_date.js"),a=require("./merge_objects/merge_objects.js"),c=require("./merge_chunks/merge_chunks.js"),f=require("./nested_list/nested_list.js"),p=b(require("./MergeFields/MergeFields.js")),m=b(require("./ItemsSelection/ItemsSelection.js")),v=require("./compare_items_lists_worker/compare_items_lists.worker.js"),y=require("./json_constructor/json_constructor.js"),h=b(require("./AppsTemplateService/AppsTemplateService.js")),d=require("./FIleHelper/FileHelper.js"),g=require("./compareObjects/compareObjects.js"),j=require("./dynamicPromiseAll/dynamicPromiseAll.js"),k=require("./filter/sortItems.js");function b(e){return e&&e.__esModule?e:{default:e}}function _(e){return(_="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 I(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var l=n&&n.prototype instanceof s?n:s,a=Object.create(l.prototype);return w(a,"_invoke",function(r,n,i){var o,s,l,a=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,r){return o=t,s=0,l=e,p.n=r,u}};function m(r,n){for(s=r,l=n,t=0;!f&&a&&!i&&t<c.length;t++){var i,o=c[t],m=p.p,v=o[2];r>3?(i=v===n)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((i=r<2&&m<o[1])?(s=0,p.v=n,p.n=o[1]):m<v&&(i=r<3||o[0]>n||n>v)&&(o[4]=r,o[5]=n,p.n=v,s=0))}if(i||r>1)return u;throw f=!0,n}return function(i,c,v){if(a>1)throw TypeError("Generator is already running");for(f&&1===c&&m(c,v),s=c,l=v;(t=s<2?e:l)||!f;){o||(s?s<3?(s>1&&(p.n=-1),m(s,l)):p.n=l:p.v=l);try{if(a=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(f=p.n<0)?l:r.call(n,p))!==u)break}catch(t){o=e,s=1,l=t}finally{a=1}}return{value:t,done:f}}}(r,i,o),!0),a}var u={};function s(){}function l(){}function a(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(w(t={},n,function(){return this}),t),f=a.prototype=s.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,w(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=a,w(f,"constructor",a),w(a,"constructor",l),l.displayName="GeneratorFunction",w(a,i,"GeneratorFunction"),w(f),w(f,i,"Generator"),w(f,n,function(){return this}),w(f,"toString",function(){return"[object Generator]"}),(I=function(){return{w:o,m:p}})()}function w(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(w=function(e,t,r,n){function o(t,r){w(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))})(e,t,r,n)}function S(e,t,r,n,i,o,u){try{var s=e[o](u),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function F(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function u(e){S(o,n,i,u,s,"next",e)}function s(e){S(o,n,i,u,s,"throw",e)}u(void 0)})}}function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q(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,P(n.key),n)}}function O(e,t,r){return t&&q(e.prototype,t),r&&q(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(e){var t=A(e,"string");return"symbol"==_(t)?t:t+""}function A(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var L=exports.Utils=function(){return O(function e(t){T(this,e),this.gudhub=t,this.MergeFields=new p.default(t),this.ItemsSelection=new m.default(t),this.AppsTemplateService=new h.default(t),this.FileHelper=new d.FileHelper(t)},[{key:"prefilter",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,e.filterPreparation)(t,this.gudhub.storage,this.gudhub.pipeService,r)}},{key:"filter",value:function(e,r){return(0,t.default)(e,r)}},{key:"mergeFilters",value:function(e,t){return(0,r.mergeFilters)(e,t)}},{key:"group",value:function(e,t){return(0,o.group)(e,t)}},{key:"getFilteredItems",value:function(){var e=F(I().m(function e(){var t,r,n,i,o,s,l,a,c,f,p,m=arguments;return I().w(function(e){for(;;)switch(e.n){case 0:return t=m.length>0&&void 0!==m[0]?m[0]:[],r=m.length>1&&void 0!==m[1]?m[1]:[],n=m.length>2?m[2]:void 0,i=m.length>3?m[3]:void 0,o=m.length>4?m[4]:void 0,s=m.length>5&&void 0!==m[5]?m[5]:"",l=m.length>6?m[6]:void 0,a=m.length>7?m[7]:void 0,e.n=1,this.prefilter(r,{element_app_id:n,app_id:i,item_id:o});case 1:return c=e.v,f=this.filter(t,c),p=this.group(s,f),e.a(2,p.filter(function(e){return!l||1===(0,u.searchValue)([e],l).length}).filter(function(e){return!a||1===(0,u.searchValue)([e],a).length}))}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"jsonToItems",value:function(e,t){return(0,n.jsonToItems)(e,t)}},{key:"getDate",value:function(e){return(0,l.getDate)(e)}},{key:"checkRecurringDate",value:function(e,t){return(0,l.checkRecurringDate)(e,t)}},{key:"populateItems",value:function(e,t,r){return(0,s.default)(e,t,r)}},{key:"populateWithDate",value:function(e,t){return(0,l.populateWithDate)(e,t)}},{key:"populateWithItemRef",value:function(e,t,r,n,o,u){return(0,i.populateWithItemRef)(e,t,r,n,o,u)}},{key:"compareItems",value:function(e,t,r){return(0,i.compareItems)(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return(0,i.mergeItems)(e,t,r)}},{key:"mergeObjects",value:function(e,t,r){return(0,a.mergeObjects)(e,t,r)}},{key:"makeNestedList",value:function(e,t,r,n,i){return(0,f.makeNestedList)(e,t,r,n,i)}},{key:"mergeChunks",value:function(e){return(0,c.mergeChunks)(e)}},{key:"mergeFieldLists",value:function(e,t){return this.MergeFields.mergeFieldLists(e,t)}},{key:"createFieldsListToView",value:function(e,t){return this.MergeFields.createFieldsListToView(e,t)}},{key:"createFieldsListToViewWithDataType",value:function(e,t){return this.MergeFields.createFieldsListToViewWithDataType(e,t)}},{key:"selectItems",value:function(e,t){return this.ItemsSelection.selectItems(e,t)}},{key:"getSelectedItems",value:function(e){return this.ItemsSelection.getSelectedItems(e)}},{key:"clearSelectedItems",value:function(e){return this.ItemsSelection.clearSelectedItems(e)}},{key:"isItemSelected",value:function(e,t){return this.ItemsSelection.isItemSelected(e,t)}},{key:"jsonConstructor",value:function(e,t,r,n){return(0,y.compiler)(e,t,this,r,n)}},{key:"fileInstallerHelper",value:function(e,t,r,n,i,o){return this.FileHelper.fileInstallerHelper(e,t,r,n,i,o)}},{key:"createAppsFromTemplate",value:function(e,t,r,n,i,o){return this.AppsTemplateService.createAppsFromTemplate(e,t,r,n,i,o)}},{key:"createApps",value:function(e){return this.AppsTemplateService.createApps(e)}},{key:"createItems",value:function(e,t){return this.AppsTemplateService.createItems(e,t)}},{key:"compareObjects",value:function(e,t){return(0,g.compareObjects)(e,t)}},{key:"compareAppsItemsLists",value:function(e,t,r){var n=new Blob([(0,v.compare_items_lists_Worker)()],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.worker.postMessage({items_list1:e,items_list2:t}),this.worker.addEventListener("message",function(e){var t=e.data.diff;r(t)})}},{key:"dynamicPromiseAll",value:function(e){return(0,j.dynamicPromiseAll)(e)}},{key:"sortItems",value:function(e,t){return(0,k.sortItems)(e,t)}},{key:"debounce",value:function(e,t){var r;return function(){for(var n=this,i=arguments.length,o=new Array(i),u=0;u<i;u++)o[u]=arguments[u];clearTimeout(r),r=setTimeout(function(){e.apply(n,o)},t)}}}])}();
|
|
307
309
|
},{"./filter/filterPreparation.js":"DvAj","./filter/filter.js":"mbGN","./filter/mergeFilters.js":"LXWr","./json_to_items/json_to_items.js":"UCDv","./merge_compare_items/merge_compare_items.js":"xDLX","./filter/group.js":"VgUi","./filter/utils.js":"zsiC","./populate_items/populate_items.js":"EzAv","./get_date/get_date.js":"VzfS","./merge_objects/merge_objects.js":"EE1j","./merge_chunks/merge_chunks.js":"AMYJ","./nested_list/nested_list.js":"S7Iy","./MergeFields/MergeFields.js":"vno1","./ItemsSelection/ItemsSelection.js":"DfIi","./compare_items_lists_worker/compare_items_lists.worker.js":"xR4c","./json_constructor/json_constructor.js":"nKaW","./AppsTemplateService/AppsTemplateService.js":"zqOZ","./FIleHelper/FileHelper.js":"E7yc","./compareObjects/compareObjects.js":"AefJ","./dynamicPromiseAll/dynamicPromiseAll.js":"ndUf","./filter/sortItems.js":"Owq4"}],"rK64":[function(require,module,exports) {
|
|
308
310
|
"use strict";function t(r){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})(r)}function r(){var t,n,o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",i=o.toStringTag||"@@toStringTag";function a(r,o,u,i){var a=o&&o.prototype instanceof c?o:c,f=Object.create(a.prototype);return e(f,"_invoke",function(r,e,o){var u,i,a,c=0,f=o||[],p=!1,l={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(r,e){return u=r,i=0,a=t,l.n=e,s}};function h(r,e){for(i=r,a=e,n=0;!p&&c&&!o&&n<f.length;n++){var o,u=f[n],h=l.p,v=u[2];r>3?(o=v===e)&&(a=u[(i=u[4])?5:(i=3,3)],u[4]=u[5]=t):u[0]<=h&&((o=r<2&&h<u[1])?(i=0,l.v=e,l.n=u[1]):h<v&&(o=r<3||u[0]>e||e>v)&&(u[4]=r,u[5]=e,l.n=v,i=0))}if(o||r>1)return s;throw p=!0,e}return function(o,f,v){if(c>1)throw TypeError("Generator is already running");for(p&&1===f&&h(f,v),i=f,a=v;(n=i<2?t:a)||!p;){u||(i?i<3?(i>1&&(l.n=-1),h(i,a)):l.n=a:l.v=a);try{if(c=2,u){if(i||(o="next"),n=u[o]){if(!(n=n.call(u,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,i<2&&(i=0)}else 1===i&&(n=u.return)&&n.call(u),i<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),i=1);u=t}else if((n=(p=l.n<0)?a:r.call(e,l))!==s)break}catch(n){u=t,i=1,a=n}finally{c=1}}return{value:n,done:p}}}(r,u,i),!0),f}var s={};function c(){}function f(){}function p(){}n=Object.getPrototypeOf;var l=[][u]?n(n([][u]())):(e(n={},u,function(){return this}),n),h=p.prototype=c.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,e(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return f.prototype=p,e(h,"constructor",p),e(p,"constructor",f),f.displayName="GeneratorFunction",e(p,i,"GeneratorFunction"),e(h),e(h,i,"Generator"),e(h,u,function(){return this}),e(h,"toString",function(){return"[object Generator]"}),(r=function(){return{w:a,m:v}})()}function e(t,r,n,o){var u=Object.defineProperty;try{u({},"",{})}catch(t){u=0}(e=function(t,r,n,o){function i(r,n){e(t,r,function(t){return this._invoke(r,n,t)})}r?u?u(t,r,{value:n,enumerable:!o,configurable:!o,writable:!o}):t[r]=n:(i("next",0),i("throw",1),i("return",2))})(t,r,n,o)}function n(t,r,e,n,o,u,i){try{var a=t[u](i),s=a.value}catch(t){return void e(t)}a.done?r(s):Promise.resolve(s).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise(function(o,u){var i=t.apply(r,e);function a(t){n(i,o,u,a,s,"next",t)}function s(t){n(i,o,u,a,s,"throw",t)}a(void 0)})}}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function i(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,s(n.key),n)}}function a(t,r,e){return r&&i(t.prototype,r),e&&i(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(r){var e=c(r,"string");return"symbol"==t(e)?e:e+""}function c(r,e){if("object"!=t(r)||!r)return r;var n=r[Symbol.toPrimitive];if(void 0!==n){var o=n.call(r,e||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0;var f=exports.Auth=function(){return a(function t(r,e){u(this,t),this.req=r,this.storage=e},[{key:"login",value:function(){var t=o(r().m(function t(){var e,n,o,u,i,a,s=arguments;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=s.length>0&&void 0!==s[0]?s[0]:{},n=e.username,o=e.password,t.p=1,t.n=2,this.loginApi(n,o);case 2:return u=t.v,this.storage.updateUser(u),t.a(2,u);case 3:return t.p=3,a=t.v,t.a(2,{error:(null===(i=a.response)||void 0===i?void 0:i.data)||a.message})}},t,this,[[1,3]])}));return function(){return t.apply(this,arguments)}}()},{key:"loginWithToken",value:function(){var t=o(r().m(function t(e){var n;return r().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.loginWithTokenApi(e);case 1:return n=t.v,this.storage.updateUser(n),t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"logout",value:function(){var t=o(r().m(function t(e){var n;return r().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.logoutApi(e);case 1:return n=t.v,t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"signup",value:function(){var t=o(r().m(function t(e){var n;return r().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.signupApi(e);case 1:return n=t.v,t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"updateToken",value:function(){var t=o(r().m(function t(e){var n;return r().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.updateTokenApi(e);case 1:return n=t.v,t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"updateUser",value:function(){var t=o(r().m(function t(e){var n;return r().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.updateUserApi(e);case 1:return n=t.v,this.storage.updateUser(n),t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"updateAvatar",value:function(){var t=o(r().m(function t(e){var n;return r().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.avatarUploadApi(e);case 1:return n=t.v,this.storage.updateUser(n),t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"getUsersList",value:function(){var t=o(r().m(function t(e){var n;return r().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getUsersListApi(e);case 1:return n=t.v,t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"loginApi",value:function(){var t=o(r().m(function t(e,n){var o,u,i,a;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login"),form:{username:e,password:n}});case 1:return o=t.v,t.a(2,o);case 2:return t.p=2,a=t.v,console.log(a),t.a(2,{status:null===(u=a.response)||void 0===u?void 0:u.status,message:null===(i=a.response)||void 0===i?void 0:i.data})}},t,this,[[0,2]])}));return function(r,e){return t.apply(this,arguments)}}()},{key:"loginWithTokenApi",value:function(){var t=o(r().m(function t(e){var n,o;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login?accesstoken=").concat(e)});case 1:return n=t.v,t.a(2,n);case 2:t.p=2,o=t.v,console.log(o);case 3:return t.a(2)}},t,this,[[0,2]])}));return function(r){return t.apply(this,arguments)}}()},{key:"updateTokenApi",value:function(){var t=o(r().m(function t(e){var n,o;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login"),form:{auth_key:e}});case 1:return n=t.v,t.a(2,n);case 2:t.p=2,o=t.v,console.log(o);case 3:return t.a(2)}},t,this,[[0,2]])}));return function(r){return t.apply(this,arguments)}}()},{key:"logoutApi",value:function(t){return this.req.post({url:"/auth/logout",form:{token:t}})}},{key:"signupApi",value:function(t){return this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/singup"),form:{user:JSON.stringify(t)}})}},{key:"getUsersListApi",value:function(t){return this.req.get({url:"/auth/userlist",params:{keyword:t}})}},{key:"updateUserApi",value:function(t){return this.req.post({url:"/auth/updateuser",form:{user:JSON.stringify(t)}})}},{key:"avatarUploadApi",value:function(t){return this.req.post({url:"/auth/avatar-upload",form:{image:t}})}},{key:"getUserByIdApi",value:function(t){return this.req.get({url:"/auth/getuserbyid",params:{id:t}})}},{key:"getVersion",value:function(){return this.req.get({url:"/version"})}},{key:"getUserFromStorage",value:function(t){return this.storage.getUsersList().find(function(r){return r.user_id==t})}},{key:"saveUserToStorage",value:function(t){var r=this.storage.getUsersList(),e=r.find(function(r){return r.user_id==t.user_id});return e||(r.push(t),t)}},{key:"getUserById",value:function(){var t=o(r().m(function t(e){var n,o;return r().w(function(t){for(;;)switch(t.n){case 0:if(n=this.getUserFromStorage(e)){t.n=3;break}return t.n=1,this.getUserByIdApi(e);case 1:if(o=t.v){t.n=2;break}return t.a(2,null);case 2:(n=this.getUserFromStorage(e))||(this.saveUserToStorage(o),n=o);case 3:return t.a(2,n)}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"getToken",value:function(){var t=o(r().m(function t(){var e,n,o,u;return r().w(function(t){for(;;)switch(t.n){case 0:if(e=new Date(this.storage.getUser().expirydate),n=new Date,o=this.storage.getUser().accesstoken,!(e<n)&&o){t.n=2;break}return t.n=1,this.updateToken(this.storage.getUser().auth_key);case 1:u=t.v,this.storage.updateUser(u),o=u.accesstoken;case 2:return t.a(2,o)}},t,this)}));return function(){return t.apply(this,arguments)}}()}])}();
|
|
309
|
-
},{}],"UV2u":[function(require,module,exports) {
|
|
310
|
-
"use strict";function e(o){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(o)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.IS_WEB=void 0;var o=exports.IS_WEB=!["undefined"==typeof window?"undefined":e(window),"undefined"==typeof document?"undefined":e(document)].includes("undefined");
|
|
311
311
|
},{}],"osSN":[function(require,module,exports) {
|
|
312
312
|
var global = arguments[3];
|
|
313
313
|
var global=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=createAngularModuleInstance;var _axios=_interopRequireDefault(require("axios")),_consts=require("./../consts.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _regenerator(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var l=r&&r.prototype instanceof c?r:c,i=Object.create(l.prototype);return _regeneratorDefine2(i,"_invoke",function(n,r,o){var a,c,l,i=0,s=o||[],d=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,c=0,l=e,f.n=n,u}};function p(n,r){for(c=n,l=r,t=0;!d&&i&&!o&&t<s.length;t++){var o,a=s[t],p=f.p,g=a[2];n>3?(o=g===r)&&(l=a[(c=a[4])?5:(c=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(c=0,f.v=r,f.n=a[1]):p<g&&(o=n<3||a[0]>r||r>g)&&(a[4]=n,a[5]=r,f.n=g,c=0))}if(o||n>1)return u;throw d=!0,r}return function(o,s,g){if(i>1)throw TypeError("Generator is already running");for(d&&1===s&&p(s,g),c=s,l=g;(t=c<2?e:l)||!d;){a||(c?c<3?(c>1&&(f.n=-1),p(c,l)):f.n=l:f.v=l);try{if(i=2,a){if(c||(o="next"),t=a[o]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,c<2&&(c=0)}else 1===c&&(t=a.return)&&t.call(a),c<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),c=1);a=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==u)break}catch(t){a=e,c=1,l=t}finally{i=1}}return{value:t,done:d}}}(n,o,a),!0),i}var u={};function c(){}function l(){}function i(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(_regeneratorDefine2(t={},r,function(){return this}),t),d=i.prototype=c.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=i,_regeneratorDefine2(d,"constructor",i),_regeneratorDefine2(i,"constructor",l),l.displayName="GeneratorFunction",_regeneratorDefine2(i,o,"GeneratorFunction"),_regeneratorDefine2(d),_regeneratorDefine2(d,o,"Generator"),_regeneratorDefine2(d,r,function(){return this}),_regeneratorDefine2(d,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:a,m:f}})()}function _regeneratorDefine2(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(_regeneratorDefine2=function(e,t,n,r){function a(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))})(e,t,n,r)}function asyncGeneratorStep(e,t,n,r,o,a,u){try{var c=e[a](u),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){asyncGeneratorStep(a,r,o,u,c,"next",e)}function c(e){asyncGeneratorStep(a,r,o,u,c,"throw",e)}u(void 0)})}}function _typeof(e){return(_typeof="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)}var $q={when:function(e){return new Promise(function(t){t(e)})}},factoryReturns={},angular={module:function(){return angular},directive:function(){return angular},factory:function(e,t){try{"object"===_typeof(t)?factoryReturns[e]=t[t.length-1]($q):factoryReturns[e]=t($q)}catch(n){console.log("Errror in data type: ",e),console.log(n)}return angular},service:function(){return angular},run:function(){return angular},filter:function(){return angular},controller:function(){return angular},value:function(){return angular},element:function(){return angular},injector:function(){return angular},invoke:function(){return angular}};function createAngularModuleInstance(e,t,n,r,o){return _createAngularModuleInstance.apply(this,arguments)}function _createAngularModuleInstance(){return _createAngularModuleInstance=_asyncToGenerator(_regenerator().m(function _callee5(gudhub,module_id,module_url,angularInjector,nodeWindow){var angularModule,importedClass,module,_module,setGlobal,proxy,response,code,encodedCode,_module2,result,_t2,_t3,_t4;return _regenerator().w(function(_context5){for(;;)switch(_context5.p=_context5.n){case 0:if(_context5.p=0,!_consts.IS_WEB){_context5.n=7;break}if(!window.angular){_context5.n=4;break}if(angularInjector.has(module_id)){_context5.n=1;break}return _context5.n=1,angularInjector.get("$ocLazyLoad").load(module_url);case 1:return _context5.n=2,angularInjector.get(module_id);case 2:return angularModule=_context5.v,_context5.n=3,_axios.default.get(module_url);case 3:module=_context5.v,module=module.data;try{eval(module)}catch(error){console.error("ERROR WHILE EVAL() IN GHCONSTRUCTOR. MODULE ID: ".concat(module_id)),console.log(error)}importedClass=factoryReturns[module_id],_context5.n=6;break;case 4:return _context5.n=5,_axios.default.get(module_url);case 5:_module=_context5.v,_module=_module.data;try{eval(_module)}catch(err){console.log("Error while importing module: ".concat(module_id)),console.log(err)}importedClass=factoryReturns[module_id];case 6:_context5.n=15;break;case 7:if(setGlobal=function(e,t){var n=Object.getOwnPropertyDescriptor(global,e);if(n)if(n.writable||"function"==typeof n.set)try{global[e]=t}catch(r){}else;else try{Object.defineProperty(global,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}catch(r){}},proxy=new Proxy(nodeWindow,{get:function(e,t){var n=e[t];if("symbol"!==_typeof(n))return n},set:function(e,t,n){return"symbol"!==_typeof(n)&&(e[t]=n,setGlobal(t,n),!0)}}),!Object.prototype.hasOwnProperty.call(global,"window")&&(setGlobal("window",proxy),setGlobal("document",nodeWindow.document),setGlobal("Element",nodeWindow.Element),setGlobal("CharacterData",nodeWindow.CharacterData),setGlobal("this",proxy),setGlobal("self",proxy),setGlobal("Blob",nodeWindow.Blob),setGlobal("Node",nodeWindow.Node),setGlobal("navigator",nodeWindow.navigator),setGlobal("HTMLElement",nodeWindow.HTMLElement),setGlobal("XMLHttpRequest",nodeWindow.XMLHttpRequest),setGlobal("WebSocket",nodeWindow.WebSocket),setGlobal("crypto",nodeWindow.crypto),setGlobal("DOMParser",nodeWindow.DOMParser),setGlobal("angular",angular),global.document))try{global.document.queryCommandSupported=function(){return!1}}catch(_){}return _context5.p=8,_context5.n=9,_axios.default.get(module_url);case 9:return response=_context5.v,code=response.data,encodedCode=encodeURIComponent(code),encodedCode="data:text/javascript;charset=utf-8,"+encodedCode,_context5.p=10,_context5.n=11,import(encodedCode);case 11:_module2=_context5.v,_context5.n=13;break;case 12:_context5.p=12,_t2=_context5.v,console.log("Error while importing module: ".concat(module_id)),console.log(_t2);case 13:_module2&&_module2.default?importedClass=new _module2.default:console.error("Module ".concat(module_id," didn't export a default class")),_context5.n=15;break;case 14:_context5.p=14,_t3=_context5.v,console.error("Error fetching module code:",_t3);case 15:return result={type:module_id,getTemplate:function(e,t,n,r,o,a){var u="false"!==n;return importedClass.getTemplate(e,t,u,r,o,a)},getDefaultValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(_regenerator().m(function o(a){var u,c;return _regenerator().w(function(o){for(;;)switch(o.n){case 0:if(!(u=importedClass.getDefaultValue)){o.n=2;break}return o.n=1,u(e,t,n,r);case 1:c=o.v,a(c),o.n=3;break;case 2:a(null);case 3:return o.a(2)}},o)}));return function(e){return o.apply(this,arguments)}}())},getSettings:function(e,t,n){return importedClass.getSettings(e,t,n)},filter:{getSearchOptions:function(e){var t=importedClass;return t.filter&&t.filter.getSearchOptions?importedClass.filter.getSearchOptions(e)||null:[]},getDropdownValues:function(){var e=importedClass;return e.filter&&e.filter.getDropdownValues?e.filter.getDropdownValues()||null:[]}},getInterpretation:function(e,t,n,r,o,a){return new Promise(function(){var u=_asyncToGenerator(_regenerator().m(function u(c){var l,i,s,d,f;return _regenerator().w(function(u){for(;;)switch(u.p=u.n){case 0:return l=importedClass,u.p=1,u.n=2,l.getInterpretation(gudhub,e,a,o,r,n);case 2:return i=u.v,s=i.find(function(e){return e.id==t})||i.find(function(e){return"default"==e.id}),u.n=3,s.content();case 3:d=u.v,c({html:d}),u.n=5;break;case 4:u.p=4,f=u.v,console.log("ERROR IN ".concat(module_id),f),c({html:"<span>no interpretation</span>"});case 5:return u.a(2)}},u,null,[[1,4]])}));return function(e){return u.apply(this,arguments)}}())},getInterpretationsList:function(e,t,n,r){return importedClass.getInterpretation(e,t,n,r)},getInterpretatedValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(_regenerator().m(function o(a){var u,c;return _regenerator().w(function(o){for(;;)switch(o.n){case 0:if(!(u=importedClass.getInterpretatedValue)){o.n=2;break}return o.n=1,u(e,t,n,r);case 1:c=o.v,a(c),o.n=3;break;case 2:a(e);case 3:return o.a(2)}},o)}));return function(e){return o.apply(this,arguments)}}())},onMessage:function(e,t,n){return new Promise(function(){var r=_asyncToGenerator(_regenerator().m(function r(o){var a,u;return _regenerator().w(function(r){for(;;)switch(r.n){case 0:if(!(a=importedClass.onMessage)){r.n=2;break}return r.n=1,a(e,t,n);case 1:u=r.v,o(u);case 2:o(null);case 3:return r.a(2)}},r)}));return function(e){return r.apply(this,arguments)}}())},getDictionary:function(){return importedClass.getDictionary?importedClass.getDictionary():[]}},_consts.IS_WEB&&(result.extendController=function(e){angularModule.getActionScope(e)},result.runAction=function(e){try{angularModule.runAction(e)}catch(t){}},result.getWindowScope=function(e){return angularModule.getWindowScope(e)},result.getWindowHTML=function(e){return angularModule.getWindowHTML(e)}),_context5.a(2,result);case 16:_context5.p=16,_t4=_context5.v,console.log(_t4),console.log("Failed in createAngularModuleInstance (ghconstructor). Module id: ".concat(module_id,"."));case 17:return _context5.a(2)}},_callee5,null,[[10,12],[8,14],[0,16]])})),_createAngularModuleInstance.apply(this,arguments)}
|