lazypock 0.19.1 → 0.19.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/index.cjs CHANGED
@@ -943,6 +943,11 @@ function authorizeWithOAuth2Popup(opts) {
943
943
  }
944
944
 
945
945
  // src/collection.ts
946
+ var MAX_PER_PAGE = 500;
947
+ function clampBatch(batch) {
948
+ if (!Number.isFinite(batch)) return MAX_PER_PAGE;
949
+ return Math.min(Math.max(1, Math.floor(batch)), MAX_PER_PAGE);
950
+ }
946
951
  function stableStringify(value) {
947
952
  const seen = /* @__PURE__ */ new Set();
948
953
  const sort = (v) => {
@@ -1439,13 +1444,14 @@ var CollectionService = class _CollectionService {
1439
1444
  return result;
1440
1445
  }
1441
1446
  /**
1442
- * Fetch all records at once (auto-paginates). Mirrors PocketBase's
1447
+ * Fetch all records at once (auto-paginates; `batch` defaults to and is capped at 500, the server max `perPage`). Mirrors PocketBase's
1443
1448
  * `pb.collection(name).getFullList()`.
1444
1449
  *
1445
1450
  * @param options Query params (`sort`, `filter`, `batch`, etc.) + request options.
1446
1451
  */
1447
1452
  async getFullList(options) {
1448
- const { batch = 1e3, ...rest } = options ?? {};
1453
+ const { batch: requestedBatch = MAX_PER_PAGE, ...rest } = options ?? {};
1454
+ const batch = clampBatch(requestedBatch);
1449
1455
  if (typeof rest.filter === "function") {
1450
1456
  rest.filter = this.resolveFilter(rest.filter);
1451
1457
  }
@@ -2338,7 +2344,8 @@ var CollectionsService = class {
2338
2344
  */
2339
2345
  async getFullList(options) {
2340
2346
  if (!this.http) return [];
2341
- const { batch = 1e3, ...rest } = options ?? {};
2347
+ const { batch: requestedBatch = MAX_PER_PAGE, ...rest } = options ?? {};
2348
+ const batch = clampBatch(requestedBatch);
2342
2349
  const {
2343
2350
  requestKey: reqKey,
2344
2351
  singleFlight: _singleFlight,