@boostercloud/framework-provider-azure 3.4.3-debug.5 → 3.4.3-debug.6

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.
@@ -46,16 +46,11 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
46
46
  });
47
47
  // Use Cosmos DB's continuation token pagination
48
48
  const feedOptions = {};
49
- // Track cumulative offset for cursor.id calculation
50
- let cumulativeOffset = 0;
51
49
  // Extract continuation token from the cursor (backward compatibility)
52
50
  if (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.continuationToken) {
53
51
  feedOptions.continuationToken = afterCursor.continuationToken;
54
- // Extract cumulative id from cursor for tracking position across pages
55
- cumulativeOffset = afterCursor.id && !isNaN(parseInt(afterCursor.id)) ? parseInt(afterCursor.id) : 0;
56
52
  logger.debug('PAGINATION DEBUG - Using provided continuation token:', {
57
53
  continuationToken: afterCursor.continuationToken,
58
- cumulativeOffset,
59
54
  feedOptions,
60
55
  });
61
56
  }
@@ -104,25 +99,25 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
104
99
  continuationTokenLength: continuationToken === null || continuationToken === void 0 ? void 0 : continuationToken.length,
105
100
  });
106
101
  const finalResources = processResources(resources || []);
102
+ // cursor.id advances by the page size (limit) to maintain consistent page-based offsets
103
+ // that frontends rely on (e.g., limit=5 produces cursors 5, 10, 15, ...)
104
+ const previousOffset = (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.id) ? parseInt(afterCursor.id) : 0;
105
+ const effectiveLimit = limit !== null && limit !== void 0 ? limit : 100;
107
106
  let cursor;
108
107
  if (continuationToken) {
109
- // Store both continuation token AND cumulative id for proper position tracking
110
- const newCumulativeId = cumulativeOffset + finalResources.length;
111
- cursor = { continuationToken, id: newCumulativeId.toString() };
108
+ cursor = { continuationToken, id: (previousOffset + effectiveLimit).toString() };
112
109
  logger.debug('PAGINATION DEBUG - Setting cursor with continuation token:', {
113
110
  cursor,
114
- previousOffset: cumulativeOffset,
115
- currentPageSize: finalResources.length,
116
- newCumulativeId,
111
+ previousOffset,
112
+ effectiveLimit,
117
113
  });
118
114
  }
119
115
  else if (finalResources.length > 0) {
120
- // Last page - use cumulative offset for final cursor position
121
- cursor = { id: (cumulativeOffset + finalResources.length).toString() };
116
+ cursor = { id: (previousOffset + effectiveLimit).toString() };
122
117
  logger.debug('PAGINATION DEBUG - No continuation token, setting fallback cursor:', {
123
118
  cursor,
124
- previousOffset: cumulativeOffset,
125
- currentPageSize: finalResources.length,
119
+ previousOffset,
120
+ effectiveLimit,
126
121
  });
127
122
  }
128
123
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boostercloud/framework-provider-azure",
3
- "version": "3.4.3-debug.5",
3
+ "version": "3.4.3-debug.6",
4
4
  "description": "Handle Booster's integration with Azure",
5
5
  "keywords": [
6
6
  "framework-provider-azure"