@gudhub/core 1.2.4-beta.6 → 1.2.4-beta.60

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.
Files changed (63) hide show
  1. package/.parcel-cache/83e7562660f7cc15-BundleGraph +0 -0
  2. package/.parcel-cache/9a0d07555444f4da-AssetGraph +0 -0
  3. package/.parcel-cache/d3a1b9507cb44047-AssetGraph +0 -0
  4. package/.parcel-cache/data.mdb +0 -0
  5. package/.parcel-cache/dc1da35000e13623-RequestGraph +0 -0
  6. package/.parcel-cache/lock.mdb +0 -0
  7. package/.parcel-cache/snapshot-dc1da35000e13623.txt +29402 -0
  8. package/.parcelrc.appRequestWorker +4 -0
  9. package/GUDHUB/AppProcessor/AppProcessor.js +58 -26
  10. package/GUDHUB/ChunksManager/ChunksManager.test.js +11 -4
  11. package/GUDHUB/DataService/AppDataService.js +36 -1
  12. package/GUDHUB/DataService/ChunkDataService.js +7 -1
  13. package/GUDHUB/DataService/IndexedDB/IndexedDBAppService.js +773 -43
  14. package/GUDHUB/DataService/IndexedDB/IndexedDBChunkService.js +118 -85
  15. package/GUDHUB/DataService/IndexedDB/IndexedDBService.js +171 -7
  16. package/GUDHUB/DataService/IndexedDB/StoreManager/BaseStoreManager.js +97 -0
  17. package/GUDHUB/DataService/IndexedDB/StoreManager/managers.js +77 -0
  18. package/GUDHUB/DataService/IndexedDB/appDataConf.js +6 -3
  19. package/GUDHUB/DataService/IndexedDB/appRequestWorker.js +163 -0
  20. package/GUDHUB/DataService/IndexedDB/chunkDataConf.js +3 -3
  21. package/GUDHUB/DataService/IndexedDB/consts.js +1 -1
  22. package/GUDHUB/DataService/IndexedDB/init.js +18 -17
  23. package/GUDHUB/DataService/IndexedDB/storeManagerConf/chunkCacheStoreManagerConf.js +11 -0
  24. package/GUDHUB/DataService/IndexedDB/storeManagerConf/init.js +1 -0
  25. package/GUDHUB/DataService/export.js +69 -14
  26. package/GUDHUB/DataService/httpService/AppHttpService.js +13 -5
  27. package/GUDHUB/DataService/httpService/ChunkHttpService.js +41 -26
  28. package/GUDHUB/DataService/utils.js +27 -27
  29. package/GUDHUB/FileManager/FileManager.js +7 -3
  30. package/GUDHUB/GHConstructor/createAngularModuleInstance.js +63 -42
  31. package/GUDHUB/GHConstructor/createClassInstance.js +8 -3
  32. package/GUDHUB/ItemProcessor/ItemProcessor.js +14 -6
  33. package/GUDHUB/Storage/ModulesList.js +66 -3
  34. package/GUDHUB/Utils/AppsTemplateService/AppsTemplateService.js +48 -5
  35. package/GUDHUB/Utils/Utils.js +29 -1
  36. package/GUDHUB/Utils/filter/filter.js +32 -1
  37. package/GUDHUB/Utils/get_date/get_date.test.js +3 -12
  38. package/GUDHUB/Utils/merge_chunks/merge_chunks.js +36 -28
  39. package/GUDHUB/Utils/merge_chunks/merge_chunks.worker.js +78 -0
  40. package/GUDHUB/Utils/merge_compare_items/merge_compare_items.js +40 -9
  41. package/GUDHUB/Utils/nested_list/nested_list.js +53 -50
  42. package/GUDHUB/Utils/nested_list/nested_list.test.js +140 -2
  43. package/GUDHUB/WebSocket/WebSocket.js +2 -1
  44. package/GUDHUB/api/AppApi.js +13 -13
  45. package/GUDHUB/api/ChunkApi.js +6 -6
  46. package/GUDHUB/config.js +11 -2
  47. package/GUDHUB/consts.js +15 -1
  48. package/GUDHUB/gudhub.js +48 -26
  49. package/GUDHUB/gudhubAppRequestWorker.js +18 -0
  50. package/build.sh +127 -0
  51. package/diff.txt +1221 -0
  52. package/dist/gudhub.es.js +13455 -0
  53. package/dist/gudhub.umd.js +197 -0
  54. package/index.js +3 -1
  55. package/indexUMD.js +0 -2
  56. package/package.json +38 -22
  57. package/umd/library.min.js +285 -2
  58. package/umd/library.min.js.map +1 -1
  59. package/vite.config.esm.js +72 -0
  60. package/vite.config.umd.js +68 -0
  61. package/GUDHUB/ChunksManager/ChunksManager.js +0 -68
  62. package/umd/library.min.js.LICENSE.txt +0 -13
  63. package/webpack.config.js +0 -33
@@ -1,31 +1,39 @@
1
+ import { mergeChunks as mergeChunksByMainThread, mergeChunksWorker } from "./merge_chunks.worker.js";
2
+
3
+
4
+ // const mergeChunksWorkerSingletone = new Worker('mergeWorker.js'); //TODO
5
+
6
+
1
7
  export function mergeChunks(chunks) {
2
- const result = {};
8
+ //dont launch new thread because already used in worker.
9
+ // Main reason is that renderer process allocates memory for structured clones for communication between trheads
10
+ return mergeChunksByMainThread(chunks);
11
+
12
+ if (
13
+ typeof Worker !== 'undefined'
14
+ ) {
15
+ return new Promise((resolve, reject) => {
16
+ const chunkWorkerBlob = new Blob([mergeChunksWorker()], {
17
+ type: "application/javascript",
18
+ });
19
+
20
+ let worker = new Worker(URL.createObjectURL(chunkWorkerBlob));
21
+
22
+ worker.postMessage(chunks);
3
23
 
4
- chunks.forEach((chunk) => {
5
- chunk.items_list.forEach((item) => {
6
- const dstItem = result[item.item_id];
7
- if (dstItem) {
8
- dstItem.trash = item.trash;
9
- return item.fields.forEach((srcField) => {
10
- let isFieldNonExist = true;
11
- dstItem.fields = dstItem.fields.map((dstField) => {
12
- if (Number(dstField.field_id) === Number(srcField.field_id)) {
13
- isFieldNonExist = false;
14
- if (dstField.field_value != srcField.field_value) {
15
- return {
16
- ...srcField,
17
- history: srcField.history.concat(dstField.history),
18
- };
19
- }
20
- return dstField;
21
- }
22
- return dstField;
23
- });
24
- if (isFieldNonExist) dstItem.fields.push(srcField);
25
- });
26
- }
27
- return (result[item.item_id] = item);
24
+ worker.onmessage = function(e) {
25
+ resolve(e.data);
26
+ worker.terminate();
27
+ };
28
+
29
+ worker.onerror = function(e) {
30
+ reject();
31
+ worker.terminate();
32
+ };
33
+
34
+ worker.postMessage(chunks);
28
35
  });
29
- });
30
- return Object.values(result);
31
- }
36
+ } else {
37
+ return mergeChunksByMainThread(chunks);
38
+ }
39
+ }
@@ -0,0 +1,78 @@
1
+ export function mergeChunks(chunks) {
2
+ const result = {};
3
+
4
+ chunks.forEach((chunk) => {
5
+ chunk.items_list.forEach((item) => {
6
+ const dstItem = result[item.item_id];
7
+ if (dstItem) {
8
+ dstItem.trash = item.trash;
9
+ return item.fields.forEach((srcField) => {
10
+ let isFieldNonExist = true;
11
+ dstItem.fields = dstItem.fields.map((dstField) => {
12
+ if (Number(dstField.field_id) === Number(srcField.field_id)) {
13
+ isFieldNonExist = false;
14
+ if (dstField.field_value != srcField.field_value) {
15
+ return {
16
+ ...srcField,
17
+ history: srcField.history.concat(dstField.history),
18
+ };
19
+ }
20
+ return dstField;
21
+ }
22
+ return dstField;
23
+ });
24
+ if (isFieldNonExist) dstItem.fields.push(srcField);
25
+ });
26
+ }
27
+ return (result[item.item_id] = item);
28
+ });
29
+ });
30
+ return Object.values(result);
31
+ }
32
+
33
+
34
+ globalThis.onmessage = function(e) {
35
+ const mergedChunks = mergeChunks(e.data);
36
+ self.postMessage(mergedChunks);
37
+ }
38
+
39
+
40
+ export function mergeChunksWorker() {
41
+ return `function mergeChunks(chunks) {
42
+ const result = {};
43
+
44
+ chunks.forEach((chunk) => {
45
+ chunk.items_list.forEach((item) => {
46
+ const dstItem = result[item.item_id];
47
+ if (dstItem) {
48
+ dstItem.trash = item.trash;
49
+ return item.fields.forEach((srcField) => {
50
+ let isFieldNonExist = true;
51
+ dstItem.fields = dstItem.fields.map((dstField) => {
52
+ if (Number(dstField.field_id) === Number(srcField.field_id)) {
53
+ isFieldNonExist = false;
54
+ if (dstField.field_value != srcField.field_value) {
55
+ return {
56
+ ...srcField,
57
+ history: srcField.history.concat(dstField.history),
58
+ };
59
+ }
60
+ return dstField;
61
+ }
62
+ return dstField;
63
+ });
64
+ if (isFieldNonExist) dstItem.fields.push(srcField);
65
+ });
66
+ }
67
+ return (result[item.item_id] = item);
68
+ });
69
+ });
70
+ return Object.values(result);
71
+ }
72
+
73
+
74
+ self.onmessage = function(e) {
75
+ const mergedChunks = mergeChunks(e.data);
76
+ self.postMessage(mergedChunks);
77
+ }`;
78
+ }
@@ -140,7 +140,8 @@
140
140
  is_items_diff: false,
141
141
  new_src_items:[],
142
142
  diff_src_items:[],
143
- same_items:[]
143
+ same_items:[],
144
+ trash_src_items: [],
144
145
  };
145
146
 
146
147
  const differentSrcItemFn = function(item){
@@ -155,11 +156,32 @@
155
156
  result.new_src_items.push(item);
156
157
  }
157
158
 
159
+ const trashSrcItemFn = function(item){
160
+ result.trash_src_items.push(item);
161
+ }
162
+
158
163
 
159
164
  //--------- Compearing Src & Dst Items by item_id ---------//
160
- if(fieldToCompare){
165
+ if (
166
+ fieldToCompare
167
+ ) {
168
+ //TODO trashSrcItemFn
161
169
  compareItemsByFieldId(src, dst, fieldToCompare, differentSrcItemFn, theSameSrcItemFn, newSrcItemFn)
162
- }else compareItemsByItemId(src, dst, differentSrcItemFn, theSameSrcItemFn, newSrcItemFn)
170
+ }
171
+
172
+ if (
173
+ !fieldToCompare
174
+ ) {
175
+ compareItemsByItemId(
176
+ src,
177
+ dst,
178
+ differentSrcItemFn,
179
+ theSameSrcItemFn,
180
+ newSrcItemFn,
181
+ null,
182
+ trashSrcItemFn,
183
+ );
184
+ }
163
185
 
164
186
 
165
187
  //--------- Final Report ---------//
@@ -214,16 +236,17 @@
214
236
 
215
237
 
216
238
 
217
- function compareItemsByItemId(src, dst, differentSrcItemFn, theSameSrcItemFn, newSrcItemFn, uniqDestItemFn){
239
+ function compareItemsByItemId(src, dst, differentSrcItemFn, theSameSrcItemFn, newSrcItemFn, uniqDestItemFn, trashSrcItemFn){
218
240
  let dstItemsMap = new ItemsMapper(dst);
219
241
 
220
242
  src.forEach(srcItem => {
221
243
  let destIndex = dstItemsMap.pullItemIndex(srcItem.item_id);
222
244
 
223
245
  if(destIndex != undefined){
224
- compareTwoItems(srcItem, dst[destIndex], differentSrcItemFn, theSameSrcItemFn);
246
+ compareTwoItems(srcItem, dst[destIndex], differentSrcItemFn, theSameSrcItemFn, trashSrcItemFn);
225
247
  }else{
226
- newSrcItemFn(srcItem);
248
+ if (srcItem.trash) trashSrcItemFn(srcItem);
249
+ if (!srcItem.trash) newSrcItemFn(srcItem);
227
250
  };
228
251
  });
229
252
 
@@ -236,7 +259,7 @@
236
259
 
237
260
 
238
261
 
239
- function compareTwoItems (src, dst, differentSrcItemFn, theSameSrcItemFn ){
262
+ function compareTwoItems (src, dst, differentSrcItemFn, theSameSrcItemFn, trashSrcItemFn){
240
263
  let sameItem = true;
241
264
 
242
265
  for(let i=0; i<src.fields.length; i++){
@@ -254,8 +277,16 @@
254
277
 
255
278
  //-- Sending Compearing Result
256
279
  if (sameItem){
257
- theSameSrcItemFn(src, dst);
258
- }else differentSrcItemFn(src, dst);
280
+ if (src.trash) trashSrcItemFn(src, dst);
281
+ if (!src.trash) theSameSrcItemFn(src, dst);
282
+ }
283
+
284
+ if (
285
+ !sameItem
286
+ ) {
287
+ if (src.trash) trashSrcItemFn(src, dst);
288
+ if (!src.trash) differentSrcItemFn(src, dst);
289
+ }
259
290
  }
260
291
 
261
292
 
@@ -1,52 +1,55 @@
1
- export function makeNestedList(arr, id, parent_id, children_property, priority_property) {
2
- let array = JSON.parse(JSON.stringify(arr));
3
- let children = Boolean(children_property) ? children_property : 'children';
4
- let priority = Boolean(priority_property) ? priority_property : false;
5
- let i;
6
- for (i = 0; i < array.length; i++) {
7
- if (array[i][parent_id] && array[i][parent_id] !== 0) {
8
- array.forEach((parent) => {
9
- if (array[i][parent_id] == parent[id]) {
10
- if (!parent[children]) {
11
- parent[children] = [];
12
- }
13
- parent[children].push(array[i]);
14
- array.splice(i, 1);
15
- i == 0 ? i = 0 : i--;
16
- } else if (parent[children]) {
17
- findIdsOfChildren(parent);
18
- }
19
- });
20
- }
21
- }
22
-
23
- function findIdsOfChildren(parent) {
24
- parent[children].forEach((child) => {
25
- if (child[id] == array[i][parent_id]) {
26
- if (!child[children]) {
27
- child[children] = [];
1
+ export function makeNestedList(
2
+ arr,
3
+ id,
4
+ parent_id,
5
+ children_property = "children",
6
+ priority_property = null
7
+ ) {
8
+ let map = {};
9
+ let roots = [];
10
+
11
+ arr.forEach((item) => {
12
+ map[item[id]] = { ...item, [children_property]: [] };
13
+ });
14
+
15
+ arr.forEach((item) => {
16
+ const parentId = item[parent_id];
17
+ if (parentId && map[parentId]) {
18
+ map[parentId][children_property].push(map[item[id]]);
19
+ } else {
20
+ roots.push(map[item[id]]);
28
21
  }
29
- child[children].push(array[i]);
30
- array.splice(i, 1);
31
- i == 0 ? i = 0 : i--;
32
- } else if (child[children]) {
33
- findIdsOfChildren(child);
34
- }
35
22
  });
36
- }
37
-
38
- function sortChildrensByPriority(unsorted_array) {
39
- unsorted_array.sort( (a, b) => a[priority] - b[priority])
40
- unsorted_array.forEach(element => {
41
- if(element[children]) {
42
- sortChildrensByPriority(element[children])
43
- }
44
- })
45
- }
46
-
47
- if(priority) {
48
- sortChildrensByPriority(array);
49
- }
50
-
51
- return array;
52
- }
23
+
24
+ const sortTreeByPriority = (nodes) => {
25
+ nodes.forEach((node) => {
26
+ if (node[children_property].length > 0) {
27
+ sortTreeByPriority(node[children_property]);
28
+ }
29
+ });
30
+
31
+ if (priority_property) {
32
+ nodes.sort((a, b) => {
33
+ const priorityA = a[priority_property] ?? Infinity;
34
+ const priorityB = b[priority_property] ?? Infinity;
35
+ return priorityA - priorityB;
36
+ });
37
+ }
38
+ };
39
+
40
+ sortTreeByPriority(roots);
41
+
42
+ const cleanEmptyChildren = (nodes) => {
43
+ nodes.forEach((node) => {
44
+ if (node[children_property].length === 0) {
45
+ delete node[children_property];
46
+ } else {
47
+ cleanEmptyChildren(node[children_property]);
48
+ }
49
+ });
50
+ };
51
+
52
+ cleanEmptyChildren(roots);
53
+
54
+ return roots;
55
+ };
@@ -29,6 +29,35 @@ describe("NESTED LIST", function () {
29
29
  nestedList[0].title.should.equal('Nineth');
30
30
  })
31
31
 
32
+ it("Should return correct nested structure with children", function () {
33
+ let nestedList = gudhub.makeNestedList(nestedComplicatedListWithDocs, 'id', 'parent_id', 'children');
34
+
35
+ nestedList.should.be.an.Array().and.have.length(1);
36
+ nestedList[0].should.have.property('children');
37
+ nestedList[0].children.should.be.an.Array().and.have.length(4);
38
+ });
39
+
40
+ it("Should correctly sort children by priority", function () {
41
+ let nestedList = gudhub.makeNestedList(nestedComplicatedListWithDocs, 'id', 'parent_id', 'children', 'priority');
42
+
43
+ nestedList[0].children[0].title.should.equal('Intro');
44
+ nestedList[0].children[1].title.should.equal('Getting Started');
45
+ nestedList[0].children[2].title.should.equal('Node Installing');
46
+ });
47
+
48
+ it("Should correctly handle deeply nested structures", function () {
49
+ let nestedList = gudhub.makeNestedList(nestedComplicatedListWithDocs, 'id', 'parent_id', 'children', 'priority');
50
+ let featuresChildren = nestedList[0].children[3].children[4].children;
51
+
52
+ featuresChildren.should.be.an.Array().and.have.length(8);
53
+ featuresChildren[0].title.should.equal("Bundler");
54
+ featuresChildren[7].title.should.equal("SSR-Menu");
55
+ });
56
+
57
+ it("Should return empty array for items without parents when parent_id is not found", function () {
58
+ let nestedList = gudhub.makeNestedList([], 'id', 'parent_id', 'children');
59
+ nestedList.should.be.an.Array().and.have.length(0);
60
+ });
32
61
  });
33
62
 
34
63
  let input = [
@@ -150,7 +179,8 @@ let complicatedInput = [
150
179
  parent_id: "26553.2884361",
151
180
  title: "Child of second parent"
152
181
  }
153
- ]
182
+ ];
183
+
154
184
  let parentInput = [
155
185
  {
156
186
  "id": "27026.2937695",
@@ -182,4 +212,112 @@ let parentInput = [
182
212
  "title": "Nineth",
183
213
  "priority": "0"
184
214
  }
185
- ]
215
+ ];
216
+
217
+ let nestedComplicatedListWithDocs = [
218
+ {
219
+ id: "123001.1237001",
220
+ parent_id: "",
221
+ title: "SSR/SSG - Parent"
222
+ },
223
+ {
224
+ id: "123002.1237002",
225
+ parent_id: "123001.1237001",
226
+ title: "Intro",
227
+ priority: 1
228
+ },
229
+ {
230
+ id: "123003.1237003",
231
+ parent_id: "123001.1237001",
232
+ title: "Getting Started",
233
+ priority: 2
234
+ },
235
+ {
236
+ id: "123004.1237004",
237
+ parent_id: "123001.1237001",
238
+ title: "Node Installing",
239
+ priority: 3
240
+ },
241
+ {
242
+ id: "123005.1237005",
243
+ parent_id: "123001.1237001",
244
+ title: "Server - Parent 2"
245
+ },
246
+ {
247
+ id: "123006.1237006",
248
+ parent_id: "123005.1237005",
249
+ title: "Server",
250
+ priority: 4
251
+ },
252
+ {
253
+ id: "123007.1237007",
254
+ parent_id: "123005.1237005",
255
+ title: "Install",
256
+ priority: 5
257
+ },
258
+ {
259
+ id: "123008.1237008",
260
+ parent_id: "123005.1237005",
261
+ title: "Endpoints",
262
+ priority: 6
263
+ },
264
+ {
265
+ id: "123009.1237009",
266
+ parent_id: "123005.1237005",
267
+ title: "Configure",
268
+ priority: 7
269
+ },
270
+ {
271
+ id: "123010.1237010",
272
+ parent_id: "123005.1237005",
273
+ title: "Features - Parent 3"
274
+ },
275
+ {
276
+ id: "123011.1237011",
277
+ parent_id: "123010.1237010",
278
+ title: "Bundler",
279
+ priority: 8
280
+ },
281
+ {
282
+ id: "123012.1237012",
283
+ parent_id: "123010.1237010",
284
+ title: "RedirectsHandler",
285
+ priority: 9
286
+ },
287
+ {
288
+ id: "123013.1237013",
289
+ parent_id: "123010.1237010",
290
+ title: "SSG",
291
+ priority: 10
292
+ },
293
+ {
294
+ id: "123014.1237014",
295
+ parent_id: "123010.1237010",
296
+ title: "SSR",
297
+ priority: 11
298
+ },
299
+ {
300
+ id: "123015.1237015",
301
+ parent_id: "123010.1237010",
302
+ title: "RouteHandler",
303
+ priority: 12
304
+ },
305
+ {
306
+ id: "123016.1237016",
307
+ parent_id: "123010.1237010",
308
+ title: "SitemapGenerator",
309
+ priority: 13
310
+ },
311
+ {
312
+ id: "123017.1237017",
313
+ parent_id: "123010.1237010",
314
+ title: "ImageHandler",
315
+ priority: 14
316
+ },
317
+ {
318
+ id: "123018.1237018",
319
+ parent_id: "123010.1237010",
320
+ title: "SSR-Menu",
321
+ priority: 15
322
+ },
323
+ ];
@@ -1,4 +1,5 @@
1
1
  import Websocket from "ws";
2
+ import { IS_BROWSER_MAIN_THREAD } from "../consts.js";
2
3
 
3
4
  export class WebSocketApi {
4
5
  constructor(url, auth) {
@@ -11,7 +12,7 @@ export class WebSocketApi {
11
12
  this.ALLOWED_HEART_BEAT_DELEY = 12000;
12
13
  this.firstHeartBeat = true;
13
14
  this.reload = true;
14
- this.isBrowser = ![typeof window, typeof document].includes("undefined");
15
+ this.isBrowser = IS_BROWSER_MAIN_THREAD;
15
16
  }
16
17
 
17
18
  async addSubscription(app_id) {
@@ -1,14 +1,14 @@
1
1
  export class AppAPI {
2
- constructor(req) {
3
- this.req = req;
4
- }
5
-
6
- async getApp(app_id) {
7
- return this.req.get({
8
- url: `/api/app/get`,
9
- params: {
10
- app_id: app_id,
11
- },
12
- });
13
- }
14
- }
2
+ constructor(req) {
3
+ this.req = req;
4
+ }
5
+
6
+ async getApp(app_id) {
7
+ return this.req.get({
8
+ url: `/api/app/get`,
9
+ params: {
10
+ app_id: app_id,
11
+ },
12
+ });
13
+ }
14
+ };
@@ -4,16 +4,16 @@ export class ChunkAPI {
4
4
  }
5
5
 
6
6
  async getChunk(app_id, chunk_id) {
7
- return this.req.get({
7
+ return this.req.axiosRequest({
8
8
  url: `${this.req.root}/api/get-items-chunk/${app_id}/${chunk_id}`,
9
9
  method: 'GET'
10
10
  });
11
11
  }
12
12
 
13
13
  async getLastChunk(app_id) {
14
- return this.req.axiosRequest({
15
- url: `${this.req.root}/api/get-last-items-chunk/${app_id}`,
16
- method: 'GET'
17
- });
14
+ return this.req.axiosRequest({
15
+ url: `${this.req.root}/api/get-last-items-chunk/${app_id}`,
16
+ method: 'GET'
17
+ });
18
18
  }
19
- }
19
+ };
package/GUDHUB/config.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { IS_BROWSER } from "./consts";
2
+
1
3
  export const server_url = "https://gudhub.com/GudHub_Test";
2
4
  //export const server_url = "https://gudhub.com/GudHub_Temp";
3
5
  //export const server_url = "https://integration.gudhub.com/GudHub_Test";
@@ -8,8 +10,15 @@ export const async_modules_path = 'build/latest/async_modules_node/';
8
10
  export const automation_modules_path = 'build/latest/automation_modules/'
9
11
  export const file_server_url = 'https://gudhub.com'
10
12
 
11
- export const cache_chunk_requests = true;
12
- export const cache_app_requests = true;
13
+ export const cache_chunk_requests = true; // todo cahce could be not only indexeddb, take into account that further
14
+ export const cache_app_requests = false;
15
+
16
+ export let useWorkerToProcessRequestsData = true;
17
+ if (
18
+ !IS_BROWSER
19
+ ) {
20
+ useWorkerToProcessRequestsData = false;
21
+ }
13
22
 
14
23
  // FOR TESTS
15
24
  export const port = 9000;
package/GUDHUB/consts.js CHANGED
@@ -1 +1,15 @@
1
- export const IS_WEB = ![typeof window, typeof document].includes("undefined");
1
+ export const IS_BROWSER_MAIN_THREAD =
2
+ typeof window != 'undefined' &&
3
+ typeof document != 'undefined'
4
+
5
+ export const IS_BROWSER_WORKER_THREAD =
6
+ typeof self === "object" &&
7
+ typeof WorkerGlobalScope != 'undefined'
8
+
9
+
10
+ export const IS_BROWSER = IS_BROWSER_MAIN_THREAD || IS_BROWSER_WORKER_THREAD;
11
+
12
+ export const IS_NODE =
13
+ typeof process !== "undefined" &&
14
+ process.versions != null &&
15
+ process.versions.node != null;