@baasix/types 1.0.7 → 1.0.8

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.d.mts CHANGED
@@ -729,6 +729,19 @@ interface QueryParams<T = unknown> {
729
729
  * Filter conditions for related items (O2M/M2M)
730
730
  */
731
731
  relConditions?: Record<string, Filter>;
732
+ /**
733
+ * Whether to compute the total record count for the result.
734
+ *
735
+ * When omitted (`undefined`), the server falls back to the deployment
736
+ * default (env `COUNT_BY_DEFAULT`, which itself defaults to `true`).
737
+ * Passing `false` skips the COUNT query even when the default is on;
738
+ * passing `true` forces it even when the default is off.
739
+ *
740
+ * When the count is skipped, `totalCount` is returned as `null`.
741
+ * When `limit` is `-1` (return all) with no offset, the count is taken
742
+ * from the result length instead of running a separate query.
743
+ */
744
+ count?: boolean;
732
745
  /**
733
746
  * Additional metadata
734
747
  */
@@ -817,7 +830,12 @@ interface StatsResult {
817
830
  */
818
831
  interface PaginatedResponse<T> {
819
832
  data: T[];
820
- totalCount?: number;
833
+ /**
834
+ * Total number of records matching the query.
835
+ * `null` when the count was intentionally skipped via `count: false`
836
+ * (or the deployment default `COUNT_BY_DEFAULT=false`).
837
+ */
838
+ totalCount?: number | null;
821
839
  page?: number;
822
840
  limit?: number;
823
841
  totalPages?: number;
@@ -861,7 +879,11 @@ interface BulkResponse<T = string[]> {
861
879
  */
862
880
  interface ReadResult<T = any> {
863
881
  data: T[];
864
- totalCount: number;
882
+ /**
883
+ * Total number of records matching the query.
884
+ * `null` when the count was intentionally skipped (see `QueryParams.count`).
885
+ */
886
+ totalCount: number | null;
865
887
  page?: number;
866
888
  limit?: number;
867
889
  }
package/dist/index.d.ts CHANGED
@@ -729,6 +729,19 @@ interface QueryParams<T = unknown> {
729
729
  * Filter conditions for related items (O2M/M2M)
730
730
  */
731
731
  relConditions?: Record<string, Filter>;
732
+ /**
733
+ * Whether to compute the total record count for the result.
734
+ *
735
+ * When omitted (`undefined`), the server falls back to the deployment
736
+ * default (env `COUNT_BY_DEFAULT`, which itself defaults to `true`).
737
+ * Passing `false` skips the COUNT query even when the default is on;
738
+ * passing `true` forces it even when the default is off.
739
+ *
740
+ * When the count is skipped, `totalCount` is returned as `null`.
741
+ * When `limit` is `-1` (return all) with no offset, the count is taken
742
+ * from the result length instead of running a separate query.
743
+ */
744
+ count?: boolean;
732
745
  /**
733
746
  * Additional metadata
734
747
  */
@@ -817,7 +830,12 @@ interface StatsResult {
817
830
  */
818
831
  interface PaginatedResponse<T> {
819
832
  data: T[];
820
- totalCount?: number;
833
+ /**
834
+ * Total number of records matching the query.
835
+ * `null` when the count was intentionally skipped via `count: false`
836
+ * (or the deployment default `COUNT_BY_DEFAULT=false`).
837
+ */
838
+ totalCount?: number | null;
821
839
  page?: number;
822
840
  limit?: number;
823
841
  totalPages?: number;
@@ -861,7 +879,11 @@ interface BulkResponse<T = string[]> {
861
879
  */
862
880
  interface ReadResult<T = any> {
863
881
  data: T[];
864
- totalCount: number;
882
+ /**
883
+ * Total number of records matching the query.
884
+ * `null` when the count was intentionally skipped (see `QueryParams.count`).
885
+ */
886
+ totalCount: number | null;
865
887
  page?: number;
866
888
  limit?: number;
867
889
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baasix/types",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Shared TypeScript types for Baasix packages",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/query.ts CHANGED
@@ -353,6 +353,20 @@ export interface QueryParams<T = unknown> {
353
353
  */
354
354
  relConditions?: Record<string, Filter>;
355
355
 
356
+ /**
357
+ * Whether to compute the total record count for the result.
358
+ *
359
+ * When omitted (`undefined`), the server falls back to the deployment
360
+ * default (env `COUNT_BY_DEFAULT`, which itself defaults to `true`).
361
+ * Passing `false` skips the COUNT query even when the default is on;
362
+ * passing `true` forces it even when the default is off.
363
+ *
364
+ * When the count is skipped, `totalCount` is returned as `null`.
365
+ * When `limit` is `-1` (return all) with no offset, the count is taken
366
+ * from the result length instead of running a separate query.
367
+ */
368
+ count?: boolean;
369
+
356
370
  /**
357
371
  * Additional metadata
358
372
  */
package/src/response.ts CHANGED
@@ -12,7 +12,12 @@
12
12
  */
13
13
  export interface PaginatedResponse<T> {
14
14
  data: T[];
15
- totalCount?: number;
15
+ /**
16
+ * Total number of records matching the query.
17
+ * `null` when the count was intentionally skipped via `count: false`
18
+ * (or the deployment default `COUNT_BY_DEFAULT=false`).
19
+ */
20
+ totalCount?: number | null;
16
21
  page?: number;
17
22
  limit?: number;
18
23
  totalPages?: number;
@@ -55,7 +60,11 @@ export interface BulkResponse<T = string[]> {
55
60
  */
56
61
  export interface ReadResult<T = any> {
57
62
  data: T[];
58
- totalCount: number;
63
+ /**
64
+ * Total number of records matching the query.
65
+ * `null` when the count was intentionally skipped (see `QueryParams.count`).
66
+ */
67
+ totalCount: number | null;
59
68
  page?: number;
60
69
  limit?: number;
61
70
  }