@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
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
|
|
2
|
+
import { appDataServiceConf, AppDataServiceForWorker, ChunkDataServiceForWorker } from "../export.js";
|
|
3
|
+
import { WORKER_EVENTS } from "../IndexedDB/IndexedDBAppService.js";
|
|
4
|
+
import { appsConf } from "../IndexedDB/appDataConf.js";
|
|
5
|
+
import { IndexedDBChunkService } from "./IndexedDBChunkService.js";
|
|
6
|
+
import { chunksConf } from "./chunkDataConf.js";
|
|
7
|
+
import { chunksMergeConf } from "./storeManagerConf/chunkCacheStoreManagerConf.js";
|
|
8
|
+
import { GudHubForAppRequestWorker } from "../../gudhubAppRequestWorker.js";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
let gudhub = {};
|
|
12
|
+
let appDataService = {};
|
|
13
|
+
let chunkDataService = {};
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
globalThis.onmessage = async function(e) {
|
|
17
|
+
if (
|
|
18
|
+
e.data.type === WORKER_EVENTS.INIT
|
|
19
|
+
) {
|
|
20
|
+
e.data.gudhubSerialized.options.initWebsocket = false;
|
|
21
|
+
|
|
22
|
+
gudhub = new GudHubForAppRequestWorker(e.data.gudhubSerialized.authKey, e.data.gudhubSerialized.options);
|
|
23
|
+
appDataService = new AppDataServiceForWorker(gudhub.req, appsConf, gudhub);
|
|
24
|
+
chunkDataService = new ChunkDataServiceForWorker(gudhub.req, chunksMergeConf, gudhub);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (
|
|
28
|
+
e.data.type == WORKER_EVENTS.PROCESS_DATA
|
|
29
|
+
) {
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
//TODO тут может прийти запрос и данные не кешируются. тогда нужно вернуть пустые данные и как-то убрать в пендинге запрос или промис в клиентском коде !!!!!!!!!!
|
|
33
|
+
//TODO pass parameter is cached version exist
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if (
|
|
38
|
+
!e.data.usedCachedDataVersion
|
|
39
|
+
) {
|
|
40
|
+
this.postMessage({id: e.data.id, type: WORKER_EVENTS.DECLINE_PROCESS_DATA_REQUEST});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
//todo cached could not exist !!!!!!!!!!!!!!!!!!!
|
|
46
|
+
|
|
47
|
+
let cached = await appDataService.getCached(e.data.id); // merge ?
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
let cachedChunksList = cached.chunks;
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
let nextVersion = await appDataService.getAppWithoutProcessing(e.data.id);
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
let isMergedChunkUpdated = true;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if (
|
|
60
|
+
cachedChunksList.length != nextVersion.chunks.length
|
|
61
|
+
) isMergedChunkUpdated = false;
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
//TODO here old chunks should be exactly with ids that came from app get request
|
|
65
|
+
if (
|
|
66
|
+
nextVersion.chunks.some(entry => !cachedChunksList.includes(entry))
|
|
67
|
+
) isMergedChunkUpdated = false;
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if (
|
|
71
|
+
!isMergedChunkUpdated
|
|
72
|
+
) {
|
|
73
|
+
|
|
74
|
+
// TODO this is repetitive operation for getCached, maybe put all code in process or in getCached
|
|
75
|
+
|
|
76
|
+
let res = await chunkDataService.getCachedMergedChunk(e.data.id, cached.chunks);
|
|
77
|
+
|
|
78
|
+
// if (!res) res = [];
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
// // TODO check that res always exists
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if (
|
|
85
|
+
res
|
|
86
|
+
) {
|
|
87
|
+
cached.items_list = await gudhub.util.mergeChunks([
|
|
88
|
+
// cachedApp,
|
|
89
|
+
res,
|
|
90
|
+
cached,
|
|
91
|
+
]);
|
|
92
|
+
} else {
|
|
93
|
+
// sentData.items_list = await this.gudhub.util.mergeChunks([
|
|
94
|
+
// cachedApp,
|
|
95
|
+
// sentData,
|
|
96
|
+
// ]);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// nextVersion = await appDataService.getAppWithSpecificChunksList(e.data.id, newChunksList); //todo check that here most recent always
|
|
100
|
+
nextVersion = await appDataService.getApp(e.data.id); //todo check that here most recent always
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
//TODO тут достаточно сравнить новые чанки+апп и закешированный апп, тогда будет сгенерирована вся инфа о новых данных
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
// return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
// let comparison = gudhub.compareItems(cached.items_list, newVersion.items_list);
|
|
111
|
+
let comparison = gudhub.compareItems(nextVersion.items_list, cached.items_list);
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
// async handleAppChange(id, prevVersion, nextVersion) {
|
|
115
|
+
let flag1 = gudhub.util.areViewListsEqual(cached.views_list, nextVersion.views_list);
|
|
116
|
+
let flag2 = gudhub.util.areFieldListsEqual(cached.field_list, nextVersion.field_list);
|
|
117
|
+
|
|
118
|
+
// if (
|
|
119
|
+
// res1 ||
|
|
120
|
+
// res2
|
|
121
|
+
// ) {
|
|
122
|
+
// this.updateAppFieldsAndViews({id, views_list: nextVersion.views_list, field_list: nextVersion.field_list});
|
|
123
|
+
// }
|
|
124
|
+
// }
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
this.postMessage({
|
|
129
|
+
id: e.data.id,
|
|
130
|
+
compareRes: comparison,
|
|
131
|
+
newVersion: nextVersion,
|
|
132
|
+
type: e.data.type,
|
|
133
|
+
viewListChanged: flag1,
|
|
134
|
+
fieldListChanged: flag2,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
/// todo process data merge and then call merge and compare and then return from here for example event to update
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// also dont forget that main thread also uses AppDataService !!!!!!!!!!!!!!!!!! make temporarile a separate class for it maybe
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
if (
|
|
150
|
+
e.data.type == WORKER_EVENTS.REQUEST_APP
|
|
151
|
+
) {
|
|
152
|
+
try {
|
|
153
|
+
let data = await gudhub.getApp(e.data.id); //todo check process request method seems there i return cahced version not most recent data from server
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
this.postMessage({id: e.data.id, type: e.data.type, data});
|
|
157
|
+
} catch (error) {
|
|
158
|
+
|
|
159
|
+
// todo reply with null or use DECLINE_PROCESS_DATA_REQUEST because outer code waits for response anyway and uses data structures for waiting
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const dbName = "gudhub";
|
|
2
|
-
export const dbVersion = 7;
|
|
2
|
+
// export const dbVersion = 7;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { appsConf } from "./appDataConf.js";
|
|
3
|
-
import { chunksConf } from "./chunkDataConf.js";
|
|
4
|
-
import { dbName, dbVersion } from "./consts.js";
|
|
1
|
+
// import { IS_BROWSER } from "../../consts.js";
|
|
2
|
+
// import { appsConf } from "./appDataConf.js";
|
|
3
|
+
// import { chunksConf } from "./chunkDataConf.js";
|
|
4
|
+
// import { dbName, dbVersion } from "./consts.js";
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
// //TODO move to indexeddbmanager
|
|
8
|
+
// if (
|
|
9
|
+
// IS_BROWSER
|
|
10
|
+
// ) {
|
|
11
|
+
// const request = indexedDB.open(dbName, dbVersion);
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
// request.onupgradeneeded = event => {
|
|
14
|
+
// const db = event.target.result;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
16
|
+
// for (let store of [appsConf.store, chunksConf.store]) {
|
|
17
|
+
// if (!db.objectStoreNames.contains(store)) {
|
|
18
|
+
// db.createObjectStore(store);
|
|
19
|
+
// }
|
|
20
|
+
// }
|
|
21
|
+
// };
|
|
22
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
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 {
|
|
3
|
-
import { IndexedDBAppService } from "./IndexedDB/IndexedDBAppService.js";
|
|
1
|
+
import { cache_app_requests, cache_chunk_requests, useWorkerToProcessRequestsData } from "../config.js";
|
|
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,10 @@ 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
|
+
|
|
13
|
+
|
|
14
|
+
//TODO confs should be used only for appropriate classes therefore it doesnt make sense to export them here
|
|
12
15
|
|
|
13
16
|
let AppDataService;
|
|
14
17
|
let ChunkDataService;
|
|
@@ -16,33 +19,85 @@ let ChunkDataService;
|
|
|
16
19
|
let appDataServiceConf;
|
|
17
20
|
let chunkDataServiceConf;
|
|
18
21
|
|
|
22
|
+
if (
|
|
23
|
+
IS_BROWSER &&
|
|
24
|
+
cache_app_requests &&
|
|
25
|
+
!useWorkerToProcessRequestsData
|
|
26
|
+
) {
|
|
27
|
+
AppDataService = IndexedDBAppService;
|
|
28
|
+
appDataServiceConf = appsConf;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if (
|
|
33
|
+
IS_BROWSER &&
|
|
34
|
+
useWorkerToProcessRequestsData &&
|
|
35
|
+
!cache_app_requests
|
|
36
|
+
) {
|
|
37
|
+
AppDataService = AppThroughWebWorkerService;
|
|
38
|
+
appDataServiceConf = appsConf; // todo seems isnt required for picked class
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if (
|
|
43
|
+
!IS_BROWSER
|
|
44
|
+
) {
|
|
45
|
+
AppDataService = AppHttpService;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
if (
|
|
50
|
+
useWorkerToProcessRequestsData &&
|
|
51
|
+
cache_app_requests
|
|
52
|
+
) {
|
|
53
|
+
throw new Error;
|
|
54
|
+
// not implemented
|
|
55
|
+
}
|
|
56
|
+
|
|
19
57
|
|
|
20
58
|
if (
|
|
21
|
-
|
|
22
|
-
cache_chunk_requests
|
|
59
|
+
IS_BROWSER &&
|
|
60
|
+
cache_chunk_requests &&
|
|
61
|
+
!useWorkerToProcessRequestsData
|
|
23
62
|
) {
|
|
24
63
|
ChunkDataService = IndexedDBChunkService;
|
|
25
64
|
chunkDataServiceConf = chunksConf;
|
|
65
|
+
}
|
|
26
66
|
|
|
27
|
-
|
|
28
|
-
|
|
67
|
+
if (
|
|
68
|
+
IS_BROWSER &&
|
|
69
|
+
cache_chunk_requests &&
|
|
70
|
+
useWorkerToProcessRequestsData
|
|
71
|
+
) {
|
|
72
|
+
// here should be http instead, but should be revised variable ChunkDataService usage
|
|
73
|
+
ChunkDataService = IndexedDBChunkService;
|
|
74
|
+
chunkDataServiceConf = chunksConf;
|
|
29
75
|
}
|
|
30
76
|
|
|
31
77
|
|
|
32
78
|
if (
|
|
33
|
-
|
|
34
|
-
cache_app_requests
|
|
79
|
+
!IS_BROWSER
|
|
35
80
|
) {
|
|
36
|
-
|
|
37
|
-
appDataServiceConf = appsConf;
|
|
38
|
-
} else {
|
|
39
|
-
AppDataService = AppHttpService;
|
|
81
|
+
ChunkDataService = ChunkHttpService;
|
|
40
82
|
}
|
|
41
83
|
|
|
42
84
|
|
|
85
|
+
let AppDataServiceForWorker = AppHttpWorkerService;
|
|
86
|
+
let ChunkDataServiceForWorker = IndexedDBChunkService;
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if (
|
|
90
|
+
useWorkerToProcessRequestsData &&
|
|
91
|
+
!cache_app_requests
|
|
92
|
+
) {
|
|
93
|
+
AppDataServiceForWorker = AppHttpWorkerService;
|
|
94
|
+
}
|
|
95
|
+
|
|
43
96
|
export {
|
|
44
97
|
AppDataService,
|
|
45
98
|
ChunkDataService,
|
|
46
99
|
appDataServiceConf,
|
|
47
100
|
chunkDataServiceConf,
|
|
101
|
+
AppDataServiceForWorker,
|
|
102
|
+
ChunkDataServiceForWorker,
|
|
48
103
|
};
|
|
@@ -5,22 +5,30 @@ import { HttpService } from "./HttpService.js";
|
|
|
5
5
|
|
|
6
6
|
export class AppHttpService extends AppDataService {
|
|
7
7
|
constructor(req, conf, gudhub) {
|
|
8
|
-
super();
|
|
8
|
+
super(req, conf, gudhub);
|
|
9
9
|
|
|
10
10
|
this.appApi = new AppAPI(req);
|
|
11
11
|
|
|
12
|
-
let
|
|
12
|
+
let httpService = new HttpService(conf);
|
|
13
13
|
|
|
14
|
-
objectAssignWithOverride(this,
|
|
14
|
+
objectAssignWithOverride(this, httpService);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
// TODO getApp -> getAppAndProcessData
|
|
18
19
|
async getApp(id) {
|
|
20
|
+
let sentData = await this.appApi.getApp(id);
|
|
21
|
+
return this.processRequestedApp(id, sentData);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// TODO -> getApp
|
|
26
|
+
async getAppWithoutProcessing(id) {
|
|
19
27
|
return this.appApi.getApp(id);
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
async putApp(id, app) {
|
|
23
|
-
|
|
31
|
+
// do nothing
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
static [Symbol.hasInstance](instance) {
|
|
@@ -32,4 +40,4 @@ export class AppHttpService extends AppDataService {
|
|
|
32
40
|
return false;
|
|
33
41
|
}
|
|
34
42
|
}
|
|
35
|
-
}
|
|
43
|
+
};
|
|
@@ -4,33 +4,48 @@ import { objectAssignWithOverride } from "../utils.js";
|
|
|
4
4
|
import { HttpService } from "./HttpService.js";
|
|
5
5
|
|
|
6
6
|
export class ChunkHttpService extends ChunkDataService {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
constructor(req, conf) {
|
|
8
|
+
super();
|
|
9
|
+
|
|
10
|
+
this.chunkApi = new ChunkAPI(req);
|
|
11
|
+
|
|
12
|
+
let httpService = new HttpService(conf);
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
objectAssignWithOverride(this, httpService);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async getChunk(app_id, id) {
|
|
18
|
+
return this.chunkApi.getChunk(app_id, id);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async getChunksForId(app_id) {
|
|
22
|
+
// maybe use app get api for now and return app.chunks from there
|
|
23
|
+
|
|
24
|
+
return []; // list of chunks
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
getCachedMergedChunk(id, chunkHashesList) {
|
|
29
|
+
// implementation doesnt have cached
|
|
30
|
+
}
|
|
11
31
|
|
|
12
|
-
|
|
32
|
+
getMergedChunkForIDList(id, chunkHashesList) {
|
|
13
33
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return false;
|
|
32
|
-
} catch (error) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
34
|
+
}
|
|
35
|
+
|
|
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
|
+
}
|
|
36
51
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
|
|
2
2
|
export let objectAssignWithoutOverride = (target, ...sourceList) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
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);
|
|
33
32
|
}
|
|
34
|
-
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -39,7 +39,7 @@ export class FileManager {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
async updateFileFromStringApi(data, file_id, file_name, extension, format) {
|
|
42
|
+
async updateFileFromStringApi(data, file_id, file_name, extension, format, alt, title) {
|
|
43
43
|
try {
|
|
44
44
|
const fileObj = {
|
|
45
45
|
file_name,
|
|
@@ -47,6 +47,8 @@ export class FileManager {
|
|
|
47
47
|
file_id,
|
|
48
48
|
format,
|
|
49
49
|
source: data,
|
|
50
|
+
alt,
|
|
51
|
+
title
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
const file = await this.req.post({
|
|
@@ -198,13 +200,15 @@ async getFiles(app_id, filesId = []) {
|
|
|
198
200
|
return file;
|
|
199
201
|
}
|
|
200
202
|
|
|
201
|
-
async updateFileFromString(data, file_id, file_name, extension, format) {
|
|
203
|
+
async updateFileFromString(data, file_id, file_name, extension, format, alt, title) {
|
|
202
204
|
const file = await this.updateFileFromStringApi(
|
|
203
205
|
data,
|
|
204
206
|
file_id,
|
|
205
207
|
file_name,
|
|
206
208
|
extension,
|
|
207
|
-
format
|
|
209
|
+
format,
|
|
210
|
+
alt,
|
|
211
|
+
title
|
|
208
212
|
);
|
|
209
213
|
this.updateFileInStorage(file_id, file.app_id, file);
|
|
210
214
|
return file;
|