@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.
- package/.parcel-cache/83e7562660f7cc15-BundleGraph +0 -0
- package/.parcel-cache/9a0d07555444f4da-AssetGraph +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 +29402 -0
- package/.parcelrc.appRequestWorker +4 -0
- package/GUDHUB/AppProcessor/AppProcessor.js +58 -26
- package/GUDHUB/ChunksManager/ChunksManager.test.js +11 -4
- package/GUDHUB/DataService/AppDataService.js +36 -1
- package/GUDHUB/DataService/ChunkDataService.js +7 -1
- package/GUDHUB/DataService/IndexedDB/IndexedDBAppService.js +773 -43
- package/GUDHUB/DataService/IndexedDB/IndexedDBChunkService.js +118 -85
- package/GUDHUB/DataService/IndexedDB/IndexedDBService.js +171 -7
- package/GUDHUB/DataService/IndexedDB/StoreManager/BaseStoreManager.js +97 -0
- package/GUDHUB/DataService/IndexedDB/StoreManager/managers.js +77 -0
- package/GUDHUB/DataService/IndexedDB/appDataConf.js +6 -3
- package/GUDHUB/DataService/IndexedDB/appRequestWorker.js +163 -0
- package/GUDHUB/DataService/IndexedDB/chunkDataConf.js +3 -3
- package/GUDHUB/DataService/IndexedDB/consts.js +1 -1
- package/GUDHUB/DataService/IndexedDB/init.js +18 -17
- package/GUDHUB/DataService/IndexedDB/storeManagerConf/chunkCacheStoreManagerConf.js +11 -0
- package/GUDHUB/DataService/IndexedDB/storeManagerConf/init.js +1 -0
- package/GUDHUB/DataService/export.js +69 -14
- package/GUDHUB/DataService/httpService/AppHttpService.js +13 -5
- package/GUDHUB/DataService/httpService/ChunkHttpService.js +41 -26
- package/GUDHUB/DataService/utils.js +27 -27
- package/GUDHUB/FileManager/FileManager.js +7 -3
- package/GUDHUB/GHConstructor/createAngularModuleInstance.js +63 -42
- package/GUDHUB/GHConstructor/createClassInstance.js +8 -3
- package/GUDHUB/ItemProcessor/ItemProcessor.js +14 -6
- package/GUDHUB/Storage/ModulesList.js +66 -3
- package/GUDHUB/Utils/AppsTemplateService/AppsTemplateService.js +48 -5
- package/GUDHUB/Utils/Utils.js +29 -1
- package/GUDHUB/Utils/filter/filter.js +32 -1
- package/GUDHUB/Utils/get_date/get_date.test.js +3 -12
- package/GUDHUB/Utils/merge_chunks/merge_chunks.js +36 -28
- package/GUDHUB/Utils/merge_chunks/merge_chunks.worker.js +78 -0
- package/GUDHUB/Utils/merge_compare_items/merge_compare_items.js +40 -9
- package/GUDHUB/Utils/nested_list/nested_list.js +53 -50
- package/GUDHUB/Utils/nested_list/nested_list.test.js +140 -2
- package/GUDHUB/WebSocket/WebSocket.js +2 -1
- package/GUDHUB/api/AppApi.js +13 -13
- package/GUDHUB/api/ChunkApi.js +6 -6
- package/GUDHUB/config.js +11 -2
- package/GUDHUB/consts.js +15 -1
- package/GUDHUB/gudhub.js +48 -26
- package/GUDHUB/gudhubAppRequestWorker.js +18 -0
- package/build.sh +127 -0
- package/diff.txt +1221 -0
- package/dist/gudhub.es.js +13455 -0
- package/dist/gudhub.umd.js +197 -0
- package/index.js +3 -1
- package/indexUMD.js +0 -2
- package/package.json +38 -22
- package/umd/library.min.js +285 -2
- package/umd/library.min.js.map +1 -1
- package/vite.config.esm.js +72 -0
- package/vite.config.umd.js +68 -0
- package/GUDHUB/ChunksManager/ChunksManager.js +0 -68
- package/umd/library.min.js.LICENSE.txt +0 -13
- package/webpack.config.js +0 -33
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(
|
|
@@ -37,6 +36,12 @@ export class GudHub {
|
|
|
37
36
|
expirydate: this.expirydate
|
|
38
37
|
}
|
|
39
38
|
) {
|
|
39
|
+
|
|
40
|
+
this.serialized = {
|
|
41
|
+
authKey,
|
|
42
|
+
options,
|
|
43
|
+
};
|
|
44
|
+
|
|
40
45
|
this.config = options;
|
|
41
46
|
this.ghconstructor = new GHConstructor(this);
|
|
42
47
|
this.interpritate = new Interpritate(this);
|
|
@@ -59,23 +64,9 @@ export class GudHub {
|
|
|
59
64
|
this.req.init(this.auth.getToken.bind(this.auth));
|
|
60
65
|
|
|
61
66
|
this.ws = new WebSocketApi(options.wss_url, this.auth);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.req,
|
|
66
|
-
this.util,
|
|
67
|
-
new ChunkDataService(this.req, chunkDataServiceConf),
|
|
68
|
-
);
|
|
69
|
-
this.appProcessor = new AppProcessor(
|
|
70
|
-
this.storage,
|
|
71
|
-
this.pipeService,
|
|
72
|
-
this.req,
|
|
73
|
-
this.ws,
|
|
74
|
-
this.chunksManager,
|
|
75
|
-
this.util,
|
|
76
|
-
options.activateSW,
|
|
77
|
-
new AppDataService(this.req, appDataServiceConf, this),
|
|
78
|
-
);
|
|
67
|
+
|
|
68
|
+
this.initializeAppProcessor();
|
|
69
|
+
|
|
79
70
|
this.itemProcessor = new ItemProcessor(
|
|
80
71
|
this.storage,
|
|
81
72
|
this.pipeService,
|
|
@@ -106,8 +97,23 @@ export class GudHub {
|
|
|
106
97
|
}
|
|
107
98
|
}
|
|
108
99
|
|
|
100
|
+
initializeAppProcessor() {
|
|
101
|
+
this.appProcessor = new AppProcessor(
|
|
102
|
+
this.storage,
|
|
103
|
+
this.pipeService,
|
|
104
|
+
this.req,
|
|
105
|
+
this.ws,
|
|
106
|
+
this.util,
|
|
107
|
+
this.config.activateSW,
|
|
108
|
+
new AppDataService(this.req, appDataServiceConf, this),
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
109
112
|
async activateSW(swLink) {
|
|
110
|
-
if (
|
|
113
|
+
if (
|
|
114
|
+
IS_BROWSER_MAIN_THREAD &&
|
|
115
|
+
"serviceWorker" in window.navigator
|
|
116
|
+
) {
|
|
111
117
|
try {
|
|
112
118
|
const sw = await window.navigator.serviceWorker.register(swLink);
|
|
113
119
|
sw.update()
|
|
@@ -234,9 +240,19 @@ export class GudHub {
|
|
|
234
240
|
return this.util.sortItems(items, options);
|
|
235
241
|
}
|
|
236
242
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
243
|
+
|
|
244
|
+
//
|
|
245
|
+
//here
|
|
246
|
+
triggerAppChange(id, prevVersion, newVersion) {
|
|
247
|
+
this.itemProcessor.handleItemsChange(id, prevVersion, newVersion);
|
|
248
|
+
this.appProcessor.handleAppChange(id, prevVersion, newVersion);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
//
|
|
253
|
+
//TODO handleAppChange
|
|
254
|
+
triggerIemsChange(id, compareRes) {
|
|
255
|
+
this.itemProcessor.triggerItemsChange(id, compareRes);
|
|
240
256
|
}
|
|
241
257
|
|
|
242
258
|
jsonToItems(json, map) {
|
|
@@ -353,6 +369,10 @@ export class GudHub {
|
|
|
353
369
|
return this.itemProcessor.deleteItems(app_id, itemsIds);
|
|
354
370
|
}
|
|
355
371
|
|
|
372
|
+
restoreItems(app_id, itemsIds) {
|
|
373
|
+
return this.itemProcessor.restoreItems(app_id, itemsIds);
|
|
374
|
+
}
|
|
375
|
+
|
|
356
376
|
getField(app_id, field_id) {
|
|
357
377
|
return this.fieldProcessor.getField(app_id, field_id);
|
|
358
378
|
}
|
|
@@ -418,13 +438,15 @@ export class GudHub {
|
|
|
418
438
|
);
|
|
419
439
|
}
|
|
420
440
|
|
|
421
|
-
updateFileFromString(data, file_id, file_name, extension, format) {
|
|
441
|
+
updateFileFromString(data, file_id, file_name, extension, format, alt, title) {
|
|
422
442
|
return this.fileManager.updateFileFromString(
|
|
423
443
|
data,
|
|
424
444
|
file_id,
|
|
425
445
|
file_name,
|
|
426
446
|
extension,
|
|
427
|
-
format
|
|
447
|
+
format,
|
|
448
|
+
alt,
|
|
449
|
+
title
|
|
428
450
|
);
|
|
429
451
|
}
|
|
430
452
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppProcessor } from "./AppProcessor/AppProcessor";
|
|
2
|
+
import { AppDataServiceForWorker } from "./DataService/export";
|
|
3
|
+
import { appsConf } from "./DataService/IndexedDB/appDataConf";
|
|
4
|
+
import { GudHub } from "./gudhub";
|
|
5
|
+
|
|
6
|
+
export class GudHubForAppRequestWorker extends GudHub {
|
|
7
|
+
initializeAppProcessor() {
|
|
8
|
+
this.appProcessor = new AppProcessor(
|
|
9
|
+
this.storage,
|
|
10
|
+
this.pipeService,
|
|
11
|
+
this.req,
|
|
12
|
+
this.ws,
|
|
13
|
+
this.util,
|
|
14
|
+
false,
|
|
15
|
+
new AppDataServiceForWorker(this.req, appsConf, this),
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
};
|
package/build.sh
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export PATH=$PATH:node_modules/.bin
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
|
8
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
9
|
+
|
|
10
|
+
nvm ls 16 >/dev/null 2>&1
|
|
11
|
+
if [ $? -ne 0 ]; then
|
|
12
|
+
echo "Node.js version 16 is not installed. Installing Node.js version 16..."
|
|
13
|
+
nvm install 16
|
|
14
|
+
else
|
|
15
|
+
echo "Node.js version 16 is already installed."
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
nvm ls 22 >/dev/null 2>&1
|
|
20
|
+
if [ $? -ne 0 ]; then
|
|
21
|
+
echo "Node.js version 18 is not installed. Installing Node.js version 18..."
|
|
22
|
+
nvm install 22
|
|
23
|
+
else
|
|
24
|
+
echo "Node.js version 18 is already installed."
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
sed -i '/PARCEL_APP_REQUEST_WORKER_FILENAME/d' GUDHUB/DataService/IndexedDB/IndexedDBAppService.js
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
nvm use 16
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# builds appRequestWorker bundle
|
|
35
|
+
./node_modules/.bin/parcel build --config .parcelrc.appRequestWorker --target appRequestWorker
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
git checkout -- GUDHUB/DataService/IndexedDB/IndexedDBAppService.js
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
sed -i 's|PARCEL_APP_REQUEST_WORKER_FILENAME.js|PARCEL_APP_REQUEST_WORKER_FILENAME.js?worker\&inline|g' GUDHUB/DataService/IndexedDB/IndexedDBAppService.js
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
nvm use 22
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
node_modules/.bin/vite -c vite.config.esm.js build
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
node_modules/.bin/vite -c vite.config.umd.js build
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
git checkout -- GUDHUB/DataService/IndexedDB/IndexedDBAppService.js
|
|
54
|
+
|
|
55
|
+
rm ./dist/PARCEL_APP_REQUEST_WORKER_FILENAME.js
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
#TODO write inlined js code that finds new variable for angular and reverts back it and execute in Node env
|
|
59
|
+
# grep below doesnt handle that how it should - mangledAngularVariable
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# sets correct angular variable for esm package after build
|
|
63
|
+
|
|
64
|
+
file="./dist/gudhub.es.js"
|
|
65
|
+
|
|
66
|
+
# mangledAngularVariable=$(grep -oP 'let \K[a-zA-Z0-9$]+(?=\s*=\s*new\s+AngularClass\(\);)' "$file")
|
|
67
|
+
mangledAngularVariable="angular\$1"
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
echo $mangledAngularVariable
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if [[ -n "$mangledAngularVariable" ]]; then
|
|
74
|
+
|
|
75
|
+
angularVariableCorrectName="angular"
|
|
76
|
+
|
|
77
|
+
# Escape the $ symbol in the variable name for use in sed (since $ is special in regex)
|
|
78
|
+
escapedMangledAngularVariable=$(echo "$mangledAngularVariable" | sed 's/\$/\\$/g')
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if [[ -z "$escapedMangledAngularVariable" ]]; then
|
|
82
|
+
echo "Error while add escapes for special characters in new angular variable name"
|
|
83
|
+
exit 1
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
sed -i "s/\b$escapedMangledAngularVariable\b/$angularVariableCorrectName/g" "$file"
|
|
87
|
+
|
|
88
|
+
echo "Replaced all occurrences of '$mangledAngularVariable' with '$angularVariableCorrectName' in '$file'."
|
|
89
|
+
else
|
|
90
|
+
echo "Cant find mangled angular variable"
|
|
91
|
+
exit 1
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# sets correct angular variable for umd package after build
|
|
97
|
+
|
|
98
|
+
file="./dist/gudhub.umd.js"
|
|
99
|
+
|
|
100
|
+
# mangledAngularVariable=$(grep -oP 'let \K[a-zA-Z0-9$]+(?=\s*=\s*new\s+AngularClass\(\);)' "$file")
|
|
101
|
+
mangledAngularVariable="angular\$1"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
echo $mangledAngularVariable
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
if [[ -n "$mangledAngularVariable" ]]; then
|
|
109
|
+
|
|
110
|
+
angularVariableCorrectName="angular"
|
|
111
|
+
|
|
112
|
+
# Escape the $ symbol in the variable name for use in sed (since $ is special in regex)
|
|
113
|
+
escapedMangledAngularVariable=$(echo "$mangledAngularVariable" | sed 's/\$/\\$/g')
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if [[ -z "$escapedMangledAngularVariable" ]]; then
|
|
117
|
+
echo "Error while add escapes for special characters in new angular variable name"
|
|
118
|
+
exit 1
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
sed -i "s/\b$escapedMangledAngularVariable\b/$angularVariableCorrectName/g" "$file"
|
|
122
|
+
|
|
123
|
+
echo "Replaced all occurrences of '$mangledAngularVariable' with '$angularVariableCorrectName' in '$file'."
|
|
124
|
+
else
|
|
125
|
+
echo "Cant find mangled angular variable"
|
|
126
|
+
exit 1
|
|
127
|
+
fi
|