@sankhyalabs/sankhyablocks 8.16.0-dev.40 → 8.16.0-dev.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/dist/cjs/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-c7e35e3b.js → ContinuousInsertUtils-64e47516.js} +29 -20
  3. package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
  4. package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-63369164.js} +2 -2
  5. package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
  6. package/dist/cjs/{dataunit-fetcher-a36ae041.js → dataunit-fetcher-228016f4.js} +1 -1
  7. package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-490a86c3.js → pesquisa-fetcher-a9bfeb22.js} +1 -1
  9. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  10. package/dist/cjs/snk-application.cjs.entry.js +101 -59
  11. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  12. package/dist/cjs/snk-config-options_3.cjs.entry.js +4 -4
  13. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  15. package/dist/cjs/{snk-data-unit-b460f1da.js → snk-data-unit-3d4d0e2a.js} +1 -1
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  18. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
  19. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  21. package/dist/cjs/{snk-guides-viewer-de0a5c57.js → snk-guides-viewer-0419911a.js} +5 -5
  22. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  23. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  24. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  25. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
  26. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  27. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  28. package/dist/collection/components/snk-application/snk-application.js +3 -53
  29. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
  30. package/dist/collection/lib/utils/CrudUtils.js +25 -16
  31. package/dist/components/ContinuousInsertUtils.js +25 -16
  32. package/dist/components/DataFetcher.js +7 -5
  33. package/dist/components/snk-application2.js +95 -53
  34. package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
  35. package/dist/esm/{ContinuousInsertUtils-3e520a07.js → ContinuousInsertUtils-b62906f9.js} +29 -20
  36. package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
  37. package/dist/esm/{SnkFormConfigManager-f1a0fc92.js → SnkFormConfigManager-b409c745.js} +2 -2
  38. package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
  39. package/dist/esm/{dataunit-fetcher-fd58c640.js → dataunit-fetcher-56cb648b.js} +1 -1
  40. package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
  41. package/dist/esm/{pesquisa-fetcher-50fc7e6b.js → pesquisa-fetcher-6bc2e41a.js} +1 -1
  42. package/dist/esm/snk-actions-button_4.entry.js +5 -5
  43. package/dist/esm/snk-application.entry.js +101 -59
  44. package/dist/esm/snk-attach.entry.js +5 -5
  45. package/dist/esm/snk-config-options_3.entry.js +4 -4
  46. package/dist/esm/snk-crud.entry.js +5 -5
  47. package/dist/esm/snk-data-exporter.entry.js +5 -5
  48. package/dist/esm/{snk-data-unit-590225b5.js → snk-data-unit-618e0b80.js} +1 -1
  49. package/dist/esm/snk-data-unit.entry.js +3 -3
  50. package/dist/esm/snk-detail-view.entry.js +7 -7
  51. package/dist/esm/snk-filter-bar_4.entry.js +3 -3
  52. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  53. package/dist/esm/snk-grid.entry.js +6 -6
  54. package/dist/esm/{snk-guides-viewer-2f4dcdc5.js → snk-guides-viewer-18453d98.js} +5 -5
  55. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  56. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  57. package/dist/esm/snk-simple-crud.entry.js +7 -7
  58. package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
  59. package/dist/sankhyablocks/{p-fadc8339.js → p-0e206e62.js} +1 -1
  60. package/dist/sankhyablocks/{p-0e320bd2.entry.js → p-0e250436.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
  62. package/dist/sankhyablocks/{p-656f0e51.entry.js → p-1dbd5c18.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-7bd9683d.js → p-2aebe5b6.js} +1 -1
  64. package/dist/sankhyablocks/{p-fa6c5826.entry.js → p-30ebcbe0.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-8a9638ae.js → p-341465ce.js} +2 -2
  66. package/dist/sankhyablocks/{p-052213ba.entry.js → p-3858a2e4.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-47bce500.js → p-47d24ac8.js} +1 -1
  68. package/dist/sankhyablocks/p-4fd06221.entry.js +1 -0
  69. package/dist/sankhyablocks/{p-275de842.entry.js → p-563b7c28.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-72c10005.entry.js → p-9c3138f5.entry.js} +1 -1
  71. package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
  72. package/dist/sankhyablocks/{p-0b6cd238.entry.js → p-a2c790ac.entry.js} +1 -1
  73. package/dist/sankhyablocks/{p-fd13b4d2.js → p-a75e9dcc.js} +1 -1
  74. package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
  75. package/dist/sankhyablocks/p-aaf94476.js +1 -0
  76. package/dist/sankhyablocks/{p-583517ba.entry.js → p-c1adf0dd.entry.js} +1 -1
  77. package/dist/sankhyablocks/p-da87e42c.entry.js +11 -0
  78. package/dist/sankhyablocks/p-e4391e16.js +1 -0
  79. package/dist/sankhyablocks/{p-5e51e833.entry.js → p-f0aaad2b.entry.js} +1 -1
  80. package/dist/sankhyablocks/{p-cefb0ee1.entry.js → p-f7d76646.entry.js} +1 -1
  81. package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
  82. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  83. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  84. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  85. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  86. package/dist/types/components/snk-application/snk-application.d.ts +3 -12
  87. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  88. package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
  89. package/package.json +1 -1
  90. package/dist/sankhyablocks/p-9f9b99d9.js +0 -1
  91. package/dist/sankhyablocks/p-ab1645fb.entry.js +0 -1
  92. package/dist/sankhyablocks/p-ca5ec380.js +0 -1
  93. package/dist/sankhyablocks/p-dbe6174a.entry.js +0 -11
@@ -2,20 +2,20 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-f1c92f79.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-63369164.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const fieldSearch = require('./field-search-68e34bf4.js');
8
8
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
9
9
  const constants = require('./constants-35ddd366.js');
10
- require('./DataFetcher-cadeef8e.js');
11
- require('./pesquisa-fetcher-490a86c3.js');
10
+ require('./DataFetcher-e059eb72.js');
11
+ require('./pesquisa-fetcher-a9bfeb22.js');
12
12
  const index$1 = require('./index-1dfc7a6e.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-a36ae041.js');
16
+ require('./dataunit-fetcher-228016f4.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
- require('./form-config-fetcher-ed497282.js');
18
+ require('./form-config-fetcher-39397ac5.js');
19
19
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
20
20
 
21
21
  const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-small:var(--space--2xs, 8px);--snk-guides-viewer__header--min-height:68px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-small);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-small)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-small));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-small))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-de0a5c57.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-0419911a.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-f1c92f79.js');
9
- require('./ConfigStorage-ecc0ed20.js');
10
- require('./form-config-fetcher-ed497282.js');
11
- require('./DataFetcher-cadeef8e.js');
8
+ require('./SnkFormConfigManager-63369164.js');
9
+ require('./ConfigStorage-f079f5fd.js');
10
+ require('./form-config-fetcher-39397ac5.js');
11
+ require('./DataFetcher-e059eb72.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
@@ -18,10 +18,10 @@ require('./field-search-68e34bf4.js');
18
18
  require('./taskbar-elements-9ad1f9c0.js');
19
19
  require('./index-1dfc7a6e.js');
20
20
  require('./index-102ba62d.js');
21
- require('./pesquisa-fetcher-490a86c3.js');
21
+ require('./pesquisa-fetcher-a9bfeb22.js');
22
22
  require('./ISave-e91b70a7.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
24
- require('./dataunit-fetcher-a36ae041.js');
24
+ require('./dataunit-fetcher-228016f4.js');
25
25
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
26
26
  require('@sankhyalabs/core/dist/utils/SortingUtils');
27
27
  require('./ResourceIDUtils-5ff86aa7.js');
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
8
- const ConfigStorage = require('./ConfigStorage-ecc0ed20.js');
8
+ const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
9
9
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
10
10
  const index$1 = require('./index-c5771aba.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
12
  require('./filter-item-type.enum-a7ffdaa6.js');
13
- require('./form-config-fetcher-ed497282.js');
14
- require('./DataFetcher-cadeef8e.js');
13
+ require('./form-config-fetcher-39397ac5.js');
14
+ require('./DataFetcher-e059eb72.js');
15
15
  require('./PrintUtils-bcaeb82f.js');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
17
 
@@ -7,19 +7,19 @@ const core = require('@sankhyalabs/core');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const constants = require('./constants-35ddd366.js');
9
9
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
10
- require('./DataFetcher-cadeef8e.js');
11
- require('./pesquisa-fetcher-490a86c3.js');
12
- const ContinuousInsertUtils = require('./ContinuousInsertUtils-c7e35e3b.js');
10
+ require('./DataFetcher-e059eb72.js');
11
+ require('./pesquisa-fetcher-a9bfeb22.js');
12
+ const ContinuousInsertUtils = require('./ContinuousInsertUtils-64e47516.js');
13
13
  const index = require('./index-1dfc7a6e.js');
14
14
  require('./ISave-e91b70a7.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
- const dataunitFetcher = require('./dataunit-fetcher-a36ae041.js');
17
+ const dataunitFetcher = require('./dataunit-fetcher-228016f4.js');
18
18
  require('./filter-item-type.enum-a7ffdaa6.js');
19
- const formConfigFetcher = require('./form-config-fetcher-ed497282.js');
19
+ const formConfigFetcher = require('./form-config-fetcher-39397ac5.js');
20
20
  const fieldSearch = require('./field-search-68e34bf4.js');
21
- const ConfigStorage = require('./ConfigStorage-ecc0ed20.js');
22
- const SnkFormConfigManager = require('./SnkFormConfigManager-f1c92f79.js');
21
+ const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
22
+ const SnkFormConfigManager = require('./SnkFormConfigManager-63369164.js');
23
23
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
24
24
  const index$2 = require('./index-102ba62d.js');
25
25
  require('./PrintUtils-bcaeb82f.js');
@@ -0,0 +1,28 @@
1
+ class DebouncedRequestListener {
2
+ constructor() {
3
+ this._debounceTime = 1500;
4
+ this.requests = new Map();
5
+ this.requestsLoadingBar = [];
6
+ }
7
+ onRequestStart(param) {
8
+ if (param.url.includes("quietMode=true")) {
9
+ return;
10
+ }
11
+ this.requestsLoadingBar.push(param.requestId);
12
+ const timeout = setTimeout(() => {
13
+ this.ezLoadingBar.show();
14
+ }, this._debounceTime);
15
+ this.requests.set(param.requestId, timeout);
16
+ }
17
+ ;
18
+ onRequestEnd(param) {
19
+ const timeoutId = this.requests.get(param.requestId);
20
+ clearTimeout(timeoutId);
21
+ if (this.requestsLoadingBar.includes(param.requestId)) {
22
+ this.requestsLoadingBar = this.requestsLoadingBar.filter(id => id !== param.requestId);
23
+ !this.requestsLoadingBar.length && this.ezLoadingBar.hide();
24
+ }
25
+ }
26
+ ;
27
+ }
28
+ export default DebouncedRequestListener;
@@ -0,0 +1,16 @@
1
+ import DebouncedRequestListener from "./DebouncedRequestListener";
2
+ import RequestListenerLoadingBar from "./RequestListenerLoadingBar";
3
+ class RequestListenerFactory {
4
+ static create({ strategy }) {
5
+ switch (strategy) {
6
+ case 'request_name':
7
+ return new RequestListenerLoadingBar();
8
+ case 'request_time':
9
+ return new DebouncedRequestListener();
10
+ default:
11
+ throw new Error('Strategy not found');
12
+ }
13
+ ;
14
+ }
15
+ }
16
+ export default RequestListenerFactory;
@@ -0,0 +1,52 @@
1
+ class RequestListenerLoadingBar {
2
+ constructor() {
3
+ this._debounceTime = 1000;
4
+ this._ignoredNameTypes = ["totals"];
5
+ this._countRequest = 0;
6
+ }
7
+ onRequestStart(param) {
8
+ if (this.isIgnoreLoadingOnRequest(param)) {
9
+ return;
10
+ }
11
+ this._countRequest++;
12
+ this.ezLoadingBar.show();
13
+ if (this._timerLoading) {
14
+ clearTimeout(this._timerLoading);
15
+ }
16
+ }
17
+ ;
18
+ onRequestEnd(param) {
19
+ if (this.isIgnoreLoadingOnRequest(param)) {
20
+ return;
21
+ }
22
+ this._countRequest--;
23
+ this._timerLoading = setTimeout(() => {
24
+ if (this._countRequest <= 0) {
25
+ this.ezLoadingBar.hide();
26
+ }
27
+ }, this._debounceTime);
28
+ }
29
+ ;
30
+ isIgnoreLoadingOnRequest(param) {
31
+ if (param == undefined) {
32
+ return false;
33
+ }
34
+ if (param.url.includes("quietMode=true")) {
35
+ return true;
36
+ }
37
+ if (param.requestBody == undefined) {
38
+ return false;
39
+ }
40
+ if (param.requestBody.length == 1) {
41
+ const { name } = param.requestBody[0].variables;
42
+ if (name) {
43
+ const nameParts = name.split(":");
44
+ const nameType = nameParts[0];
45
+ return this._ignoredNameTypes.indexOf(nameType) >= 0;
46
+ }
47
+ }
48
+ return false;
49
+ }
50
+ ;
51
+ }
52
+ export default RequestListenerLoadingBar;
@@ -15,6 +15,7 @@ import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
15
15
  import UrlUtils from "../../lib/utils/urlutils";
16
16
  import Workspace from "../../lib/workspace/workspace";
17
17
  import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
18
+ import RequestListenerFactory from "./request-listener/RequestListenerFactory";
18
19
  /**
19
20
  * É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
20
21
  * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
@@ -28,7 +29,7 @@ export class SnkApplication {
28
29
  this._waitingAppReady = new Array();
29
30
  this._duCache = new Map();
30
31
  this._duPromises = new Map();
31
- this._requestListener = new RequestListenerLoadingBar();
32
+ this._requestListener = RequestListenerFactory.create({ strategy: 'request_time' });
32
33
  this._pendingActions = new Map;
33
34
  this._loadPkParameter = null;
34
35
  this._isLoadedByPk = false;
@@ -1004,7 +1005,7 @@ export class SnkApplication {
1004
1005
  .unbind("F1");
1005
1006
  }
1006
1007
  render() {
1007
- return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
1008
+ return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.ezLoadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
1008
1009
  }
1009
1010
  static get is() { return "snk-application"; }
1010
1011
  static get encapsulation() { return "scoped"; }
@@ -2513,57 +2514,6 @@ export class SnkApplication {
2513
2514
  }];
2514
2515
  }
2515
2516
  }
2516
- class RequestListenerLoadingBar {
2517
- constructor() {
2518
- this._debounceTime = 1000;
2519
- this._ignoredNameTypes = ["totals"];
2520
- this._countRequest = 0;
2521
- }
2522
- onRequestStart(param) {
2523
- if (this.isIgnoreLoadingOnRequest(param)) {
2524
- return;
2525
- }
2526
- this._countRequest++;
2527
- this.loadingBar.show();
2528
- if (this._timerLoading) {
2529
- clearTimeout(this._timerLoading);
2530
- }
2531
- }
2532
- ;
2533
- onRequestEnd(param) {
2534
- if (this.isIgnoreLoadingOnRequest(param)) {
2535
- return;
2536
- }
2537
- this._countRequest--;
2538
- this._timerLoading = setTimeout(() => {
2539
- if (this._countRequest <= 0) {
2540
- this.loadingBar.hide();
2541
- }
2542
- }, this._debounceTime);
2543
- }
2544
- ;
2545
- isIgnoreLoadingOnRequest(param) {
2546
- if (param == undefined) {
2547
- return false;
2548
- }
2549
- if (param.url.includes("quietMode=true")) {
2550
- return true;
2551
- }
2552
- if (param.requestBody == undefined) {
2553
- return false;
2554
- }
2555
- if (param.requestBody.length == 1) {
2556
- const { name } = param.requestBody[0].variables;
2557
- if (name) {
2558
- const nameParts = name.split(":");
2559
- const nameType = nameParts[0];
2560
- return this._ignoredNameTypes.indexOf(nameType) >= 0;
2561
- }
2562
- }
2563
- return false;
2564
- }
2565
- ;
2566
- }
2567
2517
  class PendingPromise {
2568
2518
  constructor(resolve, reject) {
2569
2519
  this.resolve = resolve;
@@ -6,7 +6,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
6
6
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
7
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
8
8
  };
9
- import { ApplicationContext, ErrorException, ServiceCanceledException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
9
+ import { ApplicationContext, ErrorException, ObjectUtils, ServiceCanceledException, StringUtils, WarningException } from '@sankhyalabs/core';
10
10
  import { batchRequests } from 'graphql-request';
11
11
  import UrlUtils from "../../../lib/utils/urlutils";
12
12
  import { PrintUtils } from '../../utils/PrintUtils';
@@ -266,7 +266,8 @@ export class DataFetcher {
266
266
  }
267
267
  payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
268
268
  }
269
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
269
+ const requestId = StringUtils.generateUUID();
270
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload, requestId }));
270
271
  http.open("POST", url, true);
271
272
  http.withCredentials = true;
272
273
  http.send(ObjectUtils.objectToString(payloadJson));
@@ -306,7 +307,7 @@ export class DataFetcher {
306
307
  else if (http.readyState == 4 && http.status != 200) {
307
308
  reject(new ErrorException(`Erro ao executar serviço: ${serviceName}`, http.responseText));
308
309
  }
309
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
310
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload, requestId }));
310
311
  };
311
312
  });
312
313
  }
@@ -411,7 +412,8 @@ export class DataFetcher {
411
412
  const errorsResponse = [];
412
413
  const responseExtensions = [];
413
414
  const url = this.buildGraphQlURL(quietMode);
414
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request }));
415
+ const requestId = StringUtils.generateUUID();
416
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request, requestId }));
415
417
  try {
416
418
  const response = await batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
417
419
  response.forEach((resItem, index) => {
@@ -445,11 +447,11 @@ export class DataFetcher {
445
447
  });
446
448
  }
447
449
  else {
448
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
450
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
449
451
  throw new ErrorException("Falha de comunicação", err.message);
450
452
  }
451
453
  }
452
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
454
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
453
455
  return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
454
456
  }
455
457
  isHttpError(err) {
@@ -13,6 +13,28 @@ export class CrudUtils {
13
13
  });
14
14
  }
15
15
  }
16
+ static parseCrudResults(entities, onlyFirst) {
17
+ if (!Array.isArray(entities)) {
18
+ entities = [entities];
19
+ }
20
+ const crudFindResults = [];
21
+ for (const entity of entities) {
22
+ let crudFindResult = {
23
+ fields: new Map()
24
+ };
25
+ for (let key in entity) {
26
+ let fieldValue = entity[key];
27
+ if (fieldValue.hasOwnProperty('$')) {
28
+ crudFindResult.fields.set(key, fieldValue.$);
29
+ }
30
+ if (onlyFirst) {
31
+ break;
32
+ }
33
+ }
34
+ crudFindResults.push(crudFindResult);
35
+ }
36
+ return crudFindResults.length > 1 ? crudFindResults : crudFindResults[0];
37
+ }
16
38
  static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
17
39
  const SERVICE_CRUD_FIND = "mge@crud.find";
18
40
  let parsedFields = [];
@@ -61,24 +83,11 @@ export class CrudUtils {
61
83
  DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
62
84
  var _a;
63
85
  let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
64
- if (entities != undefined) {
65
- let crudFindResult = {
66
- fields: new Map()
67
- };
68
- for (let key in entities) {
69
- let fieldValue = entities[key];
70
- if (fieldValue.hasOwnProperty('$')) {
71
- crudFindResult.fields.set(key, fieldValue.$);
72
- }
73
- if (onlyFirst) {
74
- break;
75
- }
76
- }
77
- resolve(crudFindResult);
78
- }
79
- else {
86
+ if (!entities) {
80
87
  resolve(null);
81
88
  }
89
+ const crudFindResults = this.parseCrudResults(entities, onlyFirst);
90
+ resolve(crudFindResults);
82
91
  });
83
92
  });
84
93
  }
@@ -23,6 +23,28 @@ class CrudUtils {
23
23
  });
24
24
  }
25
25
  }
26
+ static parseCrudResults(entities, onlyFirst) {
27
+ if (!Array.isArray(entities)) {
28
+ entities = [entities];
29
+ }
30
+ const crudFindResults = [];
31
+ for (const entity of entities) {
32
+ let crudFindResult = {
33
+ fields: new Map()
34
+ };
35
+ for (let key in entity) {
36
+ let fieldValue = entity[key];
37
+ if (fieldValue.hasOwnProperty('$')) {
38
+ crudFindResult.fields.set(key, fieldValue.$);
39
+ }
40
+ if (onlyFirst) {
41
+ break;
42
+ }
43
+ }
44
+ crudFindResults.push(crudFindResult);
45
+ }
46
+ return crudFindResults.length > 1 ? crudFindResults : crudFindResults[0];
47
+ }
26
48
  static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
27
49
  const SERVICE_CRUD_FIND = "mge@crud.find";
28
50
  let parsedFields = [];
@@ -70,24 +92,11 @@ class CrudUtils {
70
92
  DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
71
93
  var _a;
72
94
  let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
73
- if (entities != undefined) {
74
- let crudFindResult = {
75
- fields: new Map()
76
- };
77
- for (let key in entities) {
78
- let fieldValue = entities[key];
79
- if (fieldValue.hasOwnProperty('$')) {
80
- crudFindResult.fields.set(key, fieldValue.$);
81
- }
82
- if (onlyFirst) {
83
- break;
84
- }
85
- }
86
- resolve(crudFindResult);
87
- }
88
- else {
95
+ if (!entities) {
89
96
  resolve(null);
90
97
  }
98
+ const crudFindResults = this.parseCrudResults(entities, onlyFirst);
99
+ resolve(crudFindResults);
91
100
  });
92
101
  });
93
102
  }
@@ -6777,7 +6777,8 @@ class DataFetcher {
6777
6777
  }
6778
6778
  payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
6779
6779
  }
6780
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
6780
+ const requestId = StringUtils.generateUUID();
6781
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload, requestId }));
6781
6782
  http.open("POST", url, true);
6782
6783
  http.withCredentials = true;
6783
6784
  http.send(ObjectUtils.objectToString(payloadJson));
@@ -6817,7 +6818,7 @@ class DataFetcher {
6817
6818
  else if (http.readyState == 4 && http.status != 200) {
6818
6819
  reject(new ErrorException(`Erro ao executar serviço: ${serviceName}`, http.responseText));
6819
6820
  }
6820
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6821
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload, requestId }));
6821
6822
  };
6822
6823
  });
6823
6824
  }
@@ -6922,7 +6923,8 @@ class DataFetcher {
6922
6923
  const errorsResponse = [];
6923
6924
  const responseExtensions = [];
6924
6925
  const url = this.buildGraphQlURL(quietMode);
6925
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request }));
6926
+ const requestId = StringUtils.generateUUID();
6927
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request, requestId }));
6926
6928
  try {
6927
6929
  const response = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
6928
6930
  response.forEach((resItem, index) => {
@@ -6956,11 +6958,11 @@ class DataFetcher {
6956
6958
  });
6957
6959
  }
6958
6960
  else {
6959
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
6961
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
6960
6962
  throw new ErrorException("Falha de comunicação", err.message);
6961
6963
  }
6962
6964
  }
6963
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
6965
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
6964
6966
  return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
6965
6967
  }
6966
6968
  isHttpError(err) {