@sankhyalabs/sankhyablocks 8.15.0-dev.53 → 8.15.0-dev.54
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/dist/cjs/{ConfigStorage-8d4e9d53.js → ConfigStorage-085c7117.js} +11 -12
- package/dist/cjs/{SnkMultiSelectionListDataSource-d15f7aac.js → IExporterProvider-955812ad.js} +52 -5
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-33995e92.js → SnkFormConfigManager-8986431f.js} +2 -2
- package/dist/cjs/{auth-fetcher-bb8e9ae4.js → auth-fetcher-eddaf17f.js} +1 -1
- package/dist/cjs/{DataFetcher-99f0f6ed.js → form-config-fetcher-cdd644a7.js} +251 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-bdbbe9ac.js → pesquisa-fetcher-6e934fb5.js} +30 -16
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +8 -9
- package/dist/cjs/snk-application.cjs.entry.js +22 -23
- package/dist/cjs/snk-attach.cjs.entry.js +12 -13
- package/dist/cjs/snk-crud.cjs.entry.js +4 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +195 -78
- package/dist/cjs/{snk-data-unit-41c29713.js → snk-data-unit-abd2113f.js} +2 -37
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +6 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +2 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -2
- package/dist/cjs/snk-form.cjs.entry.js +3 -4
- package/dist/cjs/snk-grid.cjs.entry.js +65 -102
- package/dist/cjs/{snk-guides-viewer-a8dd24a3.js → snk-guides-viewer-4e8b517b.js} +4 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +6 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +115 -32
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -2
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-d9392685.js} +2 -2
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +35 -45
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
- package/dist/collection/components/snk-grid/snk-grid.js +3 -94
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +81 -9
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +8 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/components/ConfigStorage.js +1 -2
- package/dist/components/{field-search.js → IExporterProvider.js} +52 -7
- package/dist/components/ISave.js +42 -0
- package/dist/components/dataunit-fetcher.js +18 -4
- package/dist/components/form-config-fetcher.js +7022 -3
- package/dist/components/index2.js +198 -33
- package/dist/components/snk-actions-button2.js +3 -12
- package/dist/components/snk-application2.js +1 -1
- package/dist/components/snk-attach2.js +3 -4
- package/dist/components/snk-crud.js +3 -4
- package/dist/components/snk-data-exporter2.js +192 -79
- package/dist/components/snk-data-unit2.js +41 -39
- package/dist/components/snk-detail-view2.js +4 -5
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-grid2.js +63 -100
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +101 -16
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{ConfigStorage-6e241cd7.js → ConfigStorage-cc3f3dd3.js} +1 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-7084f3b3.js → IExporterProvider-6ebf47ab.js} +52 -6
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-7a4e678f.js → SnkFormConfigManager-7edda7eb.js} +2 -2
- package/dist/esm/{auth-fetcher-8ec448b0.js → auth-fetcher-11dd9cae.js} +1 -1
- package/dist/esm/{DataFetcher-a650ae58.js → form-config-fetcher-13cd3285.js} +250 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-96d2f351.js → pesquisa-fetcher-4eed47c6.js} +18 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +3 -4
- package/dist/esm/snk-application.entry.js +4 -5
- package/dist/esm/snk-attach.entry.js +4 -5
- package/dist/esm/snk-crud.entry.js +4 -5
- package/dist/esm/snk-data-exporter.entry.js +195 -78
- package/dist/esm/{snk-data-unit-de1d140d.js → snk-data-unit-29eba11a.js} +3 -38
- package/dist/esm/snk-data-unit.entry.js +2 -1
- package/dist/esm/snk-detail-view.entry.js +6 -7
- package/dist/esm/snk-filter-bar.entry.js +2 -3
- package/dist/esm/snk-filter-modal-item.entry.js +2 -3
- package/dist/esm/snk-form-config.entry.js +1 -2
- package/dist/esm/snk-form.entry.js +3 -4
- package/dist/esm/snk-grid.entry.js +63 -100
- package/dist/esm/{snk-guides-viewer-131e9660.js → snk-guides-viewer-2742a9db.js} +4 -5
- package/dist/esm/snk-guides-viewer.entry.js +6 -7
- package/dist/esm/snk-personalized-filter.entry.js +2 -3
- package/dist/esm/snk-simple-crud.entry.js +102 -19
- package/dist/esm/snk-taskbar.entry.js +3 -2
- package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-ad766858.js} +2 -2
- package/dist/sankhyablocks/p-07825198.js +1 -0
- package/dist/sankhyablocks/p-1d9d07b4.entry.js +1 -0
- package/dist/sankhyablocks/p-201e5588.entry.js +1 -0
- package/dist/sankhyablocks/p-33a6728e.js +26 -0
- package/dist/sankhyablocks/p-37afb96a.js +1 -0
- package/dist/sankhyablocks/p-411fe937.entry.js +1 -0
- package/dist/sankhyablocks/p-44d52fc6.js +1 -0
- package/dist/sankhyablocks/p-4ddf7add.entry.js +1 -0
- package/dist/sankhyablocks/p-7b797d8f.entry.js +1 -0
- package/dist/sankhyablocks/p-87cb937d.js +65 -0
- package/dist/sankhyablocks/{p-0624f62d.js → p-8a4c4b54.js} +6 -6
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/{p-125bb902.js → p-99b51d06.js} +1 -1
- package/dist/sankhyablocks/p-9ee96756.entry.js +1 -0
- package/dist/sankhyablocks/p-a4c94582.entry.js +1 -0
- package/dist/sankhyablocks/p-bf209f48.entry.js +1 -0
- package/dist/sankhyablocks/p-c2f3ebf3.entry.js +1 -0
- package/dist/sankhyablocks/p-c3c0ad0b.entry.js +1 -0
- package/dist/sankhyablocks/{p-619c5f6f.entry.js → p-c801a38a.entry.js} +2 -2
- package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
- package/dist/sankhyablocks/{p-efeca7ba.js → p-d24c9dc6.js} +1 -1
- package/dist/sankhyablocks/p-e4225e8b.entry.js +1 -0
- package/dist/sankhyablocks/p-edd9dd1c.entry.js +1 -0
- package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
- package/dist/sankhyablocks/p-fd44c905.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +3 -1
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +14 -2
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +16 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/form-config-fetcher-d73f4449.js +0 -256
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/DataFetcher.js +0 -7023
- package/dist/components/index3.js +0 -199
- package/dist/esm/form-config-fetcher-765b8498.js +0 -253
- package/dist/sankhyablocks/p-004c356e.js +0 -26
- package/dist/sankhyablocks/p-075bba4c.entry.js +0 -1
- package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-103c5956.entry.js +0 -1
- package/dist/sankhyablocks/p-1048bd26.entry.js +0 -1
- package/dist/sankhyablocks/p-13ae1a89.entry.js +0 -1
- package/dist/sankhyablocks/p-24ed6ad6.entry.js +0 -1
- package/dist/sankhyablocks/p-34a7f2ab.js +0 -65
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5833cff9.js +0 -1
- package/dist/sankhyablocks/p-5a2e016a.entry.js +0 -1
- package/dist/sankhyablocks/p-6f560924.entry.js +0 -1
- package/dist/sankhyablocks/p-8967fa78.js +0 -1
- package/dist/sankhyablocks/p-9b1beac5.entry.js +0 -1
- package/dist/sankhyablocks/p-a87149e4.entry.js +0 -1
- package/dist/sankhyablocks/p-ac77949b.entry.js +0 -1
- package/dist/sankhyablocks/p-b10b9934.entry.js +0 -1
- package/dist/sankhyablocks/p-be75153c.js +0 -1
- package/dist/sankhyablocks/p-bf39bdb8.entry.js +0 -1
- package/dist/sankhyablocks/p-f7d0fab9.entry.js +0 -1
- package/dist/sankhyablocks/p-f7d9d148.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
- /package/dist/sankhyablocks/{p-ae4fc9a9.js → p-61dd89eb.js} +0 -0
@@ -1,256 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
const DataFetcher = require('./DataFetcher-99f0f6ed.js');
|
4
|
-
const core = require('@sankhyalabs/core');
|
5
|
-
|
6
|
-
class ResourceFetcher {
|
7
|
-
constructor() {
|
8
|
-
this.templateByQuery = new Map();
|
9
|
-
this.buldTemplates();
|
10
|
-
}
|
11
|
-
buldTemplates() {
|
12
|
-
this.templateByQuery.set("fetchResource", DataFetcher.dist.gql `query($name: String!) {
|
13
|
-
$queryAlias$: fetchResource(name: $name){
|
14
|
-
resource
|
15
|
-
}
|
16
|
-
}`);
|
17
|
-
this.templateByQuery.set("saveResource", DataFetcher.dist.gql `mutation($resource: InputResource!) {
|
18
|
-
$queryAlias$: saveResource(resource: $resource){
|
19
|
-
name
|
20
|
-
resource
|
21
|
-
}
|
22
|
-
}`);
|
23
|
-
}
|
24
|
-
loadResource(name) {
|
25
|
-
if (ResourceFetcher._loadingResource.has(name)) {
|
26
|
-
return ResourceFetcher._loadingResource.get(name);
|
27
|
-
}
|
28
|
-
const promiseLoadResource = new Promise((resolve, reject) => {
|
29
|
-
DataFetcher.DataFetcher.get()
|
30
|
-
.callGraphQL({
|
31
|
-
values: { name },
|
32
|
-
query: this.templateByQuery.get("fetchResource"),
|
33
|
-
})
|
34
|
-
.then((result) => {
|
35
|
-
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
36
|
-
ResourceFetcher._loadingResource.delete(name);
|
37
|
-
})
|
38
|
-
.catch((error) => {
|
39
|
-
reject(error);
|
40
|
-
ResourceFetcher._loadingResource.delete(name);
|
41
|
-
});
|
42
|
-
});
|
43
|
-
ResourceFetcher._loadingResource.set(name, promiseLoadResource);
|
44
|
-
return promiseLoadResource;
|
45
|
-
}
|
46
|
-
saveResource(resource, name) {
|
47
|
-
return new Promise((resolve, reject) => {
|
48
|
-
DataFetcher.DataFetcher.get()
|
49
|
-
.callGraphQL({
|
50
|
-
values: {
|
51
|
-
resource: {
|
52
|
-
name: name,
|
53
|
-
resource: JSON.stringify(resource)
|
54
|
-
}
|
55
|
-
},
|
56
|
-
query: this.templateByQuery.get("saveResource")
|
57
|
-
})
|
58
|
-
.then((resp) => {
|
59
|
-
resolve(resp);
|
60
|
-
})
|
61
|
-
.catch((error) => {
|
62
|
-
reject(error);
|
63
|
-
});
|
64
|
-
});
|
65
|
-
}
|
66
|
-
}
|
67
|
-
ResourceFetcher._loadingResource = new Map();
|
68
|
-
|
69
|
-
class FormConfigFetcher extends ResourceFetcher {
|
70
|
-
constructor() {
|
71
|
-
super();
|
72
|
-
this.queryConfig = new Map();
|
73
|
-
this.buildTemplatesConfig();
|
74
|
-
}
|
75
|
-
buildTemplatesConfig() {
|
76
|
-
this.queryConfig.set("fetchUserAvailableConfigs", DataFetcher.dist.gql `query($name: String!) {
|
77
|
-
$queryAlias$: fetchUserAvailableConfigs(name: $name){
|
78
|
-
name
|
79
|
-
origin
|
80
|
-
key
|
81
|
-
}
|
82
|
-
}`);
|
83
|
-
this.queryConfig.set("fetchLegacyConfig", DataFetcher.dist.gql `query($name: String!) {
|
84
|
-
$queryAlias$: fetchLegacyConfig(name: $name){
|
85
|
-
name
|
86
|
-
resource
|
87
|
-
}
|
88
|
-
}`);
|
89
|
-
this.queryConfig.set("fetchDefaultConfig", DataFetcher.dist.gql `query($name: String!) {
|
90
|
-
$queryAlias$: fetchDefaultConfig(name: $name){
|
91
|
-
name
|
92
|
-
resource
|
93
|
-
}
|
94
|
-
}`);
|
95
|
-
}
|
96
|
-
loadFormConfig(formName, resourceID) {
|
97
|
-
return new Promise((accept, reject) => {
|
98
|
-
Promise.all([
|
99
|
-
this.loadResource(this.getPath(resourceID, formName)),
|
100
|
-
this.loadResource(this.getPath(`FormCardState:${resourceID}`, formName, "form-card")),
|
101
|
-
this.loadResource(this.getPath(resourceID, formName, "summary")),
|
102
|
-
this.loadResource(this.getPath(resourceID, formName, "defaultValues"))
|
103
|
-
])
|
104
|
-
.then(([configAsString, formCardState, summary, defaultValues]) => {
|
105
|
-
let config;
|
106
|
-
if (configAsString != undefined) {
|
107
|
-
config = Object.assign(Object.assign({}, JSON.parse(configAsString)), { emptyConfig: false });
|
108
|
-
const { tabs, fields } = config;
|
109
|
-
if (tabs) {
|
110
|
-
const allTabs = new Map(tabs.map(t => [t.label, t]));
|
111
|
-
fields === null || fields === void 0 ? void 0 : fields.forEach(f => { var _a; return f.tab = ((_a = allTabs.get(this.getTabName(f.tab))) === null || _a === void 0 ? void 0 : _a.label) || allTabs.get(this.getTabName(f.tab)); });
|
112
|
-
}
|
113
|
-
config.fields = fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
114
|
-
if ("readonly" in field) {
|
115
|
-
const readOnly = field['readonly'] === true;
|
116
|
-
delete field['readonly'];
|
117
|
-
field.readOnly = readOnly;
|
118
|
-
}
|
119
|
-
return field;
|
120
|
-
});
|
121
|
-
}
|
122
|
-
if (formCardState != undefined) {
|
123
|
-
if (config == undefined) {
|
124
|
-
config = { emptyConfig: true, fields: [] };
|
125
|
-
}
|
126
|
-
config.cardsState = new Map(JSON.parse(formCardState));
|
127
|
-
}
|
128
|
-
if (summary != undefined) {
|
129
|
-
if (config == undefined) {
|
130
|
-
config = { emptyConfig: true, fields: [] };
|
131
|
-
}
|
132
|
-
config.summary = new Map(Object.entries(JSON.parse(summary)));
|
133
|
-
}
|
134
|
-
if (defaultValues != undefined) {
|
135
|
-
if (config == undefined) {
|
136
|
-
config = { emptyConfig: true, fields: [] };
|
137
|
-
}
|
138
|
-
config.defaultVars = new Map(Object.entries(JSON.parse(defaultValues)));
|
139
|
-
}
|
140
|
-
accept(config);
|
141
|
-
})
|
142
|
-
.catch((error) => {
|
143
|
-
reject(error);
|
144
|
-
});
|
145
|
-
});
|
146
|
-
}
|
147
|
-
getTabName(tab) {
|
148
|
-
if (typeof tab === 'object') { // ITabConfig type
|
149
|
-
return tab.label;
|
150
|
-
}
|
151
|
-
return tab; //string type
|
152
|
-
}
|
153
|
-
saveCardState(cardsState, formName, resourceID) {
|
154
|
-
const completePath = this.getPath(`FormCardState:${resourceID}`, formName, "form-card");
|
155
|
-
return new Promise((resolve, reject) => {
|
156
|
-
this.saveResource(Array.from(cardsState.entries()), completePath)
|
157
|
-
.then((resp) => {
|
158
|
-
resolve(new Map(JSON.parse(resp.resource)));
|
159
|
-
})
|
160
|
-
.catch((error) => {
|
161
|
-
reject(error);
|
162
|
-
});
|
163
|
-
});
|
164
|
-
}
|
165
|
-
saveConfig(config, formName, resourceID) {
|
166
|
-
//Essas informações não devem ser salvas na configuração
|
167
|
-
delete config.cardsState;
|
168
|
-
delete config.defaultVars;
|
169
|
-
delete config.summary;
|
170
|
-
const completePath = this.getPath(resourceID, formName);
|
171
|
-
return new Promise((resolve, reject) => {
|
172
|
-
this.saveResource(config, completePath)
|
173
|
-
.then((resp) => {
|
174
|
-
resolve(JSON.parse(resp.resource));
|
175
|
-
})
|
176
|
-
.catch((error) => {
|
177
|
-
reject(error);
|
178
|
-
});
|
179
|
-
});
|
180
|
-
}
|
181
|
-
fetchUserAvailableConfigs(formName, resourceID) {
|
182
|
-
const name = this.getPath(resourceID, formName);
|
183
|
-
return new Promise((resolve, reject) => {
|
184
|
-
DataFetcher.DataFetcher.get()
|
185
|
-
.callGraphQL({
|
186
|
-
values: { name },
|
187
|
-
query: this.queryConfig.get("fetchUserAvailableConfigs"),
|
188
|
-
})
|
189
|
-
.then((result) => {
|
190
|
-
resolve(result);
|
191
|
-
})
|
192
|
-
.catch((error) => {
|
193
|
-
reject(error);
|
194
|
-
});
|
195
|
-
});
|
196
|
-
}
|
197
|
-
fetchLegacyConfig(formName, resourceID) {
|
198
|
-
const name = this.getPath(resourceID, formName);
|
199
|
-
return new Promise((resolve, reject) => {
|
200
|
-
DataFetcher.DataFetcher.get()
|
201
|
-
.callGraphQL({
|
202
|
-
values: { name },
|
203
|
-
query: this.queryConfig.get("fetchLegacyConfig"),
|
204
|
-
})
|
205
|
-
.then((result) => {
|
206
|
-
resolve(core.ObjectUtils.stringToObject((result === null || result === void 0 ? void 0 : result.resource) || ''));
|
207
|
-
})
|
208
|
-
.catch((error) => {
|
209
|
-
reject(error);
|
210
|
-
});
|
211
|
-
});
|
212
|
-
}
|
213
|
-
fetchDefaultConfig(formName, resourceID) {
|
214
|
-
const name = this.getPath(resourceID, formName);
|
215
|
-
return new Promise((resolve, reject) => {
|
216
|
-
DataFetcher.DataFetcher.get()
|
217
|
-
.callGraphQL({
|
218
|
-
values: { name },
|
219
|
-
query: this.queryConfig.get("fetchDefaultConfig"),
|
220
|
-
})
|
221
|
-
.then((result) => {
|
222
|
-
resolve(core.ObjectUtils.stringToObject((result === null || result === void 0 ? void 0 : result.resource) || ''));
|
223
|
-
})
|
224
|
-
.catch((error) => {
|
225
|
-
reject(error);
|
226
|
-
});
|
227
|
-
});
|
228
|
-
}
|
229
|
-
getPath(resourceID, name, authority = "form") {
|
230
|
-
if (name) {
|
231
|
-
return `cfg://${authority}/${resourceID}/${name}`;
|
232
|
-
}
|
233
|
-
return `cfg://${authority}/${resourceID}`;
|
234
|
-
}
|
235
|
-
async fetchLegacyConfigurableForm(configName) {
|
236
|
-
const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
|
237
|
-
const response = await DataFetcher.DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
238
|
-
if (core.ObjectUtils.isEmpty(response))
|
239
|
-
return undefined;
|
240
|
-
return this.buildLegacyConfigurableForm(response);
|
241
|
-
}
|
242
|
-
buildLegacyConfigurableForm(config) {
|
243
|
-
var _a, _b, _c;
|
244
|
-
const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
245
|
-
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
246
|
-
}
|
247
|
-
}
|
248
|
-
exports.UserConfigType = void 0;
|
249
|
-
(function (UserConfigType) {
|
250
|
-
UserConfigType["USER"] = "USER";
|
251
|
-
UserConfigType["DEFAULT"] = "DEFAULT";
|
252
|
-
UserConfigType["SHARED"] = "SHARED";
|
253
|
-
})(exports.UserConfigType || (exports.UserConfigType = {}));
|
254
|
-
|
255
|
-
exports.FormConfigFetcher = FormConfigFetcher;
|
256
|
-
exports.ResourceFetcher = ResourceFetcher;
|
@@ -1,34 +0,0 @@
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
-
var t = {};
|
3
|
-
for (var p in s)
|
4
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
-
t[p] = s[p];
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
-
t[p[i]] = s[p[i]];
|
10
|
-
}
|
11
|
-
return t;
|
12
|
-
};
|
13
|
-
import { ApplicationContext, ObjectUtils } from "@sankhyalabs/core";
|
14
|
-
import { DataFetcher } from '../../DataFetcher';
|
15
|
-
export default function fetchDataExporter(_a) {
|
16
|
-
var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
|
17
|
-
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
18
|
-
const serviceName = `${application.getModuleName()}@DataExporterSPBean.${methodName}`;
|
19
|
-
const payload = { serviceName, requestBody };
|
20
|
-
return new Promise((resolve, reject) => {
|
21
|
-
DataFetcher.get()
|
22
|
-
.callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
|
23
|
-
.then(result => resolve(getFormatResponse(result)))
|
24
|
-
.catch(error => reject(error));
|
25
|
-
});
|
26
|
-
}
|
27
|
-
function getFormatResponse(result) {
|
28
|
-
var _a;
|
29
|
-
const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
|
30
|
-
if (response == undefined) {
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
return ObjectUtils.stringToObject(response);
|
34
|
-
}
|