@gudhub/core 1.2.4-beta.50 → 1.2.4-beta.55

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 (40) hide show
  1. package/.parcel-cache/83e7562660f7cc15-BundleGraph +0 -0
  2. package/.parcel-cache/9a0d07555444f4da-AssetGraph +0 -0
  3. package/.parcel-cache/d3a1b9507cb44047-AssetGraph +0 -0
  4. package/.parcel-cache/data.mdb +0 -0
  5. package/.parcel-cache/dc1da35000e13623-RequestGraph +0 -0
  6. package/.parcel-cache/lock.mdb +0 -0
  7. package/.parcel-cache/snapshot-dc1da35000e13623.txt +25943 -25323
  8. package/GUDHUB/AppProcessor/AppProcessor.js +12 -0
  9. package/GUDHUB/DataService/AppDataService.js +2 -0
  10. package/GUDHUB/DataService/IndexedDB/IndexedDBAppService.js +6 -1
  11. package/GUDHUB/DataService/IndexedDB/IndexedDBService.js +1 -1
  12. package/GUDHUB/DataService/IndexedDB/StoreManager/BaseStoreManager.js +1 -1
  13. package/GUDHUB/DataService/IndexedDB/appRequestWorker.js +7 -4
  14. package/GUDHUB/DataService/IndexedDB/consts.js +1 -1
  15. package/GUDHUB/DataService/IndexedDB/init.js +4 -4
  16. package/GUDHUB/DataService/IndexedDB/storeManagerConf/init.js +1 -1
  17. package/GUDHUB/DataService/export.js +2 -2
  18. package/GUDHUB/DataService/utils.js +1 -1
  19. package/GUDHUB/GHConstructor/createAngularModuleInstance.js +41 -29
  20. package/GUDHUB/ItemProcessor/ItemProcessor.js +10 -1
  21. package/GUDHUB/Storage/ModulesList.js +24 -0
  22. package/GUDHUB/Utils/AppsTemplateService/AppsTemplateService.js +11 -4
  23. package/GUDHUB/Utils/Utils.js +14 -0
  24. package/GUDHUB/Utils/get_date/get_date.test.js +3 -12
  25. package/GUDHUB/Utils/merge_chunks/merge_chunks.worker.js +1 -1
  26. package/GUDHUB/Utils/nested_list/nested_list.js +53 -50
  27. package/GUDHUB/Utils/nested_list/nested_list.test.js +140 -2
  28. package/GUDHUB/api/AppApi.js +1 -1
  29. package/GUDHUB/api/ChunkApi.js +1 -1
  30. package/GUDHUB/gudhub.js +19 -0
  31. package/GUDHUB/gudhubAppRequestWorker.js +4 -3
  32. package/build.sh +49 -13
  33. package/dist/gudhub.es.js +5107 -7385
  34. package/dist/gudhub.umd.js +85 -49
  35. package/package.json +1 -4
  36. package/.parcel-cache/61134f48017c9cc1-AssetGraph +0 -0
  37. package/.parcel-cache/72a0445d2e7372b4-BundleGraph +0 -0
  38. package/.parcel-cache/d647b2950bce7da7-RequestGraph +0 -0
  39. package/.parcel-cache/snapshot-d647b2950bce7da7.txt +0 -28892
  40. package/dist/gudhub.es.copy.js +0 -15888
@@ -29,6 +29,35 @@ describe("NESTED LIST", function () {
29
29
  nestedList[0].title.should.equal('Nineth');
30
30
  })
31
31
 
32
+ it("Should return correct nested structure with children", function () {
33
+ let nestedList = gudhub.makeNestedList(nestedComplicatedListWithDocs, 'id', 'parent_id', 'children');
34
+
35
+ nestedList.should.be.an.Array().and.have.length(1);
36
+ nestedList[0].should.have.property('children');
37
+ nestedList[0].children.should.be.an.Array().and.have.length(4);
38
+ });
39
+
40
+ it("Should correctly sort children by priority", function () {
41
+ let nestedList = gudhub.makeNestedList(nestedComplicatedListWithDocs, 'id', 'parent_id', 'children', 'priority');
42
+
43
+ nestedList[0].children[0].title.should.equal('Intro');
44
+ nestedList[0].children[1].title.should.equal('Getting Started');
45
+ nestedList[0].children[2].title.should.equal('Node Installing');
46
+ });
47
+
48
+ it("Should correctly handle deeply nested structures", function () {
49
+ let nestedList = gudhub.makeNestedList(nestedComplicatedListWithDocs, 'id', 'parent_id', 'children', 'priority');
50
+ let featuresChildren = nestedList[0].children[3].children[4].children;
51
+
52
+ featuresChildren.should.be.an.Array().and.have.length(8);
53
+ featuresChildren[0].title.should.equal("Bundler");
54
+ featuresChildren[7].title.should.equal("SSR-Menu");
55
+ });
56
+
57
+ it("Should return empty array for items without parents when parent_id is not found", function () {
58
+ let nestedList = gudhub.makeNestedList([], 'id', 'parent_id', 'children');
59
+ nestedList.should.be.an.Array().and.have.length(0);
60
+ });
32
61
  });
33
62
 
34
63
  let input = [
@@ -150,7 +179,8 @@ let complicatedInput = [
150
179
  parent_id: "26553.2884361",
151
180
  title: "Child of second parent"
152
181
  }
153
- ]
182
+ ];
183
+
154
184
  let parentInput = [
155
185
  {
156
186
  "id": "27026.2937695",
@@ -182,4 +212,112 @@ let parentInput = [
182
212
  "title": "Nineth",
183
213
  "priority": "0"
184
214
  }
185
- ]
215
+ ];
216
+
217
+ let nestedComplicatedListWithDocs = [
218
+ {
219
+ id: "123001.1237001",
220
+ parent_id: "",
221
+ title: "SSR/SSG - Parent"
222
+ },
223
+ {
224
+ id: "123002.1237002",
225
+ parent_id: "123001.1237001",
226
+ title: "Intro",
227
+ priority: 1
228
+ },
229
+ {
230
+ id: "123003.1237003",
231
+ parent_id: "123001.1237001",
232
+ title: "Getting Started",
233
+ priority: 2
234
+ },
235
+ {
236
+ id: "123004.1237004",
237
+ parent_id: "123001.1237001",
238
+ title: "Node Installing",
239
+ priority: 3
240
+ },
241
+ {
242
+ id: "123005.1237005",
243
+ parent_id: "123001.1237001",
244
+ title: "Server - Parent 2"
245
+ },
246
+ {
247
+ id: "123006.1237006",
248
+ parent_id: "123005.1237005",
249
+ title: "Server",
250
+ priority: 4
251
+ },
252
+ {
253
+ id: "123007.1237007",
254
+ parent_id: "123005.1237005",
255
+ title: "Install",
256
+ priority: 5
257
+ },
258
+ {
259
+ id: "123008.1237008",
260
+ parent_id: "123005.1237005",
261
+ title: "Endpoints",
262
+ priority: 6
263
+ },
264
+ {
265
+ id: "123009.1237009",
266
+ parent_id: "123005.1237005",
267
+ title: "Configure",
268
+ priority: 7
269
+ },
270
+ {
271
+ id: "123010.1237010",
272
+ parent_id: "123005.1237005",
273
+ title: "Features - Parent 3"
274
+ },
275
+ {
276
+ id: "123011.1237011",
277
+ parent_id: "123010.1237010",
278
+ title: "Bundler",
279
+ priority: 8
280
+ },
281
+ {
282
+ id: "123012.1237012",
283
+ parent_id: "123010.1237010",
284
+ title: "RedirectsHandler",
285
+ priority: 9
286
+ },
287
+ {
288
+ id: "123013.1237013",
289
+ parent_id: "123010.1237010",
290
+ title: "SSG",
291
+ priority: 10
292
+ },
293
+ {
294
+ id: "123014.1237014",
295
+ parent_id: "123010.1237010",
296
+ title: "SSR",
297
+ priority: 11
298
+ },
299
+ {
300
+ id: "123015.1237015",
301
+ parent_id: "123010.1237010",
302
+ title: "RouteHandler",
303
+ priority: 12
304
+ },
305
+ {
306
+ id: "123016.1237016",
307
+ parent_id: "123010.1237010",
308
+ title: "SitemapGenerator",
309
+ priority: 13
310
+ },
311
+ {
312
+ id: "123017.1237017",
313
+ parent_id: "123010.1237010",
314
+ title: "ImageHandler",
315
+ priority: 14
316
+ },
317
+ {
318
+ id: "123018.1237018",
319
+ parent_id: "123010.1237010",
320
+ title: "SSR-Menu",
321
+ priority: 15
322
+ },
323
+ ];
@@ -11,4 +11,4 @@ export class AppAPI {
11
11
  },
12
12
  });
13
13
  }
14
- };
14
+ };
@@ -16,4 +16,4 @@ export class ChunkAPI {
16
16
  method: 'GET'
17
17
  });
18
18
  }
19
- };
19
+ };
package/GUDHUB/gudhub.js CHANGED
@@ -240,6 +240,21 @@ export class GudHub {
240
240
  return this.util.sortItems(items, options);
241
241
  }
242
242
 
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);
256
+ }
257
+
243
258
  jsonToItems(json, map) {
244
259
  return this.util.jsonToItems(json, map);
245
260
  }
@@ -354,6 +369,10 @@ export class GudHub {
354
369
  return this.itemProcessor.deleteItems(app_id, itemsIds);
355
370
  }
356
371
 
372
+ restoreItems(app_id, itemsIds) {
373
+ return this.itemProcessor.restoreItems(app_id, itemsIds);
374
+ }
375
+
357
376
  getField(app_id, field_id) {
358
377
  return this.fieldProcessor.getField(app_id, field_id);
359
378
  }
@@ -1,5 +1,6 @@
1
1
  import { AppProcessor } from "./AppProcessor/AppProcessor";
2
- import { AppHttpService } from "./DataService/httpService/AppHttpService";
2
+ import { AppDataServiceForWorker } from "./DataService/export";
3
+ import { appsConf } from "./DataService/IndexedDB/appDataConf";
3
4
  import { GudHub } from "./gudhub";
4
5
 
5
6
  export class GudHubForAppRequestWorker extends GudHub {
@@ -11,7 +12,7 @@ export class GudHubForAppRequestWorker extends GudHub {
11
12
  this.ws,
12
13
  this.util,
13
14
  false,
14
- new AppHttpService(this.req, null, this),
15
+ new AppDataServiceForWorker(this.req, appsConf, this),
15
16
  );
16
17
  }
17
- };
18
+ };
package/build.sh CHANGED
@@ -55,37 +55,73 @@ git checkout -- GUDHUB/DataService/IndexedDB/IndexedDBAppService.js
55
55
  rm ./dist/PARCEL_APP_REQUEST_WORKER_FILENAME.js
56
56
 
57
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
58
60
 
59
61
 
60
- # sets correct variable for esm package
62
+ # sets correct angular variable for esm package after build
61
63
 
64
+ file="./dist/gudhub.es.js"
62
65
 
63
- file_es="./dist/gudhub.es.js"
66
+ # mangledAngularVariable=$(grep -oP 'let \K[a-zA-Z0-9$]+(?=\s*=\s*new\s+AngularClass\(\);)' "$file")
67
+ mangledAngularVariable="angular\$1"
64
68
 
65
- new_var=$(grep -oP '.+\s+([a-zA-Z_$][a-zA-Z_$0-9]*)\s*=.+AngularClass' "$file_es" | sed -E 's/.*\s+([a-zA-Z_$][a-zA-Z_$0-9]*).*=.*/\1/')
66
69
 
67
- escaped_new_var=$(echo "$new_var" | sed 's/[\*\.\$]/\\&/g')
70
+ echo $mangledAngularVariable
68
71
 
69
72
 
70
- if [[ -z "$escaped_new_var" ]]; then
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"
71
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
72
92
  fi
73
93
 
74
- sed -i "s/$escaped_new_var/angular/g" "$file_es"
75
94
 
76
95
 
96
+ # sets correct angular variable for umd package after build
97
+
98
+ file="./dist/gudhub.umd.js"
77
99
 
78
- # sets correct variable for umd package
100
+ # mangledAngularVariable=$(grep -oP 'let \K[a-zA-Z0-9$]+(?=\s*=\s*new\s+AngularClass\(\);)' "$file")
101
+ mangledAngularVariable="angular\$1"
79
102
 
80
- file_umd="./dist/gudhub.umd.js"
81
103
 
82
- new_var=$(grep -oP '.+\s+([a-zA-Z_$][a-zA-Z_$0-9]*)\s*=.+AngularClass' "$file_umd" | sed -E 's/.*\s+([a-zA-Z_$][a-zA-Z_$0-9]*).*=.*/\1/')
104
+ echo $mangledAngularVariable
83
105
 
84
- escaped_new_var=$(echo "$new_var" | sed 's/[\*\.\$]/\\&/g')
85
106
 
86
107
 
87
- if [[ -z "$escaped_new_var" ]]; then
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"
88
118
  exit 1
89
- fi
119
+ fi
120
+
121
+ sed -i "s/\b$escapedMangledAngularVariable\b/$angularVariableCorrectName/g" "$file"
90
122
 
91
- sed -i "s/$escaped_new_var/angular/g" "$file_umd"
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