@baasix/types 1.0.7 → 1.0.9

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
  }
@@ -1365,6 +1387,21 @@ type AnyRecord = Record<string, unknown>;
1365
1387
  interface Settings {
1366
1388
  [key: string]: unknown;
1367
1389
  }
1390
+ /**
1391
+ * Session type limits
1392
+ */
1393
+ interface SessionTypeLimits {
1394
+ /** -1 = unlimited, 0 = disabled, positive n = max concurrent sessions */
1395
+ web?: number;
1396
+ mobile?: number;
1397
+ }
1398
+ /**
1399
+ * Session limits by role and type
1400
+ */
1401
+ interface SessionLimits {
1402
+ default?: SessionTypeLimits;
1403
+ roles?: Record<string, SessionTypeLimits>;
1404
+ }
1368
1405
  /**
1369
1406
  * Tenant settings
1370
1407
  */
@@ -1394,6 +1431,7 @@ interface TenantSettings {
1394
1431
  email_icon?: any;
1395
1432
  metadata?: Record<string, any>;
1396
1433
  modules?: Record<string, any>;
1434
+ session_limits?: SessionLimits | null;
1397
1435
  [key: string]: any;
1398
1436
  }
1399
1437
  /**
@@ -2083,4 +2121,4 @@ interface ExpressPluginContext extends PluginRouteContext {
2083
2121
  getPluginService: (pluginName: string, serviceName: string) => any;
2084
2122
  }
2085
2123
 
2086
- export type { Accountability, Aggregate, AggregateConfig, AggregateFunction, AggregateMapping, AnyRecord, AssetQuery, AssetTransformOptions, AssociationDefinition, AssociationType, AuthMode, AuthProviderType, AuthResponse, AuthState, AuthStateEvent, AuthTokens, BaasixPlugin, BackgroundTask, BaseItem, BulkResponse, CacheConfig, CacheEntry, CacheSetOptions, CacheStrategy, CollectionItem, CreatePermissionData, DatePart, DateTruncPrecision, DeepPartial, DefaultValueType, DeleteResponse, ErrorResponse, ExportOptions, ExportResult, Express, ExpressApp, ExpressNextFunction, ExpressPluginContext, ExpressPluginMiddleware, ExpressPluginRoute, ExpressPluginRouteHandler, ExpressRequest, ExpressResponse, ExpressRouter, FieldDefinition, FieldInfo, FieldType, FieldValidation, FieldValidationRules, FieldValues, FileData, FileMetadata, Filter, FilterCondition, FilterObject, FilterOperator, FilterValue, FlattenedField, GeoJSONGeometry, GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon, Hook, HookContext, HookEvent, HookFunction, HookHandler, HttpMethod, IAssetsService, ICacheAdapter, ICacheService, IFilesService, IHooksManager, IItemsService, IMailService, IMigrationService, INotificationService, IPermissionService, IRealtimeService, IReportService, ISettingsService, ISocketService, IStatsService, IStorageService, ITasksService, IWorkflowService, ImportOptions, ImportResult, IncludeConfig, IndexDefinition, InternalUploadedFile, JWTPayload, KeysOfType, LoadedPlugin, LogicalFilter, LoginCredentials, MagicLinkOptions, MailOptions, MutationResponse, NextFunction, Notification, NotificationOptions, NotificationType, OAuth2Config, OAuth2Tokens, OAuth2UserInfo, OperatorName, PaginatedResponse, PaginationMetadata, PaginationOptions, PasswordResetOptions, Permission, PermissionAction, PermissionData, PluginApp, PluginAuthProvider, PluginContext, PluginDefinition, PluginFactory, PluginHook, PluginHookContext, PluginHookEvent, PluginHookHandler, PluginManagerOptions, PluginMeta, PluginMiddleware, PluginNextFunction, PluginRequest, PluginResponse, PluginRoute, PluginRouteContext, PluginRouteHandler, PluginRouter, PluginSchedule, PluginSchemaDefinition, PluginService, PluginServiceFactory, PluginType, ProcessedImage, ProcessedInclude, QueryContext, QueryOptions, QueryParams, ReadResult, RegisterData, RelationshipDefinition, RelationshipType, ReportConfig, ReportQuery, ReportResult, Request, Response, Role, Router, SchemaDefinition, SchemaInfo, SchemaValidation, SeedData, SeedResult, SendNotificationData, SenderConfig, ServiceOptions, Session, Settings, SingleResponse, SoftDeletableItem, Sort, SortDirection, SortItem, SortObject, StartServerOptions, StatsQuery, StatsResult, StorageAdapter, StorageProvider, Tenant, TenantSettings, TimestampedItem, UploadOptions, UploadedFile, User, UserWithPassword, UserWithRolesAndPermissions, ValidationResult, WithOptional, WithRequired, Workflow, WorkflowEdge, WorkflowExecution, WorkflowExecutionLog, WorkflowExecutionStatus, WorkflowFlowData, WorkflowNode, WorkflowNodeData, WorkflowStatus, WorkflowTrigger, WorkflowTriggerType };
2124
+ export type { Accountability, Aggregate, AggregateConfig, AggregateFunction, AggregateMapping, AnyRecord, AssetQuery, AssetTransformOptions, AssociationDefinition, AssociationType, AuthMode, AuthProviderType, AuthResponse, AuthState, AuthStateEvent, AuthTokens, BaasixPlugin, BackgroundTask, BaseItem, BulkResponse, CacheConfig, CacheEntry, CacheSetOptions, CacheStrategy, CollectionItem, CreatePermissionData, DatePart, DateTruncPrecision, DeepPartial, DefaultValueType, DeleteResponse, ErrorResponse, ExportOptions, ExportResult, Express, ExpressApp, ExpressNextFunction, ExpressPluginContext, ExpressPluginMiddleware, ExpressPluginRoute, ExpressPluginRouteHandler, ExpressRequest, ExpressResponse, ExpressRouter, FieldDefinition, FieldInfo, FieldType, FieldValidation, FieldValidationRules, FieldValues, FileData, FileMetadata, Filter, FilterCondition, FilterObject, FilterOperator, FilterValue, FlattenedField, GeoJSONGeometry, GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon, Hook, HookContext, HookEvent, HookFunction, HookHandler, HttpMethod, IAssetsService, ICacheAdapter, ICacheService, IFilesService, IHooksManager, IItemsService, IMailService, IMigrationService, INotificationService, IPermissionService, IRealtimeService, IReportService, ISettingsService, ISocketService, IStatsService, IStorageService, ITasksService, IWorkflowService, ImportOptions, ImportResult, IncludeConfig, IndexDefinition, InternalUploadedFile, JWTPayload, KeysOfType, LoadedPlugin, LogicalFilter, LoginCredentials, MagicLinkOptions, MailOptions, MutationResponse, NextFunction, Notification, NotificationOptions, NotificationType, OAuth2Config, OAuth2Tokens, OAuth2UserInfo, OperatorName, PaginatedResponse, PaginationMetadata, PaginationOptions, PasswordResetOptions, Permission, PermissionAction, PermissionData, PluginApp, PluginAuthProvider, PluginContext, PluginDefinition, PluginFactory, PluginHook, PluginHookContext, PluginHookEvent, PluginHookHandler, PluginManagerOptions, PluginMeta, PluginMiddleware, PluginNextFunction, PluginRequest, PluginResponse, PluginRoute, PluginRouteContext, PluginRouteHandler, PluginRouter, PluginSchedule, PluginSchemaDefinition, PluginService, PluginServiceFactory, PluginType, ProcessedImage, ProcessedInclude, QueryContext, QueryOptions, QueryParams, ReadResult, RegisterData, RelationshipDefinition, RelationshipType, ReportConfig, ReportQuery, ReportResult, Request, Response, Role, Router, SchemaDefinition, SchemaInfo, SchemaValidation, SeedData, SeedResult, SendNotificationData, SenderConfig, ServiceOptions, Session, SessionLimits, SessionTypeLimits, Settings, SingleResponse, SoftDeletableItem, Sort, SortDirection, SortItem, SortObject, StartServerOptions, StatsQuery, StatsResult, StorageAdapter, StorageProvider, Tenant, TenantSettings, TimestampedItem, UploadOptions, UploadedFile, User, UserWithPassword, UserWithRolesAndPermissions, ValidationResult, WithOptional, WithRequired, Workflow, WorkflowEdge, WorkflowExecution, WorkflowExecutionLog, WorkflowExecutionStatus, WorkflowFlowData, WorkflowNode, WorkflowNodeData, WorkflowStatus, WorkflowTrigger, WorkflowTriggerType };
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
  }
@@ -1365,6 +1387,21 @@ type AnyRecord = Record<string, unknown>;
1365
1387
  interface Settings {
1366
1388
  [key: string]: unknown;
1367
1389
  }
1390
+ /**
1391
+ * Session type limits
1392
+ */
1393
+ interface SessionTypeLimits {
1394
+ /** -1 = unlimited, 0 = disabled, positive n = max concurrent sessions */
1395
+ web?: number;
1396
+ mobile?: number;
1397
+ }
1398
+ /**
1399
+ * Session limits by role and type
1400
+ */
1401
+ interface SessionLimits {
1402
+ default?: SessionTypeLimits;
1403
+ roles?: Record<string, SessionTypeLimits>;
1404
+ }
1368
1405
  /**
1369
1406
  * Tenant settings
1370
1407
  */
@@ -1394,6 +1431,7 @@ interface TenantSettings {
1394
1431
  email_icon?: any;
1395
1432
  metadata?: Record<string, any>;
1396
1433
  modules?: Record<string, any>;
1434
+ session_limits?: SessionLimits | null;
1397
1435
  [key: string]: any;
1398
1436
  }
1399
1437
  /**
@@ -2083,4 +2121,4 @@ interface ExpressPluginContext extends PluginRouteContext {
2083
2121
  getPluginService: (pluginName: string, serviceName: string) => any;
2084
2122
  }
2085
2123
 
2086
- export type { Accountability, Aggregate, AggregateConfig, AggregateFunction, AggregateMapping, AnyRecord, AssetQuery, AssetTransformOptions, AssociationDefinition, AssociationType, AuthMode, AuthProviderType, AuthResponse, AuthState, AuthStateEvent, AuthTokens, BaasixPlugin, BackgroundTask, BaseItem, BulkResponse, CacheConfig, CacheEntry, CacheSetOptions, CacheStrategy, CollectionItem, CreatePermissionData, DatePart, DateTruncPrecision, DeepPartial, DefaultValueType, DeleteResponse, ErrorResponse, ExportOptions, ExportResult, Express, ExpressApp, ExpressNextFunction, ExpressPluginContext, ExpressPluginMiddleware, ExpressPluginRoute, ExpressPluginRouteHandler, ExpressRequest, ExpressResponse, ExpressRouter, FieldDefinition, FieldInfo, FieldType, FieldValidation, FieldValidationRules, FieldValues, FileData, FileMetadata, Filter, FilterCondition, FilterObject, FilterOperator, FilterValue, FlattenedField, GeoJSONGeometry, GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon, Hook, HookContext, HookEvent, HookFunction, HookHandler, HttpMethod, IAssetsService, ICacheAdapter, ICacheService, IFilesService, IHooksManager, IItemsService, IMailService, IMigrationService, INotificationService, IPermissionService, IRealtimeService, IReportService, ISettingsService, ISocketService, IStatsService, IStorageService, ITasksService, IWorkflowService, ImportOptions, ImportResult, IncludeConfig, IndexDefinition, InternalUploadedFile, JWTPayload, KeysOfType, LoadedPlugin, LogicalFilter, LoginCredentials, MagicLinkOptions, MailOptions, MutationResponse, NextFunction, Notification, NotificationOptions, NotificationType, OAuth2Config, OAuth2Tokens, OAuth2UserInfo, OperatorName, PaginatedResponse, PaginationMetadata, PaginationOptions, PasswordResetOptions, Permission, PermissionAction, PermissionData, PluginApp, PluginAuthProvider, PluginContext, PluginDefinition, PluginFactory, PluginHook, PluginHookContext, PluginHookEvent, PluginHookHandler, PluginManagerOptions, PluginMeta, PluginMiddleware, PluginNextFunction, PluginRequest, PluginResponse, PluginRoute, PluginRouteContext, PluginRouteHandler, PluginRouter, PluginSchedule, PluginSchemaDefinition, PluginService, PluginServiceFactory, PluginType, ProcessedImage, ProcessedInclude, QueryContext, QueryOptions, QueryParams, ReadResult, RegisterData, RelationshipDefinition, RelationshipType, ReportConfig, ReportQuery, ReportResult, Request, Response, Role, Router, SchemaDefinition, SchemaInfo, SchemaValidation, SeedData, SeedResult, SendNotificationData, SenderConfig, ServiceOptions, Session, Settings, SingleResponse, SoftDeletableItem, Sort, SortDirection, SortItem, SortObject, StartServerOptions, StatsQuery, StatsResult, StorageAdapter, StorageProvider, Tenant, TenantSettings, TimestampedItem, UploadOptions, UploadedFile, User, UserWithPassword, UserWithRolesAndPermissions, ValidationResult, WithOptional, WithRequired, Workflow, WorkflowEdge, WorkflowExecution, WorkflowExecutionLog, WorkflowExecutionStatus, WorkflowFlowData, WorkflowNode, WorkflowNodeData, WorkflowStatus, WorkflowTrigger, WorkflowTriggerType };
2124
+ export type { Accountability, Aggregate, AggregateConfig, AggregateFunction, AggregateMapping, AnyRecord, AssetQuery, AssetTransformOptions, AssociationDefinition, AssociationType, AuthMode, AuthProviderType, AuthResponse, AuthState, AuthStateEvent, AuthTokens, BaasixPlugin, BackgroundTask, BaseItem, BulkResponse, CacheConfig, CacheEntry, CacheSetOptions, CacheStrategy, CollectionItem, CreatePermissionData, DatePart, DateTruncPrecision, DeepPartial, DefaultValueType, DeleteResponse, ErrorResponse, ExportOptions, ExportResult, Express, ExpressApp, ExpressNextFunction, ExpressPluginContext, ExpressPluginMiddleware, ExpressPluginRoute, ExpressPluginRouteHandler, ExpressRequest, ExpressResponse, ExpressRouter, FieldDefinition, FieldInfo, FieldType, FieldValidation, FieldValidationRules, FieldValues, FileData, FileMetadata, Filter, FilterCondition, FilterObject, FilterOperator, FilterValue, FlattenedField, GeoJSONGeometry, GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon, Hook, HookContext, HookEvent, HookFunction, HookHandler, HttpMethod, IAssetsService, ICacheAdapter, ICacheService, IFilesService, IHooksManager, IItemsService, IMailService, IMigrationService, INotificationService, IPermissionService, IRealtimeService, IReportService, ISettingsService, ISocketService, IStatsService, IStorageService, ITasksService, IWorkflowService, ImportOptions, ImportResult, IncludeConfig, IndexDefinition, InternalUploadedFile, JWTPayload, KeysOfType, LoadedPlugin, LogicalFilter, LoginCredentials, MagicLinkOptions, MailOptions, MutationResponse, NextFunction, Notification, NotificationOptions, NotificationType, OAuth2Config, OAuth2Tokens, OAuth2UserInfo, OperatorName, PaginatedResponse, PaginationMetadata, PaginationOptions, PasswordResetOptions, Permission, PermissionAction, PermissionData, PluginApp, PluginAuthProvider, PluginContext, PluginDefinition, PluginFactory, PluginHook, PluginHookContext, PluginHookEvent, PluginHookHandler, PluginManagerOptions, PluginMeta, PluginMiddleware, PluginNextFunction, PluginRequest, PluginResponse, PluginRoute, PluginRouteContext, PluginRouteHandler, PluginRouter, PluginSchedule, PluginSchemaDefinition, PluginService, PluginServiceFactory, PluginType, ProcessedImage, ProcessedInclude, QueryContext, QueryOptions, QueryParams, ReadResult, RegisterData, RelationshipDefinition, RelationshipType, ReportConfig, ReportQuery, ReportResult, Request, Response, Role, Router, SchemaDefinition, SchemaInfo, SchemaValidation, SeedData, SeedResult, SendNotificationData, SenderConfig, ServiceOptions, Session, SessionLimits, SessionTypeLimits, Settings, SingleResponse, SoftDeletableItem, Sort, SortDirection, SortItem, SortObject, StartServerOptions, StatsQuery, StatsResult, StorageAdapter, StorageProvider, Tenant, TenantSettings, TimestampedItem, UploadOptions, UploadedFile, User, UserWithPassword, UserWithRolesAndPermissions, ValidationResult, WithOptional, WithRequired, Workflow, WorkflowEdge, WorkflowExecution, WorkflowExecutionLog, WorkflowExecutionStatus, WorkflowFlowData, WorkflowNode, WorkflowNodeData, WorkflowStatus, WorkflowTrigger, WorkflowTriggerType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baasix/types",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Shared TypeScript types for Baasix packages",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/common.ts CHANGED
@@ -80,6 +80,23 @@ export interface Settings {
80
80
  [key: string]: unknown;
81
81
  }
82
82
 
83
+ /**
84
+ * Session type limits
85
+ */
86
+ export interface SessionTypeLimits {
87
+ /** -1 = unlimited, 0 = disabled, positive n = max concurrent sessions */
88
+ web?: number;
89
+ mobile?: number;
90
+ }
91
+
92
+ /**
93
+ * Session limits by role and type
94
+ */
95
+ export interface SessionLimits {
96
+ default?: SessionTypeLimits;
97
+ roles?: Record<string, SessionTypeLimits>;
98
+ }
99
+
83
100
  /**
84
101
  * Tenant settings
85
102
  */
@@ -109,6 +126,7 @@ export interface TenantSettings {
109
126
  email_icon?: any;
110
127
  metadata?: Record<string, any>;
111
128
  modules?: Record<string, any>;
129
+ session_limits?: SessionLimits | null;
112
130
  [key: string]: any;
113
131
  }
114
132
 
package/src/index.ts CHANGED
@@ -1,309 +1,311 @@
1
- /**
2
- * @baasix/types
3
- * Shared TypeScript types for Baasix packages
4
- *
5
- * This package provides common type definitions used across:
6
- * - @baasix/core (backend)
7
- * - @baasix/sdk (client SDK)
8
- * - @baasix/cli (command-line interface)
9
- * - @baasix/app (admin panel)
10
- */
11
-
12
- // ============================================================================
13
- // Auth Types
14
- // ============================================================================
15
- export type {
16
- // User types
17
- User,
18
- UserWithPassword,
19
- UserWithRolesAndPermissions,
20
- // Role & Permission types
21
- Role,
22
- PermissionAction,
23
- Permission,
24
- PermissionData,
25
- CreatePermissionData,
26
- // Tenant types
27
- Tenant,
28
- // Session & Token types
29
- Session,
30
- AuthTokens,
31
- JWTPayload,
32
- // Accountability
33
- Accountability,
34
- // Auth request/response types
35
- LoginCredentials,
36
- RegisterData,
37
- AuthResponse,
38
- AuthStateEvent,
39
- AuthState,
40
- MagicLinkOptions,
41
- PasswordResetOptions,
42
- // OAuth types
43
- OAuth2Tokens,
44
- OAuth2UserInfo,
45
- // Auth mode
46
- AuthMode,
47
- } from "./auth";
48
-
49
- // ============================================================================
50
- // Schema Types
51
- // ============================================================================
52
- export type {
53
- // Field types
54
- FieldType,
55
- DefaultValueType,
56
- FieldValidationRules,
57
- FieldValues,
58
- FieldDefinition,
59
- FlattenedField,
60
- FieldInfo,
61
- // Schema types
62
- IndexDefinition,
63
- SchemaDefinition,
64
- SchemaInfo,
65
- SchemaValidation,
66
- FieldValidation,
67
- ValidationResult,
68
- // Relationship types
69
- RelationshipType,
70
- AssociationType,
71
- RelationshipDefinition,
72
- AssociationDefinition,
73
- IncludeConfig,
74
- ProcessedInclude,
75
- } from "./schema";
76
-
77
- // ============================================================================
78
- // Query Types (includes Report & Stats query types)
79
- // ============================================================================
80
- export type {
81
- // Filter types
82
- FilterOperator,
83
- OperatorName,
84
- FilterValue,
85
- FilterCondition,
86
- LogicalFilter,
87
- Filter,
88
- FilterObject,
89
- // Sort types
90
- SortDirection,
91
- Sort,
92
- SortItem,
93
- SortObject,
94
- // Pagination types
95
- PaginationOptions,
96
- PaginationMetadata,
97
- // Aggregation types
98
- AggregateFunction,
99
- AggregateConfig,
100
- Aggregate,
101
- AggregateMapping,
102
- DatePart,
103
- DateTruncPrecision,
104
- // Query parameters
105
- QueryParams,
106
- QueryOptions,
107
- QueryContext,
108
- // Report query types
109
- ReportConfig,
110
- ReportResult,
111
- ReportQuery,
112
- // Stats query types
113
- StatsQuery,
114
- StatsResult,
115
- } from "./query";
116
-
117
- // ============================================================================
118
- // Response Types
119
- // ============================================================================
120
- export type {
121
- PaginatedResponse,
122
- SingleResponse,
123
- MutationResponse,
124
- DeleteResponse,
125
- BulkResponse,
126
- ReadResult,
127
- ErrorResponse,
128
- } from "./response";
129
-
130
- // ============================================================================
131
- // File Types (includes Import/Export types)
132
- // ============================================================================
133
- export type {
134
- // File metadata
135
- FileMetadata,
136
- FileData,
137
- UploadOptions,
138
- InternalUploadedFile,
139
- // Asset types
140
- AssetTransformOptions,
141
- AssetQuery,
142
- ProcessedImage,
143
- // Storage types
144
- StorageProvider,
145
- StorageAdapter,
146
- // Import/Export types
147
- UploadedFile,
148
- ImportOptions,
149
- ExportOptions,
150
- ImportResult,
151
- ExportResult,
152
- } from "./files";
153
-
154
- // ============================================================================
155
- // Workflow Types
156
- // ============================================================================
157
- export type {
158
- WorkflowTriggerType,
159
- WorkflowStatus,
160
- Workflow,
161
- WorkflowFlowData,
162
- WorkflowTrigger,
163
- WorkflowNode,
164
- WorkflowNodeData,
165
- WorkflowEdge,
166
- WorkflowExecutionStatus,
167
- WorkflowExecution,
168
- WorkflowExecutionLog,
169
- } from "./workflow";
170
-
171
- // ============================================================================
172
- // Notification Types
173
- // ============================================================================
174
- export type {
175
- NotificationType,
176
- Notification,
177
- NotificationOptions,
178
- SendNotificationData,
179
- } from "./notification";
180
-
181
- // ============================================================================
182
- // Spatial/GeoJSON Types
183
- // ============================================================================
184
- export type {
185
- GeoJSONPoint,
186
- GeoJSONLineString,
187
- GeoJSONPolygon,
188
- GeoJSONGeometry,
189
- } from "./spatial";
190
-
191
- // ============================================================================
192
- // Cache Types
193
- // ============================================================================
194
- export type {
195
- CacheConfig,
196
- CacheSetOptions,
197
- CacheStrategy,
198
- CacheEntry,
199
- ICacheAdapter,
200
- } from "./cache";
201
-
202
- // ============================================================================
203
- // Common Types
204
- // ============================================================================
205
- export type {
206
- // Base types
207
- BaseItem,
208
- TimestampedItem,
209
- SoftDeletableItem,
210
- // Utility types
211
- DeepPartial,
212
- CollectionItem,
213
- WithRequired,
214
- WithOptional,
215
- KeysOfType,
216
- AnyRecord,
217
- // Settings types
218
- Settings,
219
- TenantSettings,
220
- // Task types
221
- BackgroundTask,
222
- // Hook types
223
- HookEvent,
224
- HookContext,
225
- HookHandler,
226
- Hook,
227
- // HTTP types
228
- HttpMethod,
229
- // Mail types
230
- MailOptions,
231
- SenderConfig,
232
- // Seed types
233
- SeedData,
234
- SeedResult,
235
- } from "./common";
236
-
237
- // ============================================================================
238
- // Plugin Types
239
- // ============================================================================
240
- export type {
241
- // Express types (actual Express types from @types/express)
242
- Request,
243
- Response,
244
- NextFunction,
245
- Express,
246
- Router,
247
- // Express type aliases
248
- ExpressRequest,
249
- ExpressResponse,
250
- ExpressNextFunction,
251
- ExpressApp,
252
- ExpressRouter,
253
- // Express-compatible types (can be used without importing express)
254
- PluginRequest,
255
- PluginResponse,
256
- PluginNextFunction,
257
- PluginApp,
258
- PluginRouter,
259
- // Service interfaces
260
- ServiceOptions,
261
- IItemsService,
262
- IPermissionService,
263
- IMailService,
264
- IStorageService,
265
- ISettingsService,
266
- ISocketService,
267
- IRealtimeService,
268
- ITasksService,
269
- IWorkflowService,
270
- IMigrationService,
271
- IHooksManager,
272
- HookFunction,
273
- ICacheService,
274
- IFilesService,
275
- IAssetsService,
276
- INotificationService,
277
- IReportService,
278
- IStatsService,
279
- // Plugin types
280
- PluginType,
281
- PluginMeta,
282
- PluginSchemaDefinition,
283
- PluginRouteContext,
284
- PluginRouteHandler,
285
- PluginRoute,
286
- PluginHookEvent,
287
- PluginHookContext,
288
- PluginHookHandler,
289
- PluginHook,
290
- PluginContext,
291
- PluginServiceFactory,
292
- PluginService,
293
- AuthProviderType,
294
- OAuth2Config,
295
- PluginAuthProvider,
296
- PluginMiddleware,
297
- PluginSchedule,
298
- PluginDefinition,
299
- PluginFactory,
300
- BaasixPlugin,
301
- LoadedPlugin,
302
- PluginManagerOptions,
303
- StartServerOptions,
304
- // Express-typed plugin types (for core package)
305
- ExpressPluginRouteHandler,
306
- ExpressPluginRoute,
307
- ExpressPluginMiddleware,
308
- ExpressPluginContext,
309
- } from "./plugin";
1
+ /**
2
+ * @baasix/types
3
+ * Shared TypeScript types for Baasix packages
4
+ *
5
+ * This package provides common type definitions used across:
6
+ * - @baasix/core (backend)
7
+ * - @baasix/sdk (client SDK)
8
+ * - @baasix/cli (command-line interface)
9
+ * - @baasix/app (admin panel)
10
+ */
11
+
12
+ // ============================================================================
13
+ // Auth Types
14
+ // ============================================================================
15
+ export type {
16
+ // User types
17
+ User,
18
+ UserWithPassword,
19
+ UserWithRolesAndPermissions,
20
+ // Role & Permission types
21
+ Role,
22
+ PermissionAction,
23
+ Permission,
24
+ PermissionData,
25
+ CreatePermissionData,
26
+ // Tenant types
27
+ Tenant,
28
+ // Session & Token types
29
+ Session,
30
+ AuthTokens,
31
+ JWTPayload,
32
+ // Accountability
33
+ Accountability,
34
+ // Auth request/response types
35
+ LoginCredentials,
36
+ RegisterData,
37
+ AuthResponse,
38
+ AuthStateEvent,
39
+ AuthState,
40
+ MagicLinkOptions,
41
+ PasswordResetOptions,
42
+ // OAuth types
43
+ OAuth2Tokens,
44
+ OAuth2UserInfo,
45
+ // Auth mode
46
+ AuthMode,
47
+ } from "./auth";
48
+
49
+ // ============================================================================
50
+ // Schema Types
51
+ // ============================================================================
52
+ export type {
53
+ // Field types
54
+ FieldType,
55
+ DefaultValueType,
56
+ FieldValidationRules,
57
+ FieldValues,
58
+ FieldDefinition,
59
+ FlattenedField,
60
+ FieldInfo,
61
+ // Schema types
62
+ IndexDefinition,
63
+ SchemaDefinition,
64
+ SchemaInfo,
65
+ SchemaValidation,
66
+ FieldValidation,
67
+ ValidationResult,
68
+ // Relationship types
69
+ RelationshipType,
70
+ AssociationType,
71
+ RelationshipDefinition,
72
+ AssociationDefinition,
73
+ IncludeConfig,
74
+ ProcessedInclude,
75
+ } from "./schema";
76
+
77
+ // ============================================================================
78
+ // Query Types (includes Report & Stats query types)
79
+ // ============================================================================
80
+ export type {
81
+ // Filter types
82
+ FilterOperator,
83
+ OperatorName,
84
+ FilterValue,
85
+ FilterCondition,
86
+ LogicalFilter,
87
+ Filter,
88
+ FilterObject,
89
+ // Sort types
90
+ SortDirection,
91
+ Sort,
92
+ SortItem,
93
+ SortObject,
94
+ // Pagination types
95
+ PaginationOptions,
96
+ PaginationMetadata,
97
+ // Aggregation types
98
+ AggregateFunction,
99
+ AggregateConfig,
100
+ Aggregate,
101
+ AggregateMapping,
102
+ DatePart,
103
+ DateTruncPrecision,
104
+ // Query parameters
105
+ QueryParams,
106
+ QueryOptions,
107
+ QueryContext,
108
+ // Report query types
109
+ ReportConfig,
110
+ ReportResult,
111
+ ReportQuery,
112
+ // Stats query types
113
+ StatsQuery,
114
+ StatsResult,
115
+ } from "./query";
116
+
117
+ // ============================================================================
118
+ // Response Types
119
+ // ============================================================================
120
+ export type {
121
+ PaginatedResponse,
122
+ SingleResponse,
123
+ MutationResponse,
124
+ DeleteResponse,
125
+ BulkResponse,
126
+ ReadResult,
127
+ ErrorResponse,
128
+ } from "./response";
129
+
130
+ // ============================================================================
131
+ // File Types (includes Import/Export types)
132
+ // ============================================================================
133
+ export type {
134
+ // File metadata
135
+ FileMetadata,
136
+ FileData,
137
+ UploadOptions,
138
+ InternalUploadedFile,
139
+ // Asset types
140
+ AssetTransformOptions,
141
+ AssetQuery,
142
+ ProcessedImage,
143
+ // Storage types
144
+ StorageProvider,
145
+ StorageAdapter,
146
+ // Import/Export types
147
+ UploadedFile,
148
+ ImportOptions,
149
+ ExportOptions,
150
+ ImportResult,
151
+ ExportResult,
152
+ } from "./files";
153
+
154
+ // ============================================================================
155
+ // Workflow Types
156
+ // ============================================================================
157
+ export type {
158
+ WorkflowTriggerType,
159
+ WorkflowStatus,
160
+ Workflow,
161
+ WorkflowFlowData,
162
+ WorkflowTrigger,
163
+ WorkflowNode,
164
+ WorkflowNodeData,
165
+ WorkflowEdge,
166
+ WorkflowExecutionStatus,
167
+ WorkflowExecution,
168
+ WorkflowExecutionLog,
169
+ } from "./workflow";
170
+
171
+ // ============================================================================
172
+ // Notification Types
173
+ // ============================================================================
174
+ export type {
175
+ NotificationType,
176
+ Notification,
177
+ NotificationOptions,
178
+ SendNotificationData,
179
+ } from "./notification";
180
+
181
+ // ============================================================================
182
+ // Spatial/GeoJSON Types
183
+ // ============================================================================
184
+ export type {
185
+ GeoJSONPoint,
186
+ GeoJSONLineString,
187
+ GeoJSONPolygon,
188
+ GeoJSONGeometry,
189
+ } from "./spatial";
190
+
191
+ // ============================================================================
192
+ // Cache Types
193
+ // ============================================================================
194
+ export type {
195
+ CacheConfig,
196
+ CacheSetOptions,
197
+ CacheStrategy,
198
+ CacheEntry,
199
+ ICacheAdapter,
200
+ } from "./cache";
201
+
202
+ // ============================================================================
203
+ // Common Types
204
+ // ============================================================================
205
+ export type {
206
+ // Base types
207
+ BaseItem,
208
+ TimestampedItem,
209
+ SoftDeletableItem,
210
+ // Utility types
211
+ DeepPartial,
212
+ CollectionItem,
213
+ WithRequired,
214
+ WithOptional,
215
+ KeysOfType,
216
+ AnyRecord,
217
+ // Settings types
218
+ Settings,
219
+ TenantSettings,
220
+ SessionTypeLimits,
221
+ SessionLimits,
222
+ // Task types
223
+ BackgroundTask,
224
+ // Hook types
225
+ HookEvent,
226
+ HookContext,
227
+ HookHandler,
228
+ Hook,
229
+ // HTTP types
230
+ HttpMethod,
231
+ // Mail types
232
+ MailOptions,
233
+ SenderConfig,
234
+ // Seed types
235
+ SeedData,
236
+ SeedResult,
237
+ } from "./common";
238
+
239
+ // ============================================================================
240
+ // Plugin Types
241
+ // ============================================================================
242
+ export type {
243
+ // Express types (actual Express types from @types/express)
244
+ Request,
245
+ Response,
246
+ NextFunction,
247
+ Express,
248
+ Router,
249
+ // Express type aliases
250
+ ExpressRequest,
251
+ ExpressResponse,
252
+ ExpressNextFunction,
253
+ ExpressApp,
254
+ ExpressRouter,
255
+ // Express-compatible types (can be used without importing express)
256
+ PluginRequest,
257
+ PluginResponse,
258
+ PluginNextFunction,
259
+ PluginApp,
260
+ PluginRouter,
261
+ // Service interfaces
262
+ ServiceOptions,
263
+ IItemsService,
264
+ IPermissionService,
265
+ IMailService,
266
+ IStorageService,
267
+ ISettingsService,
268
+ ISocketService,
269
+ IRealtimeService,
270
+ ITasksService,
271
+ IWorkflowService,
272
+ IMigrationService,
273
+ IHooksManager,
274
+ HookFunction,
275
+ ICacheService,
276
+ IFilesService,
277
+ IAssetsService,
278
+ INotificationService,
279
+ IReportService,
280
+ IStatsService,
281
+ // Plugin types
282
+ PluginType,
283
+ PluginMeta,
284
+ PluginSchemaDefinition,
285
+ PluginRouteContext,
286
+ PluginRouteHandler,
287
+ PluginRoute,
288
+ PluginHookEvent,
289
+ PluginHookContext,
290
+ PluginHookHandler,
291
+ PluginHook,
292
+ PluginContext,
293
+ PluginServiceFactory,
294
+ PluginService,
295
+ AuthProviderType,
296
+ OAuth2Config,
297
+ PluginAuthProvider,
298
+ PluginMiddleware,
299
+ PluginSchedule,
300
+ PluginDefinition,
301
+ PluginFactory,
302
+ BaasixPlugin,
303
+ LoadedPlugin,
304
+ PluginManagerOptions,
305
+ StartServerOptions,
306
+ // Express-typed plugin types (for core package)
307
+ ExpressPluginRouteHandler,
308
+ ExpressPluginRoute,
309
+ ExpressPluginMiddleware,
310
+ ExpressPluginContext,
311
+ } from "./plugin";
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
  }