@gudhub/core 1.1.34 → 1.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GUDHUB/AppProcessor/AppProcessor.js +6 -2
- package/GUDHUB/PipeService/PipeService.test.js +24 -0
- package/GUDHUB/Storage/ModulesList.js +2 -9
- package/GUDHUB/Utils/Utils.js +5 -0
- package/GUDHUB/Utils/compareObjects/compareObjects.js +3 -0
- package/GUDHUB/Utils/compareObjects/compareObjects.test.js +19 -0
- package/package.json +1 -1
- package/umd/library.min.js +6 -4
- package/umd/library.min.js.map +1 -1
|
@@ -298,8 +298,12 @@ export class AppProcessor {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
async updateAppInfo(appInfo = {}) {
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
this.pipeService.emit(
|
|
302
|
+
"gh_app_info_update",
|
|
303
|
+
{ app_id: appInfo.app_id },
|
|
304
|
+
appInfo
|
|
305
|
+
);
|
|
306
|
+
return this.updateApp(appInfo);
|
|
303
307
|
}
|
|
304
308
|
|
|
305
309
|
async createNewApp(app) {
|
|
@@ -74,4 +74,28 @@ describe("PipeService", () => {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
it("add new subscriber and delete it", () => {
|
|
78
|
+
const address = {
|
|
79
|
+
app_id: 16259,
|
|
80
|
+
item_id: 1064673
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let valuePipeFn = async function valuePipeFn(event, item) {
|
|
84
|
+
let result = await new Promise(resolve => {
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
resolve(true);
|
|
87
|
+
}, 2000);
|
|
88
|
+
});
|
|
89
|
+
return result;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
gudhub.on("gh_item_update", address, valuePipeFn);
|
|
93
|
+
|
|
94
|
+
gudhub.destroy("gh_item_update", address, valuePipeFn);
|
|
95
|
+
|
|
96
|
+
const iterator = gudhub.pipeService.subscribers['gh_item_update:16259.1064673'].entries();
|
|
97
|
+
|
|
98
|
+
iterator.next().done.should.equal(true);
|
|
99
|
+
|
|
100
|
+
});
|
|
77
101
|
});
|
|
@@ -625,13 +625,6 @@ export default function generateModulesList(async_modules_path, file_server_url,
|
|
|
625
625
|
type: 'gh_element',
|
|
626
626
|
technology: 'class'
|
|
627
627
|
},
|
|
628
|
-
{
|
|
629
|
-
name: 'fullcalendar',
|
|
630
|
-
js: 'https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js',
|
|
631
|
-
css: 'https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css',
|
|
632
|
-
type: 'gh_element',
|
|
633
|
-
technology: 'class'
|
|
634
|
-
},
|
|
635
628
|
{
|
|
636
629
|
name: "countertop_smart_quote",
|
|
637
630
|
url: file_server_url + '/' + async_modules_path + "countertop_smart_quote_data.js",
|
|
@@ -672,7 +665,7 @@ export default function generateModulesList(async_modules_path, file_server_url,
|
|
|
672
665
|
type: 'automation'
|
|
673
666
|
},
|
|
674
667
|
{
|
|
675
|
-
name: '
|
|
668
|
+
name: 'CreateItemsApi',
|
|
676
669
|
url: file_server_url + '/' + automation_modules_path + 'create_item_api.js',
|
|
677
670
|
type: 'automation'
|
|
678
671
|
},
|
|
@@ -707,7 +700,7 @@ export default function generateModulesList(async_modules_path, file_server_url,
|
|
|
707
700
|
type: 'automation'
|
|
708
701
|
},
|
|
709
702
|
{
|
|
710
|
-
name: '
|
|
703
|
+
name: 'IfCondition',
|
|
711
704
|
url: file_server_url + '/' + automation_modules_path + 'if_condition.js',
|
|
712
705
|
type: 'automation'
|
|
713
706
|
},
|
package/GUDHUB/Utils/Utils.js
CHANGED
|
@@ -20,6 +20,7 @@ import { compare_items_lists_Worker } from "./compare_items_lists_worker/compare
|
|
|
20
20
|
import { compiler } from "./json_constructor/json_constructor.js";
|
|
21
21
|
import AppsTemplateService from "./AppsTemplateService/AppsTemplateService.js";
|
|
22
22
|
import { FileHelper } from "./FIleHelper/FileHelper.js";
|
|
23
|
+
import { compareObjects } from "./compareObjects/compareObjects.js";
|
|
23
24
|
|
|
24
25
|
export class Utils {
|
|
25
26
|
constructor(gudhub) {
|
|
@@ -189,6 +190,10 @@ export class Utils {
|
|
|
189
190
|
createItems(create_apps, maxNumberOfInsstalledItems) {
|
|
190
191
|
return this.AppsTemplateService.createItems(create_apps, maxNumberOfInsstalledItems);
|
|
191
192
|
}
|
|
193
|
+
|
|
194
|
+
compareObjects(obj1, obj2) {
|
|
195
|
+
return compareObjects(obj1, obj2);
|
|
196
|
+
}
|
|
192
197
|
|
|
193
198
|
compareAppsItemsLists(items_list1, items_list2, callback) {
|
|
194
199
|
const chunkWorkerBlob = new Blob([compare_items_lists_Worker()], {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {GudHub} from '../../gudhub.js';
|
|
2
|
+
|
|
3
|
+
describe("COMPARE OBJECTS", async function() {
|
|
4
|
+
const gudhub = new GudHub();
|
|
5
|
+
|
|
6
|
+
it("COMPARE EQUALS OBJECTS", async function () {
|
|
7
|
+
let result = gudhub.util.compareObjects(obj1, obj1)
|
|
8
|
+
result.should.equals(true);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("COMPARE DIFFERENT OBJECTS", async function () {
|
|
12
|
+
let result = gudhub.util.compareObjects(obj1, obj2)
|
|
13
|
+
result.should.equals(false);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
let obj1 = { a: 1, b: 2, c: 3, d: {e: 4, f: {g: 5,}} };
|
|
19
|
+
let obj2 = { a: 1, b: 2, c: {d: 3, e: {f: 4, g: 5}} };
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -104,7 +104,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
|
|
|
104
104
|
},{}],"E3xI":[function(require,module,exports) {
|
|
105
105
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PipeService=void 0;var e=require("./utils.js");function r(e){return i(e)||n(e)||s(e)||t()}function t(){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 s(e,r){if(e){if("string"==typeof e)return o(e,r);var t=Object.prototype.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)?o(e,r):void 0}}function n(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return o(e)}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,s=new Array(r);t<r;t++)s[t]=e[t];return s}function a(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){for(var t=0;t<r.length;t++){var s=r[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function c(e,r,t){return r&&u(e.prototype,r),t&&u(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var l=function(){function t(){a(this,t),this.subscribers={},this.messageBox={}}return c(t,[{key:"on",value:function(r,t,s){var n=this;return(0,e.checkParams)(r,t,s)&&r.split(" ").map(function(r){return r+":"+(0,e.createId)(t)}).forEach(function(e){n.subscribers[e]||(n.subscribers[e]=new Set),n.subscribers[e].add(s),n.checkMessageBox(e)}),this}},{key:"emit",value:function(r,t,s,n){var i=this;return r.split(" ").forEach(function(o){var a=o+":"+(0,e.createId)(t);if(i.subscribers[a]){if(0==i.subscribers[a].size)return i.messageBox[a]=[r,t,s,n,!1],i;i.subscribers[a].forEach(function(e){e(null,s,n)})}else i.messageBox[a]=[r,t,s,n,!1]}),this}},{key:"onRoot",value:function(e,r,t){return this.on(e,r,t)}},{key:"destroy",value:function(r,t,s){var n=this;return r.split(" ").forEach(function(r){var i=r+":"+(0,e.createId)(t);n.subscribers[i]&&s&&n.subscribers[i].delete(s),n.subscribers[i]&&!s&&delete n.subscribers[i]}),this}},{key:"checkMessageBox",value:function(e){var t=this;this.cleanMesssageBox(),this.messageBox[e]&&setTimeout(function(){t.messageBox[e]&&(t.emit.apply(t,r(t.messageBox[e])),t.messageBox[e][4]=!0)},0)}},{key:"cleanMesssageBox",value:function(){for(var e in this.messageBox)this.messageBox[e][4]&&delete this.messageBox[e]}}]),t}();exports.PipeService=l;
|
|
106
106
|
},{"./utils.js":"Lc8J"}],"FJWL":[function(require,module,exports) {
|
|
107
|
-
"use strict";function e(e,t,a){return[{name:"text",url:t+"/"+e+"text_data.js",type:"gh_element",technology:"angular"},{name:"text_opt",url:t+"/"+e+"text_options_data.js",type:"gh_element",technology:"angular"},{name:"number",url:t+"/"+e+"number_data.js",type:"gh_element",technology:"angular"},{name:"task_board",url:t+"/"+e+"task_board_data.js",type:"gh_element",technology:"angular"},{name:"visualizer",url:t+"/"+e+"visualizer_data.js",type:"gh_element",technology:"angular"},{name:"enterprice_visualizer",url:t+"/"+e+"enterprice_visualizer_data.js",type:"gh_element",technology:"angular"},{name:"email",url:t+"/"+e+"email_data.js",type:"gh_element",technology:"angular"},{name:"date",url:t+"/"+e+"date_data.js",type:"gh_element",technology:"angular"},{name:"radio_button",url:t+"/"+e+"radio_button_data.js",type:"gh_element",technology:"angular"},{name:"radio_icon",url:t+"/"+e+"radio_icon_data.js",type:"gh_element",technology:"angular"},{name:"twilio_phone",url:t+"/"+e+"twilio_phone_data.js",type:"gh_element",technology:"angular"},{name:"twilio_autodialer",url:t+"/"+e+"twillio_autodialer_data.js",type:"gh_element",technology:"angular"},{name:"color",url:t+"/"+e+"color_data.js",type:"gh_element",technology:"angular"},{name:"charts",url:t+"/"+e+"charts_data.js",type:"gh_element",technology:"angular"},{name:"funnel_chart",url:t+"/"+e+"funnel_chart_data.js",type:"gh_element",technology:"angular"},{name:"add_items_from_template",url:t+"/"+e+"add_items_from_template_data.js",type:"gh_element",technology:"angular"},{name:"item_ref",url:t+"/"+e+"itemRef_data.js",type:"gh_element",technology:"angular"},{name:"calendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"gh_element",technology:"class"},{name:"data_ref",url:t+"/"+e+"data_ref_data.js",type:"gh_element",technology:"angular"},{name:"table",url:t+"/"+e+"table_data.js",type:"gh_element",technology:"angular"},{name:"tile",url:t+"/"+e+"tile_data.js",type:"gh_element",technology:"angular"},{name:"file",url:t+"/"+e+"file_data.js",type:"gh_element",technology:"angular"},{name:"image",url:t+"/"+e+"image_data.js",type:"gh_element",technology:"angular"},{name:"text_editor",url:t+"/"+e+"text_editor_data.js",type:"gh_element",technology:"angular"},{name:"tinymse",url:t+"/"+e+"tinymse_data.js",type:"gh_element",technology:"angular"},{name:"duration",url:t+"/"+e+"duration_data.js",type:"gh_element",technology:"angular"},{name:"user",url:t+"/"+e+"user_data.js",type:"gh_element",technology:"angular"},{name:"app",url:t+"/"+e+"application_data.js",type:"gh_element",technology:"angular"},{name:"field",url:t+"/"+e+"field_data.js",type:"gh_element",technology:"angular"},{name:"available",url:t+"/"+e+"available_data.js",type:"gh_element",technology:"angular"},{name:"view_list",url:t+"/"+e+"view_list_data.js",type:"gh_element",technology:"angular"},{name:"calculator",url:t+"/"+e+"calculator_data.js",type:"gh_element",technology:"angular"},{name:"string_join",url:t+"/"+e+"string_joiner_data.js",type:"gh_element",technology:"angular"},{name:"signature",url:t+"/"+e+"signature_data.js",type:"gh_element",technology:"angular"},{name:"sendEmail",url:t+"/"+e+"send_email_data.js",type:"gh_element",technology:"angular"},{name:"boolean",url:t+"/"+e+"boolean_data.js",type:"gh_element",technology:"angular"},{name:"product_gallery",url:t+"/"+e+"product_gallery_data.js",type:"gh_element",technology:"angular"},{name:"online_inventory",url:t+"/"+e+"online_inventory_data.js",type:"gh_element",technology:"angular"},{name:"3d_edges",url:t+"/"+e+"3d_edges_data.js",type:"gh_element",technology:"angular"},{name:"color_list",url:t+"/"+e+"color_list_data.js",type:"gh_element",technology:"angular"},{name:"go_to_link",url:t+"/"+e+"go_to_link_data.js",type:"gh_element",technology:"angular"},{name:"go_to_view",url:t+"/"+e+"go_to_view_data.js",type:"gh_element",technology:"angular"},{name:"range",url:t+"/"+e+"range_data.js",type:"gh_element",technology:"angular"},{name:"barcode",url:t+"/"+e+"barcode_data.js",type:"gh_element",technology:"angular"},{name:"item_remote_add",url:t+"/"+e+"item_remote_add_data.js",type:"gh_element",technology:"angular"},{name:"item_remote_update",url:t+"/"+e+"item_remote_update_data.js",type:"gh_element",technology:"angular"},{name:"timeline",url:t+"/"+e+"timeline_data.js",type:"gh_element",technology:"angular"},{name:"delete_item",url:t+"/"+e+"delete_action.js",type:"gh_element",technology:"angular"},{name:"print_doc",url:t+"/"+e+"print_doc_action.js",type:"gh_element",technology:"angular"},{name:"open_item",url:t+"/"+e+"open_item_action.js",type:"gh_element",technology:"angular"},{name:"edit_template",url:t+"/"+e+"edit_template_action.js",type:"gh_element",technology:"angular"},{name:"open_app",url:t+"/"+e+"open_app_action.js",type:"gh_element",technology:"angular"},{name:"user_settings",url:t+"/"+e+"user_settings_action.js",type:"gh_element",technology:"angular"},{name:"app_sharing",url:t+"/"+e+"sharing_action.js",type:"gh_element",technology:"angular"},{name:"app_constructor",url:t+"/"+e+"app_constructor_action.js",type:"gh_element",technology:"angular"},{name:"export_csv",url:t+"/"+e+"export_csv.js",type:"gh_element",technology:"angular"},{name:"import_csv",url:t+"/"+e+"import_csv.js",type:"gh_element",technology:"angular"},{name:"add_items",url:t+"/"+e+"add_items_action.js",type:"gh_element",technology:"angular"},{name:"update_items",url:t+"/"+e+"update_items_action.js",type:"gh_element",technology:"angular"},{name:"install_app",url:t+"/"+e+"install_app_action.js",type:"gh_element",technology:"angular"},{name:"search_action",url:t+"/"+e+"search_action.js",type:"gh_element",technology:"angular"},{name:"filter_table",url:t+"/"+e+"filter_table_action.js",type:"gh_element",technology:"angular"},{name:"slider",url:t+"/"+e+"slider_data.js",type:"gh_element",technology:"angular"},{name:"clone_item",url:t+"/"+e+"clone_item_action.js",type:"gh_element",technology:"angular"},{name:"close",url:t+"/"+e+"close_action.js",type:"gh_element",technology:"angular"},{name:"phone",url:t+"/"+e+"phone_data.js",type:"gh_element",technology:"angular"},{name:"link",url:t+"/"+e+"link_data.js",type:"gh_element",technology:"angular"},{name:"sheduling",url:t+"/"+e+"sheduling_data.js",type:"gh_element",technology:"angular"},{name:"qrcode",url:t+"/"+e+"qrcode_data.js",type:"gh_element",technology:"angular"},{name:"graph2d",url:t+"/"+e+"graph2d_data.js",type:"gh_element",technology:"angular"},{name:"quote_tool",url:t+"/"+e+"quote_tool_data.js",type:"gh_element",technology:"angular"},{name:"cards",url:t+"/"+e+"cards_data.js",type:"gh_element",technology:"angular"},{name:"jsonConstructor",url:t+"/"+e+"json_constructor_data.js",type:"gh_element",technology:"angular"},{name:"button",js:"https://gudhub.com/modules/button_action/button_action.js",type:"gh_element",technology:"class"},{name:"editorjs",js:"https://gudhub.com/modules/Editor-Js/dist/main.js",css:"https://gudhub.com/modules/Editor-Js/dist/style.css",type:"gh_element",technology:"class"},{name:"filter_advanced",url:t+"/"+e+"filter_advanced_data.js",type:"gh_element",technology:"angular"},{name:"code_editor",url:t+"/"+e+"code_editor_data.js",type:"gh_element",technology:"angular"},{name:"icon",url:t+"/"+e+"icon_data.js",type:"gh_element",technology:"angular"},{name:"quoteRequest",url:t+"/"+e+"quote_request_data.js",type:"gh_element",technology:"angular"},{name:"view_container",url:t+"/"+e+"view_container_data.js",type:"gh_element",technology:"angular"},{name:"element_ref",url:t+"/"+e+"element_ref_data.js",type:"gh_element",technology:"angular"},{name:"quote_tool_objects_renderer",url:t+"/"+e+"quote_tool_objects_renderer_data.js",type:"gh_element",technology:"angular"},{name:"quote_tool_objects_renderer_generator",url:t+"/"+e+"quote_tool_objects_renderer_generator_data.js",type:"gh_element",technology:"angular"},{name:"trigger",url:t+"/"+e+"trigger_data.js",type:"gh_element",technology:"angular"},{name:"voting",url:t+"/"+e+"voting_data.js",type:"gh_element",technology:"angular"},{name:"view_tabs",url:t+"/"+e+"view_tabs.js",type:"gh_element",technology:"angular"},{name:"filter_tabs",url:t+"/"+e+"filter_tabs.js",type:"gh_element",technology:"angular"},{name:"gps_coords",url:t+"/"+e+"gps_coords.js",type:"gh_element",technology:"angular"},{name:"google_map",url:t+"/"+e+"google_map_data.js",type:"gh_element",technology:"angular"},{name:"data_migrations",url:t+"/"+e+"data_migrations.js",type:"gh_element",technology:"angular"},{name:"additional_settings",url:t+"/"+e+"gh_additional_settings_data.js",type:"gh_element",technology:"angular"},{name:"send_request",url:t+"/"+e+"send_request_data.js",type:"gh_element",technology:"angular"},{name:"webcam",url:t+"/"+e+"webcam_data.js",type:"gh_element",technology:"angular"},{name:"json_viewer",url:t+"/"+e+"json_viewer_data.js",type:"gh_element",technology:"angular"},{name:"notifications",url:t+"/"+e+"notifications_data.js",type:"gh_element",technology:"angular"},{name:"api",url:t+"/"+e+"api_data.js",type:"gh_element",technology:"angular"},{name:"smart_input",url:t+"/"+e+"smart_input_data.js",type:"gh_element",technology:"angular"},{name:"json_editor",url:t+"/"+e+"json_editor_data.js",type:"gh_element",technology:"angular"},{name:"grapes_html_editor",url:t+"/"+e+"grapes_html_editor_data.js",type:"gh_element",technology:"angular"},{name:"quiz",url:t+"/"+e+"quiz_data.js",type:"gh_element",technology:"angular"},{name:"markdown_viewer",url:t+"/"+e+"markdown_viewer_data.js",type:"gh_element",technology:"angular"},{name:"password_input",url:t+"/"+e+"password_input_data.js",type:"gh_element",technology:"angular"},{name:"vs_code",url:t+"/"+e+"vs_code_data.js",type:"gh_element",technology:"angular"},{name:"nested_list",js:"https://gudhub.com/modules/Nested-List/dist/main.js",css:"https://gudhub.com/modules/Nested-List/dist/style.css",type:"gh_element",technology:"class"},{name:"fullcalendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"gh_element",technology:"class"},{name:"countertop_smart_quote",url:t+"/"+e+"countertop_smart_quote_data.js",type:"gh_element",technology:"angular"},{name:"markdown_viewer_web_component",js:"https://gudhub.com/modules/markdown-it-gh-element/dist/main.js",css:"https://gudhub.com/modules/markdown-it-gh-element/dist/style.css",type:"gh_element",technology:"class"},{name:"API",url:t+"/"+a+"api_node.js",type:"automation"},{name:"Calculator",url:t+"/"+a+"calculator.js",type:"automation"},{name:"CompareItems",url:t+"/"+a+"compare_items.js",type:"automation"},{name:"Constants",url:t+"/"+a+"constants.js",type:"automation"},{name:"CreateFiles",url:t+"/"+a+"create_files.js",type:"automation"},{name:"CreateItemApi",url:t+"/"+a+"create_item_api.js",type:"automation"},{name:"FaceDetector",url:t+"/"+a+"face_detector.js",type:"automation"},{name:"FileDuplicate",url:t+"/"+a+"file_duplicate.js",type:"automation"},{name:"Filter",url:t+"/"+a+"filter_node.js",type:"automation"},{name:"GetItemByItemRef",url:t+"/"+a+"get_item_by_item_ref.js",type:"automation"},{name:"GetItems",url:t+"/"+a+"get_items.js",type:"automation"},{name:"GhElementNode",url:t+"/"+a+"gh_element_node.js",type:"automation"},{name:"ifCondition",url:t+"/"+a+"if_condition.js",type:"automation"},{name:"ItemConstructor",url:t+"/"+a+"item_constructor.js",type:"automation"},{name:"ItemDestructor",url:t+"/"+a+"item_destructor.js",type:"automation"},{name:"JSONScheme",url:t+"/"+a+"json_scheme.js",type:"automation"},{name:"MergeItems",url:t+"/"+a+"merge_items.js",type:"automation"},{name:"MessageConstructor",url:t+"/"+a+"message_constructor.js",type:"automation"},{name:"ObjectToItem",url:t+"/"+a+"obj_to_item.js",type:"automation"},{name:"ObjectConstructor",url:t+"/"+a+"object_constructor.js",type:"automation"},{name:"ObjectDestructor",url:t+"/"+a+"object_destructor.js",type:"automation"},{name:"PopulateElement",url:t+"/"+a+"populate_element.js",type:"automation"},{name:"PopulateItems",url:t+"/"+a+"populate_items.js",type:"automation"},{name:"PopulateWithDate",url:t+"/"+a+"populate_with_date.js",type:"automation"},{name:"PopulateWithItemRef",url:t+"/"+a+"populate_with_item_ref.js",type:"automation"},{name:"PopUpForm",url:t+"/"+a+"popup_form.js",type:"automation"},{name:"QuizForm",url:t+"/"+a+"quiz_form.js",type:"automation"},{name:"QuizNode",url:t+"/"+a+"quiz_node.js",type:"automation"},{name:"Request",url:t+"/"+a+"request_node.js",type:"automation"},{name:"Response",url:t+"/"+a+"response_node.js",type:"automation"},{name:"SmartInput",url:t+"/"+a+"smart_input.js",type:"automation"},{name:"Trigger",url:t+"/"+a+"trigger_node.js",type:"automation"},{name:"TwilioSms",url:t+"/"+a+"twilio_sms.js",type:"automation"},{name:"UpdateItemsApi",url:t+"/"+a+"update_items_api.js",type:"automation"}]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
107
|
+
"use strict";function e(e,t,a){return[{name:"text",url:t+"/"+e+"text_data.js",type:"gh_element",technology:"angular"},{name:"text_opt",url:t+"/"+e+"text_options_data.js",type:"gh_element",technology:"angular"},{name:"number",url:t+"/"+e+"number_data.js",type:"gh_element",technology:"angular"},{name:"task_board",url:t+"/"+e+"task_board_data.js",type:"gh_element",technology:"angular"},{name:"visualizer",url:t+"/"+e+"visualizer_data.js",type:"gh_element",technology:"angular"},{name:"enterprice_visualizer",url:t+"/"+e+"enterprice_visualizer_data.js",type:"gh_element",technology:"angular"},{name:"email",url:t+"/"+e+"email_data.js",type:"gh_element",technology:"angular"},{name:"date",url:t+"/"+e+"date_data.js",type:"gh_element",technology:"angular"},{name:"radio_button",url:t+"/"+e+"radio_button_data.js",type:"gh_element",technology:"angular"},{name:"radio_icon",url:t+"/"+e+"radio_icon_data.js",type:"gh_element",technology:"angular"},{name:"twilio_phone",url:t+"/"+e+"twilio_phone_data.js",type:"gh_element",technology:"angular"},{name:"twilio_autodialer",url:t+"/"+e+"twillio_autodialer_data.js",type:"gh_element",technology:"angular"},{name:"color",url:t+"/"+e+"color_data.js",type:"gh_element",technology:"angular"},{name:"charts",url:t+"/"+e+"charts_data.js",type:"gh_element",technology:"angular"},{name:"funnel_chart",url:t+"/"+e+"funnel_chart_data.js",type:"gh_element",technology:"angular"},{name:"add_items_from_template",url:t+"/"+e+"add_items_from_template_data.js",type:"gh_element",technology:"angular"},{name:"item_ref",url:t+"/"+e+"itemRef_data.js",type:"gh_element",technology:"angular"},{name:"calendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"gh_element",technology:"class"},{name:"data_ref",url:t+"/"+e+"data_ref_data.js",type:"gh_element",technology:"angular"},{name:"table",url:t+"/"+e+"table_data.js",type:"gh_element",technology:"angular"},{name:"tile",url:t+"/"+e+"tile_data.js",type:"gh_element",technology:"angular"},{name:"file",url:t+"/"+e+"file_data.js",type:"gh_element",technology:"angular"},{name:"image",url:t+"/"+e+"image_data.js",type:"gh_element",technology:"angular"},{name:"text_editor",url:t+"/"+e+"text_editor_data.js",type:"gh_element",technology:"angular"},{name:"tinymse",url:t+"/"+e+"tinymse_data.js",type:"gh_element",technology:"angular"},{name:"duration",url:t+"/"+e+"duration_data.js",type:"gh_element",technology:"angular"},{name:"user",url:t+"/"+e+"user_data.js",type:"gh_element",technology:"angular"},{name:"app",url:t+"/"+e+"application_data.js",type:"gh_element",technology:"angular"},{name:"field",url:t+"/"+e+"field_data.js",type:"gh_element",technology:"angular"},{name:"available",url:t+"/"+e+"available_data.js",type:"gh_element",technology:"angular"},{name:"view_list",url:t+"/"+e+"view_list_data.js",type:"gh_element",technology:"angular"},{name:"calculator",url:t+"/"+e+"calculator_data.js",type:"gh_element",technology:"angular"},{name:"string_join",url:t+"/"+e+"string_joiner_data.js",type:"gh_element",technology:"angular"},{name:"signature",url:t+"/"+e+"signature_data.js",type:"gh_element",technology:"angular"},{name:"sendEmail",url:t+"/"+e+"send_email_data.js",type:"gh_element",technology:"angular"},{name:"boolean",url:t+"/"+e+"boolean_data.js",type:"gh_element",technology:"angular"},{name:"product_gallery",url:t+"/"+e+"product_gallery_data.js",type:"gh_element",technology:"angular"},{name:"online_inventory",url:t+"/"+e+"online_inventory_data.js",type:"gh_element",technology:"angular"},{name:"3d_edges",url:t+"/"+e+"3d_edges_data.js",type:"gh_element",technology:"angular"},{name:"color_list",url:t+"/"+e+"color_list_data.js",type:"gh_element",technology:"angular"},{name:"go_to_link",url:t+"/"+e+"go_to_link_data.js",type:"gh_element",technology:"angular"},{name:"go_to_view",url:t+"/"+e+"go_to_view_data.js",type:"gh_element",technology:"angular"},{name:"range",url:t+"/"+e+"range_data.js",type:"gh_element",technology:"angular"},{name:"barcode",url:t+"/"+e+"barcode_data.js",type:"gh_element",technology:"angular"},{name:"item_remote_add",url:t+"/"+e+"item_remote_add_data.js",type:"gh_element",technology:"angular"},{name:"item_remote_update",url:t+"/"+e+"item_remote_update_data.js",type:"gh_element",technology:"angular"},{name:"timeline",url:t+"/"+e+"timeline_data.js",type:"gh_element",technology:"angular"},{name:"delete_item",url:t+"/"+e+"delete_action.js",type:"gh_element",technology:"angular"},{name:"print_doc",url:t+"/"+e+"print_doc_action.js",type:"gh_element",technology:"angular"},{name:"open_item",url:t+"/"+e+"open_item_action.js",type:"gh_element",technology:"angular"},{name:"edit_template",url:t+"/"+e+"edit_template_action.js",type:"gh_element",technology:"angular"},{name:"open_app",url:t+"/"+e+"open_app_action.js",type:"gh_element",technology:"angular"},{name:"user_settings",url:t+"/"+e+"user_settings_action.js",type:"gh_element",technology:"angular"},{name:"app_sharing",url:t+"/"+e+"sharing_action.js",type:"gh_element",technology:"angular"},{name:"app_constructor",url:t+"/"+e+"app_constructor_action.js",type:"gh_element",technology:"angular"},{name:"export_csv",url:t+"/"+e+"export_csv.js",type:"gh_element",technology:"angular"},{name:"import_csv",url:t+"/"+e+"import_csv.js",type:"gh_element",technology:"angular"},{name:"add_items",url:t+"/"+e+"add_items_action.js",type:"gh_element",technology:"angular"},{name:"update_items",url:t+"/"+e+"update_items_action.js",type:"gh_element",technology:"angular"},{name:"install_app",url:t+"/"+e+"install_app_action.js",type:"gh_element",technology:"angular"},{name:"search_action",url:t+"/"+e+"search_action.js",type:"gh_element",technology:"angular"},{name:"filter_table",url:t+"/"+e+"filter_table_action.js",type:"gh_element",technology:"angular"},{name:"slider",url:t+"/"+e+"slider_data.js",type:"gh_element",technology:"angular"},{name:"clone_item",url:t+"/"+e+"clone_item_action.js",type:"gh_element",technology:"angular"},{name:"close",url:t+"/"+e+"close_action.js",type:"gh_element",technology:"angular"},{name:"phone",url:t+"/"+e+"phone_data.js",type:"gh_element",technology:"angular"},{name:"link",url:t+"/"+e+"link_data.js",type:"gh_element",technology:"angular"},{name:"sheduling",url:t+"/"+e+"sheduling_data.js",type:"gh_element",technology:"angular"},{name:"qrcode",url:t+"/"+e+"qrcode_data.js",type:"gh_element",technology:"angular"},{name:"graph2d",url:t+"/"+e+"graph2d_data.js",type:"gh_element",technology:"angular"},{name:"quote_tool",url:t+"/"+e+"quote_tool_data.js",type:"gh_element",technology:"angular"},{name:"cards",url:t+"/"+e+"cards_data.js",type:"gh_element",technology:"angular"},{name:"jsonConstructor",url:t+"/"+e+"json_constructor_data.js",type:"gh_element",technology:"angular"},{name:"button",js:"https://gudhub.com/modules/button_action/button_action.js",type:"gh_element",technology:"class"},{name:"editorjs",js:"https://gudhub.com/modules/Editor-Js/dist/main.js",css:"https://gudhub.com/modules/Editor-Js/dist/style.css",type:"gh_element",technology:"class"},{name:"filter_advanced",url:t+"/"+e+"filter_advanced_data.js",type:"gh_element",technology:"angular"},{name:"code_editor",url:t+"/"+e+"code_editor_data.js",type:"gh_element",technology:"angular"},{name:"icon",url:t+"/"+e+"icon_data.js",type:"gh_element",technology:"angular"},{name:"quoteRequest",url:t+"/"+e+"quote_request_data.js",type:"gh_element",technology:"angular"},{name:"view_container",url:t+"/"+e+"view_container_data.js",type:"gh_element",technology:"angular"},{name:"element_ref",url:t+"/"+e+"element_ref_data.js",type:"gh_element",technology:"angular"},{name:"quote_tool_objects_renderer",url:t+"/"+e+"quote_tool_objects_renderer_data.js",type:"gh_element",technology:"angular"},{name:"quote_tool_objects_renderer_generator",url:t+"/"+e+"quote_tool_objects_renderer_generator_data.js",type:"gh_element",technology:"angular"},{name:"trigger",url:t+"/"+e+"trigger_data.js",type:"gh_element",technology:"angular"},{name:"voting",url:t+"/"+e+"voting_data.js",type:"gh_element",technology:"angular"},{name:"view_tabs",url:t+"/"+e+"view_tabs.js",type:"gh_element",technology:"angular"},{name:"filter_tabs",url:t+"/"+e+"filter_tabs.js",type:"gh_element",technology:"angular"},{name:"gps_coords",url:t+"/"+e+"gps_coords.js",type:"gh_element",technology:"angular"},{name:"google_map",url:t+"/"+e+"google_map_data.js",type:"gh_element",technology:"angular"},{name:"data_migrations",url:t+"/"+e+"data_migrations.js",type:"gh_element",technology:"angular"},{name:"additional_settings",url:t+"/"+e+"gh_additional_settings_data.js",type:"gh_element",technology:"angular"},{name:"send_request",url:t+"/"+e+"send_request_data.js",type:"gh_element",technology:"angular"},{name:"webcam",url:t+"/"+e+"webcam_data.js",type:"gh_element",technology:"angular"},{name:"json_viewer",url:t+"/"+e+"json_viewer_data.js",type:"gh_element",technology:"angular"},{name:"notifications",url:t+"/"+e+"notifications_data.js",type:"gh_element",technology:"angular"},{name:"api",url:t+"/"+e+"api_data.js",type:"gh_element",technology:"angular"},{name:"smart_input",url:t+"/"+e+"smart_input_data.js",type:"gh_element",technology:"angular"},{name:"json_editor",url:t+"/"+e+"json_editor_data.js",type:"gh_element",technology:"angular"},{name:"grapes_html_editor",url:t+"/"+e+"grapes_html_editor_data.js",type:"gh_element",technology:"angular"},{name:"quiz",url:t+"/"+e+"quiz_data.js",type:"gh_element",technology:"angular"},{name:"markdown_viewer",url:t+"/"+e+"markdown_viewer_data.js",type:"gh_element",technology:"angular"},{name:"password_input",url:t+"/"+e+"password_input_data.js",type:"gh_element",technology:"angular"},{name:"vs_code",url:t+"/"+e+"vs_code_data.js",type:"gh_element",technology:"angular"},{name:"nested_list",js:"https://gudhub.com/modules/Nested-List/dist/main.js",css:"https://gudhub.com/modules/Nested-List/dist/style.css",type:"gh_element",technology:"class"},{name:"countertop_smart_quote",url:t+"/"+e+"countertop_smart_quote_data.js",type:"gh_element",technology:"angular"},{name:"markdown_viewer_web_component",js:"https://gudhub.com/modules/markdown-it-gh-element/dist/main.js",css:"https://gudhub.com/modules/markdown-it-gh-element/dist/style.css",type:"gh_element",technology:"class"},{name:"API",url:t+"/"+a+"api_node.js",type:"automation"},{name:"Calculator",url:t+"/"+a+"calculator.js",type:"automation"},{name:"CompareItems",url:t+"/"+a+"compare_items.js",type:"automation"},{name:"Constants",url:t+"/"+a+"constants.js",type:"automation"},{name:"CreateFiles",url:t+"/"+a+"create_files.js",type:"automation"},{name:"CreateItemsApi",url:t+"/"+a+"create_item_api.js",type:"automation"},{name:"FaceDetector",url:t+"/"+a+"face_detector.js",type:"automation"},{name:"FileDuplicate",url:t+"/"+a+"file_duplicate.js",type:"automation"},{name:"Filter",url:t+"/"+a+"filter_node.js",type:"automation"},{name:"GetItemByItemRef",url:t+"/"+a+"get_item_by_item_ref.js",type:"automation"},{name:"GetItems",url:t+"/"+a+"get_items.js",type:"automation"},{name:"GhElementNode",url:t+"/"+a+"gh_element_node.js",type:"automation"},{name:"IfCondition",url:t+"/"+a+"if_condition.js",type:"automation"},{name:"ItemConstructor",url:t+"/"+a+"item_constructor.js",type:"automation"},{name:"ItemDestructor",url:t+"/"+a+"item_destructor.js",type:"automation"},{name:"JSONScheme",url:t+"/"+a+"json_scheme.js",type:"automation"},{name:"MergeItems",url:t+"/"+a+"merge_items.js",type:"automation"},{name:"MessageConstructor",url:t+"/"+a+"message_constructor.js",type:"automation"},{name:"ObjectToItem",url:t+"/"+a+"obj_to_item.js",type:"automation"},{name:"ObjectConstructor",url:t+"/"+a+"object_constructor.js",type:"automation"},{name:"ObjectDestructor",url:t+"/"+a+"object_destructor.js",type:"automation"},{name:"PopulateElement",url:t+"/"+a+"populate_element.js",type:"automation"},{name:"PopulateItems",url:t+"/"+a+"populate_items.js",type:"automation"},{name:"PopulateWithDate",url:t+"/"+a+"populate_with_date.js",type:"automation"},{name:"PopulateWithItemRef",url:t+"/"+a+"populate_with_item_ref.js",type:"automation"},{name:"PopUpForm",url:t+"/"+a+"popup_form.js",type:"automation"},{name:"QuizForm",url:t+"/"+a+"quiz_form.js",type:"automation"},{name:"QuizNode",url:t+"/"+a+"quiz_node.js",type:"automation"},{name:"Request",url:t+"/"+a+"request_node.js",type:"automation"},{name:"Response",url:t+"/"+a+"response_node.js",type:"automation"},{name:"SmartInput",url:t+"/"+a+"smart_input.js",type:"automation"},{name:"Trigger",url:t+"/"+a+"trigger_node.js",type:"automation"},{name:"TwilioSms",url:t+"/"+a+"twilio_sms.js",type:"automation"},{name:"UpdateItemsApi",url:t+"/"+a+"update_items_api.js",type:"automation"}]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
108
108
|
},{}],"CSHe":[function(require,module,exports) {
|
|
109
109
|
"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 u(t)||s(t)||i(t)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.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 s(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function u(t){if(Array.isArray(t))return a(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t,e,r,n,i,s,u){try{var a=t[s](u),o=a.value}catch(p){return void r(p)}a.done?e(o):Promise.resolve(o).then(n,i)}function p(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function u(t){o(s,n,i,u,a,"next",t)}function a(t){o(s,n,i,u,a,"throw",t)}u(void 0)})}}function c(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 l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach(function(e){f(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(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 d(t,e,r){return e&&v(t.prototype,e),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var y=function(){function e(r,n,i){h(this,e),this.apps_list=[],this.users_list=[],this.user={},this.modulesList=(0,t.default)(r,n,i),this.ghComponentsPromises=[]}return d(e,[{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){return void 0===t?this.modulesList:this.modulesList.filter(function(e){return e.type===t})}},{key:"getModuleUrl",value:function(t){return this.modulesList.find(function(e){return e.name==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=l(l({},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=p(regeneratorRuntime.mark(function t(e,r){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getApp(r);case 2:return(n=t.sent)&&(n.items_list=updateItems(e,n.items_list,this.pipeService.emit.bind(this.pipeService),r),this.updateApp(n)),t.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"addItemsToApp",value:function(){var t=p(regeneratorRuntime.mark(function t(e,n){var i,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getApp(n);case 2:return(i=t.sent)&&((s=i.items_list).push.apply(s,r(e)),this.updateApp(i),this.pipeService.emit("gh_items_update",{app_id:n},e)),t.abrupt("return",i);case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItemsInApp",value:function(){var t=p(regeneratorRuntime.mark(function t(e,r){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getApp(r);case 2:return(n=t.sent)&&(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.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()}]),e}();exports.Storage=y;
|
|
110
110
|
},{"./ModulesList.js":"FJWL"}],"p58b":[function(require,module,exports) {
|
|
@@ -172,9 +172,11 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
|
|
|
172
172
|
"use strict";function e(e,n,i,t,a,o,r){try{var p=e[o](r),c=p.value}catch(u){return void i(u)}p.done?n(c):Promise.resolve(c).then(t,a)}function n(n){return function(){var i=this,t=arguments;return new Promise(function(a,o){var r=n.apply(i,t);function p(n){e(r,a,o,p,c,"next",n)}function c(n){e(r,a,o,p,c,"throw",n)}p(void 0)})}}function i(e){return(i="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 t(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){for(var i=0;i<n.length;i++){var t=n[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function o(e,n,i){return n&&a(e.prototype,n),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var r=function(){function e(n){t(this,e),this.gudhub=n,this.appsConnectingMap={apps:[],fields:[],items:[],views:[]}}return o(e,[{key:"createAppsFromTemplate",value:function(e,n,t){var a=this,o=this;return new Promise(function(r){var p=100/(6*e.apps.length),c=0;o.createApps(e,function(e){c+=1,t.call(a,{percent:c*p,status:e})}).then(function(e){o.createItems(e,n,function(e){"string"==typeof e?(c+=1,t.call(a,{percent:c*p,status:e})):"object"===i(e)&&t.call(a,{status:"Done",apps:e})}).then(function(){r()})})})}},{key:"createItems",value:function(e,n,i){var t=this;return new Promise(function(a){var o=n||1e5,r=t,p=[],c=[];e.forEach(function(e){c.push(new Promise(function(n){r.gudhub.getApp(r._searchOldAppId(e.app_id,r.appsConnectingMap.apps)).then(function(a){i&&i.call(t,"GET APP: ".concat(a.app_name," (Items steps)"));var c=JSON.parse(JSON.stringify(a)),u=c.items_list.map(function(e){return{index_number:e.index_number,item_id:0,fields:[]}}).filter(function(e,n){return n<=o});r.gudhub.addNewItems(e.app_id,u).then(function(o){i&&i.call(t,"ADD NEW ITEMS: ".concat(a.app_name," (Items steps)")),0===o.length&&(i&&i.call(t,"NO ITEMS TO REPLACE VALUE: ".concat(a.app_name," (Items steps)")),n()),e.items_list=o,r._updateMap(e.items_list,c.items_list),r._addFieldValue(c.items_list,e.items_list,r.appsConnectingMap),p.push(e),r.appsConnectingMap.apps.length===p.length&&(p.forEach(function(e){e.items_list.forEach(function(e){e.fields.forEach(function(e){r.appsConnectingMap.fields.forEach(function(n){e.field_id===n.old_field_id&&(e.field_id=n.new_field_id,e.element_id=n.new_field_id)})})})}),r.deleteField(p),r.replaceValue(p,r.appsConnectingMap).then(function(){i&&i.call(t,"REPLACE VALUE: ".concat(a.app_name," (Items steps)")),p.forEach(function(e){var i=e.items_list.map(function(e){return e.fields.forEach(function(e){delete e.data_id}),e});r.gudhub.updateItems(e.app_id,i).then(function(){n()})})}))})})}))}),Promise.all(c).then(function(){var n=e.map(function(e){return e.app_id});i.call(t,n),a()})})}},{key:"deleteField",value:function(e){e.forEach(function(e){e.items_list.forEach(function(n){n.fields=n.fields.filter(function(n){return e.field_list.findIndex(function(e){return e.field_id==n.field_id})>-1})})})}},{key:"replaceValue",value:function(e,i){var t=this;return new Promise(function(){var a=n(regeneratorRuntime.mark(function n(a){var o,r;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:o=[],r=t,e.forEach(function(e){e.field_list.forEach(function(n){"item_ref"===n.data_type&&r._replaceValueItemRef(e,n,i),o.push(new Promise(function(i){r.gudhub.ghconstructor.getInstance(n.data_type).then(function(t){return void 0===t?(console.log("ERROR WHILE GETTING INSTANCE OF ",n.data_type),void i({type:n.data_type})):"file"==t.getTemplate().constructor?r.gudhub.util.fileInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){i(e)}):void("document"==t.getTemplate().constructor?r.documentInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){i(t)}):i(t))})}))})}),o.length>0?Promise.all(o).then(function(e){a(e)}):a(result);case 4:case"end":return n.stop()}},n)}));return function(e){return a.apply(this,arguments)}}())}},{key:"documentInstallerHelper",value:function(e,i,t){var a=this;return new Promise(function(){var o=n(regeneratorRuntime.mark(function n(o){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:i.forEach(function(n){var i=n.item_id,r=n.fields.find(function(e){return e.element_id===t});r&&r.field_value&&r.field_value.length>0&&a.gudhub.getDocument({_id:r.field_value}).then(function(n){a.gudhub.createDocument({app_id:e,item_id:i,element_id:t,data:n.data}).then(function(e){r.field_value=e._id,o()})})});case 1:case"end":return n.stop()}},n)}));return function(e){return o.apply(this,arguments)}}())}},{key:"_replaceValueItemRef",value:function(e,n,i){e.items_list.forEach(function(e){e.fields.forEach(function(e){if(e.field_id===n.field_id&&e.field_value){var t=e.field_value.split(",");t.forEach(function(e,n){var a=e.split(".");i.apps.forEach(function(e){a[0]==e.old_app_id&&(a[0]=e.new_app_id)}),i.items.forEach(function(e){a[1]==e.old_item_id&&(a[1]=e.new_item_id)}),t[n]=a.join(".")}),e.field_value=t.join(",")}})})}},{key:"_addFieldValue",value:function(e,n,i){n.forEach(function(n){i.items.forEach(function(i){n.item_id===i.new_item_id&&e.forEach(function(e){i.old_item_id===e.item_id&&(n.fields=e.fields)})})})}},{key:"_updateMap",value:function(e,n){var i=this;n.forEach(function(n){e.forEach(function(e){n.index_number===e.index_number&&i.appsConnectingMap.items.push({old_item_id:n.item_id,new_item_id:e.item_id})})})}},{key:"_searchOldAppId",value:function(e,n){var i=0;return n.forEach(function(n){n.new_app_id===e&&(i=n.old_app_id)}),i}},{key:"createApps",value:function(e,n){var i=this,t=this,a={step_size:100/(3*e.apps.length),apps:[]};return new Promise(function(o){var r={},p=[],c=[];e.apps.forEach(function(u){t.gudhub.getApp(u).then(function(u){n&&n.call(i,"GET APP: ".concat(u.app_name," (App steps)"));var l=JSON.parse(JSON.stringify(u));r[l.app_id]=l,a.apps.push(l.icon);var f=t.prepareAppTemplate(l);f.app_name=f.app_name+" New",f.privacy=1,t.resetViewsIds(f),t.gudhub.createNewApp(f).then(function(a){n&&n.call(i,"CREATE NEW APP: ".concat(u.app_name," (App steps)")),p.push(a),t.mapApp(l,a,t.appsConnectingMap),e.apps.length==p.length&&(t.connectApps(p,t.appsConnectingMap,r),p.forEach(function(a){t.gudhub.updateApp(a).then(function(t){n&&n.call(i,"UPDATE APP: ".concat(u.app_name," (App steps)")),c.push(t),e.apps.length==c.length&&o(c)})}))})})})})}},{key:"mapApp",value:function(e,n,i){i.apps.push({old_app_id:e.app_id,new_app_id:n.app_id,old_view_init:e.view_init,new_view_init:n.view_init}),e.field_list.forEach(function(e){n.field_list.forEach(function(n){e.name_space==n.name_space&&i.fields.push({name_space:e.name_space,old_field_id:e.field_id,new_field_id:n.field_id})})}),e.views_list.forEach(function(e){n.views_list.forEach(function(n){e.name==n.name&&i.views.push({name:e.name,old_view_id:e.view_id,new_view_id:n.view_id})})})}},{key:"crawling",value:function(e,n){var i=null===e?[]:Object.keys(e),t=this;i.length>0&&i.forEach(function(i){var a=e[i];void 0!==a&&"string"!=typeof e&&(n(i,a,e),t.crawling(a,n))})}},{key:"resetViewsIds",value:function(e){e.view_init=0,this.crawling(e.views_list,function(e,n,i){"view_id"!=e&&"container_id"!=e||(i[e]=0)})}},{key:"connectApps",value:function(e,n,i){var t=this;return e.forEach(function(e){n.apps.forEach(function(i){e.view_init===i.new_view_init&&n.views.forEach(function(n){i.old_view_init===n.old_view_id&&(e.view_init=n.new_view_id)})}),t.crawling(e.field_list,function(a,o,r){if(-1!==a.indexOf("field_id")||-1!==a.indexOf("FieldId")||-1!==a.indexOf("destination_field")){var p=String(o).split(","),c=[];n.fields.forEach(function(e){p.forEach(function(n){n==e.old_field_id&&c.push(e.new_field_id)})}),c.length&&(r[a]=c.join(","))}if(-1==a.indexOf("app_id")&&-1==a.indexOf("AppId")&&-1==a.indexOf("destination_app")||n.apps.forEach(function(e){o==e.old_app_id&&(r[a]=e.new_app_id)}),-1!==a.indexOf("view_id")&&n.views.forEach(function(e){o==e.old_view_id&&(r[a]=e.new_view_id)}),-1!==a.indexOf("src")&&isFinite(o)){var u=n.apps.find(function(n){return n.new_app_id===e.app_id}).old_app_id,l=t.findPath(i[u].views_list,"container_id",o);r[a]="".concat(t.getValueByPath(e.views_list,l,"container_id"))}})}),e}},{key:"getValueByPath",value:function(e,n,i){var t=e;return n.split(".").forEach(function(e){t=t[e]}),t[i]}},{key:"findPath",value:function(e,n,t){var a=!1,o=!1,r=[];return this.crawling(e,function(e,p,c){o&&r.reverse().forEach(function(e){o&&(e.delete=!0,e.parent===c&&(o=!1,(r=r.filter(function(e){return!e.delete})).reverse()))}),a||("object"===i(c[e])&&r.push({prop:e,parent:c}),p==t&&n===e?a=!0:Object.keys(c).pop()===e&&"object"!==i(c[e])&&(o=!0))}),r.map(function(e){return e.prop}).join(".")}},{key:"prepareAppTemplate",value:function(e){var n=JSON.parse(JSON.stringify(e));return this.crawling(n.views_list,function(e,n,i){"element_id"==e&&(i.element_id=-Number(n),i.create_element=-Number(n))}),n.field_list.forEach(function(e){e.create_field=-Number(e.field_id),e.element_id=-Number(e.field_id),e.field_id=-Number(e.field_id),e.field_value=""}),n.items_list=[],delete n.app_id,delete n.icon.id,delete n.group_id,delete n.trash,delete n.last_update,delete n.file_list,n}}]),e}();exports.default=r;
|
|
173
173
|
},{}],"E7yc":[function(require,module,exports) {
|
|
174
174
|
"use strict";function e(e){return i(e)||r(e)||n(e)||t()}function t(){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(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function r(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return o(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 a(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileHelper=void 0;var f=function(){function t(e){u(this,t),this.gudhub=e}return a(t,[{key:"fileInstallerHelper",value:function(t,n,r){var i=this;return new Promise(function(o){var u=[[]],l=Promise.resolve(),a=[];n.forEach(function(e){var n=e.item_id,i=e.fields.find(function(e){return e.element_id===r});i&&i.field_value&&i.field_value.split(".").forEach(function(e){var i={source:e,destination:{app_id:t,item_id:n,element_id:r}};10!==u[u.length-1].length?u[u.length-1].push(i):u.push([i])})}),u.forEach(function(t){l=l.then(function(){return i.gudhub.duplicateFile(t)}).then(function(t){a=[].concat(e(a),e(t))})}),l.then(function(){n.forEach(function(e){var t=e.item_id,n=e.fields.find(function(e){return e.element_id===r});n&&n.field_value&&(n.field_value="",a.forEach(function(e){e.item_id===t&&(n.field_value=n.field_value.split(",").filter(function(e){return e}).concat(e.file_id).join(","))}))}),o()})})}}]),t}();exports.FileHelper=f;
|
|
175
|
+
},{}],"AefJ":[function(require,module,exports) {
|
|
176
|
+
"use strict";function e(e,t){return JSON.stringify(e)===JSON.stringify(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compareObjects=e;
|
|
175
177
|
},{}],"mWlG":[function(require,module,exports) {
|
|
176
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=
|
|
177
|
-
},{"./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","./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"}],"rK64":[function(require,module,exports) {
|
|
178
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=y(require("./filter/filter.js")),r=require("./json_to_items/json_to_items.js"),n=require("./merge_compare_items/merge_compare_items.js"),i=require("./filter/group.js"),u=require("./filter/utils.js"),s=y(require("./populate_items/populate_items.js")),o=require("./get_date/get_date.js"),a=require("./merge_objects/merge_objects.js"),l=require("./merge_chunks/merge_chunks.js"),c=require("./nested_list/nested_list.js"),p=y(require("./MergeFields/MergeFields.js")),f=y(require("./ItemsSelection/ItemsSelection.js")),m=require("./compare_items_lists_worker/compare_items_lists.worker.js"),v=require("./json_constructor/json_constructor.js"),h=y(require("./AppsTemplateService/AppsTemplateService.js")),d=require("./FIleHelper/FileHelper.js"),g=require("./compareObjects/compareObjects.js");function y(e){return e&&e.__esModule?e:{default:e}}function k(e){return b(e)||_(e)||I(e)||j()}function j(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function I(e,t){if(e){if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}function _(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function b(e){if(Array.isArray(e))return w(e)}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function S(e,t,r,n,i,u,s){try{var o=e[u](s),a=o.value}catch(l){return void r(l)}o.done?t(a):Promise.resolve(a).then(n,i)}function F(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var u=e.apply(t,r);function s(e){S(u,n,i,s,o,"next",e)}function o(e){S(u,n,i,s,o,"throw",e)}s(void 0)})}}function q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(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 T(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var L=function(){function y(e){q(this,y),this.gudhub=e,this.MergeFields=new p.default(e),this.ItemsSelection=new f.default(e),this.AppsTemplateService=new h.default(e),this.FileHelper=new d.FileHelper(e)}return T(y,[{key:"prefilter",value:function(t,r,n,i){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return(0,e.filterPreparation)(t,r,n,i,this.gudhub.storage,this.gudhub.pipeService,u)}},{key:"filter",value:function(e,r){return(0,t.default)(e,r)}},{key:"group",value:function(e,t){return(0,i.group)(e,t)}},{key:"getFilteredItems",value:function(){var e=F(regeneratorRuntime.mark(function e(){var t,r,n,i,s,o,a,l,c,p,f,m=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){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,s=m.length>4?m[4]:void 0,o=m.length>5&&void 0!==m[5]?m[5]:"",a=m.length>6?m[6]:void 0,l=m.length>7?m[7]:void 0,e.next=10,this.prefilter(r,n,i,s);case 10:return c=e.sent,p=this.filter(t,[].concat(k(r),k(c))),f=this.group(o,p),e.abrupt("return",f.filter(function(e){return!a||1===(0,u.searchValue)([e],a).length}).filter(function(e){return!l||1===(0,u.searchValue)([e],l).length}));case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"jsonToItems",value:function(e,t){return(0,r.jsonToItems)(e,t)}},{key:"getDate",value:function(e){return(0,o.getDate)(e)}},{key:"checkRecurringDate",value:function(e,t){return(0,o.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,o.populateWithDate)(e,t)}},{key:"populateWithItemRef",value:function(e,t,r,i,u,s){return(0,n.populateWithItemRef)(e,t,r,i,u,s)}},{key:"compareItems",value:function(e,t,r){return(0,n.compareItems)(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return(0,n.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,c.makeNestedList)(e,t,r,n,i)}},{key:"mergeChunks",value:function(e){return(0,l.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){return(0,v.compiler)(e,t,this,r)}},{key:"fileInstallerHelper",value:function(e,t,r){return this.FileHelper.fileInstallerHelper(e,t,r)}},{key:"createAppsFromTemplate",value:function(e,t,r){return this.AppsTemplateService.createAppsFromTemplate(e,t,r)}},{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,m.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)})}}]),y}();exports.Utils=L;
|
|
179
|
+
},{"./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","./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"}],"rK64":[function(require,module,exports) {
|
|
178
180
|
"use strict";function e(e,t,r,n,u,a,s){try{var o=e[a](s),i=o.value}catch(c){return void r(c)}o.done?t(i):Promise.resolve(i).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 o(t){e(s,u,a,o,i,"next",t)}function i(t){e(s,u,a,o,i,"throw",t)}o(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=t(regeneratorRuntime.mark(function e(){var t,r,n,u,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},r=t.username,n=t.password,e.next=3,this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login"),form:{username:r,password:n}});case 3:return u=e.sent,this.storage.updateUser(u),e.abrupt("return",u);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"logout",value:function(e){return this.req.post({url:"/auth/logout",form:{token:e}})}},{key:"signup",value:function(e){return this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/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.axiosRequest({method:"POST",url:"".concat(this.req.root,"/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;
|
|
179
181
|
},{}],"UV2u":[function(require,module,exports) {
|
|
180
182
|
"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;
|
|
@@ -187,7 +189,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
|
187
189
|
},{"axios":"O4Aa","./../consts.js":"UV2u"}],"Htuh":[function(require,module,exports) {
|
|
188
190
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GHConstructor=void 0;var e=n(require("./createAngularModuleInstance.js")),t=n(require("./createClassInstance.js"));function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n,r,u,a,o){try{var i=e[a](o),s=i.value}catch(c){return void n(c)}i.done?t(s):Promise.resolve(s).then(r,u)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(u,a){var o=e.apply(t,n);function i(e){r(o,u,a,i,s,"next",e)}function s(e){r(o,u,a,i,s,"throw",e)}i(void 0)})}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=function(){function n(e){a(this,n),this.gudhub=e,this.cache={},this.modulesQueue={},this.angularInjector,this.nodeWindow}return i(n,[{key:"getInstance",value:function(){var e=u(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.getCached(t)){e.next=4;break}return e.abrupt("return",this.getCached(t));case 4:if(!this.modulesQueue[t]){e.next=9;break}return e.next=7,this.modulesQueue[t];case 7:e.next=12;break;case 9:return this.modulesQueue[t]=this.createInstance(t),e.next=12,this.modulesQueue[t];case 12:return e.abrupt("return",this.getCached(t));case 13:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"pupToCache",value:function(e,t){this.cache[e]=t}},{key:"getCached",value:function(e){return this.cache[e]}},{key:"initAngularInjector",value:function(e){this.angularInjector=e}},{key:"initJsdomWindow",value:function(e){this.nodeWindow=e}},{key:"createInstance",value:function(){var n=u(regeneratorRuntime.mark(function n(r){var u,a;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(u=this.gudhub.storage.getModuleUrl(r)){n.next=4;break}return console.log("Cannot find module: ".concat(r)),n.abrupt("return");case 4:if("gh_element"!==u.type){n.next=15;break}if("angular"!==u.technology){n.next=11;break}return n.next=8,(0,e.default)(this.gudhub,r,u.url,this.angularInjector,this.nodeWindow);case 8:a=n.sent,n.next=15;break;case 11:if("class"!==u.technology){n.next=15;break}return n.next=14,(0,t.default)(this.gudhub,r,u.js,u.css,this.nodeWindow);case 14:a=n.sent;case 15:return a&&this.pupToCache(r,a),n.abrupt("return",a);case 17:case"end":return n.stop()}},n,this)}));return function(e){return n.apply(this,arguments)}}()}]),n}();exports.GHConstructor=s;
|
|
189
191
|
},{"./createAngularModuleInstance.js":"osSN","./createClassInstance.js":"DsUm"}],"q0my":[function(require,module,exports) {
|
|
190
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppProcessor=void 0;var e=require("../consts.js");function t(e){return i(e)||n(e)||o(e)||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(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return c(e)}function a(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 p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=o(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,p=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return p=e.done,e},e:function(e){s=!0,a=e},f:function(){try{p||null==r.return||r.return()}finally{if(s)throw a}}}}function o(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,i,a,p){try{var s=e[a](p),u=s.value}catch(o){return void r(o)}s.done?t(u):Promise.resolve(u).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function p(e){f(a,n,i,p,s,"next",e)}function s(e){f(a,n,i,p,s,"throw",e)}p(void 0)})}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(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 d(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=function(){function r(e,t,n,i,a,p,s){h(this,r),this.storage=e,this.pipeService=t,this.req=n,this.ws=i,this.applistReceived=!1,this.activateSW=s,this.chunksManager=a,this.util=p,this.appListeners()}return d(r,[{key:"createNewAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/create",form:{app:JSON.stringify(t)}});case 3:return(r=e.sent).from_apps_list=!0,e.abrupt("return",r);case 8:return e.prev=8,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/update",form:{app:JSON.stringify(t)}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"deleteAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/delete",form:{app_id:t}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppListApi",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.get({url:"/api/applist/get"});case 3:return t=e.sent,e.abrupt("return",t.apps_list.map(function(e){return e.from_apps_list=!0,e}));case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.get({url:"/api/app/get",params:{app_id:t}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppListFromStorage",value:function(){return this.storage.getAppsList()}},{key:"getAppFromStorage",value:function(e){var t=this.storage.getApp(e);return t&&t.field_list.length?t:null}},{key:"addNewAppToStorage",value:function(e){return this.storage.getAppsList().push(e)}},{key:"saveAppInStorage",value:function(e){e.items_object={};for(var t=0;t<e.items_list.length;t++){e.items_object[e.items_list[t].item_id]={};for(var r=0;r<e.items_list[t].fields.length;r++)e.items_object[e.items_list[t].item_id][e.items_list[t].fields[r].field_id]=e.items_list[t].fields[r]}var n=this.storage.getApp(e.app_id);return n?(e.from_apps_list=n.from_apps_list,e.permission=n.permission,this.storage.updateApp(e)):(e.from_apps_list=!1,this.addNewAppToStorage(e)),this.getAppFromStorage(e.app_id)}},{key:"updatingAppInStorage",value:function(e){var t=this,r=this.getAppFromStorage(e.app_id);e.items_list=r.items_list,e.file_list=r.file_list,e.from_apps_list=r.from_apps_list,e.items_object=r.items_object,this.storage.updateApp(e),this.pipeService.emit("gh_app_views_update",{app_id:e.app_id},e.views_list),e.field_list.forEach(function(r){t.pipeService.emit("gh_model_update",{app_id:e.app_id,field_id:r.field_id},r)})}},{key:"deletingAppFromStorage",value:function(e){var t=this.storage.getAppsList();return t.forEach(function(r,n){r.app_id==e&&t.splice(n)}),t}},{key:"updateAppsListInStorage",value:function(){var e,t=u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=this.storage.getApp(r.app_id);n?(n.from_apps_list=r.from_apps_list,n.permission=r.permission):this.addNewAppToStorage(r)}}catch(i){t.e(i)}finally{t.f()}}},{key:"refreshApps",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n,i,a,p,s,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=o.length>0&&void 0!==o[0]?o[0]:[],r=u(t),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=19;break}if(null==(i=n.value)||!this.storage.getApp(i)){e.next=17;break}return e.prev=7,e.next=10,this.getAppApi(i);case 10:if(a=e.sent){for(a.items_object={},p=0;p<a.items_list.length;p++)for(a.items_object[a.items_list[p].item_id]={},s=0;s<a.items_list[p].fields.length;s++)a.items_object[a.items_list[p].item_id][a.items_list[p].fields[s].field_id]=a.items_list[p].fields[s];this.storage.updateApp(a)}e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.log(e.t0);case 17:e.next=4;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(2),r.e(e.t1);case 24:return e.prev=24,r.f(),e.finish(24);case 27:console.log("Apps refreshed: ",JSON.stringify(t));case 28:case"end":return e.stop()}},e,this,[[2,21,24,27],[7,14]])}));return function(){return e.apply(this,arguments)}}()},{key:"refreshAppsList",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.getAppListFromStorage(),e.next=3,this.getAppListApi();case 3:r=e.sent,n=r.map(function(e){return p(p({},e),t.find(function(t){return t.app_id===e.app_id}))}),this.updateAppsListInStorage(n),this.pipeService.emit("gh_apps_list_refreshed",{});case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getAppsList",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.getAppListFromStorage(),this.applistReceived){e.next=10;break}return e.next=4,this.getAppListApi();case 4:if(r=e.sent){e.next=7;break}return e.abrupt("return",null);case 7:this.updateAppsListInStorage(r),this.applistReceived=!0,t=r;case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getAppInfo",value:function(){var e=l(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.getAppsList();case 2:return r=e.sent,e.abrupt("return",r?r.find(function(e){return e.app_id==t}):null);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"deleteApp",value:function(){var e=l(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deleteAppApi(t);case 2:return e.abrupt("return",this.deletingAppFromStorage(t));case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getApp",value:function(){var e=l(regeneratorRuntime.mark(function e(r){var n,i,a=this,p=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(p.length>1&&void 0!==p[1]&&p[1],r){e.next=3;break}return e.abrupt("return",null);case 3:if(n=this.getAppFromStorage(r)){e.next=11;break}return e.next=7,this.getAppApi(r);case 7:if(i=e.sent){e.next=10;break}return e.abrupt("return",null);case 10:i.chunks&&i.chunks.length?(this.chunksManager.getChunks(r,i.chunks).then(function(e){i.items_list=a.util.mergeChunks([].concat(t(e),[i])),a.saveAppInStorage(i),a.pipeService.emit("gh_items_update",{app_id:r},i.items_list)}),n=i,this.saveAppInStorage(i)):(n=this.getAppFromStorage(r))||(n=i,this.saveAppInStorage(i),this.ws.addSubscription(r));case 11:return e.abrupt("return",n);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateApp",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.views_list&&t.views_list.length&&t.show){e.next=6;break}return e.next=3,this.getApp(t.app_id);case 3:r=e.sent,t.views_list&&t.views_list.length||(t.views_list=r.views_list),void 0===t.show&&(t.show=r.show);case 6:return e.next=8,this.updateAppApi(t);case 8:return n=e.sent,this.updatingAppInStorage(n),e.abrupt("return",n);case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAppInfo",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:{},r=this.getAppFromStorage(t.app_id),e.abrupt("return",this.updateApp(p(p({},r),t)));case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"createNewApp",value:function(){var e=l(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.createNewAppApi(t);case 2:return(r=e.sent).items_object={},this.addNewAppToStorage(r),e.abrupt("return",r);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppViews",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,this.getApp(t);case 3:return r=e.sent,e.abrupt("return",r.views_list);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"clearAppProcessor",value:function(){this.getAppListPromises=null,this.getAppPromises={},this.applistReceived=!1}},{key:"appListeners",value:function(){var t=this;this.pipeService.onRoot("gh_app_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app_id){e.next=5;break}return e.next=3,t.getApp(n.app_id);case 3:i=e.sent,t.pipeService.emit("gh_app_get",n,i);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_apps_list_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAppsList();case 2:i=e.sent,t.pipeService.emit("gh_apps_list_get",n,i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_delete_app",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.deleteApp(n.app_id);case 2:i=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_update",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.app.items_list=[],n.app.file_list=[],e.next=4,t.updateApp(n.app);case 4:return i=e.sent,t.pipeService.emit("gh_app_views_update",{app_id:i.app_id},i.views_list),e.next=8,t.getAppsList();case 8:a=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},a),i.field_list.forEach(function(e){t.pipeService.emit("gh_model_update",{app_id:i.app_id,field_id:e.field_id},e)});case 11:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_view_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app_id){e.next=5;break}return e.next=3,t.getApp(n.app_id);case 3:(i=e.sent).views_list.forEach(function(e,r){e.view_id==n.view_id&&t.pipeService.emit("gh_app_view_get",n,i.views_list[r])});case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAppInfo(n.app_id);case 2:(i=e.sent)&&t.pipeService.emit("gh_app_info_get",n,i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_update",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app){e.next=5;break}return e.next=3,t.updateAppInfo(n.app);case 3:i=e.sent,t.pipeService.emit("gh_app_info_update",{app_id:n.app.app_id},i);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_create",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createNewApp(n.app);case 2:return e.next=4,t.getAppsList();case 4:i=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 6:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),e.IS_WEB&&this.activateSW&&navigator.serviceWorker.addEventListener("message",function(){var e=l(regeneratorRuntime.mark(function e(r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("refresh app"!==r.data.type){e.next=7;break}return e.next=3,t.getApp(r.data.payload.app_id);case 3:(n=e.sent)&&t.util.compareAppsItemsLists(n.items_list,r.data.payload.items_list.filter(function(e){return!e.trash}),function(e){var n=e.diff_fields_items,i=e.diff_fields_items_Ids,a=e.diff_items,p=e.newItems,s=e.deletedItems;(a.length||p.length||s.length)&&(t.pipeService.emit("gh_items_update",{app_id:r.data.payload.app_id},r.data.payload.items_list.filter(function(e){return!e.trash})),a.forEach(function(e){return t.pipeService.emit("gh_item_update",{app_id:r.data.payload.app_id,item_id:e.item_id},e)})),i.forEach(function(e){var i=n[e];i&&i.forEach(function(n){t.pipeService.emit("gh_value_update",{app_id:r.data.payload.app_id,item_id:e,field_id:n.field_id},n.field_value)})})}),r.data.payload.items_list=t.util.mergeChunks([n,r.data.payload]),t.saveAppInStorage(r.data.payload);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())}}]),r}();exports.AppProcessor=g;
|
|
192
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppProcessor=void 0;var e=require("../consts.js");function t(e){return i(e)||n(e)||o(e)||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(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return c(e)}function a(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 p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=o(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,p=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return p=e.done,e},e:function(e){s=!0,a=e},f:function(){try{p||null==r.return||r.return()}finally{if(s)throw a}}}}function o(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,i,a,p){try{var s=e[a](p),u=s.value}catch(o){return void r(o)}s.done?t(u):Promise.resolve(u).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function p(e){f(a,n,i,p,s,"next",e)}function s(e){f(a,n,i,p,s,"throw",e)}p(void 0)})}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(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 d(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=function(){function r(e,t,n,i,a,p,s){h(this,r),this.storage=e,this.pipeService=t,this.req=n,this.ws=i,this.applistReceived=!1,this.activateSW=s,this.chunksManager=a,this.util=p,this.appListeners()}return d(r,[{key:"createNewAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/create",form:{app:JSON.stringify(t)}});case 3:return(r=e.sent).from_apps_list=!0,e.abrupt("return",r);case 8:return e.prev=8,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/update",form:{app:JSON.stringify(t)}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"deleteAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/delete",form:{app_id:t}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppListApi",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.get({url:"/api/applist/get"});case 3:return t=e.sent,e.abrupt("return",t.apps_list.map(function(e){return e.from_apps_list=!0,e}));case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.get({url:"/api/app/get",params:{app_id:t}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppListFromStorage",value:function(){return this.storage.getAppsList()}},{key:"getAppFromStorage",value:function(e){var t=this.storage.getApp(e);return t&&t.field_list.length?t:null}},{key:"addNewAppToStorage",value:function(e){return this.storage.getAppsList().push(e)}},{key:"saveAppInStorage",value:function(e){e.items_object={};for(var t=0;t<e.items_list.length;t++){e.items_object[e.items_list[t].item_id]={};for(var r=0;r<e.items_list[t].fields.length;r++)e.items_object[e.items_list[t].item_id][e.items_list[t].fields[r].field_id]=e.items_list[t].fields[r]}var n=this.storage.getApp(e.app_id);return n?(e.from_apps_list=n.from_apps_list,e.permission=n.permission,this.storage.updateApp(e)):(e.from_apps_list=!1,this.addNewAppToStorage(e)),this.getAppFromStorage(e.app_id)}},{key:"updatingAppInStorage",value:function(e){var t=this,r=this.getAppFromStorage(e.app_id);e.items_list=r.items_list,e.file_list=r.file_list,e.from_apps_list=r.from_apps_list,e.items_object=r.items_object,this.storage.updateApp(e),this.pipeService.emit("gh_app_views_update",{app_id:e.app_id},e.views_list),e.field_list.forEach(function(r){t.pipeService.emit("gh_model_update",{app_id:e.app_id,field_id:r.field_id},r)})}},{key:"deletingAppFromStorage",value:function(e){var t=this.storage.getAppsList();return t.forEach(function(r,n){r.app_id==e&&t.splice(n)}),t}},{key:"updateAppsListInStorage",value:function(){var e,t=u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=this.storage.getApp(r.app_id);n?(n.from_apps_list=r.from_apps_list,n.permission=r.permission):this.addNewAppToStorage(r)}}catch(i){t.e(i)}finally{t.f()}}},{key:"refreshApps",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n,i,a,p,s,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=o.length>0&&void 0!==o[0]?o[0]:[],r=u(t),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=19;break}if(null==(i=n.value)||!this.storage.getApp(i)){e.next=17;break}return e.prev=7,e.next=10,this.getAppApi(i);case 10:if(a=e.sent){for(a.items_object={},p=0;p<a.items_list.length;p++)for(a.items_object[a.items_list[p].item_id]={},s=0;s<a.items_list[p].fields.length;s++)a.items_object[a.items_list[p].item_id][a.items_list[p].fields[s].field_id]=a.items_list[p].fields[s];this.storage.updateApp(a)}e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.log(e.t0);case 17:e.next=4;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(2),r.e(e.t1);case 24:return e.prev=24,r.f(),e.finish(24);case 27:console.log("Apps refreshed: ",JSON.stringify(t));case 28:case"end":return e.stop()}},e,this,[[2,21,24,27],[7,14]])}));return function(){return e.apply(this,arguments)}}()},{key:"refreshAppsList",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.getAppListFromStorage(),e.next=3,this.getAppListApi();case 3:r=e.sent,n=r.map(function(e){return p(p({},e),t.find(function(t){return t.app_id===e.app_id}))}),this.updateAppsListInStorage(n),this.pipeService.emit("gh_apps_list_refreshed",{});case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getAppsList",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.getAppListFromStorage(),this.applistReceived){e.next=10;break}return e.next=4,this.getAppListApi();case 4:if(r=e.sent){e.next=7;break}return e.abrupt("return",null);case 7:this.updateAppsListInStorage(r),this.applistReceived=!0,t=r;case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getAppInfo",value:function(){var e=l(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.getAppsList();case 2:return r=e.sent,e.abrupt("return",r?r.find(function(e){return e.app_id==t}):null);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"deleteApp",value:function(){var e=l(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deleteAppApi(t);case 2:return e.abrupt("return",this.deletingAppFromStorage(t));case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getApp",value:function(){var e=l(regeneratorRuntime.mark(function e(r){var n,i,a=this,p=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(p.length>1&&void 0!==p[1]&&p[1],r){e.next=3;break}return e.abrupt("return",null);case 3:if(n=this.getAppFromStorage(r)){e.next=11;break}return e.next=7,this.getAppApi(r);case 7:if(i=e.sent){e.next=10;break}return e.abrupt("return",null);case 10:i.chunks&&i.chunks.length?(this.chunksManager.getChunks(r,i.chunks).then(function(e){i.items_list=a.util.mergeChunks([].concat(t(e),[i])),a.saveAppInStorage(i),a.pipeService.emit("gh_items_update",{app_id:r},i.items_list)}),n=i,this.saveAppInStorage(i)):(n=this.getAppFromStorage(r))||(n=i,this.saveAppInStorage(i),this.ws.addSubscription(r));case 11:return e.abrupt("return",n);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateApp",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.views_list&&t.views_list.length&&t.show){e.next=6;break}return e.next=3,this.getApp(t.app_id);case 3:r=e.sent,t.views_list&&t.views_list.length||(t.views_list=r.views_list),void 0===t.show&&(t.show=r.show);case 6:return e.next=8,this.updateAppApi(t);case 8:return n=e.sent,this.updatingAppInStorage(n),e.abrupt("return",n);case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAppInfo",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},this.pipeService.emit("gh_app_info_update",{app_id:t.app_id},t),e.abrupt("return",this.updateApp(t));case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"createNewApp",value:function(){var e=l(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.createNewAppApi(t);case 2:return(r=e.sent).items_object={},this.addNewAppToStorage(r),e.abrupt("return",r);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppViews",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,this.getApp(t);case 3:return r=e.sent,e.abrupt("return",r.views_list);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"clearAppProcessor",value:function(){this.getAppListPromises=null,this.getAppPromises={},this.applistReceived=!1}},{key:"appListeners",value:function(){var t=this;this.pipeService.onRoot("gh_app_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app_id){e.next=5;break}return e.next=3,t.getApp(n.app_id);case 3:i=e.sent,t.pipeService.emit("gh_app_get",n,i);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_apps_list_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAppsList();case 2:i=e.sent,t.pipeService.emit("gh_apps_list_get",n,i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_delete_app",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.deleteApp(n.app_id);case 2:i=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_update",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.app.items_list=[],n.app.file_list=[],e.next=4,t.updateApp(n.app);case 4:return i=e.sent,t.pipeService.emit("gh_app_views_update",{app_id:i.app_id},i.views_list),e.next=8,t.getAppsList();case 8:a=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},a),i.field_list.forEach(function(e){t.pipeService.emit("gh_model_update",{app_id:i.app_id,field_id:e.field_id},e)});case 11:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_view_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app_id){e.next=5;break}return e.next=3,t.getApp(n.app_id);case 3:(i=e.sent).views_list.forEach(function(e,r){e.view_id==n.view_id&&t.pipeService.emit("gh_app_view_get",n,i.views_list[r])});case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAppInfo(n.app_id);case 2:(i=e.sent)&&t.pipeService.emit("gh_app_info_get",n,i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_update",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app){e.next=5;break}return e.next=3,t.updateAppInfo(n.app);case 3:i=e.sent,t.pipeService.emit("gh_app_info_update",{app_id:n.app.app_id},i);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_create",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createNewApp(n.app);case 2:return e.next=4,t.getAppsList();case 4:i=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 6:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),e.IS_WEB&&this.activateSW&&navigator.serviceWorker.addEventListener("message",function(){var e=l(regeneratorRuntime.mark(function e(r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("refresh app"!==r.data.type){e.next=7;break}return e.next=3,t.getApp(r.data.payload.app_id);case 3:(n=e.sent)&&t.util.compareAppsItemsLists(n.items_list,r.data.payload.items_list.filter(function(e){return!e.trash}),function(e){var n=e.diff_fields_items,i=e.diff_fields_items_Ids,a=e.diff_items,p=e.newItems,s=e.deletedItems;(a.length||p.length||s.length)&&(t.pipeService.emit("gh_items_update",{app_id:r.data.payload.app_id},r.data.payload.items_list.filter(function(e){return!e.trash})),a.forEach(function(e){return t.pipeService.emit("gh_item_update",{app_id:r.data.payload.app_id,item_id:e.item_id},e)})),i.forEach(function(e){var i=n[e];i&&i.forEach(function(n){t.pipeService.emit("gh_value_update",{app_id:r.data.payload.app_id,item_id:e,field_id:n.field_id},n.field_value)})})}),r.data.payload.items_list=t.util.mergeChunks([n,r.data.payload]),t.saveAppInStorage(r.data.payload);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())}}]),r}();exports.AppProcessor=g;
|
|
191
193
|
},{"../consts.js":"UV2u"}],"UUd3":[function(require,module,exports) {
|
|
192
194
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemProcessor=void 0;var e=require("../utils.js");function t(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 r(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?t(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t,r,n,i,a,s){try{var u=e[a](s),p=u.value}catch(o){return void r(o)}u.done?t(p):Promise.resolve(p).then(n,i)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var s=e.apply(t,r);function u(e){i(s,n,a,u,p,"next",e)}function p(e){i(s,n,a,u,p,"throw",e)}u(void 0)})}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 p(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var o=function(){function t(e,r,n,i,a){s(this,t),this.storage=e,this.pipeService=r,this.req=n,this.appProcessor=i,this.util=a,this.itemListeners()}return p(t,[{key:"addItemsApi",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/items/add",form:{items:JSON.stringify(r),app_id:t}});case 3:return n=e.sent,e.abrupt("return",n);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"updateItemsApi",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/items/update",form:{items:JSON.stringify(r),app_id:t}});case 3:return n=e.sent,e.abrupt("return",n);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"deleteItemsApi",value:function(e){try{var t=this.req.post({url:"/api/items/delete",form:{items_ids:JSON.stringify(e)}});return t.from_apps_list=!0,t}catch(r){return console.log(r),null}}},{key:"addItemsToStorage",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var n,i=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.appProcessor.getApp(t);case 2:return(n=e.sent)&&(r.forEach(function(e){n.items_list.push(e),n.items_object[e.item_id]={};for(var r=0;r<e.fields.length;r++)n.items_object[e.item_id][e.fields[r].field_id]=e.fields[r];i.pipeService.emit("gh_item_update",{app_id:t},[e])}),this.pipeService.emit("gh_items_update",{app_id:t},n.items_list),this.storage.updateApp(n)),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"updateItemsInStorage",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var n,i=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.pipeService.emit("gh_items_update",{app_id:t},r),e.next=3,this.appProcessor.getApp(t);case 3:return(n=e.sent)&&r&&r.forEach(function(e){var r={app_id:t};i.pipeService.emit("gh_item_update",r,[e]),r.item_id=e.item_id,i.pipeService.emit("gh_item_update",r,e);var a=n.items_list.find(function(t){return t.item_id==e.item_id});a&&e.fields.forEach(function(e){var t=a.fields.find(function(t){return t.field_id==e.field_id});r.field_id=e.field_id,t?t.field_value!=e.field_value&&(t.field_value=e.field_value,n.items_object[a.item_id][t.field_id]=t,i.pipeService.emit("gh_value_update",r,e.field_value)):(a.fields.push(e),i.pipeService.emit("gh_value_update",r,e.field_value))})}),e.abrupt("return",r);case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"deleteItemsFromStorage",value:function(){var e=a(regeneratorRuntime.mark(function e(t){var r,n,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:[],e.next=3,this.appProcessor.getApp(t);case 3:(n=e.sent)&&(n.items_list=n.items_list.filter(function(e){return!r.find(function(t){return e.item_id==t.item_id})||(delete n.items_object[e.item_id],!1)}),this.pipeService.emit("gh_items_update",{app_id:t},n.items_list),this.storage.updateApp(n));case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getItems",value:function(){var e=a(regeneratorRuntime.mark(function e(t){var r,n,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]&&i[1],e.next=3,this.appProcessor.getApp(t,r);case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return",null);case 6:return e.abrupt("return",n.items_list);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(){var t=a(regeneratorRuntime.mark(function t(n,i){var a,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=i.map(function(t){return r(r({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.next=3,this.addItemsApi(n,a);case 3:return s=t.sent,t.next=6,this.addItemsToStorage(n,s);case 6:return this.pipeService.emit("gh_items_add",{app_id:n},s),t.abrupt("return",s);case 8:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"updateItems",value:function(){var t=a(regeneratorRuntime.mark(function t(n,i){var a,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=i.map(function(t){return r(r({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.next=3,this.updateItemsApi(n,a);case 3:return s=t.sent,t.next=6,this.updateItemsInStorage(n,s);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItems",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.deleteItemsApi(r).then(function(){var e=a(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.deleteItemsFromStorage(t,r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"itemListeners",value:function(){var e=this;this.pipeService.onRoot("gh_items_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n||!n.app_id){t.next=5;break}return t.next=3,e.getItems(n.app_id);case 3:(i=t.sent)?e.pipeService.emit("gh_items_get",n,i):e.pipeService.emit("gh_items_get",n,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_add",{},function(){var t=a(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n&&n.app_id&&n.items)){t.next=5;break}return t.next=3,e.addNewItems(n.app_id,n.items);case 3:(i=t.sent)?e.pipeService.emit("gh_items_add",n,i):e.pipeService.emit("gh_items_add",n,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_update",{},function(){var t=a(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n&&n.app_id&&n.items)){t.next=5;break}return t.next=3,e.updateItems(n.app_id,n.items);case 3:(i=t.sent)?e.pipeService.emit("gh_items_update",n,i):e.pipeService.emit("gh_items_update",n,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_item_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,n){var i,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n||!n.app_id){t.next=6;break}return t.next=3,e.getItems(n.app_id);case 3:i=t.sent,a=i.find(function(e){return e.item_id==n.item_id}),e.pipeService.emit("gh_item_get",n,a);case 6:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filtered_items_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,n){var i,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n||!n.element_app_id){t.next=8;break}return t.next=3,e.getItems(n.element_app_id);case 3:return i=t.sent,t.next=6,e.util.getFilteredItems(i,n.filters_list,n.element_app_id,n.app_id,n.item_id,n.field_groupe,n.search,n.search_params);case 6:a=t.sent,e.pipeService.emit("gh_filtered_items_get",n,a);case 8:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filter_items",{},function(){var t=a(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n||!n.items){t.next=5;break}return t.next=3,e.util.getFilteredItems(n.items,n.filters_list,n.element_app_id,n.app_id,n.item_id,n.field_groupe,n.search,n.search_params);case 3:i=t.sent,e.pipeService.emit("gh_filter_items",n,i);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())}}]),t}();exports.ItemProcessor=o;
|
|
193
195
|
},{"../utils.js":"EgeI"}],"PoPF":[function(require,module,exports) {
|