@boostercloud/framework-provider-azure 3.4.4-debug.1 → 3.4.4-debug.2
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 -10
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
36
36
|
// - Legacy cursors: Numeric cursor.id values must use OFFSET/LIMIT for backward compatibility
|
|
37
37
|
const canUseContinuationToken = !isDistinctQuery;
|
|
38
38
|
const hasLegacyCursor = typeof (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.id) === 'string' && /^\d+$/.test(afterCursor.id);
|
|
39
|
-
logger.debug('
|
|
39
|
+
logger.debug('PAGINATION DEBUG - Initial analysis:', {
|
|
40
40
|
isDistinctQuery,
|
|
41
41
|
canUseContinuationToken,
|
|
42
42
|
hasLegacyCursor,
|
|
@@ -52,7 +52,7 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
52
52
|
// Extract continuation token from the cursor (backward compatibility)
|
|
53
53
|
if (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.continuationToken) {
|
|
54
54
|
feedOptions.continuationToken = afterCursor.continuationToken;
|
|
55
|
-
logger.debug('
|
|
55
|
+
logger.debug('PAGINATION DEBUG - Using provided continuation token:', {
|
|
56
56
|
continuationToken: afterCursor.continuationToken,
|
|
57
57
|
feedOptions,
|
|
58
58
|
});
|
|
@@ -65,7 +65,7 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
65
65
|
legacyQuery += ` LIMIT ${limit} `;
|
|
66
66
|
}
|
|
67
67
|
const legacyQuerySpec = { ...querySpec, query: legacyQuery };
|
|
68
|
-
logger.debug('
|
|
68
|
+
logger.debug('PAGINATION DEBUG - Using LEGACY OFFSET/LIMIT approach:', {
|
|
69
69
|
reason: !canUseContinuationToken ? 'DISTINCT query detected' : 'Legacy numeric cursor detected',
|
|
70
70
|
offset,
|
|
71
71
|
legacyQuery,
|
|
@@ -73,7 +73,7 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
73
73
|
});
|
|
74
74
|
const { resources } = await container.items.query(legacyQuerySpec).fetchAll();
|
|
75
75
|
const processedResources = processResources(resources);
|
|
76
|
-
logger.debug('
|
|
76
|
+
logger.debug('PAGINATION DEBUG - Legacy query results:', {
|
|
77
77
|
resourcesCount: (resources === null || resources === void 0 ? void 0 : resources.length) || 0,
|
|
78
78
|
processedResourcesCount: processedResources.length,
|
|
79
79
|
nextCursor: { id: (offset + processedResources.length).toString() },
|
|
@@ -86,10 +86,10 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
86
86
|
},
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
logger.debug('
|
|
89
|
+
logger.debug('PAGINATION DEBUG - About to execute continuation token query with feedOptions:', feedOptions);
|
|
90
90
|
const queryIterator = container.items.query(querySpec, feedOptions);
|
|
91
91
|
const { resources, continuationToken } = await queryIterator.fetchNext();
|
|
92
|
-
logger.debug('
|
|
92
|
+
logger.debug('PAGINATION DEBUG - Cosmos SDK response:', {
|
|
93
93
|
resourcesCount: (resources === null || resources === void 0 ? void 0 : resources.length) || 0,
|
|
94
94
|
continuationTokenReceived: !!continuationToken,
|
|
95
95
|
continuationTokenValue: continuationToken,
|
|
@@ -100,17 +100,17 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
|
|
|
100
100
|
let cursor;
|
|
101
101
|
if (continuationToken) {
|
|
102
102
|
cursor = { continuationToken };
|
|
103
|
-
logger.debug('
|
|
103
|
+
logger.debug('PAGINATION DEBUG - Setting cursor with continuation token:', cursor);
|
|
104
104
|
}
|
|
105
105
|
else if (finalResources.length > 0) {
|
|
106
106
|
const currentOffset = (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.id) && !isNaN(parseInt(afterCursor.id)) ? parseInt(afterCursor.id) : 0;
|
|
107
107
|
cursor = { id: (currentOffset + finalResources.length).toString() };
|
|
108
|
-
logger.debug('
|
|
108
|
+
logger.debug('PAGINATION DEBUG - No continuation token, setting fallback cursor:', cursor);
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
-
logger.debug('
|
|
111
|
+
logger.debug('PAGINATION DEBUG - No continuation token and no resources, no cursor set');
|
|
112
112
|
}
|
|
113
|
-
logger.debug('
|
|
113
|
+
logger.debug('PAGINATION DEBUG - Final response:', {
|
|
114
114
|
itemsCount: finalResources.length,
|
|
115
115
|
cursor,
|
|
116
116
|
hasMoreResults: !!continuationToken,
|