@boostercloud/framework-provider-azure 3.4.3-debug.4 → 3.4.3-debug.5
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 +10 -8
- package/package.json +1 -1
|
@@ -46,9 +46,6 @@ 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
|
-
if (limit) {
|
|
50
|
-
feedOptions.maxItemCount = limit;
|
|
51
|
-
}
|
|
52
49
|
// Track cumulative offset for cursor.id calculation
|
|
53
50
|
let cumulativeOffset = 0;
|
|
54
51
|
// Extract continuation token from the cursor (backward compatibility)
|
|
@@ -62,17 +59,22 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
62
59
|
feedOptions,
|
|
63
60
|
});
|
|
64
61
|
}
|
|
65
|
-
|
|
62
|
+
// Azure Cosmos DB requires maxItemCount when using continuation tokens
|
|
63
|
+
// Always set maxItemCount when limit is provided or when using continuation token
|
|
64
|
+
if (limit || (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.continuationToken)) {
|
|
65
|
+
feedOptions.maxItemCount = limit !== null && limit !== void 0 ? limit : 100;
|
|
66
|
+
}
|
|
67
|
+
if (!(afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.continuationToken) && (!canUseContinuationToken || hasLegacyCursor)) {
|
|
66
68
|
// Legacy cursor format - fallback to OFFSET for backward compatibility
|
|
67
69
|
const offset = (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.id) ? parseInt(afterCursor.id) : 0;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
70
|
+
// Azure Cosmos DB requires LIMIT when using OFFSET
|
|
71
|
+
const effectiveLimit = limit !== null && limit !== void 0 ? limit : 100;
|
|
72
|
+
const legacyQuery = `${finalQuery} OFFSET ${offset} LIMIT ${effectiveLimit} `;
|
|
72
73
|
const legacyQuerySpec = { ...querySpec, query: legacyQuery };
|
|
73
74
|
logger.debug('PAGINATION DEBUG - Using LEGACY OFFSET/LIMIT approach:', {
|
|
74
75
|
reason: !canUseContinuationToken ? 'DISTINCT query detected' : 'Legacy numeric cursor detected',
|
|
75
76
|
offset,
|
|
77
|
+
effectiveLimit,
|
|
76
78
|
legacyQuery,
|
|
77
79
|
legacyQuerySpec,
|
|
78
80
|
});
|