@adobe/spacecat-shared-data-access 2.62.2 → 2.64.0
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v2.64.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.63.0...@adobe/spacecat-shared-data-access-v2.64.0) (2025-09-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* adding new prerender audit type ([#959](https://github.com/adobe/spacecat-shared/issues/959)) ([7bebd89](https://github.com/adobe/spacecat-shared/commit/7bebd8992fa997f8dcb8db4c736b49d705fef905))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v2.63.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.62.2...@adobe/spacecat-shared-data-access-v2.63.0) (2025-09-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* System-Wide Pagination Fix for DynamoDB Data Truncation ([#964](https://github.com/adobe/spacecat-shared/issues/964)) ([8f82e5f](https://github.com/adobe/spacecat-shared/commit/8f82e5fe2d5ed9ecd8ad2ff4e139b0588b3d8c01))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v2.62.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.62.1...@adobe/spacecat-shared-data-access-v2.62.2) (2025-09-16)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -59,6 +59,7 @@ class Audit extends BaseModel {
|
|
|
59
59
|
PAID_TRAFFIC_ANALYSIS_WEEKLY: 'paid-traffic-analysis-weekly',
|
|
60
60
|
PAID_TRAFFIC_ANALYSIS_MONTHLY: 'paid-traffic-analysis-monthly',
|
|
61
61
|
READABILITY: 'readability',
|
|
62
|
+
PRERENDER: 'prerender',
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
static AUDIT_TYPE_PROPERTIES = {
|
|
@@ -252,15 +252,34 @@ class BaseCollection {
|
|
|
252
252
|
let result = await query.go(queryOptions);
|
|
253
253
|
let allData = result.data;
|
|
254
254
|
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
|
|
255
|
+
// Smart pagination behavior:
|
|
256
|
+
// - fetchAllPages: true → Always paginate through all results
|
|
257
|
+
// - fetchAllPages: false → Only fetch first page
|
|
258
|
+
// - undefined → Auto-paginate when no limit specified, respect limits otherwise
|
|
259
|
+
const shouldFetchAllPages = options.fetchAllPages === true
|
|
260
|
+
|| (options.fetchAllPages !== false && !options.limit);
|
|
261
|
+
|
|
262
|
+
if (shouldFetchAllPages) {
|
|
263
|
+
let pageCount = 1;
|
|
264
|
+
const startTime = Date.now();
|
|
265
|
+
|
|
258
266
|
while (result.cursor) {
|
|
267
|
+
pageCount += 1;
|
|
259
268
|
queryOptions.cursor = result.cursor;
|
|
260
269
|
// eslint-disable-next-line no-await-in-loop
|
|
261
270
|
result = await query.go(queryOptions);
|
|
262
271
|
allData = allData.concat(result.data);
|
|
263
272
|
}
|
|
273
|
+
|
|
274
|
+
// Debug logging to track pagination behavior
|
|
275
|
+
if (pageCount > 1) {
|
|
276
|
+
this.log.debug(`Pagination completed for ${this.entityName}`, {
|
|
277
|
+
entityName: this.entityName,
|
|
278
|
+
totalPages: pageCount,
|
|
279
|
+
totalRecords: allData.length,
|
|
280
|
+
queryDuration: Date.now() - startTime,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
264
283
|
}
|
|
265
284
|
|
|
266
285
|
if (options.limit === 1) {
|
|
@@ -34,6 +34,13 @@ export interface QueryOptions {
|
|
|
34
34
|
limit?: number;
|
|
35
35
|
order?: string;
|
|
36
36
|
attributes?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Whether to automatically fetch all pages of results.
|
|
39
|
+
* - `true`: Always paginate through all results
|
|
40
|
+
* - `false`: Only fetch first page
|
|
41
|
+
* - `undefined`: Auto-paginate when no limit specified, respect limits otherwise
|
|
42
|
+
*/
|
|
43
|
+
fetchAllPages?: boolean;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
export interface BaseCollection<T extends BaseModel> {
|
|
@@ -130,10 +130,16 @@ export function createAccessor(config) { /* eslint-disable no-underscore-dangle
|
|
|
130
130
|
} else {
|
|
131
131
|
const { keys, options } = parseAccessorArgs(collection, requiredKeys, args);
|
|
132
132
|
const allKeys = { ...foreignKeys, ...keys };
|
|
133
|
+
const finalOptions = all
|
|
134
|
+
? {
|
|
135
|
+
...options,
|
|
136
|
+
fetchAllPages: options?.fetchAllPages ?? !options?.limit,
|
|
137
|
+
}
|
|
138
|
+
: options;
|
|
133
139
|
|
|
134
140
|
result = all
|
|
135
|
-
? collection.allByIndexKeys(allKeys,
|
|
136
|
-
: collection.findByIndexKeys(allKeys,
|
|
141
|
+
? collection.allByIndexKeys(allKeys, finalOptions)
|
|
142
|
+
: collection.findByIndexKeys(allKeys, finalOptions);
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
result = await result;
|