@wavemaker/variables 11.11.0-rc.6124 → 11.11.1-rc.210
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.11.
|
|
3
|
+
"version": "11.11.1-rc.210",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@wavemaker/variables",
|
|
9
|
-
"version": "11.11.
|
|
9
|
+
"version": "11.11.1-rc.210",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@metrichor/jmespath": "^0.3.1",
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"license": "MIT"
|
|
135
135
|
},
|
|
136
136
|
"node_modules/@types/node": {
|
|
137
|
-
"version": "22.15.
|
|
138
|
-
"integrity": "sha512-
|
|
137
|
+
"version": "22.15.17",
|
|
138
|
+
"integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==",
|
|
139
139
|
"dev": true,
|
|
140
140
|
"license": "MIT",
|
|
141
141
|
"dependencies": {
|
|
@@ -438,8 +438,8 @@
|
|
|
438
438
|
}
|
|
439
439
|
},
|
|
440
440
|
"node_modules/browserslist": {
|
|
441
|
-
"version": "4.24.
|
|
442
|
-
"integrity": "sha512-
|
|
441
|
+
"version": "4.24.5",
|
|
442
|
+
"integrity": "sha512-FDToo4Wo82hIdgc1CQ+NQD0hEhmpPjrZ3hiUgwgOG6IuTdlpr8jdjyG24P6cNP1yJpTLzS5OcGgSw0xmDU1/Tw==",
|
|
443
443
|
"dev": true,
|
|
444
444
|
"funding": [
|
|
445
445
|
{
|
|
@@ -457,10 +457,10 @@
|
|
|
457
457
|
],
|
|
458
458
|
"license": "MIT",
|
|
459
459
|
"dependencies": {
|
|
460
|
-
"caniuse-lite": "^1.0.
|
|
461
|
-
"electron-to-chromium": "^1.5.
|
|
460
|
+
"caniuse-lite": "^1.0.30001716",
|
|
461
|
+
"electron-to-chromium": "^1.5.149",
|
|
462
462
|
"node-releases": "^2.0.19",
|
|
463
|
-
"update-browserslist-db": "^1.1.
|
|
463
|
+
"update-browserslist-db": "^1.1.3"
|
|
464
464
|
},
|
|
465
465
|
"bin": {
|
|
466
466
|
"browserslist": "cli.js"
|
|
@@ -476,8 +476,8 @@
|
|
|
476
476
|
"license": "MIT"
|
|
477
477
|
},
|
|
478
478
|
"node_modules/caniuse-lite": {
|
|
479
|
-
"version": "1.0.
|
|
480
|
-
"integrity": "sha512-
|
|
479
|
+
"version": "1.0.30001717",
|
|
480
|
+
"integrity": "sha512-auPpttCq6BDEG8ZAuHJIplGw6GODhjw+/11e7IjpnYCxZcW/ONgPs0KVBJ0d1bY3e2+7PRe5RCLyP+PfwVgkYw==",
|
|
481
481
|
"dev": true,
|
|
482
482
|
"funding": [
|
|
483
483
|
{
|
|
@@ -599,8 +599,8 @@
|
|
|
599
599
|
}
|
|
600
600
|
},
|
|
601
601
|
"node_modules/electron-to-chromium": {
|
|
602
|
-
"version": "1.5.
|
|
603
|
-
"integrity": "sha512-
|
|
602
|
+
"version": "1.5.151",
|
|
603
|
+
"integrity": "sha512-Rl6uugut2l9sLojjS4H4SAr3A4IgACMLgpuEMPYCVcKydzfyPrn5absNRju38IhQOf/NwjJY8OGWjlteqYeBCA==",
|
|
604
604
|
"dev": true,
|
|
605
605
|
"license": "ISC"
|
|
606
606
|
},
|
|
@@ -1776,13 +1776,14 @@
|
|
|
1776
1776
|
}
|
|
1777
1777
|
},
|
|
1778
1778
|
"node_modules/webpack": {
|
|
1779
|
-
"version": "5.99.
|
|
1780
|
-
"integrity": "sha512-
|
|
1779
|
+
"version": "5.99.8",
|
|
1780
|
+
"integrity": "sha512-lQ3CPiSTpfOnrEGeXDwoq5hIGzSjmwD72GdfVzF7CQAI7t47rJG9eDWvcEkEn3CUQymAElVvDg3YNTlCYj+qUQ==",
|
|
1781
1781
|
"dev": true,
|
|
1782
1782
|
"license": "MIT",
|
|
1783
1783
|
"dependencies": {
|
|
1784
1784
|
"@types/eslint-scope": "^3.7.7",
|
|
1785
1785
|
"@types/estree": "^1.0.6",
|
|
1786
|
+
"@types/json-schema": "^7.0.15",
|
|
1786
1787
|
"@webassemblyjs/ast": "^1.14.1",
|
|
1787
1788
|
"@webassemblyjs/wasm-edit": "^1.14.1",
|
|
1788
1789
|
"@webassemblyjs/wasm-parser": "^1.14.1",
|
|
@@ -1799,7 +1800,7 @@
|
|
|
1799
1800
|
"loader-runner": "^4.2.0",
|
|
1800
1801
|
"mime-types": "^2.1.27",
|
|
1801
1802
|
"neo-async": "^2.6.2",
|
|
1802
|
-
"schema-utils": "^4.3.
|
|
1803
|
+
"schema-utils": "^4.3.2",
|
|
1803
1804
|
"tapable": "^2.1.1",
|
|
1804
1805
|
"terser-webpack-plugin": "^5.3.11",
|
|
1805
1806
|
"watchpack": "^2.4.1",
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/variables",
|
|
3
|
-
"version": "11.11.
|
|
3
|
+
"version": "11.11.1-rc.210",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@wavemaker/variables",
|
|
9
|
-
"version": "11.11.
|
|
9
|
+
"version": "11.11.1-rc.210",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@metrichor/jmespath": "^0.3.1",
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"license": "MIT"
|
|
135
135
|
},
|
|
136
136
|
"node_modules/@types/node": {
|
|
137
|
-
"version": "22.15.
|
|
138
|
-
"integrity": "sha512-
|
|
137
|
+
"version": "22.15.17",
|
|
138
|
+
"integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==",
|
|
139
139
|
"dev": true,
|
|
140
140
|
"license": "MIT",
|
|
141
141
|
"dependencies": {
|
|
@@ -438,8 +438,8 @@
|
|
|
438
438
|
}
|
|
439
439
|
},
|
|
440
440
|
"node_modules/browserslist": {
|
|
441
|
-
"version": "4.24.
|
|
442
|
-
"integrity": "sha512-
|
|
441
|
+
"version": "4.24.5",
|
|
442
|
+
"integrity": "sha512-FDToo4Wo82hIdgc1CQ+NQD0hEhmpPjrZ3hiUgwgOG6IuTdlpr8jdjyG24P6cNP1yJpTLzS5OcGgSw0xmDU1/Tw==",
|
|
443
443
|
"dev": true,
|
|
444
444
|
"funding": [
|
|
445
445
|
{
|
|
@@ -457,10 +457,10 @@
|
|
|
457
457
|
],
|
|
458
458
|
"license": "MIT",
|
|
459
459
|
"dependencies": {
|
|
460
|
-
"caniuse-lite": "^1.0.
|
|
461
|
-
"electron-to-chromium": "^1.5.
|
|
460
|
+
"caniuse-lite": "^1.0.30001716",
|
|
461
|
+
"electron-to-chromium": "^1.5.149",
|
|
462
462
|
"node-releases": "^2.0.19",
|
|
463
|
-
"update-browserslist-db": "^1.1.
|
|
463
|
+
"update-browserslist-db": "^1.1.3"
|
|
464
464
|
},
|
|
465
465
|
"bin": {
|
|
466
466
|
"browserslist": "cli.js"
|
|
@@ -476,8 +476,8 @@
|
|
|
476
476
|
"license": "MIT"
|
|
477
477
|
},
|
|
478
478
|
"node_modules/caniuse-lite": {
|
|
479
|
-
"version": "1.0.
|
|
480
|
-
"integrity": "sha512-
|
|
479
|
+
"version": "1.0.30001717",
|
|
480
|
+
"integrity": "sha512-auPpttCq6BDEG8ZAuHJIplGw6GODhjw+/11e7IjpnYCxZcW/ONgPs0KVBJ0d1bY3e2+7PRe5RCLyP+PfwVgkYw==",
|
|
481
481
|
"dev": true,
|
|
482
482
|
"funding": [
|
|
483
483
|
{
|
|
@@ -599,8 +599,8 @@
|
|
|
599
599
|
}
|
|
600
600
|
},
|
|
601
601
|
"node_modules/electron-to-chromium": {
|
|
602
|
-
"version": "1.5.
|
|
603
|
-
"integrity": "sha512-
|
|
602
|
+
"version": "1.5.151",
|
|
603
|
+
"integrity": "sha512-Rl6uugut2l9sLojjS4H4SAr3A4IgACMLgpuEMPYCVcKydzfyPrn5absNRju38IhQOf/NwjJY8OGWjlteqYeBCA==",
|
|
604
604
|
"dev": true,
|
|
605
605
|
"license": "ISC"
|
|
606
606
|
},
|
|
@@ -1776,13 +1776,14 @@
|
|
|
1776
1776
|
}
|
|
1777
1777
|
},
|
|
1778
1778
|
"node_modules/webpack": {
|
|
1779
|
-
"version": "5.99.
|
|
1780
|
-
"integrity": "sha512-
|
|
1779
|
+
"version": "5.99.8",
|
|
1780
|
+
"integrity": "sha512-lQ3CPiSTpfOnrEGeXDwoq5hIGzSjmwD72GdfVzF7CQAI7t47rJG9eDWvcEkEn3CUQymAElVvDg3YNTlCYj+qUQ==",
|
|
1781
1781
|
"dev": true,
|
|
1782
1782
|
"license": "MIT",
|
|
1783
1783
|
"dependencies": {
|
|
1784
1784
|
"@types/eslint-scope": "^3.7.7",
|
|
1785
1785
|
"@types/estree": "^1.0.6",
|
|
1786
|
+
"@types/json-schema": "^7.0.15",
|
|
1786
1787
|
"@webassemblyjs/ast": "^1.14.1",
|
|
1787
1788
|
"@webassemblyjs/wasm-edit": "^1.14.1",
|
|
1788
1789
|
"@webassemblyjs/wasm-parser": "^1.14.1",
|
|
@@ -1799,7 +1800,7 @@
|
|
|
1799
1800
|
"loader-runner": "^4.2.0",
|
|
1800
1801
|
"mime-types": "^2.1.27",
|
|
1801
1802
|
"neo-async": "^2.6.2",
|
|
1802
|
-
"schema-utils": "^4.3.
|
|
1803
|
+
"schema-utils": "^4.3.2",
|
|
1803
1804
|
"tapable": "^2.1.1",
|
|
1804
1805
|
"terser-webpack-plugin": "^5.3.11",
|
|
1805
1806
|
"watchpack": "^2.4.1",
|
package/package.json
CHANGED
|
@@ -224,7 +224,14 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
224
224
|
}
|
|
225
225
|
var paramName = paginationInfo.input[inputParam].split('.')[0];
|
|
226
226
|
// check if paramName is present in parameters of operation info
|
|
227
|
-
var paramObj = find(operationInfo.parameters, function (obj) {
|
|
227
|
+
var paramObj = find(operationInfo.parameters, function (obj) {
|
|
228
|
+
if (obj.parameterType === 'body' && inputParam === 'page') {
|
|
229
|
+
return obj.sampleValue.hasOwnProperty(paramName);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
return obj.name === paramName;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
228
235
|
// set page/offset and size from pagination if matched parameter's type is header
|
|
229
236
|
if ((paramObj === null || paramObj === void 0 ? void 0 : paramObj.parameterType) === 'header') {
|
|
230
237
|
var inputBodyParam = VARIABLE_CONSTANTS.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY + paginationInfo.input[inputParam];
|
|
@@ -242,12 +249,19 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
242
249
|
else if ((paramObj === null || paramObj === void 0 ? void 0 : paramObj.parameterType) === 'body') {
|
|
243
250
|
// set page/offset and size from pagination if matched parameter's type is body
|
|
244
251
|
// assign bodyVal to updated pagination info object
|
|
245
|
-
var bodyVal =
|
|
246
|
-
|
|
252
|
+
var bodyVal = void 0;
|
|
253
|
+
try {
|
|
254
|
+
bodyVal = typeof paramObj.sampleValue === 'string' ? JSON.parse(paramObj.sampleValue) : paramObj.sampleValue;
|
|
255
|
+
}
|
|
256
|
+
catch (e) {
|
|
257
|
+
bodyVal = paramObj.sampleValue;
|
|
258
|
+
}
|
|
259
|
+
var bodyParam = inputParam === 'page' ? paginationInfo.input[inputParam] : paginationInfo.input[inputParam].split('.')[1];
|
|
247
260
|
if (bodyVal && bodyVal[bodyParam]) {
|
|
248
261
|
var inputBodyParam = paginationInfo.input[inputParam].split('.').splice(1).join('.');
|
|
249
262
|
if (inputParam !== 'offset') {
|
|
250
|
-
|
|
263
|
+
inputBodyParam = paginationInfo.input[inputParam];
|
|
264
|
+
set(reqObj, inputBodyParam, options.page ? options.page : 1);
|
|
251
265
|
}
|
|
252
266
|
else {
|
|
253
267
|
set(reqObj, inputBodyParam, this.getOffsetInfo(variable, options));
|
|
@@ -339,6 +353,7 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
339
353
|
* @returns {object} An object which holds the information of pagination which has to be stored on the variable
|
|
340
354
|
*/
|
|
341
355
|
PaginationUtils.generatePaginationRes = function (operationInfo, paginationInfo, response, resHeaders, options, variable) {
|
|
356
|
+
var _a, _b;
|
|
342
357
|
var res = {};
|
|
343
358
|
var resOutput = paginationInfo.output;
|
|
344
359
|
// If pagination type is not cursor, create the following metadata
|
|
@@ -350,6 +365,9 @@ var PaginationUtils = /** @class */ (function () {
|
|
|
350
365
|
if (resOutput === null || resOutput === void 0 ? void 0 : resOutput.size) {
|
|
351
366
|
this.setPaginationItems(resOutput.size, response, res, 'size', resHeaders);
|
|
352
367
|
}
|
|
368
|
+
else if (((_a = paginationInfo.input) === null || _a === void 0 ? void 0 : _a.size) && paginationInfo.type === 'page') {
|
|
369
|
+
res['size'] = (_b = paginationInfo.input) === null || _b === void 0 ? void 0 : _b.size;
|
|
370
|
+
}
|
|
353
371
|
else {
|
|
354
372
|
this.setParameterVal('size', res, operationInfo, variable);
|
|
355
373
|
}
|
|
@@ -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;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vYD,IAuYC","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) { return obj.name === paramName }); \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 const bodyVal = JSON.parse(paramObj.sampleValue);\n const bodyParam = paginationInfo.input[inputParam].split('.')[1]\n if (bodyVal && bodyVal[bodyParam]) {\n const inputBodyParam = paginationInfo.input[inputParam].split('.').splice(1).join('.'); \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, 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 { \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;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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YAC/F,CAAC;iBAAM,CAAC;gBACJ,GAAG,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;YAC7B,CAAC;QACL,CAAC;aAAM,IAAI,SAAS,EAAE,CAAC,CAAC,kEAAkE;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'] = 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}"]}
|