@sankhyalabs/sankhyablocks 1.3.34 → 1.4.0-beta.1

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 (216) 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 +720 -168
  12. package/dist/cjs/snk-crud.cjs.entry.js +70 -0
  13. package/dist/cjs/snk-data-unit.cjs.entry.js +280 -0
  14. package/dist/cjs/snk-filter-bar.cjs.entry.js +278 -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 +154 -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 +37 -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 +5 -5
  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 +1126 -621
  34. package/dist/collection/components/snk-crud/snk-crud.css +6 -0
  35. package/dist/collection/components/snk-crud/snk-crud.js +203 -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 +544 -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 +78 -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 +255 -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 +353 -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 +205 -0
  54. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -79
  55. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +86 -0
  56. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
  57. package/dist/collection/components/snk-taskbar/snk-taskbar.css +3 -0
  58. package/dist/collection/components/snk-taskbar/snk-taskbar.js +307 -0
  59. package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
  60. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +37 -12
  61. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +52 -21
  62. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +54 -0
  63. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +4 -3
  64. package/dist/collection/lib/http/data-fetcher/fetchers/totals-fetcher.js +47 -0
  65. package/dist/collection/lib/index.js +1 -0
  66. package/dist/collection/lib/message/SnkMessageBuilder.js +121 -0
  67. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +23 -0
  68. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +18 -0
  69. package/dist/collection/lib/message/resources/snk-form.msg.js +10 -0
  70. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +17 -0
  71. package/dist/components/SnkMessageBuilder.js +303 -0
  72. package/dist/components/filter-item-type.enum.js +12 -0
  73. package/dist/components/index.d.ts +18 -5
  74. package/dist/components/index.js +22 -0
  75. package/dist/components/index2.js +2384 -0
  76. package/dist/components/snk-application2.js +700 -139
  77. package/dist/components/snk-crud.d.ts +11 -0
  78. package/dist/components/snk-crud.js +133 -0
  79. package/dist/components/snk-data-unit.d.ts +11 -0
  80. package/dist/components/snk-data-unit.js +303 -0
  81. package/dist/components/snk-filter-bar.d.ts +11 -0
  82. package/dist/components/snk-filter-bar.js +6 -0
  83. package/dist/components/snk-filter-bar2.js +310 -0
  84. package/dist/components/snk-filter-binary-select.d.ts +11 -0
  85. package/dist/components/snk-filter-binary-select.js +63 -0
  86. package/dist/components/snk-filter-detail.d.ts +11 -0
  87. package/dist/components/snk-filter-detail.js +6 -0
  88. package/dist/components/snk-filter-detail2.js +63 -0
  89. package/dist/components/snk-filter-item.d.ts +11 -0
  90. package/dist/components/snk-filter-item.js +6 -0
  91. package/dist/components/snk-filter-item2.js +175 -0
  92. package/dist/components/snk-filter-list.d.ts +11 -0
  93. package/dist/components/snk-filter-list.js +6 -0
  94. package/dist/components/snk-filter-list2.js +111 -0
  95. package/dist/components/snk-filter-multi-select.d.ts +11 -0
  96. package/dist/components/snk-filter-multi-select.js +39 -0
  97. package/dist/components/snk-filter-number.d.ts +11 -0
  98. package/dist/components/snk-filter-number.js +40 -0
  99. package/dist/components/snk-filter-period.d.ts +11 -0
  100. package/dist/components/snk-filter-period.js +53 -0
  101. package/dist/components/snk-filter-search.d.ts +11 -0
  102. package/dist/components/snk-filter-search.js +62 -0
  103. package/dist/components/snk-filter-text.d.ts +11 -0
  104. package/dist/components/snk-filter-text.js +38 -0
  105. package/dist/components/snk-form.d.ts +11 -0
  106. package/dist/components/snk-form.js +6 -0
  107. package/dist/components/snk-form2.js +159 -0
  108. package/dist/components/snk-grid.d.ts +11 -0
  109. package/dist/components/snk-grid.js +6 -0
  110. package/dist/components/snk-grid2.js +127 -0
  111. package/dist/components/snk-pesquisa2.js +1 -1
  112. package/dist/components/snk-taskbar.d.ts +11 -0
  113. package/dist/components/snk-taskbar.js +6 -0
  114. package/dist/components/snk-taskbar2.js +264 -0
  115. package/dist/components/taskbar-processor.js +45 -0
  116. package/dist/components/teste-pesquisa.js +1 -1
  117. package/dist/esm/SnkMessageBuilder-a7da466b.js +303 -0
  118. package/dist/esm/app-globals-0f993ce5.js +3 -0
  119. package/dist/esm/css-shim-b3f2ee8d.js +4 -0
  120. package/dist/esm/dom-665d6011.js +73 -0
  121. package/dist/esm/filter-item-type.enum-61fbf80a.js +12 -0
  122. package/dist/esm/index-2b4d2d14.js +3262 -0
  123. package/dist/esm/index-f1d3e4da.js +2384 -0
  124. package/dist/esm/loader.js +19 -3
  125. package/dist/esm/polyfills/css-shim.js +1 -1
  126. package/dist/esm/sankhyablocks.js +117 -5
  127. package/dist/esm/shadow-css-b18e99d7.js +387 -0
  128. package/dist/esm/snk-application.entry.js +692 -140
  129. package/dist/esm/snk-crud.entry.js +66 -0
  130. package/dist/esm/snk-data-unit.entry.js +276 -0
  131. package/dist/esm/snk-filter-bar.entry.js +274 -0
  132. package/dist/esm/snk-filter-binary-select.entry.js +43 -0
  133. package/dist/esm/snk-filter-detail.entry.js +45 -0
  134. package/dist/esm/snk-filter-item.entry.js +150 -0
  135. package/dist/esm/snk-filter-list.entry.js +87 -0
  136. package/dist/esm/snk-filter-multi-select.entry.js +19 -0
  137. package/dist/esm/snk-filter-number.entry.js +20 -0
  138. package/dist/esm/snk-filter-period.entry.js +33 -0
  139. package/dist/esm/snk-filter-search.entry.js +40 -0
  140. package/dist/esm/snk-filter-text.entry.js +18 -0
  141. package/dist/esm/snk-form.entry.js +129 -0
  142. package/dist/esm/snk-grid.entry.js +75 -0
  143. package/dist/esm/snk-pesquisa.entry.js +2 -2
  144. package/dist/esm/snk-taskbar.entry.js +156 -0
  145. package/dist/esm/taskbar-elements-35d64ff9.js +90 -0
  146. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  147. package/dist/esm/teste-pesquisa.entry.js +2 -2
  148. package/dist/sankhyablocks/SnkMessageBuilder-a7da466b.js +303 -0
  149. package/dist/sankhyablocks/app-globals-0f993ce5.js +3 -0
  150. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +4 -0
  151. package/dist/sankhyablocks/dom-665d6011.js +73 -0
  152. package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +12 -0
  153. package/dist/sankhyablocks/index-2b4d2d14.js +3262 -0
  154. package/dist/sankhyablocks/index-f1d3e4da.js +2384 -0
  155. package/dist/sankhyablocks/index.esm.js +1 -0
  156. package/dist/sankhyablocks/sankhyablocks.esm.js +129 -1
  157. package/dist/sankhyablocks/shadow-css-b18e99d7.js +387 -0
  158. package/dist/sankhyablocks/snk-application.entry.js +8148 -0
  159. package/dist/sankhyablocks/snk-crud.entry.js +66 -0
  160. package/dist/sankhyablocks/snk-data-unit.entry.js +276 -0
  161. package/dist/sankhyablocks/snk-filter-bar.entry.js +274 -0
  162. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +43 -0
  163. package/dist/sankhyablocks/snk-filter-detail.entry.js +45 -0
  164. package/dist/sankhyablocks/snk-filter-item.entry.js +150 -0
  165. package/dist/sankhyablocks/snk-filter-list.entry.js +87 -0
  166. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +19 -0
  167. package/dist/sankhyablocks/snk-filter-number.entry.js +20 -0
  168. package/dist/sankhyablocks/snk-filter-period.entry.js +33 -0
  169. package/dist/sankhyablocks/snk-filter-search.entry.js +40 -0
  170. package/dist/sankhyablocks/snk-filter-text.entry.js +18 -0
  171. package/dist/sankhyablocks/snk-form.entry.js +129 -0
  172. package/dist/sankhyablocks/snk-grid.entry.js +75 -0
  173. package/dist/sankhyablocks/snk-pesquisa.entry.js +311 -0
  174. package/dist/sankhyablocks/snk-taskbar.entry.js +156 -0
  175. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +90 -0
  176. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +45 -0
  177. package/dist/sankhyablocks/teste-pesquisa.entry.js +33 -0
  178. package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
  179. package/dist/types/components/snk-application/snk-application.d.ts +145 -15
  180. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
  181. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +7 -0
  182. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +7 -0
  183. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +14 -0
  184. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +12 -0
  185. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +7 -0
  186. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +9 -0
  187. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +14 -0
  188. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +40 -0
  189. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +51 -0
  190. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +29 -0
  191. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
  192. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +84 -0
  193. package/dist/types/components.d.ts +696 -8
  194. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -6
  195. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
  196. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +6 -0
  197. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
  198. package/dist/types/lib/http/data-fetcher/fetchers/totals-fetcher.d.ts +8 -0
  199. package/dist/types/lib/index.d.ts +1 -0
  200. package/dist/types/lib/message/SnkMessageBuilder.d.ts +42 -0
  201. package/dist/types/lib/message/resources/snk-data-unit.msg.d.ts +2 -0
  202. package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
  203. package/dist/types/lib/message/resources/snk-form.msg.d.ts +2 -0
  204. package/dist/types/lib/message/resources/snk-taskbar.msg.d.ts +2 -0
  205. package/dist/types/stencil-public-runtime.d.ts +15 -4
  206. package/loader/package.json +1 -0
  207. package/package.json +5 -5
  208. package/react/components.d.ts +0 -2
  209. package/react/components.js +0 -2
  210. package/react/components.js.map +1 -1
  211. package/dist/cjs/index-1133bc2a.js +0 -1235
  212. package/dist/esm/index-ffda6382.js +0 -1208
  213. package/dist/sankhyablocks/p-2a7b4cb3.entry.js +0 -1
  214. package/dist/sankhyablocks/p-9520d78a.entry.js +0 -1
  215. package/dist/sankhyablocks/p-98e8490d.entry.js +0 -69
  216. package/dist/sankhyablocks/p-edcb9d8e.js +0 -2
@@ -1,21 +1,47 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { ErrorException, StringUtils, DataUnit, DataType, ChangeOperation, DateUtils, ObjectUtils, WaitingChangeException, WarningException, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
3
- import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { DependencyType } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
2
+ import { E as ErrorException, W as WarningException, S as StringUtils, D as DataUnit, b as DataType, C as ChangeOperation, c as DateUtils, O as ObjectUtils, d as WaitingChangeException, e as DependencyType, A as ApplicationContext, f as ErrorTracking } from './index2.js';
3
+ import { A as ApplicationUtils, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
5
4
  import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
6
5
 
7
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
7
 
8
+ function getDefaultExportFromCjs (x) {
9
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
10
+ }
11
+
9
12
  function createCommonjsModule(fn, basedir, module) {
10
13
  return module = {
11
14
  path: basedir,
12
15
  exports: {},
13
16
  require: function (path, base) {
14
- return commonjsRequire();
17
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
15
18
  }
16
19
  }, fn(module, module.exports), module.exports;
17
20
  }
18
21
 
22
+ function getDefaultExportFromNamespaceIfPresent (n) {
23
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
24
+ }
25
+
26
+ function getDefaultExportFromNamespaceIfNotNamed (n) {
27
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
28
+ }
29
+
30
+ function getAugmentedNamespace(n) {
31
+ if (n.__esModule) return n;
32
+ var a = Object.defineProperty({}, '__esModule', {value: true});
33
+ Object.keys(n).forEach(function (k) {
34
+ var d = Object.getOwnPropertyDescriptor(n, k);
35
+ Object.defineProperty(a, k, d.get ? d : {
36
+ enumerable: true,
37
+ get: function () {
38
+ return n[k];
39
+ }
40
+ });
41
+ });
42
+ return a;
43
+ }
44
+
19
45
  function commonjsRequire () {
20
46
  throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
21
47
  }
@@ -32,7 +58,7 @@ return new F();
32
58
  })();
33
59
  (function(self) {
34
60
 
35
- ((function (exports) {
61
+ var irrelevant = (function (exports) {
36
62
 
37
63
  var support = {
38
64
  searchParams: 'URLSearchParams' in self,
@@ -560,7 +586,7 @@ return new F();
560
586
 
561
587
  return exports;
562
588
 
563
- }))({});
589
+ })({});
564
590
  })(__self__);
565
591
  __self__.fetch.ponyfill = true;
566
592
  // Remove "polyfill" property added by whatwg-fetch
@@ -577,7 +603,10 @@ exports.Response = ctx.Response;
577
603
  module.exports = exports;
578
604
  });
579
605
 
606
+ const browserPonyfill$1 = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill);
607
+
580
608
  var isObjectLike_1 = createCommonjsModule(function (module, exports) {
609
+ 'use strict';
581
610
 
582
611
  Object.defineProperty(exports, '__esModule', {
583
612
  value: true,
@@ -593,7 +622,10 @@ function isObjectLike(value) {
593
622
  }
594
623
  });
595
624
 
625
+ const isObjectLike = /*@__PURE__*/getDefaultExportFromCjs(isObjectLike_1);
626
+
596
627
  var invariant_1 = createCommonjsModule(function (module, exports) {
628
+ 'use strict';
597
629
 
598
630
  Object.defineProperty(exports, '__esModule', {
599
631
  value: true,
@@ -611,7 +643,10 @@ function invariant(condition, message) {
611
643
  }
612
644
  });
613
645
 
646
+ const invariant = /*@__PURE__*/getDefaultExportFromCjs(invariant_1);
647
+
614
648
  var location_1 = createCommonjsModule(function (module, exports) {
649
+ 'use strict';
615
650
 
616
651
  Object.defineProperty(exports, '__esModule', {
617
652
  value: true,
@@ -651,7 +686,10 @@ function getLocation(source, position) {
651
686
  }
652
687
  });
653
688
 
689
+ const location$1 = /*@__PURE__*/getDefaultExportFromCjs(location_1);
690
+
654
691
  var printLocation_1 = createCommonjsModule(function (module, exports) {
692
+ 'use strict';
655
693
 
656
694
  Object.defineProperty(exports, '__esModule', {
657
695
  value: true,
@@ -727,7 +765,10 @@ function printPrefixedLines(lines) {
727
765
  }
728
766
  });
729
767
 
768
+ const printLocation = /*@__PURE__*/getDefaultExportFromCjs(printLocation_1);
769
+
730
770
  var GraphQLError_1 = createCommonjsModule(function (module, exports) {
771
+ 'use strict';
731
772
 
732
773
  Object.defineProperty(exports, '__esModule', {
733
774
  value: true,
@@ -996,7 +1037,10 @@ function formatError(error) {
996
1037
  }
997
1038
  });
998
1039
 
1040
+ const GraphQLError = /*@__PURE__*/getDefaultExportFromCjs(GraphQLError_1);
1041
+
999
1042
  var syntaxError_1 = createCommonjsModule(function (module, exports) {
1043
+ 'use strict';
1000
1044
 
1001
1045
  Object.defineProperty(exports, '__esModule', {
1002
1046
  value: true,
@@ -1017,7 +1061,10 @@ function syntaxError(source, position, description) {
1017
1061
  }
1018
1062
  });
1019
1063
 
1064
+ const syntaxError = /*@__PURE__*/getDefaultExportFromCjs(syntaxError_1);
1065
+
1020
1066
  var ast = createCommonjsModule(function (module, exports) {
1067
+ 'use strict';
1021
1068
 
1022
1069
  Object.defineProperty(exports, '__esModule', {
1023
1070
  value: true,
@@ -1233,7 +1280,7 @@ function isNode(maybeNode) {
1233
1280
  }
1234
1281
  /** Name */
1235
1282
 
1236
- let OperationTypeNode;
1283
+ var OperationTypeNode;
1237
1284
  exports.OperationTypeNode = OperationTypeNode;
1238
1285
 
1239
1286
  (function (OperationTypeNode) {
@@ -1243,7 +1290,10 @@ exports.OperationTypeNode = OperationTypeNode;
1243
1290
  })(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {}));
1244
1291
  });
1245
1292
 
1293
+ const ast$1 = /*@__PURE__*/getDefaultExportFromCjs(ast);
1294
+
1246
1295
  var directiveLocation = createCommonjsModule(function (module, exports) {
1296
+ 'use strict';
1247
1297
 
1248
1298
  Object.defineProperty(exports, '__esModule', {
1249
1299
  value: true,
@@ -1253,13 +1303,7 @@ exports.DirectiveLocation = void 0;
1253
1303
  /**
1254
1304
  * The set of allowed directive location values.
1255
1305
  */
1256
- let DirectiveLocation;
1257
- /**
1258
- * The enum type representing the directive location values.
1259
- *
1260
- * @deprecated Please use `DirectiveLocation`. Will be remove in v17.
1261
- */
1262
-
1306
+ var DirectiveLocation;
1263
1307
  exports.DirectiveLocation = DirectiveLocation;
1264
1308
 
1265
1309
  (function (DirectiveLocation) {
@@ -1283,9 +1327,17 @@ exports.DirectiveLocation = DirectiveLocation;
1283
1327
  DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
1284
1328
  DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
1285
1329
  })(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
1330
+ /**
1331
+ * The enum type representing the directive location values.
1332
+ *
1333
+ * @deprecated Please use `DirectiveLocation`. Will be remove in v17.
1334
+ */
1286
1335
  });
1287
1336
 
1337
+ const directiveLocation$1 = /*@__PURE__*/getDefaultExportFromCjs(directiveLocation);
1338
+
1288
1339
  var kinds = createCommonjsModule(function (module, exports) {
1340
+ 'use strict';
1289
1341
 
1290
1342
  Object.defineProperty(exports, '__esModule', {
1291
1343
  value: true,
@@ -1295,13 +1347,7 @@ exports.Kind = void 0;
1295
1347
  /**
1296
1348
  * The set of allowed kind values for AST nodes.
1297
1349
  */
1298
- let Kind;
1299
- /**
1300
- * The enum type representing the possible kind values of AST nodes.
1301
- *
1302
- * @deprecated Please use `Kind`. Will be remove in v17.
1303
- */
1304
-
1350
+ var Kind;
1305
1351
  exports.Kind = Kind;
1306
1352
 
1307
1353
  (function (Kind) {
@@ -1349,9 +1395,17 @@ exports.Kind = Kind;
1349
1395
  Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';
1350
1396
  Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';
1351
1397
  })(Kind || (exports.Kind = Kind = {}));
1398
+ /**
1399
+ * The enum type representing the possible kind values of AST nodes.
1400
+ *
1401
+ * @deprecated Please use `Kind`. Will be remove in v17.
1402
+ */
1352
1403
  });
1353
1404
 
1405
+ const kinds$1 = /*@__PURE__*/getDefaultExportFromCjs(kinds);
1406
+
1354
1407
  var characterClasses = createCommonjsModule(function (module, exports) {
1408
+ 'use strict';
1355
1409
 
1356
1410
  Object.defineProperty(exports, '__esModule', {
1357
1411
  value: true,
@@ -1428,7 +1482,10 @@ function isNameContinue(code) {
1428
1482
  }
1429
1483
  });
1430
1484
 
1485
+ const characterClasses$1 = /*@__PURE__*/getDefaultExportFromCjs(characterClasses);
1486
+
1431
1487
  var blockString = createCommonjsModule(function (module, exports) {
1488
+ 'use strict';
1432
1489
 
1433
1490
  Object.defineProperty(exports, '__esModule', {
1434
1491
  value: true,
@@ -1625,7 +1682,10 @@ function printBlockString(value, options) {
1625
1682
  }
1626
1683
  });
1627
1684
 
1685
+ const blockString$1 = /*@__PURE__*/getDefaultExportFromCjs(blockString);
1686
+
1628
1687
  var tokenKind = createCommonjsModule(function (module, exports) {
1688
+ 'use strict';
1629
1689
 
1630
1690
  Object.defineProperty(exports, '__esModule', {
1631
1691
  value: true,
@@ -1636,13 +1696,7 @@ exports.TokenKind = void 0;
1636
1696
  * An exported enum describing the different kinds of tokens that the
1637
1697
  * lexer emits.
1638
1698
  */
1639
- let TokenKind;
1640
- /**
1641
- * The enum type representing the token kinds values.
1642
- *
1643
- * @deprecated Please use `TokenKind`. Will be remove in v17.
1644
- */
1645
-
1699
+ var TokenKind;
1646
1700
  exports.TokenKind = TokenKind;
1647
1701
 
1648
1702
  (function (TokenKind) {
@@ -1669,9 +1723,17 @@ exports.TokenKind = TokenKind;
1669
1723
  TokenKind['BLOCK_STRING'] = 'BlockString';
1670
1724
  TokenKind['COMMENT'] = 'Comment';
1671
1725
  })(TokenKind || (exports.TokenKind = TokenKind = {}));
1726
+ /**
1727
+ * The enum type representing the token kinds values.
1728
+ *
1729
+ * @deprecated Please use `TokenKind`. Will be remove in v17.
1730
+ */
1672
1731
  });
1673
1732
 
1733
+ const tokenKind$1 = /*@__PURE__*/getDefaultExportFromCjs(tokenKind);
1734
+
1674
1735
  var lexer = createCommonjsModule(function (module, exports) {
1736
+ 'use strict';
1675
1737
 
1676
1738
  Object.defineProperty(exports, '__esModule', {
1677
1739
  value: true,
@@ -2679,7 +2741,10 @@ function readName(lexer, start) {
2679
2741
  }
2680
2742
  });
2681
2743
 
2744
+ const lexer$1 = /*@__PURE__*/getDefaultExportFromCjs(lexer);
2745
+
2682
2746
  var devAssert_1 = createCommonjsModule(function (module, exports) {
2747
+ 'use strict';
2683
2748
 
2684
2749
  Object.defineProperty(exports, '__esModule', {
2685
2750
  value: true,
@@ -2695,7 +2760,10 @@ function devAssert(condition, message) {
2695
2760
  }
2696
2761
  });
2697
2762
 
2763
+ const devAssert = /*@__PURE__*/getDefaultExportFromCjs(devAssert_1);
2764
+
2698
2765
  var inspect_1 = createCommonjsModule(function (module, exports) {
2766
+ 'use strict';
2699
2767
 
2700
2768
  Object.defineProperty(exports, '__esModule', {
2701
2769
  value: true,
@@ -2818,7 +2886,10 @@ function getObjectTag(object) {
2818
2886
  }
2819
2887
  });
2820
2888
 
2889
+ const inspect = /*@__PURE__*/getDefaultExportFromCjs(inspect_1);
2890
+
2821
2891
  var instanceOf_1 = createCommonjsModule(function (module, exports) {
2892
+ 'use strict';
2822
2893
 
2823
2894
  Object.defineProperty(exports, '__esModule', {
2824
2895
  value: true,
@@ -2837,14 +2908,54 @@ const instanceOf =
2837
2908
  /* c8 ignore next 6 */
2838
2909
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
2839
2910
  // eslint-disable-next-line no-undef
2840
- function instanceOf(value, constructor) {
2911
+ "development" === 'production'
2912
+ ? function instanceOf(value, constructor) {
2841
2913
  return value instanceof constructor;
2842
2914
  }
2843
- ;
2915
+ : function instanceOf(value, constructor) {
2916
+ if (value instanceof constructor) {
2917
+ return true;
2918
+ }
2919
+
2920
+ if (typeof value === 'object' && value !== null) {
2921
+ var _value$constructor;
2922
+
2923
+ // Prefer Symbol.toStringTag since it is immune to minification.
2924
+ const className = constructor.prototype[Symbol.toStringTag];
2925
+ const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.
2926
+ Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009
2927
+ ? value[Symbol.toStringTag]
2928
+ : (_value$constructor = value.constructor) === null ||
2929
+ _value$constructor === void 0
2930
+ ? void 0
2931
+ : _value$constructor.name;
2932
+
2933
+ if (className === valueClassName) {
2934
+ const stringifiedValue = (0, inspect_1.inspect)(value);
2935
+ throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
2936
+
2937
+ Ensure that there is only one instance of "graphql" in the node_modules
2938
+ directory. If different versions of "graphql" are the dependencies of other
2939
+ relied on modules, use "resolutions" to ensure only one version is installed.
2940
+
2941
+ https://yarnpkg.com/en/docs/selective-version-resolutions
2942
+
2943
+ Duplicate "graphql" modules cannot be used at the same time since different
2944
+ versions may have different capabilities and behavior. The data from one
2945
+ version used in the function from another could produce confusing and
2946
+ spurious results.`);
2947
+ }
2948
+ }
2949
+
2950
+ return false;
2951
+ };
2844
2952
  exports.instanceOf = instanceOf;
2845
2953
  });
2846
2954
 
2955
+ const instanceOf = /*@__PURE__*/getDefaultExportFromCjs(instanceOf_1);
2956
+
2847
2957
  var source = createCommonjsModule(function (module, exports) {
2958
+ 'use strict';
2848
2959
 
2849
2960
  Object.defineProperty(exports, '__esModule', {
2850
2961
  value: true,
@@ -2911,7 +3022,10 @@ function isSource(source) {
2911
3022
  }
2912
3023
  });
2913
3024
 
3025
+ const source$1 = /*@__PURE__*/getDefaultExportFromCjs(source);
3026
+
2914
3027
  var parser = createCommonjsModule(function (module, exports) {
3028
+ 'use strict';
2915
3029
 
2916
3030
  Object.defineProperty(exports, '__esModule', {
2917
3031
  value: true,
@@ -3005,12 +3119,13 @@ function parseType(source, options) {
3005
3119
  */
3006
3120
 
3007
3121
  class Parser {
3008
- constructor(source$1, options) {
3122
+ constructor(source$1, options = {}) {
3009
3123
  const sourceObj = (0, source.isSource)(source$1)
3010
3124
  ? source$1
3011
3125
  : new source.Source(source$1);
3012
3126
  this._lexer = new lexer.Lexer(sourceObj);
3013
3127
  this._options = options;
3128
+ this._tokenCounter = 0;
3014
3129
  }
3015
3130
  /**
3016
3131
  * Converts a name lex token into a name parse node.
@@ -3345,18 +3460,12 @@ class Parser {
3345
3460
  */
3346
3461
 
3347
3462
  parseFragmentDefinition() {
3348
- var _this$_options;
3349
-
3350
3463
  const start = this._lexer.token;
3351
3464
  this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes
3352
3465
  // the grammar of FragmentDefinition:
3353
3466
  // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
3354
3467
 
3355
- if (
3356
- ((_this$_options = this._options) === null || _this$_options === void 0
3357
- ? void 0
3358
- : _this$_options.allowLegacyFragmentVariables) === true
3359
- ) {
3468
+ if (this._options.allowLegacyFragmentVariables === true) {
3360
3469
  return this.node(start, {
3361
3470
  kind: kinds.Kind.FRAGMENT_DEFINITION,
3362
3471
  name: this.parseFragmentName(),
@@ -3417,16 +3526,14 @@ class Parser {
3417
3526
  return this.parseObject(isConst);
3418
3527
 
3419
3528
  case tokenKind.TokenKind.INT:
3420
- this._lexer.advance();
3421
-
3529
+ this.advanceLexer();
3422
3530
  return this.node(token, {
3423
3531
  kind: kinds.Kind.INT,
3424
3532
  value: token.value,
3425
3533
  });
3426
3534
 
3427
3535
  case tokenKind.TokenKind.FLOAT:
3428
- this._lexer.advance();
3429
-
3536
+ this.advanceLexer();
3430
3537
  return this.node(token, {
3431
3538
  kind: kinds.Kind.FLOAT,
3432
3539
  value: token.value,
@@ -3437,7 +3544,7 @@ class Parser {
3437
3544
  return this.parseStringLiteral();
3438
3545
 
3439
3546
  case tokenKind.TokenKind.NAME:
3440
- this._lexer.advance();
3547
+ this.advanceLexer();
3441
3548
 
3442
3549
  switch (token.value) {
3443
3550
  case 'true':
@@ -3493,9 +3600,7 @@ class Parser {
3493
3600
 
3494
3601
  parseStringLiteral() {
3495
3602
  const token = this._lexer.token;
3496
-
3497
- this._lexer.advance();
3498
-
3603
+ this.advanceLexer();
3499
3604
  return this.node(token, {
3500
3605
  kind: kinds.Kind.STRING,
3501
3606
  value: token.value,
@@ -4286,13 +4391,7 @@ class Parser {
4286
4391
  */
4287
4392
 
4288
4393
  node(startToken, node) {
4289
- var _this$_options2;
4290
-
4291
- if (
4292
- ((_this$_options2 = this._options) === null || _this$_options2 === void 0
4293
- ? void 0
4294
- : _this$_options2.noLocation) !== true
4295
- ) {
4394
+ if (this._options.noLocation !== true) {
4296
4395
  node.loc = new ast.Location(
4297
4396
  startToken,
4298
4397
  this._lexer.lastToken,
@@ -4318,8 +4417,7 @@ class Parser {
4318
4417
  const token = this._lexer.token;
4319
4418
 
4320
4419
  if (token.kind === kind) {
4321
- this._lexer.advance();
4322
-
4420
+ this.advanceLexer();
4323
4421
  return token;
4324
4422
  }
4325
4423
 
@@ -4338,8 +4436,7 @@ class Parser {
4338
4436
  const token = this._lexer.token;
4339
4437
 
4340
4438
  if (token.kind === kind) {
4341
- this._lexer.advance();
4342
-
4439
+ this.advanceLexer();
4343
4440
  return true;
4344
4441
  }
4345
4442
 
@@ -4354,7 +4451,7 @@ class Parser {
4354
4451
  const token = this._lexer.token;
4355
4452
 
4356
4453
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4357
- this._lexer.advance();
4454
+ this.advanceLexer();
4358
4455
  } else {
4359
4456
  throw (0, syntaxError_1.syntaxError)(
4360
4457
  this._lexer.source,
@@ -4372,8 +4469,7 @@ class Parser {
4372
4469
  const token = this._lexer.token;
4373
4470
 
4374
4471
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4375
- this._lexer.advance();
4376
-
4472
+ this.advanceLexer();
4377
4473
  return true;
4378
4474
  }
4379
4475
 
@@ -4460,6 +4556,24 @@ class Parser {
4460
4556
 
4461
4557
  return nodes;
4462
4558
  }
4559
+
4560
+ advanceLexer() {
4561
+ const { maxTokens } = this._options;
4562
+
4563
+ const token = this._lexer.advance();
4564
+
4565
+ if (maxTokens !== undefined && token.kind !== tokenKind.TokenKind.EOF) {
4566
+ ++this._tokenCounter;
4567
+
4568
+ if (this._tokenCounter > maxTokens) {
4569
+ throw (0, syntaxError_1.syntaxError)(
4570
+ this._lexer.source,
4571
+ token.start,
4572
+ `Document contains more that ${maxTokens} tokens. Parsing aborted.`,
4573
+ );
4574
+ }
4575
+ }
4576
+ }
4463
4577
  }
4464
4578
  /**
4465
4579
  * A helper function to describe a token as a string for debugging.
@@ -4480,7 +4594,10 @@ function getTokenKindDesc(kind) {
4480
4594
  }
4481
4595
  });
4482
4596
 
4597
+ const parser$1 = /*@__PURE__*/getDefaultExportFromCjs(parser);
4598
+
4483
4599
  var printString_1 = createCommonjsModule(function (module, exports) {
4600
+ 'use strict';
4484
4601
 
4485
4602
  Object.defineProperty(exports, '__esModule', {
4486
4603
  value: true,
@@ -4665,7 +4782,10 @@ const escapeSequences = [
4665
4782
  ];
4666
4783
  });
4667
4784
 
4785
+ const printString = /*@__PURE__*/getDefaultExportFromCjs(printString_1);
4786
+
4668
4787
  var visitor = createCommonjsModule(function (module, exports) {
4788
+ 'use strict';
4669
4789
 
4670
4790
  Object.defineProperty(exports, '__esModule', {
4671
4791
  value: true,
@@ -5044,7 +5164,10 @@ function getVisitFn(visitor, kind, isLeaving) {
5044
5164
  }
5045
5165
  });
5046
5166
 
5167
+ const visitor$1 = /*@__PURE__*/getDefaultExportFromCjs(visitor);
5168
+
5047
5169
  var printer = createCommonjsModule(function (module, exports) {
5170
+ 'use strict';
5048
5171
 
5049
5172
  Object.defineProperty(exports, '__esModule', {
5050
5173
  value: true,
@@ -5397,6 +5520,10 @@ function hasMultilineItems(maybeArray) {
5397
5520
  }
5398
5521
  });
5399
5522
 
5523
+ const printer$1 = /*@__PURE__*/getDefaultExportFromCjs(printer);
5524
+
5525
+ 'use strict';
5526
+
5400
5527
  var ReactNativeFile$1 = function ReactNativeFile(_ref) {
5401
5528
  var uri = _ref.uri,
5402
5529
  name = _ref.name,
@@ -5406,6 +5533,10 @@ var ReactNativeFile$1 = function ReactNativeFile(_ref) {
5406
5533
  this.type = type;
5407
5534
  };
5408
5535
 
5536
+ 'use strict';
5537
+
5538
+
5539
+
5409
5540
  var isExtractableFile$1 = function isExtractableFile(value) {
5410
5541
  return (
5411
5542
  (typeof File !== 'undefined' && value instanceof File) ||
@@ -5414,6 +5545,10 @@ var isExtractableFile$1 = function isExtractableFile(value) {
5414
5545
  );
5415
5546
  };
5416
5547
 
5548
+ 'use strict';
5549
+
5550
+
5551
+
5417
5552
  var extractFiles$1 = function extractFiles(value, path, isExtractableFile) {
5418
5553
  if (path === void 0) {
5419
5554
  path = '';
@@ -5465,6 +5600,8 @@ var extractFiles$1 = function extractFiles(value, path, isExtractableFile) {
5465
5600
  };
5466
5601
  };
5467
5602
 
5603
+ 'use strict';
5604
+
5468
5605
  var ReactNativeFile = ReactNativeFile$1;
5469
5606
  var extractFiles = extractFiles$1;
5470
5607
  var isExtractableFile = isExtractableFile$1;
@@ -5479,6 +5616,7 @@ var _public = {
5479
5616
  var browser = typeof self == 'object' ? self.FormData : window.FormData;
5480
5617
 
5481
5618
  var defaultJsonSerializer = createCommonjsModule(function (module, exports) {
5619
+ "use strict";
5482
5620
  Object.defineProperty(exports, "__esModule", { value: true });
5483
5621
  exports.defaultJsonSerializer = void 0;
5484
5622
  exports.defaultJsonSerializer = {
@@ -5488,7 +5626,10 @@ exports.defaultJsonSerializer = {
5488
5626
  //# sourceMappingURL=defaultJsonSerializer.js.map
5489
5627
  });
5490
5628
 
5629
+ const defaultJsonSerializer$1 = /*@__PURE__*/getDefaultExportFromCjs(defaultJsonSerializer);
5630
+
5491
5631
  var createRequestBody_1 = createCommonjsModule(function (module, exports) {
5632
+ "use strict";
5492
5633
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
5493
5634
  return (mod && mod.__esModule) ? mod : { "default": mod };
5494
5635
  };
@@ -5545,7 +5686,10 @@ exports.default = createRequestBody;
5545
5686
  //# sourceMappingURL=createRequestBody.js.map
5546
5687
  });
5547
5688
 
5689
+ const createRequestBody = /*@__PURE__*/getDefaultExportFromCjs(createRequestBody_1);
5690
+
5548
5691
  var parseArgs = createCommonjsModule(function (module, exports) {
5692
+ "use strict";
5549
5693
  Object.defineProperty(exports, "__esModule", { value: true });
5550
5694
  exports.parseBatchRequestsExtendedArgs = exports.parseRawRequestExtendedArgs = exports.parseRequestExtendedArgs = exports.parseBatchRequestArgs = exports.parseRawRequestArgs = exports.parseRequestArgs = void 0;
5551
5695
  function parseRequestArgs(documentOrOptions, variables, requestHeaders) {
@@ -5618,7 +5762,10 @@ exports.parseBatchRequestsExtendedArgs = parseBatchRequestsExtendedArgs;
5618
5762
  //# sourceMappingURL=parseArgs.js.map
5619
5763
  });
5620
5764
 
5765
+ const parseArgs$1 = /*@__PURE__*/getDefaultExportFromCjs(parseArgs);
5766
+
5621
5767
  var types = createCommonjsModule(function (module, exports) {
5768
+ "use strict";
5622
5769
  var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
5623
5770
  var extendStatics = function (d, b) {
5624
5771
  extendStatics = Object.setPrototypeOf ||
@@ -5668,7 +5815,10 @@ exports.ClientError = ClientError;
5668
5815
  //# sourceMappingURL=types.js.map
5669
5816
  });
5670
5817
 
5818
+ const types$1 = /*@__PURE__*/getDefaultExportFromCjs(types);
5819
+
5671
5820
  var graphqlWs = createCommonjsModule(function (module, exports) {
5821
+ "use strict";
5672
5822
  var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5673
5823
  __assign = Object.assign || function(t) {
5674
5824
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -5848,6 +5998,8 @@ var GraphQLWebSocketClient = /** @class */ (function () {
5848
5998
  if (message.payload.errors) {
5849
5999
  subscriber.error && subscriber.error(new types.ClientError(__assign(__assign({}, message.payload), { status: 200 }), { query: query, variables: variables }));
5850
6000
  }
6001
+ else {
6002
+ }
5851
6003
  return;
5852
6004
  }
5853
6005
  case ERROR: {
@@ -5942,7 +6094,10 @@ function Complete(id) {
5942
6094
  //# sourceMappingURL=graphql-ws.js.map
5943
6095
  });
5944
6096
 
6097
+ const graphqlWs$1 = /*@__PURE__*/getDefaultExportFromCjs(graphqlWs);
6098
+
5945
6099
  var dist = createCommonjsModule(function (module, exports) {
6100
+ "use strict";
5946
6101
  var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5947
6102
  __assign = Object.assign || function(t) {
5948
6103
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -6267,7 +6422,7 @@ exports.GraphQLClient = GraphQLClient;
6267
6422
  function makeRequest(_a) {
6268
6423
  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;
6269
6424
  return __awaiter(this, void 0, void 0, function () {
6270
- var fetcher, isBathchingQuery, response, result, successfullyReceivedData, successfullyPassedErrorPolicy, headers_1, status_1, rest, data, errorResult;
6425
+ var fetcher, isBathchingQuery, response, result, successfullyReceivedData, successfullyPassedErrorPolicy, headers_1, status_1, errors, rest, data, errorResult;
6271
6426
  return __generator(this, function (_c) {
6272
6427
  switch (_c.label) {
6273
6428
  case 0:
@@ -6294,7 +6449,7 @@ function makeRequest(_a) {
6294
6449
  successfullyPassedErrorPolicy = !result.errors || fetchOptions.errorPolicy === 'all' || fetchOptions.errorPolicy === 'ignore';
6295
6450
  if (response.ok && successfullyPassedErrorPolicy && successfullyReceivedData) {
6296
6451
  headers_1 = response.headers, status_1 = response.status;
6297
- rest = __rest(result, ["errors"]);
6452
+ errors = result.errors, rest = __rest(result, ["errors"]);
6298
6453
  data = fetchOptions.errorPolicy === 'ignore' ? rest : result;
6299
6454
  return [2 /*return*/, __assign(__assign({}, (isBathchingQuery ? { data: data } : data)), { headers: headers_1, status: status_1 })];
6300
6455
  }
@@ -6302,6 +6457,7 @@ function makeRequest(_a) {
6302
6457
  errorResult = typeof result === 'string' ? { error: result } : result;
6303
6458
  throw new types.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables });
6304
6459
  }
6460
+ return [2 /*return*/];
6305
6461
  }
6306
6462
  });
6307
6463
  });
@@ -6431,6 +6587,8 @@ Object.defineProperty(exports, "GraphQLWebSocketClient", { enumerable: true, get
6431
6587
  //# sourceMappingURL=index.js.map
6432
6588
  });
6433
6589
 
6590
+ const index = /*@__PURE__*/getDefaultExportFromCjs(dist);
6591
+
6434
6592
  class UrlUtils {
6435
6593
  static getQueryParams(queryString) {
6436
6594
  const params = new Map();
@@ -6488,6 +6646,27 @@ class DataFetcher {
6488
6646
  DataFetcher.requestListener.splice(index, 1);
6489
6647
  }
6490
6648
  }
6649
+ processErrorInfo(errors) {
6650
+ var _a, _b;
6651
+ const POSITION_ERROR_INFO = 0;
6652
+ const errorTitle = "Falha detectada";
6653
+ const error = errors[POSITION_ERROR_INFO];
6654
+ if (error.length > 0) { //As informações do erro vem no primeiro indice de um array
6655
+ const errorInfo = error[POSITION_ERROR_INFO];
6656
+ 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";
6657
+ const errorLevel = ((_a = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _a === void 0 ? void 0 : _a.level) ? errorInfo.extensions.level : "ERROR";
6658
+ const errorCode = ((_b = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _b === void 0 ? void 0 : _b.code) ? errorInfo.extensions.code : "";
6659
+ switch (errorLevel) {
6660
+ case "WARNING":
6661
+ return new WarningException(errorTitle, errorMessage, errorCode);
6662
+ default:
6663
+ return new ErrorException(errorTitle, errorMessage, errorCode);
6664
+ }
6665
+ }
6666
+ else {
6667
+ return new ErrorException(errorTitle, "Não há informações sobre o erro");
6668
+ }
6669
+ }
6491
6670
  async callGraphQL(req) {
6492
6671
  var _a;
6493
6672
  const reqKey = this.getReqKey(req);
@@ -6498,7 +6677,8 @@ class DataFetcher {
6498
6677
  let query = this.getQueryTemplate(req);
6499
6678
  const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
6500
6679
  if (res.errors.length > 0) {
6501
- reject(new ErrorException("Falha detectada", res.errors[0][0].message));
6680
+ const error = this.processErrorInfo(res.errors);
6681
+ reject(error);
6502
6682
  }
6503
6683
  else {
6504
6684
  resolve(res.data[0][reqKey]);
@@ -6515,23 +6695,26 @@ class DataFetcher {
6515
6695
  resolveURL() {
6516
6696
  return UrlUtils.getUrlBase();
6517
6697
  }
6518
- getContext() {
6698
+ getContext(module) {
6519
6699
  const urlParams = UrlUtils.getQueryParams(location.search);
6520
6700
  return {
6521
- baseUrl: `${this.resolveURL()}/mge/service.sbr`,
6701
+ baseUrl: `${this.resolveURL()}/${module}/service.sbr`,
6522
6702
  appName: "SankhyaBlocks",
6523
6703
  mgeSession: `${window['skw_session'] || urlParams.mgeSession}`,
6524
6704
  globalID: "85C0093DFA240EAB699B4E47A10215BD",
6705
+ //FIXME: Precisamos ajustar para buscar o resourceId pela aplicação
6525
6706
  resourceID: "br.com.sankhya.mov.bancaria"
6526
6707
  };
6527
6708
  }
6528
6709
  async callServiceBroker(serviceName, payload) {
6529
6710
  return new Promise((accept, reject) => {
6530
- const ctx = this.getContext();
6531
- 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`;
6711
+ const parts = serviceName.split("@");
6712
+ const [module, name] = parts.length === 2 ? parts : ['mge', serviceName];
6713
+ const ctx = this.getContext(module);
6714
+ 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`;
6532
6715
  document.cookie = `JSESSIONID=${ctx.mgeSession};`;
6533
6716
  const http = new XMLHttpRequest();
6534
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url }));
6717
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
6535
6718
  http.open("POST", url, true);
6536
6719
  http.withCredentials = true;
6537
6720
  http.send(payload);
@@ -6550,11 +6733,11 @@ class DataFetcher {
6550
6733
  console.warn(`callServiceBroker error to parser response to JSON ${e}`);
6551
6734
  reject(this.responseText);
6552
6735
  }
6553
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6736
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6554
6737
  }
6555
6738
  else if (this.readyState == 4 && this.status != 200) {
6556
6739
  reject(this.responseText);
6557
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6740
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6558
6741
  }
6559
6742
  };
6560
6743
  });
@@ -6610,7 +6793,7 @@ class DataFetcher {
6610
6793
  if (window['skw_session']) {
6611
6794
  url += `?mgeSession=${window['skw_session']}`;
6612
6795
  }
6613
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url }));
6796
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: request }));
6614
6797
  try {
6615
6798
  res = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
6616
6799
  res.forEach((resItem, index) => {
@@ -6641,11 +6824,11 @@ class DataFetcher {
6641
6824
  });
6642
6825
  }
6643
6826
  else {
6644
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6827
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: request }));
6645
6828
  throw new ErrorException("Falha de comunicação", err.message);
6646
6829
  }
6647
6830
  }
6648
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6831
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: request }));
6649
6832
  return { data: dataResponse, errors: errorsResponse };
6650
6833
  }
6651
6834
  isHttpError(err) {
@@ -6692,6 +6875,7 @@ class WaitingRequest {
6692
6875
  class DataUnitFetcher {
6693
6876
  constructor() {
6694
6877
  this.templateByQuery = new Map();
6878
+ this._loadDataTimeout = {};
6695
6879
  this.buldTemplates();
6696
6880
  }
6697
6881
  buldTemplates() {
@@ -6720,9 +6904,9 @@ class DataUnitFetcher {
6720
6904
  }
6721
6905
  }
6722
6906
  }`);
6723
- this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filter: [InputFilter!] $sort: [InputSort!]) {
6907
+ this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!]) {
6724
6908
  $queryAlias$: fetchDataUnit(name: $dataunit){
6725
- data(limit: $limit offset: $offset filters: $filter sort: $sort){
6909
+ data(limit: $limit offset: $offset filters: $filters sort: $sort){
6726
6910
  limit
6727
6911
  offset
6728
6912
  total
@@ -6751,7 +6935,7 @@ class DataUnitFetcher {
6751
6935
  getDataUnit(entityName, resourceID) {
6752
6936
  const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
6753
6937
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
6754
- dataUnit.dataLoader = (dataUnit, page, sort, filters) => this.loadData(dataUnit, page, sort, filters);
6938
+ dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
6755
6939
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
6756
6940
  dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
6757
6941
  return dataUnit;
@@ -6788,25 +6972,39 @@ class DataUnitFetcher {
6788
6972
  });
6789
6973
  });
6790
6974
  }
6791
- loadData(dataUnit, page, sort, filter) {
6975
+ loadData(dataUnit, request) {
6976
+ const duName = dataUnit.name;
6977
+ if (this._loadDataTimeout[duName]) {
6978
+ clearTimeout(this._loadDataTimeout[duName]);
6979
+ delete this._loadDataTimeout[duName];
6980
+ }
6792
6981
  return new Promise((resolve, reject) => {
6793
- var _a, _b, _c;
6794
- const variables = { dataunit: dataUnit.name, sort, filter };
6795
- if (page) {
6796
- variables.limit = page.limit;
6797
- variables.offset = page.offset;
6798
- }
6799
- if (!StringUtils.isEmpty((_a = page === null || page === void 0 ? void 0 : page.quickFilter) === null || _a === void 0 ? void 0 : _a.term)) {
6982
+ this._loadDataTimeout[duName] = setTimeout(() => {
6983
+ delete this._loadDataTimeout[duName];
6984
+ this.doLoadData(dataUnit, request)
6985
+ .then(result => resolve(result))
6986
+ .catch(reason => reject(reason));
6987
+ }, 200);
6988
+ });
6989
+ }
6990
+ doLoadData(dataUnit, request) {
6991
+ return new Promise((resolve, reject) => {
6992
+ var _a;
6993
+ const { sort, filters, limit, offset, quickFilter } = request;
6994
+ const variables = { dataunit: dataUnit.name, sort, filters };
6995
+ variables.limit = limit;
6996
+ variables.offset = offset;
6997
+ if (!StringUtils.isEmpty(quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.term)) {
6800
6998
  if (variables.filter === undefined) {
6801
6999
  variables.filter = [];
6802
7000
  }
6803
7001
  const quickFilterCriteria = {
6804
7002
  name: "__QUICK_FILTER__",
6805
7003
  expression: "__QUICK_FILTER__",
6806
- params: [{ name: "term", dataType: DataType.TEXT, value: page.quickFilter.term }]
7004
+ params: [{ name: "term", dataType: DataType.TEXT, value: quickFilter.term }]
6807
7005
  };
6808
- if (((_c = (_b = page.quickFilter) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.length) > 0) {
6809
- quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: page.quickFilter.fields });
7006
+ if (((_a = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
7007
+ quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: quickFilter.fields });
6810
7008
  }
6811
7009
  variables.filter.push(quickFilterCriteria);
6812
7010
  }
@@ -6816,16 +7014,32 @@ class DataUnitFetcher {
6816
7014
  query: this.templateByQuery.get("fetchData"),
6817
7015
  })
6818
7016
  .then((resp) => {
6819
- const pageResult = resp.data;
6820
- const records = [];
6821
- pageResult.records.forEach((responseRecord) => {
7017
+ const { limit, offset, total, hasMore, records } = resp.data;
7018
+ let paginationInfo;
7019
+ if (limit) {
7020
+ const firstRecord = total == 0 ? 0 : offset + 1;
7021
+ const lastRecord = offset + Math.min(records.length, limit);
7022
+ const currentPage = offset / limit;
7023
+ paginationInfo = {
7024
+ firstRecord,
7025
+ lastRecord,
7026
+ total,
7027
+ currentPage,
7028
+ hasMore
7029
+ };
7030
+ }
7031
+ const processedRecords = [];
7032
+ records.forEach((responseRecord) => {
6822
7033
  const duRecord = { __record__id__: responseRecord.id };
6823
7034
  responseRecord.fields.forEach(({ name, value }) => {
6824
7035
  duRecord[name] = dataUnit.valueFromString(name, value);
6825
7036
  });
6826
- records.push(duRecord);
7037
+ processedRecords.push(duRecord);
7038
+ });
7039
+ resolve({
7040
+ paginationInfo,
7041
+ records: processedRecords
6827
7042
  });
6828
- resolve(Object.assign(Object.assign({}, pageResult), { records }));
6829
7043
  })
6830
7044
  .catch((error) => {
6831
7045
  reject(error);
@@ -7051,15 +7265,16 @@ class GridConfigFetcher extends ResourceFetcher {
7051
7265
  super(...arguments);
7052
7266
  this.GRID_CONFIG_VERSION = "V3:";
7053
7267
  }
7054
- getConfig(resourceID) {
7268
+ getConfig(_gridName, resourceID) {
7055
7269
  const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
7056
7270
  return new Promise((resolve, reject) => {
7057
7271
  this.loadResource(completePath)
7058
7272
  .then(loadedResource => {
7273
+ let config = undefined;
7059
7274
  if (loadedResource) {
7060
- let config = JSON.parse(loadedResource);
7061
- resolve(config);
7275
+ config = JSON.parse(loadedResource);
7062
7276
  }
7277
+ resolve(config);
7063
7278
  }).catch((error) => {
7064
7279
  reject(error);
7065
7280
  });
@@ -7218,7 +7433,14 @@ class SnkErrorHandler {
7218
7433
  errorHandler(evt) {
7219
7434
  this.processException(evt.error);
7220
7435
  }
7436
+ buildErrorCodeHTML(exception) {
7437
+ const onclick = 'try{window.workspace.openHelp(\'_tbcode:' + exception.errorCode + '\')} catch(e){alert(\'Não é possível abrir a ajuda fora do workspace Sankhya\');}';
7438
+ return '<br><a href="#" onclick="' + onclick + '">Código: ' + exception.errorCode + '</a>';
7439
+ }
7221
7440
  processException(exception) {
7441
+ if (exception.errorCode != "") {
7442
+ exception.message += this.buildErrorCodeHTML(exception);
7443
+ }
7222
7444
  if (exception instanceof WaitingChangeException) {
7223
7445
  this._app.alert(exception.title, exception.message);
7224
7446
  }
@@ -7236,7 +7458,7 @@ class SnkErrorHandler {
7236
7458
  }
7237
7459
  else {
7238
7460
  const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
7239
- const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${exception}"`;
7461
+ const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${ObjectUtils.objectToString(exception)}"`;
7240
7462
  this._app.error(title, message);
7241
7463
  }
7242
7464
  }
@@ -7247,6 +7469,106 @@ class SnkErrorHandler {
7247
7469
 
7248
7470
  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);
7249
7471
 
7472
+ class TotalsFetcher {
7473
+ constructor() {
7474
+ this.templateByQuery = new Map();
7475
+ this.buldTemplates();
7476
+ }
7477
+ buldTemplates() {
7478
+ this.templateByQuery.set("fetchTotals", dist.gql `query($filters: [InputFilter!] $name: String!) {
7479
+ $queryAlias$: fetchTotals(name: $name, filters: $filters ){
7480
+ name
7481
+ value
7482
+ }
7483
+ }`);
7484
+ }
7485
+ async getTotals(name, resourceID, filters) {
7486
+ const path = `totals://${name}/${resourceID}`;
7487
+ let variables = {
7488
+ name: path,
7489
+ filters: filters
7490
+ };
7491
+ return DataFetcher.get().callGraphQL({
7492
+ values: variables,
7493
+ query: this.templateByQuery.get("fetchTotals"),
7494
+ });
7495
+ }
7496
+ fetchTotals(name, resourceID, filters = []) {
7497
+ return new Promise((accept, reject) => {
7498
+ this.getTotals(name, resourceID, filters)
7499
+ .then((result) => {
7500
+ if (result.length > 0) {
7501
+ const totalsData = new Map();
7502
+ result.forEach(total => {
7503
+ totalsData.set(total.name, parseFloat(total.value));
7504
+ });
7505
+ accept(totalsData);
7506
+ }
7507
+ else {
7508
+ reject(`Não foi possível recuperar os totalizadores`);
7509
+ }
7510
+ })
7511
+ .catch((error) => {
7512
+ reject(error);
7513
+ });
7514
+ });
7515
+ }
7516
+ }
7517
+
7518
+ function normalizeValue(value) {
7519
+ if (value instanceof Date) {
7520
+ return value.toISOString();
7521
+ }
7522
+ if (typeof value === "object") {
7523
+ const normalized = Object.assign({}, value);
7524
+ Object.keys(value).forEach(prop => {
7525
+ if (value[prop]) {
7526
+ normalized[prop] = normalizeValue(value[prop]);
7527
+ }
7528
+ else {
7529
+ delete normalized[prop];
7530
+ }
7531
+ });
7532
+ return normalized;
7533
+ }
7534
+ return value;
7535
+ }
7536
+ class FilterBarConfigFetcher extends ResourceFetcher {
7537
+ saveConfig(items, resourceID, configName) {
7538
+ const state = items.map(item => {
7539
+ const { id, value, fixed, visible } = item;
7540
+ const stateItem = { id };
7541
+ if (value) {
7542
+ stateItem["value"] = normalizeValue(value);
7543
+ }
7544
+ if (fixed) {
7545
+ stateItem["fixed"] = fixed;
7546
+ }
7547
+ if (visible) {
7548
+ stateItem["visible"] = true;
7549
+ }
7550
+ return stateItem;
7551
+ });
7552
+ return this.saveResource(state, `cfg://filter/FilterBarState:${resourceID}/${configName}`);
7553
+ }
7554
+ getConfig(resourceID, configName) {
7555
+ return new Promise((accept, reject) => {
7556
+ this.loadResource(`cfg://filter/FilterBarState:${resourceID}/${configName}`)
7557
+ .then((configAsString) => {
7558
+ let fieldsList;
7559
+ if (configAsString) {
7560
+ const filterBarConfig = JSON.parse(configAsString);
7561
+ fieldsList = filterBarConfig.items;
7562
+ }
7563
+ accept(fieldsList || []);
7564
+ })
7565
+ .catch((error) => {
7566
+ reject(error);
7567
+ });
7568
+ });
7569
+ }
7570
+ }
7571
+
7250
7572
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
7251
7573
 
7252
7574
  const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -7255,6 +7577,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7255
7577
  this.__registerHost();
7256
7578
  this.applicationLoaded = createEvent(this, "applicationLoaded", 7);
7257
7579
  this.applicationLoading = createEvent(this, "applicationLoading", 7);
7580
+ this._authPromises = [];
7581
+ this._duCache = new Map();
7582
+ this._duPromises = new Map();
7258
7583
  this._requestListener = new RequestListenerLoadingBar();
7259
7584
  }
7260
7585
  get parameters() {
@@ -7273,18 +7598,31 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7273
7598
  return this._resourceID;
7274
7599
  }
7275
7600
  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
- });
7601
+ if (this._auth) {
7602
+ return Promise.resolve(this._auth);
7603
+ }
7604
+ else {
7605
+ return new Promise((resolve, reject) => {
7606
+ const waitingAuth = this._authPromises.length > 0;
7607
+ this._authPromises.push(new PendingPromise(resolve, reject));
7608
+ if (!waitingAuth) {
7609
+ this.authFetcher.getData(this.resourceID).then((authList) => {
7610
+ this._auth = authList;
7611
+ while (this._authPromises.length > 0) {
7612
+ this._authPromises.pop().resolve(this._auth);
7613
+ }
7614
+ }).catch(error => {
7615
+ while (this._authPromises.length > 0) {
7616
+ this._authPromises.pop().reject(error);
7617
+ }
7618
+ });
7619
+ }
7620
+ });
7621
+ }
7287
7622
  }
7623
+ /**
7624
+ * Caso o usuário logado seja o SUP.
7625
+ */
7288
7626
  async isUserSup() {
7289
7627
  return new Promise((resolve, reject) => {
7290
7628
  this.auth.then((authorization) => {
@@ -7294,6 +7632,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7294
7632
  });
7295
7633
  });
7296
7634
  }
7635
+ /**
7636
+ * Se o usuário logado tem permissão pra determinada ação.
7637
+ */
7297
7638
  async hasAccess(access) {
7298
7639
  return new Promise((resolve, reject) => {
7299
7640
  this.auth.then((authorization) => {
@@ -7303,6 +7644,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7303
7644
  });
7304
7645
  });
7305
7646
  }
7647
+ /**
7648
+ * Retorna todos os acessos do usuário logado.
7649
+ */
7306
7650
  async getAllAccess() {
7307
7651
  return new Promise((resolve, reject) => {
7308
7652
  this.auth.then((authorization) => {
@@ -7317,33 +7661,54 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7317
7661
  });
7318
7662
  });
7319
7663
  }
7320
- async getAuthList(_auth) {
7321
- return await (new MGEAuthorization()).parseFromJSON(_auth);
7322
- }
7664
+ /**
7665
+ * Retorna o valor de um parâmetro do tipo string.
7666
+ */
7323
7667
  async getStringParam(name) {
7324
7668
  return this.parameters.asString(name, this.resourceID);
7325
7669
  }
7670
+ /**
7671
+ * Retorna o valor de um parâmetro do tipo Inteiro.
7672
+ */
7326
7673
  async getIntParam(name) {
7327
7674
  return this.parameters.asInteger(name, this.resourceID);
7328
7675
  }
7676
+ /**
7677
+ * Retorna o valor de um parâmetro do tipo Decimal.
7678
+ */
7329
7679
  async getFloatParam(name) {
7330
7680
  return this.parameters.asFloat(name, this.resourceID);
7331
7681
  }
7682
+ /**
7683
+ * Retorna o valor de um parâmetro do tipo booleano.
7684
+ */
7332
7685
  async getBooleanParam(name) {
7333
7686
  return this.parameters.asBoolean(name, this.resourceID);
7334
7687
  }
7688
+ /**
7689
+ * Retorna o valor de um parâmetro do tipo data.
7690
+ */
7335
7691
  async getDateParam(name) {
7336
7692
  return this.parameters.asDate(name, this.resourceID);
7337
7693
  }
7694
+ /**
7695
+ * Mostra o conteúdo passado em um Popup
7696
+ */
7338
7697
  async showPopUp(content) {
7339
7698
  this.clearPopUpContent();
7340
7699
  this._popUp.appendChild(content);
7341
7700
  this._popUp.opened = true;
7342
7701
  }
7702
+ /**
7703
+ * Fecha o popup, liberando o conteúdo.
7704
+ */
7343
7705
  async closePopUp() {
7344
7706
  this.clearPopUpContent();
7345
7707
  this._popUp.opened = false;
7346
7708
  }
7709
+ /**
7710
+ * Verifica se a licença do cliente tem determinado opcional (produto)
7711
+ */
7347
7712
  async temOpcional(opcional) {
7348
7713
  const opts = opcional.split(",");
7349
7714
  return new Promise((resolve, reject) => {
@@ -7367,6 +7732,10 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7367
7732
  });
7368
7733
  });
7369
7734
  }
7735
+ /**
7736
+ * Retorna a configuração de um recurso por service broker
7737
+ * Veja também o método "loadConfig"
7738
+ */
7370
7739
  async getConfig(key) {
7371
7740
  let payload = {
7372
7741
  "serviceName": "SystemUtilsSP.getConf",
@@ -7384,6 +7753,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7384
7753
  .catch(error => reject(error));
7385
7754
  });
7386
7755
  }
7756
+ /**
7757
+ * Salva a configuração de determinado recurso.
7758
+ */
7387
7759
  async saveConfig(key, data) {
7388
7760
  let payload = {
7389
7761
  "serviceName": "SystemUtilsSP.saveConf",
@@ -7402,42 +7774,166 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7402
7774
  .catch(error => reject(error));
7403
7775
  });
7404
7776
  }
7777
+ /**
7778
+ * Acessa informações de contexto "empurrados" na abertura da tela
7779
+ */
7405
7780
  async getAttributeFromHTMLWrapper(attribName) {
7406
7781
  return Promise.resolve(window[attribName]);
7407
7782
  }
7783
+ /**
7784
+ * Abre determinada tela, repassando pkObject
7785
+ */
7408
7786
  async openApp(resourceId, pkObject) {
7409
7787
  Workspace.openAppActivity(resourceId, pkObject);
7410
7788
  }
7411
- async createDataunit(entityName) {
7412
- return new Promise(resolve => {
7413
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7414
- dataUnit.loadMetadata().then(() => resolve(dataUnit));
7789
+ getDuPromissesStack(dataUnitName) {
7790
+ let stack;
7791
+ if (dataUnitName) {
7792
+ stack = this._duPromises.get(dataUnitName);
7793
+ if (!stack) {
7794
+ stack = [];
7795
+ this._duPromises.set(dataUnitName, stack);
7796
+ }
7797
+ }
7798
+ return stack || [];
7799
+ }
7800
+ /**
7801
+ * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
7802
+ * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado
7803
+ */
7804
+ async createDataunit(entityName, dataUnitName) {
7805
+ return new Promise((resolve, reject) => {
7806
+ const duPromisses = this.getDuPromissesStack(dataUnitName);
7807
+ const waitingDu = duPromisses.length > 0;
7808
+ duPromisses.push(new PendingPromise(resolve, reject));
7809
+ if (!waitingDu) {
7810
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7811
+ dataUnit.loadMetadata().then(() => {
7812
+ if (dataUnitName) {
7813
+ this._duCache.set(dataUnitName, dataUnit);
7814
+ }
7815
+ while (duPromisses.length > 0) {
7816
+ duPromisses.pop().resolve(dataUnit);
7817
+ }
7818
+ }).catch(reason => {
7819
+ while (duPromisses.length > 0) {
7820
+ duPromisses.pop().reject(reason);
7821
+ }
7822
+ });
7823
+ }
7415
7824
  });
7416
7825
  }
7826
+ /**
7827
+ * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
7828
+ */
7829
+ async getDataUnit(entityName, dataUnitName) {
7830
+ return new Promise((resolve, reject) => {
7831
+ const dataUnit = this._duCache.get(dataUnitName);
7832
+ if (dataUnit) {
7833
+ resolve(dataUnit);
7834
+ }
7835
+ else {
7836
+ this.createDataunit(entityName, dataUnitName).then(dataUnit => {
7837
+ resolve(dataUnit);
7838
+ }).catch(reason => reject(reason));
7839
+ }
7840
+ });
7841
+ }
7842
+ /**
7843
+ * Retorna o resourceID da tela em questão.
7844
+ */
7417
7845
  async getResourceID() {
7418
7846
  return Promise.resolve(this.resourceID);
7419
7847
  }
7848
+ /**
7849
+ * Mostra o diálogo de alerta de acordo com os parâmetros passados.
7850
+ */
7420
7851
  async alert(title, message, icon, options) {
7421
7852
  return ApplicationUtils.alert(title, message, icon, options);
7422
7853
  }
7854
+ /**
7855
+ * Mostra o diálogo de erro de acordo com os parâmetros passados.
7856
+ */
7423
7857
  async error(title, message, icon, options) {
7424
7858
  return ApplicationUtils.error(title, message, icon, options);
7425
7859
  }
7426
- async confirm(title, message, icon, critical, options) {
7427
- return ApplicationUtils.confirm(title, message, icon, critical, options);
7860
+ /**
7861
+ * Mostra o diálogo de sucesso de acordo com os parâmetros passados.
7862
+ */
7863
+ async success(title, message, icon, options) {
7864
+ return ApplicationUtils.success(title, message, icon, options);
7865
+ }
7866
+ /**
7867
+ * Exibe um diálogo de mensagem comum
7868
+ */
7869
+ async message(title, message, icon, options) {
7870
+ return ApplicationUtils.message(title, message, icon, options);
7428
7871
  }
7872
+ /**
7873
+ * Exibe um diálogo de confirmação
7874
+ */
7875
+ async confirm(title, message, icon, dialogType, options) {
7876
+ return ApplicationUtils.confirm(title, message, icon, dialogType, options);
7877
+ }
7878
+ /**
7879
+ * Mostra uma informação efêmera (de segundo plano).
7880
+ */
7429
7881
  async info(message, options) {
7430
7882
  return ApplicationUtils.info(message, options);
7431
7883
  }
7884
+ /**
7885
+ * Busca a configuração de formulário.
7886
+ */
7432
7887
  async loadFormConfig(name) {
7433
7888
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7434
7889
  }
7435
- async loadGridConfig() {
7436
- return this.gridConfigFetcher.getConfig(this.resourceID);
7890
+ /**
7891
+ * Busca a configuração de grade.
7892
+ */
7893
+ async loadGridConfig(name) {
7894
+ return this.gridConfigFetcher.getConfig(name, this.resourceID);
7437
7895
  }
7896
+ /**
7897
+ * Busca os totalizadores da grade.
7898
+ */
7899
+ async loadTotals(name, resourceID, filters) {
7900
+ return this.totalsFetcher.fetchTotals(name, resourceID, filters);
7901
+ }
7902
+ /**
7903
+ * Salva a configuração de grade.
7904
+ */
7438
7905
  async saveGridConfig(config) {
7439
7906
  return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7440
7907
  }
7908
+ /**
7909
+ * Obtém as configurações da barra de filtros
7910
+ */
7911
+ async getFilterBarConfig(name) {
7912
+ return new Promise((accept, reject) => {
7913
+ if (this.configName === name && this._filterBarConfig) {
7914
+ accept(this._filterBarConfig);
7915
+ }
7916
+ else if (this.configName === name && this._filterConfigPromise != undefined) {
7917
+ Promise.all([this._filterConfigPromise])
7918
+ .then(result => accept(result[0]))
7919
+ .catch(reason => reject(reason[0]));
7920
+ }
7921
+ else {
7922
+ this.filterBarConfigFetcher.getConfig(this.resourceID, name)
7923
+ .then(config => accept(config))
7924
+ .catch(reason => reject(reason));
7925
+ }
7926
+ });
7927
+ }
7928
+ /**
7929
+ * Salva as configurações da barra de filtros
7930
+ */
7931
+ async saveFilterBarConfig(config, name) {
7932
+ return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
7933
+ }
7934
+ async getAuthList(_auth) {
7935
+ return await (new MGEAuthorization()).parseFromJSON(_auth);
7936
+ }
7441
7937
  get urlParams() {
7442
7938
  if (!this._urlParams) {
7443
7939
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -7462,6 +7958,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7462
7958
  }
7463
7959
  return this._gridConfigFetcher;
7464
7960
  }
7961
+ get totalsFetcher() {
7962
+ if (!this._totalsFetcher) {
7963
+ this._totalsFetcher = new TotalsFetcher();
7964
+ }
7965
+ return this._totalsFetcher;
7966
+ }
7465
7967
  get pesquisaFetcher() {
7466
7968
  if (!this._pesquisaFetcher) {
7467
7969
  this._pesquisaFetcher = new PesquisaFetcher();
@@ -7474,9 +7976,17 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7474
7976
  }
7475
7977
  return this._authFetcher;
7476
7978
  }
7979
+ get filterBarConfigFetcher() {
7980
+ if (!this._filterBarConfigFetcher) {
7981
+ this._filterBarConfigFetcher = new FilterBarConfigFetcher();
7982
+ }
7983
+ return this._filterBarConfigFetcher;
7984
+ }
7477
7985
  async executeSearch(searchArgument, fieldName, dataUnit) {
7478
7986
  const descriptor = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(fieldName);
7479
- if (!descriptor) ;
7987
+ if (!descriptor) {
7988
+ //TODO: Implementar mensagem de erro
7989
+ }
7480
7990
  else {
7481
7991
  const { mode, argument } = searchArgument;
7482
7992
  const { ENTITYNAME, CODEFIELD, DESCRIPTIONFIELD, ROOTENTITY, DESCRIPTIONENTITY } = descriptor.properties;
@@ -7508,23 +8018,27 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7508
8018
  }
7509
8019
  }
7510
8020
  });
7511
- if (mode === "ADVANCED") {
7512
- return new Promise(accept => {
7513
- const pesquisaContent = document.createElement("snk-pesquisa");
7514
- pesquisaContent.argument = argument;
7515
- pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
7516
- pesquisaContent.selectItem = (option) => {
7517
- accept(option);
7518
- this.clearPopUpTitle();
7519
- this.closePopUp();
7520
- };
7521
- this.setPopUpTitle(DESCRIPTIONENTITY);
7522
- this.showPopUp(pesquisaContent);
7523
- });
7524
- }
7525
- else {
7526
- return this.pesquisaFetcher.loadSearchOptions(ENTITYNAME, argument, criteria, searchOptions);
7527
- }
8021
+ return this.executePreparedSearch(mode, argument, { entity: ENTITYNAME, entityDescription: DESCRIPTIONENTITY, criteria, searchOptions });
8022
+ }
8023
+ }
8024
+ async executePreparedSearch(mode, argument, options) {
8025
+ const { entity, entityDescription, criteria, searchOptions } = options;
8026
+ if (mode === "ADVANCED") {
8027
+ return new Promise(accept => {
8028
+ const pesquisaContent = document.createElement("snk-pesquisa");
8029
+ pesquisaContent.argument = argument;
8030
+ pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
8031
+ pesquisaContent.selectItem = (option) => {
8032
+ accept(option);
8033
+ this.clearPopUpTitle();
8034
+ this.closePopUp();
8035
+ };
8036
+ this.setPopUpTitle(entityDescription);
8037
+ this.showPopUp(pesquisaContent);
8038
+ });
8039
+ }
8040
+ else {
8041
+ return this.pesquisaFetcher.loadSearchOptions(entity, argument, criteria, searchOptions);
7528
8042
  }
7529
8043
  }
7530
8044
  async isDebugMode() {
@@ -7547,14 +8061,26 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7547
8061
  }
7548
8062
  componentWillLoad() {
7549
8063
  this._errorHandler = new SnkErrorHandler(this);
8064
+ this.messagesBuilder = new SnkMessageBuilder();
7550
8065
  ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
7551
8066
  ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
7552
8067
  return this.executeSearch(searchArgument, fieldName, dataUnit);
7553
8068
  });
7554
8069
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
8070
+ if (this.configName) {
8071
+ this._filterConfigPromise = new Promise((accept, reject) => {
8072
+ this.filterBarConfigFetcher.getConfig(this.resourceID, this.configName)
8073
+ .then(config => {
8074
+ this._filterBarConfig = config;
8075
+ accept(config);
8076
+ })
8077
+ .catch(reason => reject(reason));
8078
+ });
8079
+ }
7555
8080
  ErrorTracking.init();
7556
8081
  }
7557
8082
  connectedCallback() {
8083
+ ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
7558
8084
  DataFetcher.addRequestListener(this._requestListener);
7559
8085
  }
7560
8086
  disconnectedCallback() {
@@ -7571,6 +8097,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7571
8097
  }
7572
8098
  static get style() { return snkApplicationCss; }
7573
8099
  }, [2, "snk-application", {
8100
+ "messagesBuilder": [1040],
8101
+ "configName": [1, "config-name"],
7574
8102
  "isUserSup": [64],
7575
8103
  "hasAccess": [64],
7576
8104
  "getAllAccess": [64],
@@ -7587,31 +8115,45 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7587
8115
  "getAttributeFromHTMLWrapper": [64],
7588
8116
  "openApp": [64],
7589
8117
  "createDataunit": [64],
8118
+ "getDataUnit": [64],
7590
8119
  "getResourceID": [64],
7591
8120
  "alert": [64],
7592
8121
  "error": [64],
8122
+ "success": [64],
8123
+ "message": [64],
7593
8124
  "confirm": [64],
7594
8125
  "info": [64],
7595
8126
  "loadFormConfig": [64],
7596
8127
  "loadGridConfig": [64],
8128
+ "loadTotals": [64],
7597
8129
  "saveGridConfig": [64],
8130
+ "getFilterBarConfig": [64],
8131
+ "saveFilterBarConfig": [64],
7598
8132
  "executeSearch": [64],
8133
+ "executePreparedSearch": [64],
7599
8134
  "isDebugMode": [64]
7600
8135
  }]);
7601
8136
  class RequestListenerLoadingBar {
7602
8137
  constructor() {
7603
8138
  this._debounceTime = 1000;
8139
+ this._ignoredNameTypes = ["totals"];
7604
8140
  this._countRequest = 0;
7605
8141
  }
7606
- onRequestStart() {
7607
- this.loadingBar.show();
8142
+ onRequestStart(param) {
8143
+ if (this.isIgnoreLoadingOnRequest(param)) {
8144
+ return;
8145
+ }
7608
8146
  this._countRequest++;
8147
+ this.loadingBar.show();
7609
8148
  if (this._timerLoading) {
7610
8149
  clearTimeout(this._timerLoading);
7611
8150
  }
7612
8151
  }
7613
8152
  ;
7614
- onRequestEnd() {
8153
+ onRequestEnd(param) {
8154
+ if (this.isIgnoreLoadingOnRequest(param)) {
8155
+ return;
8156
+ }
7615
8157
  this._countRequest--;
7616
8158
  this._timerLoading = setTimeout(() => {
7617
8159
  if (this._countRequest <= 0) {
@@ -7620,6 +8162,25 @@ class RequestListenerLoadingBar {
7620
8162
  }, this._debounceTime);
7621
8163
  }
7622
8164
  ;
8165
+ isIgnoreLoadingOnRequest(param) {
8166
+ var _a;
8167
+ if (((_a = param === null || param === void 0 ? void 0 : param.requestBody) === null || _a === void 0 ? void 0 : _a.length) == 1) {
8168
+ const { name } = param.requestBody[0].variables;
8169
+ if (name) {
8170
+ const nameParts = name.split(":");
8171
+ const nameType = nameParts[0];
8172
+ return this._ignoredNameTypes.indexOf(nameType) >= 0;
8173
+ }
8174
+ }
8175
+ return false;
8176
+ }
8177
+ ;
8178
+ }
8179
+ class PendingPromise {
8180
+ constructor(resolve, reject) {
8181
+ this.resolve = resolve;
8182
+ this.reject = reject;
8183
+ }
7623
8184
  }
7624
8185
  function defineCustomElement() {
7625
8186
  if (typeof customElements === "undefined") {