@gudhub/core 1.0.62 → 1.0.63
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.
|
@@ -188,33 +188,12 @@ export class GHConstructor {
|
|
|
188
188
|
|
|
189
189
|
//*************** GET INTERPRETATION ****************//
|
|
190
190
|
|
|
191
|
-
getInterpretation: function
|
|
192
|
-
return new Promise(async (resolve) => {
|
|
193
|
-
let currentDataType = angularModule;
|
|
194
|
-
|
|
195
|
-
let interpr_arr = await currentDataType.getInterpretation(value, field, dataType, interpretation_id, itemId, appId);
|
|
196
|
-
if (interpr_arr) {
|
|
197
|
-
let data = interpr_arr.find((item) => item.id == interpretation_id) || interpr_arr.find((item) => item.id == 'default');
|
|
198
|
-
|
|
199
|
-
resolve({
|
|
200
|
-
html: data.html
|
|
201
|
-
})
|
|
202
|
-
} else {
|
|
203
|
-
resolve({
|
|
204
|
-
html: '<span>error(from constructor)</span>'
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
//*************** GET INTERPRETATION V2 ****************//
|
|
211
|
-
|
|
212
|
-
getInterpretationNew: function(value, interpretation_id, dataType, field, itemId, appId) {
|
|
191
|
+
getInterpretation: function(value, interpretation_id, dataType, field, itemId, appId) {
|
|
213
192
|
return new Promise(async (resolve) => {
|
|
214
193
|
let currentDataType = factoryReturns[module_id];
|
|
215
194
|
|
|
216
195
|
try {
|
|
217
|
-
let interpr_arr = await currentDataType.
|
|
196
|
+
let interpr_arr = await currentDataType.getInterpretation(value, appId, itemId, field, dataType);
|
|
218
197
|
let data = interpr_arr.find((item) => item.id == interpretation_id) || interpr_arr.find((item) => item.id == 'default');
|
|
219
198
|
|
|
220
199
|
let result = await data.content()
|
|
@@ -38,7 +38,7 @@ export class Interpritate {
|
|
|
38
38
|
/*-- if we have data_type then we construct new data object to interpritate value*/
|
|
39
39
|
gudhub.ghconstructor.getInstance(data_type).then(function (data) {
|
|
40
40
|
var interpretationObj = self.getInterpretationObj(field, data.getTemplate().model, source, containerId);
|
|
41
|
-
data.
|
|
41
|
+
data.getInterpretation(value, interpretationObj.id, data_type, field, itemId, appId).then(function (result) {
|
|
42
42
|
// console.log(result, interpretationObj)
|
|
43
43
|
|
|
44
44
|
resolve(gudhub.mergeObjects(result, interpretationObj));
|
|
@@ -80,7 +80,7 @@ export class Interpritate {
|
|
|
80
80
|
resolve('');
|
|
81
81
|
}
|
|
82
82
|
this.gudhub.ghconstructor.getInstance(fieldModel.data_type).then(async (instance) => {
|
|
83
|
-
let interpretatedValue = await instance.
|
|
83
|
+
let interpretatedValue = await instance.getInterpretation(fieldValue, interpretationId, fieldModel.data_type, fieldModel, itemId, appId);
|
|
84
84
|
if(interpretatedValue.html == '<span>no interpretation</span>') {
|
|
85
85
|
resolve(fieldValue);
|
|
86
86
|
} else {
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -171,7 +171,7 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
|
|
|
171
171
|
},{"./filter/filterPreparation.js":"DvAj","./filter/filter.js":"mbGN","./json_to_items/json_to_items.js":"UCDv","./merge_compare_items/merge_compare_items.js":"xDLX","./filter/group.js":"VgUi","./filter/utils.js":"zsiC","./populate_items/populate_items.js":"EzAv","./get_date/get_date.js":"VzfS","./merge_objects/merge_objects.js":"EE1j","./merge_chunks/merge_chunks.js":"AMYJ","./interpretation/interpretation.js":"pMyP","./nested_list/nested_list.js":"S7Iy","./MergeFields/MergeFields.js":"vno1","./ItemsSelection/ItemsSelection.js":"DfIi","./compare_items_lists_worker/compare_items_lists.worker.js":"xR4c","./json_constructor/json_constructor.js":"nKaW"}],"rK64":[function(require,module,exports) {
|
|
172
172
|
"use strict";function e(e,t,r,n,u,a,s){try{var i=e[a](s),o=i.value}catch(c){return void r(c)}i.done?t(o):Promise.resolve(o).then(n,u)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(u,a){var s=t.apply(r,n);function i(t){e(s,u,a,i,o,"next",t)}function o(t){e(s,u,a,i,o,"throw",t)}i(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0;var a=function(){function e(t,n){r(this,e),this.req=t,this.storage=n}return u(e,[{key:"login",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.username,r=e.password;return this.req.simplePost({url:"/auth/login",form:{username:t,password:r}})}},{key:"logout",value:function(e){return this.req.post({url:"/auth/logout",form:{token:e}})}},{key:"signup",value:function(e){return this.req.simplePost({url:"/auth/singup",form:{user:JSON.stringify(e)}})}},{key:"getUsersList",value:function(e){return this.req.get({url:"/auth/userlist",params:{keyword:e}})}},{key:"updateUserApi",value:function(e){return this.req.post({url:"/auth/updateuser",form:{user:JSON.stringify(e)}})}},{key:"updateToken",value:function(e){return this.req.simplePost({url:"/auth/login",form:{auth_key:e}})}},{key:"avatarUploadApi",value:function(e){return this.req.post({url:"/auth/avatar-upload",form:{image:e}})}},{key:"getUserByIdApi",value:function(e){return this.req.get({url:"/auth/getuserbyid",params:{id:e}})}},{key:"getVersion",value:function(){return this.req.get({url:"/version"})}},{key:"getUserFromStorage",value:function(e){return this.storage.getUsersList().find(function(t){return t.user_id==e})}},{key:"saveUserToStorage",value:function(e){var t=this.storage.getUsersList(),r=t.find(function(t){return t.user_id==e.user_id});return r||(t.push(e),e)}},{key:"getUserById",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getUserFromStorage(t)){e.next=9;break}return e.next=4,this.getUserByIdApi(t);case 4:if(n=e.sent){e.next=7;break}return e.abrupt("return",null);case 7:(r=this.getUserFromStorage(t))||(this.saveUserToStorage(n),r=n);case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getToken",value:function(){var e=t(regeneratorRuntime.mark(function e(){var t,r,n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=new Date(this.storage.getUser().expirydate),r=new Date,n=this.storage.getUser().accesstoken,!(t<r)&&n){e.next=9;break}return e.next=6,this.updateToken(this.storage.getUser().auth_key);case 6:u=e.sent,this.storage.updateUser(u),n=u.accesstoken;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"updateUser",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateUserApi(t);case 2:return r=e.sent,this.storage.updateUser(r),e.abrupt("return",r);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAvatar",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.avatarUploadApi(t);case 2:return r=e.sent,this.storage.updateUser(r),e.abrupt("return",r);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}();exports.Auth=a;
|
|
173
173
|
},{}],"Htuh":[function(require,module,exports) {
|
|
174
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GHConstructor=void 0;var _axios=_interopRequireDefault(require("axios"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function asyncGeneratorStep(e,t,n,r,o,u,a){try{var c=e[u](a),i=c.value}catch(l){return void n(l)}c.done?t(i):Promise.resolve(i).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function a(e){asyncGeneratorStep(u,r,o,a,c,"next",e)}function c(e){asyncGeneratorStep(u,r,o,a,c,"throw",e)}a(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}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}},GHConstructor=function(){function GHConstructor(){_classCallCheck(this,GHConstructor),this.cache=[],this.modulesQueue={},this.angularInjector}return _createClass(GHConstructor,[{key:"getInstance",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.modulesQueue[t]){e.next=4;break}return e.abrupt("return",n.modulesQueue[t].then(function(){r(n.getCached(t))}));case 4:n.cache.find(function(e){return e.type===t})?r(n.getCached(t)):(n.modulesQueue[t]=n.createInstance(t),n.modulesQueue[t].then(function(){r(n.getCached(t))}));case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"pupToCache",value:function(e){this.cache.push(e)}},{key:"getCached",value:function(e){return this.cache.find(function(t){return t.type===e})}},{key:"initAngularInjector",value:function(e){this.angularInjector=e}},{key:"createInstance",value:function(){var _createInstance=_asyncToGenerator(regeneratorRuntime.mark(function
|
|
174
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GHConstructor=void 0;var _axios=_interopRequireDefault(require("axios"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function asyncGeneratorStep(e,t,n,r,o,u,a){try{var c=e[u](a),i=c.value}catch(l){return void n(l)}c.done?t(i):Promise.resolve(i).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function a(e){asyncGeneratorStep(u,r,o,a,c,"next",e)}function c(e){asyncGeneratorStep(u,r,o,a,c,"throw",e)}a(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}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}},GHConstructor=function(){function GHConstructor(){_classCallCheck(this,GHConstructor),this.cache=[],this.modulesQueue={},this.angularInjector}return _createClass(GHConstructor,[{key:"getInstance",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.modulesQueue[t]){e.next=4;break}return e.abrupt("return",n.modulesQueue[t].then(function(){r(n.getCached(t))}));case 4:n.cache.find(function(e){return e.type===t})?r(n.getCached(t)):(n.modulesQueue[t]=n.createInstance(t),n.modulesQueue[t].then(function(){r(n.getCached(t))}));case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"pupToCache",value:function(e){this.cache.push(e)}},{key:"getCached",value:function(e){return this.cache.find(function(t){return t.type===e})}},{key:"initAngularInjector",value:function(e){this.angularInjector=e}},{key:"createInstance",value:function(){var _createInstance=_asyncToGenerator(regeneratorRuntime.mark(function _callee6(module_id){var module_url,angularModule,module,result;return regeneratorRuntime.wrap(function _callee6$(_context6){for(;;)switch(_context6.prev=_context6.next){case 0:if(module_url=gudhub.storage.getModuleUrl(module_id),this.angularInjector.has(module_id)){_context6.next=4;break}return _context6.next=4,this.angularInjector.get("$ocLazyLoad").load(gudhub.storage.getModuleUrl(module_id));case 4:return _context6.next=6,this.angularInjector.get(module_id);case 6:return angularModule=_context6.sent,_context6.next=9,_axios.default.get(module_url);case 9:module=_context6.sent,module=module.data;try{eval(module)}catch(error){console.error("ERROR WHILE EVAL() IN GHCONSTRUCTOR",error)}return result={type:module_id,getTemplate:function(e,t,n,r,o,u){var a="false"!==n;return angularModule.getTemplate(e,t,a,r,o,u)},getDefaultValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(regeneratorRuntime.mark(function o(u){var a,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(a=angularModule.getDefaultValue)){o.next=8;break}return o.next=4,a(e,t,n,r);case 4:c=o.sent,u(c),o.next=9;break;case 8:u(null);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},getSettings:function(e,t,n){return angularModule.getSettings(e,t,n)},filter:{getSearchOptions:function(e){var t=angularModule;return t.filter&&t.filter.getSearchOptions?angularModule.filter.getSearchOptions(e):[]},getDropdownValues:function(){var e=angularModule;return e.filter&&e.filter.getDropdownValues?e.filter.getDropdownValues():[]}},getInterpretation:function(e,t,n,r,o,u){return new Promise(function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(c){var i,l,s,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return i=factoryReturns[module_id],a.prev=1,a.next=4,i.getInterpretation(e,u,o,r,n);case 4:return l=a.sent,s=l.find(function(e){return e.id==t})||l.find(function(e){return"default"==e.id}),a.next=8,s.content();case 8:f=a.sent,c({html:f}),a.next=16;break;case 12:a.prev=12,a.t0=a.catch(1),console.log("ERROR IN ".concat(module_id),a.t0),c({html:"<span>no interpretation</span>"});case 16:case"end":return a.stop()}},a,null,[[1,12]])}));return function(e){return a.apply(this,arguments)}}())},getInterpretatedValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(regeneratorRuntime.mark(function o(u){var a,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(a=factoryReturns[module_id].getInterpretatedValue)){o.next=8;break}return o.next=4,a(e,t,n,r);case 4:c=o.sent,u(c),o.next=9;break;case 8:u(e);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},extendController:function(e){angularModule.getActionScope(e)},runAction:function(e){try{angularModule.runAction(e)}catch(t){}},getWindowScope:function(e){return angularModule.getWindowScope(e)},getWindowHTML:function(e){return angularModule.getWindowHTML(e)}},this.pupToCache(result),_context6.abrupt("return",result);case 15:case"end":return _context6.stop()}},_callee6,this)}));function createInstance(e){return _createInstance.apply(this,arguments)}return createInstance}()}]),GHConstructor}();exports.GHConstructor=GHConstructor;
|
|
175
175
|
},{"axios":"O4Aa"}],"UV2u":[function(require,module,exports) {
|
|
176
176
|
"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=!["undefined"==typeof window?"undefined":e(window),"undefined"==typeof document?"undefined":e(document)].includes("undefined");exports.IS_WEB=o;
|
|
177
177
|
},{}],"q0my":[function(require,module,exports) {
|
|
@@ -187,7 +187,7 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
|
|
|
187
187
|
},{}],"K1Gs":[function(require,module,exports) {
|
|
188
188
|
"use strict";function e(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function n(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.DocumentManager=void 0;var r=function(){function n(t){e(this,n),this.req=t}return t(n,[{key:"createDocument",value:function(e){return this.req.post({url:"/api/new/document/insert-one",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}},{key:"getDocument",value:function(e){return this.req.post({url:"/api/new/document/find-one",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}},{key:"getDocuments",value:function(e){return this.req.post({url:"/api/new/document/find",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}},{key:"deleteDocument",value:function(e){return this.req.post({url:"/api/new/document/remove-one",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{document:JSON.stringify(e)}})}}]),n}();exports.DocumentManager=r;
|
|
189
189
|
},{}],"X4Dt":[function(require,module,exports) {
|
|
190
|
-
"use strict";function t(t,e,n,r,a,u,o){try{var i=t[u](o),c=i.value}catch(s){return void n(s)}i.done?e(c):Promise.resolve(c).then(r,a)}function e(e){return function(){var n=this,r=arguments;return new Promise(function(a,u){var o=e.apply(n,r);function i(e){t(o,a,u,i,c,"next",e)}function c(e){t(o,a,u,i,c,"throw",e)}i(void 0)})}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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,r.key,r)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Interpritate=void 0;var u=function(){function t(e){n(this,t),this.gudhub=e}return a(t,[{key:"getInterpretationObj",value:function(t,e,n,r){var a={},u=e.data_model.interpretation.find(function(t){return t.src==n})||e.data_model.interpretation.find(function(t){return"table"==t.src})||{id:"default"};return t.data_model&&t.data_model.interpretation&&(a=t.data_model.interpretation.find(function(t){return t.src==r})||t.data_model.interpretation.find(function(t){return t.src==n})),gudhub.mergeObjects(u,a)}},{key:"getInterpretation",value:function(t,n,r,a,u,o,i){var c=this,s=this;return new Promise(function(){var f=e(regeneratorRuntime.mark(function e(f,p){var d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(d=n&&n.data_type?n.data_type:r)?gudhub.ghconstructor.getInstance(d).then(function(e){var r=s.getInterpretationObj(n,e.getTemplate().model,a,i);e.
|
|
190
|
+
"use strict";function t(t,e,n,r,a,u,o){try{var i=t[u](o),c=i.value}catch(s){return void n(s)}i.done?e(c):Promise.resolve(c).then(r,a)}function e(e){return function(){var n=this,r=arguments;return new Promise(function(a,u){var o=e.apply(n,r);function i(e){t(o,a,u,i,c,"next",e)}function c(e){t(o,a,u,i,c,"throw",e)}i(void 0)})}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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,r.key,r)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Interpritate=void 0;var u=function(){function t(e){n(this,t),this.gudhub=e}return a(t,[{key:"getInterpretationObj",value:function(t,e,n,r){var a={},u=e.data_model.interpretation.find(function(t){return t.src==n})||e.data_model.interpretation.find(function(t){return"table"==t.src})||{id:"default"};return t.data_model&&t.data_model.interpretation&&(a=t.data_model.interpretation.find(function(t){return t.src==r})||t.data_model.interpretation.find(function(t){return t.src==n})),gudhub.mergeObjects(u,a)}},{key:"getInterpretation",value:function(t,n,r,a,u,o,i){var c=this,s=this;return new Promise(function(){var f=e(regeneratorRuntime.mark(function e(f,p){var d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(d=n&&n.data_type?n.data_type:r)?gudhub.ghconstructor.getInstance(d).then(function(e){var r=s.getInterpretationObj(n,e.getTemplate().model,a,i);e.getInterpretation(t,r.id,d,n,u,o).then(function(t){f(gudhub.mergeObjects(t,r))},function(t){p()})},function(t){}):f(c.getDefaultInterpretation(t,n));case 2:case"end":return e.stop()}},e)}));return function(t,e){return f.apply(this,arguments)}}())}},{key:"getDefaultInterpretation",value:function(t,e){var n=t;return e&&e.forEach(function(e){e.value==t&&""!=t&&(n=e.name)}),n}},{key:"getInterpretationById",value:function(t,n,r,a){var u=this;return new Promise(function(){var o=e(regeneratorRuntime.mark(function o(i){var c,s;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,u.gudhub.getFieldValue(t,n,r);case 2:return c=o.sent,o.next=5,u.gudhub.getField(t,r);case 5:null==(s=o.sent)&&i(""),u.gudhub.ghconstructor.getInstance(s.data_type).then(function(){var r=e(regeneratorRuntime.mark(function e(r){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getInterpretation(c,a,s.data_type,s,n,t);case 2:"<span>no interpretation</span>"==(u=e.sent).html?i(c):i(u.html);case 4:case"end":return e.stop()}},e)}));return function(t){return r.apply(this,arguments)}}());case 8:case"end":return o.stop()}},o)}));return function(t){return o.apply(this,arguments)}}())}}]),t}();exports.Interpritate=u;
|
|
191
191
|
},{}],"U9gy":[function(require,module,exports) {
|
|
192
192
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHub=void 0;var e=require("./gudhub-https-service.js"),t=require("./PipeService/PipeService.js"),r=require("./Storage/Storage.js"),i=require("./WebSocket/WebSocket.js"),n=require("./config.js"),s=require("./Utils/Utils.js"),o=require("./Auth/Auth.js"),u=require("./GHConstructor/ghconstructor.js"),a=require("./AppProcessor/AppProcessor.js"),l=require("./ItemProcessor/ItemProcessor.js"),c=require("./FieldProcessor/FieldProcessor.js"),p=require("./FileManager/FileManager.js"),d=require("./ChunksManager/ChunksManager.js"),h=require("./DocumentManager/DocumentManager.js"),f=require("./GHConstructor/interpritate.js"),g=require("./consts.js");function v(e,t,r,i,n,s,o){try{var u=e[s](o),a=u.value}catch(l){return void r(l)}u.done?t(a):Promise.resolve(a).then(i,n)}function k(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var s=e.apply(t,r);function o(e){v(s,i,n,o,u,"next",e)}function u(e){v(s,i,n,o,u,"throw",e)}o(void 0)})}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function w(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var b=function(){function v(g){var k=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{server_url:n.server_url,wss_url:n.wss_url,initWebsocket:!1,activateSW:!1,swLink:"",async_modules_path:"",file_server_url:""};m(this,v),this.ghconstructor=new u.GHConstructor,this.interpritate=new f.Interpritate(this),this.pipeService=new t.PipeService,this.storage=new r.Storage(k.async_modules_path,k.file_server_url),this.util=new s.Utils(this),this.req=new e.GudHubHttpsService(k.server_url),this.auth=new o.Auth(this.req,this.storage),g&&this.storage.setUser({auth_key:g}),this.req.init(this.auth.getToken.bind(this.auth)),this.ws=new i.WebSocketApi(k.wss_url,this.auth),this.chunksManager=new d.ChunksManager(this.storage,this.pipeService,this.req,this.util),this.appProcessor=new a.AppProcessor(this.storage,this.pipeService,this.req,this.ws,this.chunksManager,this.util,k.activateSW),this.itemProcessor=new l.ItemProcessor(this.storage,this.pipeService,this.req,this.appProcessor,this.util),this.fieldProcessor=new c.FieldProcessor(this.storage,this.req,this.appProcessor,this.itemProcessor,this.pipeService),this.fileManager=new p.FileManager(this.storage,this.pipeService,this.req,this.appProcessor),this.documentManager=new h.DocumentManager(this.req),k.initWebsocket&&this.ws.initWebSocket(this.websocketHandler.bind(this),this.appProcessor.refreshApps.bind(this.appProcessor)),k.activateSW&&this.activateSW(k.swLink)}return w(v,[{key:"activateSW",value:function(){var e=k(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(g.IS_WEB&&"serviceWorker"in window.navigator)){e.next=14;break}return e.prev=1,e.next=4,window.navigator.serviceWorker.register(t);case 4:(r=e.sent).update().then(function(){return console.log("%cSW ->>> Service worker successful updated","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;")}).catch(function(){return console.warn("SW ->>> Service worker is not updated")}),console.log("%cSW ->>> Service worker is registered","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",r),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.warn("%cSW ->>> Service worker is not registered","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",e.t0);case 12:e.next=15;break;case 14:console.log("%cSW ->>> ServiceWorkers not supported","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;");case 15:case"end":return e.stop()}},e,null,[[1,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"on",value:function(e,t,r){return this.pipeService.on(e,t,r),this}},{key:"emit",value:function(e,t,r,i){return this.pipeService.emit(e,t,r,i),this}},{key:"destroy",value:function(e,t,r){return this.pipeService.destroy(e,t,r),this}},{key:"prefilter",value:function(e,t,r,i,n){return this.util.prefilter(e,t,r,i,n)}},{key:"initAngularInjector",value:function(e){return this.ghconstructor.initAngularInjector(e)}},{key:"getInterpretation",value:function(e,t,r,i,n,s,o){return this.interpritate.getInterpretation(e,t,r,i,n,s,o)}},{key:"getInterpretationById",value:function(e,t,r,i){return this.interpritate.getInterpretationById(e,t,r,i)}},{key:"filter",value:function(e,t){return this.util.filter(e,t)}},{key:"group",value:function(e,t){return this.util.group(e,t)}},{key:"getFilteredItems",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.util.getFilteredItems(e,t,r.element_app_id,r.app_id,r.item_id,r.field_group,r.search,r.search_params)}},{key:"jsonToItems",value:function(e,t){return this.util.jsonToItems(e,t)}},{key:"getDate",value:function(e){return this.util.getDate(e)}},{key:"populateWithDate",value:function(e,t){return this.util.populateWithDate(e,t)}},{key:"checkRecurringDate",value:function(e,t){return this.util.checkRecurringDate(e,t)}},{key:"populateItems",value:function(e,t,r){return this.util.populateItems(e,t,r)}},{key:"populateWithItemRef",value:function(e,t,r,i,n,s){return this.util.populateWithItemRef(e,t,r,i,n,s)}},{key:"compareItems",value:function(e,t,r){return this.util.compareItems(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return this.util.mergeItems(e,t,r)}},{key:"mergeObjects",value:function(e,t){return this.util.mergeObjects(e,t)}},{key:"makeNestedList",value:function(e,t,r,i,n){return this.util.makeNestedList(e,t,r,i,n)}},{key:"jsonConstructor",value:function(e,t,r){return this.util.jsonConstructor(e,t,r)}},{key:"getAppsList",value:function(){return this.appProcessor.getAppsList()}},{key:"getAppInfo",value:function(e){return this.appProcessor.getAppInfo(e)}},{key:"deleteApp",value:function(e){return this.appProcessor.deleteApp(e)}},{key:"getApp",value:function(e){return this.appProcessor.getApp(e)}},{key:"updateApp",value:function(e){return this.appProcessor.updateApp(e)}},{key:"updateAppInfo",value:function(e){return this.appProcessor.updateAppInfo(e)}},{key:"createNewApp",value:function(e){return this.appProcessor.createNewApp(e)}},{key:"getItems",value:function(e){return this.itemProcessor.getItems(e)}},{key:"getItem",value:function(){var e=k(regeneratorRuntime.mark(function e(t,r){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getItems(t);case 2:if(!(i=e.sent)){e.next=5;break}return e.abrupt("return",i.find(function(e){return e.item_id==r}));case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(e,t){return this.itemProcessor.addNewItems(e,t)}},{key:"updateItems",value:function(e,t){return this.itemProcessor.updateItems(e,t)}},{key:"deleteItems",value:function(e,t){return this.itemProcessor.deleteItems(e,t)}},{key:"getField",value:function(e,t){return this.fieldProcessor.getField(e,t)}},{key:"getFieldModels",value:function(e){return this.fieldProcessor.getFieldModels(e)}},{key:"updateField",value:function(e,t){return this.fieldProcessor.updateField(e,t)}},{key:"deleteField",value:function(e,t){return this.fieldProcessor.deleteField(e,t)}},{key:"getFieldValue",value:function(e,t,r){return this.fieldProcessor.getFieldValue(e,t,r)}},{key:"getInterpretedValue",value:function(e,t,r){return this.util.getInterpretedValue(e,t,r)}},{key:"setFieldValue",value:function(e,t,r,i){return this.fieldProcessor.setFieldValue(e,t,r,i)}},{key:"getFile",value:function(e,t){return this.fileManager.getFile(e,t)}},{key:"getFiles",value:function(e,t){return this.fileManager.getFiles(e,t)}},{key:"uploadFile",value:function(e,t,r){return this.fileManager.uploadFile(e,t,r)}},{key:"uploadFileFromString",value:function(e,t,r,i,n,s,o){return this.fileManager.uploadFileFromString(e,t,r,i,n,s,o)}},{key:"updateFileFromString",value:function(e,t,r,i,n){return this.fileManager.updateFileFromString(e,t,r,i,n)}},{key:"deleteFile",value:function(e,t){return this.fileManager.deleteFile(e,t)}},{key:"duplicateFile",value:function(e){return this.fileManager.duplicateFile(e)}},{key:"downloadFileFromString",value:function(e,t){return this.fileManager.downloadFileFromString(e,t)}},{key:"createDocument",value:function(e){return this.documentManager.createDocument(e)}},{key:"getDocument",value:function(e){return this.documentManager.getDocument(e)}},{key:"getDocuments",value:function(e){return this.documentManager.getDocuments(e)}},{key:"deleteDocument",value:function(e){return this.documentManager.deleteDocument(e)}},{key:"login",value:function(e){return this.auth.login(e)}},{key:"logout",value:function(e){return this.appProcessor.clearAppProcessor(),this.auth.logout(e)}},{key:"signup",value:function(e){return this.auth.signup(e)}},{key:"getUsersList",value:function(e){return this.auth.getUsersList(e)}},{key:"updateToken",value:function(e){return this.auth.updateToken(e)}},{key:"avatarUploadApi",value:function(e){return this.auth.avatarUploadApi(e)}},{key:"getVersion",value:function(){return this.auth.getVersion()}},{key:"getUserById",value:function(e){return this.auth.getUserById(e)}},{key:"getToken",value:function(){return this.auth.getToken()}},{key:"updateUser",value:function(e){return this.auth.updateUser(e)}},{key:"updateAvatar",value:function(e){return this.auth.updateAvatar(e)}},{key:"websocketHandler",value:function(e){switch(e.api){case"/items/update":console.log("/items/update - ",e),this.itemProcessor.updateItemsInStorage(e.app_id,e.response);break;case"/items/add":console.log("/items/add - ",e),this.itemProcessor.addItemsToStorage(e.app_id,e.response);break;case"/items/delete":console.log("/items/delete - ",e),this.itemProcessor.deleteItemsFromStorage(e.app_id,e.response);break;case"/app/update":console.log("/app/update - ",e),this.appProcessor.updatingAppInStorage(e.response);break;case"/file/delete":console.log("file/delete - ",e),this.fileManager.deleteFileFromStorage(e.response.file_id,e.app_id);break;case"/file/upload":console.log("file/upload - ",e),this.fileManager.addFileToStorage(e.app_id,e.response);break;case"/file/formupload":console.log("file/formupload - ",e);break;case"/file/update":this.fileManager.updateFileInStorage(e.response.file_id,e.response.app_id,e.response),console.log("file/update - ",e);break;case"/new/file/duplicate":this.fileManager.addFilesToStorage(e.app_id,e.response),console.log("new/file/duplicate - ",e);break;default:console.warn("WEBSOCKETS is not process this API:",e.api)}}}]),v}();exports.GudHub=b;
|
|
193
193
|
},{"./gudhub-https-service.js":"hDvy","./PipeService/PipeService.js":"E3xI","./Storage/Storage.js":"CSHe","./WebSocket/WebSocket.js":"pHMV","./config.js":"TPH7","./Utils/Utils.js":"mWlG","./Auth/Auth.js":"rK64","./GHConstructor/ghconstructor.js":"Htuh","./AppProcessor/AppProcessor.js":"q0my","./ItemProcessor/ItemProcessor.js":"UUd3","./FieldProcessor/FieldProcessor.js":"PoPF","./FileManager/FileManager.js":"XUT2","./ChunksManager/ChunksManager.js":"KHGc","./DocumentManager/DocumentManager.js":"K1Gs","./GHConstructor/interpritate.js":"X4Dt","./consts.js":"UV2u"}],"iRRN":[function(require,module,exports) {
|