@baasix/types
v1.0.2
Published
Shared TypeScript types for Baasix packages
Readme
@baasix/types
Shared TypeScript type definitions for Baasix packages.
Installation
npm install @baasix/typesUsage
import type {
// Auth types
User,
Role,
Permission,
Accountability,
AuthResponse,
AuthMode,
// Schema types
FieldType,
FieldDefinition,
SchemaDefinition,
RelationshipType,
// Query types
Filter,
FilterOperator,
OperatorName,
Sort,
QueryParams,
ReportQuery,
StatsQuery,
// Response types
PaginatedResponse,
SingleResponse,
// File types
FileMetadata,
UploadOptions,
ImportOptions,
ExportOptions,
// Spatial types
GeoJSONPoint,
GeoJSONGeometry,
// Cache types
CacheConfig,
ICacheAdapter,
// Workflow types
Workflow,
WorkflowExecution,
// Common types
BaseItem,
DeepPartial,
} from '@baasix/types';Package Structure
src/
├── index.ts # Main exports (aggregates all types)
├── auth.ts # Authentication & authorization types
├── schema.ts # Schema & field definition types
├── query.ts # Query, filter, sort, aggregation, report & stats types
├── response.ts # API response types
├── files.ts # File, asset, import/export types
├── workflow.ts # Workflow types
├── notification.ts # Notification types
├── spatial.ts # GeoJSON/spatial types
├── cache.ts # Cache configuration & adapter types
├── common.ts # Base types, utilities, settings, hooks, mail, seed
└── plugin.ts # Plugin system types (Express, services, hooks)Type Categories
Auth Types (auth.ts)
User and authentication types:
User,UserWithPassword,UserWithRolesAndPermissionsRole,Permission,PermissionAction,PermissionData,CreatePermissionDataTenant,Session,AuthTokens,JWTPayloadAccountability- User context for permission checkingLoginCredentials,RegisterData,AuthResponseAuthStateEvent,AuthState,MagicLinkOptions,PasswordResetOptionsOAuth2Tokens,OAuth2UserInfoAuthMode- Authentication mode ("jwt"|"cookie")
Schema Types (schema.ts)
Field and schema definition types:
FieldType,DefaultValueType,FieldValidationRules,FieldValuesFieldDefinition,FlattenedField,FieldInfoIndexDefinition,SchemaDefinition,SchemaInfoSchemaValidation,FieldValidation,ValidationResultRelationshipType,AssociationType,RelationshipDefinitionAssociationDefinition,IncludeConfig,ProcessedInclude
Query Types (query.ts)
Filter, sort, pagination, and aggregation types:
FilterOperator,OperatorName- All supported filter operatorsFilter,FilterValue,FilterCondition,LogicalFilter,FilterObjectSort,SortDirection,SortItem,SortObjectPaginationOptions,PaginationMetadataAggregateFunction,AggregateConfig,Aggregate,AggregateMappingDatePart,DateTruncPrecisionQueryParams,QueryOptions,QueryContext
Report and stats query types:
ReportConfig,ReportResult,ReportQueryStatsQuery,StatsResult
Response Types (response.ts)
API response wrapper types:
PaginatedResponse<T>- Paginated list responseSingleResponse<T>- Single item responseMutationResponse<T>- Create/update responseDeleteResponse- Delete operation responseBulkResponse<T>- Bulk operation responseReadResult<T>- Read operation resultErrorResponse- Error response
File Types (files.ts)
File and asset handling types:
FileMetadata,FileData,UploadOptions,InternalUploadedFileAssetTransformOptions,AssetQuery,ProcessedImageStorageProvider,StorageAdapter
Import/Export types:
UploadedFile- Uploaded file from multipart formImportOptions,ImportResultExportOptions,ExportResult
Workflow Types (workflow.ts)
Workflow automation types:
Workflow,WorkflowFlowData,WorkflowTriggerWorkflowNode,WorkflowNodeData,WorkflowEdgeWorkflowExecution,WorkflowExecutionLogWorkflowTriggerType,WorkflowStatus,WorkflowExecutionStatus
Notification Types (notification.ts)
Notification system types:
Notification,NotificationTypeNotificationOptions,SendNotificationData
Spatial Types (spatial.ts)
GeoJSON/PostGIS compatible types:
GeoJSONPoint- Point geometry[longitude, latitude]GeoJSONLineString- Line geometryGeoJSONPolygon- Polygon geometryGeoJSONGeometry- Union of all geometry types
Cache Types (cache.ts)
Caching system types:
CacheConfig- Cache configuration (enabled, ttl, prefix)CacheSetOptions- Options for cache.set operationsCacheStrategy- Cache strategy ("explicit"|"all")CacheEntry- Cache entry structureICacheAdapter- Interface for custom cache adapters
Common Types (common.ts)
Base and utility types:
BaseItem,TimestampedItem,SoftDeletableItemDeepPartial<T>,CollectionItem<T>,WithRequired<T, K>,WithOptional<T, K>KeysOfType<T, V>,AnyRecord
Settings types:
Settings,TenantSettings
Task types:
BackgroundTask
Hook types:
HookEvent,HookContext,HookHandler,Hook
Other types:
HttpMethod- HTTP methodsMailOptions,SenderConfig- Email typesSeedData,SeedResult- Database seeding types
Plugin Types (plugin.ts)
Express types (re-exported from @types/express):
Request,Response,NextFunction,Express,Router- Aliases:
ExpressRequest,PluginRequest, etc.
Service interfaces:
IItemsService,IPermissionService,IMailServiceIStorageService,ISettingsService,ISocketServiceIRealtimeService,ITasksService,IWorkflowServiceIMigrationService,IHooksManager,ICacheServiceIFilesService,IAssetsService,INotificationServiceIReportService,IStatsService
Plugin definition types:
PluginType,PluginMeta,PluginDefinition,BaasixPluginPluginRoute,PluginHook,PluginMiddleware,PluginSchedulePluginContext,PluginRouteContext,PluginHookContextPluginServiceFactory,PluginService,PluginAuthProviderStartServerOptions,PluginManagerOptions,LoadedPlugin
Peer Dependencies
For Express types to work, you need @types/express installed:
npm install -D @types/expressDevelopment
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run devLicense
MIT
