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 +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.global.js +10 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/collection.ts +16 -2
- package/src/collections.ts +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1111,7 +1111,7 @@ declare class CollectionService<T = ApiRecord, TData = never, TFields = T, TExpa
|
|
|
1111
1111
|
expand?: ExpandObj<E, TExpand>;
|
|
1112
1112
|
}> | null>;
|
|
1113
1113
|
/**
|
|
1114
|
-
* Fetch all records at once (auto-paginates). Mirrors PocketBase's
|
|
1114
|
+
* Fetch all records at once (auto-paginates; `batch` defaults to and is capped at 500, the server max `perPage`). Mirrors PocketBase's
|
|
1115
1115
|
* `pb.collection(name).getFullList()`.
|
|
1116
1116
|
*
|
|
1117
1117
|
* @param options Query params (`sort`, `filter`, `batch`, etc.) + request options.
|
package/dist/index.d.ts
CHANGED
|
@@ -1111,7 +1111,7 @@ declare class CollectionService<T = ApiRecord, TData = never, TFields = T, TExpa
|
|
|
1111
1111
|
expand?: ExpandObj<E, TExpand>;
|
|
1112
1112
|
}> | null>;
|
|
1113
1113
|
/**
|
|
1114
|
-
* Fetch all records at once (auto-paginates). Mirrors PocketBase's
|
|
1114
|
+
* Fetch all records at once (auto-paginates; `batch` defaults to and is capped at 500, the server max `perPage`). Mirrors PocketBase's
|
|
1115
1115
|
* `pb.collection(name).getFullList()`.
|
|
1116
1116
|
*
|
|
1117
1117
|
* @param options Query params (`sort`, `filter`, `batch`, etc.) + request options.
|
package/dist/index.global.js
CHANGED
|
@@ -943,6 +943,11 @@ var Lazypock = (() => {
|
|
|
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 Lazypock = (() => {
|
|
|
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 =
|
|
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 Lazypock = (() => {
|
|
|
2338
2344
|
*/
|
|
2339
2345
|
async getFullList(options) {
|
|
2340
2346
|
if (!this.http) return [];
|
|
2341
|
-
const { batch =
|
|
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,
|