zudello-integration-sdk 1.0.81 → 1.0.82
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
|
@@ -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;
|