@baasix/sdk 0.1.17 → 0.1.18

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
@@ -1223,6 +1223,25 @@ var QueryBuilder = class {
1223
1223
  }
1224
1224
  return this;
1225
1225
  }
1226
+ /**
1227
+ * Control whether the total record count is computed for this query.
1228
+ *
1229
+ * Pass `false` to skip the COUNT query (the response `totalCount` will be
1230
+ * `null`) — useful for read-heavy or infinite-scroll lists where the total
1231
+ * isn't needed. Pass `true` to force the count even when the deployment
1232
+ * default (env `COUNT_BY_DEFAULT`) is off. When omitted, the server default
1233
+ * applies.
1234
+ *
1235
+ * @example
1236
+ * ```typescript
1237
+ * // Skip the count for a faster list query
1238
+ * const { data } = await items.filter({ status: { eq: 'active' } }).withCount(false).get();
1239
+ * ```
1240
+ */
1241
+ withCount(enabled = true) {
1242
+ this.queryParams.count = enabled;
1243
+ return this;
1244
+ }
1226
1245
  /**
1227
1246
  * Include soft-deleted items
1228
1247
  *
@@ -1348,6 +1367,9 @@ var QueryBuilder = class {
1348
1367
  if (this.queryParams.groupBy) {
1349
1368
  params.groupBy = this.queryParams.groupBy;
1350
1369
  }
1370
+ if (this.queryParams.count !== void 0) {
1371
+ params.count = this.queryParams.count;
1372
+ }
1351
1373
  return params;
1352
1374
  }
1353
1375
  };