@boostercloud/framework-provider-azure 3.4.3-debug.3 → 3.4.3-debug.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/query-helper.js +21 -5
- package/package.json +1 -1
|
@@ -49,11 +49,16 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
49
49
|
if (limit) {
|
|
50
50
|
feedOptions.maxItemCount = limit;
|
|
51
51
|
}
|
|
52
|
+
// Track cumulative offset for cursor.id calculation
|
|
53
|
+
let cumulativeOffset = 0;
|
|
52
54
|
// Extract continuation token from the cursor (backward compatibility)
|
|
53
55
|
if (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.continuationToken) {
|
|
54
56
|
feedOptions.continuationToken = afterCursor.continuationToken;
|
|
57
|
+
// Extract cumulative id from cursor for tracking position across pages
|
|
58
|
+
cumulativeOffset = afterCursor.id && !isNaN(parseInt(afterCursor.id)) ? parseInt(afterCursor.id) : 0;
|
|
55
59
|
logger.debug('PAGINATION DEBUG - Using provided continuation token:', {
|
|
56
60
|
continuationToken: afterCursor.continuationToken,
|
|
61
|
+
cumulativeOffset,
|
|
57
62
|
feedOptions,
|
|
58
63
|
});
|
|
59
64
|
}
|
|
@@ -99,13 +104,24 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
99
104
|
const finalResources = processResources(resources || []);
|
|
100
105
|
let cursor;
|
|
101
106
|
if (continuationToken) {
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
// Store both continuation token AND cumulative id for proper position tracking
|
|
108
|
+
const newCumulativeId = cumulativeOffset + finalResources.length;
|
|
109
|
+
cursor = { continuationToken, id: newCumulativeId.toString() };
|
|
110
|
+
logger.debug('PAGINATION DEBUG - Setting cursor with continuation token:', {
|
|
111
|
+
cursor,
|
|
112
|
+
previousOffset: cumulativeOffset,
|
|
113
|
+
currentPageSize: finalResources.length,
|
|
114
|
+
newCumulativeId,
|
|
115
|
+
});
|
|
104
116
|
}
|
|
105
117
|
else if (finalResources.length > 0) {
|
|
106
|
-
|
|
107
|
-
cursor = { id: (
|
|
108
|
-
logger.debug('PAGINATION DEBUG - No continuation token, setting fallback cursor:',
|
|
118
|
+
// Last page - use cumulative offset for final cursor position
|
|
119
|
+
cursor = { id: (cumulativeOffset + finalResources.length).toString() };
|
|
120
|
+
logger.debug('PAGINATION DEBUG - No continuation token, setting fallback cursor:', {
|
|
121
|
+
cursor,
|
|
122
|
+
previousOffset: cumulativeOffset,
|
|
123
|
+
currentPageSize: finalResources.length,
|
|
124
|
+
});
|
|
109
125
|
}
|
|
110
126
|
else {
|
|
111
127
|
logger.debug('PAGINATION DEBUG - No continuation token and no resources, no cursor set');
|