@sankhyalabs/sankhyablocks 1.1.28 → 1.3.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.
- package/LICENSE +21 -21
- package/README.md +75 -75
- package/dist/cjs/index-4720dab8.js +735 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +668 -653
- package/dist/collection/collection-manifest.json +5 -34
- package/dist/collection/components/snk-application/snk-application.css +5 -5
- package/dist/collection/components/snk-application/snk-application.js +492 -492
- package/dist/collection/index.js +1 -1
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +158 -158
- package/dist/collection/lib/http/data-fetcher/fetchers/application-config-fetcher.js +23 -23
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +188 -188
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +25 -25
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +59 -59
- package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +30 -30
- package/dist/collection/lib/http/data-fetcher/state/LoadStateManager.js +66 -66
- package/dist/collection/lib/utils/pesquisa.js +16 -16
- package/dist/collection/lib/utils/urlutils.js +23 -23
- package/dist/collection/lib/workspace/workspace.js +7 -7
- package/dist/components/snk-application.js +655 -640
- package/dist/esm/index-72d4e2e0.js +709 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +626 -611
- package/dist/sankhyablocks/p-5d8ddbda.entry.js +57 -0
- package/dist/sankhyablocks/p-a33afc3b.js +2 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +44 -44
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +15 -15
- package/dist/types/lib/http/data-fetcher/fetchers/application-config-fetcher.d.ts +6 -6
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +12 -12
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +5 -5
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +2 -2
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +13 -13
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +6 -6
- package/dist/types/lib/http/data-fetcher/state/LoadStateManager.d.ts +23 -23
- package/dist/types/lib/utils/pesquisa.d.ts +2 -2
- package/dist/types/lib/utils/urlutils.d.ts +4 -4
- package/dist/types/lib/workspace/workspace.d.ts +4 -4
- package/package.json +63 -52
- package/react/.keepfolder +1 -0
- package/react/components.d.ts +3 -32
- package/react/components.js +5 -34
- package/react/components.js.map +1 -1
- package/react/react-component-lib/createComponent.d.ts +10 -10
- package/react/react-component-lib/createComponent.js +58 -74
- package/react/react-component-lib/createComponent.js.map +1 -1
- package/react/react-component-lib/createOverlayComponent.d.ts +20 -21
- package/react/react-component-lib/createOverlayComponent.js +88 -108
- package/react/react-component-lib/createOverlayComponent.js.map +1 -1
- package/react/react-component-lib/index.d.ts +2 -2
- package/react/react-component-lib/index.js +2 -2
- package/react/react-component-lib/interfaces.d.ts +29 -29
- package/react/react-component-lib/utils/attachProps.d.ts +12 -12
- package/react/react-component-lib/utils/attachProps.js +95 -97
- package/react/react-component-lib/utils/attachProps.js.map +1 -1
- package/react/react-component-lib/utils/case.d.ts +2 -2
- package/react/react-component-lib/utils/case.js +6 -6
- package/react/react-component-lib/utils/dev.d.ts +2 -2
- package/react/react-component-lib/utils/dev.js +12 -12
- package/react/react-component-lib/utils/index.d.ts +7 -10
- package/react/react-component-lib/utils/index.js +20 -33
- package/react/react-component-lib/utils/index.js.map +1 -1
- package/dist/cjs/ApplicationUtils-05b74ee9.js +0 -39
- package/dist/cjs/AssetsUtils-7e3c38f9.js +0 -24
- package/dist/cjs/CSSVarsUtils-75ca9c64.js +0 -19
- package/dist/cjs/_commonjsHelpers-537d719a.js +0 -20
- package/dist/cjs/ez-action-chip.cjs.entry.js +0 -27
- package/dist/cjs/ez-application.cjs.entry.js +0 -26
- package/dist/cjs/ez-button_4.cjs.entry.js +0 -660
- package/dist/cjs/ez-calendar.cjs.entry.js +0 -223
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +0 -47
- package/dist/cjs/ez-combo-box.cjs.entry.js +0 -278
- package/dist/cjs/ez-date-input.cjs.entry.js +0 -102
- package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -145
- package/dist/cjs/ez-dialog.cjs.entry.js +0 -89
- package/dist/cjs/ez-form.cjs.entry.js +0 -785
- package/dist/cjs/ez-grid.cjs.entry.js +0 -110485
- package/dist/cjs/ez-icon.cjs.entry.js +0 -41
- package/dist/cjs/ez-label-chip.cjs.entry.js +0 -104
- package/dist/cjs/ez-modal_2.cjs.entry.js +0 -316
- package/dist/cjs/ez-number-input.cjs.entry.js +0 -86
- package/dist/cjs/ez-popover.cjs.entry.js +0 -120
- package/dist/cjs/ez-popup.cjs.entry.js +0 -48
- package/dist/cjs/ez-search.cjs.entry.js +0 -64
- package/dist/cjs/ez-tabselector.cjs.entry.js +0 -198
- package/dist/cjs/ez-text-area.cjs.entry.js +0 -114
- package/dist/cjs/ez-text-input.cjs.entry.js +0 -201
- package/dist/cjs/ez-time-input.cjs.entry.js +0 -118
- package/dist/cjs/ez-toast.cjs.entry.js +0 -44
- package/dist/cjs/ez-upload.cjs.entry.js +0 -356
- package/dist/cjs/index-682c98b2.js +0 -1771
- package/dist/cjs/test-du.cjs.entry.js +0 -76
- package/dist/components/ApplicationUtils.js +0 -37
- package/dist/components/AssetsUtils.js +0 -22
- package/dist/components/CSSVarsUtils.js +0 -17
- package/dist/components/_commonjsHelpers.js +0 -17
- package/dist/components/ez-action-chip.js +0 -44
- package/dist/components/ez-application.js +0 -39
- package/dist/components/ez-button.js +0 -6
- package/dist/components/ez-button2.js +0 -105
- package/dist/components/ez-calendar.js +0 -6
- package/dist/components/ez-calendar2.js +0 -242
- package/dist/components/ez-check.js +0 -6
- package/dist/components/ez-check2.js +0 -94
- package/dist/components/ez-collapsible-box.js +0 -67
- package/dist/components/ez-combo-box.js +0 -6
- package/dist/components/ez-combo-box2.js +0 -311
- package/dist/components/ez-date-input.js +0 -135
- package/dist/components/ez-date-time-input.js +0 -179
- package/dist/components/ez-dialog.js +0 -124
- package/dist/components/ez-form.js +0 -6
- package/dist/components/ez-form2.js +0 -807
- package/dist/components/ez-grid.js +0 -110576
- package/dist/components/ez-icon.js +0 -6
- package/dist/components/ez-icon2.js +0 -56
- package/dist/components/ez-label-chip.js +0 -125
- package/dist/components/ez-list.js +0 -6
- package/dist/components/ez-list2.js +0 -523
- package/dist/components/ez-modal.js +0 -6
- package/dist/components/ez-modal2.js +0 -82
- package/dist/components/ez-number-input.js +0 -115
- package/dist/components/ez-popover.js +0 -145
- package/dist/components/ez-popup.js +0 -67
- package/dist/components/ez-search.js +0 -100
- package/dist/components/ez-tabselector.js +0 -6
- package/dist/components/ez-tabselector2.js +0 -213
- package/dist/components/ez-text-area.js +0 -137
- package/dist/components/ez-text-input.js +0 -6
- package/dist/components/ez-text-input2.js +0 -223
- package/dist/components/ez-time-input.js +0 -153
- package/dist/components/ez-toast.js +0 -64
- package/dist/components/ez-upload.js +0 -382
- package/dist/components/grid-config.js +0 -6
- package/dist/components/grid-config2.js +0 -318
- package/dist/components/select-box.js +0 -6
- package/dist/components/select-box2.js +0 -47
- package/dist/components/test-du.js +0 -101
- package/dist/esm/ApplicationUtils-e0b6d857.js +0 -37
- package/dist/esm/AssetsUtils-6e6624dc.js +0 -22
- package/dist/esm/CSSVarsUtils-0787c3f3.js +0 -17
- package/dist/esm/_commonjsHelpers-9943807e.js +0 -17
- package/dist/esm/ez-action-chip.entry.js +0 -23
- package/dist/esm/ez-application.entry.js +0 -22
- package/dist/esm/ez-button_4.entry.js +0 -653
- package/dist/esm/ez-calendar.entry.js +0 -219
- package/dist/esm/ez-collapsible-box.entry.js +0 -43
- package/dist/esm/ez-combo-box.entry.js +0 -274
- package/dist/esm/ez-date-input.entry.js +0 -98
- package/dist/esm/ez-date-time-input.entry.js +0 -141
- package/dist/esm/ez-dialog.entry.js +0 -85
- package/dist/esm/ez-form.entry.js +0 -781
- package/dist/esm/ez-grid.entry.js +0 -110481
- package/dist/esm/ez-icon.entry.js +0 -37
- package/dist/esm/ez-label-chip.entry.js +0 -100
- package/dist/esm/ez-modal_2.entry.js +0 -311
- package/dist/esm/ez-number-input.entry.js +0 -82
- package/dist/esm/ez-popover.entry.js +0 -116
- package/dist/esm/ez-popup.entry.js +0 -44
- package/dist/esm/ez-search.entry.js +0 -60
- package/dist/esm/ez-tabselector.entry.js +0 -194
- package/dist/esm/ez-text-area.entry.js +0 -110
- package/dist/esm/ez-text-input.entry.js +0 -197
- package/dist/esm/ez-time-input.entry.js +0 -114
- package/dist/esm/ez-toast.entry.js +0 -40
- package/dist/esm/ez-upload.entry.js +0 -352
- package/dist/esm/index-35088a3f.js +0 -1740
- package/dist/esm/test-du.entry.js +0 -72
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +0 -67
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +0 -3
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +0 -180
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +0 -319
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +0 -327
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +0 -162
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -217
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +0 -49
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -44
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +0 -527
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +0 -5
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +0 -31
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +0 -129
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +0 -10
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +0 -176
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +0 -139
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +0 -335
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +0 -358
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +0 -4
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +0 -44
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +0 -405
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +0 -3
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -138
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +0 -165
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +0 -196
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +0 -10
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +0 -127
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +0 -568
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +0 -3
- package/dist/sankhyablocks/p-0183d259.entry.js +0 -1
- package/dist/sankhyablocks/p-01f23a70.entry.js +0 -1
- package/dist/sankhyablocks/p-07c32f68.entry.js +0 -1
- package/dist/sankhyablocks/p-0f90499d.entry.js +0 -1
- package/dist/sankhyablocks/p-105724a3.entry.js +0 -1
- package/dist/sankhyablocks/p-112455b1.js +0 -1
- package/dist/sankhyablocks/p-2ac02d48.entry.js +0 -1
- package/dist/sankhyablocks/p-35364a97.entry.js +0 -1
- package/dist/sankhyablocks/p-3f6aa9a7.entry.js +0 -1
- package/dist/sankhyablocks/p-4811bc0a.entry.js +0 -369
- package/dist/sankhyablocks/p-5f9af495.entry.js +0 -1
- package/dist/sankhyablocks/p-60967cf0.js +0 -1
- package/dist/sankhyablocks/p-70ad6c16.entry.js +0 -1
- package/dist/sankhyablocks/p-710bfffe.entry.js +0 -1
- package/dist/sankhyablocks/p-73397a0f.entry.js +0 -57
- package/dist/sankhyablocks/p-811b4b9d.js +0 -1
- package/dist/sankhyablocks/p-813fe4f7.js +0 -1
- package/dist/sankhyablocks/p-85a9446b.js +0 -2
- package/dist/sankhyablocks/p-89a1100f.entry.js +0 -1
- package/dist/sankhyablocks/p-8b543003.entry.js +0 -1
- package/dist/sankhyablocks/p-9750632b.entry.js +0 -1
- package/dist/sankhyablocks/p-a96272f7.entry.js +0 -1
- package/dist/sankhyablocks/p-ac8842e5.entry.js +0 -1
- package/dist/sankhyablocks/p-ba64cc41.entry.js +0 -1
- package/dist/sankhyablocks/p-c1ede043.entry.js +0 -1
- package/dist/sankhyablocks/p-d90ebb85.entry.js +0 -1
- package/dist/sankhyablocks/p-e5355a29.entry.js +0 -1
- package/dist/sankhyablocks/p-ef04b633.entry.js +0 -1
- package/dist/sankhyablocks/p-f6db07fb.entry.js +0 -1
- package/dist/sankhyablocks/p-f80cabc7.entry.js +0 -1
- package/dist/sankhyablocks/p-fcd9bd92.entry.js +0 -1
|
@@ -2,13 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-4720dab8.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
|
|
8
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
8
|
|
|
10
|
-
var
|
|
11
|
-
|
|
9
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
10
|
+
|
|
11
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
12
|
+
return module = {
|
|
13
|
+
path: basedir,
|
|
14
|
+
exports: {},
|
|
15
|
+
require: function (path, base) {
|
|
16
|
+
return commonjsRequire();
|
|
17
|
+
}
|
|
18
|
+
}, fn(module, module.exports), module.exports;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function commonjsRequire () {
|
|
22
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var browserPonyfill = createCommonjsModule(function (module, exports) {
|
|
26
|
+
var global = typeof self !== 'undefined' ? self : commonjsGlobal;
|
|
12
27
|
var __self__ = (function () {
|
|
13
28
|
function F() {
|
|
14
29
|
this.fetch = false;
|
|
@@ -564,7 +579,7 @@ exports.Response = ctx.Response;
|
|
|
564
579
|
module.exports = exports;
|
|
565
580
|
});
|
|
566
581
|
|
|
567
|
-
var isObjectLike_1 =
|
|
582
|
+
var isObjectLike_1 = createCommonjsModule(function (module, exports) {
|
|
568
583
|
|
|
569
584
|
Object.defineProperty(exports, '__esModule', {
|
|
570
585
|
value: true,
|
|
@@ -580,7 +595,7 @@ function isObjectLike(value) {
|
|
|
580
595
|
}
|
|
581
596
|
});
|
|
582
597
|
|
|
583
|
-
var invariant_1 =
|
|
598
|
+
var invariant_1 = createCommonjsModule(function (module, exports) {
|
|
584
599
|
|
|
585
600
|
Object.defineProperty(exports, '__esModule', {
|
|
586
601
|
value: true,
|
|
@@ -598,7 +613,7 @@ function invariant(condition, message) {
|
|
|
598
613
|
}
|
|
599
614
|
});
|
|
600
615
|
|
|
601
|
-
var location_1 =
|
|
616
|
+
var location_1 = createCommonjsModule(function (module, exports) {
|
|
602
617
|
|
|
603
618
|
Object.defineProperty(exports, '__esModule', {
|
|
604
619
|
value: true,
|
|
@@ -638,7 +653,7 @@ function getLocation(source, position) {
|
|
|
638
653
|
}
|
|
639
654
|
});
|
|
640
655
|
|
|
641
|
-
var printLocation_1 =
|
|
656
|
+
var printLocation_1 = createCommonjsModule(function (module, exports) {
|
|
642
657
|
|
|
643
658
|
Object.defineProperty(exports, '__esModule', {
|
|
644
659
|
value: true,
|
|
@@ -714,7 +729,7 @@ function printPrefixedLines(lines) {
|
|
|
714
729
|
}
|
|
715
730
|
});
|
|
716
731
|
|
|
717
|
-
var GraphQLError_1 =
|
|
732
|
+
var GraphQLError_1 = createCommonjsModule(function (module, exports) {
|
|
718
733
|
|
|
719
734
|
Object.defineProperty(exports, '__esModule', {
|
|
720
735
|
value: true,
|
|
@@ -983,7 +998,7 @@ function formatError(error) {
|
|
|
983
998
|
}
|
|
984
999
|
});
|
|
985
1000
|
|
|
986
|
-
var syntaxError_1 =
|
|
1001
|
+
var syntaxError_1 = createCommonjsModule(function (module, exports) {
|
|
987
1002
|
|
|
988
1003
|
Object.defineProperty(exports, '__esModule', {
|
|
989
1004
|
value: true,
|
|
@@ -1004,7 +1019,7 @@ function syntaxError(source, position, description) {
|
|
|
1004
1019
|
}
|
|
1005
1020
|
});
|
|
1006
1021
|
|
|
1007
|
-
var ast =
|
|
1022
|
+
var ast = createCommonjsModule(function (module, exports) {
|
|
1008
1023
|
|
|
1009
1024
|
Object.defineProperty(exports, '__esModule', {
|
|
1010
1025
|
value: true,
|
|
@@ -1230,7 +1245,7 @@ exports.OperationTypeNode = OperationTypeNode;
|
|
|
1230
1245
|
})(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {}));
|
|
1231
1246
|
});
|
|
1232
1247
|
|
|
1233
|
-
var directiveLocation =
|
|
1248
|
+
var directiveLocation = createCommonjsModule(function (module, exports) {
|
|
1234
1249
|
|
|
1235
1250
|
Object.defineProperty(exports, '__esModule', {
|
|
1236
1251
|
value: true,
|
|
@@ -1272,7 +1287,7 @@ exports.DirectiveLocation = DirectiveLocation;
|
|
|
1272
1287
|
})(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
|
|
1273
1288
|
});
|
|
1274
1289
|
|
|
1275
|
-
var kinds =
|
|
1290
|
+
var kinds = createCommonjsModule(function (module, exports) {
|
|
1276
1291
|
|
|
1277
1292
|
Object.defineProperty(exports, '__esModule', {
|
|
1278
1293
|
value: true,
|
|
@@ -1338,7 +1353,7 @@ exports.Kind = Kind;
|
|
|
1338
1353
|
})(Kind || (exports.Kind = Kind = {}));
|
|
1339
1354
|
});
|
|
1340
1355
|
|
|
1341
|
-
var characterClasses =
|
|
1356
|
+
var characterClasses = createCommonjsModule(function (module, exports) {
|
|
1342
1357
|
|
|
1343
1358
|
Object.defineProperty(exports, '__esModule', {
|
|
1344
1359
|
value: true,
|
|
@@ -1415,7 +1430,7 @@ function isNameContinue(code) {
|
|
|
1415
1430
|
}
|
|
1416
1431
|
});
|
|
1417
1432
|
|
|
1418
|
-
var blockString =
|
|
1433
|
+
var blockString = createCommonjsModule(function (module, exports) {
|
|
1419
1434
|
|
|
1420
1435
|
Object.defineProperty(exports, '__esModule', {
|
|
1421
1436
|
value: true,
|
|
@@ -1612,7 +1627,7 @@ function printBlockString(value, options) {
|
|
|
1612
1627
|
}
|
|
1613
1628
|
});
|
|
1614
1629
|
|
|
1615
|
-
var tokenKind =
|
|
1630
|
+
var tokenKind = createCommonjsModule(function (module, exports) {
|
|
1616
1631
|
|
|
1617
1632
|
Object.defineProperty(exports, '__esModule', {
|
|
1618
1633
|
value: true,
|
|
@@ -1658,7 +1673,7 @@ exports.TokenKind = TokenKind;
|
|
|
1658
1673
|
})(TokenKind || (exports.TokenKind = TokenKind = {}));
|
|
1659
1674
|
});
|
|
1660
1675
|
|
|
1661
|
-
var lexer =
|
|
1676
|
+
var lexer = createCommonjsModule(function (module, exports) {
|
|
1662
1677
|
|
|
1663
1678
|
Object.defineProperty(exports, '__esModule', {
|
|
1664
1679
|
value: true,
|
|
@@ -2666,7 +2681,7 @@ function readName(lexer, start) {
|
|
|
2666
2681
|
}
|
|
2667
2682
|
});
|
|
2668
2683
|
|
|
2669
|
-
var devAssert_1 =
|
|
2684
|
+
var devAssert_1 = createCommonjsModule(function (module, exports) {
|
|
2670
2685
|
|
|
2671
2686
|
Object.defineProperty(exports, '__esModule', {
|
|
2672
2687
|
value: true,
|
|
@@ -2682,7 +2697,7 @@ function devAssert(condition, message) {
|
|
|
2682
2697
|
}
|
|
2683
2698
|
});
|
|
2684
2699
|
|
|
2685
|
-
var inspect_1 =
|
|
2700
|
+
var inspect_1 = createCommonjsModule(function (module, exports) {
|
|
2686
2701
|
|
|
2687
2702
|
Object.defineProperty(exports, '__esModule', {
|
|
2688
2703
|
value: true,
|
|
@@ -2805,7 +2820,7 @@ function getObjectTag(object) {
|
|
|
2805
2820
|
}
|
|
2806
2821
|
});
|
|
2807
2822
|
|
|
2808
|
-
var instanceOf_1 =
|
|
2823
|
+
var instanceOf_1 = createCommonjsModule(function (module, exports) {
|
|
2809
2824
|
|
|
2810
2825
|
Object.defineProperty(exports, '__esModule', {
|
|
2811
2826
|
value: true,
|
|
@@ -2831,7 +2846,7 @@ const instanceOf =
|
|
|
2831
2846
|
exports.instanceOf = instanceOf;
|
|
2832
2847
|
});
|
|
2833
2848
|
|
|
2834
|
-
var source =
|
|
2849
|
+
var source = createCommonjsModule(function (module, exports) {
|
|
2835
2850
|
|
|
2836
2851
|
Object.defineProperty(exports, '__esModule', {
|
|
2837
2852
|
value: true,
|
|
@@ -2898,7 +2913,7 @@ function isSource(source) {
|
|
|
2898
2913
|
}
|
|
2899
2914
|
});
|
|
2900
2915
|
|
|
2901
|
-
var parser =
|
|
2916
|
+
var parser = createCommonjsModule(function (module, exports) {
|
|
2902
2917
|
|
|
2903
2918
|
Object.defineProperty(exports, '__esModule', {
|
|
2904
2919
|
value: true,
|
|
@@ -4467,7 +4482,7 @@ function getTokenKindDesc(kind) {
|
|
|
4467
4482
|
}
|
|
4468
4483
|
});
|
|
4469
4484
|
|
|
4470
|
-
var printString_1 =
|
|
4485
|
+
var printString_1 = createCommonjsModule(function (module, exports) {
|
|
4471
4486
|
|
|
4472
4487
|
Object.defineProperty(exports, '__esModule', {
|
|
4473
4488
|
value: true,
|
|
@@ -4652,7 +4667,7 @@ const escapeSequences = [
|
|
|
4652
4667
|
];
|
|
4653
4668
|
});
|
|
4654
4669
|
|
|
4655
|
-
var visitor =
|
|
4670
|
+
var visitor = createCommonjsModule(function (module, exports) {
|
|
4656
4671
|
|
|
4657
4672
|
Object.defineProperty(exports, '__esModule', {
|
|
4658
4673
|
value: true,
|
|
@@ -5031,7 +5046,7 @@ function getVisitFn(visitor, kind, isLeaving) {
|
|
|
5031
5046
|
}
|
|
5032
5047
|
});
|
|
5033
5048
|
|
|
5034
|
-
var printer =
|
|
5049
|
+
var printer = createCommonjsModule(function (module, exports) {
|
|
5035
5050
|
|
|
5036
5051
|
Object.defineProperty(exports, '__esModule', {
|
|
5037
5052
|
value: true,
|
|
@@ -5465,7 +5480,7 @@ var _public = {
|
|
|
5465
5480
|
/* eslint-env browser */
|
|
5466
5481
|
var browser = typeof self == 'object' ? self.FormData : window.FormData;
|
|
5467
5482
|
|
|
5468
|
-
var defaultJsonSerializer =
|
|
5483
|
+
var defaultJsonSerializer = createCommonjsModule(function (module, exports) {
|
|
5469
5484
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5470
5485
|
exports.defaultJsonSerializer = void 0;
|
|
5471
5486
|
exports.defaultJsonSerializer = {
|
|
@@ -5475,8 +5490,8 @@ exports.defaultJsonSerializer = {
|
|
|
5475
5490
|
//# sourceMappingURL=defaultJsonSerializer.js.map
|
|
5476
5491
|
});
|
|
5477
5492
|
|
|
5478
|
-
var createRequestBody_1 =
|
|
5479
|
-
var __importDefault = (
|
|
5493
|
+
var createRequestBody_1 = createCommonjsModule(function (module, exports) {
|
|
5494
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
5480
5495
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5481
5496
|
};
|
|
5482
5497
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5532,7 +5547,7 @@ exports.default = createRequestBody;
|
|
|
5532
5547
|
//# sourceMappingURL=createRequestBody.js.map
|
|
5533
5548
|
});
|
|
5534
5549
|
|
|
5535
|
-
var parseArgs =
|
|
5550
|
+
var parseArgs = createCommonjsModule(function (module, exports) {
|
|
5536
5551
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5537
5552
|
exports.parseBatchRequestsExtendedArgs = exports.parseRawRequestExtendedArgs = exports.parseRequestExtendedArgs = exports.parseBatchRequestArgs = exports.parseRawRequestArgs = exports.parseRequestArgs = void 0;
|
|
5538
5553
|
function parseRequestArgs(documentOrOptions, variables, requestHeaders) {
|
|
@@ -5605,8 +5620,8 @@ exports.parseBatchRequestsExtendedArgs = parseBatchRequestsExtendedArgs;
|
|
|
5605
5620
|
//# sourceMappingURL=parseArgs.js.map
|
|
5606
5621
|
});
|
|
5607
5622
|
|
|
5608
|
-
var types =
|
|
5609
|
-
var __extends = (
|
|
5623
|
+
var types = createCommonjsModule(function (module, exports) {
|
|
5624
|
+
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
5610
5625
|
var extendStatics = function (d, b) {
|
|
5611
5626
|
extendStatics = Object.setPrototypeOf ||
|
|
5612
5627
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -5655,8 +5670,8 @@ exports.ClientError = ClientError;
|
|
|
5655
5670
|
//# sourceMappingURL=types.js.map
|
|
5656
5671
|
});
|
|
5657
5672
|
|
|
5658
|
-
var graphqlWs =
|
|
5659
|
-
var __assign = (
|
|
5673
|
+
var graphqlWs = createCommonjsModule(function (module, exports) {
|
|
5674
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
5660
5675
|
__assign = Object.assign || function(t) {
|
|
5661
5676
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5662
5677
|
s = arguments[i];
|
|
@@ -5667,7 +5682,7 @@ var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlob
|
|
|
5667
5682
|
};
|
|
5668
5683
|
return __assign.apply(this, arguments);
|
|
5669
5684
|
};
|
|
5670
|
-
var __awaiter = (
|
|
5685
|
+
var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5671
5686
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5672
5687
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5673
5688
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -5676,7 +5691,7 @@ var __awaiter = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlo
|
|
|
5676
5691
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5677
5692
|
});
|
|
5678
5693
|
};
|
|
5679
|
-
var __generator = (
|
|
5694
|
+
var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
5680
5695
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
5681
5696
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5682
5697
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -5929,8 +5944,8 @@ function Complete(id) {
|
|
|
5929
5944
|
//# sourceMappingURL=graphql-ws.js.map
|
|
5930
5945
|
});
|
|
5931
5946
|
|
|
5932
|
-
var dist =
|
|
5933
|
-
var __assign = (
|
|
5947
|
+
var dist = createCommonjsModule(function (module, exports) {
|
|
5948
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
5934
5949
|
__assign = Object.assign || function(t) {
|
|
5935
5950
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5936
5951
|
s = arguments[i];
|
|
@@ -5941,26 +5956,26 @@ var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlob
|
|
|
5941
5956
|
};
|
|
5942
5957
|
return __assign.apply(this, arguments);
|
|
5943
5958
|
};
|
|
5944
|
-
var __createBinding = (
|
|
5959
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5945
5960
|
if (k2 === undefined) k2 = k;
|
|
5946
5961
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5947
5962
|
}) : (function(o, m, k, k2) {
|
|
5948
5963
|
if (k2 === undefined) k2 = k;
|
|
5949
5964
|
o[k2] = m[k];
|
|
5950
5965
|
}));
|
|
5951
|
-
var __setModuleDefault = (
|
|
5966
|
+
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
5952
5967
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
5953
5968
|
}) : function(o, v) {
|
|
5954
5969
|
o["default"] = v;
|
|
5955
5970
|
});
|
|
5956
|
-
var __importStar = (
|
|
5971
|
+
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
5957
5972
|
if (mod && mod.__esModule) return mod;
|
|
5958
5973
|
var result = {};
|
|
5959
5974
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
5960
5975
|
__setModuleDefault(result, mod);
|
|
5961
5976
|
return result;
|
|
5962
5977
|
};
|
|
5963
|
-
var __awaiter = (
|
|
5978
|
+
var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5964
5979
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5965
5980
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5966
5981
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -5969,7 +5984,7 @@ var __awaiter = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlo
|
|
|
5969
5984
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5970
5985
|
});
|
|
5971
5986
|
};
|
|
5972
|
-
var __generator = (
|
|
5987
|
+
var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
5973
5988
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
5974
5989
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5975
5990
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -5996,7 +6011,7 @@ var __generator = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsG
|
|
|
5996
6011
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
5997
6012
|
}
|
|
5998
6013
|
};
|
|
5999
|
-
var __rest = (
|
|
6014
|
+
var __rest = (commonjsGlobal && commonjsGlobal.__rest) || function (s, e) {
|
|
6000
6015
|
var t = {};
|
|
6001
6016
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
6002
6017
|
t[p] = s[p];
|
|
@@ -6007,7 +6022,7 @@ var __rest = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal
|
|
|
6007
6022
|
}
|
|
6008
6023
|
return t;
|
|
6009
6024
|
};
|
|
6010
|
-
var __importDefault = (
|
|
6025
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
6011
6026
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6012
6027
|
};
|
|
6013
6028
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6418,633 +6433,633 @@ Object.defineProperty(exports, "GraphQLWebSocketClient", { enumerable: true, get
|
|
|
6418
6433
|
//# sourceMappingURL=index.js.map
|
|
6419
6434
|
});
|
|
6420
6435
|
|
|
6421
|
-
class HttpFetcher {
|
|
6422
|
-
constructor() {
|
|
6423
|
-
this.watingRequestsById = new Map();
|
|
6424
|
-
}
|
|
6425
|
-
static get() {
|
|
6426
|
-
if (!HttpFetcher.instance) {
|
|
6427
|
-
HttpFetcher.instance = new HttpFetcher();
|
|
6428
|
-
const application = document.querySelector(this.appTagName);
|
|
6429
|
-
if (application === null) {
|
|
6430
|
-
HttpFetcher.instance.resume();
|
|
6431
|
-
}
|
|
6432
|
-
else {
|
|
6433
|
-
application.addEventListener('applicationLoading', () => HttpFetcher.instance.pause());
|
|
6434
|
-
application.addEventListener('applicationLoaded', () => HttpFetcher.instance.resume());
|
|
6435
|
-
}
|
|
6436
|
-
}
|
|
6437
|
-
return this.instance;
|
|
6438
|
-
}
|
|
6439
|
-
async callGraphQL(req) {
|
|
6440
|
-
var _a;
|
|
6441
|
-
const reqKey = this.getReqKey(req);
|
|
6442
|
-
req.queryID = reqKey;
|
|
6443
|
-
req.values.queryID = reqKey;
|
|
6444
|
-
if (this.ready) {
|
|
6445
|
-
return new Promise(async (resolve, reject) => {
|
|
6446
|
-
let query = this.getQueryTemplate(req);
|
|
6447
|
-
const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
|
|
6448
|
-
if (res.errors.length > 0) {
|
|
6449
|
-
reject(res);
|
|
6450
|
-
}
|
|
6451
|
-
else {
|
|
6452
|
-
//resolve(res);
|
|
6453
|
-
//FIXME: Precisamos trabalhar melhor a resposta, quem chamou
|
|
6454
|
-
//a API não pode ficar responsavel por desempacotar... fiz uma
|
|
6455
|
-
//gambiarra aqui...
|
|
6456
|
-
resolve(res.data[0][reqKey]);
|
|
6457
|
-
}
|
|
6458
|
-
});
|
|
6459
|
-
}
|
|
6460
|
-
else {
|
|
6461
|
-
if (!this.watingRequestsById.has(reqKey)) {
|
|
6462
|
-
this.watingRequestsById.set(reqKey, new WaitingRequest(req));
|
|
6463
|
-
}
|
|
6464
|
-
return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
|
|
6465
|
-
}
|
|
6466
|
-
}
|
|
6467
|
-
getReqKey(req) {
|
|
6468
|
-
return window.btoa(this.hashCode(`${req.query}${JSON.stringify(req.values || "")}`)).replace(/=/g, "");
|
|
6469
|
-
}
|
|
6470
|
-
getQueryTemplate(re) {
|
|
6471
|
-
return (re.query || "").replaceAll("$queryAlias$", re.queryID);
|
|
6472
|
-
}
|
|
6473
|
-
getWatingRequest(reqID) {
|
|
6474
|
-
return this.watingRequestsById.get(reqID);
|
|
6475
|
-
}
|
|
6476
|
-
pause() {
|
|
6477
|
-
this.ready = false;
|
|
6478
|
-
}
|
|
6479
|
-
async resume() {
|
|
6480
|
-
this.ready = true;
|
|
6481
|
-
if (this.watingRequestsById.size > 0) {
|
|
6482
|
-
const requestsBatch = [];
|
|
6483
|
-
this.watingRequestsById.forEach(async (waitingReq) => {
|
|
6484
|
-
let query = this.getQueryTemplate(waitingReq.request);
|
|
6485
|
-
requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
|
|
6486
|
-
});
|
|
6487
|
-
let res = undefined;
|
|
6488
|
-
let dataResponse = [];
|
|
6489
|
-
let errorsResponse = [];
|
|
6490
|
-
res = await this.fecthGrapql(requestsBatch);
|
|
6491
|
-
dataResponse = res.data;
|
|
6492
|
-
errorsResponse = res.errors;
|
|
6493
|
-
//Reject promises with errors from query
|
|
6494
|
-
errorsResponse.forEach((errorResponse) => {
|
|
6495
|
-
Object.entries(errorResponse).forEach(([_key, val]) => {
|
|
6496
|
-
var _a;
|
|
6497
|
-
(((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(val);
|
|
6498
|
-
});
|
|
6499
|
-
});
|
|
6500
|
-
//Resolve promises with data from query
|
|
6501
|
-
dataResponse.forEach((data) => {
|
|
6502
|
-
Object.entries(data).forEach(([key, val]) => {
|
|
6503
|
-
var _a;
|
|
6504
|
-
(((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
|
|
6505
|
-
});
|
|
6506
|
-
});
|
|
6507
|
-
this.watingRequestsById.clear();
|
|
6508
|
-
}
|
|
6509
|
-
}
|
|
6510
|
-
async fecthGrapql(request) {
|
|
6511
|
-
let res = undefined;
|
|
6512
|
-
let dataResponse = [];
|
|
6513
|
-
let errorsResponse = [];
|
|
6514
|
-
try {
|
|
6515
|
-
res = await dist.batchRequests('http://localhost:8082/', request);
|
|
6516
|
-
res.forEach((resItem) => {
|
|
6517
|
-
dataResponse.push(resItem.data);
|
|
6518
|
-
});
|
|
6519
|
-
}
|
|
6520
|
-
catch (err) {
|
|
6521
|
-
//TODO: Tratar erro quando não existir err.response
|
|
6522
|
-
res = err.response;
|
|
6523
|
-
const req = err.request;
|
|
6524
|
-
Object.entries(res).forEach(([key, val]) => {
|
|
6525
|
-
if (val.errors) {
|
|
6526
|
-
errorsResponse.push(val.errors.map((item) => {
|
|
6527
|
-
item.request = req;
|
|
6528
|
-
item.index = Number(key);
|
|
6529
|
-
return item;
|
|
6530
|
-
}));
|
|
6531
|
-
}
|
|
6532
|
-
else if (val.data) {
|
|
6533
|
-
dataResponse.push(val.data);
|
|
6534
|
-
}
|
|
6535
|
-
});
|
|
6536
|
-
}
|
|
6537
|
-
return { data: dataResponse, errors: errorsResponse };
|
|
6538
|
-
}
|
|
6539
|
-
//TODO: Mover este metodo para o @sankhyalabs/core classe string utils.
|
|
6540
|
-
hashCode(txt) {
|
|
6541
|
-
var hash = 0, i, chr;
|
|
6542
|
-
if (txt.length === 0)
|
|
6543
|
-
return hash.toString();
|
|
6544
|
-
for (i = 0; i < txt.length; i++) {
|
|
6545
|
-
chr = txt.charCodeAt(i);
|
|
6546
|
-
hash = ((hash << 5) - hash) + chr;
|
|
6547
|
-
hash |= 0; // Convert to 32bit integer
|
|
6548
|
-
}
|
|
6549
|
-
return hash.toString();
|
|
6550
|
-
}
|
|
6551
|
-
;
|
|
6552
|
-
}
|
|
6553
|
-
HttpFetcher.appTagName = "snk-application";
|
|
6554
|
-
class WaitingRequest {
|
|
6555
|
-
constructor(req) {
|
|
6556
|
-
this._resolve = () => { };
|
|
6557
|
-
this._reject = () => { };
|
|
6558
|
-
this._request = undefined;
|
|
6559
|
-
this._request = req;
|
|
6560
|
-
this._promisse = new Promise((resolve, reject) => {
|
|
6561
|
-
this._resolve = resolve;
|
|
6562
|
-
this._reject = reject;
|
|
6563
|
-
});
|
|
6564
|
-
}
|
|
6565
|
-
get resolve() {
|
|
6566
|
-
return this._resolve;
|
|
6567
|
-
}
|
|
6568
|
-
get reject() {
|
|
6569
|
-
return this._reject;
|
|
6570
|
-
}
|
|
6571
|
-
get promise() {
|
|
6572
|
-
return this._promisse;
|
|
6573
|
-
}
|
|
6574
|
-
get request() {
|
|
6575
|
-
return this._request;
|
|
6576
|
-
}
|
|
6436
|
+
class HttpFetcher {
|
|
6437
|
+
constructor() {
|
|
6438
|
+
this.watingRequestsById = new Map();
|
|
6439
|
+
}
|
|
6440
|
+
static get() {
|
|
6441
|
+
if (!HttpFetcher.instance) {
|
|
6442
|
+
HttpFetcher.instance = new HttpFetcher();
|
|
6443
|
+
const application = document.querySelector(this.appTagName);
|
|
6444
|
+
if (application === null) {
|
|
6445
|
+
HttpFetcher.instance.resume();
|
|
6446
|
+
}
|
|
6447
|
+
else {
|
|
6448
|
+
application.addEventListener('applicationLoading', () => HttpFetcher.instance.pause());
|
|
6449
|
+
application.addEventListener('applicationLoaded', () => HttpFetcher.instance.resume());
|
|
6450
|
+
}
|
|
6451
|
+
}
|
|
6452
|
+
return this.instance;
|
|
6453
|
+
}
|
|
6454
|
+
async callGraphQL(req) {
|
|
6455
|
+
var _a;
|
|
6456
|
+
const reqKey = this.getReqKey(req);
|
|
6457
|
+
req.queryID = reqKey;
|
|
6458
|
+
req.values.queryID = reqKey;
|
|
6459
|
+
if (this.ready) {
|
|
6460
|
+
return new Promise(async (resolve, reject) => {
|
|
6461
|
+
let query = this.getQueryTemplate(req);
|
|
6462
|
+
const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
|
|
6463
|
+
if (res.errors.length > 0) {
|
|
6464
|
+
reject(res);
|
|
6465
|
+
}
|
|
6466
|
+
else {
|
|
6467
|
+
//resolve(res);
|
|
6468
|
+
//FIXME: Precisamos trabalhar melhor a resposta, quem chamou
|
|
6469
|
+
//a API não pode ficar responsavel por desempacotar... fiz uma
|
|
6470
|
+
//gambiarra aqui...
|
|
6471
|
+
resolve(res.data[0][reqKey]);
|
|
6472
|
+
}
|
|
6473
|
+
});
|
|
6474
|
+
}
|
|
6475
|
+
else {
|
|
6476
|
+
if (!this.watingRequestsById.has(reqKey)) {
|
|
6477
|
+
this.watingRequestsById.set(reqKey, new WaitingRequest(req));
|
|
6478
|
+
}
|
|
6479
|
+
return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
|
|
6480
|
+
}
|
|
6481
|
+
}
|
|
6482
|
+
getReqKey(req) {
|
|
6483
|
+
return window.btoa(this.hashCode(`${req.query}${JSON.stringify(req.values || "")}`)).replace(/=/g, "");
|
|
6484
|
+
}
|
|
6485
|
+
getQueryTemplate(re) {
|
|
6486
|
+
return (re.query || "").replaceAll("$queryAlias$", re.queryID);
|
|
6487
|
+
}
|
|
6488
|
+
getWatingRequest(reqID) {
|
|
6489
|
+
return this.watingRequestsById.get(reqID);
|
|
6490
|
+
}
|
|
6491
|
+
pause() {
|
|
6492
|
+
this.ready = false;
|
|
6493
|
+
}
|
|
6494
|
+
async resume() {
|
|
6495
|
+
this.ready = true;
|
|
6496
|
+
if (this.watingRequestsById.size > 0) {
|
|
6497
|
+
const requestsBatch = [];
|
|
6498
|
+
this.watingRequestsById.forEach(async (waitingReq) => {
|
|
6499
|
+
let query = this.getQueryTemplate(waitingReq.request);
|
|
6500
|
+
requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
|
|
6501
|
+
});
|
|
6502
|
+
let res = undefined;
|
|
6503
|
+
let dataResponse = [];
|
|
6504
|
+
let errorsResponse = [];
|
|
6505
|
+
res = await this.fecthGrapql(requestsBatch);
|
|
6506
|
+
dataResponse = res.data;
|
|
6507
|
+
errorsResponse = res.errors;
|
|
6508
|
+
//Reject promises with errors from query
|
|
6509
|
+
errorsResponse.forEach((errorResponse) => {
|
|
6510
|
+
Object.entries(errorResponse).forEach(([_key, val]) => {
|
|
6511
|
+
var _a;
|
|
6512
|
+
(((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(val);
|
|
6513
|
+
});
|
|
6514
|
+
});
|
|
6515
|
+
//Resolve promises with data from query
|
|
6516
|
+
dataResponse.forEach((data) => {
|
|
6517
|
+
Object.entries(data).forEach(([key, val]) => {
|
|
6518
|
+
var _a;
|
|
6519
|
+
(((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
|
|
6520
|
+
});
|
|
6521
|
+
});
|
|
6522
|
+
this.watingRequestsById.clear();
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6525
|
+
async fecthGrapql(request) {
|
|
6526
|
+
let res = undefined;
|
|
6527
|
+
let dataResponse = [];
|
|
6528
|
+
let errorsResponse = [];
|
|
6529
|
+
try {
|
|
6530
|
+
res = await dist.batchRequests('http://localhost:8082/', request);
|
|
6531
|
+
res.forEach((resItem) => {
|
|
6532
|
+
dataResponse.push(resItem.data);
|
|
6533
|
+
});
|
|
6534
|
+
}
|
|
6535
|
+
catch (err) {
|
|
6536
|
+
//TODO: Tratar erro quando não existir err.response
|
|
6537
|
+
res = err.response;
|
|
6538
|
+
const req = err.request;
|
|
6539
|
+
Object.entries(res).forEach(([key, val]) => {
|
|
6540
|
+
if (val.errors) {
|
|
6541
|
+
errorsResponse.push(val.errors.map((item) => {
|
|
6542
|
+
item.request = req;
|
|
6543
|
+
item.index = Number(key);
|
|
6544
|
+
return item;
|
|
6545
|
+
}));
|
|
6546
|
+
}
|
|
6547
|
+
else if (val.data) {
|
|
6548
|
+
dataResponse.push(val.data);
|
|
6549
|
+
}
|
|
6550
|
+
});
|
|
6551
|
+
}
|
|
6552
|
+
return { data: dataResponse, errors: errorsResponse };
|
|
6553
|
+
}
|
|
6554
|
+
//TODO: Mover este metodo para o @sankhyalabs/core classe string utils.
|
|
6555
|
+
hashCode(txt) {
|
|
6556
|
+
var hash = 0, i, chr;
|
|
6557
|
+
if (txt.length === 0)
|
|
6558
|
+
return hash.toString();
|
|
6559
|
+
for (i = 0; i < txt.length; i++) {
|
|
6560
|
+
chr = txt.charCodeAt(i);
|
|
6561
|
+
hash = ((hash << 5) - hash) + chr;
|
|
6562
|
+
hash |= 0; // Convert to 32bit integer
|
|
6563
|
+
}
|
|
6564
|
+
return hash.toString();
|
|
6565
|
+
}
|
|
6566
|
+
;
|
|
6567
|
+
}
|
|
6568
|
+
HttpFetcher.appTagName = "snk-application";
|
|
6569
|
+
class WaitingRequest {
|
|
6570
|
+
constructor(req) {
|
|
6571
|
+
this._resolve = () => { };
|
|
6572
|
+
this._reject = () => { };
|
|
6573
|
+
this._request = undefined;
|
|
6574
|
+
this._request = req;
|
|
6575
|
+
this._promisse = new Promise((resolve, reject) => {
|
|
6576
|
+
this._resolve = resolve;
|
|
6577
|
+
this._reject = reject;
|
|
6578
|
+
});
|
|
6579
|
+
}
|
|
6580
|
+
get resolve() {
|
|
6581
|
+
return this._resolve;
|
|
6582
|
+
}
|
|
6583
|
+
get reject() {
|
|
6584
|
+
return this._reject;
|
|
6585
|
+
}
|
|
6586
|
+
get promise() {
|
|
6587
|
+
return this._promisse;
|
|
6588
|
+
}
|
|
6589
|
+
get request() {
|
|
6590
|
+
return this._request;
|
|
6591
|
+
}
|
|
6577
6592
|
}
|
|
6578
6593
|
|
|
6579
|
-
class DataUnitFetcher {
|
|
6580
|
-
constructor() {
|
|
6581
|
-
this.templateByQuery = new Map();
|
|
6582
|
-
this.buldTemplates();
|
|
6583
|
-
}
|
|
6584
|
-
buldTemplates() {
|
|
6585
|
-
this.templateByQuery.set("fetchDataUnit", dist.gql `query($name: String!) {
|
|
6586
|
-
$queryAlias$: fetchDataUnit(name: $name){
|
|
6587
|
-
name
|
|
6588
|
-
fields{
|
|
6589
|
-
name
|
|
6590
|
-
defaultValue
|
|
6591
|
-
label
|
|
6592
|
-
readOnly
|
|
6593
|
-
required
|
|
6594
|
-
dataType
|
|
6595
|
-
userInterface
|
|
6596
|
-
properties{
|
|
6597
|
-
name
|
|
6598
|
-
value
|
|
6599
|
-
}
|
|
6600
|
-
dependencies{
|
|
6601
|
-
masterFields
|
|
6602
|
-
type
|
|
6603
|
-
expression
|
|
6604
|
-
}
|
|
6605
|
-
}
|
|
6606
|
-
}
|
|
6607
|
-
}`);
|
|
6608
|
-
this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $first: Int $offset:Int $filter: [Filter!] $sort: [Sort!]) {
|
|
6609
|
-
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
6610
|
-
data(first: $first offset: $offset filters: $filter sort: $sort){
|
|
6611
|
-
first
|
|
6612
|
-
offset
|
|
6613
|
-
total
|
|
6614
|
-
hasMore
|
|
6615
|
-
records{
|
|
6616
|
-
id
|
|
6617
|
-
fields {
|
|
6618
|
-
name
|
|
6619
|
-
value
|
|
6620
|
-
}
|
|
6621
|
-
}
|
|
6622
|
-
}
|
|
6623
|
-
}
|
|
6624
|
-
}`);
|
|
6625
|
-
this.templateByQuery.set("saveData", dist.gql `mutation($changes: [Change!]!) {
|
|
6626
|
-
$queryAlias$: saveDataUnitChanges(changes: $changes){
|
|
6627
|
-
oldId
|
|
6628
|
-
id
|
|
6629
|
-
fields {
|
|
6630
|
-
name
|
|
6631
|
-
value
|
|
6632
|
-
}
|
|
6633
|
-
}
|
|
6634
|
-
}`);
|
|
6635
|
-
}
|
|
6636
|
-
getDataUnit(entityName, resourceID) {
|
|
6637
|
-
const dataUnit = new core.DataUnit(`dd://${entityName}/${resourceID}`);
|
|
6638
|
-
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
|
6639
|
-
dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
|
|
6640
|
-
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
6641
|
-
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
6642
|
-
return dataUnit;
|
|
6643
|
-
}
|
|
6644
|
-
loadMetadata(dataUnit) {
|
|
6645
|
-
return new Promise((resolve, reject) => {
|
|
6646
|
-
HttpFetcher.get()
|
|
6647
|
-
.callGraphQL({
|
|
6648
|
-
values: { name: dataUnit.name },
|
|
6649
|
-
query: this.templateByQuery.get("fetchDataUnit"),
|
|
6650
|
-
})
|
|
6651
|
-
.then((resp) => {
|
|
6652
|
-
var _a;
|
|
6653
|
-
const metadata = {
|
|
6654
|
-
name: resp.name,
|
|
6655
|
-
label: resp.name,
|
|
6656
|
-
fields: [],
|
|
6657
|
-
};
|
|
6658
|
-
(_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
|
|
6659
|
-
let properties = undefined;
|
|
6660
|
-
if (Array.isArray(source.properties)) {
|
|
6661
|
-
properties = {};
|
|
6662
|
-
source.properties.forEach((prop) => (properties[prop.name] = prop.value));
|
|
6663
|
-
}
|
|
6664
|
-
metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
|
|
6665
|
-
});
|
|
6666
|
-
resolve(metadata);
|
|
6667
|
-
})
|
|
6668
|
-
.catch((error) => {
|
|
6669
|
-
reject(error);
|
|
6670
|
-
});
|
|
6671
|
-
});
|
|
6672
|
-
}
|
|
6673
|
-
loadData(dataUnit, sort, filters) {
|
|
6674
|
-
return new Promise((resolve, reject) => {
|
|
6675
|
-
HttpFetcher.get()
|
|
6676
|
-
.callGraphQL({
|
|
6677
|
-
values: { dataunit: dataUnit.name, sort, filters },
|
|
6678
|
-
query: this.templateByQuery.get("fetchData"),
|
|
6679
|
-
})
|
|
6680
|
-
.then((resp) => {
|
|
6681
|
-
const result = resp.data;
|
|
6682
|
-
const dataUnitRecords = [];
|
|
6683
|
-
result.records.forEach((responseRecord) => {
|
|
6684
|
-
const duRecord = { __record__id__: responseRecord.id };
|
|
6685
|
-
responseRecord.fields.forEach(({ name, value }) => {
|
|
6686
|
-
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
6687
|
-
});
|
|
6688
|
-
dataUnitRecords.push(duRecord);
|
|
6689
|
-
});
|
|
6690
|
-
resolve(dataUnitRecords);
|
|
6691
|
-
})
|
|
6692
|
-
.catch((error) => {
|
|
6693
|
-
reject(error);
|
|
6694
|
-
});
|
|
6695
|
-
});
|
|
6696
|
-
}
|
|
6697
|
-
saveData(dataUnit, duChanges) {
|
|
6698
|
-
const changes = duChanges.map((change) => {
|
|
6699
|
-
const { dataUnit: changeDU, record, updatingFields, operation } = change;
|
|
6700
|
-
const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
|
6701
|
-
return { fieldName, value: this.formatValueToServer(value) };
|
|
6702
|
-
});
|
|
6703
|
-
return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
|
|
6704
|
-
});
|
|
6705
|
-
return new Promise((resolve, reject) => {
|
|
6706
|
-
HttpFetcher.get()
|
|
6707
|
-
.callGraphQL({
|
|
6708
|
-
values: { changes: changes },
|
|
6709
|
-
query: this.templateByQuery.get("saveData"),
|
|
6710
|
-
})
|
|
6711
|
-
.then((resp) => {
|
|
6712
|
-
const dataUnitRecords = [];
|
|
6713
|
-
resp === null || resp === void 0 ? void 0 : resp.forEach((responseRecord) => {
|
|
6714
|
-
const duRecord = { __record__id__: responseRecord.id };
|
|
6715
|
-
if (responseRecord.oldId) {
|
|
6716
|
-
duRecord.__old__id__ = responseRecord.oldId;
|
|
6717
|
-
}
|
|
6718
|
-
responseRecord.fields.forEach(({ name, value }) => {
|
|
6719
|
-
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
6720
|
-
});
|
|
6721
|
-
dataUnitRecords.push(duRecord);
|
|
6722
|
-
});
|
|
6723
|
-
resolve(dataUnitRecords);
|
|
6724
|
-
})
|
|
6725
|
-
.catch((error) => {
|
|
6726
|
-
reject(error);
|
|
6727
|
-
});
|
|
6728
|
-
});
|
|
6729
|
-
}
|
|
6730
|
-
formatValueToServer(value) {
|
|
6731
|
-
if (value === undefined)
|
|
6732
|
-
return value;
|
|
6733
|
-
try {
|
|
6734
|
-
if (value instanceof Date) {
|
|
6735
|
-
return value.toString();
|
|
6736
|
-
}
|
|
6737
|
-
//Any others objects
|
|
6738
|
-
value = JSON.stringify(value);
|
|
6739
|
-
}
|
|
6740
|
-
catch (_a) {
|
|
6741
|
-
value = value.toString();
|
|
6742
|
-
}
|
|
6743
|
-
return value;
|
|
6744
|
-
}
|
|
6745
|
-
removeRecords(dataUnit, recordIds) {
|
|
6746
|
-
const changes = recordIds.map((recordId) => {
|
|
6747
|
-
return { dataUnit: dataUnit.name, operation: core.ChangeOperation.DELETE, recordId };
|
|
6748
|
-
});
|
|
6749
|
-
return new Promise((resolve, reject) => {
|
|
6750
|
-
HttpFetcher.get()
|
|
6751
|
-
.callGraphQL({
|
|
6752
|
-
values: { changes: changes },
|
|
6753
|
-
query: this.templateByQuery.get("saveData"),
|
|
6754
|
-
})
|
|
6755
|
-
.then((_resp) => {
|
|
6756
|
-
resolve(recordIds);
|
|
6757
|
-
})
|
|
6758
|
-
.catch((error) => {
|
|
6759
|
-
reject(error);
|
|
6760
|
-
});
|
|
6761
|
-
});
|
|
6762
|
-
}
|
|
6594
|
+
class DataUnitFetcher {
|
|
6595
|
+
constructor() {
|
|
6596
|
+
this.templateByQuery = new Map();
|
|
6597
|
+
this.buldTemplates();
|
|
6598
|
+
}
|
|
6599
|
+
buldTemplates() {
|
|
6600
|
+
this.templateByQuery.set("fetchDataUnit", dist.gql `query($name: String!) {
|
|
6601
|
+
$queryAlias$: fetchDataUnit(name: $name){
|
|
6602
|
+
name
|
|
6603
|
+
fields{
|
|
6604
|
+
name
|
|
6605
|
+
defaultValue
|
|
6606
|
+
label
|
|
6607
|
+
readOnly
|
|
6608
|
+
required
|
|
6609
|
+
dataType
|
|
6610
|
+
userInterface
|
|
6611
|
+
properties{
|
|
6612
|
+
name
|
|
6613
|
+
value
|
|
6614
|
+
}
|
|
6615
|
+
dependencies{
|
|
6616
|
+
masterFields
|
|
6617
|
+
type
|
|
6618
|
+
expression
|
|
6619
|
+
}
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6622
|
+
}`);
|
|
6623
|
+
this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $first: Int $offset:Int $filter: [Filter!] $sort: [Sort!]) {
|
|
6624
|
+
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
6625
|
+
data(first: $first offset: $offset filters: $filter sort: $sort){
|
|
6626
|
+
first
|
|
6627
|
+
offset
|
|
6628
|
+
total
|
|
6629
|
+
hasMore
|
|
6630
|
+
records{
|
|
6631
|
+
id
|
|
6632
|
+
fields {
|
|
6633
|
+
name
|
|
6634
|
+
value
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
}`);
|
|
6640
|
+
this.templateByQuery.set("saveData", dist.gql `mutation($changes: [Change!]!) {
|
|
6641
|
+
$queryAlias$: saveDataUnitChanges(changes: $changes){
|
|
6642
|
+
oldId
|
|
6643
|
+
id
|
|
6644
|
+
fields {
|
|
6645
|
+
name
|
|
6646
|
+
value
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
}`);
|
|
6650
|
+
}
|
|
6651
|
+
getDataUnit(entityName, resourceID) {
|
|
6652
|
+
const dataUnit = new core.DataUnit(`dd://${entityName}/${resourceID}`);
|
|
6653
|
+
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
|
6654
|
+
dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
|
|
6655
|
+
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
6656
|
+
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
6657
|
+
return dataUnit;
|
|
6658
|
+
}
|
|
6659
|
+
loadMetadata(dataUnit) {
|
|
6660
|
+
return new Promise((resolve, reject) => {
|
|
6661
|
+
HttpFetcher.get()
|
|
6662
|
+
.callGraphQL({
|
|
6663
|
+
values: { name: dataUnit.name },
|
|
6664
|
+
query: this.templateByQuery.get("fetchDataUnit"),
|
|
6665
|
+
})
|
|
6666
|
+
.then((resp) => {
|
|
6667
|
+
var _a;
|
|
6668
|
+
const metadata = {
|
|
6669
|
+
name: resp.name,
|
|
6670
|
+
label: resp.name,
|
|
6671
|
+
fields: [],
|
|
6672
|
+
};
|
|
6673
|
+
(_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
|
|
6674
|
+
let properties = undefined;
|
|
6675
|
+
if (Array.isArray(source.properties)) {
|
|
6676
|
+
properties = {};
|
|
6677
|
+
source.properties.forEach((prop) => (properties[prop.name] = prop.value));
|
|
6678
|
+
}
|
|
6679
|
+
metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
|
|
6680
|
+
});
|
|
6681
|
+
resolve(metadata);
|
|
6682
|
+
})
|
|
6683
|
+
.catch((error) => {
|
|
6684
|
+
reject(error);
|
|
6685
|
+
});
|
|
6686
|
+
});
|
|
6687
|
+
}
|
|
6688
|
+
loadData(dataUnit, sort, filters) {
|
|
6689
|
+
return new Promise((resolve, reject) => {
|
|
6690
|
+
HttpFetcher.get()
|
|
6691
|
+
.callGraphQL({
|
|
6692
|
+
values: { dataunit: dataUnit.name, sort, filters },
|
|
6693
|
+
query: this.templateByQuery.get("fetchData"),
|
|
6694
|
+
})
|
|
6695
|
+
.then((resp) => {
|
|
6696
|
+
const result = resp.data;
|
|
6697
|
+
const dataUnitRecords = [];
|
|
6698
|
+
result.records.forEach((responseRecord) => {
|
|
6699
|
+
const duRecord = { __record__id__: responseRecord.id };
|
|
6700
|
+
responseRecord.fields.forEach(({ name, value }) => {
|
|
6701
|
+
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
6702
|
+
});
|
|
6703
|
+
dataUnitRecords.push(duRecord);
|
|
6704
|
+
});
|
|
6705
|
+
resolve(dataUnitRecords);
|
|
6706
|
+
})
|
|
6707
|
+
.catch((error) => {
|
|
6708
|
+
reject(error);
|
|
6709
|
+
});
|
|
6710
|
+
});
|
|
6711
|
+
}
|
|
6712
|
+
saveData(dataUnit, duChanges) {
|
|
6713
|
+
const changes = duChanges.map((change) => {
|
|
6714
|
+
const { dataUnit: changeDU, record, updatingFields, operation } = change;
|
|
6715
|
+
const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
|
6716
|
+
return { fieldName, value: this.formatValueToServer(value) };
|
|
6717
|
+
});
|
|
6718
|
+
return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
|
|
6719
|
+
});
|
|
6720
|
+
return new Promise((resolve, reject) => {
|
|
6721
|
+
HttpFetcher.get()
|
|
6722
|
+
.callGraphQL({
|
|
6723
|
+
values: { changes: changes },
|
|
6724
|
+
query: this.templateByQuery.get("saveData"),
|
|
6725
|
+
})
|
|
6726
|
+
.then((resp) => {
|
|
6727
|
+
const dataUnitRecords = [];
|
|
6728
|
+
resp === null || resp === void 0 ? void 0 : resp.forEach((responseRecord) => {
|
|
6729
|
+
const duRecord = { __record__id__: responseRecord.id };
|
|
6730
|
+
if (responseRecord.oldId) {
|
|
6731
|
+
duRecord.__old__id__ = responseRecord.oldId;
|
|
6732
|
+
}
|
|
6733
|
+
responseRecord.fields.forEach(({ name, value }) => {
|
|
6734
|
+
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
6735
|
+
});
|
|
6736
|
+
dataUnitRecords.push(duRecord);
|
|
6737
|
+
});
|
|
6738
|
+
resolve(dataUnitRecords);
|
|
6739
|
+
})
|
|
6740
|
+
.catch((error) => {
|
|
6741
|
+
reject(error);
|
|
6742
|
+
});
|
|
6743
|
+
});
|
|
6744
|
+
}
|
|
6745
|
+
formatValueToServer(value) {
|
|
6746
|
+
if (value === undefined)
|
|
6747
|
+
return value;
|
|
6748
|
+
try {
|
|
6749
|
+
if (value instanceof Date) {
|
|
6750
|
+
return value.toString();
|
|
6751
|
+
}
|
|
6752
|
+
//Any others objects
|
|
6753
|
+
value = JSON.stringify(value);
|
|
6754
|
+
}
|
|
6755
|
+
catch (_a) {
|
|
6756
|
+
value = value.toString();
|
|
6757
|
+
}
|
|
6758
|
+
return value;
|
|
6759
|
+
}
|
|
6760
|
+
removeRecords(dataUnit, recordIds) {
|
|
6761
|
+
const changes = recordIds.map((recordId) => {
|
|
6762
|
+
return { dataUnit: dataUnit.name, operation: core.ChangeOperation.DELETE, recordId };
|
|
6763
|
+
});
|
|
6764
|
+
return new Promise((resolve, reject) => {
|
|
6765
|
+
HttpFetcher.get()
|
|
6766
|
+
.callGraphQL({
|
|
6767
|
+
values: { changes: changes },
|
|
6768
|
+
query: this.templateByQuery.get("saveData"),
|
|
6769
|
+
})
|
|
6770
|
+
.then((_resp) => {
|
|
6771
|
+
resolve(recordIds);
|
|
6772
|
+
})
|
|
6773
|
+
.catch((error) => {
|
|
6774
|
+
reject(error);
|
|
6775
|
+
});
|
|
6776
|
+
});
|
|
6777
|
+
}
|
|
6763
6778
|
}
|
|
6764
6779
|
|
|
6765
|
-
class UrlUtils {
|
|
6766
|
-
static getQueryParams(queryString) {
|
|
6767
|
-
const params = new Map();
|
|
6768
|
-
const re = /[?&]?([^=]+)=([^&]*)/g;
|
|
6769
|
-
let tokens;
|
|
6770
|
-
//Necessário por causa da tela Histórico Padrão que possui resourceID com acento
|
|
6771
|
-
queryString = window.unescape(queryString);
|
|
6772
|
-
queryString = queryString.split("+").join(" ");
|
|
6773
|
-
while ((tokens = re.exec(queryString))) {
|
|
6774
|
-
params.set(window.decodeURIComponent(tokens[1]), tokens[2]);
|
|
6775
|
-
}
|
|
6776
|
-
//Inserimos a urlBase no params.
|
|
6777
|
-
params.set("urlBase", this.getUrlBase());
|
|
6778
|
-
if (window["moduleID"] && window["URIServiceBroker"]) {
|
|
6779
|
-
params.set("moduleID", window["moduleID"]);
|
|
6780
|
-
params.set("URIServiceBroker", window["URIServiceBroker"]);
|
|
6781
|
-
}
|
|
6782
|
-
return params;
|
|
6783
|
-
}
|
|
6784
|
-
static getUrlBase() {
|
|
6785
|
-
return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
|
|
6786
|
-
}
|
|
6780
|
+
class UrlUtils {
|
|
6781
|
+
static getQueryParams(queryString) {
|
|
6782
|
+
const params = new Map();
|
|
6783
|
+
const re = /[?&]?([^=]+)=([^&]*)/g;
|
|
6784
|
+
let tokens;
|
|
6785
|
+
//Necessário por causa da tela Histórico Padrão que possui resourceID com acento
|
|
6786
|
+
queryString = window.unescape(queryString);
|
|
6787
|
+
queryString = queryString.split("+").join(" ");
|
|
6788
|
+
while ((tokens = re.exec(queryString))) {
|
|
6789
|
+
params.set(window.decodeURIComponent(tokens[1]), tokens[2]);
|
|
6790
|
+
}
|
|
6791
|
+
//Inserimos a urlBase no params.
|
|
6792
|
+
params.set("urlBase", this.getUrlBase());
|
|
6793
|
+
if (window["moduleID"] && window["URIServiceBroker"]) {
|
|
6794
|
+
params.set("moduleID", window["moduleID"]);
|
|
6795
|
+
params.set("URIServiceBroker", window["URIServiceBroker"]);
|
|
6796
|
+
}
|
|
6797
|
+
return params;
|
|
6798
|
+
}
|
|
6799
|
+
static getUrlBase() {
|
|
6800
|
+
return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
|
|
6801
|
+
}
|
|
6787
6802
|
}
|
|
6788
6803
|
|
|
6789
|
-
class Workspace {
|
|
6790
|
-
static openAppActivity(resourceId, pkObject) {
|
|
6791
|
-
var _a;
|
|
6792
|
-
(_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
|
|
6793
|
-
}
|
|
6794
|
-
}
|
|
6804
|
+
class Workspace {
|
|
6805
|
+
static openAppActivity(resourceId, pkObject) {
|
|
6806
|
+
var _a;
|
|
6807
|
+
(_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
|
|
6808
|
+
}
|
|
6809
|
+
}
|
|
6795
6810
|
Workspace.resourceID = window["workspace"].resourceID;
|
|
6796
6811
|
|
|
6797
|
-
class ParametersFetcher {
|
|
6798
|
-
constructor() {
|
|
6799
|
-
this.templateByQuery = new Map();
|
|
6800
|
-
this.buldTemplates();
|
|
6801
|
-
}
|
|
6802
|
-
buldTemplates() {
|
|
6803
|
-
this.templateByQuery.set("fetchParam", dist.gql `query($name: String!) {
|
|
6804
|
-
$queryAlias$: fetchResource(name: $name){
|
|
6805
|
-
name
|
|
6806
|
-
resource
|
|
6807
|
-
}
|
|
6808
|
-
}`);
|
|
6809
|
-
}
|
|
6810
|
-
async getParam(name, resourceID) {
|
|
6811
|
-
const completPath = `param://${resourceID}?params=${window.btoa(name)}`;
|
|
6812
|
-
return HttpFetcher.get().callGraphQL({
|
|
6813
|
-
values: { name: completPath },
|
|
6814
|
-
query: this.templateByQuery.get("fetchParam"),
|
|
6815
|
-
});
|
|
6816
|
-
}
|
|
6817
|
-
async asString(name, resourceID) {
|
|
6818
|
-
const paramArr = await this.getParam(name, resourceID);
|
|
6819
|
-
return this.getValue(paramArr);
|
|
6820
|
-
}
|
|
6821
|
-
async asInteger(name, resourceID) {
|
|
6822
|
-
const paramArr = await this.getParam(name, resourceID);
|
|
6823
|
-
return parseInt(this.getValue(paramArr));
|
|
6824
|
-
}
|
|
6825
|
-
async asFloat(name, resourceID) {
|
|
6826
|
-
const paramArr = await this.getParam(name, resourceID);
|
|
6827
|
-
return parseFloat(this.getValue(paramArr));
|
|
6828
|
-
}
|
|
6829
|
-
async asBoolean(name, resourceID) {
|
|
6830
|
-
const paramArr = await this.getParam(name, resourceID);
|
|
6831
|
-
return this.getValue(paramArr) == "S";
|
|
6832
|
-
}
|
|
6833
|
-
async asDate(name, resourceID) {
|
|
6834
|
-
const paramArr = await this.getParam(name, resourceID);
|
|
6835
|
-
return core.DateUtils.strToDate(this.getValue(paramArr));
|
|
6836
|
-
}
|
|
6837
|
-
async getBatchParams(names, resourceID) {
|
|
6838
|
-
const paramArr = await this.getParam(names.join(","), resourceID);
|
|
6839
|
-
//TODO: try to typed params val?
|
|
6840
|
-
const response = {};
|
|
6841
|
-
paramArr.forEach((param) => (response[param.name] = param.resource));
|
|
6842
|
-
return response;
|
|
6843
|
-
}
|
|
6844
|
-
getValue(obj = {}) {
|
|
6845
|
-
if (Array.isArray(obj) && obj.length > 0) {
|
|
6846
|
-
obj = obj[0];
|
|
6847
|
-
}
|
|
6848
|
-
if (core.StringUtils.isEmpty(obj.resource))
|
|
6849
|
-
return "";
|
|
6850
|
-
return obj.resource;
|
|
6851
|
-
}
|
|
6812
|
+
class ParametersFetcher {
|
|
6813
|
+
constructor() {
|
|
6814
|
+
this.templateByQuery = new Map();
|
|
6815
|
+
this.buldTemplates();
|
|
6816
|
+
}
|
|
6817
|
+
buldTemplates() {
|
|
6818
|
+
this.templateByQuery.set("fetchParam", dist.gql `query($name: String!) {
|
|
6819
|
+
$queryAlias$: fetchResource(name: $name){
|
|
6820
|
+
name
|
|
6821
|
+
resource
|
|
6822
|
+
}
|
|
6823
|
+
}`);
|
|
6824
|
+
}
|
|
6825
|
+
async getParam(name, resourceID) {
|
|
6826
|
+
const completPath = `param://${resourceID}?params=${window.btoa(name)}`;
|
|
6827
|
+
return HttpFetcher.get().callGraphQL({
|
|
6828
|
+
values: { name: completPath },
|
|
6829
|
+
query: this.templateByQuery.get("fetchParam"),
|
|
6830
|
+
});
|
|
6831
|
+
}
|
|
6832
|
+
async asString(name, resourceID) {
|
|
6833
|
+
const paramArr = await this.getParam(name, resourceID);
|
|
6834
|
+
return this.getValue(paramArr);
|
|
6835
|
+
}
|
|
6836
|
+
async asInteger(name, resourceID) {
|
|
6837
|
+
const paramArr = await this.getParam(name, resourceID);
|
|
6838
|
+
return parseInt(this.getValue(paramArr));
|
|
6839
|
+
}
|
|
6840
|
+
async asFloat(name, resourceID) {
|
|
6841
|
+
const paramArr = await this.getParam(name, resourceID);
|
|
6842
|
+
return parseFloat(this.getValue(paramArr));
|
|
6843
|
+
}
|
|
6844
|
+
async asBoolean(name, resourceID) {
|
|
6845
|
+
const paramArr = await this.getParam(name, resourceID);
|
|
6846
|
+
return this.getValue(paramArr) == "S";
|
|
6847
|
+
}
|
|
6848
|
+
async asDate(name, resourceID) {
|
|
6849
|
+
const paramArr = await this.getParam(name, resourceID);
|
|
6850
|
+
return core.DateUtils.strToDate(this.getValue(paramArr));
|
|
6851
|
+
}
|
|
6852
|
+
async getBatchParams(names, resourceID) {
|
|
6853
|
+
const paramArr = await this.getParam(names.join(","), resourceID);
|
|
6854
|
+
//TODO: try to typed params val?
|
|
6855
|
+
const response = {};
|
|
6856
|
+
paramArr.forEach((param) => (response[param.name] = param.resource));
|
|
6857
|
+
return response;
|
|
6858
|
+
}
|
|
6859
|
+
getValue(obj = {}) {
|
|
6860
|
+
if (Array.isArray(obj) && obj.length > 0) {
|
|
6861
|
+
obj = obj[0];
|
|
6862
|
+
}
|
|
6863
|
+
if (core.StringUtils.isEmpty(obj.resource))
|
|
6864
|
+
return "";
|
|
6865
|
+
return obj.resource;
|
|
6866
|
+
}
|
|
6852
6867
|
}
|
|
6853
6868
|
|
|
6854
|
-
class ResourceFetcher {
|
|
6855
|
-
constructor() {
|
|
6856
|
-
this.templateByQuery = new Map();
|
|
6857
|
-
this.buldTemplates();
|
|
6858
|
-
}
|
|
6859
|
-
buldTemplates() {
|
|
6860
|
-
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
|
6861
|
-
$queryAlias$: fetchResource(name: $name){
|
|
6862
|
-
resource
|
|
6863
|
-
}
|
|
6864
|
-
}`);
|
|
6865
|
-
}
|
|
6866
|
-
loadResource(name) {
|
|
6867
|
-
return new Promise((resolve, reject) => {
|
|
6868
|
-
HttpFetcher.get()
|
|
6869
|
-
.callGraphQL({
|
|
6870
|
-
values: { name },
|
|
6871
|
-
query: this.templateByQuery.get("fetchResource"),
|
|
6872
|
-
})
|
|
6873
|
-
.then((result) => {
|
|
6874
|
-
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
|
6875
|
-
})
|
|
6876
|
-
.catch((error) => {
|
|
6877
|
-
reject(error);
|
|
6878
|
-
});
|
|
6879
|
-
});
|
|
6880
|
-
}
|
|
6869
|
+
class ResourceFetcher {
|
|
6870
|
+
constructor() {
|
|
6871
|
+
this.templateByQuery = new Map();
|
|
6872
|
+
this.buldTemplates();
|
|
6873
|
+
}
|
|
6874
|
+
buldTemplates() {
|
|
6875
|
+
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
|
6876
|
+
$queryAlias$: fetchResource(name: $name){
|
|
6877
|
+
resource
|
|
6878
|
+
}
|
|
6879
|
+
}`);
|
|
6880
|
+
}
|
|
6881
|
+
loadResource(name) {
|
|
6882
|
+
return new Promise((resolve, reject) => {
|
|
6883
|
+
HttpFetcher.get()
|
|
6884
|
+
.callGraphQL({
|
|
6885
|
+
values: { name },
|
|
6886
|
+
query: this.templateByQuery.get("fetchResource"),
|
|
6887
|
+
})
|
|
6888
|
+
.then((result) => {
|
|
6889
|
+
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
|
6890
|
+
})
|
|
6891
|
+
.catch((error) => {
|
|
6892
|
+
reject(error);
|
|
6893
|
+
});
|
|
6894
|
+
});
|
|
6895
|
+
}
|
|
6881
6896
|
}
|
|
6882
6897
|
|
|
6883
|
-
class FormConfigFetcher extends ResourceFetcher {
|
|
6884
|
-
loadFormConfig(formName, resourceID) {
|
|
6885
|
-
return new Promise((accept, reject) => {
|
|
6886
|
-
this.loadResource(`cfg://form/${resourceID}/${formName}`)
|
|
6887
|
-
.then((configAsString) => {
|
|
6888
|
-
if (configAsString) {
|
|
6889
|
-
const config = JSON.parse(configAsString);
|
|
6890
|
-
const { tabs, fields } = config;
|
|
6891
|
-
if (tabs) {
|
|
6892
|
-
const allTabs = new Map(tabs.map(t => [t.label, t]));
|
|
6893
|
-
fields.forEach(f => f.tab = allTabs.get(f.tab));
|
|
6894
|
-
}
|
|
6895
|
-
accept(fields);
|
|
6896
|
-
}
|
|
6897
|
-
else {
|
|
6898
|
-
reject(`Sem configuração pro formulário "${formName}".`);
|
|
6899
|
-
}
|
|
6900
|
-
})
|
|
6901
|
-
.catch((error) => {
|
|
6902
|
-
reject(error);
|
|
6903
|
-
});
|
|
6904
|
-
});
|
|
6905
|
-
}
|
|
6898
|
+
class FormConfigFetcher extends ResourceFetcher {
|
|
6899
|
+
loadFormConfig(formName, resourceID) {
|
|
6900
|
+
return new Promise((accept, reject) => {
|
|
6901
|
+
this.loadResource(`cfg://form/${resourceID}/${formName}`)
|
|
6902
|
+
.then((configAsString) => {
|
|
6903
|
+
if (configAsString) {
|
|
6904
|
+
const config = JSON.parse(configAsString);
|
|
6905
|
+
const { tabs, fields } = config;
|
|
6906
|
+
if (tabs) {
|
|
6907
|
+
const allTabs = new Map(tabs.map(t => [t.label, t]));
|
|
6908
|
+
fields.forEach(f => f.tab = allTabs.get(f.tab));
|
|
6909
|
+
}
|
|
6910
|
+
accept(fields);
|
|
6911
|
+
}
|
|
6912
|
+
else {
|
|
6913
|
+
reject(`Sem configuração pro formulário "${formName}".`);
|
|
6914
|
+
}
|
|
6915
|
+
})
|
|
6916
|
+
.catch((error) => {
|
|
6917
|
+
reject(error);
|
|
6918
|
+
});
|
|
6919
|
+
});
|
|
6920
|
+
}
|
|
6906
6921
|
}
|
|
6907
6922
|
|
|
6908
|
-
const mockByEntity = {
|
|
6909
|
-
"ImplantacaoSaldoConta": [{ "value": 6, "label": "Conta Financeiro" }, { "value": 7, "label": "Conta Banco do Brasil" }],
|
|
6910
|
-
"HistoricoBancario": [{ "value": 9, "label": "Lanç. Origem" }, { "value": 8, "label": "Lanç. Origem 2" }],
|
|
6911
|
-
"ContaDestino": [{ "value": 10, "label": "Conta BB" }, { "value": 7, "label": "Conta Santander" }],
|
|
6912
|
-
"HistoricoBancarioDestino": [{ "value": 11, "label": "Contra Bradesco" }, { "value": 13, "label": "Contra Destino" }],
|
|
6913
|
-
"Usuario": [{ "value": 0, "label": "SUP" }],
|
|
6914
|
-
"ContaBancaria": [{ "value": 10, "label": "Conta 10" }, { "value": 17, "label": "Conta 17" }],
|
|
6915
|
-
"TipoOperacao": [{ "value": 4, "label": "Entrada NFse" }, { "value": 5, "label": "Outra top" }, { "value": 6, "label": "Top 6" }]
|
|
6916
|
-
};
|
|
6917
|
-
const pesquisaLoadOptions = (searchArgument, fieldName, dataUnit) => {
|
|
6918
|
-
var _a;
|
|
6919
|
-
console.log(searchArgument);
|
|
6920
|
-
const field = dataUnit.getField(fieldName);
|
|
6921
|
-
const entityName = (_a = field.properties) === null || _a === void 0 ? void 0 : _a.ENTITYNAME;
|
|
6922
|
-
return (mockByEntity[entityName] || []);
|
|
6923
|
+
const mockByEntity = {
|
|
6924
|
+
"ImplantacaoSaldoConta": [{ "value": 6, "label": "Conta Financeiro" }, { "value": 7, "label": "Conta Banco do Brasil" }],
|
|
6925
|
+
"HistoricoBancario": [{ "value": 9, "label": "Lanç. Origem" }, { "value": 8, "label": "Lanç. Origem 2" }],
|
|
6926
|
+
"ContaDestino": [{ "value": 10, "label": "Conta BB" }, { "value": 7, "label": "Conta Santander" }],
|
|
6927
|
+
"HistoricoBancarioDestino": [{ "value": 11, "label": "Contra Bradesco" }, { "value": 13, "label": "Contra Destino" }],
|
|
6928
|
+
"Usuario": [{ "value": 0, "label": "SUP" }],
|
|
6929
|
+
"ContaBancaria": [{ "value": 10, "label": "Conta 10" }, { "value": 17, "label": "Conta 17" }],
|
|
6930
|
+
"TipoOperacao": [{ "value": 4, "label": "Entrada NFse" }, { "value": 5, "label": "Outra top" }, { "value": 6, "label": "Top 6" }]
|
|
6931
|
+
};
|
|
6932
|
+
const pesquisaLoadOptions = (searchArgument, fieldName, dataUnit) => {
|
|
6933
|
+
var _a;
|
|
6934
|
+
console.log(searchArgument);
|
|
6935
|
+
const field = dataUnit.getField(fieldName);
|
|
6936
|
+
const entityName = (_a = field.properties) === null || _a === void 0 ? void 0 : _a.ENTITYNAME;
|
|
6937
|
+
return (mockByEntity[entityName] || []);
|
|
6923
6938
|
};
|
|
6924
6939
|
|
|
6925
6940
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
6926
6941
|
|
|
6927
|
-
const SnkApplication = class {
|
|
6928
|
-
constructor(hostRef) {
|
|
6929
|
-
index.registerInstance(this, hostRef);
|
|
6930
|
-
this.applicationLoaded = index.createEvent(this, "applicationLoaded", 7);
|
|
6931
|
-
this.applicationLoading = index.createEvent(this, "applicationLoading", 7);
|
|
6932
|
-
}
|
|
6933
|
-
get parameters() {
|
|
6934
|
-
if (!this._parameters) {
|
|
6935
|
-
this._parameters = new ParametersFetcher();
|
|
6936
|
-
}
|
|
6937
|
-
return this._parameters;
|
|
6938
|
-
}
|
|
6939
|
-
get resourceID() {
|
|
6940
|
-
if (!this._resourceID) {
|
|
6941
|
-
this._resourceID = this.urlParams.get("workspaceResourceID") ||
|
|
6942
|
-
this.urlParams.get("resourceID") ||
|
|
6943
|
-
Workspace.resourceID ||
|
|
6944
|
-
"unknown.resource.id";
|
|
6945
|
-
}
|
|
6946
|
-
return this._resourceID;
|
|
6947
|
-
}
|
|
6948
|
-
async getStringParam(name) {
|
|
6949
|
-
return this.parameters.asString(name, this.resourceID);
|
|
6950
|
-
}
|
|
6951
|
-
async getIntParam(name) {
|
|
6952
|
-
return this.parameters.asInteger(name, this.resourceID);
|
|
6953
|
-
}
|
|
6954
|
-
async getFloatParam(name) {
|
|
6955
|
-
return this.parameters.asFloat(name, this.resourceID);
|
|
6956
|
-
}
|
|
6957
|
-
async getBooleanParam(name) {
|
|
6958
|
-
return this.parameters.asBoolean(name, this.resourceID);
|
|
6959
|
-
}
|
|
6960
|
-
async getDateParam(name) {
|
|
6961
|
-
return this.parameters.asDate(name, this.resourceID);
|
|
6962
|
-
}
|
|
6963
|
-
async temOpcional(opcional) {
|
|
6964
|
-
const opts = opcional.split(",");
|
|
6965
|
-
return new Promise((resolve, reject) => {
|
|
6966
|
-
this.getAttributeFromHTMLWrapper("opc0009")
|
|
6967
|
-
.then(value => {
|
|
6968
|
-
if (value === "1") {
|
|
6969
|
-
resolve(true);
|
|
6970
|
-
}
|
|
6971
|
-
else {
|
|
6972
|
-
Promise.all(opts.map(opt => this.getAttributeFromHTMLWrapper("opc" + opt)))
|
|
6973
|
-
.then(result => {
|
|
6974
|
-
resolve(result.includes("1"));
|
|
6975
|
-
})
|
|
6976
|
-
.catch(error => {
|
|
6977
|
-
reject(error);
|
|
6978
|
-
});
|
|
6979
|
-
}
|
|
6980
|
-
})
|
|
6981
|
-
.catch(error => {
|
|
6982
|
-
reject(error);
|
|
6983
|
-
});
|
|
6984
|
-
});
|
|
6985
|
-
}
|
|
6986
|
-
async getAttributeFromHTMLWrapper(attribName) {
|
|
6987
|
-
return Promise.resolve(window[attribName]);
|
|
6988
|
-
}
|
|
6989
|
-
async openApp(resourceId, pkObject) {
|
|
6990
|
-
Workspace.openAppActivity(resourceId, pkObject);
|
|
6991
|
-
}
|
|
6992
|
-
async createDataunit(entityName) {
|
|
6993
|
-
return new Promise(resolve => {
|
|
6994
|
-
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
|
|
6995
|
-
dataUnit.loadMetadata();
|
|
6996
|
-
resolve(dataUnit);
|
|
6997
|
-
});
|
|
6998
|
-
}
|
|
6999
|
-
async getResourceID() {
|
|
7000
|
-
return Promise.resolve(this.resourceID);
|
|
7001
|
-
}
|
|
7002
|
-
async alert(title, message, icon) {
|
|
7003
|
-
return utils.ApplicationUtils.alert(title, message, icon);
|
|
7004
|
-
}
|
|
7005
|
-
async error(title, message, icon) {
|
|
7006
|
-
return utils.ApplicationUtils.error(title, message, icon);
|
|
7007
|
-
}
|
|
7008
|
-
async confirm(title, message, icon, critical) {
|
|
7009
|
-
return utils.ApplicationUtils.confirm(title, message, icon, critical);
|
|
7010
|
-
}
|
|
7011
|
-
async info(message, options = undefined) {
|
|
7012
|
-
return utils.ApplicationUtils.info(message, options);
|
|
7013
|
-
}
|
|
7014
|
-
async loadFormConfig(name) {
|
|
7015
|
-
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7016
|
-
}
|
|
7017
|
-
get urlParams() {
|
|
7018
|
-
if (!this._urlParams) {
|
|
7019
|
-
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
7020
|
-
}
|
|
7021
|
-
return this._urlParams;
|
|
7022
|
-
}
|
|
7023
|
-
get dataUnitFetcher() {
|
|
7024
|
-
if (!this._dataUnitFetcher) {
|
|
7025
|
-
this._dataUnitFetcher = new DataUnitFetcher();
|
|
7026
|
-
}
|
|
7027
|
-
return this._dataUnitFetcher;
|
|
7028
|
-
}
|
|
7029
|
-
get formConfigFetcher() {
|
|
7030
|
-
if (!this._formConfigFetcher) {
|
|
7031
|
-
this._formConfigFetcher = new FormConfigFetcher();
|
|
7032
|
-
}
|
|
7033
|
-
return this._formConfigFetcher;
|
|
7034
|
-
}
|
|
7035
|
-
componentWillLoad() {
|
|
7036
|
-
core.ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
|
|
7037
|
-
}
|
|
7038
|
-
componentDidLoad() {
|
|
7039
|
-
this.applicationLoading.emit(true);
|
|
7040
|
-
window.requestAnimationFrame(() => {
|
|
7041
|
-
this.applicationLoaded.emit(true);
|
|
7042
|
-
});
|
|
7043
|
-
}
|
|
7044
|
-
render() {
|
|
7045
|
-
return (index.h("div", null));
|
|
7046
|
-
}
|
|
7047
|
-
};
|
|
6942
|
+
const SnkApplication = class {
|
|
6943
|
+
constructor(hostRef) {
|
|
6944
|
+
index.registerInstance(this, hostRef);
|
|
6945
|
+
this.applicationLoaded = index.createEvent(this, "applicationLoaded", 7);
|
|
6946
|
+
this.applicationLoading = index.createEvent(this, "applicationLoading", 7);
|
|
6947
|
+
}
|
|
6948
|
+
get parameters() {
|
|
6949
|
+
if (!this._parameters) {
|
|
6950
|
+
this._parameters = new ParametersFetcher();
|
|
6951
|
+
}
|
|
6952
|
+
return this._parameters;
|
|
6953
|
+
}
|
|
6954
|
+
get resourceID() {
|
|
6955
|
+
if (!this._resourceID) {
|
|
6956
|
+
this._resourceID = this.urlParams.get("workspaceResourceID") ||
|
|
6957
|
+
this.urlParams.get("resourceID") ||
|
|
6958
|
+
Workspace.resourceID ||
|
|
6959
|
+
"unknown.resource.id";
|
|
6960
|
+
}
|
|
6961
|
+
return this._resourceID;
|
|
6962
|
+
}
|
|
6963
|
+
async getStringParam(name) {
|
|
6964
|
+
return this.parameters.asString(name, this.resourceID);
|
|
6965
|
+
}
|
|
6966
|
+
async getIntParam(name) {
|
|
6967
|
+
return this.parameters.asInteger(name, this.resourceID);
|
|
6968
|
+
}
|
|
6969
|
+
async getFloatParam(name) {
|
|
6970
|
+
return this.parameters.asFloat(name, this.resourceID);
|
|
6971
|
+
}
|
|
6972
|
+
async getBooleanParam(name) {
|
|
6973
|
+
return this.parameters.asBoolean(name, this.resourceID);
|
|
6974
|
+
}
|
|
6975
|
+
async getDateParam(name) {
|
|
6976
|
+
return this.parameters.asDate(name, this.resourceID);
|
|
6977
|
+
}
|
|
6978
|
+
async temOpcional(opcional) {
|
|
6979
|
+
const opts = opcional.split(",");
|
|
6980
|
+
return new Promise((resolve, reject) => {
|
|
6981
|
+
this.getAttributeFromHTMLWrapper("opc0009")
|
|
6982
|
+
.then(value => {
|
|
6983
|
+
if (value === "1") {
|
|
6984
|
+
resolve(true);
|
|
6985
|
+
}
|
|
6986
|
+
else {
|
|
6987
|
+
Promise.all(opts.map(opt => this.getAttributeFromHTMLWrapper("opc" + opt)))
|
|
6988
|
+
.then(result => {
|
|
6989
|
+
resolve(result.includes("1"));
|
|
6990
|
+
})
|
|
6991
|
+
.catch(error => {
|
|
6992
|
+
reject(error);
|
|
6993
|
+
});
|
|
6994
|
+
}
|
|
6995
|
+
})
|
|
6996
|
+
.catch(error => {
|
|
6997
|
+
reject(error);
|
|
6998
|
+
});
|
|
6999
|
+
});
|
|
7000
|
+
}
|
|
7001
|
+
async getAttributeFromHTMLWrapper(attribName) {
|
|
7002
|
+
return Promise.resolve(window[attribName]);
|
|
7003
|
+
}
|
|
7004
|
+
async openApp(resourceId, pkObject) {
|
|
7005
|
+
Workspace.openAppActivity(resourceId, pkObject);
|
|
7006
|
+
}
|
|
7007
|
+
async createDataunit(entityName) {
|
|
7008
|
+
return new Promise(resolve => {
|
|
7009
|
+
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
|
|
7010
|
+
dataUnit.loadMetadata();
|
|
7011
|
+
resolve(dataUnit);
|
|
7012
|
+
});
|
|
7013
|
+
}
|
|
7014
|
+
async getResourceID() {
|
|
7015
|
+
return Promise.resolve(this.resourceID);
|
|
7016
|
+
}
|
|
7017
|
+
async alert(title, message, icon) {
|
|
7018
|
+
return utils.ApplicationUtils.alert(title, message, icon);
|
|
7019
|
+
}
|
|
7020
|
+
async error(title, message, icon) {
|
|
7021
|
+
return utils.ApplicationUtils.error(title, message, icon);
|
|
7022
|
+
}
|
|
7023
|
+
async confirm(title, message, icon, critical) {
|
|
7024
|
+
return utils.ApplicationUtils.confirm(title, message, icon, critical);
|
|
7025
|
+
}
|
|
7026
|
+
async info(message, options = undefined) {
|
|
7027
|
+
return utils.ApplicationUtils.info(message, options);
|
|
7028
|
+
}
|
|
7029
|
+
async loadFormConfig(name) {
|
|
7030
|
+
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7031
|
+
}
|
|
7032
|
+
get urlParams() {
|
|
7033
|
+
if (!this._urlParams) {
|
|
7034
|
+
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
7035
|
+
}
|
|
7036
|
+
return this._urlParams;
|
|
7037
|
+
}
|
|
7038
|
+
get dataUnitFetcher() {
|
|
7039
|
+
if (!this._dataUnitFetcher) {
|
|
7040
|
+
this._dataUnitFetcher = new DataUnitFetcher();
|
|
7041
|
+
}
|
|
7042
|
+
return this._dataUnitFetcher;
|
|
7043
|
+
}
|
|
7044
|
+
get formConfigFetcher() {
|
|
7045
|
+
if (!this._formConfigFetcher) {
|
|
7046
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
7047
|
+
}
|
|
7048
|
+
return this._formConfigFetcher;
|
|
7049
|
+
}
|
|
7050
|
+
componentWillLoad() {
|
|
7051
|
+
core.ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
|
|
7052
|
+
}
|
|
7053
|
+
componentDidLoad() {
|
|
7054
|
+
this.applicationLoading.emit(true);
|
|
7055
|
+
window.requestAnimationFrame(() => {
|
|
7056
|
+
this.applicationLoaded.emit(true);
|
|
7057
|
+
});
|
|
7058
|
+
}
|
|
7059
|
+
render() {
|
|
7060
|
+
return (index.h("div", null));
|
|
7061
|
+
}
|
|
7062
|
+
};
|
|
7048
7063
|
SnkApplication.style = snkApplicationCss;
|
|
7049
7064
|
|
|
7050
7065
|
exports.snk_application = SnkApplication;
|