@sankhyalabs/sankhyablocks 1.3.31-beta.2 → 1.3.31-beta.20

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 (218) hide show
  1. package/dist/cjs/SnkMessageBuilder-7717f1e4.js +326 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  3. package/dist/cjs/css-shim-b8158822.js +6 -0
  4. package/dist/cjs/dom-36862b77.js +75 -0
  5. package/dist/cjs/filter-item-type.enum-e2e1bc5b.js +14 -0
  6. package/dist/cjs/index-02201bc9.js +2397 -0
  7. package/dist/cjs/index-b0b676c5.js +3298 -0
  8. package/dist/cjs/loader.cjs.js +19 -3
  9. package/dist/cjs/sankhyablocks.cjs.js +117 -5
  10. package/dist/cjs/shadow-css-346c0795.js +389 -0
  11. package/dist/cjs/snk-application.cjs.entry.js +1041 -177
  12. package/dist/cjs/snk-crud.cjs.entry.js +65 -0
  13. package/dist/cjs/snk-data-unit.cjs.entry.js +276 -0
  14. package/dist/cjs/snk-filter-bar.cjs.entry.js +265 -0
  15. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +47 -0
  16. package/dist/cjs/snk-filter-detail.cjs.entry.js +49 -0
  17. package/dist/cjs/snk-filter-item.cjs.entry.js +143 -0
  18. package/dist/cjs/snk-filter-list.cjs.entry.js +91 -0
  19. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +23 -0
  20. package/dist/cjs/snk-filter-number.cjs.entry.js +24 -0
  21. package/dist/cjs/snk-filter-period.cjs.entry.js +26 -0
  22. package/dist/cjs/snk-filter-search.cjs.entry.js +44 -0
  23. package/dist/cjs/snk-filter-text.cjs.entry.js +22 -0
  24. package/dist/cjs/snk-form.cjs.entry.js +133 -0
  25. package/dist/cjs/snk-grid.cjs.entry.js +79 -0
  26. package/dist/cjs/snk-pesquisa.cjs.entry.js +10 -7
  27. package/dist/cjs/snk-taskbar.cjs.entry.js +160 -0
  28. package/dist/cjs/taskbar-elements-283c737e.js +93 -0
  29. package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
  30. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  31. package/dist/collection/collection-manifest.json +17 -2
  32. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +9 -2
  33. package/dist/collection/components/snk-application/snk-application.js +1061 -629
  34. package/dist/collection/components/snk-crud/snk-crud.css +6 -0
  35. package/dist/collection/components/snk-crud/snk-crud.js +176 -0
  36. package/dist/collection/components/snk-data-unit/snk-data-unit.css +6 -0
  37. package/dist/collection/components/snk-data-unit/snk-data-unit.js +540 -0
  38. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +88 -0
  39. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +64 -0
  40. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +65 -0
  41. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +69 -0
  42. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +118 -0
  43. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +63 -0
  44. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +10 -0
  45. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +118 -0
  46. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +244 -0
  47. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +233 -0
  48. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +114 -0
  49. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +323 -0
  50. package/dist/collection/components/snk-form/snk-form.css +34 -0
  51. package/dist/collection/components/snk-form/snk-form.js +258 -0
  52. package/dist/collection/components/snk-grid/snk-grid.css +18 -0
  53. package/dist/collection/components/snk-grid/snk-grid.js +183 -0
  54. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +56 -13
  55. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +81 -76
  56. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +86 -0
  57. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
  58. package/dist/collection/components/snk-taskbar/snk-taskbar.css +3 -0
  59. package/dist/collection/components/snk-taskbar/snk-taskbar.js +307 -0
  60. package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
  61. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +38 -13
  62. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +52 -21
  63. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +388 -0
  64. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +4 -3
  65. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +2 -0
  66. package/dist/collection/lib/http/data-fetcher/fetchers/totals-fetcher.js +47 -0
  67. package/dist/collection/lib/index.js +1 -0
  68. package/dist/collection/lib/message/SnkMessageBuilder.js +121 -0
  69. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +23 -0
  70. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +18 -0
  71. package/dist/collection/lib/message/resources/snk-form.msg.js +10 -0
  72. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +17 -0
  73. package/dist/components/SnkMessageBuilder.js +303 -0
  74. package/dist/components/filter-item-type.enum.js +12 -0
  75. package/dist/components/index.d.ts +18 -5
  76. package/dist/components/index.js +22 -0
  77. package/dist/components/index2.js +2384 -0
  78. package/dist/components/snk-application2.js +1019 -148
  79. package/dist/components/snk-crud.d.ts +11 -0
  80. package/dist/components/snk-crud.js +127 -0
  81. package/dist/components/snk-data-unit.d.ts +11 -0
  82. package/dist/components/snk-data-unit.js +299 -0
  83. package/dist/components/snk-filter-bar.d.ts +11 -0
  84. package/dist/components/snk-filter-bar.js +6 -0
  85. package/dist/components/snk-filter-bar2.js +296 -0
  86. package/dist/components/snk-filter-binary-select.d.ts +11 -0
  87. package/dist/components/snk-filter-binary-select.js +63 -0
  88. package/dist/components/snk-filter-detail.d.ts +11 -0
  89. package/dist/components/snk-filter-detail.js +6 -0
  90. package/dist/components/snk-filter-detail2.js +63 -0
  91. package/dist/components/snk-filter-item.d.ts +11 -0
  92. package/dist/components/snk-filter-item.js +6 -0
  93. package/dist/components/snk-filter-item2.js +164 -0
  94. package/dist/components/snk-filter-list.d.ts +11 -0
  95. package/dist/components/snk-filter-list.js +6 -0
  96. package/dist/components/snk-filter-list2.js +111 -0
  97. package/dist/components/snk-filter-multi-select.d.ts +11 -0
  98. package/dist/components/snk-filter-multi-select.js +39 -0
  99. package/dist/components/snk-filter-number.d.ts +11 -0
  100. package/dist/components/snk-filter-number.js +40 -0
  101. package/dist/components/snk-filter-period.d.ts +11 -0
  102. package/dist/components/snk-filter-period.js +42 -0
  103. package/dist/components/snk-filter-search.d.ts +11 -0
  104. package/dist/components/snk-filter-search.js +62 -0
  105. package/dist/components/snk-filter-text.d.ts +11 -0
  106. package/dist/components/snk-filter-text.js +38 -0
  107. package/dist/components/snk-form.d.ts +11 -0
  108. package/dist/components/snk-form.js +6 -0
  109. package/dist/components/snk-form2.js +159 -0
  110. package/dist/components/snk-grid.d.ts +11 -0
  111. package/dist/components/snk-grid.js +6 -0
  112. package/dist/components/snk-grid2.js +126 -0
  113. package/dist/components/snk-pesquisa2.js +6 -3
  114. package/dist/components/snk-taskbar.d.ts +11 -0
  115. package/dist/components/snk-taskbar.js +6 -0
  116. package/dist/components/snk-taskbar2.js +264 -0
  117. package/dist/components/taskbar-processor.js +45 -0
  118. package/dist/components/teste-pesquisa.js +1 -1
  119. package/dist/esm/SnkMessageBuilder-a7da466b.js +303 -0
  120. package/dist/esm/app-globals-0f993ce5.js +3 -0
  121. package/dist/esm/css-shim-b3f2ee8d.js +4 -0
  122. package/dist/esm/dom-665d6011.js +73 -0
  123. package/dist/esm/filter-item-type.enum-61fbf80a.js +12 -0
  124. package/dist/esm/index-2b4d2d14.js +3262 -0
  125. package/dist/esm/index-e5b61043.js +2384 -0
  126. package/dist/esm/loader.js +19 -3
  127. package/dist/esm/polyfills/css-shim.js +1 -1
  128. package/dist/esm/sankhyablocks.js +117 -5
  129. package/dist/esm/shadow-css-b18e99d7.js +387 -0
  130. package/dist/esm/snk-application.entry.js +1013 -149
  131. package/dist/esm/snk-crud.entry.js +61 -0
  132. package/dist/esm/snk-data-unit.entry.js +272 -0
  133. package/dist/esm/snk-filter-bar.entry.js +261 -0
  134. package/dist/esm/snk-filter-binary-select.entry.js +43 -0
  135. package/dist/esm/snk-filter-detail.entry.js +45 -0
  136. package/dist/esm/snk-filter-item.entry.js +139 -0
  137. package/dist/esm/snk-filter-list.entry.js +87 -0
  138. package/dist/esm/snk-filter-multi-select.entry.js +19 -0
  139. package/dist/esm/snk-filter-number.entry.js +20 -0
  140. package/dist/esm/snk-filter-period.entry.js +22 -0
  141. package/dist/esm/snk-filter-search.entry.js +40 -0
  142. package/dist/esm/snk-filter-text.entry.js +18 -0
  143. package/dist/esm/snk-form.entry.js +129 -0
  144. package/dist/esm/snk-grid.entry.js +75 -0
  145. package/dist/esm/snk-pesquisa.entry.js +7 -4
  146. package/dist/esm/snk-taskbar.entry.js +156 -0
  147. package/dist/esm/taskbar-elements-35d64ff9.js +90 -0
  148. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  149. package/dist/esm/teste-pesquisa.entry.js +2 -2
  150. package/dist/sankhyablocks/SnkMessageBuilder-a7da466b.js +303 -0
  151. package/dist/sankhyablocks/app-globals-0f993ce5.js +3 -0
  152. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +4 -0
  153. package/dist/sankhyablocks/dom-665d6011.js +73 -0
  154. package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +12 -0
  155. package/dist/sankhyablocks/index-2b4d2d14.js +3262 -0
  156. package/dist/sankhyablocks/index-e5b61043.js +2384 -0
  157. package/dist/sankhyablocks/index.esm.js +1 -0
  158. package/dist/sankhyablocks/sankhyablocks.esm.js +129 -1
  159. package/dist/sankhyablocks/shadow-css-b18e99d7.js +387 -0
  160. package/dist/sankhyablocks/snk-application.entry.js +8452 -0
  161. package/dist/sankhyablocks/snk-crud.entry.js +61 -0
  162. package/dist/sankhyablocks/snk-data-unit.entry.js +272 -0
  163. package/dist/sankhyablocks/snk-filter-bar.entry.js +261 -0
  164. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +43 -0
  165. package/dist/sankhyablocks/snk-filter-detail.entry.js +45 -0
  166. package/dist/sankhyablocks/snk-filter-item.entry.js +139 -0
  167. package/dist/sankhyablocks/snk-filter-list.entry.js +87 -0
  168. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +19 -0
  169. package/dist/sankhyablocks/snk-filter-number.entry.js +20 -0
  170. package/dist/sankhyablocks/snk-filter-period.entry.js +22 -0
  171. package/dist/sankhyablocks/snk-filter-search.entry.js +40 -0
  172. package/dist/sankhyablocks/snk-filter-text.entry.js +18 -0
  173. package/dist/sankhyablocks/snk-form.entry.js +129 -0
  174. package/dist/sankhyablocks/snk-grid.entry.js +75 -0
  175. package/dist/sankhyablocks/snk-pesquisa.entry.js +311 -0
  176. package/dist/sankhyablocks/snk-taskbar.entry.js +156 -0
  177. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +90 -0
  178. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +45 -0
  179. package/dist/sankhyablocks/teste-pesquisa.entry.js +33 -0
  180. package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
  181. package/dist/types/components/snk-application/snk-application.d.ts +141 -20
  182. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
  183. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +7 -0
  184. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +7 -0
  185. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +13 -0
  186. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +12 -0
  187. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +7 -0
  188. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +9 -0
  189. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +14 -0
  190. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +40 -0
  191. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +46 -0
  192. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +29 -0
  193. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
  194. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +84 -0
  195. package/dist/types/components.d.ts +662 -9
  196. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -6
  197. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
  198. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +5 -0
  199. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +3 -3
  200. package/dist/types/lib/http/data-fetcher/fetchers/totals-fetcher.d.ts +8 -0
  201. package/dist/types/lib/index.d.ts +1 -0
  202. package/dist/types/lib/message/SnkMessageBuilder.d.ts +42 -0
  203. package/dist/types/lib/message/resources/snk-data-unit.msg.d.ts +2 -0
  204. package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
  205. package/dist/types/lib/message/resources/snk-form.msg.d.ts +2 -0
  206. package/dist/types/lib/message/resources/snk-taskbar.msg.d.ts +2 -0
  207. package/dist/types/stencil-public-runtime.d.ts +15 -4
  208. package/loader/package.json +1 -0
  209. package/package.json +5 -5
  210. package/react/components.d.ts +0 -2
  211. package/react/components.js +0 -2
  212. package/react/components.js.map +1 -1
  213. package/dist/cjs/index-1133bc2a.js +0 -1235
  214. package/dist/esm/index-ffda6382.js +0 -1208
  215. package/dist/sankhyablocks/p-2a7b4cb3.entry.js +0 -1
  216. package/dist/sankhyablocks/p-d62412bb.entry.js +0 -1
  217. package/dist/sankhyablocks/p-e6e91d5f.entry.js +0 -69
  218. package/dist/sankhyablocks/p-edcb9d8e.js +0 -2
@@ -2,23 +2,50 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-1133bc2a.js');
6
- const core = require('@sankhyalabs/core');
7
- const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
- const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
5
+ const index$2 = require('./index-b0b676c5.js');
6
+ const index$1 = require('./index-02201bc9.js');
7
+ const SnkMessageBuilder = require('./SnkMessageBuilder-7717f1e4.js');
8
+ const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
9
9
 
10
10
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
11
11
 
12
+ function getDefaultExportFromCjs (x) {
13
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
14
+ }
15
+
12
16
  function createCommonjsModule(fn, basedir, module) {
13
17
  return module = {
14
18
  path: basedir,
15
19
  exports: {},
16
20
  require: function (path, base) {
17
- return commonjsRequire();
21
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
18
22
  }
19
23
  }, fn(module, module.exports), module.exports;
20
24
  }
21
25
 
26
+ function getDefaultExportFromNamespaceIfPresent (n) {
27
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
28
+ }
29
+
30
+ function getDefaultExportFromNamespaceIfNotNamed (n) {
31
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
32
+ }
33
+
34
+ function getAugmentedNamespace(n) {
35
+ if (n.__esModule) return n;
36
+ var a = Object.defineProperty({}, '__esModule', {value: true});
37
+ Object.keys(n).forEach(function (k) {
38
+ var d = Object.getOwnPropertyDescriptor(n, k);
39
+ Object.defineProperty(a, k, d.get ? d : {
40
+ enumerable: true,
41
+ get: function () {
42
+ return n[k];
43
+ }
44
+ });
45
+ });
46
+ return a;
47
+ }
48
+
22
49
  function commonjsRequire () {
23
50
  throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
24
51
  }
@@ -35,7 +62,7 @@ return new F();
35
62
  })();
36
63
  (function(self) {
37
64
 
38
- ((function (exports) {
65
+ var irrelevant = (function (exports) {
39
66
 
40
67
  var support = {
41
68
  searchParams: 'URLSearchParams' in self,
@@ -563,7 +590,7 @@ return new F();
563
590
 
564
591
  return exports;
565
592
 
566
- }))({});
593
+ })({});
567
594
  })(__self__);
568
595
  __self__.fetch.ponyfill = true;
569
596
  // Remove "polyfill" property added by whatwg-fetch
@@ -580,7 +607,10 @@ exports.Response = ctx.Response;
580
607
  module.exports = exports;
581
608
  });
582
609
 
610
+ const browserPonyfill$1 = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill);
611
+
583
612
  var isObjectLike_1 = createCommonjsModule(function (module, exports) {
613
+ 'use strict';
584
614
 
585
615
  Object.defineProperty(exports, '__esModule', {
586
616
  value: true,
@@ -596,7 +626,10 @@ function isObjectLike(value) {
596
626
  }
597
627
  });
598
628
 
629
+ const isObjectLike = /*@__PURE__*/getDefaultExportFromCjs(isObjectLike_1);
630
+
599
631
  var invariant_1 = createCommonjsModule(function (module, exports) {
632
+ 'use strict';
600
633
 
601
634
  Object.defineProperty(exports, '__esModule', {
602
635
  value: true,
@@ -614,7 +647,10 @@ function invariant(condition, message) {
614
647
  }
615
648
  });
616
649
 
650
+ const invariant = /*@__PURE__*/getDefaultExportFromCjs(invariant_1);
651
+
617
652
  var location_1 = createCommonjsModule(function (module, exports) {
653
+ 'use strict';
618
654
 
619
655
  Object.defineProperty(exports, '__esModule', {
620
656
  value: true,
@@ -654,7 +690,10 @@ function getLocation(source, position) {
654
690
  }
655
691
  });
656
692
 
693
+ const location$1 = /*@__PURE__*/getDefaultExportFromCjs(location_1);
694
+
657
695
  var printLocation_1 = createCommonjsModule(function (module, exports) {
696
+ 'use strict';
658
697
 
659
698
  Object.defineProperty(exports, '__esModule', {
660
699
  value: true,
@@ -730,7 +769,10 @@ function printPrefixedLines(lines) {
730
769
  }
731
770
  });
732
771
 
772
+ const printLocation = /*@__PURE__*/getDefaultExportFromCjs(printLocation_1);
773
+
733
774
  var GraphQLError_1 = createCommonjsModule(function (module, exports) {
775
+ 'use strict';
734
776
 
735
777
  Object.defineProperty(exports, '__esModule', {
736
778
  value: true,
@@ -999,7 +1041,10 @@ function formatError(error) {
999
1041
  }
1000
1042
  });
1001
1043
 
1044
+ const GraphQLError = /*@__PURE__*/getDefaultExportFromCjs(GraphQLError_1);
1045
+
1002
1046
  var syntaxError_1 = createCommonjsModule(function (module, exports) {
1047
+ 'use strict';
1003
1048
 
1004
1049
  Object.defineProperty(exports, '__esModule', {
1005
1050
  value: true,
@@ -1020,7 +1065,10 @@ function syntaxError(source, position, description) {
1020
1065
  }
1021
1066
  });
1022
1067
 
1068
+ const syntaxError = /*@__PURE__*/getDefaultExportFromCjs(syntaxError_1);
1069
+
1023
1070
  var ast = createCommonjsModule(function (module, exports) {
1071
+ 'use strict';
1024
1072
 
1025
1073
  Object.defineProperty(exports, '__esModule', {
1026
1074
  value: true,
@@ -1236,7 +1284,7 @@ function isNode(maybeNode) {
1236
1284
  }
1237
1285
  /** Name */
1238
1286
 
1239
- let OperationTypeNode;
1287
+ var OperationTypeNode;
1240
1288
  exports.OperationTypeNode = OperationTypeNode;
1241
1289
 
1242
1290
  (function (OperationTypeNode) {
@@ -1246,7 +1294,10 @@ exports.OperationTypeNode = OperationTypeNode;
1246
1294
  })(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {}));
1247
1295
  });
1248
1296
 
1297
+ const ast$1 = /*@__PURE__*/getDefaultExportFromCjs(ast);
1298
+
1249
1299
  var directiveLocation = createCommonjsModule(function (module, exports) {
1300
+ 'use strict';
1250
1301
 
1251
1302
  Object.defineProperty(exports, '__esModule', {
1252
1303
  value: true,
@@ -1256,13 +1307,7 @@ exports.DirectiveLocation = void 0;
1256
1307
  /**
1257
1308
  * The set of allowed directive location values.
1258
1309
  */
1259
- let DirectiveLocation;
1260
- /**
1261
- * The enum type representing the directive location values.
1262
- *
1263
- * @deprecated Please use `DirectiveLocation`. Will be remove in v17.
1264
- */
1265
-
1310
+ var DirectiveLocation;
1266
1311
  exports.DirectiveLocation = DirectiveLocation;
1267
1312
 
1268
1313
  (function (DirectiveLocation) {
@@ -1286,9 +1331,17 @@ exports.DirectiveLocation = DirectiveLocation;
1286
1331
  DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
1287
1332
  DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
1288
1333
  })(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
1334
+ /**
1335
+ * The enum type representing the directive location values.
1336
+ *
1337
+ * @deprecated Please use `DirectiveLocation`. Will be remove in v17.
1338
+ */
1289
1339
  });
1290
1340
 
1341
+ const directiveLocation$1 = /*@__PURE__*/getDefaultExportFromCjs(directiveLocation);
1342
+
1291
1343
  var kinds = createCommonjsModule(function (module, exports) {
1344
+ 'use strict';
1292
1345
 
1293
1346
  Object.defineProperty(exports, '__esModule', {
1294
1347
  value: true,
@@ -1298,13 +1351,7 @@ exports.Kind = void 0;
1298
1351
  /**
1299
1352
  * The set of allowed kind values for AST nodes.
1300
1353
  */
1301
- let Kind;
1302
- /**
1303
- * The enum type representing the possible kind values of AST nodes.
1304
- *
1305
- * @deprecated Please use `Kind`. Will be remove in v17.
1306
- */
1307
-
1354
+ var Kind;
1308
1355
  exports.Kind = Kind;
1309
1356
 
1310
1357
  (function (Kind) {
@@ -1352,9 +1399,17 @@ exports.Kind = Kind;
1352
1399
  Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';
1353
1400
  Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';
1354
1401
  })(Kind || (exports.Kind = Kind = {}));
1402
+ /**
1403
+ * The enum type representing the possible kind values of AST nodes.
1404
+ *
1405
+ * @deprecated Please use `Kind`. Will be remove in v17.
1406
+ */
1355
1407
  });
1356
1408
 
1409
+ const kinds$1 = /*@__PURE__*/getDefaultExportFromCjs(kinds);
1410
+
1357
1411
  var characterClasses = createCommonjsModule(function (module, exports) {
1412
+ 'use strict';
1358
1413
 
1359
1414
  Object.defineProperty(exports, '__esModule', {
1360
1415
  value: true,
@@ -1431,7 +1486,10 @@ function isNameContinue(code) {
1431
1486
  }
1432
1487
  });
1433
1488
 
1489
+ const characterClasses$1 = /*@__PURE__*/getDefaultExportFromCjs(characterClasses);
1490
+
1434
1491
  var blockString = createCommonjsModule(function (module, exports) {
1492
+ 'use strict';
1435
1493
 
1436
1494
  Object.defineProperty(exports, '__esModule', {
1437
1495
  value: true,
@@ -1628,7 +1686,10 @@ function printBlockString(value, options) {
1628
1686
  }
1629
1687
  });
1630
1688
 
1689
+ const blockString$1 = /*@__PURE__*/getDefaultExportFromCjs(blockString);
1690
+
1631
1691
  var tokenKind = createCommonjsModule(function (module, exports) {
1692
+ 'use strict';
1632
1693
 
1633
1694
  Object.defineProperty(exports, '__esModule', {
1634
1695
  value: true,
@@ -1639,13 +1700,7 @@ exports.TokenKind = void 0;
1639
1700
  * An exported enum describing the different kinds of tokens that the
1640
1701
  * lexer emits.
1641
1702
  */
1642
- let TokenKind;
1643
- /**
1644
- * The enum type representing the token kinds values.
1645
- *
1646
- * @deprecated Please use `TokenKind`. Will be remove in v17.
1647
- */
1648
-
1703
+ var TokenKind;
1649
1704
  exports.TokenKind = TokenKind;
1650
1705
 
1651
1706
  (function (TokenKind) {
@@ -1672,9 +1727,17 @@ exports.TokenKind = TokenKind;
1672
1727
  TokenKind['BLOCK_STRING'] = 'BlockString';
1673
1728
  TokenKind['COMMENT'] = 'Comment';
1674
1729
  })(TokenKind || (exports.TokenKind = TokenKind = {}));
1730
+ /**
1731
+ * The enum type representing the token kinds values.
1732
+ *
1733
+ * @deprecated Please use `TokenKind`. Will be remove in v17.
1734
+ */
1675
1735
  });
1676
1736
 
1737
+ const tokenKind$1 = /*@__PURE__*/getDefaultExportFromCjs(tokenKind);
1738
+
1677
1739
  var lexer = createCommonjsModule(function (module, exports) {
1740
+ 'use strict';
1678
1741
 
1679
1742
  Object.defineProperty(exports, '__esModule', {
1680
1743
  value: true,
@@ -2682,7 +2745,10 @@ function readName(lexer, start) {
2682
2745
  }
2683
2746
  });
2684
2747
 
2748
+ const lexer$1 = /*@__PURE__*/getDefaultExportFromCjs(lexer);
2749
+
2685
2750
  var devAssert_1 = createCommonjsModule(function (module, exports) {
2751
+ 'use strict';
2686
2752
 
2687
2753
  Object.defineProperty(exports, '__esModule', {
2688
2754
  value: true,
@@ -2698,7 +2764,10 @@ function devAssert(condition, message) {
2698
2764
  }
2699
2765
  });
2700
2766
 
2767
+ const devAssert = /*@__PURE__*/getDefaultExportFromCjs(devAssert_1);
2768
+
2701
2769
  var inspect_1 = createCommonjsModule(function (module, exports) {
2770
+ 'use strict';
2702
2771
 
2703
2772
  Object.defineProperty(exports, '__esModule', {
2704
2773
  value: true,
@@ -2821,7 +2890,10 @@ function getObjectTag(object) {
2821
2890
  }
2822
2891
  });
2823
2892
 
2893
+ const inspect = /*@__PURE__*/getDefaultExportFromCjs(inspect_1);
2894
+
2824
2895
  var instanceOf_1 = createCommonjsModule(function (module, exports) {
2896
+ 'use strict';
2825
2897
 
2826
2898
  Object.defineProperty(exports, '__esModule', {
2827
2899
  value: true,
@@ -2840,14 +2912,54 @@ const instanceOf =
2840
2912
  /* c8 ignore next 6 */
2841
2913
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
2842
2914
  // eslint-disable-next-line no-undef
2843
- function instanceOf(value, constructor) {
2915
+ "development" === 'production'
2916
+ ? function instanceOf(value, constructor) {
2844
2917
  return value instanceof constructor;
2845
2918
  }
2846
- ;
2919
+ : function instanceOf(value, constructor) {
2920
+ if (value instanceof constructor) {
2921
+ return true;
2922
+ }
2923
+
2924
+ if (typeof value === 'object' && value !== null) {
2925
+ var _value$constructor;
2926
+
2927
+ // Prefer Symbol.toStringTag since it is immune to minification.
2928
+ const className = constructor.prototype[Symbol.toStringTag];
2929
+ const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.
2930
+ Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009
2931
+ ? value[Symbol.toStringTag]
2932
+ : (_value$constructor = value.constructor) === null ||
2933
+ _value$constructor === void 0
2934
+ ? void 0
2935
+ : _value$constructor.name;
2936
+
2937
+ if (className === valueClassName) {
2938
+ const stringifiedValue = (0, inspect_1.inspect)(value);
2939
+ throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
2940
+
2941
+ Ensure that there is only one instance of "graphql" in the node_modules
2942
+ directory. If different versions of "graphql" are the dependencies of other
2943
+ relied on modules, use "resolutions" to ensure only one version is installed.
2944
+
2945
+ https://yarnpkg.com/en/docs/selective-version-resolutions
2946
+
2947
+ Duplicate "graphql" modules cannot be used at the same time since different
2948
+ versions may have different capabilities and behavior. The data from one
2949
+ version used in the function from another could produce confusing and
2950
+ spurious results.`);
2951
+ }
2952
+ }
2953
+
2954
+ return false;
2955
+ };
2847
2956
  exports.instanceOf = instanceOf;
2848
2957
  });
2849
2958
 
2959
+ const instanceOf = /*@__PURE__*/getDefaultExportFromCjs(instanceOf_1);
2960
+
2850
2961
  var source = createCommonjsModule(function (module, exports) {
2962
+ 'use strict';
2851
2963
 
2852
2964
  Object.defineProperty(exports, '__esModule', {
2853
2965
  value: true,
@@ -2914,7 +3026,10 @@ function isSource(source) {
2914
3026
  }
2915
3027
  });
2916
3028
 
3029
+ const source$1 = /*@__PURE__*/getDefaultExportFromCjs(source);
3030
+
2917
3031
  var parser = createCommonjsModule(function (module, exports) {
3032
+ 'use strict';
2918
3033
 
2919
3034
  Object.defineProperty(exports, '__esModule', {
2920
3035
  value: true,
@@ -3008,12 +3123,13 @@ function parseType(source, options) {
3008
3123
  */
3009
3124
 
3010
3125
  class Parser {
3011
- constructor(source$1, options) {
3126
+ constructor(source$1, options = {}) {
3012
3127
  const sourceObj = (0, source.isSource)(source$1)
3013
3128
  ? source$1
3014
3129
  : new source.Source(source$1);
3015
3130
  this._lexer = new lexer.Lexer(sourceObj);
3016
3131
  this._options = options;
3132
+ this._tokenCounter = 0;
3017
3133
  }
3018
3134
  /**
3019
3135
  * Converts a name lex token into a name parse node.
@@ -3348,18 +3464,12 @@ class Parser {
3348
3464
  */
3349
3465
 
3350
3466
  parseFragmentDefinition() {
3351
- var _this$_options;
3352
-
3353
3467
  const start = this._lexer.token;
3354
3468
  this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes
3355
3469
  // the grammar of FragmentDefinition:
3356
3470
  // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
3357
3471
 
3358
- if (
3359
- ((_this$_options = this._options) === null || _this$_options === void 0
3360
- ? void 0
3361
- : _this$_options.allowLegacyFragmentVariables) === true
3362
- ) {
3472
+ if (this._options.allowLegacyFragmentVariables === true) {
3363
3473
  return this.node(start, {
3364
3474
  kind: kinds.Kind.FRAGMENT_DEFINITION,
3365
3475
  name: this.parseFragmentName(),
@@ -3420,16 +3530,14 @@ class Parser {
3420
3530
  return this.parseObject(isConst);
3421
3531
 
3422
3532
  case tokenKind.TokenKind.INT:
3423
- this._lexer.advance();
3424
-
3533
+ this.advanceLexer();
3425
3534
  return this.node(token, {
3426
3535
  kind: kinds.Kind.INT,
3427
3536
  value: token.value,
3428
3537
  });
3429
3538
 
3430
3539
  case tokenKind.TokenKind.FLOAT:
3431
- this._lexer.advance();
3432
-
3540
+ this.advanceLexer();
3433
3541
  return this.node(token, {
3434
3542
  kind: kinds.Kind.FLOAT,
3435
3543
  value: token.value,
@@ -3440,7 +3548,7 @@ class Parser {
3440
3548
  return this.parseStringLiteral();
3441
3549
 
3442
3550
  case tokenKind.TokenKind.NAME:
3443
- this._lexer.advance();
3551
+ this.advanceLexer();
3444
3552
 
3445
3553
  switch (token.value) {
3446
3554
  case 'true':
@@ -3496,9 +3604,7 @@ class Parser {
3496
3604
 
3497
3605
  parseStringLiteral() {
3498
3606
  const token = this._lexer.token;
3499
-
3500
- this._lexer.advance();
3501
-
3607
+ this.advanceLexer();
3502
3608
  return this.node(token, {
3503
3609
  kind: kinds.Kind.STRING,
3504
3610
  value: token.value,
@@ -4289,13 +4395,7 @@ class Parser {
4289
4395
  */
4290
4396
 
4291
4397
  node(startToken, node) {
4292
- var _this$_options2;
4293
-
4294
- if (
4295
- ((_this$_options2 = this._options) === null || _this$_options2 === void 0
4296
- ? void 0
4297
- : _this$_options2.noLocation) !== true
4298
- ) {
4398
+ if (this._options.noLocation !== true) {
4299
4399
  node.loc = new ast.Location(
4300
4400
  startToken,
4301
4401
  this._lexer.lastToken,
@@ -4321,8 +4421,7 @@ class Parser {
4321
4421
  const token = this._lexer.token;
4322
4422
 
4323
4423
  if (token.kind === kind) {
4324
- this._lexer.advance();
4325
-
4424
+ this.advanceLexer();
4326
4425
  return token;
4327
4426
  }
4328
4427
 
@@ -4341,8 +4440,7 @@ class Parser {
4341
4440
  const token = this._lexer.token;
4342
4441
 
4343
4442
  if (token.kind === kind) {
4344
- this._lexer.advance();
4345
-
4443
+ this.advanceLexer();
4346
4444
  return true;
4347
4445
  }
4348
4446
 
@@ -4357,7 +4455,7 @@ class Parser {
4357
4455
  const token = this._lexer.token;
4358
4456
 
4359
4457
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4360
- this._lexer.advance();
4458
+ this.advanceLexer();
4361
4459
  } else {
4362
4460
  throw (0, syntaxError_1.syntaxError)(
4363
4461
  this._lexer.source,
@@ -4375,8 +4473,7 @@ class Parser {
4375
4473
  const token = this._lexer.token;
4376
4474
 
4377
4475
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4378
- this._lexer.advance();
4379
-
4476
+ this.advanceLexer();
4380
4477
  return true;
4381
4478
  }
4382
4479
 
@@ -4463,6 +4560,24 @@ class Parser {
4463
4560
 
4464
4561
  return nodes;
4465
4562
  }
4563
+
4564
+ advanceLexer() {
4565
+ const { maxTokens } = this._options;
4566
+
4567
+ const token = this._lexer.advance();
4568
+
4569
+ if (maxTokens !== undefined && token.kind !== tokenKind.TokenKind.EOF) {
4570
+ ++this._tokenCounter;
4571
+
4572
+ if (this._tokenCounter > maxTokens) {
4573
+ throw (0, syntaxError_1.syntaxError)(
4574
+ this._lexer.source,
4575
+ token.start,
4576
+ `Document contains more that ${maxTokens} tokens. Parsing aborted.`,
4577
+ );
4578
+ }
4579
+ }
4580
+ }
4466
4581
  }
4467
4582
  /**
4468
4583
  * A helper function to describe a token as a string for debugging.
@@ -4483,7 +4598,10 @@ function getTokenKindDesc(kind) {
4483
4598
  }
4484
4599
  });
4485
4600
 
4601
+ const parser$1 = /*@__PURE__*/getDefaultExportFromCjs(parser);
4602
+
4486
4603
  var printString_1 = createCommonjsModule(function (module, exports) {
4604
+ 'use strict';
4487
4605
 
4488
4606
  Object.defineProperty(exports, '__esModule', {
4489
4607
  value: true,
@@ -4668,7 +4786,10 @@ const escapeSequences = [
4668
4786
  ];
4669
4787
  });
4670
4788
 
4789
+ const printString = /*@__PURE__*/getDefaultExportFromCjs(printString_1);
4790
+
4671
4791
  var visitor = createCommonjsModule(function (module, exports) {
4792
+ 'use strict';
4672
4793
 
4673
4794
  Object.defineProperty(exports, '__esModule', {
4674
4795
  value: true,
@@ -5047,7 +5168,10 @@ function getVisitFn(visitor, kind, isLeaving) {
5047
5168
  }
5048
5169
  });
5049
5170
 
5171
+ const visitor$1 = /*@__PURE__*/getDefaultExportFromCjs(visitor);
5172
+
5050
5173
  var printer = createCommonjsModule(function (module, exports) {
5174
+ 'use strict';
5051
5175
 
5052
5176
  Object.defineProperty(exports, '__esModule', {
5053
5177
  value: true,
@@ -5400,6 +5524,10 @@ function hasMultilineItems(maybeArray) {
5400
5524
  }
5401
5525
  });
5402
5526
 
5527
+ const printer$1 = /*@__PURE__*/getDefaultExportFromCjs(printer);
5528
+
5529
+ 'use strict';
5530
+
5403
5531
  var ReactNativeFile$1 = function ReactNativeFile(_ref) {
5404
5532
  var uri = _ref.uri,
5405
5533
  name = _ref.name,
@@ -5409,6 +5537,10 @@ var ReactNativeFile$1 = function ReactNativeFile(_ref) {
5409
5537
  this.type = type;
5410
5538
  };
5411
5539
 
5540
+ 'use strict';
5541
+
5542
+
5543
+
5412
5544
  var isExtractableFile$1 = function isExtractableFile(value) {
5413
5545
  return (
5414
5546
  (typeof File !== 'undefined' && value instanceof File) ||
@@ -5417,6 +5549,10 @@ var isExtractableFile$1 = function isExtractableFile(value) {
5417
5549
  );
5418
5550
  };
5419
5551
 
5552
+ 'use strict';
5553
+
5554
+
5555
+
5420
5556
  var extractFiles$1 = function extractFiles(value, path, isExtractableFile) {
5421
5557
  if (path === void 0) {
5422
5558
  path = '';
@@ -5468,6 +5604,8 @@ var extractFiles$1 = function extractFiles(value, path, isExtractableFile) {
5468
5604
  };
5469
5605
  };
5470
5606
 
5607
+ 'use strict';
5608
+
5471
5609
  var ReactNativeFile = ReactNativeFile$1;
5472
5610
  var extractFiles = extractFiles$1;
5473
5611
  var isExtractableFile = isExtractableFile$1;
@@ -5482,6 +5620,7 @@ var _public = {
5482
5620
  var browser = typeof self == 'object' ? self.FormData : window.FormData;
5483
5621
 
5484
5622
  var defaultJsonSerializer = createCommonjsModule(function (module, exports) {
5623
+ "use strict";
5485
5624
  Object.defineProperty(exports, "__esModule", { value: true });
5486
5625
  exports.defaultJsonSerializer = void 0;
5487
5626
  exports.defaultJsonSerializer = {
@@ -5491,7 +5630,10 @@ exports.defaultJsonSerializer = {
5491
5630
  //# sourceMappingURL=defaultJsonSerializer.js.map
5492
5631
  });
5493
5632
 
5633
+ const defaultJsonSerializer$1 = /*@__PURE__*/getDefaultExportFromCjs(defaultJsonSerializer);
5634
+
5494
5635
  var createRequestBody_1 = createCommonjsModule(function (module, exports) {
5636
+ "use strict";
5495
5637
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
5496
5638
  return (mod && mod.__esModule) ? mod : { "default": mod };
5497
5639
  };
@@ -5548,7 +5690,10 @@ exports.default = createRequestBody;
5548
5690
  //# sourceMappingURL=createRequestBody.js.map
5549
5691
  });
5550
5692
 
5693
+ const createRequestBody = /*@__PURE__*/getDefaultExportFromCjs(createRequestBody_1);
5694
+
5551
5695
  var parseArgs = createCommonjsModule(function (module, exports) {
5696
+ "use strict";
5552
5697
  Object.defineProperty(exports, "__esModule", { value: true });
5553
5698
  exports.parseBatchRequestsExtendedArgs = exports.parseRawRequestExtendedArgs = exports.parseRequestExtendedArgs = exports.parseBatchRequestArgs = exports.parseRawRequestArgs = exports.parseRequestArgs = void 0;
5554
5699
  function parseRequestArgs(documentOrOptions, variables, requestHeaders) {
@@ -5621,7 +5766,10 @@ exports.parseBatchRequestsExtendedArgs = parseBatchRequestsExtendedArgs;
5621
5766
  //# sourceMappingURL=parseArgs.js.map
5622
5767
  });
5623
5768
 
5769
+ const parseArgs$1 = /*@__PURE__*/getDefaultExportFromCjs(parseArgs);
5770
+
5624
5771
  var types = createCommonjsModule(function (module, exports) {
5772
+ "use strict";
5625
5773
  var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
5626
5774
  var extendStatics = function (d, b) {
5627
5775
  extendStatics = Object.setPrototypeOf ||
@@ -5671,7 +5819,10 @@ exports.ClientError = ClientError;
5671
5819
  //# sourceMappingURL=types.js.map
5672
5820
  });
5673
5821
 
5822
+ const types$1 = /*@__PURE__*/getDefaultExportFromCjs(types);
5823
+
5674
5824
  var graphqlWs = createCommonjsModule(function (module, exports) {
5825
+ "use strict";
5675
5826
  var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5676
5827
  __assign = Object.assign || function(t) {
5677
5828
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -5851,6 +6002,8 @@ var GraphQLWebSocketClient = /** @class */ (function () {
5851
6002
  if (message.payload.errors) {
5852
6003
  subscriber.error && subscriber.error(new types.ClientError(__assign(__assign({}, message.payload), { status: 200 }), { query: query, variables: variables }));
5853
6004
  }
6005
+ else {
6006
+ }
5854
6007
  return;
5855
6008
  }
5856
6009
  case ERROR: {
@@ -5945,7 +6098,10 @@ function Complete(id) {
5945
6098
  //# sourceMappingURL=graphql-ws.js.map
5946
6099
  });
5947
6100
 
6101
+ const graphqlWs$1 = /*@__PURE__*/getDefaultExportFromCjs(graphqlWs);
6102
+
5948
6103
  var dist = createCommonjsModule(function (module, exports) {
6104
+ "use strict";
5949
6105
  var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5950
6106
  __assign = Object.assign || function(t) {
5951
6107
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -6270,7 +6426,7 @@ exports.GraphQLClient = GraphQLClient;
6270
6426
  function makeRequest(_a) {
6271
6427
  var url = _a.url, query = _a.query, variables = _a.variables, headers = _a.headers, operationName = _a.operationName, fetch = _a.fetch, _b = _a.method, method = _b === void 0 ? 'POST' : _b, fetchOptions = _a.fetchOptions;
6272
6428
  return __awaiter(this, void 0, void 0, function () {
6273
- var fetcher, isBathchingQuery, response, result, successfullyReceivedData, successfullyPassedErrorPolicy, headers_1, status_1, rest, data, errorResult;
6429
+ var fetcher, isBathchingQuery, response, result, successfullyReceivedData, successfullyPassedErrorPolicy, headers_1, status_1, errors, rest, data, errorResult;
6274
6430
  return __generator(this, function (_c) {
6275
6431
  switch (_c.label) {
6276
6432
  case 0:
@@ -6297,7 +6453,7 @@ function makeRequest(_a) {
6297
6453
  successfullyPassedErrorPolicy = !result.errors || fetchOptions.errorPolicy === 'all' || fetchOptions.errorPolicy === 'ignore';
6298
6454
  if (response.ok && successfullyPassedErrorPolicy && successfullyReceivedData) {
6299
6455
  headers_1 = response.headers, status_1 = response.status;
6300
- rest = __rest(result, ["errors"]);
6456
+ errors = result.errors, rest = __rest(result, ["errors"]);
6301
6457
  data = fetchOptions.errorPolicy === 'ignore' ? rest : result;
6302
6458
  return [2 /*return*/, __assign(__assign({}, (isBathchingQuery ? { data: data } : data)), { headers: headers_1, status: status_1 })];
6303
6459
  }
@@ -6305,6 +6461,7 @@ function makeRequest(_a) {
6305
6461
  errorResult = typeof result === 'string' ? { error: result } : result;
6306
6462
  throw new types.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables });
6307
6463
  }
6464
+ return [2 /*return*/];
6308
6465
  }
6309
6466
  });
6310
6467
  });
@@ -6434,6 +6591,8 @@ Object.defineProperty(exports, "GraphQLWebSocketClient", { enumerable: true, get
6434
6591
  //# sourceMappingURL=index.js.map
6435
6592
  });
6436
6593
 
6594
+ const index = /*@__PURE__*/getDefaultExportFromCjs(dist);
6595
+
6437
6596
  class UrlUtils {
6438
6597
  static getQueryParams(queryString) {
6439
6598
  const params = new Map();
@@ -6462,7 +6621,7 @@ class UrlUtils {
6462
6621
 
6463
6622
  class DataFetcher {
6464
6623
  constructor() {
6465
- this.GRAPHQL_PATH = window['applicationenv'] === "sankhyaom" ? "/mge/graphql" : "";
6624
+ this.GRAPHQL_PATH = "/mge/graphql";
6466
6625
  this.watingRequestsById = new Map();
6467
6626
  }
6468
6627
  static get() {
@@ -6491,6 +6650,27 @@ class DataFetcher {
6491
6650
  DataFetcher.requestListener.splice(index, 1);
6492
6651
  }
6493
6652
  }
6653
+ processErrorInfo(errors) {
6654
+ var _a, _b;
6655
+ const POSITION_ERROR_INFO = 0;
6656
+ const errorTitle = "Falha detectada";
6657
+ const error = errors[POSITION_ERROR_INFO];
6658
+ if (error.length > 0) { //As informações do erro vem no primeiro indice de um array
6659
+ const errorInfo = error[POSITION_ERROR_INFO];
6660
+ const errorMessage = (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.message) ? errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.message : "Não há mensagem de erro";
6661
+ const errorLevel = ((_a = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _a === void 0 ? void 0 : _a.level) ? errorInfo.extensions.level : "ERROR";
6662
+ const errorCode = ((_b = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _b === void 0 ? void 0 : _b.code) ? errorInfo.extensions.code : "";
6663
+ switch (errorLevel) {
6664
+ case "WARNING":
6665
+ return new index$1.WarningException(errorTitle, errorMessage, errorCode);
6666
+ default:
6667
+ return new index$1.ErrorException(errorTitle, errorMessage, errorCode);
6668
+ }
6669
+ }
6670
+ else {
6671
+ return new index$1.ErrorException(errorTitle, "Não há informações sobre o erro");
6672
+ }
6673
+ }
6494
6674
  async callGraphQL(req) {
6495
6675
  var _a;
6496
6676
  const reqKey = this.getReqKey(req);
@@ -6501,7 +6681,8 @@ class DataFetcher {
6501
6681
  let query = this.getQueryTemplate(req);
6502
6682
  const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
6503
6683
  if (res.errors.length > 0) {
6504
- reject(new core.ErrorException("Falha detectada", res.errors[0][0].message));
6684
+ const error = this.processErrorInfo(res.errors);
6685
+ reject(error);
6505
6686
  }
6506
6687
  else {
6507
6688
  resolve(res.data[0][reqKey]);
@@ -6518,23 +6699,26 @@ class DataFetcher {
6518
6699
  resolveURL() {
6519
6700
  return UrlUtils.getUrlBase();
6520
6701
  }
6521
- getContext() {
6702
+ getContext(module) {
6522
6703
  const urlParams = UrlUtils.getQueryParams(location.search);
6523
6704
  return {
6524
- baseUrl: `${this.resolveURL()}/mge/service.sbr`,
6705
+ baseUrl: `${this.resolveURL()}/${module}/service.sbr`,
6525
6706
  appName: "SankhyaBlocks",
6526
6707
  mgeSession: `${window['skw_session'] || urlParams.mgeSession}`,
6527
6708
  globalID: "85C0093DFA240EAB699B4E47A10215BD",
6709
+ //FIXME: Precisamos ajustar para buscar o resourceId pela aplicação
6528
6710
  resourceID: "br.com.sankhya.mov.bancaria"
6529
6711
  };
6530
6712
  }
6531
6713
  async callServiceBroker(serviceName, payload) {
6532
6714
  return new Promise((accept, reject) => {
6533
- const ctx = this.getContext();
6534
- const url = `${ctx.baseUrl}?serviceName=${serviceName}&counter=21&application=${ctx.appName}&outputType=json&preventTransform=false&mgeSession=${ctx.mgeSession}&resourceID=${ctx.resourceID}&globalID=${ctx.globalID}&allowConcurrentCalls=true`;
6715
+ const parts = serviceName.split("@");
6716
+ const [module, name] = parts.length === 2 ? parts : ['mge', serviceName];
6717
+ const ctx = this.getContext(module);
6718
+ const url = `${ctx.baseUrl}?serviceName=${name}&counter=21&application=${ctx.appName}&outputType=json&preventTransform=false&mgeSession=${ctx.mgeSession}&resourceID=${ctx.resourceID}&globalID=${ctx.globalID}&allowConcurrentCalls=true`;
6535
6719
  document.cookie = `JSESSIONID=${ctx.mgeSession};`;
6536
6720
  const http = new XMLHttpRequest();
6537
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url }));
6721
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
6538
6722
  http.open("POST", url, true);
6539
6723
  http.withCredentials = true;
6540
6724
  http.send(payload);
@@ -6553,17 +6737,17 @@ class DataFetcher {
6553
6737
  console.warn(`callServiceBroker error to parser response to JSON ${e}`);
6554
6738
  reject(this.responseText);
6555
6739
  }
6556
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6740
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6557
6741
  }
6558
6742
  else if (this.readyState == 4 && this.status != 200) {
6559
6743
  reject(this.responseText);
6560
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6744
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6561
6745
  }
6562
6746
  };
6563
6747
  });
6564
6748
  }
6565
6749
  getReqKey(req) {
6566
- return window.btoa(core.StringUtils.hashCode(`${req.query}${JSON.stringify(req.values || "")}`)).replace(/=/g, "");
6750
+ return window.btoa(index$1.StringUtils.hashCode(`${req.query}${JSON.stringify(req.values || "")}`)).replace(/=/g, "");
6567
6751
  }
6568
6752
  getQueryTemplate(re) {
6569
6753
  return (re.query || "").replaceAll("$queryAlias$", re.queryID);
@@ -6592,7 +6776,7 @@ class DataFetcher {
6592
6776
  errorsResponse.forEach((errorResponse) => {
6593
6777
  Object.entries(errorResponse).forEach(([_key, val]) => {
6594
6778
  var _a;
6595
- (((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new core.ErrorException("Falha detectada", val.message));
6779
+ (((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new index$1.ErrorException("Falha detectada", val.message));
6596
6780
  });
6597
6781
  });
6598
6782
  //Resolve promises with data from query
@@ -6613,7 +6797,7 @@ class DataFetcher {
6613
6797
  if (window['skw_session']) {
6614
6798
  url += `?mgeSession=${window['skw_session']}`;
6615
6799
  }
6616
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url }));
6800
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: request }));
6617
6801
  try {
6618
6802
  res = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
6619
6803
  res.forEach((resItem, index) => {
@@ -6644,11 +6828,11 @@ class DataFetcher {
6644
6828
  });
6645
6829
  }
6646
6830
  else {
6647
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6648
- throw new core.ErrorException("Falha de comunicação", err.message);
6831
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: request }));
6832
+ throw new index$1.ErrorException("Falha de comunicação", err.message);
6649
6833
  }
6650
6834
  }
6651
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6835
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: request }));
6652
6836
  return { data: dataResponse, errors: errorsResponse };
6653
6837
  }
6654
6838
  isHttpError(err) {
@@ -6695,6 +6879,7 @@ class WaitingRequest {
6695
6879
  class DataUnitFetcher {
6696
6880
  constructor() {
6697
6881
  this.templateByQuery = new Map();
6882
+ this._loadDataTimeout = {};
6698
6883
  this.buldTemplates();
6699
6884
  }
6700
6885
  buldTemplates() {
@@ -6723,9 +6908,9 @@ class DataUnitFetcher {
6723
6908
  }
6724
6909
  }
6725
6910
  }`);
6726
- this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filter: [InputFilter!] $sort: [InputSort!]) {
6911
+ this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!]) {
6727
6912
  $queryAlias$: fetchDataUnit(name: $dataunit){
6728
- data(limit: $limit offset: $offset filters: $filter sort: $sort){
6913
+ data(limit: $limit offset: $offset filters: $filters sort: $sort){
6729
6914
  limit
6730
6915
  offset
6731
6916
  total
@@ -6752,9 +6937,9 @@ class DataUnitFetcher {
6752
6937
  }`);
6753
6938
  }
6754
6939
  getDataUnit(entityName, resourceID) {
6755
- const dataUnit = new core.DataUnit(`dd://${entityName}/${resourceID}`);
6940
+ const dataUnit = new index$1.DataUnit(`dd://${entityName}/${resourceID}`);
6756
6941
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
6757
- dataUnit.dataLoader = (dataUnit, page, sort, filters) => this.loadData(dataUnit, page, sort, filters);
6942
+ dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
6758
6943
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
6759
6944
  dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
6760
6945
  return dataUnit;
@@ -6791,25 +6976,39 @@ class DataUnitFetcher {
6791
6976
  });
6792
6977
  });
6793
6978
  }
6794
- loadData(dataUnit, page, sort, filter) {
6979
+ loadData(dataUnit, request) {
6980
+ const duName = dataUnit.name;
6981
+ if (this._loadDataTimeout[duName]) {
6982
+ clearTimeout(this._loadDataTimeout[duName]);
6983
+ delete this._loadDataTimeout[duName];
6984
+ }
6795
6985
  return new Promise((resolve, reject) => {
6796
- var _a, _b, _c;
6797
- const variables = { dataunit: dataUnit.name, sort, filter };
6798
- if (page) {
6799
- variables.limit = page.limit;
6800
- variables.offset = page.offset;
6801
- }
6802
- if (!core.StringUtils.isEmpty((_a = page === null || page === void 0 ? void 0 : page.quickFilter) === null || _a === void 0 ? void 0 : _a.term)) {
6986
+ this._loadDataTimeout[duName] = setTimeout(() => {
6987
+ delete this._loadDataTimeout[duName];
6988
+ this.doLoadData(dataUnit, request)
6989
+ .then(result => resolve(result))
6990
+ .catch(reason => reject(reason));
6991
+ }, 200);
6992
+ });
6993
+ }
6994
+ doLoadData(dataUnit, request) {
6995
+ return new Promise((resolve, reject) => {
6996
+ var _a;
6997
+ const { sort, filters, limit, offset, quickFilter } = request;
6998
+ const variables = { dataunit: dataUnit.name, sort, filters };
6999
+ variables.limit = limit;
7000
+ variables.offset = offset;
7001
+ if (!index$1.StringUtils.isEmpty(quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.term)) {
6803
7002
  if (variables.filter === undefined) {
6804
7003
  variables.filter = [];
6805
7004
  }
6806
7005
  const quickFilterCriteria = {
6807
7006
  name: "__QUICK_FILTER__",
6808
7007
  expression: "__QUICK_FILTER__",
6809
- params: [{ name: "term", dataType: core.DataType.TEXT, value: page.quickFilter.term }]
7008
+ params: [{ name: "term", dataType: index$1.DataType.TEXT, value: quickFilter.term }]
6810
7009
  };
6811
- if (((_c = (_b = page.quickFilter) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.length) > 0) {
6812
- quickFilterCriteria.params.push({ name: "fields", dataType: core.DataType.OBJECT, value: page.quickFilter.fields });
7010
+ if (((_a = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
7011
+ quickFilterCriteria.params.push({ name: "fields", dataType: index$1.DataType.OBJECT, value: quickFilter.fields });
6813
7012
  }
6814
7013
  variables.filter.push(quickFilterCriteria);
6815
7014
  }
@@ -6819,16 +7018,32 @@ class DataUnitFetcher {
6819
7018
  query: this.templateByQuery.get("fetchData"),
6820
7019
  })
6821
7020
  .then((resp) => {
6822
- const pageResult = resp.data;
6823
- const records = [];
6824
- pageResult.records.forEach((responseRecord) => {
7021
+ const { limit, offset, total, hasMore, records } = resp.data;
7022
+ let paginationInfo;
7023
+ if (limit) {
7024
+ const firstRecord = total == 0 ? 0 : offset + 1;
7025
+ const lastRecord = offset + Math.min(records.length, limit);
7026
+ const currentPage = offset / limit;
7027
+ paginationInfo = {
7028
+ firstRecord,
7029
+ lastRecord,
7030
+ total,
7031
+ currentPage,
7032
+ hasMore
7033
+ };
7034
+ }
7035
+ const processedRecords = [];
7036
+ records.forEach((responseRecord) => {
6825
7037
  const duRecord = { __record__id__: responseRecord.id };
6826
7038
  responseRecord.fields.forEach(({ name, value }) => {
6827
7039
  duRecord[name] = dataUnit.valueFromString(name, value);
6828
7040
  });
6829
- records.push(duRecord);
7041
+ processedRecords.push(duRecord);
7042
+ });
7043
+ resolve({
7044
+ paginationInfo,
7045
+ records: processedRecords
6830
7046
  });
6831
- resolve(Object.assign(Object.assign({}, pageResult), { records }));
6832
7047
  })
6833
7048
  .catch((error) => {
6834
7049
  reject(error);
@@ -6842,7 +7057,7 @@ class DataUnitFetcher {
6842
7057
  if (updatingFields) {
6843
7058
  parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
6844
7059
  const descriptor = dataUnit.getField(fieldName);
6845
- const dataType = descriptor ? descriptor.dataType : core.DataType.TEXT;
7060
+ const dataType = descriptor ? descriptor.dataType : index$1.DataType.TEXT;
6846
7061
  return { fieldName, dataType, value: dataUnit.valueToString(fieldName, value) };
6847
7062
  });
6848
7063
  }
@@ -6879,7 +7094,7 @@ class DataUnitFetcher {
6879
7094
  }
6880
7095
  removeRecords(dataUnit, recordIds) {
6881
7096
  const changes = recordIds.map((recordId) => {
6882
- return { dataUnit: dataUnit.name, operation: core.ChangeOperation.DELETE, recordId };
7097
+ return { dataUnit: dataUnit.name, operation: index$1.ChangeOperation.DELETE, recordId };
6883
7098
  });
6884
7099
  return new Promise((resolve, reject) => {
6885
7100
  DataFetcher.get()
@@ -6944,7 +7159,7 @@ class ParametersFetcher {
6944
7159
  }
6945
7160
  async asDate(name, resourceID) {
6946
7161
  const paramArr = await this.getParam(name, resourceID);
6947
- return core.DateUtils.strToDate(this.getValue(paramArr));
7162
+ return index$1.DateUtils.strToDate(this.getValue(paramArr));
6948
7163
  }
6949
7164
  async getBatchParams(names, resourceID) {
6950
7165
  const paramArr = await this.getParam(names.join(","), resourceID);
@@ -6957,7 +7172,7 @@ class ParametersFetcher {
6957
7172
  if (Array.isArray(obj) && obj.length > 0) {
6958
7173
  obj = obj[0];
6959
7174
  }
6960
- if (core.StringUtils.isEmpty(obj.resource))
7175
+ if (index$1.StringUtils.isEmpty(obj.resource))
6961
7176
  return "";
6962
7177
  return obj.resource;
6963
7178
  }
@@ -7054,15 +7269,16 @@ class GridConfigFetcher extends ResourceFetcher {
7054
7269
  super(...arguments);
7055
7270
  this.GRID_CONFIG_VERSION = "V3:";
7056
7271
  }
7057
- getConfig(resourceID) {
7272
+ getConfig(_gridName, resourceID) {
7058
7273
  const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
7059
7274
  return new Promise((resolve, reject) => {
7060
7275
  this.loadResource(completePath)
7061
7276
  .then(loadedResource => {
7277
+ let config = undefined;
7062
7278
  if (loadedResource) {
7063
- let config = JSON.parse(loadedResource);
7064
- resolve(config);
7279
+ config = JSON.parse(loadedResource);
7065
7280
  }
7281
+ resolve(config);
7066
7282
  }).catch((error) => {
7067
7283
  reject(error);
7068
7284
  });
@@ -7097,6 +7313,8 @@ class PesquisaFetcher {
7097
7313
  }`);
7098
7314
  }
7099
7315
  loadSearchOptions(entityName, argument, criteria, options) {
7316
+ const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
7317
+ argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
7100
7318
  return new Promise((resolve, reject) => {
7101
7319
  DataFetcher.get()
7102
7320
  .callGraphQL({
@@ -7154,9 +7372,9 @@ function convertParamType(dataType) {
7154
7372
  //atual da pesquisa... em geral, somente inteiros,
7155
7373
  //data (com ou sem hora) e string são realmente relevantes
7156
7374
  switch (dataType) {
7157
- case core.DataType.NUMBER:
7375
+ case index$1.DataType.NUMBER:
7158
7376
  return "I";
7159
- case core.DataType.DATE:
7377
+ case index$1.DataType.DATE:
7160
7378
  return "D";
7161
7379
  default:
7162
7380
  return "S";
@@ -7169,7 +7387,7 @@ class AuthFetcher extends ResourceFetcher {
7169
7387
  return new Promise((resolve, reject) => {
7170
7388
  this.loadResource(completePath)
7171
7389
  .then((loadedResource) => {
7172
- let auth = core.ObjectUtils.stringToObject(loadedResource);
7390
+ let auth = index$1.ObjectUtils.stringToObject(loadedResource);
7173
7391
  if (auth && typeof (auth) === 'object') {
7174
7392
  resolve(auth);
7175
7393
  }
@@ -7203,7 +7421,7 @@ class SnkErrorHandler {
7203
7421
  const reason = evt.reason;
7204
7422
  //Promisse rejeitada com WaitingChangeException, não precisam
7205
7423
  //ser notificadas pelo usuário.
7206
- if (!(reason instanceof core.WaitingChangeException)) {
7424
+ if (!(reason instanceof index$1.WaitingChangeException)) {
7207
7425
  if (reason) {
7208
7426
  this.processException(reason);
7209
7427
  }
@@ -7219,14 +7437,21 @@ class SnkErrorHandler {
7219
7437
  errorHandler(evt) {
7220
7438
  this.processException(evt.error);
7221
7439
  }
7440
+ buildErrorCodeHTML(exception) {
7441
+ const onclick = 'try{window.workspace.openHelp(\'_tbcode:' + exception.errorCode + '\')} catch(e){alert(\'Não é possível abrir a ajuda fora do workspace Sankhya\');}';
7442
+ return '<br><a href="#" onclick="' + onclick + '">Código: ' + exception.errorCode + '</a>';
7443
+ }
7222
7444
  processException(exception) {
7223
- if (exception instanceof core.WaitingChangeException) {
7445
+ if (exception.errorCode != "") {
7446
+ exception.message += this.buildErrorCodeHTML(exception);
7447
+ }
7448
+ if (exception instanceof index$1.WaitingChangeException) {
7224
7449
  this._app.alert(exception.title, exception.message);
7225
7450
  }
7226
- else if (exception instanceof core.WarningException) {
7451
+ else if (exception instanceof index$1.WarningException) {
7227
7452
  this._app.alert(exception.title, exception.message);
7228
7453
  }
7229
- else if (exception instanceof core.ErrorException) {
7454
+ else if (exception instanceof index$1.ErrorException) {
7230
7455
  this._app.error(exception.title, exception.message);
7231
7456
  }
7232
7457
  else {
@@ -7237,7 +7462,7 @@ class SnkErrorHandler {
7237
7462
  }
7238
7463
  else {
7239
7464
  const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
7240
- const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${exception}"`;
7465
+ const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${index$1.ObjectUtils.objectToString(exception)}"`;
7241
7466
  this._app.error(title, message);
7242
7467
  }
7243
7468
  }
@@ -7248,13 +7473,449 @@ class SnkErrorHandler {
7248
7473
 
7249
7474
  function _0x53e1(){const _0x340df8=['2909523kXwted','CompanyName=Sankhya\x20Jiva\x20Tecnologia\x20e\x20Inovao\x20Ltda,LicensedApplication=Sankhya\x20Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869','1131048CARoeW','502909mLEPmu','447255iQEXuN','428UHbJwW','270AFTxAV','194369jhGqTI','1540nWuTrj','2044062GicUQI','30CkXPWg'];_0x53e1=function(){return _0x340df8;};return _0x53e1();}const _0xc7632f=_0x15c2;function _0x15c2(_0x353a9c,_0x3e4a5a){const _0x53e110=_0x53e1();return _0x15c2=function(_0x15c2aa,_0x219858){_0x15c2aa=_0x15c2aa-0x188;let _0x307231=_0x53e110[_0x15c2aa];return _0x307231;},_0x15c2(_0x353a9c,_0x3e4a5a);}(function(_0x42617e,_0x57debe){const _0x31061a=_0x15c2,_0x128d7d=_0x42617e();while(!![]){try{const _0x1c9bb1=-parseInt(_0x31061a(0x18e))/0x1+-parseInt(_0x31061a(0x189))/0x2+parseInt(_0x31061a(0x18b))/0x3+-parseInt(_0x31061a(0x190))/0x4*(parseInt(_0x31061a(0x188))/0x5)+-parseInt(_0x31061a(0x191))/0x6*(-parseInt(_0x31061a(0x192))/0x7)+parseInt(_0x31061a(0x18d))/0x8+-parseInt(_0x31061a(0x18f))/0x9*(-parseInt(_0x31061a(0x18a))/0xa);if(_0x1c9bb1===_0x57debe)break;else _0x128d7d['push'](_0x128d7d['shift']());}catch(_0x1bd816){_0x128d7d['push'](_0x128d7d['shift']());}}}(_0x53e1,0xe8676));const agGridLicense=_0xc7632f(0x18c);
7250
7475
 
7476
+ class TotalsFetcher {
7477
+ constructor() {
7478
+ this.templateByQuery = new Map();
7479
+ this.buldTemplates();
7480
+ }
7481
+ buldTemplates() {
7482
+ this.templateByQuery.set("fetchTotals", dist.gql `query($filters: [InputFilter!] $name: String!) {
7483
+ $queryAlias$: fetchTotals(name: $name, filters: $filters ){
7484
+ name
7485
+ value
7486
+ }
7487
+ }`);
7488
+ }
7489
+ async getTotals(name, resourceID, filters) {
7490
+ const path = `totals://${name}/${resourceID}`;
7491
+ let variables = {
7492
+ name: path,
7493
+ filters: filters
7494
+ };
7495
+ return DataFetcher.get().callGraphQL({
7496
+ values: variables,
7497
+ query: this.templateByQuery.get("fetchTotals"),
7498
+ });
7499
+ }
7500
+ fetchTotals(name, resourceID, filters = []) {
7501
+ return new Promise((accept, reject) => {
7502
+ this.getTotals(name, resourceID, filters)
7503
+ .then((result) => {
7504
+ if (result.length > 0) {
7505
+ const totalsData = new Map();
7506
+ result.forEach(total => {
7507
+ totalsData.set(total.name, parseFloat(total.value));
7508
+ });
7509
+ accept(totalsData);
7510
+ }
7511
+ else {
7512
+ reject(`Não foi possível recuperar os totalizadores`);
7513
+ }
7514
+ })
7515
+ .catch((error) => {
7516
+ reject(error);
7517
+ });
7518
+ });
7519
+ }
7520
+ }
7521
+
7522
+ class FilterBarConfigFetcher extends ResourceFetcher {
7523
+ getConfig(resourceID) {
7524
+ return new Promise((resolve) => {
7525
+ if (resourceID === "br.com.sankhya.fin.cad.movimentacaoFinanceira") {
7526
+ resolve(getFiltrosMovFin());
7527
+ }
7528
+ else if (resourceID === "br.com.sankhya.fin.cad.movimentacaoBancaria") {
7529
+ resolve(getFiltrosMovBan());
7530
+ }
7531
+ else {
7532
+ resolve(undefined);
7533
+ }
7534
+ });
7535
+ }
7536
+ }
7537
+ function getFiltrosMovBan() {
7538
+ return [{
7539
+ "id": "DTLANC",
7540
+ "visible": true,
7541
+ "type": filterItemType_enum.FilterItemType.PERIOD,
7542
+ "label": "Dt Lançamento",
7543
+ "detailTitle": "Informe a data ou período",
7544
+ "props": {
7545
+ "expression": {
7546
+ "fullfill": "onlydate(this.DTLANC) >= :DTLANC.START AND onlydate(this.DTLANC) <= :DTLANC.END",
7547
+ "onlystart": "onlydate(this.DTLANC) >= :DTLANC",
7548
+ "onlyend": "onlydate(this.DTLANC) <= :DTLANC"
7549
+ }
7550
+ }
7551
+ },
7552
+ {
7553
+ "id": "CODCTABCOINT",
7554
+ "visible": true,
7555
+ "type": filterItemType_enum.FilterItemType.SEARCH,
7556
+ "label": "Conta origem",
7557
+ "detailTitle": "Informe a conta de origem",
7558
+ "props": {
7559
+ "expression": "this.CODCTABCOINT = :CODCTABCOINT",
7560
+ "searchContext": {
7561
+ "entity": "ImplantacaoSaldoConta",
7562
+ "entityDescription": "Conta origem",
7563
+ "searchOptions": {
7564
+ "rootEntity": "MovimentoBancario",
7565
+ "descriptionFieldName": "DESCRICAO",
7566
+ "codeFieldName": "CODCTABCOINT",
7567
+ "showInactives": false
7568
+ }
7569
+ }
7570
+ }
7571
+ },
7572
+ {
7573
+ "id": "CODTIPOPER",
7574
+ "visible": false,
7575
+ "type": filterItemType_enum.FilterItemType.SEARCH,
7576
+ "label": "Tipo de operação",
7577
+ "detailTitle": "Informe o tipo de operação",
7578
+ "props": {
7579
+ "expression": "this.CODTIPOPER = :CODTIPOPER",
7580
+ "searchContext": {
7581
+ "entity": "TipoOperacao",
7582
+ "entityDescription": "Tipo de operação",
7583
+ "searchOptions": {
7584
+ "rootEntity": "MovimentoBancario",
7585
+ "descriptionFieldName": "DESCROPER",
7586
+ "codeFieldName": "CODTIPOPER",
7587
+ "showInactives": false
7588
+ }
7589
+ }
7590
+ }
7591
+ },
7592
+ {
7593
+ "id": "ORIGMOV",
7594
+ "visible": false,
7595
+ "type": filterItemType_enum.FilterItemType.MULTI_SELECT,
7596
+ "label": "Tipo de movimento",
7597
+ "detailTitle": "Escolha um tipo de movimento",
7598
+ "props": {
7599
+ "expression": "this.ORIGMOV = :ORIGMOV",
7600
+ "options": [
7601
+ { "value": "A", "label": "Aplicação" },
7602
+ { "value": "R", "label": "Resgate" },
7603
+ { "value": "S", "label": "Saque" },
7604
+ { "value": "D", "label": "Depósito" },
7605
+ { "value": "T", "label": "Transferência" }
7606
+ ]
7607
+ }
7608
+ },
7609
+ {
7610
+ "id": "NUBCO",
7611
+ "type": filterItemType_enum.FilterItemType.NUMBER,
7612
+ "visible": false,
7613
+ "label": "Nr. único",
7614
+ "detailTitle": "Informe o número único",
7615
+ "props": {
7616
+ "expression": "this.NUBCO = :NUBCO"
7617
+ }
7618
+ },
7619
+ {
7620
+ "id": "VLRLANC",
7621
+ "type": filterItemType_enum.FilterItemType.NUMBER,
7622
+ "visible": false,
7623
+ "label": "Vlr. Lançamento",
7624
+ "detailTitle": "Informe o valor do lançamento",
7625
+ "props": {
7626
+ "expression": "this.VLRLANC = :VLRLANC",
7627
+ "precision": 2
7628
+ }
7629
+ },
7630
+ {
7631
+ "id": "CODLANC",
7632
+ "visible": false,
7633
+ "type": filterItemType_enum.FilterItemType.SEARCH,
7634
+ "label": "Lançamento origem",
7635
+ "detailTitle": "Informe o lançamento de origem",
7636
+ "props": {
7637
+ "expression": "this.CODLANC = :CODLANC",
7638
+ "searchContext": {
7639
+ "entity": "HistoricoBancario",
7640
+ "entityDescription": "Lançamento origem",
7641
+ "searchOptions": {
7642
+ "rootEntity": "MovimentoBancario",
7643
+ "descriptionFieldName": "DESCRLANCBCO",
7644
+ "codeFieldName": "CODLANC",
7645
+ "showInactives": false
7646
+ }
7647
+ }
7648
+ }
7649
+ }];
7650
+ }
7651
+ function getFiltrosMovFin() {
7652
+ return [{
7653
+ id: "RECDESP",
7654
+ visible: true,
7655
+ label: "Receitas + Despesas",
7656
+ detailTitle: "Selecione o que deseja ver",
7657
+ type: filterItemType_enum.FilterItemType.BINARY_SELECT,
7658
+ hardFixed: true,
7659
+ props: {
7660
+ options: [
7661
+ { name: "RECEITA", expression: "this.RECDESP = 1", label: "Receitas" },
7662
+ { name: "DESPESA", expression: "this.RECDESP = -1", label: "Despesas" }
7663
+ ]
7664
+ }
7665
+ },
7666
+ {
7667
+ id: "PROVISAO",
7668
+ visible: true,
7669
+ label: "Real + Provisão",
7670
+ detailTitle: "Selecione o que deseja ver",
7671
+ type: filterItemType_enum.FilterItemType.BINARY_SELECT,
7672
+ hardFixed: true,
7673
+ props: {
7674
+ options: [
7675
+ { name: "REAL", expression: "nullvalue(this.PROVISAO, 'N') = 'N'", label: "Real" },
7676
+ { name: "PROVISAO", expression: "nullvalue(this.PROVISAO, 'N') = 'S'", label: "Provisão" }
7677
+ ]
7678
+ }
7679
+ },
7680
+ {
7681
+ id: "BAIXADO",
7682
+ visible: true,
7683
+ label: "Pendentes + Baixados",
7684
+ detailTitle: "Selecione o que deseja ver",
7685
+ type: filterItemType_enum.FilterItemType.BINARY_SELECT,
7686
+ hardFixed: true,
7687
+ props: {
7688
+ options: [
7689
+ { name: "PENDENTE", expression: "this.DHBAIXA IS NULL", label: "Pendentes" },
7690
+ { name: "BAIXADO", expression: "this.DHBAIXA IS NOT NULL", label: "Baixados" }
7691
+ ]
7692
+ }
7693
+ },
7694
+ {
7695
+ id: "DTVENC",
7696
+ visible: true,
7697
+ type: filterItemType_enum.FilterItemType.PERIOD,
7698
+ label: "Dt. Vencimento",
7699
+ detailTitle: "Informe a data ou período",
7700
+ props: {
7701
+ expression: {
7702
+ fullfill: "onlydate(this.DTVENC) >= :DTVENC.START AND onlydate(this.DTVENC) <= :DTVENC.END",
7703
+ onlystart: "onlydate(this.DTVENC) >= :DTVENC",
7704
+ onlyend: "onlydate(this.DTVENC) <= :DTVENC"
7705
+ }
7706
+ }
7707
+ },
7708
+ {
7709
+ id: "CODPARC",
7710
+ visible: true,
7711
+ type: filterItemType_enum.FilterItemType.SEARCH,
7712
+ label: "Parceiro",
7713
+ detailTitle: "Informe o parceiro",
7714
+ props: {
7715
+ expression: "this.CODPARC = :CODPARC",
7716
+ searchContext: {
7717
+ entity: "Parceiro",
7718
+ entityDescription: "Parceiro",
7719
+ searchOptions: {
7720
+ rootEntity: "Financeiro",
7721
+ descriptionFieldName: "NOMEPARC",
7722
+ codeFieldName: "CODPARC",
7723
+ showInactives: false
7724
+ }
7725
+ }
7726
+ }
7727
+ },
7728
+ {
7729
+ id: "NUFIN",
7730
+ type: filterItemType_enum.FilterItemType.NUMBER,
7731
+ visible: true,
7732
+ label: "Nr. único",
7733
+ detailTitle: "Informe o número único",
7734
+ props: {
7735
+ expression: "this.NUFIN = :NUFIN"
7736
+ }
7737
+ },
7738
+ {
7739
+ id: "NUMNOTA",
7740
+ visible: true,
7741
+ type: filterItemType_enum.FilterItemType.NUMBER,
7742
+ label: "Nr. Nota",
7743
+ detailTitle: "Informe o número da nota",
7744
+ props: {
7745
+ expression: "this.NUMNOTA = :NUMNOTA"
7746
+ }
7747
+ },
7748
+ {
7749
+ id: "DHBAIXA",
7750
+ visible: true,
7751
+ type: filterItemType_enum.FilterItemType.PERIOD,
7752
+ label: "Data da Baixa",
7753
+ detailTitle: "Informe a data ou período",
7754
+ props: {
7755
+ expression: {
7756
+ fullfill: "onlydate(this.DHBAIXA) >= :DHBAIXA.START AND onlydate(this.DHBAIXA) <= :DHBAIXA.END",
7757
+ onlystart: "onlydate(this.DHBAIXA) >= :DHBAIXA",
7758
+ onlyend: "onlydate(this.DHBAIXA) <= :DHBAIXA"
7759
+ }
7760
+ }
7761
+ },
7762
+ {
7763
+ id: "CODEMP",
7764
+ visible: false,
7765
+ type: filterItemType_enum.FilterItemType.SEARCH,
7766
+ label: "Empresa",
7767
+ detailTitle: "Informe a empresa",
7768
+ props: {
7769
+ expression: "this.CODEMP = :CODEMP",
7770
+ searchContext: {
7771
+ entity: "Empresa",
7772
+ entityDescription: "Empresa",
7773
+ searchOptions: {
7774
+ rootEntity: "Financeiro",
7775
+ descriptionFieldName: "NOMEFANTASIA",
7776
+ codeFieldName: "CODEMP",
7777
+ showInactives: false
7778
+ }
7779
+ }
7780
+ }
7781
+ },
7782
+ {
7783
+ id: "CODNAT",
7784
+ visible: false,
7785
+ type: filterItemType_enum.FilterItemType.SEARCH,
7786
+ label: "Natureza",
7787
+ detailTitle: "Informe a natureza",
7788
+ props: {
7789
+ expression: "this.CODNAT = :CODNAT",
7790
+ searchContext: {
7791
+ entity: "Natureza",
7792
+ entityDescription: "Natureza",
7793
+ searchOptions: {
7794
+ rootEntity: "Financeiro",
7795
+ descriptionFieldName: "DESCRNAT",
7796
+ codeFieldName: "CODNAT",
7797
+ showInactives: false
7798
+ }
7799
+ }
7800
+ }
7801
+ },
7802
+ {
7803
+ id: "DTNEG",
7804
+ visible: false,
7805
+ type: filterItemType_enum.FilterItemType.PERIOD,
7806
+ label: "Dt. Negociação",
7807
+ detailTitle: "Informe a data ou período",
7808
+ props: {
7809
+ expression: {
7810
+ fullfill: "onlydate(this.DTNEG) >= :DTNEG.START AND onlydate(this.DTNEG) <= :DTNEG.END",
7811
+ onlystart: "onlydate(this.DTNEG) >= :DTNEG",
7812
+ onlyend: "onlydate(this.DTNEG) <= :DTNEG"
7813
+ }
7814
+ }
7815
+ },
7816
+ {
7817
+ id: "NUNOTA",
7818
+ visible: false,
7819
+ type: filterItemType_enum.FilterItemType.NUMBER,
7820
+ label: "Nro Único do Pedido",
7821
+ detailTitle: "Informe o número único do pedido",
7822
+ props: {
7823
+ expression: "this.NUNOTA = :NUNOTA"
7824
+ }
7825
+ },
7826
+ {
7827
+ id: "CODCENCUS",
7828
+ visible: false,
7829
+ type: filterItemType_enum.FilterItemType.SEARCH,
7830
+ label: "Centro de resultado",
7831
+ detailTitle: "Informe o centro de resultado",
7832
+ props: {
7833
+ expression: "this.CODCENCUS = :CODCENCUS",
7834
+ searchContext: {
7835
+ entity: "CentroResultado",
7836
+ entityDescription: "Centro de resultado",
7837
+ searchOptions: {
7838
+ rootEntity: "Financeiro",
7839
+ descriptionFieldName: "DESCRCENCUS",
7840
+ codeFieldName: "CODCENCUS",
7841
+ showInactives: false
7842
+ }
7843
+ }
7844
+ }
7845
+ },
7846
+ {
7847
+ id: "CODCTABCOINT",
7848
+ visible: false,
7849
+ type: filterItemType_enum.FilterItemType.SEARCH,
7850
+ label: "Conta bancária",
7851
+ detailTitle: "Informe a conta bancária",
7852
+ props: {
7853
+ expression: "this.CODCTABCOINT = :CODCTABCOINT",
7854
+ searchContext: {
7855
+ entity: "ContaBancaria",
7856
+ entityDescription: "Conta bancária",
7857
+ searchOptions: {
7858
+ rootEntity: "Financeiro",
7859
+ descriptionFieldName: "DESCRICAO",
7860
+ codeFieldName: "CODCTABCOINT",
7861
+ showInactives: false
7862
+ }
7863
+ }
7864
+ }
7865
+ },
7866
+ {
7867
+ id: "CODBCO",
7868
+ visible: false,
7869
+ type: filterItemType_enum.FilterItemType.SEARCH,
7870
+ label: "Banco",
7871
+ detailTitle: "Informe o banco",
7872
+ props: {
7873
+ expression: "this.CODBCO = :CODBCO",
7874
+ searchContext: {
7875
+ entity: "Banco",
7876
+ entityDescription: "Banco",
7877
+ searchOptions: {
7878
+ rootEntity: "Financeiro",
7879
+ descriptionFieldName: "NOMEBCO",
7880
+ codeFieldName: "CODBCO",
7881
+ showInactives: false
7882
+ }
7883
+ }
7884
+ }
7885
+ },
7886
+ {
7887
+ id: "CODPROJ",
7888
+ visible: false,
7889
+ type: filterItemType_enum.FilterItemType.SEARCH,
7890
+ label: "Projeto",
7891
+ detailTitle: "Informe o projeto",
7892
+ props: {
7893
+ expression: "this.CODPROJ = :CODPROJ",
7894
+ searchContext: {
7895
+ entity: "Projeto",
7896
+ entityDescription: "Projeto",
7897
+ searchOptions: {
7898
+ rootEntity: "Financeiro",
7899
+ descriptionFieldName: "IDENTIFICACAO",
7900
+ codeFieldName: "CODPROJ",
7901
+ showInactives: false
7902
+ }
7903
+ }
7904
+ }
7905
+ }
7906
+ ];
7907
+ }
7908
+
7251
7909
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
7252
7910
 
7253
7911
  const SnkApplication = class {
7254
7912
  constructor(hostRef) {
7255
- index.registerInstance(this, hostRef);
7256
- this.applicationLoaded = index.createEvent(this, "applicationLoaded", 7);
7257
- this.applicationLoading = index.createEvent(this, "applicationLoading", 7);
7913
+ index$2.registerInstance(this, hostRef);
7914
+ this.applicationLoaded = index$2.createEvent(this, "applicationLoaded", 7);
7915
+ this.applicationLoading = index$2.createEvent(this, "applicationLoading", 7);
7916
+ this._authPromises = [];
7917
+ this._duCache = new Map();
7918
+ this._duPromises = new Map();
7258
7919
  this._requestListener = new RequestListenerLoadingBar();
7259
7920
  }
7260
7921
  get parameters() {
@@ -7273,18 +7934,31 @@ const SnkApplication = class {
7273
7934
  return this._resourceID;
7274
7935
  }
7275
7936
  get auth() {
7276
- return new Promise((resolve, reject) => {
7277
- if (this._auth) {
7278
- resolve(this._auth);
7279
- }
7280
- else {
7281
- this.authFetcher.getData(this._resourceID).then((authList) => {
7282
- this._auth = authList;
7283
- resolve(authList);
7284
- }).catch(error => reject(error));
7285
- }
7286
- });
7937
+ if (this._auth) {
7938
+ return Promise.resolve(this._auth);
7939
+ }
7940
+ else {
7941
+ return new Promise((resolve, reject) => {
7942
+ const waitingAuth = this._authPromises.length > 0;
7943
+ this._authPromises.push(new PendingPromise(resolve, reject));
7944
+ if (!waitingAuth) {
7945
+ this.authFetcher.getData(this.resourceID).then((authList) => {
7946
+ this._auth = authList;
7947
+ while (this._authPromises.length > 0) {
7948
+ this._authPromises.pop().resolve(this._auth);
7949
+ }
7950
+ }).catch(error => {
7951
+ while (this._authPromises.length > 0) {
7952
+ this._authPromises.pop().reject(error);
7953
+ }
7954
+ });
7955
+ }
7956
+ });
7957
+ }
7287
7958
  }
7959
+ /**
7960
+ * Caso o usuário logado seja o SUP.
7961
+ */
7288
7962
  async isUserSup() {
7289
7963
  return new Promise((resolve, reject) => {
7290
7964
  this.auth.then((authorization) => {
@@ -7294,6 +7968,9 @@ const SnkApplication = class {
7294
7968
  });
7295
7969
  });
7296
7970
  }
7971
+ /**
7972
+ * Se o usuário logado tem permissão pra determinada ação.
7973
+ */
7297
7974
  async hasAccess(access) {
7298
7975
  return new Promise((resolve, reject) => {
7299
7976
  this.auth.then((authorization) => {
@@ -7303,6 +7980,9 @@ const SnkApplication = class {
7303
7980
  });
7304
7981
  });
7305
7982
  }
7983
+ /**
7984
+ * Retorna todos os acessos do usuário logado.
7985
+ */
7306
7986
  async getAllAccess() {
7307
7987
  return new Promise((resolve, reject) => {
7308
7988
  this.auth.then((authorization) => {
@@ -7317,34 +7997,54 @@ const SnkApplication = class {
7317
7997
  });
7318
7998
  });
7319
7999
  }
7320
- async getAuthList(_auth) {
7321
- return await (new MGEAuthorization()).parseFromJSON(_auth);
7322
- }
8000
+ /**
8001
+ * Retorna o valor de um parâmetro do tipo string.
8002
+ */
7323
8003
  async getStringParam(name) {
7324
8004
  return this.parameters.asString(name, this.resourceID);
7325
8005
  }
8006
+ /**
8007
+ * Retorna o valor de um parâmetro do tipo Inteiro.
8008
+ */
7326
8009
  async getIntParam(name) {
7327
8010
  return this.parameters.asInteger(name, this.resourceID);
7328
8011
  }
8012
+ /**
8013
+ * Retorna o valor de um parâmetro do tipo Decimal.
8014
+ */
7329
8015
  async getFloatParam(name) {
7330
8016
  return this.parameters.asFloat(name, this.resourceID);
7331
8017
  }
8018
+ /**
8019
+ * Retorna o valor de um parâmetro do tipo booleano.
8020
+ */
7332
8021
  async getBooleanParam(name) {
7333
8022
  return this.parameters.asBoolean(name, this.resourceID);
7334
8023
  }
8024
+ /**
8025
+ * Retorna o valor de um parâmetro do tipo data.
8026
+ */
7335
8027
  async getDateParam(name) {
7336
8028
  return this.parameters.asDate(name, this.resourceID);
7337
8029
  }
8030
+ /**
8031
+ * Mostra o conteúdo passado em um Popup
8032
+ */
7338
8033
  async showPopUp(content) {
8034
+ this.clearPopUpContent();
7339
8035
  this._popUp.appendChild(content);
7340
- this._popUp["opened"] = true;
8036
+ this._popUp.opened = true;
7341
8037
  }
8038
+ /**
8039
+ * Fecha o popup, liberando o conteúdo.
8040
+ */
7342
8041
  async closePopUp() {
7343
- Array.from(this._popUp.children).forEach(c => {
7344
- this._popUp.removeChild(c);
7345
- });
7346
- this._popUp["opened"] = false;
8042
+ this.clearPopUpContent();
8043
+ this._popUp.opened = false;
7347
8044
  }
8045
+ /**
8046
+ * Verifica se a licença do cliente tem determinado opcional (produto)
8047
+ */
7348
8048
  async temOpcional(opcional) {
7349
8049
  const opts = opcional.split(",");
7350
8050
  return new Promise((resolve, reject) => {
@@ -7368,6 +8068,10 @@ const SnkApplication = class {
7368
8068
  });
7369
8069
  });
7370
8070
  }
8071
+ /**
8072
+ * Retorna a configuração de um recurso por service broker
8073
+ * Veja também o método "loadConfig"
8074
+ */
7371
8075
  async getConfig(key) {
7372
8076
  let payload = {
7373
8077
  "serviceName": "SystemUtilsSP.getConf",
@@ -7385,6 +8089,9 @@ const SnkApplication = class {
7385
8089
  .catch(error => reject(error));
7386
8090
  });
7387
8091
  }
8092
+ /**
8093
+ * Salva a configuração de determinado recurso.
8094
+ */
7388
8095
  async saveConfig(key, data) {
7389
8096
  let payload = {
7390
8097
  "serviceName": "SystemUtilsSP.saveConf",
@@ -7403,42 +8110,146 @@ const SnkApplication = class {
7403
8110
  .catch(error => reject(error));
7404
8111
  });
7405
8112
  }
8113
+ /**
8114
+ * Acessa informações de contexto "empurrados" na abertura da tela
8115
+ */
7406
8116
  async getAttributeFromHTMLWrapper(attribName) {
7407
8117
  return Promise.resolve(window[attribName]);
7408
8118
  }
8119
+ /**
8120
+ * Abre determinada tela, repassando pkObject
8121
+ */
7409
8122
  async openApp(resourceId, pkObject) {
7410
8123
  Workspace.openAppActivity(resourceId, pkObject);
7411
8124
  }
7412
- async createDataunit(entityName) {
7413
- return new Promise(resolve => {
7414
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7415
- dataUnit.loadMetadata().then(() => resolve(dataUnit));
8125
+ getDuPromissesStack(dataUnitName) {
8126
+ let stack;
8127
+ if (dataUnitName) {
8128
+ stack = this._duPromises.get(dataUnitName);
8129
+ if (!stack) {
8130
+ stack = [];
8131
+ this._duPromises.set(dataUnitName, stack);
8132
+ }
8133
+ }
8134
+ return stack || [];
8135
+ }
8136
+ /**
8137
+ * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
8138
+ * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado
8139
+ */
8140
+ async createDataunit(entityName, dataUnitName) {
8141
+ return new Promise((resolve, reject) => {
8142
+ const duPromisses = this.getDuPromissesStack(dataUnitName);
8143
+ const waitingDu = duPromisses.length > 0;
8144
+ duPromisses.push(new PendingPromise(resolve, reject));
8145
+ if (!waitingDu) {
8146
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
8147
+ dataUnit.loadMetadata().then(() => {
8148
+ if (dataUnitName) {
8149
+ this._duCache.set(dataUnitName, dataUnit);
8150
+ }
8151
+ while (duPromisses.length > 0) {
8152
+ duPromisses.pop().resolve(dataUnit);
8153
+ }
8154
+ }).catch(reason => {
8155
+ while (duPromisses.length > 0) {
8156
+ duPromisses.pop().reject(reason);
8157
+ }
8158
+ });
8159
+ }
8160
+ });
8161
+ }
8162
+ /**
8163
+ * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
8164
+ */
8165
+ async getDataUnit(entityName, dataUnitName) {
8166
+ return new Promise((resolve, reject) => {
8167
+ const dataUnit = this._duCache.get(dataUnitName);
8168
+ if (dataUnit) {
8169
+ resolve(dataUnit);
8170
+ }
8171
+ else {
8172
+ this.createDataunit(entityName, dataUnitName).then(dataUnit => {
8173
+ resolve(dataUnit);
8174
+ }).catch(reason => reject(reason));
8175
+ }
7416
8176
  });
7417
8177
  }
8178
+ /**
8179
+ * Retorna o resourceID da tela em questão.
8180
+ */
7418
8181
  async getResourceID() {
7419
8182
  return Promise.resolve(this.resourceID);
7420
8183
  }
8184
+ /**
8185
+ * Mostra o diálogo de alerta de acordo com os parâmetros passados.
8186
+ */
7421
8187
  async alert(title, message, icon, options) {
7422
- return utils.ApplicationUtils.alert(title, message, icon, options);
8188
+ return SnkMessageBuilder.ApplicationUtils.alert(title, message, icon, options);
7423
8189
  }
8190
+ /**
8191
+ * Mostra o diálogo de erro de acordo com os parâmetros passados.
8192
+ */
7424
8193
  async error(title, message, icon, options) {
7425
- return utils.ApplicationUtils.error(title, message, icon, options);
8194
+ return SnkMessageBuilder.ApplicationUtils.error(title, message, icon, options);
8195
+ }
8196
+ /**
8197
+ * Mostra o diálogo de sucesso de acordo com os parâmetros passados.
8198
+ */
8199
+ async success(title, message, icon, options) {
8200
+ return SnkMessageBuilder.ApplicationUtils.success(title, message, icon, options);
8201
+ }
8202
+ /**
8203
+ * Exibe um diálogo de mensagem comum
8204
+ */
8205
+ async message(title, message, icon, options) {
8206
+ return SnkMessageBuilder.ApplicationUtils.message(title, message, icon, options);
7426
8207
  }
7427
- async confirm(title, message, icon, critical, options) {
7428
- return utils.ApplicationUtils.confirm(title, message, icon, critical, options);
8208
+ /**
8209
+ * Exibe um diálogo de confirmação
8210
+ */
8211
+ async confirm(title, message, icon, dialogType, options) {
8212
+ return SnkMessageBuilder.ApplicationUtils.confirm(title, message, icon, dialogType, options);
7429
8213
  }
8214
+ /**
8215
+ * Mostra uma informação efêmera (de segundo plano).
8216
+ */
7430
8217
  async info(message, options) {
7431
- return utils.ApplicationUtils.info(message, options);
8218
+ return SnkMessageBuilder.ApplicationUtils.info(message, options);
7432
8219
  }
8220
+ /**
8221
+ * Busca a configuração de formulário.
8222
+ */
7433
8223
  async loadFormConfig(name) {
7434
8224
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7435
8225
  }
7436
- async loadGridConfig() {
7437
- return this.gridConfigFetcher.getConfig(this.resourceID);
8226
+ /**
8227
+ * Busca a configuração de grade.
8228
+ */
8229
+ async loadGridConfig(name) {
8230
+ return this.gridConfigFetcher.getConfig(name, this.resourceID);
8231
+ }
8232
+ /**
8233
+ * Busca os totalizadores da grade.
8234
+ */
8235
+ async loadTotals(name, resourceID, filters) {
8236
+ return this.totalsFetcher.fetchTotals(name, resourceID, filters);
7438
8237
  }
8238
+ /**
8239
+ * Salva a configuração de grade.
8240
+ */
7439
8241
  async saveGridConfig(config) {
7440
8242
  return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7441
8243
  }
8244
+ /**
8245
+ * Obtém as configurações da barra de filtros
8246
+ */
8247
+ async getFilterBarConfig() {
8248
+ return this.filterBarConfigFetcher.getConfig(this.resourceID);
8249
+ }
8250
+ async getAuthList(_auth) {
8251
+ return await (new MGEAuthorization()).parseFromJSON(_auth);
8252
+ }
7442
8253
  get urlParams() {
7443
8254
  if (!this._urlParams) {
7444
8255
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -7463,6 +8274,12 @@ const SnkApplication = class {
7463
8274
  }
7464
8275
  return this._gridConfigFetcher;
7465
8276
  }
8277
+ get totalsFetcher() {
8278
+ if (!this._totalsFetcher) {
8279
+ this._totalsFetcher = new TotalsFetcher();
8280
+ }
8281
+ return this._totalsFetcher;
8282
+ }
7466
8283
  get pesquisaFetcher() {
7467
8284
  if (!this._pesquisaFetcher) {
7468
8285
  this._pesquisaFetcher = new PesquisaFetcher();
@@ -7475,9 +8292,17 @@ const SnkApplication = class {
7475
8292
  }
7476
8293
  return this._authFetcher;
7477
8294
  }
8295
+ get filterBarConfigFetcher() {
8296
+ if (!this._filterBarConfigFetcher) {
8297
+ this._filterBarConfigFetcher = new FilterBarConfigFetcher();
8298
+ }
8299
+ return this._filterBarConfigFetcher;
8300
+ }
7478
8301
  async executeSearch(searchArgument, fieldName, dataUnit) {
7479
8302
  const descriptor = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(fieldName);
7480
- if (!descriptor) ;
8303
+ if (!descriptor) {
8304
+ //TODO: Implementar mensagem de erro
8305
+ }
7481
8306
  else {
7482
8307
  const { mode, argument } = searchArgument;
7483
8308
  const { ENTITYNAME, CODEFIELD, DESCRIPTIONFIELD, ROOTENTITY, DESCRIPTIONENTITY } = descriptor.properties;
@@ -7491,13 +8316,13 @@ const SnkApplication = class {
7491
8316
  };
7492
8317
  dependencies === null || dependencies === void 0 ? void 0 : dependencies.filter(dep => { var _a; return (_a = dep.masterFields) === null || _a === void 0 ? void 0 : _a.every(f => { var _a; return (_a = dataUnit.getField(f)) === null || _a === void 0 ? void 0 : _a.visible; }); }).forEach(dependency => {
7493
8318
  var _a;
7494
- if (dependency.type === UnitMetadata.DependencyType.SEARCHING) {
8319
+ if (dependency.type === index$1.DependencyType.SEARCHING) {
7495
8320
  if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
7496
8321
  criteria = {
7497
8322
  expression: dependency.expression,
7498
8323
  params: dependency.masterFields.map(fieldName => {
7499
8324
  const masterDescriptor = dataUnit.getField(fieldName);
7500
- const dataType = (masterDescriptor === null || masterDescriptor === void 0 ? void 0 : masterDescriptor.dataType) || core.DataType.TEXT;
8325
+ const dataType = (masterDescriptor === null || masterDescriptor === void 0 ? void 0 : masterDescriptor.dataType) || index$1.DataType.TEXT;
7501
8326
  const value = dataUnit.getFieldValue(fieldName);
7502
8327
  if (value == undefined) {
7503
8328
  this.alert("Erro ao pesquisar", `É necessario informar o campo ${masterDescriptor.label} para executar a pesquisa.`);
@@ -7509,23 +8334,27 @@ const SnkApplication = class {
7509
8334
  }
7510
8335
  }
7511
8336
  });
7512
- if (mode === "ADVANCED") {
7513
- return new Promise(accept => {
7514
- const pesquisaContent = document.createElement("snk-pesquisa");
7515
- pesquisaContent.argument = argument;
7516
- pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
7517
- pesquisaContent.selectItem = (option) => {
7518
- accept(option);
7519
- this.cleanPopUpTitle();
7520
- this.closePopUp();
7521
- };
7522
- this.setPopUpTitle(DESCRIPTIONENTITY);
7523
- this.showPopUp(pesquisaContent);
7524
- });
7525
- }
7526
- else {
7527
- return this.pesquisaFetcher.loadSearchOptions(ENTITYNAME, argument, criteria, searchOptions);
7528
- }
8337
+ return this.executePreparedSearch(mode, argument, { entity: ENTITYNAME, entityDescription: DESCRIPTIONENTITY, criteria, searchOptions });
8338
+ }
8339
+ }
8340
+ async executePreparedSearch(mode, argument, options) {
8341
+ const { entity, entityDescription, criteria, searchOptions } = options;
8342
+ if (mode === "ADVANCED") {
8343
+ return new Promise(accept => {
8344
+ const pesquisaContent = document.createElement("snk-pesquisa");
8345
+ pesquisaContent.argument = argument;
8346
+ pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
8347
+ pesquisaContent.selectItem = (option) => {
8348
+ accept(option);
8349
+ this.clearPopUpTitle();
8350
+ this.closePopUp();
8351
+ };
8352
+ this.setPopUpTitle(entityDescription);
8353
+ this.showPopUp(pesquisaContent);
8354
+ });
8355
+ }
8356
+ else {
8357
+ return this.pesquisaFetcher.loadSearchOptions(entity, argument, criteria, searchOptions);
7529
8358
  }
7530
8359
  }
7531
8360
  async isDebugMode() {
@@ -7533,22 +8362,31 @@ const SnkApplication = class {
7533
8362
  accept(window['isDebugMode']);
7534
8363
  });
7535
8364
  }
7536
- cleanPopUpTitle() {
7537
- this._popUp['ezTitle'] = "";
8365
+ clearPopUpContent() {
8366
+ if (this._popUp) {
8367
+ Array.from(this._popUp.children).forEach(c => {
8368
+ this._popUp.removeChild(c);
8369
+ });
8370
+ }
8371
+ }
8372
+ clearPopUpTitle() {
8373
+ this._popUp.ezTitle = "";
7538
8374
  }
7539
8375
  setPopUpTitle(title) {
7540
- this._popUp['ezTitle'] = title;
8376
+ this._popUp.ezTitle = title;
7541
8377
  }
7542
8378
  componentWillLoad() {
7543
8379
  this._errorHandler = new SnkErrorHandler(this);
7544
- core.ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
7545
- core.ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
8380
+ this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder();
8381
+ index$1.ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
8382
+ index$1.ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
7546
8383
  return this.executeSearch(searchArgument, fieldName, dataUnit);
7547
8384
  });
7548
- core.ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
7549
- core.ErrorTracking.init();
8385
+ index$1.ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
8386
+ index$1.ErrorTracking.init();
7550
8387
  }
7551
8388
  connectedCallback() {
8389
+ index$1.ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
7552
8390
  DataFetcher.addRequestListener(this._requestListener);
7553
8391
  }
7554
8392
  disconnectedCallback() {
@@ -7561,23 +8399,30 @@ const SnkApplication = class {
7561
8399
  });
7562
8400
  }
7563
8401
  render() {
7564
- return (index.h("div", null, index.h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), index.h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() })));
8402
+ return (index$2.h("div", null, index$2.h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), index$2.h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() })));
7565
8403
  }
7566
8404
  };
7567
8405
  class RequestListenerLoadingBar {
7568
8406
  constructor() {
7569
8407
  this._debounceTime = 1000;
8408
+ this._ignoredNameTypes = ["totals"];
7570
8409
  this._countRequest = 0;
7571
8410
  }
7572
- onRequestStart() {
7573
- this.loadingBar.show();
8411
+ onRequestStart(param) {
8412
+ if (this.isIgnoreLoadingOnRequest(param)) {
8413
+ return;
8414
+ }
7574
8415
  this._countRequest++;
8416
+ this.loadingBar.show();
7575
8417
  if (this._timerLoading) {
7576
8418
  clearTimeout(this._timerLoading);
7577
8419
  }
7578
8420
  }
7579
8421
  ;
7580
- onRequestEnd() {
8422
+ onRequestEnd(param) {
8423
+ if (this.isIgnoreLoadingOnRequest(param)) {
8424
+ return;
8425
+ }
7581
8426
  this._countRequest--;
7582
8427
  this._timerLoading = setTimeout(() => {
7583
8428
  if (this._countRequest <= 0) {
@@ -7586,6 +8431,25 @@ class RequestListenerLoadingBar {
7586
8431
  }, this._debounceTime);
7587
8432
  }
7588
8433
  ;
8434
+ isIgnoreLoadingOnRequest(param) {
8435
+ var _a;
8436
+ if (((_a = param === null || param === void 0 ? void 0 : param.requestBody) === null || _a === void 0 ? void 0 : _a.length) == 1) {
8437
+ const { name } = param.requestBody[0].variables;
8438
+ if (name) {
8439
+ const nameParts = name.split(":");
8440
+ const nameType = nameParts[0];
8441
+ return this._ignoredNameTypes.indexOf(nameType) >= 0;
8442
+ }
8443
+ }
8444
+ return false;
8445
+ }
8446
+ ;
8447
+ }
8448
+ class PendingPromise {
8449
+ constructor(resolve, reject) {
8450
+ this.resolve = resolve;
8451
+ this.reject = reject;
8452
+ }
7589
8453
  }
7590
8454
  SnkApplication.style = snkApplicationCss;
7591
8455