@izara_project/izara-shared-search-and-sort 1.0.3 → 1.0.4

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.
@@ -27,7 +27,6 @@ import searchResultShared from '@izara_project/izara-core-library-search-result'
27
27
 
28
28
 
29
29
  function createSearchRequest(
30
- _izContext,
31
30
  objType,
32
31
  initialLogicalElementId,
33
32
  logicalElements,
@@ -38,7 +37,7 @@ function createSearchRequest(
38
37
  requiredDataLinkSteps,
39
38
  values
40
39
  ) {
41
- _izContext.logger.debug('createSearchResult: ', {
40
+ console.log('createSearchResult: ', {
42
41
  objType,
43
42
  initialLogicalElementId,
44
43
  logicalElements,
@@ -62,14 +61,13 @@ function createSearchRequest(
62
61
  complexErrorsObject,
63
62
  complexErrorsFound
64
63
  ] = filtersSharedLib.createFiltersRequest(
65
- _izContext,
66
64
  objType,
67
65
  initialLogicalElementId,
68
66
  logicalElements,
69
67
  values,
70
68
  []
71
69
  );
72
- _izContext.logger.debug('return createComplexFilter: ', {
70
+ console.log('return createComplexFilter: ', {
73
71
  complexFilterRequest,
74
72
  complexFilterStatus,
75
73
  complexErrorsObject,
@@ -82,7 +80,6 @@ function createSearchRequest(
82
80
  }
83
81
 
84
82
  let requiredData = dataFieldsSharedLib.createRequiredData(
85
- _izContext,
86
83
  objType,
87
84
  requiredDataFields,
88
85
  complexFilterCombinations,
@@ -91,7 +88,7 @@ function createSearchRequest(
91
88
  requiredDataLinkSteps,
92
89
  values,
93
90
  );
94
- _izContext.logger.debug('return create requiredData: ', requiredData);
91
+ console.log('return create requiredData: ', requiredData);
95
92
 
96
93
  if (requiredData.status === 'invalid' || requiredData.errorsFound.length > 0) {
97
94
  Object.assign(errorsObject, requiredData.errorsObject)
@@ -121,7 +118,7 @@ function createSearchRequest(
121
118
  Object.assign(filterElements, requiredData.filterElements);
122
119
  }
123
120
 
124
- _izContext.logger.debug("--------------------------- start create searchResult request -------------------------------", {
121
+ console.log("--------------------------- start create searchResult request -------------------------------", {
125
122
  complexFilterRequest,
126
123
  requiredData,
127
124
  filterElements
@@ -139,14 +136,13 @@ function createSearchRequest(
139
136
  linkPathObjects: requiredData.linkPathObjects,
140
137
  linkPathSteps: requiredData.linkPathSteps
141
138
  };
142
- _izContext.logger.debug("searchResultRequest: ", searchResultRequest);
139
+ console.log("searchResultRequest: ", searchResultRequest);
143
140
 
144
141
  return [searchResultRequest, status, errorsObject, errorsFound]
145
142
 
146
143
  }
147
144
 
148
145
  function createSortRequest(
149
- _izContext,
150
146
  objType,
151
147
  initialLogicalElementId,
152
148
  logicalElements,
@@ -158,7 +154,7 @@ function createSortRequest(
158
154
  sortFields,
159
155
  values
160
156
  ) {
161
- _izContext.logger.debug('createSortResult: ', {
157
+ console.log('createSortResult: ', {
162
158
  objType,
163
159
  initialLogicalElementId,
164
160
  logicalElements,
@@ -183,16 +179,16 @@ function createSortRequest(
183
179
  let requiredDataLinkStepObjectId = sortField.requiredDataLinkStepObjectId;
184
180
 
185
181
  let requiredDataLinkObject = requiredDataLinkStepObjects[requiredDataLinkStepObjectId];
186
- _izContext.logger.debug('requiredDataLinkObject', requiredDataLinkObject);
182
+ console.log('requiredDataLinkObject', requiredDataLinkObject);
187
183
 
188
184
  let requiredDataLinkStepsSortField = requiredDataLinkObject.linkSteps;
189
- _izContext.logger.debug('requiredDataLinkStepsSortField', requiredDataLinkStepsSortField);
185
+ console.log('requiredDataLinkStepsSortField', requiredDataLinkStepsSortField);
190
186
 
191
187
  let lastRequiredDataLinkStepId = requiredDataLinkStepsSortField[requiredDataLinkStepsSortField.length - 1];
192
- _izContext.logger.debug('lastRequiredDataLinkStepId', lastRequiredDataLinkStepId);
188
+ console.log('lastRequiredDataLinkStepId', lastRequiredDataLinkStepId);
193
189
 
194
190
  let linkStep = requiredDataLinkSteps[lastRequiredDataLinkStepId];
195
- _izContext.logger.debug('linkStep', linkStep);
191
+ console.log('linkStep', linkStep);
196
192
 
197
193
  sortFieldMain.push({
198
194
  fieldName: linkStep.fieldName,
@@ -200,10 +196,9 @@ function createSortRequest(
200
196
  });
201
197
 
202
198
  }
203
- _izContext.logger.debug("sortFieldMain: ", sortFieldMain)
199
+ console.log("sortFieldMain: ", sortFieldMain)
204
200
 
205
201
  let [searchResultRequest, status, errorsObject, errorsFound] = createSearchRequest(
206
- _izContext,
207
202
  objType,
208
203
  initialLogicalElementId,
209
204
  logicalElements,
@@ -214,7 +209,7 @@ function createSortRequest(
214
209
  requiredDataLinkSteps,
215
210
  values
216
211
  );
217
- _izContext.logger.debug('SearchResultRequest: ', {
212
+ console.log('SearchResultRequest: ', {
218
213
  searchResultRequest,
219
214
  status,
220
215
  errorsObject,
@@ -227,18 +222,19 @@ function createSortRequest(
227
222
 
228
223
  let searchResultId = searchResultRequest.searchResultId;
229
224
  let searchDetailId = searchResultRequest.searchDetailId;
230
- _izContext.logger.debug('searchResultMain: ', {
225
+ console.log('searchResultMain: ', {
231
226
  searchResultId,
232
227
  searchDetailId
233
228
  });
234
229
 
235
- let sortResultId = searchResultShared.createSortResultId(
236
- _izContext,
237
- searchResultId,
238
- searchDetailId,
239
- sortFieldMain
240
- );
241
- _izContext.logger.debug('sortResultId: ', sortResultId)
230
+ let sortFieldsHash = hash(sortFieldMain);
231
+ let sortResultId = searchResultId + '__' + searchDetailId + '__' + sortFieldsHash;
232
+ // let sortResultId = searchResultShared.createSortResultId(
233
+ // searchResultId,
234
+ // searchDetailId,
235
+ // sortFieldMain
236
+ // );
237
+ console.log('sortResultId: ', sortResultId)
242
238
 
243
239
  let sortRequest = {
244
240
  objType: objType,
@@ -251,9 +247,9 @@ function createSortRequest(
251
247
  linkPathSteps: searchResultRequest.linkPathSteps,
252
248
  sortFields: sortFieldMain
253
249
  };
254
- _izContext.logger.debug('sortRequest: ', sortRequest);
250
+ console.log('sortRequest: ', sortRequest);
255
251
 
256
- return [sortRequest, status, errorsObject, errorsFound]
252
+ return [sortResultId, sortRequest, status, errorsObject, errorsFound]
257
253
 
258
254
  }
259
255