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