@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.
- package/.parcel-cache/83e7562660f7cc15-BundleGraph +0 -0
- package/.parcel-cache/d3a1b9507cb44047-AssetGraph +0 -0
- package/.parcel-cache/data.mdb +0 -0
- package/.parcel-cache/dc1da35000e13623-RequestGraph +0 -0
- package/.parcel-cache/lock.mdb +0 -0
- package/.parcel-cache/snapshot-dc1da35000e13623.txt +160 -163
- package/GUDHUB/AppProcessor/AppProcessor.js +6 -20
- package/GUDHUB/ChunksManager/ChunksManager.test.js +3 -0
- package/GUDHUB/DataService/AppDataService.js +1 -200
- package/GUDHUB/DataService/ChunkDataService.js +0 -4
- package/GUDHUB/DataService/IndexedDB/IndexedDBAppService.js +224 -263
- package/GUDHUB/DataService/IndexedDB/IndexedDBChunkService.js +3 -227
- package/GUDHUB/DataService/IndexedDB/IndexedDBService.js +124 -302
- package/GUDHUB/DataService/IndexedDB/StoreManager/BaseStoreManager.js +9 -36
- package/GUDHUB/DataService/IndexedDB/StoreManager/managers.js +4 -40
- package/GUDHUB/DataService/IndexedDB/appRequestWorker.js +23 -88
- package/GUDHUB/DataService/IndexedDB/consts.js +1 -3
- package/GUDHUB/DataService/IndexedDB/init.js +1 -1
- package/GUDHUB/DataService/IndexedDB/storeManagerConf/init.js +1 -1
- package/GUDHUB/DataService/export.js +73 -13
- package/GUDHUB/DataService/httpService/AppHttpService.js +5 -15
- package/GUDHUB/DataService/httpService/ChunkHttpService.js +35 -37
- package/GUDHUB/DataService/utils.js +24 -127
- package/GUDHUB/GHConstructor/createAngularModuleInstance.js +7 -4
- package/GUDHUB/GHConstructor/createClassInstance.js +8 -3
- package/GUDHUB/ItemProcessor/ItemProcessor.js +0 -18
- package/GUDHUB/Utils/Utils.js +0 -14
- package/GUDHUB/WebSocket/WebSocket.js +2 -2
- package/GUDHUB/api/AppApi.js +13 -13
- package/GUDHUB/api/ChunkApi.js +5 -5
- package/GUDHUB/config.js +11 -2
- package/GUDHUB/consts.js +6 -12
- package/GUDHUB/gudhub.js +7 -30
- package/GUDHUB/gudhubAppRequestWorker.js +1 -2
- package/dist/gudhub.es.js +8 -1
- package/dist/gudhub.umd.js +2 -2
- package/package.json +4 -2
- package/GUDHUB/ChunksManager/ChunksManager.js +0 -68
- package/indextest.html +0 -35
package/GUDHUB/Utils/Utils.js
CHANGED
|
@@ -24,7 +24,6 @@ import { FileHelper } from "./FIleHelper/FileHelper.js";
|
|
|
24
24
|
import { compareObjects } from "./compareObjects/compareObjects.js";
|
|
25
25
|
import { dynamicPromiseAll } from "./dynamicPromiseAll/dynamicPromiseAll.js";
|
|
26
26
|
import { sortItems } from './filter/sortItems.js';
|
|
27
|
-
import { mergeChunksWorker } from "./merge_chunks/merge_chunks.worker.js";
|
|
28
27
|
|
|
29
28
|
export class Utils {
|
|
30
29
|
constructor(gudhub) {
|
|
@@ -127,7 +126,6 @@ export class Utils {
|
|
|
127
126
|
);
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
//here
|
|
131
129
|
compareItems(sourceItems, destinationItems, fieldToCompare) {
|
|
132
130
|
return compareItems(sourceItems, destinationItems, fieldToCompare);
|
|
133
131
|
}
|
|
@@ -146,17 +144,6 @@ export class Utils {
|
|
|
146
144
|
|
|
147
145
|
async mergeChunks(chunks) {
|
|
148
146
|
return mergeChunks(chunks);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// const chunkWorkerBlob = new Blob([mergeChunksWorker()], {
|
|
152
|
-
// type: "application/javascript",
|
|
153
|
-
// });
|
|
154
|
-
// this.worker = new Worker(URL.createObjectURL(chunkWorkerBlob));
|
|
155
|
-
// this.worker.postMessage(chunks);
|
|
156
|
-
// this.worker.addEventListener("message", (event) => {
|
|
157
|
-
// const { diff } = event.data;
|
|
158
|
-
// callback(event.data);
|
|
159
|
-
// });
|
|
160
147
|
}
|
|
161
148
|
|
|
162
149
|
mergeFieldLists(fieldsToView, fieldList) {
|
|
@@ -225,7 +212,6 @@ export class Utils {
|
|
|
225
212
|
return compareObjects(obj1, obj2);
|
|
226
213
|
}
|
|
227
214
|
|
|
228
|
-
//
|
|
229
215
|
compareAppsItemsLists(items_list1, items_list2, callback) {
|
|
230
216
|
const chunkWorkerBlob = new Blob([compare_items_lists_Worker()], {
|
|
231
217
|
type: "application/javascript",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Websocket from "ws";
|
|
2
|
-
import {
|
|
2
|
+
import { IS_BROWSER_MAIN_THREAD } from "../consts.js";
|
|
3
3
|
|
|
4
4
|
export class WebSocketApi {
|
|
5
5
|
constructor(url, auth) {
|
|
@@ -12,7 +12,7 @@ export class WebSocketApi {
|
|
|
12
12
|
this.ALLOWED_HEART_BEAT_DELEY = 12000;
|
|
13
13
|
this.firstHeartBeat = true;
|
|
14
14
|
this.reload = true;
|
|
15
|
-
this.isBrowser =
|
|
15
|
+
this.isBrowser = IS_BROWSER_MAIN_THREAD;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
async addSubscription(app_id) {
|
package/GUDHUB/api/AppApi.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export class AppAPI {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
};
|
package/GUDHUB/api/ChunkApi.js
CHANGED
|
@@ -11,9 +11,9 @@ export class ChunkAPI {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async getLastChunk(app_id) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 =
|
|
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,21 +1,15 @@
|
|
|
1
|
-
export const IS_BROWSER_MAIN_THREAD =
|
|
1
|
+
export const IS_BROWSER_MAIN_THREAD =
|
|
2
|
+
typeof window != 'undefined' &&
|
|
3
|
+
typeof document != 'undefined'
|
|
2
4
|
|
|
3
|
-
export const
|
|
5
|
+
export const IS_BROWSER_WORKER_THREAD =
|
|
4
6
|
typeof self === "object" &&
|
|
5
7
|
typeof WorkerGlobalScope != 'undefined'
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
export const IS_BROWSER = IS_BROWSER_MAIN_THREAD ||
|
|
10
|
+
export const IS_BROWSER = IS_BROWSER_MAIN_THREAD || IS_BROWSER_WORKER_THREAD;
|
|
9
11
|
|
|
10
12
|
export const IS_NODE =
|
|
11
|
-
// @ts-expect-error
|
|
12
13
|
typeof process !== "undefined" &&
|
|
13
|
-
// @ts-expect-error
|
|
14
14
|
process.versions != null &&
|
|
15
|
-
|
|
16
|
-
process.versions.node != null;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// IS_WEB
|
|
15
|
+
process.versions.node != null;
|
package/GUDHUB/gudhub.js
CHANGED
|
@@ -10,15 +10,14 @@ import { AppProcessor } from "./AppProcessor/AppProcessor.js";
|
|
|
10
10
|
import { ItemProcessor } from "./ItemProcessor/ItemProcessor.js";
|
|
11
11
|
import { FieldProcessor } from "./FieldProcessor/FieldProcessor.js";
|
|
12
12
|
import { FileManager } from "./FileManager/FileManager.js";
|
|
13
|
-
// import { ChunksManager } from "./ChunksManager/ChunksManager.js";
|
|
14
13
|
import { DocumentManager } from "./DocumentManager/DocumentManager.js";
|
|
15
14
|
import { Interpritate } from './GHConstructor/interpritate.js'
|
|
16
|
-
import {
|
|
15
|
+
import { IS_BROWSER_MAIN_THREAD } from "./consts.js";
|
|
17
16
|
import { WebsocketHandler } from './WebSocket/WebsocketHandler.js';
|
|
18
17
|
import { GroupSharing } from './Utils/sharing/GroupSharing.js';
|
|
19
18
|
import { Sharing } from './Utils/sharing/Sharing.js';
|
|
20
19
|
import { WebSocketEmitter } from './WebSocket/WebSocketEmitter.js';
|
|
21
|
-
import { AppDataService,
|
|
20
|
+
import { AppDataService, appDataServiceConf } from "./DataService/export.js";
|
|
22
21
|
|
|
23
22
|
export class GudHub {
|
|
24
23
|
constructor(
|
|
@@ -41,7 +40,7 @@ export class GudHub {
|
|
|
41
40
|
this.serialized = {
|
|
42
41
|
authKey,
|
|
43
42
|
options,
|
|
44
|
-
}
|
|
43
|
+
};
|
|
45
44
|
|
|
46
45
|
this.config = options;
|
|
47
46
|
this.ghconstructor = new GHConstructor(this);
|
|
@@ -66,15 +65,6 @@ export class GudHub {
|
|
|
66
65
|
|
|
67
66
|
this.ws = new WebSocketApi(options.wss_url, this.auth);
|
|
68
67
|
|
|
69
|
-
//todo
|
|
70
|
-
// this.chunksManager = new ChunksManager(
|
|
71
|
-
// this.storage,
|
|
72
|
-
// this.pipeService,
|
|
73
|
-
// this.req,
|
|
74
|
-
// this.util,
|
|
75
|
-
// new ChunkDataService(this.req, chunkDataServiceConf, this),
|
|
76
|
-
// );
|
|
77
|
-
|
|
78
68
|
this.initializeAppProcessor();
|
|
79
69
|
|
|
80
70
|
this.itemProcessor = new ItemProcessor(
|
|
@@ -113,7 +103,6 @@ export class GudHub {
|
|
|
113
103
|
this.pipeService,
|
|
114
104
|
this.req,
|
|
115
105
|
this.ws,
|
|
116
|
-
// this.chunksManager,
|
|
117
106
|
this.util,
|
|
118
107
|
this.config.activateSW,
|
|
119
108
|
new AppDataService(this.req, appDataServiceConf, this),
|
|
@@ -121,7 +110,10 @@ export class GudHub {
|
|
|
121
110
|
}
|
|
122
111
|
|
|
123
112
|
async activateSW(swLink) {
|
|
124
|
-
if (
|
|
113
|
+
if (
|
|
114
|
+
IS_BROWSER_MAIN_THREAD &&
|
|
115
|
+
"serviceWorker" in window.navigator
|
|
116
|
+
) {
|
|
125
117
|
try {
|
|
126
118
|
const sw = await window.navigator.serviceWorker.register(swLink);
|
|
127
119
|
sw.update()
|
|
@@ -248,21 +240,6 @@ export class GudHub {
|
|
|
248
240
|
return this.util.sortItems(items, options);
|
|
249
241
|
}
|
|
250
242
|
|
|
251
|
-
|
|
252
|
-
//
|
|
253
|
-
//here
|
|
254
|
-
triggerAppChange(id, prevVersion, newVersion) {
|
|
255
|
-
this.itemProcessor.handleItemsChange(id, prevVersion, newVersion);
|
|
256
|
-
this.appProcessor.handleAppChange(id, prevVersion, newVersion);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
//
|
|
261
|
-
//TODO handleAppChange
|
|
262
|
-
triggerIemsChange(id, compareRes) {
|
|
263
|
-
this.itemProcessor.triggerItemsChange(id, compareRes);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
243
|
jsonToItems(json, map) {
|
|
267
244
|
return this.util.jsonToItems(json, map);
|
|
268
245
|
}
|