@sankhyalabs/sankhyablocks 1.3.34 → 1.4.0-beta.2

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 (239) hide show
  1. package/dist/cjs/SnkMessageBuilder-d8215915.js +221 -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-3daf58d3.js +16 -0
  6. package/dist/cjs/index-84fe3b86.js +20 -0
  7. package/dist/cjs/index-93965c41.js +141 -0
  8. package/dist/cjs/index-b0b676c5.js +3298 -0
  9. package/dist/cjs/index-e90ae303.js +2408 -0
  10. package/dist/cjs/loader.cjs.js +19 -3
  11. package/dist/cjs/sankhyablocks.cjs.js +117 -5
  12. package/dist/cjs/shadow-css-346c0795.js +389 -0
  13. package/dist/cjs/snk-application.cjs.entry.js +744 -174
  14. package/dist/cjs/snk-crud.cjs.entry.js +70 -0
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +272 -0
  16. package/dist/cjs/snk-filter-bar.cjs.entry.js +466 -0
  17. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +47 -0
  18. package/dist/cjs/snk-filter-detail.cjs.entry.js +84 -0
  19. package/dist/cjs/snk-filter-item.cjs.entry.js +177 -0
  20. package/dist/cjs/snk-filter-list.cjs.entry.js +91 -0
  21. package/dist/cjs/snk-filter-modal.cjs.entry.js +37 -0
  22. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +23 -0
  23. package/dist/cjs/snk-filter-number.cjs.entry.js +24 -0
  24. package/dist/cjs/snk-filter-period.cjs.entry.js +37 -0
  25. package/dist/cjs/snk-filter-personalized.cjs.entry.js +89 -0
  26. package/dist/cjs/snk-filter-search.cjs.entry.js +44 -0
  27. package/dist/cjs/snk-filter-text.cjs.entry.js +22 -0
  28. package/dist/cjs/snk-form.cjs.entry.js +133 -0
  29. package/dist/cjs/snk-grid.cjs.entry.js +79 -0
  30. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
  31. package/dist/cjs/snk-taskbar.cjs.entry.js +160 -0
  32. package/dist/cjs/taskbar-elements-283c737e.js +93 -0
  33. package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
  34. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  35. package/dist/collection/collection-manifest.json +19 -2
  36. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +9 -2
  37. package/dist/collection/components/snk-application/snk-application.js +1179 -627
  38. package/dist/collection/components/snk-crud/snk-crud.css +6 -0
  39. package/dist/collection/components/snk-crud/snk-crud.js +201 -0
  40. package/dist/collection/components/snk-data-unit/snk-data-unit.css +6 -0
  41. package/dist/collection/components/snk-data-unit/snk-data-unit.js +517 -0
  42. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
  43. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +88 -0
  44. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +64 -0
  45. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +65 -0
  46. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +78 -0
  47. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +161 -0
  48. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +118 -0
  49. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +63 -0
  50. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +12 -0
  51. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +153 -0
  52. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +278 -0
  53. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +233 -0
  54. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +196 -0
  55. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +136 -0
  56. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +452 -0
  57. package/dist/collection/components/snk-form/snk-form.css +34 -0
  58. package/dist/collection/components/snk-form/snk-form.js +258 -0
  59. package/dist/collection/components/snk-grid/snk-grid.css +18 -0
  60. package/dist/collection/components/snk-grid/snk-grid.js +203 -0
  61. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -79
  62. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +86 -0
  63. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
  64. package/dist/collection/components/snk-taskbar/snk-taskbar.css +3 -0
  65. package/dist/collection/components/snk-taskbar/snk-taskbar.js +307 -0
  66. package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
  67. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +37 -12
  68. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +52 -21
  69. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +62 -0
  70. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +4 -3
  71. package/dist/collection/lib/http/data-fetcher/fetchers/totals-fetcher.js +47 -0
  72. package/dist/collection/lib/index.js +1 -0
  73. package/dist/collection/lib/message/SnkMessageBuilder.js +121 -0
  74. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +23 -0
  75. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +30 -0
  76. package/dist/collection/lib/message/resources/snk-form.msg.js +10 -0
  77. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +17 -0
  78. package/dist/components/SnkMessageBuilder.js +199 -0
  79. package/dist/components/filter-item-type.enum.js +14 -0
  80. package/dist/components/index.d.ts +20 -5
  81. package/dist/components/index.js +24 -0
  82. package/dist/components/index2.js +2394 -0
  83. package/dist/components/index3.js +139 -0
  84. package/dist/components/snk-application2.js +727 -146
  85. package/dist/components/snk-crud.d.ts +11 -0
  86. package/dist/components/snk-crud.js +139 -0
  87. package/dist/components/snk-data-unit.d.ts +11 -0
  88. package/dist/components/snk-data-unit.js +294 -0
  89. package/dist/components/snk-filter-bar.d.ts +11 -0
  90. package/dist/components/snk-filter-bar.js +6 -0
  91. package/dist/components/snk-filter-bar2.js +504 -0
  92. package/dist/components/snk-filter-binary-select.d.ts +11 -0
  93. package/dist/components/snk-filter-binary-select.js +63 -0
  94. package/dist/components/snk-filter-detail.d.ts +11 -0
  95. package/dist/components/snk-filter-detail.js +6 -0
  96. package/dist/components/snk-filter-detail2.js +98 -0
  97. package/dist/components/snk-filter-item.d.ts +11 -0
  98. package/dist/components/snk-filter-item.js +6 -0
  99. package/dist/components/snk-filter-item2.js +198 -0
  100. package/dist/components/snk-filter-list.d.ts +11 -0
  101. package/dist/components/snk-filter-list.js +6 -0
  102. package/dist/components/snk-filter-list2.js +111 -0
  103. package/dist/components/snk-filter-modal.d.ts +11 -0
  104. package/dist/components/snk-filter-modal.js +6 -0
  105. package/dist/components/snk-filter-modal2.js +73 -0
  106. package/dist/components/snk-filter-multi-select.d.ts +11 -0
  107. package/dist/components/snk-filter-multi-select.js +39 -0
  108. package/dist/components/snk-filter-number.d.ts +11 -0
  109. package/dist/components/snk-filter-number.js +40 -0
  110. package/dist/components/snk-filter-period.d.ts +11 -0
  111. package/dist/components/snk-filter-period.js +53 -0
  112. package/dist/components/snk-filter-personalized.d.ts +11 -0
  113. package/dist/components/snk-filter-personalized.js +107 -0
  114. package/dist/components/snk-filter-search.d.ts +11 -0
  115. package/dist/components/snk-filter-search.js +62 -0
  116. package/dist/components/snk-filter-text.d.ts +11 -0
  117. package/dist/components/snk-filter-text.js +38 -0
  118. package/dist/components/snk-form.d.ts +11 -0
  119. package/dist/components/snk-form.js +6 -0
  120. package/dist/components/snk-form2.js +159 -0
  121. package/dist/components/snk-grid.d.ts +11 -0
  122. package/dist/components/snk-grid.js +6 -0
  123. package/dist/components/snk-grid2.js +133 -0
  124. package/dist/components/snk-pesquisa2.js +1 -1
  125. package/dist/components/snk-taskbar.d.ts +11 -0
  126. package/dist/components/snk-taskbar.js +6 -0
  127. package/dist/components/snk-taskbar2.js +264 -0
  128. package/dist/components/taskbar-processor.js +45 -0
  129. package/dist/components/teste-pesquisa.js +1 -1
  130. package/dist/esm/SnkMessageBuilder-35a20271.js +199 -0
  131. package/dist/esm/app-globals-0f993ce5.js +3 -0
  132. package/dist/esm/css-shim-b3f2ee8d.js +4 -0
  133. package/dist/esm/dom-665d6011.js +73 -0
  134. package/dist/esm/filter-item-type.enum-a79b2fa8.js +14 -0
  135. package/dist/esm/index-2b4d2d14.js +3262 -0
  136. package/dist/esm/index-5992b7e6.js +139 -0
  137. package/dist/esm/index-c683b2b0.js +2394 -0
  138. package/dist/esm/index-c71285cb.js +17 -0
  139. package/dist/esm/loader.js +19 -3
  140. package/dist/esm/polyfills/css-shim.js +1 -1
  141. package/dist/esm/sankhyablocks.js +117 -5
  142. package/dist/esm/shadow-css-b18e99d7.js +387 -0
  143. package/dist/esm/snk-application.entry.js +717 -147
  144. package/dist/esm/snk-crud.entry.js +66 -0
  145. package/dist/esm/snk-data-unit.entry.js +268 -0
  146. package/dist/esm/snk-filter-bar.entry.js +462 -0
  147. package/dist/esm/snk-filter-binary-select.entry.js +43 -0
  148. package/dist/esm/snk-filter-detail.entry.js +80 -0
  149. package/dist/esm/snk-filter-item.entry.js +173 -0
  150. package/dist/esm/snk-filter-list.entry.js +87 -0
  151. package/dist/esm/snk-filter-modal.entry.js +33 -0
  152. package/dist/esm/snk-filter-multi-select.entry.js +19 -0
  153. package/dist/esm/snk-filter-number.entry.js +20 -0
  154. package/dist/esm/snk-filter-period.entry.js +33 -0
  155. package/dist/esm/snk-filter-personalized.entry.js +85 -0
  156. package/dist/esm/snk-filter-search.entry.js +40 -0
  157. package/dist/esm/snk-filter-text.entry.js +18 -0
  158. package/dist/esm/snk-form.entry.js +129 -0
  159. package/dist/esm/snk-grid.entry.js +75 -0
  160. package/dist/esm/snk-pesquisa.entry.js +2 -2
  161. package/dist/esm/snk-taskbar.entry.js +156 -0
  162. package/dist/esm/taskbar-elements-35d64ff9.js +90 -0
  163. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  164. package/dist/esm/teste-pesquisa.entry.js +2 -2
  165. package/dist/sankhyablocks/SnkMessageBuilder-35a20271.js +199 -0
  166. package/dist/sankhyablocks/app-globals-0f993ce5.js +3 -0
  167. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +4 -0
  168. package/dist/sankhyablocks/dom-665d6011.js +73 -0
  169. package/dist/sankhyablocks/filter-item-type.enum-a79b2fa8.js +14 -0
  170. package/dist/sankhyablocks/index-2b4d2d14.js +3262 -0
  171. package/dist/sankhyablocks/index-5992b7e6.js +139 -0
  172. package/dist/sankhyablocks/index-c683b2b0.js +2394 -0
  173. package/dist/sankhyablocks/index-c71285cb.js +17 -0
  174. package/dist/sankhyablocks/index.esm.js +1 -0
  175. package/dist/sankhyablocks/sankhyablocks.esm.js +129 -1
  176. package/dist/sankhyablocks/shadow-css-b18e99d7.js +387 -0
  177. package/dist/sankhyablocks/snk-application.entry.js +8166 -0
  178. package/dist/sankhyablocks/snk-crud.entry.js +66 -0
  179. package/dist/sankhyablocks/snk-data-unit.entry.js +268 -0
  180. package/dist/sankhyablocks/snk-filter-bar.entry.js +462 -0
  181. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +43 -0
  182. package/dist/sankhyablocks/snk-filter-detail.entry.js +80 -0
  183. package/dist/sankhyablocks/snk-filter-item.entry.js +173 -0
  184. package/dist/sankhyablocks/snk-filter-list.entry.js +87 -0
  185. package/dist/sankhyablocks/snk-filter-modal.entry.js +33 -0
  186. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +19 -0
  187. package/dist/sankhyablocks/snk-filter-number.entry.js +20 -0
  188. package/dist/sankhyablocks/snk-filter-period.entry.js +33 -0
  189. package/dist/sankhyablocks/snk-filter-personalized.entry.js +85 -0
  190. package/dist/sankhyablocks/snk-filter-search.entry.js +40 -0
  191. package/dist/sankhyablocks/snk-filter-text.entry.js +18 -0
  192. package/dist/sankhyablocks/snk-form.entry.js +129 -0
  193. package/dist/sankhyablocks/snk-grid.entry.js +75 -0
  194. package/dist/sankhyablocks/snk-pesquisa.entry.js +311 -0
  195. package/dist/sankhyablocks/snk-taskbar.entry.js +156 -0
  196. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +90 -0
  197. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +45 -0
  198. package/dist/sankhyablocks/teste-pesquisa.entry.js +33 -0
  199. package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
  200. package/dist/types/components/snk-application/snk-application.d.ts +149 -16
  201. package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
  202. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
  203. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +7 -0
  204. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +7 -0
  205. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +14 -0
  206. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +23 -0
  207. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +12 -0
  208. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +7 -0
  209. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +11 -0
  210. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +16 -0
  211. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +40 -0
  212. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +23 -0
  213. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +29 -0
  214. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
  215. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +84 -0
  216. package/dist/types/components.d.ts +744 -8
  217. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -6
  218. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
  219. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +6 -0
  220. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
  221. package/dist/types/lib/http/data-fetcher/fetchers/totals-fetcher.d.ts +8 -0
  222. package/dist/types/lib/index.d.ts +1 -0
  223. package/dist/types/lib/message/SnkMessageBuilder.d.ts +42 -0
  224. package/dist/types/lib/message/resources/snk-data-unit.msg.d.ts +2 -0
  225. package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
  226. package/dist/types/lib/message/resources/snk-form.msg.d.ts +2 -0
  227. package/dist/types/lib/message/resources/snk-taskbar.msg.d.ts +2 -0
  228. package/dist/types/stencil-public-runtime.d.ts +15 -4
  229. package/loader/package.json +1 -0
  230. package/package.json +5 -5
  231. package/react/components.d.ts +0 -2
  232. package/react/components.js +0 -2
  233. package/react/components.js.map +1 -1
  234. package/dist/cjs/index-1133bc2a.js +0 -1235
  235. package/dist/esm/index-ffda6382.js +0 -1208
  236. package/dist/sankhyablocks/p-2a7b4cb3.entry.js +0 -1
  237. package/dist/sankhyablocks/p-9520d78a.entry.js +0 -1
  238. package/dist/sankhyablocks/p-98e8490d.entry.js +0 -69
  239. package/dist/sankhyablocks/p-edcb9d8e.js +0 -2
@@ -1,20 +1,47 @@
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, d as DateUtils, O as ObjectUtils, e as WaitingChangeException, f as DependencyType, A as ApplicationContext, g as ErrorTracking } from './index-c683b2b0.js';
3
+ import { A as ApplicationUtils } from './index-5992b7e6.js';
4
+ import { S as SnkMessageBuilder } from './SnkMessageBuilder-35a20271.js';
5
5
 
6
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
7
7
 
8
+ function getDefaultExportFromCjs (x) {
9
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
10
+ }
11
+
8
12
  function createCommonjsModule(fn, basedir, module) {
9
13
  return module = {
10
14
  path: basedir,
11
15
  exports: {},
12
16
  require: function (path, base) {
13
- return commonjsRequire();
17
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
14
18
  }
15
19
  }, fn(module, module.exports), module.exports;
16
20
  }
17
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
+
18
45
  function commonjsRequire () {
19
46
  throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
20
47
  }
@@ -31,7 +58,7 @@ return new F();
31
58
  })();
32
59
  (function(self) {
33
60
 
34
- ((function (exports) {
61
+ var irrelevant = (function (exports) {
35
62
 
36
63
  var support = {
37
64
  searchParams: 'URLSearchParams' in self,
@@ -559,7 +586,7 @@ return new F();
559
586
 
560
587
  return exports;
561
588
 
562
- }))({});
589
+ })({});
563
590
  })(__self__);
564
591
  __self__.fetch.ponyfill = true;
565
592
  // Remove "polyfill" property added by whatwg-fetch
@@ -576,7 +603,10 @@ exports.Response = ctx.Response;
576
603
  module.exports = exports;
577
604
  });
578
605
 
606
+ const browserPonyfill$1 = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill);
607
+
579
608
  var isObjectLike_1 = createCommonjsModule(function (module, exports) {
609
+ 'use strict';
580
610
 
581
611
  Object.defineProperty(exports, '__esModule', {
582
612
  value: true,
@@ -592,7 +622,10 @@ function isObjectLike(value) {
592
622
  }
593
623
  });
594
624
 
625
+ const isObjectLike = /*@__PURE__*/getDefaultExportFromCjs(isObjectLike_1);
626
+
595
627
  var invariant_1 = createCommonjsModule(function (module, exports) {
628
+ 'use strict';
596
629
 
597
630
  Object.defineProperty(exports, '__esModule', {
598
631
  value: true,
@@ -610,7 +643,10 @@ function invariant(condition, message) {
610
643
  }
611
644
  });
612
645
 
646
+ const invariant = /*@__PURE__*/getDefaultExportFromCjs(invariant_1);
647
+
613
648
  var location_1 = createCommonjsModule(function (module, exports) {
649
+ 'use strict';
614
650
 
615
651
  Object.defineProperty(exports, '__esModule', {
616
652
  value: true,
@@ -650,7 +686,10 @@ function getLocation(source, position) {
650
686
  }
651
687
  });
652
688
 
689
+ const location$1 = /*@__PURE__*/getDefaultExportFromCjs(location_1);
690
+
653
691
  var printLocation_1 = createCommonjsModule(function (module, exports) {
692
+ 'use strict';
654
693
 
655
694
  Object.defineProperty(exports, '__esModule', {
656
695
  value: true,
@@ -726,7 +765,10 @@ function printPrefixedLines(lines) {
726
765
  }
727
766
  });
728
767
 
768
+ const printLocation = /*@__PURE__*/getDefaultExportFromCjs(printLocation_1);
769
+
729
770
  var GraphQLError_1 = createCommonjsModule(function (module, exports) {
771
+ 'use strict';
730
772
 
731
773
  Object.defineProperty(exports, '__esModule', {
732
774
  value: true,
@@ -995,7 +1037,10 @@ function formatError(error) {
995
1037
  }
996
1038
  });
997
1039
 
1040
+ const GraphQLError = /*@__PURE__*/getDefaultExportFromCjs(GraphQLError_1);
1041
+
998
1042
  var syntaxError_1 = createCommonjsModule(function (module, exports) {
1043
+ 'use strict';
999
1044
 
1000
1045
  Object.defineProperty(exports, '__esModule', {
1001
1046
  value: true,
@@ -1016,7 +1061,10 @@ function syntaxError(source, position, description) {
1016
1061
  }
1017
1062
  });
1018
1063
 
1064
+ const syntaxError = /*@__PURE__*/getDefaultExportFromCjs(syntaxError_1);
1065
+
1019
1066
  var ast = createCommonjsModule(function (module, exports) {
1067
+ 'use strict';
1020
1068
 
1021
1069
  Object.defineProperty(exports, '__esModule', {
1022
1070
  value: true,
@@ -1232,7 +1280,7 @@ function isNode(maybeNode) {
1232
1280
  }
1233
1281
  /** Name */
1234
1282
 
1235
- let OperationTypeNode;
1283
+ var OperationTypeNode;
1236
1284
  exports.OperationTypeNode = OperationTypeNode;
1237
1285
 
1238
1286
  (function (OperationTypeNode) {
@@ -1242,7 +1290,10 @@ exports.OperationTypeNode = OperationTypeNode;
1242
1290
  })(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {}));
1243
1291
  });
1244
1292
 
1293
+ const ast$1 = /*@__PURE__*/getDefaultExportFromCjs(ast);
1294
+
1245
1295
  var directiveLocation = createCommonjsModule(function (module, exports) {
1296
+ 'use strict';
1246
1297
 
1247
1298
  Object.defineProperty(exports, '__esModule', {
1248
1299
  value: true,
@@ -1252,13 +1303,7 @@ exports.DirectiveLocation = void 0;
1252
1303
  /**
1253
1304
  * The set of allowed directive location values.
1254
1305
  */
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
-
1306
+ var DirectiveLocation;
1262
1307
  exports.DirectiveLocation = DirectiveLocation;
1263
1308
 
1264
1309
  (function (DirectiveLocation) {
@@ -1282,9 +1327,17 @@ exports.DirectiveLocation = DirectiveLocation;
1282
1327
  DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
1283
1328
  DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
1284
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
+ */
1285
1335
  });
1286
1336
 
1337
+ const directiveLocation$1 = /*@__PURE__*/getDefaultExportFromCjs(directiveLocation);
1338
+
1287
1339
  var kinds = createCommonjsModule(function (module, exports) {
1340
+ 'use strict';
1288
1341
 
1289
1342
  Object.defineProperty(exports, '__esModule', {
1290
1343
  value: true,
@@ -1294,13 +1347,7 @@ exports.Kind = void 0;
1294
1347
  /**
1295
1348
  * The set of allowed kind values for AST nodes.
1296
1349
  */
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
-
1350
+ var Kind;
1304
1351
  exports.Kind = Kind;
1305
1352
 
1306
1353
  (function (Kind) {
@@ -1348,9 +1395,17 @@ exports.Kind = Kind;
1348
1395
  Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';
1349
1396
  Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';
1350
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
+ */
1351
1403
  });
1352
1404
 
1405
+ const kinds$1 = /*@__PURE__*/getDefaultExportFromCjs(kinds);
1406
+
1353
1407
  var characterClasses = createCommonjsModule(function (module, exports) {
1408
+ 'use strict';
1354
1409
 
1355
1410
  Object.defineProperty(exports, '__esModule', {
1356
1411
  value: true,
@@ -1427,7 +1482,10 @@ function isNameContinue(code) {
1427
1482
  }
1428
1483
  });
1429
1484
 
1485
+ const characterClasses$1 = /*@__PURE__*/getDefaultExportFromCjs(characterClasses);
1486
+
1430
1487
  var blockString = createCommonjsModule(function (module, exports) {
1488
+ 'use strict';
1431
1489
 
1432
1490
  Object.defineProperty(exports, '__esModule', {
1433
1491
  value: true,
@@ -1624,7 +1682,10 @@ function printBlockString(value, options) {
1624
1682
  }
1625
1683
  });
1626
1684
 
1685
+ const blockString$1 = /*@__PURE__*/getDefaultExportFromCjs(blockString);
1686
+
1627
1687
  var tokenKind = createCommonjsModule(function (module, exports) {
1688
+ 'use strict';
1628
1689
 
1629
1690
  Object.defineProperty(exports, '__esModule', {
1630
1691
  value: true,
@@ -1635,13 +1696,7 @@ exports.TokenKind = void 0;
1635
1696
  * An exported enum describing the different kinds of tokens that the
1636
1697
  * lexer emits.
1637
1698
  */
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
-
1699
+ var TokenKind;
1645
1700
  exports.TokenKind = TokenKind;
1646
1701
 
1647
1702
  (function (TokenKind) {
@@ -1668,9 +1723,17 @@ exports.TokenKind = TokenKind;
1668
1723
  TokenKind['BLOCK_STRING'] = 'BlockString';
1669
1724
  TokenKind['COMMENT'] = 'Comment';
1670
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
+ */
1671
1731
  });
1672
1732
 
1733
+ const tokenKind$1 = /*@__PURE__*/getDefaultExportFromCjs(tokenKind);
1734
+
1673
1735
  var lexer = createCommonjsModule(function (module, exports) {
1736
+ 'use strict';
1674
1737
 
1675
1738
  Object.defineProperty(exports, '__esModule', {
1676
1739
  value: true,
@@ -2678,7 +2741,10 @@ function readName(lexer, start) {
2678
2741
  }
2679
2742
  });
2680
2743
 
2744
+ const lexer$1 = /*@__PURE__*/getDefaultExportFromCjs(lexer);
2745
+
2681
2746
  var devAssert_1 = createCommonjsModule(function (module, exports) {
2747
+ 'use strict';
2682
2748
 
2683
2749
  Object.defineProperty(exports, '__esModule', {
2684
2750
  value: true,
@@ -2694,7 +2760,10 @@ function devAssert(condition, message) {
2694
2760
  }
2695
2761
  });
2696
2762
 
2763
+ const devAssert = /*@__PURE__*/getDefaultExportFromCjs(devAssert_1);
2764
+
2697
2765
  var inspect_1 = createCommonjsModule(function (module, exports) {
2766
+ 'use strict';
2698
2767
 
2699
2768
  Object.defineProperty(exports, '__esModule', {
2700
2769
  value: true,
@@ -2817,7 +2886,10 @@ function getObjectTag(object) {
2817
2886
  }
2818
2887
  });
2819
2888
 
2889
+ const inspect = /*@__PURE__*/getDefaultExportFromCjs(inspect_1);
2890
+
2820
2891
  var instanceOf_1 = createCommonjsModule(function (module, exports) {
2892
+ 'use strict';
2821
2893
 
2822
2894
  Object.defineProperty(exports, '__esModule', {
2823
2895
  value: true,
@@ -2836,14 +2908,54 @@ const instanceOf =
2836
2908
  /* c8 ignore next 6 */
2837
2909
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
2838
2910
  // eslint-disable-next-line no-undef
2839
- function instanceOf(value, constructor) {
2911
+ "development" === 'production'
2912
+ ? function instanceOf(value, constructor) {
2840
2913
  return value instanceof constructor;
2841
2914
  }
2842
- ;
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
+ };
2843
2952
  exports.instanceOf = instanceOf;
2844
2953
  });
2845
2954
 
2955
+ const instanceOf = /*@__PURE__*/getDefaultExportFromCjs(instanceOf_1);
2956
+
2846
2957
  var source = createCommonjsModule(function (module, exports) {
2958
+ 'use strict';
2847
2959
 
2848
2960
  Object.defineProperty(exports, '__esModule', {
2849
2961
  value: true,
@@ -2910,7 +3022,10 @@ function isSource(source) {
2910
3022
  }
2911
3023
  });
2912
3024
 
3025
+ const source$1 = /*@__PURE__*/getDefaultExportFromCjs(source);
3026
+
2913
3027
  var parser = createCommonjsModule(function (module, exports) {
3028
+ 'use strict';
2914
3029
 
2915
3030
  Object.defineProperty(exports, '__esModule', {
2916
3031
  value: true,
@@ -3004,12 +3119,13 @@ function parseType(source, options) {
3004
3119
  */
3005
3120
 
3006
3121
  class Parser {
3007
- constructor(source$1, options) {
3122
+ constructor(source$1, options = {}) {
3008
3123
  const sourceObj = (0, source.isSource)(source$1)
3009
3124
  ? source$1
3010
3125
  : new source.Source(source$1);
3011
3126
  this._lexer = new lexer.Lexer(sourceObj);
3012
3127
  this._options = options;
3128
+ this._tokenCounter = 0;
3013
3129
  }
3014
3130
  /**
3015
3131
  * Converts a name lex token into a name parse node.
@@ -3344,18 +3460,12 @@ class Parser {
3344
3460
  */
3345
3461
 
3346
3462
  parseFragmentDefinition() {
3347
- var _this$_options;
3348
-
3349
3463
  const start = this._lexer.token;
3350
3464
  this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes
3351
3465
  // the grammar of FragmentDefinition:
3352
3466
  // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
3353
3467
 
3354
- if (
3355
- ((_this$_options = this._options) === null || _this$_options === void 0
3356
- ? void 0
3357
- : _this$_options.allowLegacyFragmentVariables) === true
3358
- ) {
3468
+ if (this._options.allowLegacyFragmentVariables === true) {
3359
3469
  return this.node(start, {
3360
3470
  kind: kinds.Kind.FRAGMENT_DEFINITION,
3361
3471
  name: this.parseFragmentName(),
@@ -3416,16 +3526,14 @@ class Parser {
3416
3526
  return this.parseObject(isConst);
3417
3527
 
3418
3528
  case tokenKind.TokenKind.INT:
3419
- this._lexer.advance();
3420
-
3529
+ this.advanceLexer();
3421
3530
  return this.node(token, {
3422
3531
  kind: kinds.Kind.INT,
3423
3532
  value: token.value,
3424
3533
  });
3425
3534
 
3426
3535
  case tokenKind.TokenKind.FLOAT:
3427
- this._lexer.advance();
3428
-
3536
+ this.advanceLexer();
3429
3537
  return this.node(token, {
3430
3538
  kind: kinds.Kind.FLOAT,
3431
3539
  value: token.value,
@@ -3436,7 +3544,7 @@ class Parser {
3436
3544
  return this.parseStringLiteral();
3437
3545
 
3438
3546
  case tokenKind.TokenKind.NAME:
3439
- this._lexer.advance();
3547
+ this.advanceLexer();
3440
3548
 
3441
3549
  switch (token.value) {
3442
3550
  case 'true':
@@ -3492,9 +3600,7 @@ class Parser {
3492
3600
 
3493
3601
  parseStringLiteral() {
3494
3602
  const token = this._lexer.token;
3495
-
3496
- this._lexer.advance();
3497
-
3603
+ this.advanceLexer();
3498
3604
  return this.node(token, {
3499
3605
  kind: kinds.Kind.STRING,
3500
3606
  value: token.value,
@@ -4285,13 +4391,7 @@ class Parser {
4285
4391
  */
4286
4392
 
4287
4393
  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
- ) {
4394
+ if (this._options.noLocation !== true) {
4295
4395
  node.loc = new ast.Location(
4296
4396
  startToken,
4297
4397
  this._lexer.lastToken,
@@ -4317,8 +4417,7 @@ class Parser {
4317
4417
  const token = this._lexer.token;
4318
4418
 
4319
4419
  if (token.kind === kind) {
4320
- this._lexer.advance();
4321
-
4420
+ this.advanceLexer();
4322
4421
  return token;
4323
4422
  }
4324
4423
 
@@ -4337,8 +4436,7 @@ class Parser {
4337
4436
  const token = this._lexer.token;
4338
4437
 
4339
4438
  if (token.kind === kind) {
4340
- this._lexer.advance();
4341
-
4439
+ this.advanceLexer();
4342
4440
  return true;
4343
4441
  }
4344
4442
 
@@ -4353,7 +4451,7 @@ class Parser {
4353
4451
  const token = this._lexer.token;
4354
4452
 
4355
4453
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4356
- this._lexer.advance();
4454
+ this.advanceLexer();
4357
4455
  } else {
4358
4456
  throw (0, syntaxError_1.syntaxError)(
4359
4457
  this._lexer.source,
@@ -4371,8 +4469,7 @@ class Parser {
4371
4469
  const token = this._lexer.token;
4372
4470
 
4373
4471
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4374
- this._lexer.advance();
4375
-
4472
+ this.advanceLexer();
4376
4473
  return true;
4377
4474
  }
4378
4475
 
@@ -4459,6 +4556,24 @@ class Parser {
4459
4556
 
4460
4557
  return nodes;
4461
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
+ }
4462
4577
  }
4463
4578
  /**
4464
4579
  * A helper function to describe a token as a string for debugging.
@@ -4479,7 +4594,10 @@ function getTokenKindDesc(kind) {
4479
4594
  }
4480
4595
  });
4481
4596
 
4597
+ const parser$1 = /*@__PURE__*/getDefaultExportFromCjs(parser);
4598
+
4482
4599
  var printString_1 = createCommonjsModule(function (module, exports) {
4600
+ 'use strict';
4483
4601
 
4484
4602
  Object.defineProperty(exports, '__esModule', {
4485
4603
  value: true,
@@ -4664,7 +4782,10 @@ const escapeSequences = [
4664
4782
  ];
4665
4783
  });
4666
4784
 
4785
+ const printString = /*@__PURE__*/getDefaultExportFromCjs(printString_1);
4786
+
4667
4787
  var visitor = createCommonjsModule(function (module, exports) {
4788
+ 'use strict';
4668
4789
 
4669
4790
  Object.defineProperty(exports, '__esModule', {
4670
4791
  value: true,
@@ -5043,7 +5164,10 @@ function getVisitFn(visitor, kind, isLeaving) {
5043
5164
  }
5044
5165
  });
5045
5166
 
5167
+ const visitor$1 = /*@__PURE__*/getDefaultExportFromCjs(visitor);
5168
+
5046
5169
  var printer = createCommonjsModule(function (module, exports) {
5170
+ 'use strict';
5047
5171
 
5048
5172
  Object.defineProperty(exports, '__esModule', {
5049
5173
  value: true,
@@ -5396,6 +5520,10 @@ function hasMultilineItems(maybeArray) {
5396
5520
  }
5397
5521
  });
5398
5522
 
5523
+ const printer$1 = /*@__PURE__*/getDefaultExportFromCjs(printer);
5524
+
5525
+ 'use strict';
5526
+
5399
5527
  var ReactNativeFile$1 = function ReactNativeFile(_ref) {
5400
5528
  var uri = _ref.uri,
5401
5529
  name = _ref.name,
@@ -5405,6 +5533,10 @@ var ReactNativeFile$1 = function ReactNativeFile(_ref) {
5405
5533
  this.type = type;
5406
5534
  };
5407
5535
 
5536
+ 'use strict';
5537
+
5538
+
5539
+
5408
5540
  var isExtractableFile$1 = function isExtractableFile(value) {
5409
5541
  return (
5410
5542
  (typeof File !== 'undefined' && value instanceof File) ||
@@ -5413,6 +5545,10 @@ var isExtractableFile$1 = function isExtractableFile(value) {
5413
5545
  );
5414
5546
  };
5415
5547
 
5548
+ 'use strict';
5549
+
5550
+
5551
+
5416
5552
  var extractFiles$1 = function extractFiles(value, path, isExtractableFile) {
5417
5553
  if (path === void 0) {
5418
5554
  path = '';
@@ -5464,6 +5600,8 @@ var extractFiles$1 = function extractFiles(value, path, isExtractableFile) {
5464
5600
  };
5465
5601
  };
5466
5602
 
5603
+ 'use strict';
5604
+
5467
5605
  var ReactNativeFile = ReactNativeFile$1;
5468
5606
  var extractFiles = extractFiles$1;
5469
5607
  var isExtractableFile = isExtractableFile$1;
@@ -5478,6 +5616,7 @@ var _public = {
5478
5616
  var browser = typeof self == 'object' ? self.FormData : window.FormData;
5479
5617
 
5480
5618
  var defaultJsonSerializer = createCommonjsModule(function (module, exports) {
5619
+ "use strict";
5481
5620
  Object.defineProperty(exports, "__esModule", { value: true });
5482
5621
  exports.defaultJsonSerializer = void 0;
5483
5622
  exports.defaultJsonSerializer = {
@@ -5487,7 +5626,10 @@ exports.defaultJsonSerializer = {
5487
5626
  //# sourceMappingURL=defaultJsonSerializer.js.map
5488
5627
  });
5489
5628
 
5629
+ const defaultJsonSerializer$1 = /*@__PURE__*/getDefaultExportFromCjs(defaultJsonSerializer);
5630
+
5490
5631
  var createRequestBody_1 = createCommonjsModule(function (module, exports) {
5632
+ "use strict";
5491
5633
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
5492
5634
  return (mod && mod.__esModule) ? mod : { "default": mod };
5493
5635
  };
@@ -5544,7 +5686,10 @@ exports.default = createRequestBody;
5544
5686
  //# sourceMappingURL=createRequestBody.js.map
5545
5687
  });
5546
5688
 
5689
+ const createRequestBody = /*@__PURE__*/getDefaultExportFromCjs(createRequestBody_1);
5690
+
5547
5691
  var parseArgs = createCommonjsModule(function (module, exports) {
5692
+ "use strict";
5548
5693
  Object.defineProperty(exports, "__esModule", { value: true });
5549
5694
  exports.parseBatchRequestsExtendedArgs = exports.parseRawRequestExtendedArgs = exports.parseRequestExtendedArgs = exports.parseBatchRequestArgs = exports.parseRawRequestArgs = exports.parseRequestArgs = void 0;
5550
5695
  function parseRequestArgs(documentOrOptions, variables, requestHeaders) {
@@ -5617,7 +5762,10 @@ exports.parseBatchRequestsExtendedArgs = parseBatchRequestsExtendedArgs;
5617
5762
  //# sourceMappingURL=parseArgs.js.map
5618
5763
  });
5619
5764
 
5765
+ const parseArgs$1 = /*@__PURE__*/getDefaultExportFromCjs(parseArgs);
5766
+
5620
5767
  var types = createCommonjsModule(function (module, exports) {
5768
+ "use strict";
5621
5769
  var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
5622
5770
  var extendStatics = function (d, b) {
5623
5771
  extendStatics = Object.setPrototypeOf ||
@@ -5667,7 +5815,10 @@ exports.ClientError = ClientError;
5667
5815
  //# sourceMappingURL=types.js.map
5668
5816
  });
5669
5817
 
5818
+ const types$1 = /*@__PURE__*/getDefaultExportFromCjs(types);
5819
+
5670
5820
  var graphqlWs = createCommonjsModule(function (module, exports) {
5821
+ "use strict";
5671
5822
  var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5672
5823
  __assign = Object.assign || function(t) {
5673
5824
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -5847,6 +5998,8 @@ var GraphQLWebSocketClient = /** @class */ (function () {
5847
5998
  if (message.payload.errors) {
5848
5999
  subscriber.error && subscriber.error(new types.ClientError(__assign(__assign({}, message.payload), { status: 200 }), { query: query, variables: variables }));
5849
6000
  }
6001
+ else {
6002
+ }
5850
6003
  return;
5851
6004
  }
5852
6005
  case ERROR: {
@@ -5941,7 +6094,10 @@ function Complete(id) {
5941
6094
  //# sourceMappingURL=graphql-ws.js.map
5942
6095
  });
5943
6096
 
6097
+ const graphqlWs$1 = /*@__PURE__*/getDefaultExportFromCjs(graphqlWs);
6098
+
5944
6099
  var dist = createCommonjsModule(function (module, exports) {
6100
+ "use strict";
5945
6101
  var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5946
6102
  __assign = Object.assign || function(t) {
5947
6103
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -6266,7 +6422,7 @@ exports.GraphQLClient = GraphQLClient;
6266
6422
  function makeRequest(_a) {
6267
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;
6268
6424
  return __awaiter(this, void 0, void 0, function () {
6269
- 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;
6270
6426
  return __generator(this, function (_c) {
6271
6427
  switch (_c.label) {
6272
6428
  case 0:
@@ -6293,7 +6449,7 @@ function makeRequest(_a) {
6293
6449
  successfullyPassedErrorPolicy = !result.errors || fetchOptions.errorPolicy === 'all' || fetchOptions.errorPolicy === 'ignore';
6294
6450
  if (response.ok && successfullyPassedErrorPolicy && successfullyReceivedData) {
6295
6451
  headers_1 = response.headers, status_1 = response.status;
6296
- rest = __rest(result, ["errors"]);
6452
+ errors = result.errors, rest = __rest(result, ["errors"]);
6297
6453
  data = fetchOptions.errorPolicy === 'ignore' ? rest : result;
6298
6454
  return [2 /*return*/, __assign(__assign({}, (isBathchingQuery ? { data: data } : data)), { headers: headers_1, status: status_1 })];
6299
6455
  }
@@ -6301,6 +6457,7 @@ function makeRequest(_a) {
6301
6457
  errorResult = typeof result === 'string' ? { error: result } : result;
6302
6458
  throw new types.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables });
6303
6459
  }
6460
+ return [2 /*return*/];
6304
6461
  }
6305
6462
  });
6306
6463
  });
@@ -6430,6 +6587,8 @@ Object.defineProperty(exports, "GraphQLWebSocketClient", { enumerable: true, get
6430
6587
  //# sourceMappingURL=index.js.map
6431
6588
  });
6432
6589
 
6590
+ const index = /*@__PURE__*/getDefaultExportFromCjs(dist);
6591
+
6433
6592
  class UrlUtils {
6434
6593
  static getQueryParams(queryString) {
6435
6594
  const params = new Map();
@@ -6487,6 +6646,27 @@ class DataFetcher {
6487
6646
  DataFetcher.requestListener.splice(index, 1);
6488
6647
  }
6489
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
+ }
6490
6670
  async callGraphQL(req) {
6491
6671
  var _a;
6492
6672
  const reqKey = this.getReqKey(req);
@@ -6497,7 +6677,8 @@ class DataFetcher {
6497
6677
  let query = this.getQueryTemplate(req);
6498
6678
  const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
6499
6679
  if (res.errors.length > 0) {
6500
- reject(new ErrorException("Falha detectada", res.errors[0][0].message));
6680
+ const error = this.processErrorInfo(res.errors);
6681
+ reject(error);
6501
6682
  }
6502
6683
  else {
6503
6684
  resolve(res.data[0][reqKey]);
@@ -6514,23 +6695,26 @@ class DataFetcher {
6514
6695
  resolveURL() {
6515
6696
  return UrlUtils.getUrlBase();
6516
6697
  }
6517
- getContext() {
6698
+ getContext(module) {
6518
6699
  const urlParams = UrlUtils.getQueryParams(location.search);
6519
6700
  return {
6520
- baseUrl: `${this.resolveURL()}/mge/service.sbr`,
6701
+ baseUrl: `${this.resolveURL()}/${module}/service.sbr`,
6521
6702
  appName: "SankhyaBlocks",
6522
6703
  mgeSession: `${window['skw_session'] || urlParams.mgeSession}`,
6523
6704
  globalID: "85C0093DFA240EAB699B4E47A10215BD",
6705
+ //FIXME: Precisamos ajustar para buscar o resourceId pela aplicação
6524
6706
  resourceID: "br.com.sankhya.mov.bancaria"
6525
6707
  };
6526
6708
  }
6527
6709
  async callServiceBroker(serviceName, payload) {
6528
6710
  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`;
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`;
6531
6715
  document.cookie = `JSESSIONID=${ctx.mgeSession};`;
6532
6716
  const http = new XMLHttpRequest();
6533
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url }));
6717
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
6534
6718
  http.open("POST", url, true);
6535
6719
  http.withCredentials = true;
6536
6720
  http.send(payload);
@@ -6549,11 +6733,11 @@ class DataFetcher {
6549
6733
  console.warn(`callServiceBroker error to parser response to JSON ${e}`);
6550
6734
  reject(this.responseText);
6551
6735
  }
6552
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6736
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6553
6737
  }
6554
6738
  else if (this.readyState == 4 && this.status != 200) {
6555
6739
  reject(this.responseText);
6556
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6740
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6557
6741
  }
6558
6742
  };
6559
6743
  });
@@ -6609,7 +6793,7 @@ class DataFetcher {
6609
6793
  if (window['skw_session']) {
6610
6794
  url += `?mgeSession=${window['skw_session']}`;
6611
6795
  }
6612
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url }));
6796
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: request }));
6613
6797
  try {
6614
6798
  res = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
6615
6799
  res.forEach((resItem, index) => {
@@ -6640,11 +6824,11 @@ class DataFetcher {
6640
6824
  });
6641
6825
  }
6642
6826
  else {
6643
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6827
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: request }));
6644
6828
  throw new ErrorException("Falha de comunicação", err.message);
6645
6829
  }
6646
6830
  }
6647
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
6831
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: request }));
6648
6832
  return { data: dataResponse, errors: errorsResponse };
6649
6833
  }
6650
6834
  isHttpError(err) {
@@ -6691,6 +6875,7 @@ class WaitingRequest {
6691
6875
  class DataUnitFetcher {
6692
6876
  constructor() {
6693
6877
  this.templateByQuery = new Map();
6878
+ this._loadDataTimeout = {};
6694
6879
  this.buldTemplates();
6695
6880
  }
6696
6881
  buldTemplates() {
@@ -6719,9 +6904,9 @@ class DataUnitFetcher {
6719
6904
  }
6720
6905
  }
6721
6906
  }`);
6722
- 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!]) {
6723
6908
  $queryAlias$: fetchDataUnit(name: $dataunit){
6724
- data(limit: $limit offset: $offset filters: $filter sort: $sort){
6909
+ data(limit: $limit offset: $offset filters: $filters sort: $sort){
6725
6910
  limit
6726
6911
  offset
6727
6912
  total
@@ -6750,7 +6935,7 @@ class DataUnitFetcher {
6750
6935
  getDataUnit(entityName, resourceID) {
6751
6936
  const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
6752
6937
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
6753
- dataUnit.dataLoader = (dataUnit, page, sort, filters) => this.loadData(dataUnit, page, sort, filters);
6938
+ dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
6754
6939
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
6755
6940
  dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
6756
6941
  return dataUnit;
@@ -6787,25 +6972,39 @@ class DataUnitFetcher {
6787
6972
  });
6788
6973
  });
6789
6974
  }
6790
- 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
+ }
6791
6981
  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)) {
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)) {
6799
6998
  if (variables.filter === undefined) {
6800
6999
  variables.filter = [];
6801
7000
  }
6802
7001
  const quickFilterCriteria = {
6803
7002
  name: "__QUICK_FILTER__",
6804
7003
  expression: "__QUICK_FILTER__",
6805
- params: [{ name: "term", dataType: DataType.TEXT, value: page.quickFilter.term }]
7004
+ params: [{ name: "term", dataType: DataType.TEXT, value: quickFilter.term }]
6806
7005
  };
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 });
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 });
6809
7008
  }
6810
7009
  variables.filter.push(quickFilterCriteria);
6811
7010
  }
@@ -6815,16 +7014,32 @@ class DataUnitFetcher {
6815
7014
  query: this.templateByQuery.get("fetchData"),
6816
7015
  })
6817
7016
  .then((resp) => {
6818
- const pageResult = resp.data;
6819
- const records = [];
6820
- 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) => {
6821
7033
  const duRecord = { __record__id__: responseRecord.id };
6822
7034
  responseRecord.fields.forEach(({ name, value }) => {
6823
7035
  duRecord[name] = dataUnit.valueFromString(name, value);
6824
7036
  });
6825
- records.push(duRecord);
7037
+ processedRecords.push(duRecord);
7038
+ });
7039
+ resolve({
7040
+ paginationInfo,
7041
+ records: processedRecords
6826
7042
  });
6827
- resolve(Object.assign(Object.assign({}, pageResult), { records }));
6828
7043
  })
6829
7044
  .catch((error) => {
6830
7045
  reject(error);
@@ -7050,15 +7265,16 @@ class GridConfigFetcher extends ResourceFetcher {
7050
7265
  super(...arguments);
7051
7266
  this.GRID_CONFIG_VERSION = "V3:";
7052
7267
  }
7053
- getConfig(resourceID) {
7268
+ getConfig(_gridName, resourceID) {
7054
7269
  const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
7055
7270
  return new Promise((resolve, reject) => {
7056
7271
  this.loadResource(completePath)
7057
7272
  .then(loadedResource => {
7273
+ let config = undefined;
7058
7274
  if (loadedResource) {
7059
- let config = JSON.parse(loadedResource);
7060
- resolve(config);
7275
+ config = JSON.parse(loadedResource);
7061
7276
  }
7277
+ resolve(config);
7062
7278
  }).catch((error) => {
7063
7279
  reject(error);
7064
7280
  });
@@ -7217,7 +7433,14 @@ class SnkErrorHandler {
7217
7433
  errorHandler(evt) {
7218
7434
  this.processException(evt.error);
7219
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
+ }
7220
7440
  processException(exception) {
7441
+ if (exception.errorCode != "") {
7442
+ exception.message += this.buildErrorCodeHTML(exception);
7443
+ }
7221
7444
  if (exception instanceof WaitingChangeException) {
7222
7445
  this._app.alert(exception.title, exception.message);
7223
7446
  }
@@ -7235,7 +7458,7 @@ class SnkErrorHandler {
7235
7458
  }
7236
7459
  else {
7237
7460
  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}"`;
7461
+ const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${ObjectUtils.objectToString(exception)}"`;
7239
7462
  this._app.error(title, message);
7240
7463
  }
7241
7464
  }
@@ -7246,6 +7469,114 @@ class SnkErrorHandler {
7246
7469
 
7247
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);
7248
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 == undefined) {
7520
+ return value;
7521
+ }
7522
+ if (value instanceof Date) {
7523
+ return value.toISOString();
7524
+ }
7525
+ if (typeof value === "object") {
7526
+ if (value instanceof Array) {
7527
+ return value.map(item => normalizeValue(item));
7528
+ }
7529
+ else {
7530
+ const normalized = Object.assign({}, value);
7531
+ Object.keys(value).forEach(prop => {
7532
+ if (value[prop]) {
7533
+ normalized[prop] = normalizeValue(value[prop]);
7534
+ }
7535
+ else {
7536
+ delete normalized[prop];
7537
+ }
7538
+ });
7539
+ return normalized;
7540
+ }
7541
+ }
7542
+ return value;
7543
+ }
7544
+ class FilterBarConfigFetcher extends ResourceFetcher {
7545
+ saveConfig(items, resourceID, configName) {
7546
+ const state = items.map(item => {
7547
+ const { id, value, fixed, visible } = item;
7548
+ const stateItem = { id };
7549
+ if (value) {
7550
+ stateItem["value"] = normalizeValue(value);
7551
+ }
7552
+ if (fixed) {
7553
+ stateItem["fixed"] = fixed;
7554
+ }
7555
+ if (visible) {
7556
+ stateItem["visible"] = true;
7557
+ }
7558
+ return stateItem;
7559
+ });
7560
+ return this.saveResource(state, `cfg://filter/FilterBarState:${resourceID}/${configName}`);
7561
+ }
7562
+ getConfig(resourceID, configName) {
7563
+ return new Promise((accept, reject) => {
7564
+ this.loadResource(`cfg://filter/FilterBarState:${resourceID}/${configName}`)
7565
+ .then((configAsString) => {
7566
+ let fieldsList;
7567
+ if (configAsString) {
7568
+ const filterBarConfig = JSON.parse(configAsString);
7569
+ fieldsList = filterBarConfig.items;
7570
+ }
7571
+ accept(fieldsList || []);
7572
+ })
7573
+ .catch((error) => {
7574
+ reject(error);
7575
+ });
7576
+ });
7577
+ }
7578
+ }
7579
+
7249
7580
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
7250
7581
 
7251
7582
  const SnkApplication = class {
@@ -7253,6 +7584,9 @@ const SnkApplication = class {
7253
7584
  registerInstance(this, hostRef);
7254
7585
  this.applicationLoaded = createEvent(this, "applicationLoaded", 7);
7255
7586
  this.applicationLoading = createEvent(this, "applicationLoading", 7);
7587
+ this._authPromises = [];
7588
+ this._duCache = new Map();
7589
+ this._duPromises = new Map();
7256
7590
  this._requestListener = new RequestListenerLoadingBar();
7257
7591
  }
7258
7592
  get parameters() {
@@ -7271,18 +7605,31 @@ const SnkApplication = class {
7271
7605
  return this._resourceID;
7272
7606
  }
7273
7607
  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
- });
7608
+ if (this._auth) {
7609
+ return Promise.resolve(this._auth);
7610
+ }
7611
+ else {
7612
+ return new Promise((resolve, reject) => {
7613
+ const waitingAuth = this._authPromises.length > 0;
7614
+ this._authPromises.push(new PendingPromise(resolve, reject));
7615
+ if (!waitingAuth) {
7616
+ this.authFetcher.getData(this.resourceID).then((authList) => {
7617
+ this._auth = authList;
7618
+ while (this._authPromises.length > 0) {
7619
+ this._authPromises.pop().resolve(this._auth);
7620
+ }
7621
+ }).catch(error => {
7622
+ while (this._authPromises.length > 0) {
7623
+ this._authPromises.pop().reject(error);
7624
+ }
7625
+ });
7626
+ }
7627
+ });
7628
+ }
7285
7629
  }
7630
+ /**
7631
+ * Caso o usuário logado seja o SUP.
7632
+ */
7286
7633
  async isUserSup() {
7287
7634
  return new Promise((resolve, reject) => {
7288
7635
  this.auth.then((authorization) => {
@@ -7292,6 +7639,9 @@ const SnkApplication = class {
7292
7639
  });
7293
7640
  });
7294
7641
  }
7642
+ /**
7643
+ * Se o usuário logado tem permissão pra determinada ação.
7644
+ */
7295
7645
  async hasAccess(access) {
7296
7646
  return new Promise((resolve, reject) => {
7297
7647
  this.auth.then((authorization) => {
@@ -7301,6 +7651,9 @@ const SnkApplication = class {
7301
7651
  });
7302
7652
  });
7303
7653
  }
7654
+ /**
7655
+ * Retorna todos os acessos do usuário logado.
7656
+ */
7304
7657
  async getAllAccess() {
7305
7658
  return new Promise((resolve, reject) => {
7306
7659
  this.auth.then((authorization) => {
@@ -7315,33 +7668,63 @@ const SnkApplication = class {
7315
7668
  });
7316
7669
  });
7317
7670
  }
7318
- async getAuthList(_auth) {
7319
- return await (new MGEAuthorization()).parseFromJSON(_auth);
7320
- }
7671
+ /**
7672
+ * Retorna o valor de um parâmetro do tipo string.
7673
+ */
7321
7674
  async getStringParam(name) {
7322
7675
  return this.parameters.asString(name, this.resourceID);
7323
7676
  }
7677
+ /**
7678
+ * Retorna o valor de um parâmetro do tipo Inteiro.
7679
+ */
7324
7680
  async getIntParam(name) {
7325
7681
  return this.parameters.asInteger(name, this.resourceID);
7326
7682
  }
7683
+ /**
7684
+ * Retorna o valor de um parâmetro do tipo Decimal.
7685
+ */
7327
7686
  async getFloatParam(name) {
7328
7687
  return this.parameters.asFloat(name, this.resourceID);
7329
7688
  }
7689
+ /**
7690
+ * Retorna o valor de um parâmetro do tipo booleano.
7691
+ */
7330
7692
  async getBooleanParam(name) {
7331
7693
  return this.parameters.asBoolean(name, this.resourceID);
7332
7694
  }
7695
+ /**
7696
+ * Retorna o valor de um parâmetro do tipo data.
7697
+ */
7333
7698
  async getDateParam(name) {
7334
7699
  return this.parameters.asDate(name, this.resourceID);
7335
7700
  }
7701
+ /**
7702
+ * Mostra o conteúdo passado em um Popup
7703
+ */
7336
7704
  async showPopUp(content) {
7337
- this.clearPopUpContent();
7705
+ this.clearContent(this._popUp);
7338
7706
  this._popUp.appendChild(content);
7339
7707
  this._popUp.opened = true;
7340
7708
  }
7709
+ async showModal(content) {
7710
+ this.clearContent(this._rightModal);
7711
+ this._rightModal.appendChild(content);
7712
+ this._rightModal.opened = true;
7713
+ }
7714
+ async closeModal() {
7715
+ this.clearContent(this._rightModal);
7716
+ this._rightModal.opened = false;
7717
+ }
7718
+ /**
7719
+ * Fecha o popup, liberando o conteúdo.
7720
+ */
7341
7721
  async closePopUp() {
7342
- this.clearPopUpContent();
7722
+ this.clearContent(this._popUp);
7343
7723
  this._popUp.opened = false;
7344
7724
  }
7725
+ /**
7726
+ * Verifica se a licença do cliente tem determinado opcional (produto)
7727
+ */
7345
7728
  async temOpcional(opcional) {
7346
7729
  const opts = opcional.split(",");
7347
7730
  return new Promise((resolve, reject) => {
@@ -7365,6 +7748,10 @@ const SnkApplication = class {
7365
7748
  });
7366
7749
  });
7367
7750
  }
7751
+ /**
7752
+ * Retorna a configuração de um recurso por service broker
7753
+ * Veja também o método "loadConfig"
7754
+ */
7368
7755
  async getConfig(key) {
7369
7756
  let payload = {
7370
7757
  "serviceName": "SystemUtilsSP.getConf",
@@ -7382,6 +7769,9 @@ const SnkApplication = class {
7382
7769
  .catch(error => reject(error));
7383
7770
  });
7384
7771
  }
7772
+ /**
7773
+ * Salva a configuração de determinado recurso.
7774
+ */
7385
7775
  async saveConfig(key, data) {
7386
7776
  let payload = {
7387
7777
  "serviceName": "SystemUtilsSP.saveConf",
@@ -7400,42 +7790,166 @@ const SnkApplication = class {
7400
7790
  .catch(error => reject(error));
7401
7791
  });
7402
7792
  }
7793
+ /**
7794
+ * Acessa informações de contexto "empurrados" na abertura da tela
7795
+ */
7403
7796
  async getAttributeFromHTMLWrapper(attribName) {
7404
7797
  return Promise.resolve(window[attribName]);
7405
7798
  }
7799
+ /**
7800
+ * Abre determinada tela, repassando pkObject
7801
+ */
7406
7802
  async openApp(resourceId, pkObject) {
7407
7803
  Workspace.openAppActivity(resourceId, pkObject);
7408
7804
  }
7409
- async createDataunit(entityName) {
7410
- return new Promise(resolve => {
7411
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7412
- dataUnit.loadMetadata().then(() => resolve(dataUnit));
7805
+ getDuPromissesStack(dataUnitName) {
7806
+ let stack;
7807
+ if (dataUnitName) {
7808
+ stack = this._duPromises.get(dataUnitName);
7809
+ if (!stack) {
7810
+ stack = [];
7811
+ this._duPromises.set(dataUnitName, stack);
7812
+ }
7813
+ }
7814
+ return stack || [];
7815
+ }
7816
+ /**
7817
+ * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
7818
+ * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado
7819
+ */
7820
+ async createDataunit(entityName, dataUnitName) {
7821
+ return new Promise((resolve, reject) => {
7822
+ const duPromisses = this.getDuPromissesStack(dataUnitName);
7823
+ const waitingDu = duPromisses.length > 0;
7824
+ duPromisses.push(new PendingPromise(resolve, reject));
7825
+ if (!waitingDu) {
7826
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7827
+ dataUnit.loadMetadata().then(() => {
7828
+ if (dataUnitName) {
7829
+ this._duCache.set(dataUnitName, dataUnit);
7830
+ }
7831
+ while (duPromisses.length > 0) {
7832
+ duPromisses.pop().resolve(dataUnit);
7833
+ }
7834
+ }).catch(reason => {
7835
+ while (duPromisses.length > 0) {
7836
+ duPromisses.pop().reject(reason);
7837
+ }
7838
+ });
7839
+ }
7840
+ });
7841
+ }
7842
+ /**
7843
+ * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
7844
+ */
7845
+ async getDataUnit(entityName, dataUnitName) {
7846
+ return new Promise((resolve, reject) => {
7847
+ const dataUnit = this._duCache.get(dataUnitName);
7848
+ if (dataUnit) {
7849
+ resolve(dataUnit);
7850
+ }
7851
+ else {
7852
+ this.createDataunit(entityName, dataUnitName).then(dataUnit => {
7853
+ resolve(dataUnit);
7854
+ }).catch(reason => reject(reason));
7855
+ }
7413
7856
  });
7414
7857
  }
7858
+ /**
7859
+ * Retorna o resourceID da tela em questão.
7860
+ */
7415
7861
  async getResourceID() {
7416
7862
  return Promise.resolve(this.resourceID);
7417
7863
  }
7864
+ /**
7865
+ * Mostra o diálogo de alerta de acordo com os parâmetros passados.
7866
+ */
7418
7867
  async alert(title, message, icon, options) {
7419
7868
  return ApplicationUtils.alert(title, message, icon, options);
7420
7869
  }
7870
+ /**
7871
+ * Mostra o diálogo de erro de acordo com os parâmetros passados.
7872
+ */
7421
7873
  async error(title, message, icon, options) {
7422
7874
  return ApplicationUtils.error(title, message, icon, options);
7423
7875
  }
7424
- async confirm(title, message, icon, critical, options) {
7425
- return ApplicationUtils.confirm(title, message, icon, critical, options);
7876
+ /**
7877
+ * Mostra o diálogo de sucesso de acordo com os parâmetros passados.
7878
+ */
7879
+ async success(title, message, icon, options) {
7880
+ return ApplicationUtils.success(title, message, icon, options);
7881
+ }
7882
+ /**
7883
+ * Exibe um diálogo de mensagem comum
7884
+ */
7885
+ async message(title, message, icon, options) {
7886
+ return ApplicationUtils.message(title, message, icon, options);
7887
+ }
7888
+ /**
7889
+ * Exibe um diálogo de confirmação
7890
+ */
7891
+ async confirm(title, message, icon, dialogType, options) {
7892
+ return ApplicationUtils.confirm(title, message, icon, dialogType, options);
7426
7893
  }
7894
+ /**
7895
+ * Mostra uma informação efêmera (de segundo plano).
7896
+ */
7427
7897
  async info(message, options) {
7428
7898
  return ApplicationUtils.info(message, options);
7429
7899
  }
7900
+ /**
7901
+ * Busca a configuração de formulário.
7902
+ */
7430
7903
  async loadFormConfig(name) {
7431
7904
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7432
7905
  }
7433
- async loadGridConfig() {
7434
- return this.gridConfigFetcher.getConfig(this.resourceID);
7906
+ /**
7907
+ * Busca a configuração de grade.
7908
+ */
7909
+ async loadGridConfig(name) {
7910
+ return this.gridConfigFetcher.getConfig(name, this.resourceID);
7911
+ }
7912
+ /**
7913
+ * Busca os totalizadores da grade.
7914
+ */
7915
+ async loadTotals(name, resourceID, filters) {
7916
+ return this.totalsFetcher.fetchTotals(name, resourceID, filters);
7435
7917
  }
7918
+ /**
7919
+ * Salva a configuração de grade.
7920
+ */
7436
7921
  async saveGridConfig(config) {
7437
7922
  return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7438
7923
  }
7924
+ /**
7925
+ * Obtém as configurações da barra de filtros
7926
+ */
7927
+ async getFilterBarConfig(name) {
7928
+ return new Promise((accept, reject) => {
7929
+ if (this.configName === name && this._filterBarConfig) {
7930
+ accept(this._filterBarConfig);
7931
+ }
7932
+ else if (this.configName === name && this._filterConfigPromise != undefined) {
7933
+ Promise.all([this._filterConfigPromise])
7934
+ .then(result => accept(result[0]))
7935
+ .catch(reason => reject(reason[0]));
7936
+ }
7937
+ else {
7938
+ this.filterBarConfigFetcher.getConfig(this.resourceID, name)
7939
+ .then(config => accept(config))
7940
+ .catch(reason => reject(reason));
7941
+ }
7942
+ });
7943
+ }
7944
+ /**
7945
+ * Salva as configurações da barra de filtros
7946
+ */
7947
+ async saveFilterBarConfig(config, name) {
7948
+ return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
7949
+ }
7950
+ async getAuthList(_auth) {
7951
+ return await (new MGEAuthorization()).parseFromJSON(_auth);
7952
+ }
7439
7953
  get urlParams() {
7440
7954
  if (!this._urlParams) {
7441
7955
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -7460,6 +7974,12 @@ const SnkApplication = class {
7460
7974
  }
7461
7975
  return this._gridConfigFetcher;
7462
7976
  }
7977
+ get totalsFetcher() {
7978
+ if (!this._totalsFetcher) {
7979
+ this._totalsFetcher = new TotalsFetcher();
7980
+ }
7981
+ return this._totalsFetcher;
7982
+ }
7463
7983
  get pesquisaFetcher() {
7464
7984
  if (!this._pesquisaFetcher) {
7465
7985
  this._pesquisaFetcher = new PesquisaFetcher();
@@ -7472,9 +7992,17 @@ const SnkApplication = class {
7472
7992
  }
7473
7993
  return this._authFetcher;
7474
7994
  }
7995
+ get filterBarConfigFetcher() {
7996
+ if (!this._filterBarConfigFetcher) {
7997
+ this._filterBarConfigFetcher = new FilterBarConfigFetcher();
7998
+ }
7999
+ return this._filterBarConfigFetcher;
8000
+ }
7475
8001
  async executeSearch(searchArgument, fieldName, dataUnit) {
7476
8002
  const descriptor = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(fieldName);
7477
- if (!descriptor) ;
8003
+ if (!descriptor) {
8004
+ //TODO: Implementar mensagem de erro
8005
+ }
7478
8006
  else {
7479
8007
  const { mode, argument } = searchArgument;
7480
8008
  const { ENTITYNAME, CODEFIELD, DESCRIPTIONFIELD, ROOTENTITY, DESCRIPTIONENTITY } = descriptor.properties;
@@ -7506,23 +8034,27 @@ const SnkApplication = class {
7506
8034
  }
7507
8035
  }
7508
8036
  });
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
- }
8037
+ return this.executePreparedSearch(mode, argument, { entity: ENTITYNAME, entityDescription: DESCRIPTIONENTITY, criteria, searchOptions });
8038
+ }
8039
+ }
8040
+ async executePreparedSearch(mode, argument, options) {
8041
+ const { entity, entityDescription, criteria, searchOptions } = options;
8042
+ if (mode === "ADVANCED") {
8043
+ return new Promise(accept => {
8044
+ const pesquisaContent = document.createElement("snk-pesquisa");
8045
+ pesquisaContent.argument = argument;
8046
+ pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
8047
+ pesquisaContent.selectItem = (option) => {
8048
+ accept(option);
8049
+ this.clearPopUpTitle();
8050
+ this.closePopUp();
8051
+ };
8052
+ this.setPopUpTitle(entityDescription);
8053
+ this.showPopUp(pesquisaContent);
8054
+ });
8055
+ }
8056
+ else {
8057
+ return this.pesquisaFetcher.loadSearchOptions(entity, argument, criteria, searchOptions);
7526
8058
  }
7527
8059
  }
7528
8060
  async isDebugMode() {
@@ -7530,10 +8062,10 @@ const SnkApplication = class {
7530
8062
  accept(window['isDebugMode']);
7531
8063
  });
7532
8064
  }
7533
- clearPopUpContent() {
7534
- if (this._popUp) {
7535
- Array.from(this._popUp.children).forEach(c => {
7536
- this._popUp.removeChild(c);
8065
+ clearContent(container) {
8066
+ if (container) {
8067
+ Array.from(container.children).forEach(child => {
8068
+ container.removeChild(child);
7537
8069
  });
7538
8070
  }
7539
8071
  }
@@ -7545,14 +8077,26 @@ const SnkApplication = class {
7545
8077
  }
7546
8078
  componentWillLoad() {
7547
8079
  this._errorHandler = new SnkErrorHandler(this);
8080
+ this.messagesBuilder = new SnkMessageBuilder();
7548
8081
  ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
7549
8082
  ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
7550
8083
  return this.executeSearch(searchArgument, fieldName, dataUnit);
7551
8084
  });
7552
8085
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
8086
+ if (this.configName) {
8087
+ this._filterConfigPromise = new Promise((accept, reject) => {
8088
+ this.filterBarConfigFetcher.getConfig(this.resourceID, this.configName)
8089
+ .then(config => {
8090
+ this._filterBarConfig = config;
8091
+ accept(config);
8092
+ })
8093
+ .catch(reason => reject(reason));
8094
+ });
8095
+ }
7553
8096
  ErrorTracking.init();
7554
8097
  }
7555
8098
  connectedCallback() {
8099
+ ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
7556
8100
  DataFetcher.addRequestListener(this._requestListener);
7557
8101
  }
7558
8102
  disconnectedCallback() {
@@ -7565,23 +8109,30 @@ const SnkApplication = class {
7565
8109
  });
7566
8110
  }
7567
8111
  render() {
7568
- return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() })));
8112
+ return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "col col--sd-3", closeOutsideClick: true })));
7569
8113
  }
7570
8114
  };
7571
8115
  class RequestListenerLoadingBar {
7572
8116
  constructor() {
7573
8117
  this._debounceTime = 1000;
8118
+ this._ignoredNameTypes = ["totals"];
7574
8119
  this._countRequest = 0;
7575
8120
  }
7576
- onRequestStart() {
7577
- this.loadingBar.show();
8121
+ onRequestStart(param) {
8122
+ if (this.isIgnoreLoadingOnRequest(param)) {
8123
+ return;
8124
+ }
7578
8125
  this._countRequest++;
8126
+ this.loadingBar.show();
7579
8127
  if (this._timerLoading) {
7580
8128
  clearTimeout(this._timerLoading);
7581
8129
  }
7582
8130
  }
7583
8131
  ;
7584
- onRequestEnd() {
8132
+ onRequestEnd(param) {
8133
+ if (this.isIgnoreLoadingOnRequest(param)) {
8134
+ return;
8135
+ }
7585
8136
  this._countRequest--;
7586
8137
  this._timerLoading = setTimeout(() => {
7587
8138
  if (this._countRequest <= 0) {
@@ -7590,6 +8141,25 @@ class RequestListenerLoadingBar {
7590
8141
  }, this._debounceTime);
7591
8142
  }
7592
8143
  ;
8144
+ isIgnoreLoadingOnRequest(param) {
8145
+ var _a;
8146
+ if (((_a = param === null || param === void 0 ? void 0 : param.requestBody) === null || _a === void 0 ? void 0 : _a.length) == 1) {
8147
+ const { name } = param.requestBody[0].variables;
8148
+ if (name) {
8149
+ const nameParts = name.split(":");
8150
+ const nameType = nameParts[0];
8151
+ return this._ignoredNameTypes.indexOf(nameType) >= 0;
8152
+ }
8153
+ }
8154
+ return false;
8155
+ }
8156
+ ;
8157
+ }
8158
+ class PendingPromise {
8159
+ constructor(resolve, reject) {
8160
+ this.resolve = resolve;
8161
+ this.reject = reject;
8162
+ }
7593
8163
  }
7594
8164
  SnkApplication.style = snkApplicationCss;
7595
8165