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.
@@ -1,4 +1,4 @@
1
- import { minForLimitParam, SCANNED_COUNT, toPath, toPathSegment } from '../utils.js';
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 `SCANNED_COUNT`). The next offset and
64
- // the stop condition follow the scanned rows: advancing by `items.length` would re-scan rows after a filter
65
- // dropped some and skip rows after `unwind` multiplied them, and stopping at an empty page would end the
66
- // iteration in front of rows a filter hid. The scanned number is derived from a dataset's item count, which
67
- // lags a fresh push, so the larger of it and `items.length` is taken, capped at the rows the request asked for
68
- // so that an unwound page does not advance past rows the next request would then never read.
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[SCANNED_COUNT] ?? 0, page.items.length);
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.