@izara_project/izara-shared-search-and-sort 1.0.5 → 1.0.7
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/index.js +0 -2
- package/package.json +1 -1
- package/src/DataFieldsSharedLib.js +10 -1
- package/src/FiltersSharedLib.js +0 -1
- package/src/LogicalStructureSharedLib.js +710 -101
- package/src/SearchSortSharedLib.js +40 -19
- package/src/ChangeLevelSharedLib.js +0 -610
|
@@ -23,10 +23,9 @@ import lodash from 'lodash';
|
|
|
23
23
|
const { isEmpty } = lodash;
|
|
24
24
|
import filtersSharedLib from './FiltersSharedLib.js'; //const filtersSharedLib = require('./FiltersSharedLib');
|
|
25
25
|
import dataFieldsSharedLib from './DataFieldsSharedLib.js';
|
|
26
|
-
import searchResultShared from '@izara_project/izara-core-library-search-result';
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
function createSearchRequest(
|
|
28
|
+
async function createSearchRequest(
|
|
30
29
|
objType,
|
|
31
30
|
initialLogicalElementId,
|
|
32
31
|
logicalElements,
|
|
@@ -35,7 +34,8 @@ function createSearchRequest(
|
|
|
35
34
|
perParentCombinations,
|
|
36
35
|
requiredDataLinkStepObjects,
|
|
37
36
|
requiredDataLinkSteps,
|
|
38
|
-
values
|
|
37
|
+
values,
|
|
38
|
+
// getSchemaFn
|
|
39
39
|
) {
|
|
40
40
|
console.log('createSearchResult: ', {
|
|
41
41
|
objType,
|
|
@@ -46,7 +46,8 @@ function createSearchRequest(
|
|
|
46
46
|
perParentCombinations,
|
|
47
47
|
requiredDataLinkStepObjects,
|
|
48
48
|
requiredDataLinkSteps,
|
|
49
|
-
values
|
|
49
|
+
values,
|
|
50
|
+
// getSchemaFn
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
let filterElements = {};
|
|
@@ -54,6 +55,17 @@ function createSearchRequest(
|
|
|
54
55
|
let errorsObject = {};
|
|
55
56
|
let errorsFound = [];
|
|
56
57
|
|
|
58
|
+
let requiredDataPromise = dataFieldsSharedLib.createRequiredData(
|
|
59
|
+
objType,
|
|
60
|
+
requiredDataFields,
|
|
61
|
+
complexFilterCombinations,
|
|
62
|
+
perParentCombinations,
|
|
63
|
+
requiredDataLinkStepObjects,
|
|
64
|
+
requiredDataLinkSteps,
|
|
65
|
+
values,
|
|
66
|
+
// getSchemaFn
|
|
67
|
+
);
|
|
68
|
+
|
|
57
69
|
//* create complexFilter normalize to send backend
|
|
58
70
|
let [
|
|
59
71
|
complexFilterRequest,
|
|
@@ -79,15 +91,16 @@ function createSearchRequest(
|
|
|
79
91
|
Object.assign(errorsObject, complexErrorsObject);
|
|
80
92
|
}
|
|
81
93
|
|
|
82
|
-
let requiredData = dataFieldsSharedLib.createRequiredData(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
);
|
|
94
|
+
// let requiredData = dataFieldsSharedLib.createRequiredData(
|
|
95
|
+
// objType,
|
|
96
|
+
// requiredDataFields,
|
|
97
|
+
// complexFilterCombinations,
|
|
98
|
+
// perParentCombinations,
|
|
99
|
+
// requiredDataLinkStepObjects,
|
|
100
|
+
// requiredDataLinkSteps,
|
|
101
|
+
// values,
|
|
102
|
+
// );
|
|
103
|
+
let requiredData = await requiredDataPromise;
|
|
91
104
|
console.log('return create requiredData: ', requiredData);
|
|
92
105
|
|
|
93
106
|
if (requiredData.status === 'invalid' || requiredData.errorsFound.length > 0) {
|
|
@@ -142,7 +155,7 @@ function createSearchRequest(
|
|
|
142
155
|
|
|
143
156
|
}
|
|
144
157
|
|
|
145
|
-
function createSortRequest(
|
|
158
|
+
async function createSortRequest(
|
|
146
159
|
objType,
|
|
147
160
|
initialLogicalElementId,
|
|
148
161
|
logicalElements,
|
|
@@ -152,7 +165,8 @@ function createSortRequest(
|
|
|
152
165
|
requiredDataLinkStepObjects,
|
|
153
166
|
requiredDataLinkSteps,
|
|
154
167
|
sortFields,
|
|
155
|
-
values
|
|
168
|
+
values,
|
|
169
|
+
// getSchemaFn
|
|
156
170
|
) {
|
|
157
171
|
console.log('createSortResult: ', {
|
|
158
172
|
objType,
|
|
@@ -164,7 +178,8 @@ function createSortRequest(
|
|
|
164
178
|
requiredDataLinkStepObjects,
|
|
165
179
|
requiredDataLinkSteps,
|
|
166
180
|
sortFields,
|
|
167
|
-
values
|
|
181
|
+
values,
|
|
182
|
+
// getSchemaFn
|
|
168
183
|
});
|
|
169
184
|
|
|
170
185
|
let sortFieldMain = []
|
|
@@ -198,7 +213,7 @@ function createSortRequest(
|
|
|
198
213
|
}
|
|
199
214
|
console.log("sortFieldMain: ", sortFieldMain)
|
|
200
215
|
|
|
201
|
-
let [searchResultRequest, status, errorsObject, errorsFound] = createSearchRequest(
|
|
216
|
+
let [searchResultRequest, status, errorsObject, errorsFound] = await createSearchRequest(
|
|
202
217
|
objType,
|
|
203
218
|
initialLogicalElementId,
|
|
204
219
|
logicalElements,
|
|
@@ -207,7 +222,8 @@ function createSortRequest(
|
|
|
207
222
|
perParentCombinations,
|
|
208
223
|
requiredDataLinkStepObjects,
|
|
209
224
|
requiredDataLinkSteps,
|
|
210
|
-
values
|
|
225
|
+
values,
|
|
226
|
+
// getSchemaFn
|
|
211
227
|
);
|
|
212
228
|
console.log('SearchResultRequest: ', {
|
|
213
229
|
searchResultRequest,
|
|
@@ -258,4 +274,9 @@ export default {
|
|
|
258
274
|
//* create request to backend to sort and search
|
|
259
275
|
createSearchRequest,
|
|
260
276
|
createSortRequest
|
|
261
|
-
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
// getSchemaFn = {
|
|
281
|
+
|
|
282
|
+
// }
|