apify-client 3.0.0-beta.86 → 3.0.0-beta.87
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/base/api_client.js +8 -8
- package/dist/bundle.js +6 -6
- package/dist/bundle.js.map +1 -1
- package/dist/resource_clients/dataset.js +5 -9
- package/dist/resource_clients/run.js +2 -2
- package/dist/utils.d.ts +6 -11
- package/dist/utils.js +0 -10
- package/package.json +1 -1
package/dist/base/api_client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { minForLimitParam,
|
|
1
|
+
import { minForLimitParam, toPath, toPathSegment } from '../utils.js';
|
|
2
2
|
/** @private */
|
|
3
3
|
export class ApiClient {
|
|
4
4
|
id;
|
|
@@ -60,14 +60,14 @@ export class ApiClient {
|
|
|
60
60
|
const { chunkSize, ...listOptions } = options;
|
|
61
61
|
const firstPageLimit = minForLimitParam(options.limit, chunkSize);
|
|
62
62
|
const paginatedListPromise = getPaginatedList({ ...listOptions, limit: firstPageLimit });
|
|
63
|
-
// A page can return more or fewer items than the rows it scanned (see `
|
|
64
|
-
// the stop condition follow the scanned rows: advancing by `items.length` would re-scan
|
|
65
|
-
// dropped some and skip rows after `unwind` multiplied them, and stopping at an empty page
|
|
66
|
-
// iteration in front of rows a filter hid. The
|
|
67
|
-
//
|
|
68
|
-
//
|
|
63
|
+
// A page of dataset items can return more or fewer items than the rows it scanned (see `PaginatedList.count`).
|
|
64
|
+
// The next offset and the stop condition follow the scanned rows: advancing by `items.length` would re-scan
|
|
65
|
+
// rows after a filter dropped some and skip rows after `unwind` multiplied them, and stopping at an empty page
|
|
66
|
+
// would end the iteration in front of rows a filter hid. The step is the larger of `count` and `items.length`,
|
|
67
|
+
// capped at the rows the request asked for, which keeps an unwound page from advancing past rows the next
|
|
68
|
+
// request would then never read.
|
|
69
69
|
const scannedRows = (page, requestedLimit) => {
|
|
70
|
-
const scanned = Math.max(page
|
|
70
|
+
const scanned = Math.max(page.count ?? 0, page.items.length);
|
|
71
71
|
return requestedLimit ? Math.min(scanned, requestedLimit) : scanned;
|
|
72
72
|
};
|
|
73
73
|
// `total` is not consulted, as it changes when the listed resource grows during the iteration.
|