@wavemaker/variables 11.14.3-rc.6401 → 11.15.0-rc.6403
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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/variables",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.15.0-rc.6403",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@wavemaker/variables",
|
|
9
|
-
"version": "11.
|
|
9
|
+
"version": "11.15.0-rc.6403",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@metrichor/jmespath": "^0.3.1",
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/variables",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.15.0-rc.6403",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@wavemaker/variables",
|
|
9
|
-
"version": "11.
|
|
9
|
+
"version": "11.15.0-rc.6403",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@metrichor/jmespath": "^0.3.1",
|
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ export declare class PaginationUtils {
|
|
|
67
67
|
* @param variable withholds variable information
|
|
68
68
|
* @returns {void} This method does not return anything
|
|
69
69
|
*/
|
|
70
|
-
static setParameterVal(paramName: any, res: any, operationInfo: any, variable: any): void;
|
|
70
|
+
static setParameterVal(paramName: any, res: any, operationInfo: any, variable: any, options?: any): void;
|
|
71
71
|
/**
|
|
72
72
|
* Creates res object from the response recieved from the api triggered
|
|
73
73
|
* @param variable withholds variable information
|
|
@@ -79,4 +79,13 @@ export declare class PaginationUtils {
|
|
|
79
79
|
* @returns {object} An object which holds the information of pagination which has to be stored on the variable
|
|
80
80
|
*/
|
|
81
81
|
static generatePaginationRes(operationInfo: any, paginationInfo: any, response: any, resHeaders: any, options: any, variable: any): {};
|
|
82
|
+
/**
|
|
83
|
+
* If totalElements has $minValue in it, set totalElements as $minValue
|
|
84
|
+
* If the rendered elements are greater than $minValue, set totalElements as Number of elements rendered + 1
|
|
85
|
+
|
|
86
|
+
* If totalElements is present in the pagination's output metadata deduce totalElements from api's response
|
|
87
|
+
|
|
88
|
+
* If Pagination type is offset, deduce totalElements from size and options[page] else deduce from size and res[page]
|
|
89
|
+
*/
|
|
90
|
+
static setTotalElements(resOutput: any, options: any, res: any, variable: any, response: any, paginationInfo: any, resHeaders: any): void;
|
|
82
91
|
}
|
|
@@ -159,14 +159,14 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
159
159
|
* @returns {void} This method does not return anything
|
|
160
160
|
*/
|
|
161
161
|
PaginationUtils.checkPaginationAtQuery = function (operationInfo, variable, options) {
|
|
162
|
-
var _a;
|
|
162
|
+
var _a, _b;
|
|
163
163
|
var paginationInfo = this.getPaginationInfo(operationInfo, variable);
|
|
164
164
|
// If page is not first, pagination is present on the variable and paginationInfo's input meta has size set pagination in query params
|
|
165
165
|
var hasPagination = options && options['page'] && (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.input.size) && variable.pagination;
|
|
166
166
|
if (!hasPagination) {
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
var inputParam;
|
|
169
|
+
var inputParam, sizeParam;
|
|
170
170
|
// if pagination type is offset, asssign inputParam to offset else page
|
|
171
171
|
if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {
|
|
172
172
|
inputParam = 'offset';
|
|
@@ -174,6 +174,16 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
174
174
|
else {
|
|
175
175
|
inputParam = 'page';
|
|
176
176
|
}
|
|
177
|
+
if (["page", "offset", "cursor"].includes(paginationInfo.type)) {
|
|
178
|
+
sizeParam = 'size';
|
|
179
|
+
}
|
|
180
|
+
if (sizeParam) {
|
|
181
|
+
var sizeParamName_1 = paginationInfo.input[sizeParam].split('.')[0];
|
|
182
|
+
var sizeParamObj = find(operationInfo.parameters, function (obj) { return obj.name === sizeParamName_1; });
|
|
183
|
+
if (sizeParamObj && sizeParamObj.parameterType === 'query' && ["page", "offset", "cursor"].includes(paginationInfo.type)) {
|
|
184
|
+
variable.pagination['size'] = options['size'] || variable.pagination['size'];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
177
187
|
var paramName = paginationInfo.input[inputParam].split('.')[0];
|
|
178
188
|
var paramObj = find(operationInfo.parameters, function (obj) { return obj.name === paramName; });
|
|
179
189
|
// check if the variable has query params and they are not empty
|
|
@@ -190,6 +200,15 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
190
200
|
}
|
|
191
201
|
this.setPaginationQueryParams(variable, operationInfo, paginationInfo);
|
|
192
202
|
}
|
|
203
|
+
else if (paginationInfo.type === 'cursor') {
|
|
204
|
+
var sParam_1 = (((_b = paginationInfo.input) === null || _b === void 0 ? void 0 : _b.size) && paginationInfo.input['size'].split('.')[0]) || "";
|
|
205
|
+
if (sParam_1) {
|
|
206
|
+
var sParamObj = find(operationInfo.parameters, function (obj) { return obj.name === sParam_1 && obj.parameterType === 'path'; });
|
|
207
|
+
if (sParamObj) {
|
|
208
|
+
sParamObj.sampleValue = options['size'] || variable.pagination['size'] || sParamObj.sampleValue;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
193
212
|
};
|
|
194
213
|
/**
|
|
195
214
|
* Deduces the offset information from the size and page params
|
|
@@ -308,17 +327,26 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
308
327
|
* For cursor type pagination, if pagination info is present in the query
|
|
309
328
|
* Based on whether user clicks on the next or prev button modify the url's query params
|
|
310
329
|
*/
|
|
330
|
+
var sizeParam_1 = paginationInfo.input['size'].split('.')[0];
|
|
331
|
+
var sizeObj = find(operationInfo.parameters, function (obj) { return obj.name === sizeParam_1; });
|
|
311
332
|
var urlParams = url.split('?');
|
|
312
333
|
var invokeUrl = void 0;
|
|
313
334
|
if (variable.pagination.isNext) {
|
|
314
335
|
invokeUrl = variable.pagination.next.split('?');
|
|
315
336
|
}
|
|
316
|
-
else {
|
|
337
|
+
else if (variable.pagination.isPrev) {
|
|
317
338
|
invokeUrl = variable.pagination.prev.split('?');
|
|
318
339
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
340
|
+
if (invokeUrl) {
|
|
341
|
+
var queryParams = new URLSearchParams(invokeUrl[1]);
|
|
342
|
+
if (sizeObj && sizeObj.sampleValue) {
|
|
343
|
+
queryParams.set(sizeObj.name, sizeObj.sampleValue);
|
|
344
|
+
}
|
|
345
|
+
invokeUrl[1] = queryParams.toString();
|
|
346
|
+
urlParams[1] = invokeUrl[1];
|
|
347
|
+
url = urlParams.join('?');
|
|
348
|
+
resObj['url'] = url;
|
|
349
|
+
}
|
|
322
350
|
}
|
|
323
351
|
}
|
|
324
352
|
return resObj;
|
|
@@ -331,11 +359,14 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
331
359
|
* @param variable withholds variable information
|
|
332
360
|
* @returns {void} This method does not return anything
|
|
333
361
|
*/
|
|
334
|
-
PaginationUtils.setParameterVal = function (paramName, res, operationInfo, variable) {
|
|
362
|
+
PaginationUtils.setParameterVal = function (paramName, res, operationInfo, variable, options) {
|
|
335
363
|
var paginationInfo = this.getPaginationInfo(operationInfo, variable);
|
|
336
364
|
var paginationParams = paginationInfo.input[paramName].split('.');
|
|
337
365
|
var param = paginationParams[0];
|
|
338
366
|
var sizeObj = find(operationInfo.parameters, function (obj) { return obj.name === param; });
|
|
367
|
+
if (paramName === 'size' && paginationInfo && (paginationInfo.type === 'offset' || paginationInfo.type === 'page') && (options === null || options === void 0 ? void 0 : options.size) && (sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.sampleValue)) {
|
|
368
|
+
sizeObj.sampleValue = options['size'] || result(sizeObj, 'sampleValue');
|
|
369
|
+
}
|
|
339
370
|
res[paramName] = result(sizeObj, 'sampleValue');
|
|
340
371
|
// if input value is configured from object, fetch the value from the specified path
|
|
341
372
|
if (paginationParams.length > 1) {
|
|
@@ -365,11 +396,11 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
365
396
|
if (resOutput === null || resOutput === void 0 ? void 0 : resOutput.size) {
|
|
366
397
|
this.setPaginationItems(resOutput.size, response, res, 'size', resHeaders);
|
|
367
398
|
}
|
|
368
|
-
else if (((_a = paginationInfo.input) === null || _a === void 0 ? void 0 : _a.size) && paginationInfo.type === 'page') {
|
|
369
|
-
res['size'] = Number((_b = paginationInfo.input) === null || _b === void 0 ? void 0 : _b.size) ? (_c = paginationInfo.input) === null || _c === void 0 ? void 0 : _c.size : get(response, (_d = paginationInfo.input) === null || _d === void 0 ? void 0 : _d.size);
|
|
370
|
-
}
|
|
371
399
|
else {
|
|
372
|
-
this.setParameterVal('size', res, operationInfo, variable);
|
|
400
|
+
this.setParameterVal('size', res, operationInfo, variable, options);
|
|
401
|
+
}
|
|
402
|
+
if (!(resOutput === null || resOutput === void 0 ? void 0 : resOutput.size) && ((_a = paginationInfo.input) === null || _a === void 0 ? void 0 : _a.size) && paginationInfo.type === 'page') {
|
|
403
|
+
res['size'] = (Number((_b = paginationInfo.input) === null || _b === void 0 ? void 0 : _b.size) ? (_c = paginationInfo.input) === null || _c === void 0 ? void 0 : _c.size : get(response, (_d = paginationInfo.input) === null || _d === void 0 ? void 0 : _d.size)) || res['size'];
|
|
373
404
|
}
|
|
374
405
|
/**
|
|
375
406
|
* If page is present in the pagination's output metadata deduce page from api's response
|
|
@@ -379,38 +410,9 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
379
410
|
this.setPaginationItems(resOutput.page, response, res, 'page', resHeaders);
|
|
380
411
|
}
|
|
381
412
|
else if (paginationInfo.type !== 'offset') {
|
|
382
|
-
this.setParameterVal('page', res, operationInfo, variable);
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* If totalElements has $minValue in it, set totalElements as $minValue
|
|
386
|
-
* If the rendered elements are greater than $minValue, set totalElements as Number of elements rendered + 1
|
|
387
|
-
|
|
388
|
-
* If totalElements is present in the pagination's output metadata deduce totalElements from api's response
|
|
389
|
-
|
|
390
|
-
* If Pagination type is offset, deduce totalElements from size and options[page] else deduce from size and res[page]
|
|
391
|
-
*/
|
|
392
|
-
if (startsWith(resOutput === null || resOutput === void 0 ? void 0 : resOutput.totalElements, '$minValue')) {
|
|
393
|
-
var totalEl = resOutput.totalElements.replace('$minValue=', '');
|
|
394
|
-
var pageParam = res['page'] ? res['page'] : options['page'];
|
|
395
|
-
var elRendered = res['size'] * pageParam;
|
|
396
|
-
if (!variable.pagination || variable.pagination['totalElements'] > elRendered) {
|
|
397
|
-
res['totalElements'] = parseInt(totalEl);
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
res['totalElements'] = elRendered + 1;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
else if (resOutput === null || resOutput === void 0 ? void 0 : resOutput.totalElements) {
|
|
404
|
-
this.setPaginationItems(resOutput.totalElements, response, res, 'totalElements', resHeaders);
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {
|
|
408
|
-
res['totalElements'] = (res['size'] * (options['page'] ? options['page'] : 1)) + 1;
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
res['totalElements'] = (res['size'] * res['page']) + 1;
|
|
412
|
-
}
|
|
413
|
+
this.setParameterVal('page', res, operationInfo, variable, options);
|
|
413
414
|
}
|
|
415
|
+
this.setTotalElements(resOutput, options, res, variable, response, paginationInfo, resHeaders);
|
|
414
416
|
/**
|
|
415
417
|
* If hasMoreItems is present in the pagination's output metadata deduce hasMoreItems from api's response
|
|
416
418
|
* Else assign it as empty which will be calculated at pagination object generation
|
|
@@ -425,9 +427,44 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
425
427
|
else if (resOutput) { // For cursor type pagination set next and prev keys in res object
|
|
426
428
|
this.setPaginationItems(resOutput.next, response, res, 'next', resHeaders);
|
|
427
429
|
this.setPaginationItems(resOutput.prev, response, res, 'prev', resHeaders);
|
|
430
|
+
this.setPaginationItems(resOutput.size, response, res, 'size', resHeaders);
|
|
431
|
+
this.setParameterVal('page', res, operationInfo, variable, options);
|
|
432
|
+
this.setTotalElements(resOutput, options, res, variable, response, paginationInfo, resHeaders);
|
|
428
433
|
}
|
|
429
434
|
return res;
|
|
430
435
|
};
|
|
436
|
+
/**
|
|
437
|
+
* If totalElements has $minValue in it, set totalElements as $minValue
|
|
438
|
+
* If the rendered elements are greater than $minValue, set totalElements as Number of elements rendered + 1
|
|
439
|
+
|
|
440
|
+
* If totalElements is present in the pagination's output metadata deduce totalElements from api's response
|
|
441
|
+
|
|
442
|
+
* If Pagination type is offset, deduce totalElements from size and options[page] else deduce from size and res[page]
|
|
443
|
+
*/
|
|
444
|
+
PaginationUtils.setTotalElements = function (resOutput, options, res, variable, response, paginationInfo, resHeaders) {
|
|
445
|
+
if (startsWith(resOutput === null || resOutput === void 0 ? void 0 : resOutput.totalElements, '$minValue')) {
|
|
446
|
+
var totalEl = resOutput.totalElements.replace('$minValue=', '');
|
|
447
|
+
var pageParam = res['page'] ? res['page'] : options['page'];
|
|
448
|
+
var elRendered = res['size'] * pageParam;
|
|
449
|
+
if (!variable.pagination || variable.pagination['totalElements'] > elRendered) {
|
|
450
|
+
res['totalElements'] = parseInt(totalEl);
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
res['totalElements'] = elRendered + 1;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
else if (resOutput === null || resOutput === void 0 ? void 0 : resOutput.totalElements) {
|
|
457
|
+
this.setPaginationItems(resOutput.totalElements, response, res, 'totalElements', resHeaders);
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {
|
|
461
|
+
res['totalElements'] = (res['size'] * (options['page'] ? options['page'] : 1)) + 1;
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
res['totalElements'] = (res['size'] * res['page']) + 1;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
};
|
|
431
468
|
return PaginationUtils;
|
|
432
469
|
}());
|
|
433
470
|
export { PaginationUtils };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.utils.js","sourceRoot":"./","sources":["src/util/variable/pagination.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE;IAAA;IAqZA,CAAC;IApZG;;;;;;OAMG;IACI,wCAAwB,GAA/B,UAAgC,QAAQ,EAAE,aAAa,EAAE,cAAc;QACnE,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,OAAO;YACpC,wDAAwD;YACxD,IAAI,UAAU,CAAC;YACf,IAAI,cAAc,CAAC,IAAI,KAAK,QAAQ,IAAI,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBAClE,UAAU,GAAG,QAAQ,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACJ,UAAU,GAAG,MAAM,CAAC;YACxB,CAAC;YACD,4DAA4D;YAC5D,0HAA0H;YAC1H,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,OAAO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E;YACtF,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IACL,sBAAC;AAAD,CAAC,AArZD,IAqZC","sourcesContent":["import { jmespath } from '@metrichor/jmespath';\n\nimport {startsWith, find, set, result, get} from 'lodash-es';\nimport { getValidJSON } from '../utils';\nimport { VARIABLE_CONSTANTS } from '../../constants/variables.constants';\n\nexport class PaginationUtils {\n /**\n * Modifies the query values with the pagination info which is retrieved from the previous API response.\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @param paginationInfo has metadata of the variable pagination data\n * @returns {void} This method does not return anything\n */\n static setPaginationQueryParams(variable, operationInfo, paginationInfo) {\n operationInfo.parameters.forEach(element => {\n // pagination input information varies based on the type\n let inputParam;\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n inputParam = 'offset';\n } else {\n inputParam = 'page';\n }\n // modifies query values based on the pagination of variable\n // compare parameter name with the input parameter's starting naming key (ex: channelcontext in channelcontext.pagination)\n if (element.name === paginationInfo.input[inputParam].split('.')[0]) {\n element.sampleValue = variable.pagination['page'];\n } else if (element.name === paginationInfo.input.size.split('.')[0]) {\n element.sampleValue = variable.pagination['size'];\n }\n });\n }\n\n /**\n * Sets pagination on the variable based on the response of the triggered api call.\n * @param variable withholds variable information \n * @param response has data of the api call's response\n * @param options has info of the api's query params\n * @returns {void} This method does not return anything\n */\n static setVariablePagination(variable, response, options) {\n if (!variable.pagination) {\n variable.pagination = {\n empty: false\n };\n }\n variable.pagination['size'] = response.size;\n variable.pagination['page'] = response.page || 0;\n variable.pagination['totalElements'] = response.totalElements;\n variable.pagination['numberOfElements'] = variable.pagination['size'];\n variable.pagination['number'] = options['page'] ? options['page'] - 1 : 0;\n \n /**\n * Deduce totalPages from totalElements by size.\n * If the total elements are evenly split among the pages, assign the same to totalPages\n * Else assign totalPages + 1\n */\n variable.pagination['totalPages'] = variable.pagination['totalElements'] / variable.pagination['size'];\n if (variable.pagination['totalElements'] % variable.pagination['size'] === 0) {\n variable.pagination['totalPages'] = parseInt(variable.pagination['totalPages']);\n } else {\n variable.pagination['totalPages'] = parseInt(variable.pagination['totalPages']) + 1;\n }\n\n // If pagination type is cursor, fill next & prev\n if (response.next) {\n variable.pagination['next'] = response.next;\n variable.pagination['prev'] = response.prev;\n variable.pagination['last'] = response.next ? false : true;\n variable.pagination['first'] = response.prev ? false : true;\n } else {\n variable.pagination['first'] = variable.pagination['page'] <= 1 ? true : false;\n // calculate last based on current page index against total pages\n variable.pagination['last'] = response.hasMoreItems === '' ? !(variable.pagination['page'] < variable.pagination['totalPages']) : !response.hasMoreItems;\n }\n }\n\n /**\n * Resolves the expression given in pagination metadata's output\n * @param item has value of each key which is inside output pagination metadata\n * @param response has data of the api call's response\n * @param resHeaders has data of the api call's response headers\n * @param res holds the information of pagination which has to be stored on the variable\n * @param key has key name against which data has to be stored in pagination \n * @returns {void} This method does not return anything\n */\n static setPaginationItems(item, response, res, key, resHeaders) {\n // if the item has body, resolve the expression against the response\n if (startsWith(item, '$body')) {\n const bodyKey = item.replace('$body.', '');\n try {\n res[key] = jmespath.search(response, bodyKey);\n } catch {\n console.warn(`${item} expression needs to be corrected as per JMES guidelines`);\n }\n } else if (startsWith(item, '$header')) { // if the item has header, resolve the expression against the response headers \n const headerKey = item.replace('$header.', '');\n const headers = (<any>Object).fromEntries(resHeaders?.headers || resHeaders);\n const headerParams = headerKey.split('.');\n try {\n res[key] = jmespath.search(headers, headerParams[0].toLowerCase());\n } catch {\n console.warn(`${item} expression needs to be corrected as per JMES guidelines`);\n }\n if (res[key]?.length) { \n let headerVal = res[key].join();\n if (headerParams.length === 1) { \n /**\n * If the headerParams has only 1 key (which is not an object) name assing headerVal to the res[key]\n */\n res[key] = headerVal;\n } else { \n /**\n * If the headerParams has more than 1 key (an object), parse the stringified headerVal which is an object\n * Resolve the expression against headerVal object amd assign it to res[key]\n */\n let keyName = headerParams.slice(1).join('.');\n const headerResp = JSON.parse(headerVal);\n const specialChar = /[!@#$%^&*()+\\=\\[\\]{};':\"\\\\|,<>\\/?]+/;\n if (specialChar.test(keyName)) {\n // If key name has expression (ex: comparission expression) \n // add root key name to keyName for JMES to resolve the expression\n keyName = 'headerResp.' + keyName;\n }\n try {\n res[key] = jmespath.search(headerResp, keyName);\n } catch {\n console.warn(`${item} expression needs to be corrected as per JMES guidelines`);\n }\n }\n }\n }\n }\n\n /**\n * Return the pagination information of the service based on its existence on swagger or on the variable\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @returns {object} This method return pagination metadata\n */\n static getPaginationInfo(operationInfo, variable) {\n if (operationInfo?.paginationInfo) {\n return operationInfo.paginationInfo;\n } else {\n return variable._paginationConfig;\n }\n }\n\n /**\n * Set query params with the pagination info, if pagination metadata is present in query params\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @param options has info of the api's query params\n * @returns {void} This method does not return anything\n */\n static checkPaginationAtQuery(operationInfo, variable, options) { \n const paginationInfo = this.getPaginationInfo(operationInfo, variable);\n // If page is not first, pagination is present on the variable and paginationInfo's input meta has size set pagination in query params\n const hasPagination = options && options['page'] && paginationInfo?.input.size && variable.pagination; \n if (!hasPagination) {\n return;\n }\n\n let inputParam;\n // if pagination type is offset, asssign inputParam to offset else page\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n inputParam = 'offset';\n } else {\n inputParam = 'page';\n }\n const paramName = paginationInfo.input[inputParam].split('.')[0]; \n const paramObj = find(operationInfo.parameters, function(obj) { return obj.name === paramName }); \n // check if the variable has query params and they are not empty\n if (paramObj && paramObj.parameterType === 'query') {\n /**\n * For pagination type other than offset, assign page which is recieved from options\n * For offset type, calculate page from size and options[page]\n */\n if (!paginationInfo.output?.page && paginationInfo.type !== 'offset') {\n variable.pagination['page'] = options['page'];\n } else {\n variable.pagination['page'] = this.getOffsetInfo(variable, options);\n }\n this.setPaginationQueryParams(variable, operationInfo, paginationInfo); \n }\n }\n\n /**\n * Deduces the offset information from the size and page params\n * @param variable withholds variable information \n * @param options has info of the api's query params\n * @returns {object} Returns the next offset number\n */\n static getOffsetInfo(variable, options) {\n return variable.pagination['size'] * (options['page'] ? (options['page'] - 1) : 0);\n }\n\n /**\n * Sets Pagination data on the request information\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @param options has info of the api's query params\n * @param paginationInfo has pagination information of the variable\n * @param headers has request headers\n * @param requestBody has request body\n * @param url has request url\n * @returns {object} Returns the request object which has pagination info\n */\n static setPaginationAtReq(paginationInfo, operationInfo, variable, headers, requestBody, url, options) {\n let reqObj = {};\n let inputParam;\n let resObj = {};\n // pagination input information varies based on the type\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n inputParam = 'offset';\n } else {\n inputParam = 'page';\n }\n const paramName = paginationInfo.input[inputParam].split('.')[0]; \n // check if paramName is present in parameters of operation info \n const paramObj = find(operationInfo.parameters, function(obj) { \n if(obj.parameterType === 'body' && inputParam === 'page'){\n return obj.sampleValue.hasOwnProperty(paramName)\n }else{\n return obj.name === paramName\n }\n }); \n // set page/offset and size from pagination if matched parameter's type is header \n if (paramObj?.parameterType === 'header') {\n const inputBodyParam = VARIABLE_CONSTANTS.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY + paginationInfo.input[inputParam]; \n if (inputParam !== 'offset') { \n set(reqObj, inputBodyParam, variable.pagination['page']);\n } else {\n set(reqObj, inputBodyParam, this.getOffsetInfo(variable, options));\n }\n set(reqObj, VARIABLE_CONSTANTS.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY + paginationInfo.input.size, variable.pagination['size']);\n let headerKey = VARIABLE_CONSTANTS.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY + paramName;\n headers[headerKey] = typeof reqObj[headerKey] === 'object' ? JSON.stringify(reqObj[headerKey]) : reqObj[headerKey];\n resObj['headers'] = headers;\n } else if (paramObj?.parameterType === 'body') { \n // set page/offset and size from pagination if matched parameter's type is body \n // assign bodyVal to updated pagination info object\n let bodyVal: any;\n try {\n bodyVal = typeof paramObj.sampleValue === 'string' ? JSON.parse(paramObj.sampleValue) : paramObj.sampleValue;\n } catch (e) {\n bodyVal = paramObj.sampleValue;\n }\n const bodyParam = inputParam === 'page' ? paginationInfo.input[inputParam] : paginationInfo.input[inputParam].split('.')[1]\n if (bodyVal && bodyVal[bodyParam]) {\n let inputBodyParam = paginationInfo.input[inputParam].split('.').splice(1).join('.'); \n if (inputParam !== 'offset') { \n inputBodyParam = paginationInfo.input[inputParam]; \n set(reqObj, inputBodyParam, options.page ? options.page : 1);\n } else {\n set(reqObj, inputBodyParam, this.getOffsetInfo(variable, options));\n }\n set(reqObj, paginationInfo.input.size.split('.').splice(1).join('.'), variable.pagination['size']);\n bodyVal[bodyParam] = reqObj[bodyParam];\n requestBody = JSON.stringify(bodyVal);\n resObj['requestBody'] = requestBody;\n }\n } else if (variable.pagination.next && paramObj) {\n /**\n * For cursor type pagination, if pagination info is present in the path \n * Based on whether user clicks on the next or prev button modify the url \n */\n \n if (paramObj.parameterType === 'path') {\n const urlParams = operationInfo.relativePath.split('/'),\n paramConfig = '{' + paramObj.name + '}',\n paramIndex = urlParams.indexOf(paramConfig);\n let invokeUrl;\n if (variable.pagination.isNext) {\n invokeUrl = variable.pagination.next.split('/');\n } else {\n invokeUrl = variable.pagination.prev.split('/');\n }\n\n let urlPathParmas;\n let urlPath;\n if (operationInfo.directPath) { // For direct path, as url has hostname, derivate pathname using URL object\n urlPath = new URL(url);\n urlPathParmas = urlPath.pathname.split('/');\n urlPathParmas[paramIndex] = invokeUrl[paramIndex];\n urlPath.pathname = urlPathParmas.join('/');\n url = urlPath.href;\n resObj['url'] = url;\n } else { // Else modify the url with index as +1 (following proxy pattern)\n urlPathParmas = url.split('/');\n urlPathParmas[paramIndex + 1] = invokeUrl[paramIndex];\n url = urlPathParmas.join('/');\n resObj['url'] = url;\n }\n\n } else if (paramObj.parameterType === 'query') {\n /**\n * For cursor type pagination, if pagination info is present in the query \n * Based on whether user clicks on the next or prev button modify the url's query params\n */\n const urlParams = url.split('?');\n let invokeUrl;\n if (variable.pagination.isNext) {\n invokeUrl = variable.pagination.next.split('?');\n } else {\n invokeUrl = variable.pagination.prev.split('?');\n }\n urlParams[1] = invokeUrl[1];\n url = urlParams.join('?');\n resObj['url'] = url;\n }\n }\n return resObj; \n }\n\n /**\n * Sets the pagination info recieved from api's response in the res object\n * @param operationInfo has metadata of the variable\n * @param res holds the information of pagination which has to be stored on the variable\n * @param paramName has key name against which data has to be stored in pagination\n * @param variable withholds variable information \n * @returns {void} This method does not return anything\n */\n static setParameterVal(paramName, res, operationInfo, variable) {\n const paginationInfo = this.getPaginationInfo(operationInfo, variable);\n const paginationParams = paginationInfo.input[paramName].split('.');\n const param = paginationParams[0]; \n const sizeObj = find(operationInfo.parameters, function(obj) { return obj.name === param });\n res[paramName] = result(sizeObj, 'sampleValue');\n // if input value is configured from object, fetch the value from the specified path\n if (paginationParams.length > 1) {\n res[paramName] = get(getValidJSON(res[paramName]), paginationInfo.input[paramName].split('.').splice(1).join('.'));\n }\n }\n\n /**\n * Creates res object from the response recieved from the api triggered\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable\n * @param paginationInfo has metadata of the variable's pagination\n * @param response has data of the api call's response\n * @param options has info of the api's query params\n * @param resHeaders has data of the api call's response headers\n * @returns {object} An object which holds the information of pagination which has to be stored on the variable\n */\n static generatePaginationRes(operationInfo, paginationInfo, response, resHeaders, options, variable) {\n let res = {};\n const resOutput = paginationInfo.output;\n // If pagination type is not cursor, create the following metadata \n if (!resOutput?.next) {\n /**\n * If size is present in the pagination's output metadata deduce size from api's response\n * Else deduce size from the pagination's input metadata size key\n */\n if (resOutput?.size) {\n this.setPaginationItems(resOutput.size, response, res, 'size', resHeaders);\n } else if(paginationInfo.input?.size && paginationInfo.type === 'page'){\n res['size'] = Number(paginationInfo.input?.size) ? paginationInfo.input?.size : get(response, paginationInfo.input?.size) \n }else{ \n this.setParameterVal('size', res, operationInfo, variable);\n }\n /**\n * If page is present in the pagination's output metadata deduce page from api's response\n * Else deduce page from the pagination's input metadata page key\n */\n if (resOutput?.page) {\n this.setPaginationItems(resOutput.page, response, res, 'page', resHeaders);\n } else if (paginationInfo.type !== 'offset') {\n this.setParameterVal('page', res, operationInfo, variable);\n }\n /**\n * If totalElements has $minValue in it, set totalElements as $minValue\n * If the rendered elements are greater than $minValue, set totalElements as Number of elements rendered + 1\n \n * If totalElements is present in the pagination's output metadata deduce totalElements from api's response\n \n * If Pagination type is offset, deduce totalElements from size and options[page] else deduce from size and res[page]\n */\n if (startsWith(resOutput?.totalElements, '$minValue')) {\n const totalEl = resOutput.totalElements.replace('$minValue=', '');\n const pageParam = res['page'] ? res['page'] : options['page']\n const elRendered = res['size'] * pageParam;\n if (!variable.pagination || variable.pagination['totalElements'] > elRendered) {\n res['totalElements'] = parseInt(totalEl);\n } else {\n res['totalElements'] = elRendered + 1;\n }\n } else if (resOutput?.totalElements) {\n this.setPaginationItems(resOutput.totalElements, response, res, 'totalElements', resHeaders);\n } else {\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n res['totalElements'] = (res['size'] * (options['page'] ? options['page'] : 1)) + 1;\n } else {\n res['totalElements'] = (res['size'] * res['page']) + 1;\n }\n }\n /**\n * If hasMoreItems is present in the pagination's output metadata deduce hasMoreItems from api's response\n * Else assign it as empty which will be calculated at pagination object generation\n */\n if (resOutput?.hasMoreItems) {\n this.setPaginationItems(resOutput.hasMoreItems, response, res, 'hasMoreItems', resHeaders);\n } else {\n res['hasMoreItems'] = '';\n }\n } else if (resOutput) { // For cursor type pagination set next and prev keys in res object\n this.setPaginationItems(resOutput.next, response, res, 'next', resHeaders);\n this.setPaginationItems(resOutput.prev, response, res, 'prev', resHeaders);\n }\n return res;\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"pagination.utils.js","sourceRoot":"./","sources":["src/util/variable/pagination.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE;IAAA;IA2bA,CAAC;IA1bG;;;;;;OAMG;IACI,wCAAwB,GAA/B,UAAgC,QAAQ,EAAE,aAAa,EAAE,cAAc;QACnE,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,OAAO;YACpC,wDAAwD;YACxD,IAAI,UAAU,CAAC;YACf,IAAI,cAAc,CAAC,IAAI,KAAK,QAAQ,IAAI,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBAClE,UAAU,GAAG,QAAQ,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACJ,UAAU,GAAG,MAAM,CAAC;YACxB,CAAC;YACD,4DAA4D;YAC5D,0HAA0H;YAC1H,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,OAAO,CAAC,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACtD,CAAC;iBAAM,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,OAAO,CAAC,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACtD,CAAC;QACL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AAS,uBAAT,SAAS,CAAE,aAAa,EAAE,CAAC;YAClC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QACjG,CAAC;aAAM,CAAC;YACJ,IAAI,cAAc,CAAC,IAAI,KAAK,QAAQ,IAAI,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBAClE,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACvF,CAAC;iBAAM,CAAC;gBACJ,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;YAC3D,CAAC;QACL,CAAC;IACL,CAAC;IACL,sBAAC;AAAD,CAAC,AA3bD,IA2bC","sourcesContent":["import { jmespath } from '@metrichor/jmespath';\n\nimport {startsWith, find, set, result, get} from 'lodash-es';\nimport { getValidJSON } from '../utils';\nimport { VARIABLE_CONSTANTS } from '../../constants/variables.constants';\n\nexport class PaginationUtils {\n /**\n * Modifies the query values with the pagination info which is retrieved from the previous API response.\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @param paginationInfo has metadata of the variable pagination data\n * @returns {void} This method does not return anything\n */\n static setPaginationQueryParams(variable, operationInfo, paginationInfo) {\n operationInfo.parameters.forEach(element => {\n // pagination input information varies based on the type\n let inputParam;\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n inputParam = 'offset';\n } else {\n inputParam = 'page';\n }\n // modifies query values based on the pagination of variable\n // compare parameter name with the input parameter's starting naming key (ex: channelcontext in channelcontext.pagination)\n if (element.name === paginationInfo.input[inputParam].split('.')[0]) {\n element.sampleValue = variable.pagination['page'];\n } else if (element.name === paginationInfo.input.size.split('.')[0]) {\n element.sampleValue = variable.pagination['size'];\n }\n });\n }\n\n /**\n * Sets pagination on the variable based on the response of the triggered api call.\n * @param variable withholds variable information \n * @param response has data of the api call's response\n * @param options has info of the api's query params\n * @returns {void} This method does not return anything\n */\n static setVariablePagination(variable, response, options) {\n if (!variable.pagination) {\n variable.pagination = {\n empty: false\n };\n }\n variable.pagination['size'] = response.size;\n variable.pagination['page'] = response.page || 0;\n variable.pagination['totalElements'] = response.totalElements;\n variable.pagination['numberOfElements'] = variable.pagination['size'];\n variable.pagination['number'] = options['page'] ? options['page'] - 1 : 0;\n \n /**\n * Deduce totalPages from totalElements by size.\n * If the total elements are evenly split among the pages, assign the same to totalPages\n * Else assign totalPages + 1\n */\n variable.pagination['totalPages'] = variable.pagination['totalElements'] / variable.pagination['size'];\n if (variable.pagination['totalElements'] % variable.pagination['size'] === 0) {\n variable.pagination['totalPages'] = parseInt(variable.pagination['totalPages']);\n } else {\n variable.pagination['totalPages'] = parseInt(variable.pagination['totalPages']) + 1;\n }\n\n // If pagination type is cursor, fill next & prev\n if (response.next) {\n variable.pagination['next'] = response.next;\n variable.pagination['prev'] = response.prev;\n variable.pagination['last'] = response.next ? false : true;\n variable.pagination['first'] = response.prev ? false : true;\n } else {\n variable.pagination['first'] = variable.pagination['page'] <= 1 ? true : false;\n // calculate last based on current page index against total pages\n variable.pagination['last'] = response.hasMoreItems === '' ? !(variable.pagination['page'] < variable.pagination['totalPages']) : !response.hasMoreItems;\n }\n }\n\n /**\n * Resolves the expression given in pagination metadata's output\n * @param item has value of each key which is inside output pagination metadata\n * @param response has data of the api call's response\n * @param resHeaders has data of the api call's response headers\n * @param res holds the information of pagination which has to be stored on the variable\n * @param key has key name against which data has to be stored in pagination \n * @returns {void} This method does not return anything\n */\n static setPaginationItems(item, response, res, key, resHeaders) {\n // if the item has body, resolve the expression against the response\n if (startsWith(item, '$body')) {\n const bodyKey = item.replace('$body.', '');\n try {\n res[key] = jmespath.search(response, bodyKey);\n } catch {\n console.warn(`${item} expression needs to be corrected as per JMES guidelines`);\n }\n } else if (startsWith(item, '$header')) { // if the item has header, resolve the expression against the response headers \n const headerKey = item.replace('$header.', '');\n const headers = (<any>Object).fromEntries(resHeaders?.headers || resHeaders);\n const headerParams = headerKey.split('.');\n try {\n res[key] = jmespath.search(headers, headerParams[0].toLowerCase());\n } catch {\n console.warn(`${item} expression needs to be corrected as per JMES guidelines`);\n }\n if (res[key]?.length) { \n let headerVal = res[key].join();\n if (headerParams.length === 1) { \n /**\n * If the headerParams has only 1 key (which is not an object) name assing headerVal to the res[key]\n */\n res[key] = headerVal;\n } else { \n /**\n * If the headerParams has more than 1 key (an object), parse the stringified headerVal which is an object\n * Resolve the expression against headerVal object amd assign it to res[key]\n */\n let keyName = headerParams.slice(1).join('.');\n const headerResp = JSON.parse(headerVal);\n const specialChar = /[!@#$%^&*()+\\=\\[\\]{};':\"\\\\|,<>\\/?]+/;\n if (specialChar.test(keyName)) {\n // If key name has expression (ex: comparission expression) \n // add root key name to keyName for JMES to resolve the expression\n keyName = 'headerResp.' + keyName;\n }\n try {\n res[key] = jmespath.search(headerResp, keyName);\n } catch {\n console.warn(`${item} expression needs to be corrected as per JMES guidelines`);\n }\n }\n }\n }\n }\n\n /**\n * Return the pagination information of the service based on its existence on swagger or on the variable\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @returns {object} This method return pagination metadata\n */\n static getPaginationInfo(operationInfo, variable) {\n if (operationInfo?.paginationInfo) {\n return operationInfo.paginationInfo;\n } else {\n return variable._paginationConfig;\n }\n }\n\n /**\n * Set query params with the pagination info, if pagination metadata is present in query params\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @param options has info of the api's query params\n * @returns {void} This method does not return anything\n */\n static checkPaginationAtQuery(operationInfo, variable, options) { \n const paginationInfo = this.getPaginationInfo(operationInfo, variable);\n // If page is not first, pagination is present on the variable and paginationInfo's input meta has size set pagination in query params\n const hasPagination = options && options['page'] && paginationInfo?.input.size && variable.pagination; \n if (!hasPagination) {\n return;\n }\n\n let inputParam,sizeParam;\n // if pagination type is offset, asssign inputParam to offset else page\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n inputParam = 'offset';\n } else {\n inputParam = 'page';\n }\n if([\"page\",\"offset\",\"cursor\"].includes(paginationInfo.type)) {\n sizeParam = 'size';\n }\n if(sizeParam) {\n const sizeParamName = paginationInfo.input[sizeParam].split('.')[0];\n const sizeParamObj = find(operationInfo.parameters, function (obj) { return obj.name === sizeParamName; });\n if (sizeParamObj && sizeParamObj.parameterType === 'query' && [\"page\",\"offset\",\"cursor\"].includes(paginationInfo.type)) {\n variable.pagination['size'] = options['size'] || variable.pagination['size'];\n }\n }\n const paramName = paginationInfo.input[inputParam].split('.')[0]; \n const paramObj = find(operationInfo.parameters, function(obj) { return obj.name === paramName }); \n // check if the variable has query params and they are not empty\n if (paramObj && paramObj.parameterType === 'query') {\n /**\n * For pagination type other than offset, assign page which is recieved from options\n * For offset type, calculate page from size and options[page]\n */\n if (!paginationInfo.output?.page && paginationInfo.type !== 'offset') {\n variable.pagination['page'] = options['page'];\n } else {\n variable.pagination['page'] = this.getOffsetInfo(variable, options);\n }\n this.setPaginationQueryParams(variable, operationInfo, paginationInfo); \n } else if(paginationInfo.type === 'cursor') {\n const sParam = (paginationInfo.input?.size && paginationInfo.input['size'].split('.')[0]) || \"\";\n if(sParam) {\n const sParamObj = find(operationInfo.parameters, function(obj) { return obj.name === sParam && obj.parameterType === 'path' });\n if(sParamObj) {\n sParamObj.sampleValue = options['size'] || variable.pagination['size'] || sParamObj.sampleValue;\n }\n }\n }\n }\n\n /**\n * Deduces the offset information from the size and page params\n * @param variable withholds variable information \n * @param options has info of the api's query params\n * @returns {object} Returns the next offset number\n */\n static getOffsetInfo(variable, options) {\n return variable.pagination['size'] * (options['page'] ? (options['page'] - 1) : 0);\n }\n\n /**\n * Sets Pagination data on the request information\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable \n * @param options has info of the api's query params\n * @param paginationInfo has pagination information of the variable\n * @param headers has request headers\n * @param requestBody has request body\n * @param url has request url\n * @returns {object} Returns the request object which has pagination info\n */\n static setPaginationAtReq(paginationInfo, operationInfo, variable, headers, requestBody, url, options) {\n let reqObj = {};\n let inputParam;\n let resObj = {};\n // pagination input information varies based on the type\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n inputParam = 'offset';\n } else {\n inputParam = 'page';\n }\n const paramName = paginationInfo.input[inputParam].split('.')[0]; \n // check if paramName is present in parameters of operation info \n const paramObj = find(operationInfo.parameters, function(obj) { \n if(obj.parameterType === 'body' && inputParam === 'page'){\n return obj.sampleValue.hasOwnProperty(paramName)\n }else{\n return obj.name === paramName\n }\n }); \n // set page/offset and size from pagination if matched parameter's type is header \n if (paramObj?.parameterType === 'header') {\n const inputBodyParam = VARIABLE_CONSTANTS.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY + paginationInfo.input[inputParam]; \n if (inputParam !== 'offset') { \n set(reqObj, inputBodyParam, variable.pagination['page']);\n } else {\n set(reqObj, inputBodyParam, this.getOffsetInfo(variable, options));\n }\n set(reqObj, VARIABLE_CONSTANTS.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY + paginationInfo.input.size, variable.pagination['size']);\n let headerKey = VARIABLE_CONSTANTS.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY + paramName;\n headers[headerKey] = typeof reqObj[headerKey] === 'object' ? JSON.stringify(reqObj[headerKey]) : reqObj[headerKey];\n resObj['headers'] = headers;\n } else if (paramObj?.parameterType === 'body') { \n // set page/offset and size from pagination if matched parameter's type is body \n // assign bodyVal to updated pagination info object\n let bodyVal: any;\n try {\n bodyVal = typeof paramObj.sampleValue === 'string' ? JSON.parse(paramObj.sampleValue) : paramObj.sampleValue;\n } catch (e) {\n bodyVal = paramObj.sampleValue;\n }\n const bodyParam = inputParam === 'page' ? paginationInfo.input[inputParam] : paginationInfo.input[inputParam].split('.')[1]\n if (bodyVal && bodyVal[bodyParam]) {\n let inputBodyParam = paginationInfo.input[inputParam].split('.').splice(1).join('.'); \n if (inputParam !== 'offset') { \n inputBodyParam = paginationInfo.input[inputParam]; \n set(reqObj, inputBodyParam, options.page ? options.page : 1);\n } else {\n set(reqObj, inputBodyParam, this.getOffsetInfo(variable, options));\n }\n set(reqObj, paginationInfo.input.size.split('.').splice(1).join('.'), variable.pagination['size']);\n bodyVal[bodyParam] = reqObj[bodyParam];\n requestBody = JSON.stringify(bodyVal);\n resObj['requestBody'] = requestBody;\n }\n } else if (variable.pagination.next && paramObj) {\n /**\n * For cursor type pagination, if pagination info is present in the path \n * Based on whether user clicks on the next or prev button modify the url \n */\n \n if (paramObj.parameterType === 'path') {\n const urlParams = operationInfo.relativePath.split('/'),\n paramConfig = '{' + paramObj.name + '}',\n paramIndex = urlParams.indexOf(paramConfig);\n let invokeUrl;\n if (variable.pagination.isNext) {\n invokeUrl = variable.pagination.next.split('/');\n } else {\n invokeUrl = variable.pagination.prev.split('/');\n }\n\n let urlPathParmas;\n let urlPath;\n if (operationInfo.directPath) { // For direct path, as url has hostname, derivate pathname using URL object\n urlPath = new URL(url);\n urlPathParmas = urlPath.pathname.split('/');\n urlPathParmas[paramIndex] = invokeUrl[paramIndex];\n urlPath.pathname = urlPathParmas.join('/');\n url = urlPath.href;\n resObj['url'] = url;\n } else { // Else modify the url with index as +1 (following proxy pattern)\n urlPathParmas = url.split('/');\n urlPathParmas[paramIndex + 1] = invokeUrl[paramIndex];\n url = urlPathParmas.join('/');\n resObj['url'] = url;\n }\n\n } else if (paramObj.parameterType === 'query') {\n /**\n * For cursor type pagination, if pagination info is present in the query \n * Based on whether user clicks on the next or prev button modify the url's query params\n */\n const sizeParam = paginationInfo.input['size'].split('.')[0];\n const sizeObj = find(operationInfo.parameters, function(obj) { return obj.name === sizeParam });\n const urlParams = url.split('?');\n let invokeUrl;\n if (variable.pagination.isNext) {\n invokeUrl = variable.pagination.next.split('?');\n } else if(variable.pagination.isPrev) {\n invokeUrl = variable.pagination.prev.split('?');\n }\n if(invokeUrl) {\n const queryParams = new URLSearchParams(invokeUrl[1]);\n if (sizeObj && sizeObj.sampleValue) {\n queryParams.set(sizeObj.name, sizeObj.sampleValue);\n }\n invokeUrl[1] = queryParams.toString();\n urlParams[1] = invokeUrl[1]\n url = urlParams.join('?');\n resObj['url'] = url;\n }\n }\n }\n return resObj; \n }\n\n /**\n * Sets the pagination info recieved from api's response in the res object\n * @param operationInfo has metadata of the variable\n * @param res holds the information of pagination which has to be stored on the variable\n * @param paramName has key name against which data has to be stored in pagination\n * @param variable withholds variable information \n * @returns {void} This method does not return anything\n */\n static setParameterVal(paramName, res, operationInfo, variable, options?) {\n const paginationInfo = this.getPaginationInfo(operationInfo, variable);\n const paginationParams = paginationInfo.input[paramName].split('.');\n const param = paginationParams[0]; \n const sizeObj = find(operationInfo.parameters, function(obj) { return obj.name === param });\n if(paramName === 'size' && paginationInfo && (paginationInfo.type === 'offset' || paginationInfo.type === 'page') && options?.size && sizeObj?.sampleValue) {\n sizeObj.sampleValue = options['size'] || result(sizeObj, 'sampleValue');\n }\n res[paramName] = result(sizeObj, 'sampleValue');\n // if input value is configured from object, fetch the value from the specified path\n if (paginationParams.length > 1) {\n res[paramName] = get(getValidJSON(res[paramName]), paginationInfo.input[paramName].split('.').splice(1).join('.'));\n }\n }\n\n /**\n * Creates res object from the response recieved from the api triggered\n * @param variable withholds variable information \n * @param operationInfo has metadata of the variable\n * @param paginationInfo has metadata of the variable's pagination\n * @param response has data of the api call's response\n * @param options has info of the api's query params\n * @param resHeaders has data of the api call's response headers\n * @returns {object} An object which holds the information of pagination which has to be stored on the variable\n */\n static generatePaginationRes(operationInfo, paginationInfo, response, resHeaders, options, variable) {\n let res = {};\n const resOutput = paginationInfo.output;\n // If pagination type is not cursor, create the following metadata \n if (!resOutput?.next) {\n /**\n * If size is present in the pagination's output metadata deduce size from api's response\n * Else deduce size from the pagination's input metadata size key\n */\n if (resOutput?.size) {\n this.setPaginationItems(resOutput.size, response, res, 'size', resHeaders);\n }else{ \n this.setParameterVal('size', res, operationInfo, variable, options);\n }\n \n if(!resOutput?.size && paginationInfo.input?.size && paginationInfo.type === 'page'){\n res['size'] = (Number(paginationInfo.input?.size) ? paginationInfo.input?.size : get(response, paginationInfo.input?.size)) || res['size'];\n }\n /**\n * If page is present in the pagination's output metadata deduce page from api's response\n * Else deduce page from the pagination's input metadata page key\n */\n if (resOutput?.page) {\n this.setPaginationItems(resOutput.page, response, res, 'page', resHeaders);\n } else if (paginationInfo.type !== 'offset') {\n this.setParameterVal('page', res, operationInfo, variable, options);\n }\n this.setTotalElements(resOutput,options,res,variable,response,paginationInfo,resHeaders);\n /**\n * If hasMoreItems is present in the pagination's output metadata deduce hasMoreItems from api's response\n * Else assign it as empty which will be calculated at pagination object generation\n */\n if (resOutput?.hasMoreItems) {\n this.setPaginationItems(resOutput.hasMoreItems, response, res, 'hasMoreItems', resHeaders);\n } else {\n res['hasMoreItems'] = '';\n }\n } else if (resOutput) { // For cursor type pagination set next and prev keys in res object\n this.setPaginationItems(resOutput.next, response, res, 'next', resHeaders);\n this.setPaginationItems(resOutput.prev, response, res, 'prev', resHeaders);\n this.setPaginationItems(resOutput.size, response, res, 'size', resHeaders);\n this.setParameterVal('page', res, operationInfo, variable, options);\n this.setTotalElements(resOutput,options,res,variable,response,paginationInfo,resHeaders);\n }\n return res;\n }\n /**\n * If totalElements has $minValue in it, set totalElements as $minValue\n * If the rendered elements are greater than $minValue, set totalElements as Number of elements rendered + 1\n\n * If totalElements is present in the pagination's output metadata deduce totalElements from api's response\n\n * If Pagination type is offset, deduce totalElements from size and options[page] else deduce from size and res[page]\n */\n static setTotalElements(resOutput, options, res, variable, response, paginationInfo, resHeaders) {\n if (startsWith(resOutput?.totalElements, '$minValue')) {\n const totalEl = resOutput.totalElements.replace('$minValue=', '');\n const pageParam = res['page'] ? res['page'] : options['page']\n const elRendered = res['size'] * pageParam;\n if (!variable.pagination || variable.pagination['totalElements'] > elRendered) {\n res['totalElements'] = parseInt(totalEl);\n } else {\n res['totalElements'] = elRendered + 1;\n }\n } else if (resOutput?.totalElements) {\n this.setPaginationItems(resOutput.totalElements, response, res, 'totalElements', resHeaders);\n } else {\n if (paginationInfo.type === 'offset' || paginationInfo.input.offset) {\n res['totalElements'] = (res['size'] * (options['page'] ? options['page'] : 1)) + 1;\n } else {\n res['totalElements'] = (res['size'] * res['page']) + 1;\n }\n }\n }\n}"]}
|