@gudhub/core 1.2.4-beta.24 → 1.2.4-beta.26

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.
@@ -307,6 +307,27 @@ export class IndexedDBAppServiceForWorker extends AppDataService {
307
307
  // });
308
308
  // }
309
309
 
310
+
311
+ async getAppWithoutProcessing(id) {
312
+ let data = await this.dataService.getAppWithoutProcessing(id);
313
+
314
+ await this.putApp(id, data);
315
+
316
+ return data;
317
+ }
318
+
319
+ // this returns data for specific chunks + app request data
320
+ // async getAppWithSpecificChunksList(id, list) {
321
+ // let data = await this.dataService.getAppWithoutProcessing(id);
322
+
323
+ // await self.putApp(id, data);
324
+
325
+
326
+ // let processedData = await self.processRequestedApp(id, data);//here нужно пересмотреть
327
+
328
+ // return processedData;
329
+ // }
330
+
310
331
  async getApp(id) {
311
332
  // if (this.requestCache.has(id)) return this.requestCache.get(id);
312
333
 
@@ -40,33 +40,66 @@ self.onmessage = async function(e) {
40
40
  let cached = await appDataService.getCached(e.data.id); // merge ?
41
41
 
42
42
 
43
+ let cachedChunksList = cached.chunks;
43
44
 
44
- // TODO this is repetitive operation for getCached, maybe put all code in process or in getCached
45
45
 
46
- let res = await chunkDataService.getCachedMergedChunk(e.data.id, cached.chunks);
46
+ let nextVersion = await appDataService.getAppWithoutProcessing(e.data.id);
47
47
 
48
- // if (!res) res = [];
49
48
 
49
+ let isMergedChunkUpdated = true;
50
50
 
51
- // TODO check that res always exists
51
+
52
+ if (
53
+ cachedChunksList.length != nextVersion.chunks.length
54
+ ) isMergedChunkUpdated = false;
55
+
56
+
57
+ if (
58
+ nextVersion.chunks.some(entry => !cachedChunksList.includes(entry))
59
+ ) isMergedChunkUpdated = false;
52
60
 
53
61
 
54
62
  if (
55
- res
63
+ !isMergedChunkUpdated
56
64
  ) {
57
- cached.items_list = await gudhub.util.mergeChunks([
58
- // cachedApp,
59
- res,
60
- cached,
61
- ]);
62
- } else {
63
- // sentData.items_list = await this.gudhub.util.mergeChunks([
64
- // cachedApp,
65
- // sentData,
66
- // ]);
65
+
66
+ // TODO this is repetitive operation for getCached, maybe put all code in process or in getCached
67
+
68
+ let res = await chunkDataService.getCachedMergedChunk(e.data.id, cached.chunks);
69
+
70
+ // if (!res) res = [];
71
+
72
+
73
+ // // TODO check that res always exists
74
+
75
+
76
+ if (
77
+ res
78
+ ) {
79
+ cached.items_list = await gudhub.util.mergeChunks([
80
+ // cachedApp,
81
+ res,
82
+ cached,
83
+ ]);
84
+ } else {
85
+ // sentData.items_list = await this.gudhub.util.mergeChunks([
86
+ // cachedApp,
87
+ // sentData,
88
+ // ]);
89
+ }
90
+
91
+ // nextVersion = await appDataService.getAppWithSpecificChunksList(e.data.id, newChunksList); //todo check that here most recent always
92
+ nextVersion = await appDataService.getApp(e.data.id); //todo check that here most recent always
93
+
94
+
95
+ //TODO тут достаточно сравнить новые чанки+апп и закешированный апп, тогда будет сгенерирована вся инфа о новых данных
96
+
97
+
98
+ // return;
67
99
  }
68
100
 
69
- let nextVersion = await appDataService.getApp(e.data.id); //todo check that here most recent always
101
+
102
+
70
103
 
71
104
 
72
105
 
@@ -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;
@@ -931,7 +931,7 @@ export default function generateModulesList(async_modules_path, file_server_url,
931
931
  data_type: 'study_journal',
932
932
  name: 'Study Journal',
933
933
  icon: 'timeline',
934
- js: 'https://gudhub.com/modules/Study-Journal/dist/main.js',
934
+ js: 'https://gudhub.com/modules/Study-Journal/dist/main.js?t=1',
935
935
  css: 'https://gudhub.com/modules/Study-Journal/dist/style.css',
936
936
  type: 'gh_element',
937
937
  technology: 'class'
@@ -958,11 +958,19 @@ export default function generateModulesList(async_modules_path, file_server_url,
958
958
  data_type: "text_area",
959
959
  name: "Text Area",
960
960
  icon: "text_icon",
961
- js: "https://gudhub.com/modules/text-area-ghe/dist/main.js?t=1",
961
+ js: "https://gudhub.com/modules/text-area-ghe/dist/main.js?t=3",
962
962
  css: "https://gudhub.com/modules/text-area-ghe/dist/style.css",
963
963
  type: "gh_element",
964
964
  technology: "class",
965
965
  },
966
+ {
967
+ data_type: "resource_calendar",
968
+ name: "Resource Сalendar",
969
+ icon: "calendar",
970
+ url: file_server_url + '/' + async_modules_path + "resource_calendar_data.js",
971
+ type: 'gh_element',
972
+ technology: 'angular'
973
+ },
966
974
  /* AUTOMATION MODULES */
967
975
  /*
968
976
  We have next types for automations:
package/GUDHUB/gudhub.js CHANGED
@@ -436,13 +436,15 @@ export class GudHub {
436
436
  );
437
437
  }
438
438
 
439
- updateFileFromString(data, file_id, file_name, extension, format) {
439
+ updateFileFromString(data, file_id, file_name, extension, format, alt, title) {
440
440
  return this.fileManager.updateFileFromString(
441
441
  data,
442
442
  file_id,
443
443
  file_name,
444
444
  extension,
445
- format
445
+ format,
446
+ alt,
447
+ title
446
448
  );
447
449
  }
448
450
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.2.4-beta.24",
3
+ "version": "1.2.4-beta.26",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {