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.js CHANGED
@@ -904,6 +904,11 @@ function authorizeWithOAuth2Popup(opts) {
904
904
  }
905
905
 
906
906
  // src/collection.ts
907
+ var MAX_PER_PAGE = 500;
908
+ function clampBatch(batch) {
909
+ if (!Number.isFinite(batch)) return MAX_PER_PAGE;
910
+ return Math.min(Math.max(1, Math.floor(batch)), MAX_PER_PAGE);
911
+ }
907
912
  function stableStringify(value) {
908
913
  const seen = /* @__PURE__ */ new Set();
909
914
  const sort = (v) => {
@@ -1400,13 +1405,14 @@ var CollectionService = class _CollectionService {
1400
1405
  return result;
1401
1406
  }
1402
1407
  /**
1403
- * Fetch all records at once (auto-paginates). Mirrors PocketBase's
1408
+ * Fetch all records at once (auto-paginates; `batch` defaults to and is capped at 500, the server max `perPage`). Mirrors PocketBase's
1404
1409
  * `pb.collection(name).getFullList()`.
1405
1410
  *
1406
1411
  * @param options Query params (`sort`, `filter`, `batch`, etc.) + request options.
1407
1412
  */
1408
1413
  async getFullList(options) {
1409
- const { batch = 1e3, ...rest } = options ?? {};
1414
+ const { batch: requestedBatch = MAX_PER_PAGE, ...rest } = options ?? {};
1415
+ const batch = clampBatch(requestedBatch);
1410
1416
  if (typeof rest.filter === "function") {
1411
1417
  rest.filter = this.resolveFilter(rest.filter);
1412
1418
  }
@@ -2299,7 +2305,8 @@ var CollectionsService = class {
2299
2305
  */
2300
2306
  async getFullList(options) {
2301
2307
  if (!this.http) return [];
2302
- const { batch = 1e3, ...rest } = options ?? {};
2308
+ const { batch: requestedBatch = MAX_PER_PAGE, ...rest } = options ?? {};
2309
+ const batch = clampBatch(requestedBatch);
2303
2310
  const {
2304
2311
  requestKey: reqKey,
2305
2312
  singleFlight: _singleFlight,