@gudhub/core 1.2.4-beta.45 → 1.2.4-beta.47

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 (39) hide show
  1. package/.parcel-cache/83e7562660f7cc15-BundleGraph +0 -0
  2. package/.parcel-cache/d3a1b9507cb44047-AssetGraph +0 -0
  3. package/.parcel-cache/data.mdb +0 -0
  4. package/.parcel-cache/dc1da35000e13623-RequestGraph +0 -0
  5. package/.parcel-cache/lock.mdb +0 -0
  6. package/.parcel-cache/snapshot-dc1da35000e13623.txt +160 -163
  7. package/GUDHUB/AppProcessor/AppProcessor.js +6 -20
  8. package/GUDHUB/ChunksManager/ChunksManager.test.js +3 -0
  9. package/GUDHUB/DataService/AppDataService.js +1 -200
  10. package/GUDHUB/DataService/ChunkDataService.js +0 -4
  11. package/GUDHUB/DataService/IndexedDB/IndexedDBAppService.js +224 -263
  12. package/GUDHUB/DataService/IndexedDB/IndexedDBChunkService.js +3 -227
  13. package/GUDHUB/DataService/IndexedDB/IndexedDBService.js +124 -302
  14. package/GUDHUB/DataService/IndexedDB/StoreManager/BaseStoreManager.js +9 -36
  15. package/GUDHUB/DataService/IndexedDB/StoreManager/managers.js +4 -40
  16. package/GUDHUB/DataService/IndexedDB/appRequestWorker.js +23 -88
  17. package/GUDHUB/DataService/IndexedDB/consts.js +1 -3
  18. package/GUDHUB/DataService/IndexedDB/init.js +1 -1
  19. package/GUDHUB/DataService/IndexedDB/storeManagerConf/init.js +1 -1
  20. package/GUDHUB/DataService/export.js +73 -13
  21. package/GUDHUB/DataService/httpService/AppHttpService.js +5 -15
  22. package/GUDHUB/DataService/httpService/ChunkHttpService.js +35 -37
  23. package/GUDHUB/DataService/utils.js +24 -127
  24. package/GUDHUB/GHConstructor/createAngularModuleInstance.js +7 -4
  25. package/GUDHUB/GHConstructor/createClassInstance.js +8 -3
  26. package/GUDHUB/ItemProcessor/ItemProcessor.js +0 -18
  27. package/GUDHUB/Utils/Utils.js +0 -14
  28. package/GUDHUB/WebSocket/WebSocket.js +2 -2
  29. package/GUDHUB/api/AppApi.js +13 -13
  30. package/GUDHUB/api/ChunkApi.js +5 -5
  31. package/GUDHUB/config.js +11 -2
  32. package/GUDHUB/consts.js +6 -12
  33. package/GUDHUB/gudhub.js +7 -30
  34. package/GUDHUB/gudhubAppRequestWorker.js +1 -2
  35. package/dist/gudhub.es.js +8 -1
  36. package/dist/gudhub.umd.js +2 -2
  37. package/package.json +4 -2
  38. package/GUDHUB/ChunksManager/ChunksManager.js +0 -68
  39. package/indextest.html +0 -35
@@ -1,6 +1,6 @@
1
1
 
2
- import { appDataServiceConf } from "../export.js";
3
- import { IndexedDBAppServiceForWorker } from "../IndexedDB/IndexedDBAppService.js";
2
+ import { appDataServiceConf, AppDataServiceForWorker, ChunkDataServiceForWorker } from "../export.js";
3
+ import { WORKER_EVENTS } from "../IndexedDB/IndexedDBAppService.js";
4
4
  import { appsConf } from "../IndexedDB/appDataConf.js";
5
5
  import { IndexedDBChunkService } from "./IndexedDBChunkService.js";
6
6
  import { chunksConf } from "./chunkDataConf.js";
@@ -14,28 +14,36 @@ let appDataService = {};
14
14
  let chunkDataService = {};
15
15
 
16
16
 
17
-
18
- //TODO also ChunkDataService !!!!!!!!!!!!!!!!!!!!!!!
19
-
20
-
21
17
  self.onmessage = async function(e) {
22
- if (e.data.type === 'init') {
23
-
24
-
18
+ if (
19
+ e.data.type === WORKER_EVENTS.INIT
20
+ ) {
25
21
  e.data.gudhubSerialized.options.initWebsocket = false;
26
22
 
27
23
  gudhub = new GudHubForAppRequestWorker(e.data.gudhubSerialized.authKey, e.data.gudhubSerialized.options);
28
- appDataService = new IndexedDBAppServiceForWorker(gudhub.req, appsConf, gudhub);
29
- chunkDataService = new IndexedDBChunkService(gudhub.req, chunksMergeConf, gudhub);
24
+ appDataService = new AppDataServiceForWorker(gudhub.req, appsConf, gudhub);
25
+ chunkDataService = new ChunkDataServiceForWorker(gudhub.req, chunksMergeConf, gudhub);
26
+ }
30
27
 
28
+ if (
29
+ e.data.type == WORKER_EVENTS.PROCESS_DATA
30
+ ) {
31
31
 
32
- }
33
32
 
34
- if (e.data.type === 'processData') {
33
+ //TODO тут может прийти запрос и данные не кешируются. тогда нужно вернуть пустые данные и как-то убрать в пендинге запрос или промис в клиентском коде !!!!!!!!!!
34
+ //TODO pass parameter is cached version exist
35
35
 
36
36
 
37
37
 
38
- //todo cached could not exist !!!!!!!!!!!!!!!!!!!
38
+ if (
39
+ !e.data.usedCachedDataVersion
40
+ ) {
41
+ this.postMessage({id: e.data.id, type: WORKER_EVENTS.DECLINE_PROCESS_DATA_REQUEST});
42
+ return;
43
+ }
44
+
45
+
46
+ //todo cached could not exist !!!!!!!!!!!!!!!!!!!
39
47
 
40
48
  let cached = await appDataService.getCached(e.data.id); // merge ?
41
49
 
@@ -100,12 +108,6 @@ self.onmessage = async function(e) {
100
108
  }
101
109
 
102
110
 
103
-
104
-
105
-
106
-
107
-
108
-
109
111
  // let comparison = gudhub.compareItems(cached.items_list, newVersion.items_list);
110
112
  let comparison = gudhub.compareItems(nextVersion.items_list, cached.items_list);
111
113
 
@@ -146,80 +148,13 @@ self.onmessage = async function(e) {
146
148
 
147
149
 
148
150
  if (
149
- e.data.type === 'requestApp'
151
+ e.data.type == WORKER_EVENTS.REQUEST_APP
150
152
  ) {
151
153
 
152
- // //todo cached could not exist !!!!!!!!!!!!!!!!!!!
153
-
154
- // let cached = await appDataService.getCached(e.data.id); // merge ?
155
-
156
-
157
- // let cachedChunksList = cached.chunks;
158
-
159
-
160
- // let nextVersion = await appDataService.getAppWithoutProcessing(e.data.id);
161
-
162
-
163
- // let isMergedChunkUpdated = true;
164
-
165
-
166
- // if (
167
- // cachedChunksList.length != nextVersion.chunks.length
168
- // ) isMergedChunkUpdated = false;
169
-
170
-
171
- // //TODO here old chunks should be exactly with ids that came from app get request
172
- // if (
173
- // nextVersion.chunks.some(entry => !cachedChunksList.includes(entry))
174
- // ) isMergedChunkUpdated = false;
175
-
176
-
177
- // if (
178
- // !isMergedChunkUpdated
179
- // ) {
180
-
181
- // // TODO this is repetitive operation for getCached, maybe put all code in process or in getCached
182
-
183
- // let res = await chunkDataService.getCachedMergedChunk(e.data.id, cached.chunks);
184
-
185
- // // if (!res) res = [];
186
-
187
-
188
- // // // TODO check that res always exists
189
-
190
-
191
- // if (
192
- // res
193
- // ) {
194
- // cached.items_list = await gudhub.util.mergeChunks([
195
- // // cachedApp,
196
- // res,
197
- // cached,
198
- // ]);
199
- // } else {
200
- // // sentData.items_list = await this.gudhub.util.mergeChunks([
201
- // // cachedApp,
202
- // // sentData,
203
- // // ]);
204
- // }
205
-
206
- // // nextVersion = await appDataService.getAppWithSpecificChunksList(e.data.id, newChunksList); //todo check that here most recent always
207
- // nextVersion = await appDataService.getApp(e.data.id); //todo check that here most recent always
208
-
209
-
210
- // //TODO тут достаточно сравнить новые чанки+апп и закешированный апп, тогда будет сгенерирована вся инфа о новых данных
211
-
212
-
213
- // // return;
214
- // }
215
-
216
154
  let data = await appDataService.getApp(e.data.id); //todo check process request method seems there i return cahced version not most recent data from server
217
155
 
218
156
 
219
157
  this.postMessage({id: e.data.id, type: e.data.type, data});
220
158
 
221
159
  }
222
-
223
-
224
- // this.appRequestAndProcessWorker.postMessage({ type: 'requestApp', id: id });
225
160
  };
@@ -1,4 +1,2 @@
1
1
  export const dbName = "gudhub";
2
- // export const dbVersion = 7;
3
-
4
- //todo dynamic version change chatgpt used, maybe isnt good to use static version
2
+ // export const dbVersion = 7;
@@ -1,4 +1,4 @@
1
- import { IS_BROWSER, IS_WEB } from "../../consts.js";
1
+ import { IS_BROWSER } from "../../consts.js";
2
2
  import { appsConf } from "./appDataConf.js";
3
3
  import { chunksConf } from "./chunkDataConf.js";
4
4
  import { dbName, dbVersion } from "./consts.js";
@@ -1 +1 @@
1
- //move appsdbcons chunksdbconf and chunkcacheconf to here
1
+ //move appsdbcons chunksdbconf and chunkcacheconf to here maybe
@@ -1,6 +1,6 @@
1
- import { cache_app_requests, cache_chunk_requests } from "../config.js";
2
- import { IS_BROWSER, IS_WEB } from "../consts.js";
3
- import { IndexedDBAppService } from "./IndexedDB/IndexedDBAppService.js";
1
+ import { cache_app_requests, cache_chunk_requests, useWorkerToProcessRequestsData } from "../config.js"; //TODO maybe this constants are not necessary! seems still required
2
+ import { IS_BROWSER } from "../consts.js";
3
+ import { AppHttpWorkerService, AppIndexedDBWorkerService, AppThroughWebWorkerService, IndexedDBAppService, IndexedDBAppServiceForWorker } from "./IndexedDB/IndexedDBAppService.js";
4
4
  import { IndexedDBChunkService } from "./IndexedDB/IndexedDBChunkService.js";
5
5
  import { appsConf } from "./IndexedDB/appDataConf.js";
6
6
  import { chunksConf } from "./IndexedDB/chunkDataConf.js";
@@ -8,7 +8,7 @@ import { AppHttpService } from "./httpService/AppHttpService.js";
8
8
  import { ChunkHttpService } from "./httpService/ChunkHttpService.js";
9
9
 
10
10
 
11
- import "./IndexedDB/init.js";
11
+ import "./IndexedDB/init.js"; // <-----------------------------------------
12
12
 
13
13
 
14
14
  //TODO confs should be used only for appropriate classes therefore it doesnt make sense to export them here
@@ -20,32 +20,92 @@ let appDataServiceConf;
20
20
  let chunkDataServiceConf;
21
21
 
22
22
 
23
+
24
+ if (
25
+ !IS_BROWSER
26
+ ) {
27
+ useWorkerToProcessRequestsData = false;
28
+ }
29
+
30
+ if (
31
+ IS_BROWSER &&
32
+ cache_app_requests &&
33
+ !useWorkerToProcessRequestsData
34
+ ) {
35
+ AppDataService = IndexedDBAppService;
36
+ appDataServiceConf = appsConf;
37
+ }
38
+
39
+
40
+ if (
41
+ IS_BROWSER &&
42
+ useWorkerToProcessRequestsData &&
43
+ !cache_app_requests
44
+ ) {
45
+ AppDataService = AppThroughWebWorkerService;
46
+ appDataServiceConf = appsConf; // todo seems isnt required for picked class
47
+ }
48
+
49
+
50
+ if (
51
+ !IS_BROWSER
52
+ ) {
53
+ AppDataService = AppHttpService;
54
+ }
55
+
56
+ if (
57
+ useWorkerToProcessRequestsData &&
58
+ !cache_app_requests
59
+ ) {
60
+ AppDataServiceForWorker = AppHttpWorkerService;
61
+ }
62
+
63
+
64
+ if (
65
+ useWorkerToProcessRequestsData &&
66
+ cache_app_requests
67
+ ) {
68
+ throw new Error;
69
+ // not implemented
70
+ }
71
+
72
+
23
73
  if (
24
74
  IS_BROWSER &&
25
- cache_chunk_requests
75
+ cache_chunk_requests &&
76
+ !useWorkerToProcessRequestsData
26
77
  ) {
27
78
  ChunkDataService = IndexedDBChunkService;
28
79
  chunkDataServiceConf = chunksConf;
80
+ }
29
81
 
30
- } else {
31
- ChunkDataService = ChunkHttpService;
82
+ if (
83
+ IS_BROWSER &&
84
+ cache_chunk_requests &&
85
+ useWorkerToProcessRequestsData
86
+ ) {
87
+ // here should be http instead, but should be revised variable ChunkDataService usage
88
+ ChunkDataService = IndexedDBChunkService;
89
+ chunkDataServiceConf = chunksConf;
32
90
  }
33
91
 
34
92
 
35
93
  if (
36
- IS_BROWSER &&
37
- cache_app_requests // todo here outdated approach
94
+ !IS_BROWSER
38
95
  ) {
39
- AppDataService = IndexedDBAppService; // here will be AppHttpService for browser too, check compatability. Checked. seems different code. IndexedDBAppService uses worker
40
- appDataServiceConf = appsConf;
41
- } else {
42
- AppDataService = AppHttpService;
96
+ ChunkDataService = ChunkHttpService;
43
97
  }
44
98
 
45
99
 
100
+ let AppDataServiceForWorker = AppHttpWorkerService;
101
+ let ChunkDataServiceForWorker = IndexedDBChunkService;
102
+
103
+
46
104
  export {
47
105
  AppDataService,
48
106
  ChunkDataService,
49
107
  appDataServiceConf,
50
108
  chunkDataServiceConf,
109
+ AppDataServiceForWorker,
110
+ ChunkDataServiceForWorker,
51
111
  };
@@ -1,6 +1,5 @@
1
1
  import { AppAPI } from "../../api/AppApi.js";
2
2
  import { AppDataService } from "../AppDataService.js";
3
- import { ChunkDataService } from "../export.js";
4
3
  import { objectAssignWithOverride } from "../utils.js";
5
4
  import { HttpService } from "./HttpService.js";
6
5
 
@@ -10,29 +9,20 @@ export class AppHttpService extends AppDataService {
10
9
 
11
10
  this.appApi = new AppAPI(req);
12
11
 
13
- let indexDBService = new HttpService(conf);
14
-
15
-
16
- // this.chunkDataService = new ChunkDataService; //TODO move to
12
+ let httpService = new HttpService(conf);
17
13
 
18
- objectAssignWithOverride(this, indexDBService);
14
+ objectAssignWithOverride(this, httpService);
19
15
  }
20
16
 
21
17
 
18
+ // TODO getApp -> getAppAndProcessData
22
19
  async getApp(id) {
23
20
  let sentData = await this.appApi.getApp(id);
24
- return this.processRequestedApp(id, sentData); //TODO check is it ok to trigger change isnide method for AppHttpService
21
+ return this.processRequestedApp(id, sentData);
25
22
  }
26
23
 
27
- //TODO should be getApp and getAppAndProcessData - refactor whole code to use them
28
-
29
-
30
-
31
-
32
- //TODO андрей говорил про то что там надо фильтровать айтемы удаленные, я так и не доделал
33
-
34
-
35
24
 
25
+ // TODO -> getApp
36
26
  async getAppWithoutProcessing(id) {
37
27
  return this.appApi.getApp(id);
38
28
  }
@@ -4,50 +4,48 @@ import { objectAssignWithOverride } from "../utils.js";
4
4
  import { HttpService } from "./HttpService.js";
5
5
 
6
6
  export class ChunkHttpService extends ChunkDataService {
7
- constructor(req, conf) {
8
- super();
9
-
10
- this.chunkApi = new ChunkAPI(req);
7
+ constructor(req, conf) {
8
+ super();
11
9
 
12
- let httpService = new HttpService(conf);
13
-
14
- objectAssignWithOverride(this, httpService);
15
- }
10
+ this.chunkApi = new ChunkAPI(req);
11
+
12
+ let httpService = new HttpService(conf);
16
13
 
17
- async getChunk(app_id, id) {
18
- return this.chunkApi.getChunk(app_id, id);
19
- }
14
+ objectAssignWithOverride(this, httpService);
15
+ }
20
16
 
21
- async getChunksForId(app_id) {
22
- // maybe use app get api for now and return app.chunks from there
17
+ async getChunk(app_id, id) {
18
+ return this.chunkApi.getChunk(app_id, id);
19
+ }
23
20
 
24
- return []; // list of chunks
25
- }
21
+ async getChunksForId(app_id) {
22
+ // maybe use app get api for now and return app.chunks from there
26
23
 
24
+ return []; // list of chunks
25
+ }
27
26
 
28
- getCachedMergedChunk(id, chunkHashesList) {
29
27
 
30
- }
28
+ getCachedMergedChunk(id, chunkHashesList) {
29
+ // implementation doesnt have cached
30
+ }
31
31
 
32
+ getMergedChunkForIDList(id, chunkHashesList) {
33
+
34
+ }
32
35
 
33
- //here
34
- getMergedChunkForIDList(id, chunkHashesList) {
35
-
36
- }
37
-
38
-
39
- putChunk() {
40
- //do nothing
41
- }
42
-
43
-
44
- static [Symbol.hasInstance](instance) {
45
- try {
46
- if (instance instanceof ChunkHttpService) return true;
47
- if (instance instanceof HttpService) return true; //TODO requires multiple inheritance, thhink how to overcome it
48
- return false;
49
- } catch (error) {
50
- return false;
51
- }
52
- }
36
+
37
+ putChunk() {
38
+ //do nothing
39
+ }
40
+
41
+
42
+ static [Symbol.hasInstance](instance) {
43
+ try {
44
+ if (instance instanceof ChunkHttpService) return true;
45
+ if (instance instanceof HttpService) return true; //TODO requires multiple inheritance, thhink how to overcome it
46
+ return false;
47
+ } catch (error) {
48
+ return false;
49
+ }
50
+ }
53
51
  }
@@ -1,137 +1,34 @@
1
1
 
2
2
  export let objectAssignWithoutOverride = (target, ...sourceList) => {
3
- for (let source of sourceList) {
4
- if (!source) continue;
5
- for(let key of Object.keys(source)) {//this doesnt iterate over class like source properties
6
- if (!(key in target)) {//checks own and inherited keys, works fine also for class prototypes and instances
7
- const desc = Object.getOwnPropertyDescriptor(source, key);
8
- if (desc.enumerable) Object.defineProperty(target, key, desc);
9
- }
10
- }
11
- }
12
- };
13
-
14
- export let objectAssignWithOverride = (target, ...sourceList) => {
15
- for (let source of sourceList) {
16
- if (!source) continue;
17
- for(let key of Object.keys(source)) {//this doesnt iterate over class like source properties
3
+ for (let source of sourceList) {
4
+ if (!source) continue;
5
+ for(let key of Object.keys(source)) {//this doesnt iterate over class like source properties
6
+ if (!(key in target)) {//checks own and inherited keys, works fine also for class prototypes and instances
18
7
  const desc = Object.getOwnPropertyDescriptor(source, key);
19
8
  if (desc.enumerable) Object.defineProperty(target, key, desc);
20
9
  }
21
10
  }
22
- };
23
-
24
-
25
-
26
- export let checkInstanceModifier = (target, ...sourceList) => {
27
- for (let source of sourceList) {
28
- if (!source) continue;
29
- for(let key of Object.keys(source)) {//this doesnt iterate over class like source properties
30
- const desc = Object.getOwnPropertyDescriptor(source, key);
31
- if (desc.enumerable) Object.defineProperty(target, key, desc);
32
- }
11
+ }
12
+ };
13
+
14
+ export let objectAssignWithOverride = (target, ...sourceList) => {
15
+ for (let source of sourceList) {
16
+ if (!source) continue;
17
+ for(let key of Object.keys(source)) {//this doesnt iterate over class like source properties
18
+ const desc = Object.getOwnPropertyDescriptor(source, key);
19
+ if (desc.enumerable) Object.defineProperty(target, key, desc);
33
20
  }
34
- };
35
-
36
-
37
-
38
- // // Base classes
39
- // class IndexedDBMixin {
40
- // constructor(dbName, version) {
41
- // this.dbName = dbName;
42
- // this.version = version;
43
- // this.dbPromise = this.openConnection();
44
- // }
45
-
46
- // openConnection() {
47
- // return new Promise((resolve, reject) => {
48
- // const request = indexedDB.open(this.dbName, this.version);
49
-
50
- // request.onupgradeneeded = (event) => {
51
- // const db = event.target.result;
52
- // if (!db.objectStoreNames.contains('storeName')) {
53
- // db.createObjectStore('storeName', { keyPath: 'id' });
54
- // }
55
- // };
21
+ }
22
+ };
56
23
 
57
- // request.onsuccess = (event) => resolve(event.target.result);
58
- // request.onerror = (event) => reject(event.target.error);
59
- // });
60
- // }
61
24
 
62
- // async getDB() {
63
- // return await this.dbPromise;
64
- // }
65
-
66
- // async addRecord(storeName, record) {
67
- // const db = await this.getDB();
68
- // return new Promise((resolve, reject) => {
69
- // const transaction = db.transaction(storeName, 'readwrite');
70
- // const store = transaction.objectStore(storeName);
71
- // const request = store.add(record);
72
25
 
73
- // request.onsuccess = () => resolve(request.result);
74
- // request.onerror = () => reject(request.error);
75
- // });
76
- // }
77
-
78
- // async getRecord(storeName, key) {
79
- // const db = await this.getDB();
80
- // return new Promise((resolve, reject) => {
81
- // const transaction = db.transaction(storeName, 'readonly');
82
- // const store = transaction.objectStore(storeName);
83
- // const request = store.get(key);
84
-
85
- // request.onsuccess = () => resolve(request.result);
86
- // request.onerror = () => reject(request.error);
87
- // });
88
- // }
89
- // }
90
-
91
- // class LoggingMixin {
92
- // log(message) {
93
- // console.log(message);
94
- // }
95
-
96
- // error(message) {
97
- // console.error(message);
98
- // }
99
- // }
100
-
101
- // // Mixin function
102
- // function applyMixins(targetClass, baseClasses) {
103
- // baseClasses.forEach(baseClass => {
104
- // Object.getOwnPropertyDescriptors(baseClass.prototype).forEach(descriptor => {
105
- // Object.defineProperty(targetClass.prototype, descriptor[0], descriptor[1]);
106
- // });
107
- // });
108
- // }
109
-
110
- // // Combined class
111
- // class EnhancedIndexedDB extends IndexedDBMixin {
112
- // constructor(dbName, version) {
113
- // super(dbName, version);
114
- // }
115
- // }
116
-
117
- // // Apply mixins
118
- // applyMixins(EnhancedIndexedDB, [LoggingMixin]);
119
-
120
- // // Usage example
121
- // const dbFacade = new EnhancedIndexedDB('myDatabase', 1);
122
-
123
- // dbFacade.addRecord('storeName', { id: 1, name: 'Sample' })
124
- // .then((id) => {
125
- // dbFacade.log('Record added with id: ' + id);
126
- // })
127
- // .catch((error) => {
128
- // dbFacade.error('Error adding record: ' + error);
129
- // });
130
-
131
- // dbFacade.getRecord('storeName', 1)
132
- // .then((record) => {
133
- // dbFacade.log('Record retrieved: ' + JSON.stringify(record));
134
- // })
135
- // .catch((error) => {
136
- // dbFacade.error('Error retrieving record: ' + error);
137
- // });
26
+ export let checkInstanceModifier = (target, ...sourceList) => {
27
+ for (let source of sourceList) {
28
+ if (!source) continue;
29
+ for(let key of Object.keys(source)) {//this doesnt iterate over class like source properties
30
+ const desc = Object.getOwnPropertyDescriptor(source, key);
31
+ if (desc.enumerable) Object.defineProperty(target, key, desc);
32
+ }
33
+ }
34
+ };
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import { IS_BROWSER_MAIN_THREAD, IS_WEB } from './../consts.js';
2
+ import { IS_BROWSER_MAIN_THREAD } from './../consts.js';
3
3
 
4
4
  /*************** FAKE ANGULAR $Q ***************/
5
5
  // It's needed when we import angular code.
@@ -85,8 +85,9 @@ export default async function createAngularModuleInstance(gudhub, module_id, mod
85
85
  let angularModule;
86
86
  let importedClass;
87
87
 
88
- // todo IS_BROWSER_MAIN_PROCESS ?
89
- if (IS_BROWSER_MAIN_THREAD) {
88
+ if (
89
+ IS_BROWSER_MAIN_THREAD
90
+ ) {
90
91
 
91
92
  if(window.angular) {
92
93
 
@@ -296,7 +297,9 @@ export default async function createAngularModuleInstance(gudhub, module_id, mod
296
297
 
297
298
  // We need these methods in browser environment only
298
299
 
299
- if (IS_BROWSER_MAIN_THREAD) {
300
+ if (
301
+ IS_BROWSER_MAIN_THREAD
302
+ ) {
300
303
 
301
304
  //*************** EXTEND CONTROLLER ****************//
302
305
 
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import { IS_BROWSER_MAIN_THREAD, IS_WEB } from './../consts.js';
2
+ import { IS_BROWSER, IS_BROWSER_MAIN_THREAD } from './../consts.js';
3
3
 
4
4
  export default async function createClassInstance(gudhub, module_id, js_url, css_url, nodeWindow) {
5
5
 
@@ -14,7 +14,9 @@ export default async function createClassInstance(gudhub, module_id, js_url, css
14
14
  // Import module using dynamic import
15
15
 
16
16
  let downloadModule = (url) => {
17
- if (!IS_BROWSER_MAIN_THREAD && !global.hasOwnProperty('window')) {
17
+ if (
18
+ !IS_BROWSER_MAIN_THREAD
19
+ ) {
18
20
  global.window = proxy;
19
21
  global.document = nodeWindow.document;
20
22
  global.Element = nodeWindow.Element;
@@ -67,7 +69,10 @@ export default async function createClassInstance(gudhub, module_id, js_url, css
67
69
  // Check if there is url to css file of module
68
70
  // If true, and there is no css for this data type, than create link tag to this css in head
69
71
 
70
- if (css_url && IS_BROWSER_MAIN_THREAD) {
72
+ if (
73
+ css_url &&
74
+ IS_BROWSER
75
+ ) {
71
76
  const linkTag = document.createElement('link');
72
77
  linkTag.href = css_url;
73
78
  linkTag.setAttribute('data-module', module_id);
@@ -118,24 +118,6 @@ export class ItemProcessor {
118
118
  return items;
119
119
  }
120
120
 
121
- //here
122
-
123
- /////
124
- handleItemsChange(id, prevVersion, nextVersion) {
125
- let compareRes = this.util.compareItems(prevVersion.items_list, nextVersion.items_list);
126
-
127
- this.updateItemsInStorage(id, compareRes.diff_src_items);
128
- this.addItemsToStorage(id, compareRes.new_src_items);
129
- }
130
-
131
-
132
- //
133
- triggerItemsChange(id, compareRes) {
134
- this.updateItemsInStorage(id, compareRes.diff_src_items);
135
- this.addItemsToStorage(id, compareRes.new_src_items);
136
- }
137
-
138
- //
139
121
  handleDiff(id, compare) {
140
122
  this.updateItemsInStorage(id, compare.diff_src_items);
141
123
  this.addItemsToStorage(id, compare.new_src_items);