@gudhub/core 1.1.94 → 1.1.95
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.
|
@@ -8,7 +8,8 @@ export class AppProcessor {
|
|
|
8
8
|
websocket,
|
|
9
9
|
chunksManager,
|
|
10
10
|
util,
|
|
11
|
-
activateSW
|
|
11
|
+
activateSW,
|
|
12
|
+
// dataService,
|
|
12
13
|
) {
|
|
13
14
|
this.storage = storage;
|
|
14
15
|
this.pipeService = pipeService;
|
|
@@ -19,6 +20,9 @@ export class AppProcessor {
|
|
|
19
20
|
this.chunksManager = chunksManager;
|
|
20
21
|
this.util = util;
|
|
21
22
|
this.appListeners();
|
|
23
|
+
// this.dataService = dataService;
|
|
24
|
+
|
|
25
|
+
this.appRequestCache = new Map;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
async createNewAppApi(app) {
|
|
@@ -75,7 +79,6 @@ export class AppProcessor {
|
|
|
75
79
|
return null;
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
|
-
|
|
79
82
|
async getAppApi(app_id) {
|
|
80
83
|
try {
|
|
81
84
|
const response = await this.req.get({
|
|
@@ -266,39 +269,69 @@ export class AppProcessor {
|
|
|
266
269
|
if (!app_id) return null;
|
|
267
270
|
|
|
268
271
|
let app = this.getAppFromStorage(app_id);
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
272
|
+
if (app) return app;
|
|
273
|
+
|
|
274
|
+
if (this.appRequestCache.has(app_id)) return this.appRequestCache.get(app_id);
|
|
275
|
+
|
|
276
|
+
let self = this;
|
|
277
|
+
|
|
278
|
+
let pr = new Promise(async (resolve, reject) => {
|
|
279
|
+
try {
|
|
280
|
+
// let app = await self.dataService.getApp(app_id);
|
|
281
|
+
const app = await this.getAppApi(app_id);
|
|
282
|
+
if (!app) reject();
|
|
283
|
+
|
|
284
|
+
//!!! temporary check !!!! if app has chanks property then we start getting it
|
|
285
|
+
if (app.chunks && app.chunks.length) {
|
|
286
|
+
// here should be checked is merge required
|
|
287
|
+
|
|
288
|
+
let chunks = await self.chunksManager.getChunks(app_id, app.chunks);
|
|
289
|
+
app.items_list = self.util.mergeChunks([
|
|
290
|
+
...chunks,
|
|
291
|
+
app,
|
|
292
|
+
]);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
let filtered = { ...app };
|
|
296
|
+
|
|
297
|
+
// Removing items from items_list with trash = true and move it to trash_items array
|
|
298
|
+
let newItems = [];
|
|
299
|
+
let trashItems = [];
|
|
300
|
+
if (Array.isArray(app.items_list)) {
|
|
301
|
+
for (let i = 0; i < app.items_list.length; i++) {
|
|
302
|
+
if (!app.items_list[i].trash) {
|
|
303
|
+
newItems.push(app.items_list[i]);
|
|
304
|
+
} else {
|
|
305
|
+
trashItems.push(app.items_list[i]);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
298
308
|
}
|
|
309
|
+
filtered.items_list = newItems;
|
|
310
|
+
filtered.trash_items = trashItems;
|
|
311
|
+
|
|
312
|
+
// Removing fields from field_list with trash = true
|
|
313
|
+
let newFields = [];
|
|
314
|
+
if (Array.isArray(app.field_list)) {
|
|
315
|
+
for (let i = 0; i < app.field_list.length; i++) {
|
|
316
|
+
if (!app.field_list[i].trash) {
|
|
317
|
+
newFields.push(app.field_list[i]);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
filtered.field_list = newFields;
|
|
322
|
+
|
|
323
|
+
resolve(filtered);
|
|
324
|
+
|
|
325
|
+
self.saveAppInStorage(filtered);
|
|
326
|
+
self.ws.addSubscription(app_id);
|
|
327
|
+
} catch (error) {
|
|
328
|
+
reject();
|
|
299
329
|
}
|
|
300
|
-
}
|
|
301
|
-
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
self.appRequestCache.set(app_id, pr);
|
|
333
|
+
|
|
334
|
+
return pr;
|
|
302
335
|
}
|
|
303
336
|
|
|
304
337
|
async updateApp(app) {
|
|
@@ -93,22 +93,9 @@ export class Storage {
|
|
|
93
93
|
// }
|
|
94
94
|
|
|
95
95
|
updateApp(newApp) {
|
|
96
|
-
this.apps_list = this.apps_list.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const items = updatedApp.items_list || [];
|
|
100
|
-
|
|
101
|
-
const trashItems = items.filter(item => item.trash == true);
|
|
102
|
-
const nonTrashItems = items.filter(item => item.trash == false);
|
|
103
|
-
|
|
104
|
-
updatedApp.items_list = nonTrashItems;
|
|
105
|
-
updatedApp.trash_items = trashItems;
|
|
106
|
-
|
|
107
|
-
acc.push(updatedApp);
|
|
108
|
-
|
|
109
|
-
return acc;
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
96
|
+
this.apps_list = this.apps_list.map((app) =>
|
|
97
|
+
app.app_id == newApp.app_id ? newApp : app
|
|
98
|
+
);
|
|
112
99
|
return this.apps_list;
|
|
113
100
|
}
|
|
114
101
|
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -167,7 +167,7 @@ var t=arguments[3],e="function"==typeof Map&&Map.prototype,r=Object.getOwnProper
|
|
|
167
167
|
},{"./utils.js":"Lc8J"}],"FJWL":[function(require,module,exports) {
|
|
168
168
|
"use strict";function e(e,t,a){return[{data_type:"text",name:"Text",icon:"text_icon",url:t+"/"+e+"text_data.js",type:"gh_element",technology:"angular"},{data_type:"text_opt",name:"Options",icon:"option_gh_element",url:t+"/"+e+"text_options_data.js",type:"gh_element",technology:"angular"},{data_type:"number",name:"Number",icon:"number",url:t+"/"+e+"number_data.js",type:"gh_element",technology:"angular"},{data_type:"task_board",name:"Task Board",icon:"task_board",url:t+"/"+e+"task_board_data.js",type:"gh_element",technology:"angular"},{data_type:"visualizer",name:"visualizer",icon:"visualizer",url:t+"/"+e+"visualizer_data.js",type:"gh_element",technology:"angular"},{data_type:"enterprice_visualizer",name:"Enterprice Visualizer",icon:"visualizer",private:!0,url:t+"/"+e+"enterprice_visualizer_data.js",type:"gh_element",technology:"angular"},{data_type:"email",name:"Email",icon:"email",url:t+"/"+e+"email_data.js",type:"gh_element",technology:"angular"},{data_type:"date",name:"Date",icon:"date_gh_element",url:t+"/"+e+"date_data.js",type:"gh_element",technology:"angular"},{data_type:"radio_button",name:"Radio Button",icon:"radio_button_gh_element",url:t+"/"+e+"radio_button_data.js",type:"gh_element",technology:"angular"},{data_type:"radio_icon",name:"Radio icon",icon:"radio_icon_gh_element",url:t+"/"+e+"radio_icon_data.js",type:"gh_element",technology:"angular"},{data_type:"twilio_phone",name:"Twilio Phone",icon:"phone_twilio_gh_element",url:t+"/"+e+"twilio_phone_data.js",type:"gh_element",technology:"angular"},{data_type:"twilio_autodialer",name:"Twilio Auto Dialer",icon:"twilio_dialer",url:t+"/"+e+"twillio_autodialer_data.js",type:"gh_element",technology:"angular"},{data_type:"color",name:"Color",icon:"paint_gh_element",url:t+"/"+e+"color_data.js",type:"gh_element",technology:"angular"},{data_type:"charts",name:"Charts",icon:"graph_gh_element",url:t+"/"+e+"charts_data.js",type:"gh_element",technology:"angular"},{data_type:"funnel_chart",name:"Funnel chart",icon:"funnel_chart_gh_element",url:t+"/"+e+"funnel_chart_data.js",type:"gh_element",technology:"angular"},{data_type:"add_items_from_template",name:"Add items from template",icon:"contact_second",url:t+"/"+e+"add_items_from_template_data.js",type:"gh_element",technology:"angular"},{data_type:"item_ref",name:"Reference",icon:"reference",url:t+"/"+e+"itemRef_data.js",type:"gh_element",technology:"angular"},{data_type:"calendar",name:"Calendar",icon:"calendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js?t=6",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css?t=1",type:"gh_element",technology:"class"},{data_type:"data_ref",name:"Data Reference",icon:"data_reference",url:t+"/"+e+"data_ref_data.js",type:"gh_element",technology:"angular"},{data_type:"table",name:"Table",icon:"table",url:t+"/"+e+"table_data.js",type:"gh_element",technology:"angular"},{data_type:"tile",name:"Tile table",icon:"tile_table",url:t+"/"+e+"tile_data.js",type:"gh_element",technology:"angular"},{data_type:"file",name:"File",icon:"box",url:t+"/"+e+"file_data.js",type:"gh_element",technology:"angular"},{data_type:"image",name:"Image",icon:"image",url:t+"/"+e+"image_data.js",type:"gh_element",technology:"angular"},{data_type:"text_editor",name:"Text Editor",icon:"square",url:t+"/"+e+"text_editor_data.js",type:"gh_element",technology:"angular"},{data_type:"tinymse",name:"Text editor MSE",icon:"tag",url:t+"/"+e+"tinymse_data.js",type:"gh_element",technology:"angular"},{data_type:"duration",name:"Duration",icon:"number_gh_element",url:t+"/"+e+"duration_data.js",type:"gh_element",technology:"angular"},{data_type:"user",name:"User",icon:"user_gh_element",url:t+"/"+e+"user_data.js",type:"gh_element",technology:"angular"},{data_type:"app",name:"App",icon:"app",url:t+"/"+e+"application_data.js",type:"gh_element",technology:"angular"},{data_type:"field",name:"Field",icon:"field_gh_element",url:t+"/"+e+"field_data.js",type:"gh_element",technology:"angular"},{data_type:"available",name:"Available",icon:"availible_gh_element",url:t+"/"+e+"available_data.js",type:"gh_element",technology:"angular"},{data_type:"view_list",name:"View List",icon:"view_list",url:t+"/"+e+"view_list_data.js",type:"gh_element",technology:"angular"},{data_type:"calculator",name:"Calculator",icon:"calculator",url:t+"/"+e+"calculator_data.js",type:"gh_element",technology:"angular"},{data_type:"string_join",name:"String Joiner",icon:"string_join_gh_element",url:t+"/"+e+"string_joiner_data.js",type:"gh_element",technology:"angular"},{data_type:"signature",name:"Signature",icon:"signature",url:t+"/"+e+"signature_data.js",type:"gh_element",technology:"angular"},{data_type:"sendEmail",name:"Send Email",icon:"send_email_gh_element",url:t+"/"+e+"send_email_data.js",type:"gh_element",technology:"angular"},{data_type:"boolean",name:"Yes/No",icon:"boolen_gh_element",url:t+"/"+e+"boolean_data.js",type:"gh_element",technology:"angular"},{data_type:"product_gallery",name:"Product gallery",icon:"product_gallery",url:t+"/"+e+"product_gallery_data.js",type:"gh_element",technology:"angular"},{data_type:"online_inventory",name:"Online inventory",icon:"slab",url:t+"/"+e+"online_inventory_data.js",type:"gh_element",technology:"angular"},{data_type:"3d_edges",name:"3D Edges",icon:"3d_edges_gh_element",url:t+"/"+e+"3d_edges_data.js",type:"gh_element",technology:"angular"},{data_type:"color_list",name:"Color list",icon:"circular_gh_element",url:t+"/"+e+"color_list_data.js",type:"gh_element",technology:"angular"},{data_type:"go_to_link",name:"Go to Link",icon:"go_to_link",url:t+"/"+e+"go_to_link_data.js",type:"gh_element",technology:"angular"},{data_type:"go_to_view",name:"Go to View",icon:"go_to_view",url:t+"/"+e+"go_to_view_data.js",type:"gh_element",technology:"angular"},{data_type:"range",name:"Range",icon:"range_gh_element",url:t+"/"+e+"range_data.js",type:"gh_element",technology:"angular"},{data_type:"barcode",name:"Barcode",icon:"barcode_gh_element",url:t+"/"+e+"barcode_data.js",type:"gh_element",technology:"angular"},{data_type:"item_remote_add",name:"Item remote add",icon:"remote_add_gh_element",url:t+"/"+e+"item_remote_add_data.js",type:"gh_element",technology:"angular"},{data_type:"item_remote_update",name:"Item remote update",icon:"remote_update_gh_element",url:t+"/"+e+"item_remote_update_data.js",type:"gh_element",technology:"angular"},{data_type:"timeline",name:"Timeline",icon:"timeline",url:t+"/"+e+"timeline_data.js",type:"gh_element",technology:"angular"},{data_type:"delete_item",name:"Delete Item",icon:"rubbish",url:t+"/"+e+"delete_action.js",type:"gh_element",technology:"angular"},{data_type:"print_doc",name:"Print document",icon:"print",url:t+"/"+e+"print_doc_action.js",type:"gh_element",technology:"angular"},{data_type:"open_item",name:"Open Item",icon:"delete",private:!0,url:t+"/"+e+"open_item_action.js",type:"gh_element",technology:"angular"},{data_type:"edit_template",name:"Edit template",icon:"delete",private:!0,url:t+"/"+e+"edit_template_action.js",type:"gh_element",technology:"angular"},{data_type:"open_app",private:!0,name:"Open App",icon:"delete",url:t+"/"+e+"open_app_action.js",type:"gh_element",technology:"angular"},{data_type:"user_settings",private:!0,name:"User Settings",icon:"delete",url:t+"/"+e+"user_settings_action.js",type:"gh_element",technology:"angular"},{data_type:"app_sharing",name:"Sharing",icon:"sharing",url:t+"/"+e+"sharing_action.js",type:"gh_element",technology:"angular"},{data_type:"app_constructor",private:!0,name:"App constructor",icon:"app_constructor",url:t+"/"+e+"app_constructor_action.js",type:"gh_element",technology:"angular"},{data_type:"app_settings",name:"App Settings",icon:"configuration",url:t+"/"+e+"app_settings_action.js",type:"gh_element",technology:"angular"},{data_type:"export_csv",name:"Export CSV",icon:"export_csv",url:t+"/"+e+"export_csv.js",type:"gh_element",technology:"angular"},{data_type:"import_csv",name:"Import CSV",icon:"import_csv",url:t+"/"+e+"import_csv.js",type:"gh_element",technology:"angular"},{data_type:"add_items",name:"Add Items",icon:"plus",url:t+"/"+e+"add_items_action.js",type:"gh_element",technology:"angular"},{data_type:"update_items",name:"Update Items",icon:"update",url:t+"/"+e+"update_items_action.js",type:"gh_element",technology:"angular"},{data_type:"install_app",name:"Install",icon:"install",url:t+"/"+e+"install_app_action.js",type:"gh_element",technology:"angular"},{data_type:"search_action",name:"Search",icon:"search",url:t+"/"+e+"search_action.js",type:"gh_element",technology:"angular"},{data_type:"filter_table",name:"Table filter",icon:"filter",url:t+"/"+e+"filter_table_action.js",type:"gh_element",technology:"angular"},{data_type:"slider",name:"Slider",icon:"slider",url:t+"/"+e+"slider_data.js",type:"gh_element",technology:"angular"},{data_type:"clone_item",name:"Clone Item",icon:"double_plus",url:t+"/"+e+"clone_item_action.js",type:"gh_element",technology:"angular"},{data_type:"close",name:"Close",icon:"cross",url:t+"/"+e+"close_action.js",type:"gh_element",technology:"angular"},{data_type:"phone",name:"Phone",icon:"phone_thin",url:t+"/"+e+"phone_data.js",type:"gh_element",technology:"angular"},{data_type:"link",name:"Link",icon:"link_gh_element",url:t+"/"+e+"link_data.js",type:"gh_element",technology:"angular"},{data_type:"sheduling",name:"Sheduling",icon:"scheduling",url:t+"/"+e+"sheduling_data.js",type:"gh_element",technology:"angular"},{data_type:"qrcode",name:"QR Code",icon:"qr_code",url:t+"/"+e+"qrcode_data.js",type:"gh_element",technology:"angular"},{data_type:"graph2d",name:"Graph",icon:"graph",url:t+"/"+e+"graph2d_data.js",type:"gh_element",technology:"angular"},{data_type:"quote_tool",name:"Quote tool",icon:"quoters",url:t+"/"+e+"quote_tool_data.js",type:"gh_element",technology:"angular"},{data_type:"cards",name:"Cards",icon:"cards",url:t+"/"+e+"cards_data.js",type:"gh_element",technology:"angular"},{data_type:"jsonConstructor",name:"Json Constructor",icon:"button",url:t+"/"+e+"json_constructor_data.js",type:"gh_element",technology:"angular"},{data_type:"button",name:"Button",icon:"button",js:"https://gudhub.com/modules/button_action/button_action.js?t=1",type:"gh_element",technology:"class"},{data_type:"editorjs",name:"EditorJS",icon:"code_editor",js:"https://gudhub.com/modules/Editor-Js/dist/main.js?t=2",css:"https://gudhub.com/modules/Editor-Js/dist/style.css?t=2",type:"gh_element",technology:"class"},{data_type:"filter_advanced",name:"Filter Advanced",icon:"filter_advanced",url:t+"/"+e+"filter_advanced_data.js",type:"gh_element",technology:"angular"},{data_type:"code_editor",name:"Code Editor",icon:"code_editor",url:t+"/"+e+"code_editor_data.js",type:"gh_element",technology:"angular"},{data_type:"icon",name:"Icon",icon:"icon_gh_element",url:t+"/"+e+"icon_data.js",type:"gh_element",technology:"angular"},{data_type:"quoteRequest",name:"Quote Request",icon:"invoices",url:t+"/"+e+"quote_request_data.js",type:"gh_element",technology:"angular"},{data_type:"view_container",name:"View Container",icon:"pencil",url:t+"/"+e+"view_container_data.js",type:"gh_element",technology:"angular"},{data_type:"element_ref",name:"Element Reference",icon:"cloudSync_gh_element",url:t+"/"+e+"element_ref_data.js",type:"gh_element",technology:"angular"},{data_type:"quote_tool_objects_renderer",name:"Quote Tool Renderer",icon:"l_counter",url:t+"/"+e+"quote_tool_objects_renderer_data.js",type:"gh_element",technology:"angular"},{data_type:"quote_tool_objects_renderer_generator",name:"Quote Tool Parts Generator",icon:"l_counter_arrow",url:t+"/"+e+"quote_tool_objects_renderer_generator_data.js",type:"gh_element",technology:"angular"},{data_type:"trigger",name:"Trigger",icon:"job",url:t+"/"+e+"trigger_data.js",type:"gh_element",technology:"angular"},{data_type:"voting",name:"Voting",icon:"like_gh_element",url:t+"/"+e+"voting_data.js",type:"gh_element",technology:"angular"},{data_type:"view_tabs",name:"View Tab",icon:"tabs",url:t+"/"+e+"view_tabs.js",type:"gh_element",technology:"angular"},{data_type:"filter_tabs",name:"Filter Tabs",icon:"filter_tabs_gh_element",url:t+"/"+e+"filter_tabs.js",type:"gh_element",technology:"angular"},{data_type:"gps_coords",name:"GPS Coords",icon:"location_gh_element",url:t+"/"+e+"gps_coords.js",type:"gh_element",technology:"angular"},{data_type:"google_map",name:"Google Map",icon:"location",url:t+"/"+e+"google_map_data.js",type:"gh_element",technology:"angular"},{data_type:"data_migrations",name:"Data migrations",icon:"view_list_gh_element",url:t+"/"+e+"data_migrations.js",type:"gh_element",technology:"angular"},{data_type:"additional_settings",name:"Additional Settings",icon:"",private:!0,url:t+"/"+e+"gh_additional_settings_data.js",type:"gh_element",technology:"angular"},{data_type:"send_request",name:"Send Request",icon:"send_request_gh_element",url:t+"/"+e+"send_request_data.js",type:"gh_element",technology:"angular"},{data_type:"webcam",name:"Web camera",icon:"webcam_gh_element",url:t+"/"+e+"webcam_data.js",type:"gh_element",technology:"angular"},{data_type:"json_viewer",name:"JSON viewer",icon:"json_gh_element",url:t+"/"+e+"json_viewer_data.js",type:"gh_element",technology:"angular"},{data_type:"notifications",name:"Notifications",icon:"full_gh_element",url:t+"/"+e+"notifications_data.js",type:"gh_element",technology:"angular"},{data_type:"api",name:"API",icon:"job",url:t+"/"+e+"api_data.js",type:"gh_element",technology:"angular"},{data_type:"external_function",name:"External Function",icon:"automation_external_function",url:t+"/"+e+"external_function_data.js",type:"gh_element",technology:"angular"},{data_type:"smart_input",name:"Smart Input",icon:"roket",url:t+"/"+e+"smart_input_data.js",type:"gh_element",technology:"angular"},{data_type:"json_editor",name:"JSON Editor",icon:"code",url:t+"/"+e+"json_editor_data.js",type:"gh_element",technology:"angular"},{data_type:"grapes_html_editor",name:"Grapes Html Editor",icon:"code_editor",url:t+"/"+e+"grapes_html_editor_data.js",type:"gh_element",technology:"angular"},{data_type:"quiz",name:"Quiz",icon:"quiz_gh_element",url:t+"/"+e+"quiz_data.js",type:"gh_element",technology:"angular"},{data_type:"password_input",name:"Password",icon:"lock_gh_element",url:t+"/"+e+"password_input_data.js",type:"gh_element",technology:"angular"},{data_type:"vs_code",name:"VS Code",icon:"code_editor",url:t+"/"+e+"vs_code_data.js",type:"gh_element",technology:"angular"},{data_type:"nested_list",name:"Nested List",icon:"scheduling",js:"https://gudhub.com/modules/Nested-List/dist/main.js?t=2",css:"https://gudhub.com/modules/Nested-List/dist/style.css?t=2",type:"gh_element",technology:"class"},{data_type:"countertop_smart_quote",name:"Countertop Smart Quote",icon:"quoters",url:t+"/"+e+"countertop_smart_quote_data.js",type:"gh_element",technology:"angular"},{data_type:"markdown_viewer",name:"Markdown viewer",icon:"code_editor",js:"https://gudhub.com/modules/markdown-it-gh-element/dist/main.js?t=1",css:"https://gudhub.com/modules/markdown-it-gh-element/dist/style.css?t=1",type:"gh_element",technology:"class"},{data_type:"html_viewer",name:"HTML Viewer",icon:"code_editor",js:"https://gudhub.com/modules/HTML-Viewer/dist/main.js?t=1",css:"https://gudhub.com/modules/HTML-Viewer/dist/style.css?t=1",type:"gh_element",technology:"class"},{data_type:"element_customizer",name:"Element Customizer",icon:"pencil",url:t+"/"+e+"element_customizer_data.js",type:"gh_element",technology:"angular"},{data_type:"task",name:"Task",icon:"table",url:t+"/"+e+"task_data.js",type:"gh_element",technology:"angular"},{data_type:"cron_picker",name:"Cron Picker",icon:"table",js:"https://gudhub.com/modules/Cron-Picker/dist/main.js?t=2",css:"https://gudhub.com/modules/Cron-Picker/dist/style.css?t=2",type:"gh_element",technology:"class"},{data_type:"balance_sheet",name:"Balance Sheet",icon:"table",js:"https://gudhub.com/modules/balance-sheet/dist/main.js?t=2",css:"https://gudhub.com/modules/balance-sheet/dist/style.css?t=2",type:"gh_element",technology:"class"},{data_type:"quote_form",name:"Quote Form",icon:"table",js:"https://gudhub.com/modules/countertop-quote-form/dist/main.js",css:"https://gudhub.com/modules/countertop-quote-form/dist/style.css",type:"gh_element",technology:"class"},{data_type:"static_nested_list",name:"Nested Filter",icon:"scheduling",js:"https://gudhub.com/modules/nested-filter/dist/main.js?t=1",css:"https://gudhub.com/modules/nested-filter/dist/style.css?t=1",type:"gh_element",technology:"class"},{data_type:"conversations",name:"Conversations",icon:"timeline",js:"https://gudhub.com/modules/conversation/dist/main.js?t=1",css:"https://gudhub.com/modules/conversation/dist/style.css?t=1",type:"gh_element",technology:"class"},{data_type:"study_journal",name:"Study Journal",icon:"timeline",js:"https://gudhub.com/modules/Study-Journal/dist/main.js?t=1",css:"https://gudhub.com/modules/Study-Journal/dist/style.css",type:"gh_element",technology:"class"},{data_type:"study_schedule",name:"Study Schedule",icon:"timeline",js:"https://gudhub.com/modules/Study-Schedule/dist/main.js?t=1",css:"https://gudhub.com/modules/Study-Schedule/dist/style.css?t=1",type:"gh_element",technology:"class"},{data_type:"avatar",name:"Avatar",icon:"user",js:"https://gudhub.com/modules/Gh-Avatar/dist/main.js?t=1",css:"https://gudhub.com/modules/Gh-Avatar/dist/style.css?t=1",type:"gh_element",technology:"class"},{data_type:"text_area",name:"Text Area",icon:"text_icon",js:"https://gudhub.com/modules/text-area-ghe/dist/main.js?t=3",css:"https://gudhub.com/modules/text-area-ghe/dist/style.css",type:"gh_element",technology:"class"},{data_type:"resource_calendar",name:"Resource Сalendar",icon:"calendar",url:t+"/"+e+"resource_calendar_data.js",type:"gh_element",technology:"angular"},{data_type:"visualizer_with_control_panel",name:"Visualizer With Control Panel",icon:"visualizer",url:t+"/"+e+"visualizer_with_control_panel_data.js",type:"gh_element",technology:"angular"},{data_type:"svg_to_pdf",name:"SVG To PDF",icon:"box",js:"https://gudhub.com/modules/SVG-to-PDF-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/SVG-to-PDF-Gh-Element/dist/style.css",type:"gh_element",technology:"class"},{data_type:"recycle_bin",name:"Recycle Bin",icon:"recycle_bin",url:t+"/"+e+"recycle_bin_data.js",type:"gh_element",technology:"angular"},{data_type:"API",name:"API",url:t+"/"+a+"api_node.js",type:"automation",icon:"automation_api",private:!0},{data_type:"ExternalFunction",name:"External Function",url:t+"/"+a+"external_function_node.js",type:"automation",icon:"automation_external_function"},{data_type:"Function",name:"Function",url:t+"/"+a+"function_node.js",type:"automation",icon:"automation_function",private:!0},{data_type:"Return",name:"Return",url:t+"/"+a+"return_node.js",type:"automation",icon:"automation_return",private:!0},{data_type:"ChatGPTThread",name:"ChatGPT Thread",url:t+"/"+a+"chat_gpt_thread_node.js",type:"automation",icon:"automation_chat_gpt_thread"},{data_type:"Calculator",name:"Calculator",url:t+"/"+a+"calculator.js",type:"automation",icon:"automation_calculator"},{data_type:"CompareItems",name:"Compare Items",url:t+"/"+a+"compare_items.js",type:"automation",icon:"automation_compare_items"},{data_type:"Constants",name:"Constants",url:t+"/"+a+"constants.js",type:"automation",icon:"automation_constants"},{data_type:"CreateFiles",name:"Create Files",url:t+"/"+a+"create_files.js",type:"automation",icon:"automation_create_files"},{data_type:"CreateItemsApi",name:"Create Items Api",url:t+"/"+a+"create_item_api.js",type:"automation",icon:"automation_create_items_api"},{data_type:"FileDuplicate",name:"File Duplicate",url:t+"/"+a+"file_duplicate.js",type:"automation",icon:"automation_file_duplicate"},{data_type:"Filter",name:"Filter",url:t+"/"+a+"filter_node.js",type:"automation",icon:"filter"},{data_type:"GetItemByItemRef",name:"Get Item By Item Ref",url:t+"/"+a+"get_item_by_item_ref.js",type:"automation",icon:"automation_get_item_by_item_ref"},{data_type:"GetItems",name:"Get Items",url:t+"/"+a+"get_items.js",type:"automation",icon:"automation_get_items"},{data_type:"GhElementNode",name:"Gh Element Node",url:t+"/"+a+"gh_element_node.js",type:"automation",icon:"automation_gh_element_node",private:!0,created_for:["GhElement"]},{data_type:"IfCondition",name:"If Condition",url:t+"/"+a+"if_condition.js",type:"automation",icon:"automation_if_condition"},{data_type:"ItemConstructor",name:"Item Constructor",url:t+"/"+a+"item_constructor.js",type:"automation",icon:"automation_item_constructor"},{data_type:"ItemDestructor",name:"Item Destructor",url:t+"/"+a+"item_destructor.js",type:"automation",icon:"automation_item_destructor"},{data_type:"JSONScheme",name:"JSON Scheme",url:t+"/"+a+"json_scheme.js",type:"automation",icon:"automation_json_scheme"},{data_type:"MergeItems",name:"Merge Items",url:t+"/"+a+"merge_items.js",type:"automation",icon:"automation_merge_items"},{data_type:"MessageConstructor",name:"Message Constructor",url:t+"/"+a+"message_constructor.js",type:"automation",icon:"automation_message_constructor"},{data_type:"ObjectToItem",name:"Object To Item",url:t+"/"+a+"obj_to_item.js",type:"automation",icon:"automation_object_to_item"},{data_type:"ObjectConstructor",name:"Object Constructor",url:t+"/"+a+"object_constructor.js",type:"automation",icon:"automation_object_constructor"},{data_type:"ObjectDestructor",name:"Object Destructor",url:t+"/"+a+"object_destructor.js",type:"automation",icon:"automation_object_destructor"},{data_type:"PopulateElement",name:"Populate Element",url:t+"/"+a+"populate_element.js",type:"automation",icon:"automation_populate_element",private:!0,created_for:["GhElement"]},{data_type:"PopulateItems",name:"Populate Items",url:t+"/"+a+"populate_items.js",type:"automation",icon:"automation_populate_items"},{data_type:"PopulateWithDate",name:"Populate With Date",url:t+"/"+a+"populate_with_date.js",type:"automation",icon:"automation_populate_with_date"},{data_type:"PopulateWithItemRef",name:"Populate with Item Ref",url:t+"/"+a+"populate_with_item_ref.js",type:"automation",icon:"automation_populate_with_item_ref"},{data_type:"PopUpForm",name:"Pop Up Form",url:t+"/"+a+"popup_form.js",type:"automation",icon:"automation_pop_up_form",private:!0,created_for:["Quiz","GhElement","SmartInput","Iterator"]},{data_type:"QuizForm",name:"Quiz Form",url:t+"/"+a+"quiz_form.js",type:"automation",icon:"automation_quiz_form",private:!0,created_for:["Quiz"]},{data_type:"QuizNode",name:"Quiz Node",url:t+"/"+a+"quiz_node.js",type:"automation",icon:"automation_quiz_node",private:!0},{data_type:"Request",name:"Request",url:t+"/"+a+"request_node.js",type:"automation",icon:"automation_request"},{data_type:"Response",name:"Response",url:t+"/"+a+"response_node.js",type:"automation",icon:"automation_response",private:!0,created_for:["API"]},{data_type:"SmartInput",name:"Smart Input",url:t+"/"+a+"smart_input.js",type:"automation",icon:"automation_smart_input",private:!0},{data_type:"Trigger",name:"Trigger",url:t+"/"+a+"trigger_node.js",type:"automation",icon:"automation_trigger",private:!0},{data_type:"TwilioSMS",name:"Twilio SMS",url:t+"/"+a+"twilio_sms.js",type:"automation",icon:"automation_twilio"},{data_type:"TwilioAuth",name:"Twilio Auth",url:t+"/"+a+"twilio_auth.js",type:"automation",icon:"table"},{data_type:"TwilioDevice",name:"Twilio Device",url:t+"/"+a+"twilio_device.js",type:"automation",icon:"table"},{data_type:"UpdateItemsApi",name:"Update Items Api",url:t+"/"+a+"update_items_api.js",type:"automation",icon:"automation_update_items_api"},{data_type:"GoogleCalendar",name:"Google Calendar",url:t+"/"+a+"google_calendar.js",type:"automation",icon:"calendar"},{data_type:"VerifyEmail",name:"Verify email",url:t+"/"+a+"verify_email.js",type:"automation",icon:"check_in_circle"},{data_type:"Iterator",name:"Iterator",url:t+"/"+a+"iterator.js",type:"automation",icon:"update"},{data_type:"IteratorInput",name:"Iterator Input",url:t+"/"+a+"iterator_input.js",type:"automation",icon:"arrow_right",private:!0},{data_type:"IteratorOutput",name:"Iterator Output",url:t+"/"+a+"iterator_output.js",type:"automation",icon:"arrow_right",private:!0},{data_type:"SendEmail",name:"Send email",url:t+"/"+a+"send_email.js",type:"automation",icon:"email"},{data_type:"FileReader",name:"File Reader",url:t+"/"+a+"file_reader.js",type:"automation",icon:"file"},{data_type:"WebsitesChecker",name:"Websites Checker",url:t+"/"+a+"websites_checker.js",type:"automation",icon:"world"},{data_type:"VoiceMachineDetection",name:"Voice Machine Detection",url:t+"/"+a+"voice_machine_detection.js",type:"automation",icon:"automation_calculator"},{data_type:"Task",name:"Task",url:t+"/"+a+"task.js",type:"automation",icon:"automation_calculator",private:!0},{data_type:"DeleteItems",name:"Delete Items",url:t+"/"+a+"delete_items.js",type:"automation",icon:"rubbish"},{data_type:"GoToItem",name:"Go To Item",url:t+"/"+a+"go_to_item.js",type:"automation",icon:"cursor_point"},{data_type:"FireWorks",name:"Fire Works",url:t+"/"+a+"fireworks_node.js",type:"automation",icon:"weeding_party"},{data_type:"SendMessage",name:"Send Message",url:t+"/"+a+"send_message.js",type:"automation",icon:"speech_bubble"},{data_type:"TurboSMS",name:"Turbo SMS",url:t+"/"+a+"turbo_sms.js",type:"automation",icon:"email"},{data_type:"JsCode",name:"Js Code",url:t+"/"+a+"js_code.js",type:"automation",icon:"code_editor"}]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
|
|
169
169
|
},{}],"CSHe":[function(require,module,exports) {
|
|
170
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Storage=void 0;var t=e(require("./ModulesList.js"));function e(t){return t&&t.__esModule?t:{default:t}}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return s(t)||u(t)||o(t)||i()}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function u(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(t){if(Array.isArray(t))return a(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var a=n&&n.prototype instanceof s?n:s,c=Object.create(a.prototype);return p(c,"_invoke",function(r,n,i){var o,s,a,c=0,p=i||[],f=!1,l={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return o=e,s=0,a=t,l.n=r,u}};function y(r,n){for(s=r,a=n,e=0;!f&&c&&!i&&e<p.length;e++){var i,o=p[e],y=l.p,
|
|
170
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Storage=void 0;var t=e(require("./ModulesList.js"));function e(t){return t&&t.__esModule?t:{default:t}}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return s(t)||u(t)||o(t)||i()}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function u(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(t){if(Array.isArray(t))return a(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var a=n&&n.prototype instanceof s?n:s,c=Object.create(a.prototype);return p(c,"_invoke",function(r,n,i){var o,s,a,c=0,p=i||[],f=!1,l={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return o=e,s=0,a=t,l.n=r,u}};function y(r,n){for(s=r,a=n,e=0;!f&&c&&!i&&e<p.length;e++){var i,o=p[e],y=l.p,v=o[2];r>3?(i=v===n)&&(a=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=y&&((i=r<2&&y<o[1])?(s=0,l.v=n,l.n=o[1]):y<v&&(i=r<3||o[0]>n||n>v)&&(o[4]=r,o[5]=n,l.n=v,s=0))}if(i||r>1)return u;throw f=!0,n}return function(i,p,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===p&&y(p,v),s=p,a=v;(e=s<2?t:a)||!f;){o||(s?s<3?(s>1&&(l.n=-1),y(s,a)):l.n=a:l.v=a);try{if(c=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(a=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(f=l.n<0)?a:r.call(n,l))!==u)break}catch(e){o=t,s=1,a=e}finally{c=1}}return{value:e,done:f}}}(r,i,o),!0),c}var u={};function s(){}function a(){}function f(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(p(e={},n,function(){return this}),e),y=f.prototype=s.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,p(t,i,"GeneratorFunction")),t.prototype=Object.create(y),t}return a.prototype=f,p(y,"constructor",f),p(f,"constructor",a),a.displayName="GeneratorFunction",p(f,i,"GeneratorFunction"),p(y),p(y,i,"Generator"),p(y,n,function(){return this}),p(y,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:v}})()}function p(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(p=function(t,e,r,n){if(e)i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r;else{var o=function(e,r){p(t,e,function(t){return this._invoke(e,r,t)})};o("next",0),o("throw",1),o("return",2)}})(t,e,r,n)}function f(t,e,r,n,i,o,u){try{var s=t[o](u),a=s.value}catch(t){return void r(t)}s.done?e(a):Promise.resolve(a).then(n,i)}function l(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function u(t){f(o,n,i,u,s,"next",t)}function s(t){f(o,n,i,u,s,"throw",t)}u(void 0)})}}function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function v(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function h(t,e,r){return(e=_(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_(n.key),n)}}function b(t,e,r){return e&&m(t.prototype,e),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _(t){var e=g(t,"string");return"symbol"==r(e)?e:e+""}function g(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var O=exports.Storage=function(){return b(function e(r,n,i){d(this,e),this.apps_list=[],this.users_list=[],this.user={},this.modulesList=(0,t.default)(r,n,i),this.ghComponentsPromises=[]},[{key:"getMainStorage",value:function(){return this}},{key:"getAppsList",value:function(){return this.apps_list}},{key:"getUser",value:function(){return this.user}},{key:"getUsersList",value:function(){return this.users_list}},{key:"getModulesList",value:function(t,e,r){return void 0===t?this.modulesList:0==e?this.modulesList.filter(function(e){return e.created_for?e.type===t&&e.private&&e.created_for.includes(r):e.type===t&&!e.private}):this.modulesList.filter(function(e){return e.type===t})}},{key:"getModuleUrl",value:function(t){return this.modulesList.find(function(e){return e.data_type==t})}},{key:"setUser",value:function(t){this.user=t,this.users_list.push(t)}},{key:"updateUser",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.avatar_128&&(t.avatar_128=t.avatar_128+"?"+(new Date).getTime()),t.avatar_512&&(t.avatar_512=t.avatar_512+"?"+(new Date).getTime()),this.user=v(v({},this.user),t),this.users_list=this.users_list.filter(function(e){return e.user_id!=t.user_id}),this.users_list.push(this.user)}},{key:"unsetUser",value:function(){this.user={}}},{key:"getApp",value:function(t){for(var e=0;e<this.apps_list.length;e++)if(this.apps_list[e].app_id==t)return this.apps_list[e]}},{key:"unsetApps",value:function(){this.apps_list=[]}},{key:"updateApp",value:function(t){return this.apps_list=this.apps_list.map(function(e){return e.app_id==t.app_id?t:e}),this.apps_list}},{key:"deleteApp",value:function(t){return this.apps_list=this.apps_list.filter(function(e){return e.app_id!=t}),this.apps_list}},{key:"updateItemsInApp",value:function(){var t=l(c().m(function t(e,r){var n;return c().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getApp(r);case 1:return(n=t.v)&&(n.items_list=updateItems(e,n.items_list,this.pipeService.emit.bind(this.pipeService),r),this.updateApp(n)),t.a(2,n)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"addItemsToApp",value:function(){var t=l(c().m(function t(e,r){var i,o;return c().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getApp(r);case 1:return(i=t.v)&&((o=i.items_list).push.apply(o,n(e)),this.updateApp(i),this.pipeService.emit("gh_items_update",{app_id:r},e)),t.a(2,i)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItemsInApp",value:function(){var t=l(c().m(function t(e,r){var n;return c().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getApp(r);case 1:return(n=t.v)&&(n.items_list=n.items_list.filter(function(t){return!e.find(function(e){return e.item_id==t.item_id})}),this.updateApp(n)),t.a(2,n)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()}])}();
|
|
171
171
|
},{"./ModulesList.js":"FJWL"}],"p58b":[function(require,module,exports) {
|
|
172
172
|
"use strict";module.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")};
|
|
173
173
|
},{}],"pHMV":[function(require,module,exports) {
|
|
@@ -262,7 +262,7 @@ var t=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
|
262
262
|
},{"axios":"O4Aa","./../consts.js":"UV2u"}],"Htuh":[function(require,module,exports) {
|
|
263
263
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GHConstructor=void 0;var t=n(require("./createAngularModuleInstance.js")),e=n(require("./createClassInstance.js"));function n(t){return t&&t.__esModule?t:{default:t}}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,o,i){var a=r&&r.prototype instanceof s?r:s,f=Object.create(a.prototype);return u(f,"_invoke",function(n,r,o){var u,i,a,s=0,f=o||[],l=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return u=e,i=0,a=t,h.n=n,c}};function y(n,r){for(i=n,a=r,e=0;!l&&s&&!o&&e<f.length;e++){var o,u=f[e],y=h.p,p=u[2];n>3?(o=p===r)&&(a=u[(i=u[4])?5:(i=3,3)],u[4]=u[5]=t):u[0]<=y&&((o=n<2&&y<u[1])?(i=0,h.v=r,h.n=u[1]):y<p&&(o=n<3||u[0]>r||r>p)&&(u[4]=n,u[5]=r,h.n=p,i=0))}if(o||n>1)return c;throw l=!0,r}return function(o,f,p){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,p),i=f,a=p;(e=i<2?t:a)||!l;){u||(i?i<3?(i>1&&(h.n=-1),y(i,a)):h.n=a:h.v=a);try{if(s=2,u){if(i||(o="next"),e=u[o]){if(!(e=e.call(u,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,i<2&&(i=0)}else 1===i&&(e=u.return)&&e.call(u),i<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),i=1);u=t}else if((e=(l=h.n<0)?a:n.call(r,h))!==c)break}catch(e){u=t,i=1,a=e}finally{s=1}}return{value:e,done:l}}}(n,o,i),!0),f}var c={};function s(){}function f(){}function l(){}e=Object.getPrototypeOf;var h=[][r]?e(e([][r]())):(u(e={},r,function(){return this}),e),y=l.prototype=s.prototype=Object.create(h);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,u(t,i,"GeneratorFunction")),t.prototype=Object.create(y),t}return f.prototype=l,u(y,"constructor",l),u(l,"constructor",f),f.displayName="GeneratorFunction",u(l,i,"GeneratorFunction"),u(y),u(y,i,"Generator"),u(y,r,function(){return this}),u(y,"toString",function(){return"[object Generator]"}),(o=function(){return{w:a,m:p}})()}function u(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}(u=function(t,e,n,r){if(e)o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n;else{var i=function(e,n){u(t,e,function(t){return this._invoke(e,n,t)})};i("next",0),i("throw",1),i("return",2)}})(t,e,n,r)}function i(t,e,n,r,o,u,i){try{var a=t[u](i),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function a(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var u=t.apply(e,n);function a(t){i(u,r,o,a,c,"next",t)}function c(t){i(u,r,o,a,c,"throw",t)}a(void 0)})}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function f(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var e=h(t,"string");return"symbol"==r(e)?e:e+""}function h(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var y=exports.GHConstructor=function(){return f(function t(e){c(this,t),this.gudhub=e,this.cache={},this.modulesQueue={},this.angularInjector,this.nodeWindow},[{key:"getInstance",value:function(){var t=a(o().m(function t(e){return o().w(function(t){for(;;)switch(t.n){case 0:if(!this.getCached(e)){t.n=1;break}return t.a(2,this.getCached(e));case 1:if(!this.modulesQueue[e]){t.n=3;break}return t.n=2,this.modulesQueue[e];case 2:t.n=4;break;case 3:return this.modulesQueue[e]=this.createInstance(e),t.n=4,this.modulesQueue[e];case 4:return t.a(2,this.getCached(e))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"pupToCache",value:function(t,e){this.cache[t]=e}},{key:"getCached",value:function(t){return this.cache[t]}},{key:"initAngularInjector",value:function(t){this.angularInjector=t}},{key:"initJsdomWindow",value:function(t){this.nodeWindow=t}},{key:"createInstance",value:function(){var n=a(o().m(function n(r){var u,i;return o().w(function(n){for(;;)switch(n.n){case 0:if(u=this.gudhub.storage.getModuleUrl(r)){n.n=1;break}return console.log("Cannot find module: ".concat(r)),n.a(2);case 1:if("gh_element"!==u.type){n.n=5;break}if("angular"!==u.technology){n.n=3;break}return n.n=2,(0,t.default)(this.gudhub,r,u.url,this.angularInjector,this.nodeWindow);case 2:i=n.v,n.n=5;break;case 3:if("class"!==u.technology){n.n=5;break}return n.n=4,(0,e.default)(this.gudhub,r,u.js,u.css,this.nodeWindow);case 4:i=n.v;case 5:return i&&this.pupToCache(r,i),n.a(2,i)}},n,this)}));return function(t){return n.apply(this,arguments)}}()}])}();
|
|
264
264
|
},{"./createAngularModuleInstance.js":"osSN","./createClassInstance.js":"DsUm"}],"q0my":[function(require,module,exports) {
|
|
265
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppProcessor=void 0;var t=require("../consts.js");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return a(t)||n(t)||c(t)||i()}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function a(t){if(Array.isArray(t))return f(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach(function(e){s(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function s(t,e,r){return(e=y(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=c(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}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,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return p=t.done,t},e:function(t){o=!0,a=t},f:function(){try{p||null==r.return||r.return()}finally{if(o)throw a}}}}function c(t,e){if(t){if("string"==typeof t)return f(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function l(){var t,e,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var s=i&&i.prototype instanceof o?i:o,u=Object.create(s.prototype);return h(u,"_invoke",function(r,i,n){var a,o,s,u=0,c=n||[],f=!1,l={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,r){return a=e,o=0,s=t,l.n=r,p}};function h(r,i){for(o=r,s=i,e=0;!f&&u&&!n&&e<c.length;e++){var n,a=c[e],h=l.p,v=a[2];r>3?(n=v===i)&&(s=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=t):a[0]<=h&&((n=r<2&&h<a[1])?(o=0,l.v=i,l.n=a[1]):h<v&&(n=r<3||a[0]>i||i>v)&&(a[4]=r,a[5]=i,l.n=v,o=0))}if(n||r>1)return p;throw f=!0,i}return function(n,c,v){if(u>1)throw TypeError("Generator is already running");for(f&&1===c&&h(c,v),o=c,s=v;(e=o<2?t:s)||!f;){a||(o?o<3?(o>1&&(l.n=-1),h(o,s)):l.n=s:l.v=s);try{if(u=2,a){if(o||(n="next"),e=a[n]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,o<2&&(o=0)}else 1===o&&(e=a.return)&&e.call(a),o<2&&(s=TypeError("The iterator does not provide a '"+n+"' method"),o=1);a=t}else if((e=(f=l.n<0)?s:r.call(i,l))!==p)break}catch(e){a=t,o=1,s=e}finally{u=1}}return{value:e,done:f}}}(r,n,a),!0),u}var p={};function o(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][i]?e(e([][i]())):(h(e={},i,function(){return this}),e),f=u.prototype=o.prototype=Object.create(c);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,h(t,n,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=u,h(f,"constructor",u),h(u,"constructor",s),s.displayName="GeneratorFunction",h(u,n,"GeneratorFunction"),h(f),h(f,n,"Generator"),h(f,i,function(){return this}),h(f,"toString",function(){return"[object Generator]"}),(l=function(){return{w:a,m:v}})()}function h(t,e,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}(h=function(t,e,r,i){if(e)n?n(t,e,{value:r,enumerable:!i,configurable:!i,writable:!i}):t[e]=r;else{var a=function(e,r){h(t,e,function(t){return this._invoke(e,r,t)})};a("next",0),a("throw",1),a("return",2)}})(t,e,r,i)}function v(t,e,r,i,n,a,p){try{var o=t[a](p),s=o.value}catch(t){return void r(t)}o.done?e(s):Promise.resolve(s).then(i,n)}function d(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var a=t.apply(e,r);function p(t){v(a,i,n,p,o,"next",t)}function o(t){v(a,i,n,p,o,"throw",t)}p(void 0)})}}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,y(i.key),i)}}function m(t,e,r){return e&&g(t.prototype,e),r&&g(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){var r=w(t,"string");return"symbol"==e(r)?r:r+""}function w(t,r){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}var A=exports.AppProcessor=function(){return m(function t(e,r,i,n,a,p,o){_(this,t),this.storage=e,this.pipeService=r,this.req=i,this.ws=n,this.applistReceived=!1,this.activateSW=o,this.chunksManager=a,this.util=p,this.appListeners()},[{key:"createNewAppApi",value:function(){var t=d(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/create",form:{app:JSON.stringify(e)}});case 1:return(r=t.v).from_apps_list=!0,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppApi",value:function(){var t=d(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/update",form:{app:JSON.stringify(e)}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteAppApi",value:function(){var t=d(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/delete",form:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListApi",value:function(){var t=d(l().m(function t(){var e,r;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/applist/get"});case 1:return e=t.v,t.a(2,e.apps_list.map(function(t){return t.from_apps_list=!0,t}));case 2:return t.p=2,r=t.v,console.log(r),t.a(2,null)}},t,this,[[0,2]])}));return function(){return t.apply(this,arguments)}}()},{key:"getAppApi",value:function(){var t=d(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/app/get",params:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListFromStorage",value:function(){return this.storage.getAppsList()}},{key:"getAppFromStorage",value:function(t){var e=this.storage.getApp(t);return e&&e.field_list.length?e:null}},{key:"addNewAppToStorage",value:function(t){return this.storage.getAppsList().push(t)}},{key:"saveAppInStorage",value:function(t){t.items_object={};for(var e=0;e<t.items_list.length;e++){t.items_object[t.items_list[e].item_id]={};for(var r=0;r<t.items_list[e].fields.length;r++)t.items_object[t.items_list[e].item_id][t.items_list[e].fields[r].field_id]=t.items_list[e].fields[r]}var i=this.storage.getApp(t.app_id);return i?(t.from_apps_list=i.from_apps_list,t.permission=i.permission,this.storage.updateApp(t)):(t.from_apps_list=!1,this.addNewAppToStorage(t)),this.getAppFromStorage(t.app_id)}},{key:"updateAppFieldsAndViews",value:function(t){var e=this,r=this.getAppFromStorage(t.app_id);t.items_list=r.items_list,t.file_list=r.file_list,t.from_apps_list=r.from_apps_list,t.items_object=r.items_object,this.storage.updateApp(t),this.pipeService.emit("gh_app_views_update",{app_id:t.app_id},t.views_list),t.field_list.forEach(function(r){e.pipeService.emit("gh_model_update",{app_id:t.app_id,field_id:r.field_id},r)})}},{key:"updateAppInStorage",value:function(t){this.storage.getApp(t.app_id)?(this.storage.updateApp(t),this.pipeService.emit("gh_app_update",{app_id:t.app_id},t),this.pipeService.emit("gh_items_update",{app_id:t.app_id},t.items_list)):this.addNewAppToStorage(t)}},{key:"deletingAppFromStorage",value:function(t){var e=this.storage.getAppsList();return e.forEach(function(r,i){r.app_id==t&&e.splice(i)}),e}},{key:"updateAppsListInStorage",value:function(){var t,e=u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var r=t.value,i=this.storage.getApp(r.app_id);i?(i.from_apps_list=r.from_apps_list,i.permission=r.permission):this.addNewAppToStorage(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"refreshApps",value:function(){var t=d(l().m(function t(){var e,r,i,n,a,p,o,s,c,f=arguments;return l().w(function(t){for(;;)switch(t.n){case 0:e=f.length>0&&void 0!==f[0]?f[0]:[],r=u(e),t.p=1,r.s();case 2:if((i=r.n()).done){t.n=7;break}if(null==(n=i.value)){t.n=6;break}return t.p=3,t.n=4,this.getAppApi(n);case 4:if(a=t.v){for(a.items_object={},p=0;p<a.items_list.length;p++)for(a.items_object[a.items_list[p].item_id]={},o=0;o<a.items_list[p].fields.length;o++)a.items_object[a.items_list[p].item_id][a.items_list[p].fields[o].field_id]=a.items_list[p].fields[o];this.updateAppInStorage(a),this.pipeService.emit("gh_app_views_update",{app_id:a.app_id},a.views_list)}t.n=6;break;case 5:t.p=5,s=t.v,console.log(s);case 6:t.n=2;break;case 7:t.n=9;break;case 8:t.p=8,c=t.v,r.e(c);case 9:return t.p=9,r.f(),t.f(9);case 10:console.log("Apps refreshed: ",JSON.stringify(e));case 11:return t.a(2)}},t,this,[[3,5],[1,8,9,10]])}));return function(){return t.apply(this,arguments)}}()},{key:"refreshAppsList",value:function(){var t=d(l().m(function t(){var e,r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return e=this.getAppListFromStorage(),t.n=1,this.getAppListApi();case 1:r=t.v,i=r.map(function(t){return o(o({},t),e.find(function(e){return e.app_id===t.app_id}))}),this.updateAppsListInStorage(i),this.pipeService.emit("gh_apps_list_refreshed",{});case 2:return t.a(2)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppsList",value:function(){var t=d(l().m(function t(){var e,r;return l().w(function(t){for(;;)switch(t.n){case 0:if(e=this.getAppListFromStorage(),this.applistReceived){t.n=3;break}return t.n=1,this.getAppListApi();case 1:if(r=t.v){t.n=2;break}return t.a(2,null);case 2:this.updateAppsListInStorage(r),this.applistReceived=!0,e=r,this.getApp(this.storage.getUser().app_init);case 3:return t.a(2,e)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppInfo",value:function(){var t=d(l().m(function t(e){var r;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getAppsList();case 1:return r=t.v,t.a(2,r?r.find(function(t){return t.app_id==e}):null)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteApp",value:function(){var t=d(l().m(function t(e){return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.deleteAppApi(e);case 1:return t.a(2,this.deletingAppFromStorage(e))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getApp",value:function(){var t=d(l().m(function t(e){var i,n,a=this;return l().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}return t.a(2,null);case 1:if(i=this.getAppFromStorage(e)){t.n=4;break}return t.n=2,this.getAppApi(e);case 2:if(n=t.v){t.n=3;break}return t.a(2,null);case 3:n.chunks&&n.chunks.length?(this.chunksManager.getChunks(e,n.chunks).then(function(t){n.items_list=a.util.mergeChunks([].concat(r(t),[n])),a.saveAppInStorage(n),a.pipeService.emit("gh_items_update",{app_id:e},n.items_list)}),i=n,this.saveAppInStorage(n)):(i=this.getAppFromStorage(e))||(i=n,this.saveAppInStorage(n),this.ws.addSubscription(e));case 4:return t.a(2,i)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateApp",value:function(){var t=d(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:if(e.views_list&&e.views_list.length&&e.show){t.n=2;break}return t.n=1,this.getApp(e.app_id);case 1:r=t.v,e.views_list&&e.views_list.length||(e.views_list=r.views_list),void 0===e.show&&(e.show=r.show);case 2:return t.n=3,this.updateAppApi(e);case 3:return i=t.v,this.updateAppFieldsAndViews(i),t.a(2,i)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppInfo",value:function(){var t=d(l().m(function t(){var e,r=arguments;return l().w(function(t){for(;;)switch(t.n){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:{},this.pipeService.emit("gh_app_info_update",{app_id:e.app_id},e),t.a(2,this.updateApp(e))}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"createNewApp",value:function(){var t=d(l().m(function t(e){var r;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.createNewAppApi(e);case 1:return(r=t.v).items_object={},this.addNewAppToStorage(r),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppViews",value:function(){var t=d(l().m(function t(e){var r;return l().w(function(t){for(;;)switch(t.n){case 0:if(!e){t.n=2;break}return t.n=1,this.getApp(e);case 1:return r=t.v,t.a(2,r.views_list);case 2:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"clearAppProcessor",value:function(){this.getAppListPromises=null,this.getAppPromises={},this.applistReceived=!1}},{key:"appListeners",value:function(){var e=this;this.pipeService.onRoot("gh_app_get",{},function(){var t=d(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getApp(i.app_id);case 1:n=t.v,e.pipeService.emit("gh_app_get",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_apps_list_get",{},function(){var t=d(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppsList();case 1:n=t.v,e.pipeService.emit("gh_apps_list_get",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_delete_app",{},function(){var t=d(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.deleteApp(i.app_id);case 1:n=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_update",{},function(){var t=d(l().m(function t(r,i){var n,a;return l().w(function(t){for(;;)switch(t.n){case 0:return i.app.items_list=[],i.app.file_list=[],t.n=1,e.updateApp(i.app);case 1:return n=t.v,e.pipeService.emit("gh_app_views_update",{app_id:n.app_id},n.views_list),t.n=2,e.getAppsList();case 2:a=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},a),n.field_list.forEach(function(t){e.pipeService.emit("gh_model_update",{app_id:n.app_id,field_id:t.field_id},t)});case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_view_get",{},function(){var t=d(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getApp(i.app_id);case 1:(n=t.v).views_list.forEach(function(t,r){t.view_id==i.view_id&&e.pipeService.emit("gh_app_view_get",i,n.views_list[r])});case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_get",{},function(){var t=d(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppInfo(i.app_id);case 1:(n=t.v)&&e.pipeService.emit("gh_app_info_get",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_update",{},function(){var t=d(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app){t.n=2;break}return t.n=1,e.updateAppInfo(i.app);case 1:n=t.v,e.pipeService.emit("gh_app_info_update",{app_id:i.app.app_id},n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_create",{},function(){var t=d(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.createNewApp(i.app);case 1:return t.n=2,e.getAppsList();case 2:n=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},n);case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),t.IS_WEB&&this.activateSW&&navigator.serviceWorker.addEventListener("message",function(){var t=d(l().m(function t(r){var i;return l().w(function(t){for(;;)switch(t.n){case 0:if("refresh app"!==r.data.type){t.n=2;break}return t.n=1,e.getApp(r.data.payload.app_id);case 1:(i=t.v)&&e.util.compareAppsItemsLists(i.items_list,r.data.payload.items_list.filter(function(t){return!t.trash}),function(t){var i=t.diff_fields_items,n=t.diff_fields_items_Ids,a=t.diff_items,p=t.newItems,o=t.deletedItems;(a.length||p.length||o.length)&&(e.pipeService.emit("gh_items_update",{app_id:r.data.payload.app_id},r.data.payload.items_list.filter(function(t){return!t.trash})),a.forEach(function(t){return e.pipeService.emit("gh_item_update",{app_id:r.data.payload.app_id,item_id:t.item_id},t)})),n.forEach(function(t){var n=i[t];n&&n.forEach(function(i){e.pipeService.emit("gh_value_update",{app_id:r.data.payload.app_id,item_id:t,field_id:i.field_id},i.field_value)})})}),r.data.payload.items_list=e.util.mergeChunks([i,r.data.payload]),e.saveAppInStorage(r.data.payload);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}}])}();
|
|
265
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppProcessor=void 0;var t=require("../consts.js");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return a(t)||n(t)||c(t)||i()}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function a(t){if(Array.isArray(t))return f(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach(function(e){o(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function o(t,e,r){return(e=y(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=c(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}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(t)},n:function(){var t=r.next();return p=t.done,t},e:function(t){s=!0,a=t},f:function(){try{p||null==r.return||r.return()}finally{if(s)throw a}}}}function c(t,e){if(t){if("string"==typeof t)return f(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function l(){var t,e,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var o=i&&i.prototype instanceof s?i:s,u=Object.create(o.prototype);return h(u,"_invoke",function(r,i,n){var a,s,o,u=0,c=n||[],f=!1,l={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,r){return a=e,s=0,o=t,l.n=r,p}};function h(r,i){for(s=r,o=i,e=0;!f&&u&&!n&&e<c.length;e++){var n,a=c[e],h=l.p,v=a[2];r>3?(n=v===i)&&(o=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=t):a[0]<=h&&((n=r<2&&h<a[1])?(s=0,l.v=i,l.n=a[1]):h<v&&(n=r<3||a[0]>i||i>v)&&(a[4]=r,a[5]=i,l.n=v,s=0))}if(n||r>1)return p;throw f=!0,i}return function(n,c,v){if(u>1)throw TypeError("Generator is already running");for(f&&1===c&&h(c,v),s=c,o=v;(e=s<2?t:o)||!f;){a||(s?s<3?(s>1&&(l.n=-1),h(s,o)):l.n=o:l.v=o);try{if(u=2,a){if(s||(n="next"),e=a[n]){if(!(e=e.call(a,o)))throw TypeError("iterator result is not an object");if(!e.done)return e;o=e.value,s<2&&(s=0)}else 1===s&&(e=a.return)&&e.call(a),s<2&&(o=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=t}else if((e=(f=l.n<0)?o:r.call(i,l))!==p)break}catch(e){a=t,s=1,o=e}finally{u=1}}return{value:e,done:f}}}(r,n,a),!0),u}var p={};function s(){}function o(){}function u(){}e=Object.getPrototypeOf;var c=[][i]?e(e([][i]())):(h(e={},i,function(){return this}),e),f=u.prototype=s.prototype=Object.create(c);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,h(t,n,"GeneratorFunction")),t.prototype=Object.create(f),t}return o.prototype=u,h(f,"constructor",u),h(u,"constructor",o),o.displayName="GeneratorFunction",h(u,n,"GeneratorFunction"),h(f),h(f,n,"Generator"),h(f,i,function(){return this}),h(f,"toString",function(){return"[object Generator]"}),(l=function(){return{w:a,m:v}})()}function h(t,e,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}(h=function(t,e,r,i){if(e)n?n(t,e,{value:r,enumerable:!i,configurable:!i,writable:!i}):t[e]=r;else{var a=function(e,r){h(t,e,function(t){return this._invoke(e,r,t)})};a("next",0),a("throw",1),a("return",2)}})(t,e,r,i)}function v(t,e,r,i,n,a,p){try{var s=t[a](p),o=s.value}catch(t){return void r(t)}s.done?e(o):Promise.resolve(o).then(i,n)}function _(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var a=t.apply(e,r);function p(t){v(a,i,n,p,s,"next",t)}function s(t){v(a,i,n,p,s,"throw",t)}p(void 0)})}}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,y(i.key),i)}}function g(t,e,r){return e&&m(t.prototype,e),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){var r=w(t,"string");return"symbol"==e(r)?r:r+""}function w(t,r){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}var A=exports.AppProcessor=function(){return g(function t(e,r,i,n,a,p,s){d(this,t),this.storage=e,this.pipeService=r,this.req=i,this.ws=n,this.applistReceived=!1,this.activateSW=s,this.chunksManager=a,this.util=p,this.appListeners(),this.appRequestCache=new Map},[{key:"createNewAppApi",value:function(){var t=_(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/create",form:{app:JSON.stringify(e)}});case 1:return(r=t.v).from_apps_list=!0,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppApi",value:function(){var t=_(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/update",form:{app:JSON.stringify(e)}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteAppApi",value:function(){var t=_(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/app/delete",form:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListApi",value:function(){var t=_(l().m(function t(){var e,r;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/applist/get"});case 1:return e=t.v,t.a(2,e.apps_list.map(function(t){return t.from_apps_list=!0,t}));case 2:return t.p=2,r=t.v,console.log(r),t.a(2,null)}},t,this,[[0,2]])}));return function(){return t.apply(this,arguments)}}()},{key:"getAppApi",value:function(){var t=_(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/app/get",params:{app_id:e}});case 1:return r=t.v,t.a(2,r);case 2:return t.p=2,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppListFromStorage",value:function(){return this.storage.getAppsList()}},{key:"getAppFromStorage",value:function(t){var e=this.storage.getApp(t);return e&&e.field_list.length?e:null}},{key:"addNewAppToStorage",value:function(t){return this.storage.getAppsList().push(t)}},{key:"saveAppInStorage",value:function(t){t.items_object={};for(var e=0;e<t.items_list.length;e++){t.items_object[t.items_list[e].item_id]={};for(var r=0;r<t.items_list[e].fields.length;r++)t.items_object[t.items_list[e].item_id][t.items_list[e].fields[r].field_id]=t.items_list[e].fields[r]}var i=this.storage.getApp(t.app_id);return i?(t.from_apps_list=i.from_apps_list,t.permission=i.permission,this.storage.updateApp(t)):(t.from_apps_list=!1,this.addNewAppToStorage(t)),this.getAppFromStorage(t.app_id)}},{key:"updateAppFieldsAndViews",value:function(t){var e=this,r=this.getAppFromStorage(t.app_id);t.items_list=r.items_list,t.file_list=r.file_list,t.from_apps_list=r.from_apps_list,t.items_object=r.items_object,this.storage.updateApp(t),this.pipeService.emit("gh_app_views_update",{app_id:t.app_id},t.views_list),t.field_list.forEach(function(r){e.pipeService.emit("gh_model_update",{app_id:t.app_id,field_id:r.field_id},r)})}},{key:"updateAppInStorage",value:function(t){this.storage.getApp(t.app_id)?(this.storage.updateApp(t),this.pipeService.emit("gh_app_update",{app_id:t.app_id},t),this.pipeService.emit("gh_items_update",{app_id:t.app_id},t.items_list)):this.addNewAppToStorage(t)}},{key:"deletingAppFromStorage",value:function(t){var e=this.storage.getAppsList();return e.forEach(function(r,i){r.app_id==t&&e.splice(i)}),e}},{key:"updateAppsListInStorage",value:function(){var t,e=u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var r=t.value,i=this.storage.getApp(r.app_id);i?(i.from_apps_list=r.from_apps_list,i.permission=r.permission):this.addNewAppToStorage(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"refreshApps",value:function(){var t=_(l().m(function t(){var e,r,i,n,a,p,s,o,c,f=arguments;return l().w(function(t){for(;;)switch(t.n){case 0:e=f.length>0&&void 0!==f[0]?f[0]:[],r=u(e),t.p=1,r.s();case 2:if((i=r.n()).done){t.n=7;break}if(null==(n=i.value)){t.n=6;break}return t.p=3,t.n=4,this.getAppApi(n);case 4:if(a=t.v){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.updateAppInStorage(a),this.pipeService.emit("gh_app_views_update",{app_id:a.app_id},a.views_list)}t.n=6;break;case 5:t.p=5,o=t.v,console.log(o);case 6:t.n=2;break;case 7:t.n=9;break;case 8:t.p=8,c=t.v,r.e(c);case 9:return t.p=9,r.f(),t.f(9);case 10:console.log("Apps refreshed: ",JSON.stringify(e));case 11:return t.a(2)}},t,this,[[3,5],[1,8,9,10]])}));return function(){return t.apply(this,arguments)}}()},{key:"refreshAppsList",value:function(){var t=_(l().m(function t(){var e,r,i;return l().w(function(t){for(;;)switch(t.n){case 0:return e=this.getAppListFromStorage(),t.n=1,this.getAppListApi();case 1:r=t.v,i=r.map(function(t){return s(s({},t),e.find(function(e){return e.app_id===t.app_id}))}),this.updateAppsListInStorage(i),this.pipeService.emit("gh_apps_list_refreshed",{});case 2:return t.a(2)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppsList",value:function(){var t=_(l().m(function t(){var e,r;return l().w(function(t){for(;;)switch(t.n){case 0:if(e=this.getAppListFromStorage(),this.applistReceived){t.n=3;break}return t.n=1,this.getAppListApi();case 1:if(r=t.v){t.n=2;break}return t.a(2,null);case 2:this.updateAppsListInStorage(r),this.applistReceived=!0,e=r,this.getApp(this.storage.getUser().app_init);case 3:return t.a(2,e)}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAppInfo",value:function(){var t=_(l().m(function t(e){var r;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getAppsList();case 1:return r=t.v,t.a(2,r?r.find(function(t){return t.app_id==e}):null)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"deleteApp",value:function(){var t=_(l().m(function t(e){return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.deleteAppApi(e);case 1:return t.a(2,this.deletingAppFromStorage(e))}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getApp",value:function(){var t=_(l().m(function t(e){var i,n,a,p=this;return l().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}return t.a(2,null);case 1:if(!(i=this.getAppFromStorage(e))){t.n=2;break}return t.a(2,i);case 2:if(!this.appRequestCache.has(e)){t.n=3;break}return t.a(2,this.appRequestCache.get(e));case 3:return n=this,a=new Promise(function(){var t=_(l().m(function t(i,a){var o,u,c,f,h,v,_,d;return l().w(function(t){for(;;)switch(t.n){case 0:return t.p=0,t.n=1,p.getAppApi(e);case 1:if((o=t.v)||a(),!o.chunks||!o.chunks.length){t.n=3;break}return t.n=2,n.chunksManager.getChunks(e,o.chunks);case 2:u=t.v,o.items_list=n.util.mergeChunks([].concat(r(u),[o]));case 3:if(c=s({},o),f=[],h=[],Array.isArray(o.items_list))for(v=0;v<o.items_list.length;v++)o.items_list[v].trash?h.push(o.items_list[v]):f.push(o.items_list[v]);if(c.items_list=f,c.trash_items=h,_=[],Array.isArray(o.field_list))for(d=0;d<o.field_list.length;d++)o.field_list[d].trash||_.push(o.field_list[d]);c.field_list=_,i(c),n.saveAppInStorage(c),n.ws.addSubscription(e),t.n=5;break;case 4:t.p=4,t.v,a();case 5:return t.a(2)}},t,null,[[0,4]])}));return function(e,r){return t.apply(this,arguments)}}()),n.appRequestCache.set(e,a),t.a(2,a)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateApp",value:function(){var t=_(l().m(function t(e){var r,i;return l().w(function(t){for(;;)switch(t.n){case 0:if(e.views_list&&e.views_list.length&&e.show){t.n=2;break}return t.n=1,this.getApp(e.app_id);case 1:r=t.v,e.views_list&&e.views_list.length||(e.views_list=r.views_list),void 0===e.show&&(e.show=r.show);case 2:return t.n=3,this.updateAppApi(e);case 3:return i=t.v,this.updateAppFieldsAndViews(i),t.a(2,i)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAppInfo",value:function(){var t=_(l().m(function t(){var e,r=arguments;return l().w(function(t){for(;;)switch(t.n){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:{},this.pipeService.emit("gh_app_info_update",{app_id:e.app_id},e),t.a(2,this.updateApp(e))}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"createNewApp",value:function(){var t=_(l().m(function t(e){var r;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.createNewAppApi(e);case 1:return(r=t.v).items_object={},this.addNewAppToStorage(r),t.a(2,r)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getAppViews",value:function(){var t=_(l().m(function t(e){var r;return l().w(function(t){for(;;)switch(t.n){case 0:if(!e){t.n=2;break}return t.n=1,this.getApp(e);case 1:return r=t.v,t.a(2,r.views_list);case 2:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"clearAppProcessor",value:function(){this.getAppListPromises=null,this.getAppPromises={},this.applistReceived=!1}},{key:"appListeners",value:function(){var e=this;this.pipeService.onRoot("gh_app_get",{},function(){var t=_(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getApp(i.app_id);case 1:n=t.v,e.pipeService.emit("gh_app_get",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_apps_list_get",{},function(){var t=_(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppsList();case 1:n=t.v,e.pipeService.emit("gh_apps_list_get",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_delete_app",{},function(){var t=_(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.deleteApp(i.app_id);case 1:n=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_update",{},function(){var t=_(l().m(function t(r,i){var n,a;return l().w(function(t){for(;;)switch(t.n){case 0:return i.app.items_list=[],i.app.file_list=[],t.n=1,e.updateApp(i.app);case 1:return n=t.v,e.pipeService.emit("gh_app_views_update",{app_id:n.app_id},n.views_list),t.n=2,e.getAppsList();case 2:a=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},a),n.field_list.forEach(function(t){e.pipeService.emit("gh_model_update",{app_id:n.app_id,field_id:t.field_id},t)});case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_view_get",{},function(){var t=_(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getApp(i.app_id);case 1:(n=t.v).views_list.forEach(function(t,r){t.view_id==i.view_id&&e.pipeService.emit("gh_app_view_get",i,n.views_list[r])});case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_get",{},function(){var t=_(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.getAppInfo(i.app_id);case 1:(n=t.v)&&e.pipeService.emit("gh_app_info_get",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_update",{},function(){var t=_(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app){t.n=2;break}return t.n=1,e.updateAppInfo(i.app);case 1:n=t.v,e.pipeService.emit("gh_app_info_update",{app_id:i.app.app_id},n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_create",{},function(){var t=_(l().m(function t(r,i){var n;return l().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.createNewApp(i.app);case 1:return t.n=2,e.getAppsList();case 2:n=t.v,e.pipeService.emit("gh_apps_list_update",{recipient:"all"},n);case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),t.IS_WEB&&this.activateSW&&navigator.serviceWorker.addEventListener("message",function(){var t=_(l().m(function t(r){var i;return l().w(function(t){for(;;)switch(t.n){case 0:if("refresh app"!==r.data.type){t.n=2;break}return t.n=1,e.getApp(r.data.payload.app_id);case 1:(i=t.v)&&e.util.compareAppsItemsLists(i.items_list,r.data.payload.items_list.filter(function(t){return!t.trash}),function(t){var i=t.diff_fields_items,n=t.diff_fields_items_Ids,a=t.diff_items,p=t.newItems,s=t.deletedItems;(a.length||p.length||s.length)&&(e.pipeService.emit("gh_items_update",{app_id:r.data.payload.app_id},r.data.payload.items_list.filter(function(t){return!t.trash})),a.forEach(function(t){return e.pipeService.emit("gh_item_update",{app_id:r.data.payload.app_id,item_id:t.item_id},t)})),n.forEach(function(t){var n=i[t];n&&n.forEach(function(i){e.pipeService.emit("gh_value_update",{app_id:r.data.payload.app_id,item_id:t,field_id:i.field_id},i.field_value)})})}),r.data.payload.items_list=e.util.mergeChunks([i,r.data.payload]),e.saveAppInStorage(r.data.payload);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}}])}();
|
|
266
266
|
},{"../consts.js":"UV2u"}],"UUd3":[function(require,module,exports) {
|
|
267
267
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemProcessor=void 0;var e=require("../utils.js");function t(e){return(t="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 r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function i(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function n(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,o){var a=i&&i.prototype instanceof c?i:c,p=Object.create(a.prototype);return u(p,"_invoke",function(r,i,n){var o,u,a,c=0,p=n||[],f=!1,l={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,r){return o=t,u=0,a=e,l.n=r,s}};function m(r,i){for(u=r,a=i,t=0;!f&&c&&!n&&t<p.length;t++){var n,o=p[t],m=l.p,d=o[2];r>3?(n=d===i)&&(a=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=m&&((n=r<2&&m<o[1])?(u=0,l.v=i,l.n=o[1]):m<d&&(n=r<3||o[0]>i||i>d)&&(o[4]=r,o[5]=i,l.n=d,u=0))}if(n||r>1)return s;throw f=!0,i}return function(n,p,d){if(c>1)throw TypeError("Generator is already running");for(f&&1===p&&m(p,d),u=p,a=d;(t=u<2?e:a)||!f;){o||(u?u<3?(u>1&&(l.n=-1),m(u,a)):l.n=a:l.v=a);try{if(c=2,o){if(u||(n="next"),t=o[n]){if(!(t=t.call(o,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(a=TypeError("The iterator does not provide a '"+n+"' method"),u=1);o=e}else if((t=(f=l.n<0)?a:r.call(i,l))!==s)break}catch(t){o=e,u=1,a=t}finally{c=1}}return{value:t,done:f}}}(r,n,o),!0),p}var s={};function c(){}function p(){}function f(){}t=Object.getPrototypeOf;var l=[][i]?t(t([][i]())):(u(t={},i,function(){return this}),t),m=f.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,u(e,n,"GeneratorFunction")),e.prototype=Object.create(m),e}return p.prototype=f,u(m,"constructor",f),u(f,"constructor",p),p.displayName="GeneratorFunction",u(f,n,"GeneratorFunction"),u(m),u(m,n,"Generator"),u(m,i,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(o=function(){return{w:a,m:d}})()}function u(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}(u=function(e,t,r,i){if(t)n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r;else{var o=function(t,r){u(e,t,function(e){return this._invoke(t,r,e)})};o("next",0),o("throw",1),o("return",2)}})(e,t,r,i)}function a(e,t,r,i,n,o,u){try{var a=e[o](u),s=a.value}catch(e){return void r(e)}a.done?t(s):Promise.resolve(s).then(i,n)}function s(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function u(e){a(o,i,n,u,s,"next",e)}function s(e){a(o,i,n,u,s,"throw",e)}u(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,l(i.key),i)}}function f(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e){var r=m(e,"string");return"symbol"==t(r)?r:r+""}function m(e,r){if("object"!=t(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,r||"default");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}var d=exports.ItemProcessor=function(){return f(function e(t,r,i,n,o){c(this,e),this.storage=t,this.pipeService=r,this.req=i,this.appProcessor=n,this.util=o,this.itemListeners()},[{key:"addItemsApi",value:function(){var e=s(o().m(function e(t,r){var i,n;return o().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,this.req.post({url:"/api/items/add",form:{items:JSON.stringify(r),app_id:t}});case 1:return i=e.v,e.a(2,i);case 2:return e.p=2,n=e.v,console.log(n),e.a(2,null)}},e,this,[[0,2]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"updateItemsApi",value:function(){var e=s(o().m(function e(t,r){var i,n;return o().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,this.req.post({url:"/api/items/update",form:{items:JSON.stringify(r),app_id:t}});case 1:return i=e.v,e.a(2,i);case 2:return e.p=2,n=e.v,console.log(n),e.a(2,null)}},e,this,[[0,2]])}));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=s(o().m(function e(t,r){var i,n=this;return o().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.appProcessor.getApp(t);case 1:return(i=e.v)&&(r.forEach(function(e){i.items_list.push(e),i.items_object[e.item_id]={};for(var r=0;r<e.fields.length;r++)i.items_object[e.item_id][e.fields[r].field_id]=e.fields[r];n.pipeService.emit("gh_item_update",{app_id:t},[e])}),this.pipeService.emit("gh_items_update",{app_id:t},i.items_list),this.storage.updateApp(i)),e.a(2,i)}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"updateItemsInStorage",value:function(){var e=s(o().m(function e(t,r){var i,n=this;return o().w(function(e){for(;;)switch(e.n){case 0:return this.pipeService.emit("gh_items_update",{app_id:t},r),e.n=1,this.appProcessor.getApp(t);case 1:return(i=e.v)&&r&&r.forEach(function(e){var r={app_id:t};n.pipeService.emit("gh_item_update",r,[e]),r.item_id=e.item_id,n.pipeService.emit("gh_item_update",r,e);var o=i.items_list.find(function(t){return t.item_id==e.item_id});o&&e.fields.forEach(function(e){var t=o.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,i.items_object[o.item_id][t.field_id]=t,n.pipeService.emit("gh_value_update",r,e.field_value)):(o.fields.push(e),i.items_object[o.item_id][e.field_id]=e,n.pipeService.emit("gh_value_update",r,e.field_value))})}),e.a(2,r)}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"deleteItemsFromStorage",value:function(){var e=s(o().m(function e(t){var r,i,n=arguments;return o().w(function(e){for(;;)switch(e.n){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:[],e.n=1,this.appProcessor.getApp(t);case 1:(i=e.v)&&(i.items_list=i.items_list.filter(function(e){return!r.find(function(t){return e.item_id==t.item_id})||(delete i.items_object[e.item_id],!1)}),this.pipeService.emit("gh_items_update",{app_id:t},i.items_list),this.storage.updateApp(i));case 2:return e.a(2)}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getItems",value:function(){var e=s(o().m(function e(t){var r,i=arguments;return o().w(function(e){for(;;)switch(e.n){case 0:return i.length>1&&void 0!==i[1]&&i[1],e.n=1,this.appProcessor.getApp(t);case 1:if(r=e.v){e.n=2;break}return e.a(2,null);case 2:return e.a(2,r.items_list)}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(){var t=s(o().m(function t(r,n){var u,a;return o().w(function(t){for(;;)switch(t.n){case 0:return u=n.map(function(t){return i(i({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.n=1,this.addItemsApi(r,u);case 1:return a=t.v,t.n=2,this.addItemsToStorage(r,a);case 2:return this.pipeService.emit("gh_items_add",{app_id:r},a),t.a(2,a)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"updateItems",value:function(){var t=s(o().m(function t(r,n){var u,a;return o().w(function(t){for(;;)switch(t.n){case 0:return u=n.map(function(t){return i(i({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.n=1,this.updateItemsApi(r,u);case 1:return a=t.v,t.n=2,this.updateItemsInStorage(r,a);case 2:return t.a(2,t.v)}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItems",value:function(){var e=s(o().m(function e(t,r){var i=this;return o().w(function(e){for(;;)switch(e.n){case 0:return e.a(2,this.deleteItemsApi(r).then(function(){var e=s(o().m(function e(r){return o().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i.deleteItemsFromStorage(t,r);case 1:return e.a(2,e.v)}},e)}));return function(t){return e.apply(this,arguments)}}()))}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"restoreItems",value:function(){var e=s(o().m(function e(t,r){var i,n;return o().w(function(e){for(;;)switch(e.n){case 0:return i=r.map(function(e){return{item_id:e,trash:!1}}),e.n=1,this.updateItemsApi(t,i);case 1:return n=e.v,e.n=2,this.updateItemsInStorage(t,n);case 2:return e.a(2,e.v)}},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=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getItems(i.app_id);case 1:(n=t.v)?e.pipeService.emit("gh_items_get",i,n):e.pipeService.emit("gh_items_get",i,[]);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_add",{},function(){var t=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!(i&&i.app_id&&i.items)){t.n=2;break}return t.n=1,e.addNewItems(i.app_id,i.items);case 1:(n=t.v)?e.pipeService.emit("gh_items_add",i,n):e.pipeService.emit("gh_items_add",i,[]);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_update",{},function(){var t=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!(i&&i.app_id&&i.items)){t.n=2;break}return t.n=1,e.updateItems(i.app_id,i.items);case 1:(n=t.v)?e.pipeService.emit("gh_items_update",i,n):e.pipeService.emit("gh_items_update",i,[]);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_item_get",{},function(){var t=s(o().m(function t(r,i){var n,u;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.app_id){t.n=2;break}return t.n=1,e.getItems(i.app_id);case 1:n=t.v,u=n.find(function(e){return e.item_id==i.item_id}),e.pipeService.emit("gh_item_get",i,u);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filtered_items_get",{},function(){var t=s(o().m(function t(r,i){var n,u;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.element_app_id){t.n=3;break}return t.n=1,e.getItems(i.element_app_id);case 1:return n=t.v,t.n=2,e.util.getFilteredItems(n,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 2:u=t.v,e.pipeService.emit("gh_filtered_items_get",i,u);case 3:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filter_items",{},function(){var t=s(o().m(function t(r,i){var n;return o().w(function(t){for(;;)switch(t.n){case 0:if(!i||!i.items){t.n=2;break}return t.n=1,e.util.getFilteredItems(i.items,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 1:n=t.v,e.pipeService.emit("gh_filter_items",i,n);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}())}}])}();
|
|
268
268
|
},{"../utils.js":"EgeI"}],"PoPF":[function(require,module,exports) {
|