@boostercloud/framework-provider-azure 3.4.3 → 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.
@@ -36,6 +36,14 @@ 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('PAGINATION DEBUG - Initial analysis:', {
40
+ isDistinctQuery,
41
+ canUseContinuationToken,
42
+ hasLegacyCursor,
43
+ afterCursor,
44
+ limit,
45
+ finalQuery,
46
+ });
39
47
  // Use Cosmos DB's continuation token pagination
40
48
  const feedOptions = {};
41
49
  if (limit) {
@@ -44,6 +52,10 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
44
52
  // Extract continuation token from the cursor (backward compatibility)
45
53
  if (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.continuationToken) {
46
54
  feedOptions.continuationToken = afterCursor.continuationToken;
55
+ logger.debug('PAGINATION DEBUG - Using provided continuation token:', {
56
+ continuationToken: afterCursor.continuationToken,
57
+ feedOptions,
58
+ });
47
59
  }
48
60
  else if (!canUseContinuationToken || hasLegacyCursor) {
49
61
  // Legacy cursor format - fallback to OFFSET for backward compatibility
@@ -53,8 +65,19 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
53
65
  legacyQuery += ` LIMIT ${limit} `;
54
66
  }
55
67
  const legacyQuerySpec = { ...querySpec, query: legacyQuery };
68
+ logger.debug('PAGINATION DEBUG - Using LEGACY OFFSET/LIMIT approach:', {
69
+ reason: !canUseContinuationToken ? 'DISTINCT query detected' : 'Legacy numeric cursor detected',
70
+ offset,
71
+ legacyQuery,
72
+ legacyQuerySpec,
73
+ });
56
74
  const { resources } = await container.items.query(legacyQuerySpec).fetchAll();
57
75
  const processedResources = processResources(resources);
76
+ logger.debug('PAGINATION DEBUG - Legacy query results:', {
77
+ resourcesCount: (resources === null || resources === void 0 ? void 0 : resources.length) || 0,
78
+ processedResourcesCount: processedResources.length,
79
+ nextCursor: { id: (offset + processedResources.length).toString() },
80
+ });
58
81
  return {
59
82
  items: processedResources !== null && processedResources !== void 0 ? processedResources : [],
60
83
  count: processedResources.length,
@@ -63,17 +86,35 @@ async function search(cosmosDb, config, containerName, filters, limit, afterCurs
63
86
  },
64
87
  };
65
88
  }
89
+ logger.debug('PAGINATION DEBUG - About to execute continuation token query with feedOptions:', feedOptions);
66
90
  const queryIterator = container.items.query(querySpec, feedOptions);
67
91
  const { resources, continuationToken } = await queryIterator.fetchNext();
92
+ logger.debug('PAGINATION DEBUG - Cosmos SDK response:', {
93
+ resourcesCount: (resources === null || resources === void 0 ? void 0 : resources.length) || 0,
94
+ continuationTokenReceived: !!continuationToken,
95
+ continuationTokenValue: continuationToken,
96
+ continuationTokenType: typeof continuationToken,
97
+ continuationTokenLength: continuationToken === null || continuationToken === void 0 ? void 0 : continuationToken.length,
98
+ });
68
99
  const finalResources = processResources(resources || []);
69
100
  let cursor;
70
101
  if (continuationToken) {
71
102
  cursor = { continuationToken };
103
+ logger.debug('PAGINATION DEBUG - Setting cursor with continuation token:', cursor);
72
104
  }
73
105
  else if (finalResources.length > 0) {
74
106
  const currentOffset = (afterCursor === null || afterCursor === void 0 ? void 0 : afterCursor.id) && !isNaN(parseInt(afterCursor.id)) ? parseInt(afterCursor.id) : 0;
75
- cursor = { id: (currentOffset + finalResources.length).toString() }; // Use the length of the results to calculate the next id
107
+ cursor = { id: (currentOffset + finalResources.length).toString() };
108
+ logger.debug('PAGINATION DEBUG - No continuation token, setting fallback cursor:', cursor);
76
109
  }
110
+ else {
111
+ logger.debug('PAGINATION DEBUG - No continuation token and no resources, no cursor set');
112
+ }
113
+ logger.debug('PAGINATION DEBUG - Final response:', {
114
+ itemsCount: finalResources.length,
115
+ cursor,
116
+ hasMoreResults: !!continuationToken,
117
+ });
77
118
  return {
78
119
  items: finalResources,
79
120
  count: finalResources.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boostercloud/framework-provider-azure",
3
- "version": "3.4.3",
3
+ "version": "3.4.4-debug.2",
4
4
  "description": "Handle Booster's integration with Azure",
5
5
  "keywords": [
6
6
  "framework-provider-azure"
@@ -27,14 +27,14 @@
27
27
  "@azure/functions": "^1.2.2",
28
28
  "@azure/identity": "~4.7.0",
29
29
  "@azure/event-hubs": "5.11.1",
30
- "@boostercloud/framework-common-helpers": "^3.4.3",
31
- "@boostercloud/framework-types": "^3.4.3",
30
+ "@boostercloud/framework-common-helpers": "workspace:^3.4.3",
31
+ "@boostercloud/framework-types": "workspace:^3.4.3",
32
32
  "tslib": "^2.4.0",
33
33
  "@effect-ts/core": "^0.60.4",
34
34
  "@azure/web-pubsub": "~1.1.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@boostercloud/eslint-config": "^3.4.3",
37
+ "@boostercloud/eslint-config": "workspace:^3.4.3",
38
38
  "@types/chai": "4.2.18",
39
39
  "@types/chai-as-promised": "7.1.4",
40
40
  "@types/faker": "5.1.5",
@@ -61,16 +61,27 @@
61
61
  "typescript": "5.7.3",
62
62
  "eslint-plugin-unicorn": "~44.0.2"
63
63
  },
64
- "bugs": {
65
- "url": "https://github.com/boostercloud/booster/issues"
66
- },
67
64
  "scripts": {
68
65
  "format": "prettier --write --ext '.js,.ts' **/*.ts **/*/*.ts",
69
66
  "lint:check": "eslint --ext '.js,.ts' **/*.ts",
70
67
  "lint:fix": "eslint --quiet --fix --ext '.js,.ts' **/*.ts",
71
68
  "build": "tsc -b tsconfig.json",
72
69
  "clean": "rimraf ./dist tsconfig.tsbuildinfo",
70
+ "prepack": "tsc -b tsconfig.json",
73
71
  "test:provider-azure": "npm run test",
74
72
  "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\""
73
+ },
74
+ "bugs": {
75
+ "url": "https://github.com/boostercloud/booster/issues"
76
+ },
77
+ "pnpm": {
78
+ "overrides": {
79
+ "pac-resolver@<5.0.0": ">=5.0.0",
80
+ "underscore@>=1.3.2 <1.12.1": ">=1.13.6",
81
+ "node-fetch@<2.6.7": ">=2.6.7",
82
+ "ws@>=7.0.0 <7.4.6": ">=7.4.6",
83
+ "nanoid@>=3.0.0 <3.1.31": ">=3.1.31",
84
+ "node-fetch@<2.6.1": ">=2.6.1"
85
+ }
75
86
  }
76
- }
87
+ }