zudello-integration-sdk 1.0.81 → 1.0.83
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/package.json
CHANGED
|
@@ -93,7 +93,7 @@ class UniversalModule {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
let response = await this.list({ url, method, header, qs, body });
|
|
96
|
-
let currentPageCount = response?.data?.length;
|
|
96
|
+
let currentPageCount = response?.data?.data?.length || 0;
|
|
97
97
|
|
|
98
98
|
yield response;
|
|
99
99
|
|
|
@@ -102,7 +102,7 @@ class UniversalModule {
|
|
|
102
102
|
qs.page = qs.page + 1;
|
|
103
103
|
|
|
104
104
|
response = await this.list({ url, method, header, qs, body });
|
|
105
|
-
currentPageCount = response?.data?.length;
|
|
105
|
+
currentPageCount = response?.data?.data?.length || 0;
|
|
106
106
|
|
|
107
107
|
yield response;
|
|
108
108
|
}
|
|
@@ -77,12 +77,12 @@ class UniversalModule {
|
|
|
77
77
|
/**
|
|
78
78
|
* Auto-pagination generator using cursor-based pagination (recommended).
|
|
79
79
|
* @param {string} sql Base SQL Query.
|
|
80
|
-
* @param {object} options Cursor options: { cursorField, limit, orderBy }.
|
|
80
|
+
* @param {object} options Cursor options: { cursorField, cursorFieldAlias, limit, orderBy }.
|
|
81
81
|
* @param {object} queryParams Query parameters.
|
|
82
82
|
* @returns {AsyncGenerator} Yields cursor-based responses.
|
|
83
83
|
*/
|
|
84
84
|
async *autoCursorQuery({ sql, options = {}, queryParams = {} }) {
|
|
85
|
-
const { cursorField, limit = 100, orderBy } = options;
|
|
85
|
+
const { cursorField, cursorFieldAlias, limit = 100, orderBy } = options;
|
|
86
86
|
|
|
87
87
|
let cursorValue = null;
|
|
88
88
|
let hasMoreData = true;
|
|
@@ -98,7 +98,8 @@ class UniversalModule {
|
|
|
98
98
|
|
|
99
99
|
const records = response?.data || [];
|
|
100
100
|
if (records.length > 0 && cursorField) {
|
|
101
|
-
|
|
101
|
+
const fieldToExtract = cursorFieldAlias || cursorField;
|
|
102
|
+
cursorValue = records[records.length - 1][fieldToExtract];
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
hasMoreData = records.length === limit;
|