@baasix/types 1.0.1

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/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # @baasix/types
2
+
3
+ Shared TypeScript type definitions for Baasix packages.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @baasix/types
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import type {
15
+ // Auth types
16
+ User,
17
+ Role,
18
+ Permission,
19
+ Accountability,
20
+ AuthResponse,
21
+ AuthMode,
22
+
23
+ // Schema types
24
+ FieldType,
25
+ FieldDefinition,
26
+ SchemaDefinition,
27
+ RelationshipType,
28
+
29
+ // Query types
30
+ Filter,
31
+ FilterOperator,
32
+ OperatorName,
33
+ Sort,
34
+ QueryParams,
35
+ ReportQuery,
36
+ StatsQuery,
37
+
38
+ // Response types
39
+ PaginatedResponse,
40
+ SingleResponse,
41
+
42
+ // File types
43
+ FileMetadata,
44
+ UploadOptions,
45
+ ImportOptions,
46
+ ExportOptions,
47
+
48
+ // Spatial types
49
+ GeoJSONPoint,
50
+ GeoJSONGeometry,
51
+
52
+ // Cache types
53
+ CacheConfig,
54
+ ICacheAdapter,
55
+
56
+ // Workflow types
57
+ Workflow,
58
+ WorkflowExecution,
59
+
60
+ // Common types
61
+ BaseItem,
62
+ DeepPartial,
63
+ } from '@baasix/types';
64
+ ```
65
+
66
+ ## Package Structure
67
+
68
+ ```
69
+ src/
70
+ ├── index.ts # Main exports (aggregates all types)
71
+ ├── auth.ts # Authentication & authorization types
72
+ ├── schema.ts # Schema & field definition types
73
+ ├── query.ts # Query, filter, sort, aggregation, report & stats types
74
+ ├── response.ts # API response types
75
+ ├── files.ts # File, asset, import/export types
76
+ ├── workflow.ts # Workflow types
77
+ ├── notification.ts # Notification types
78
+ ├── spatial.ts # GeoJSON/spatial types
79
+ ├── cache.ts # Cache configuration & adapter types
80
+ ├── common.ts # Base types, utilities, settings, hooks, mail, seed
81
+ └── plugin.ts # Plugin system types (Express, services, hooks)
82
+ ```
83
+
84
+ ## Type Categories
85
+
86
+ ### Auth Types (`auth.ts`)
87
+
88
+ User and authentication types:
89
+ - `User`, `UserWithPassword`, `UserWithRolesAndPermissions`
90
+ - `Role`, `Permission`, `PermissionAction`, `PermissionData`, `CreatePermissionData`
91
+ - `Tenant`, `Session`, `AuthTokens`, `JWTPayload`
92
+ - `Accountability` - User context for permission checking
93
+ - `LoginCredentials`, `RegisterData`, `AuthResponse`
94
+ - `AuthStateEvent`, `AuthState`, `MagicLinkOptions`, `PasswordResetOptions`
95
+ - `OAuth2Tokens`, `OAuth2UserInfo`
96
+ - `AuthMode` - Authentication mode (`"jwt"` | `"cookie"`)
97
+
98
+ ### Schema Types (`schema.ts`)
99
+
100
+ Field and schema definition types:
101
+ - `FieldType`, `DefaultValueType`, `FieldValidationRules`, `FieldValues`
102
+ - `FieldDefinition`, `FlattenedField`, `FieldInfo`
103
+ - `IndexDefinition`, `SchemaDefinition`, `SchemaInfo`
104
+ - `SchemaValidation`, `FieldValidation`, `ValidationResult`
105
+ - `RelationshipType`, `AssociationType`, `RelationshipDefinition`
106
+ - `AssociationDefinition`, `IncludeConfig`, `ProcessedInclude`
107
+
108
+ ### Query Types (`query.ts`)
109
+
110
+ Filter, sort, pagination, and aggregation types:
111
+ - `FilterOperator`, `OperatorName` - All supported filter operators
112
+ - `Filter`, `FilterValue`, `FilterCondition`, `LogicalFilter`, `FilterObject`
113
+ - `Sort`, `SortDirection`, `SortItem`, `SortObject`
114
+ - `PaginationOptions`, `PaginationMetadata`
115
+ - `AggregateFunction`, `AggregateConfig`, `Aggregate`, `AggregateMapping`
116
+ - `DatePart`, `DateTruncPrecision`
117
+ - `QueryParams`, `QueryOptions`, `QueryContext`
118
+
119
+ Report and stats query types:
120
+ - `ReportConfig`, `ReportResult`, `ReportQuery`
121
+ - `StatsQuery`, `StatsResult`
122
+
123
+ ### Response Types (`response.ts`)
124
+
125
+ API response wrapper types:
126
+ - `PaginatedResponse<T>` - Paginated list response
127
+ - `SingleResponse<T>` - Single item response
128
+ - `MutationResponse<T>` - Create/update response
129
+ - `DeleteResponse` - Delete operation response
130
+ - `BulkResponse<T>` - Bulk operation response
131
+ - `ReadResult<T>` - Read operation result
132
+ - `ErrorResponse` - Error response
133
+
134
+ ### File Types (`files.ts`)
135
+
136
+ File and asset handling types:
137
+ - `FileMetadata`, `FileData`, `UploadOptions`, `InternalUploadedFile`
138
+ - `AssetTransformOptions`, `AssetQuery`, `ProcessedImage`
139
+ - `StorageProvider`, `StorageAdapter`
140
+
141
+ Import/Export types:
142
+ - `UploadedFile` - Uploaded file from multipart form
143
+ - `ImportOptions`, `ImportResult`
144
+ - `ExportOptions`, `ExportResult`
145
+
146
+ ### Workflow Types (`workflow.ts`)
147
+
148
+ Workflow automation types:
149
+ - `Workflow`, `WorkflowFlowData`, `WorkflowTrigger`
150
+ - `WorkflowNode`, `WorkflowNodeData`, `WorkflowEdge`
151
+ - `WorkflowExecution`, `WorkflowExecutionLog`
152
+ - `WorkflowTriggerType`, `WorkflowStatus`, `WorkflowExecutionStatus`
153
+
154
+ ### Notification Types (`notification.ts`)
155
+
156
+ Notification system types:
157
+ - `Notification`, `NotificationType`
158
+ - `NotificationOptions`, `SendNotificationData`
159
+
160
+ ### Spatial Types (`spatial.ts`)
161
+
162
+ GeoJSON/PostGIS compatible types:
163
+ - `GeoJSONPoint` - Point geometry `[longitude, latitude]`
164
+ - `GeoJSONLineString` - Line geometry
165
+ - `GeoJSONPolygon` - Polygon geometry
166
+ - `GeoJSONGeometry` - Union of all geometry types
167
+
168
+ ### Cache Types (`cache.ts`)
169
+
170
+ Caching system types:
171
+ - `CacheConfig` - Cache configuration (enabled, ttl, prefix)
172
+ - `CacheSetOptions` - Options for cache.set operations
173
+ - `CacheStrategy` - Cache strategy (`"explicit"` | `"all"`)
174
+ - `CacheEntry` - Cache entry structure
175
+ - `ICacheAdapter` - Interface for custom cache adapters
176
+
177
+ ### Common Types (`common.ts`)
178
+
179
+ Base and utility types:
180
+ - `BaseItem`, `TimestampedItem`, `SoftDeletableItem`
181
+ - `DeepPartial<T>`, `CollectionItem<T>`, `WithRequired<T, K>`, `WithOptional<T, K>`
182
+ - `KeysOfType<T, V>`, `AnyRecord`
183
+
184
+ Settings types:
185
+ - `Settings`, `TenantSettings`
186
+
187
+ Task types:
188
+ - `BackgroundTask`
189
+
190
+ Hook types:
191
+ - `HookEvent`, `HookContext`, `HookHandler`, `Hook`
192
+
193
+ Other types:
194
+ - `HttpMethod` - HTTP methods
195
+ - `MailOptions`, `SenderConfig` - Email types
196
+ - `SeedData`, `SeedResult` - Database seeding types
197
+
198
+ ### Plugin Types (`plugin.ts`)
199
+
200
+ Express types (re-exported from `@types/express`):
201
+ - `Request`, `Response`, `NextFunction`, `Express`, `Router`
202
+ - Aliases: `ExpressRequest`, `PluginRequest`, etc.
203
+
204
+ Service interfaces:
205
+ - `IItemsService`, `IPermissionService`, `IMailService`
206
+ - `IStorageService`, `ISettingsService`, `ISocketService`
207
+ - `IRealtimeService`, `ITasksService`, `IWorkflowService`
208
+ - `IMigrationService`, `IHooksManager`, `ICacheService`
209
+ - `IFilesService`, `IAssetsService`, `INotificationService`
210
+ - `IReportService`, `IStatsService`
211
+
212
+ Plugin definition types:
213
+ - `PluginType`, `PluginMeta`, `PluginDefinition`, `BaasixPlugin`
214
+ - `PluginRoute`, `PluginHook`, `PluginMiddleware`, `PluginSchedule`
215
+ - `PluginContext`, `PluginRouteContext`, `PluginHookContext`
216
+ - `PluginServiceFactory`, `PluginService`, `PluginAuthProvider`
217
+ - `StartServerOptions`, `PluginManagerOptions`, `LoadedPlugin`
218
+
219
+ ## Peer Dependencies
220
+
221
+ For Express types to work, you need `@types/express` installed:
222
+
223
+ ```bash
224
+ npm install -D @types/express
225
+ ```
226
+
227
+ ## Development
228
+
229
+ ```bash
230
+ # Install dependencies
231
+ npm install
232
+
233
+ # Build
234
+ npm run build
235
+
236
+ # Watch mode
237
+ npm run dev
238
+ ```
239
+
240
+ ## License
241
+
242
+ MIT