@@ -5,9 +5,7 @@ export type RealtimeEventType = "create" | "update" | "delete";
55
66/**
77 * Payload received when a realtime event occurs.
8- *
9- * @typeParam T - The entity type for the data field. Defaults to `any`.
10- */
8+ g */
119export interface RealtimeEvent < T = any > {
1210 /** The type of change that occurred */
1311 type : RealtimeEventType ;
@@ -21,8 +19,6 @@ export interface RealtimeEvent<T = any> {
2119
2220/**
2321 * Callback function invoked when a realtime event occurs.
24- *
25- * @typeParam T - The entity type for the event data. Defaults to `any`.
2622 */
2723export type RealtimeCallback < T = any > = ( event : RealtimeEvent < T > ) => void ;
2824
@@ -46,34 +42,18 @@ export interface DeleteManyResult {
4642
4743/**
4844 * Result returned when importing entities from a file.
49- *
50- * @typeParam T - The entity type for imported records. Defaults to `any`.
5145 */
5246export interface ImportResult < T = any > {
5347 /** Status of the import operation */
5448 status : "success" | "error" ;
55- /** Details message, e.g., "Successfully imported 3 entities with RLS enforcement" */
49+ /** Details message */
5650 details : string | null ;
5751 /** Array of created entity objects when successful, or null on error */
5852 output : T [ ] | null ;
5953}
6054
6155/**
62- * Sort field type for entity queries.
63- *
64- * Supports ascending (no prefix or `'+'`) and descending (`'-'`) sorting.
65- *
66- * @typeParam T - The entity type to derive sortable fields from.
67- *
68- * @example
69- * ```typescript
70- * // Ascending sort (default)
71- * 'created_date'
72- * '+created_date'
73- *
74- * // Descending sort
75- * '-created_date'
76- * ```
56+ * Sort field for entity queries. Prefix with `-` for descending order.
7757 */
7858export type SortField < T > =
7959 | ( keyof T & string )
@@ -82,35 +62,14 @@ export type SortField<T> =
8262
8363/**
8464 * Registry mapping entity names to their TypeScript types.
85- *
86- * This interface is designed to be augmented by generated type declaration files.
87- * When augmented, it enables type-safe entity access throughout your application.
88- *
89- * @example
90- * ```typescript
91- * // In your generated types.d.ts file:
92- * declare module '@base44/sdk' {
93- * interface EntityTypeRegistry {
94- * Task: { title: string; completed: boolean };
95- * User: { email: string; name: string };
96- * }
97- * }
98- *
99- * // Then in your code:
100- * const task = await base44.entities.Task.create({
101- * title: 'Buy groceries', // ✅ Type-checked
102- * completed: false
103- * });
104- * ```
65+ * Augmented by `base44 types generate` to enable type-safe entity access.
10566 */
10667export interface EntityTypeRegistry { }
10768
10869/**
10970 * Entity handler providing CRUD operations for a specific entity type.
11071 *
11172 * Each entity in the app gets a handler with these methods for managing data.
112- *
113- * @typeParam T - The entity type. Defaults to `any` for backward compatibility.
11473 */
11574export interface EntityHandler < T = any > {
11675 /**
@@ -121,12 +80,11 @@ export interface EntityHandler<T = any> {
12180 *
12281 * **Note:** The maximum limit is 5,000 items per request.
12382 *
124- * @typeParam K - The fields to include in the response. Defaults to all fields.
12583 * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
12684 * @param limit - Maximum number of results to return. Defaults to `50`.
12785 * @param skip - Number of results to skip for pagination. Defaults to `0`.
12886 * @param fields - Array of field names to include in the response. Defaults to all fields.
129- * @returns Promise resolving to an array of records with selected fields .
87+ * @returns Promise resolving to an array of records.
13088 *
13189 * @example
13290 * ```typescript
@@ -168,15 +126,14 @@ export interface EntityHandler<T = any> {
168126 *
169127 * **Note:** The maximum limit is 5,000 items per request.
170128 *
171- * @typeParam K - The fields to include in the response. Defaults to all fields.
172129 * @param query - Query object with field-value pairs. Each key should be a field name
173130 * from your entity schema, and each value is the criteria to match. Records matching all
174131 * specified criteria are returned. Field names are case-sensitive.
175132 * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
176133 * @param limit - Maximum number of results to return. Defaults to `50`.
177134 * @param skip - Number of results to skip for pagination. Defaults to `0`.
178135 * @param fields - Array of field names to include in the response. Defaults to all fields.
179- * @returns Promise resolving to an array of filtered records with selected fields .
136+ * @returns Promise resolving to an array of filtered records.
180137 *
181138 * @example
182139 * ```typescript
@@ -328,7 +285,7 @@ export interface EntityHandler<T = any> {
328285 * status: 'completed',
329286 * priority: 'low'
330287 * });
331- * console.log('Deleted:', result);
288+ * console.log('Deleted:', result.deleted );
332289 * ```
333290 */
334291 deleteMany ( query : Partial < T > ) : Promise < DeleteManyResult > ;
@@ -361,7 +318,7 @@ export interface EntityHandler<T = any> {
361318 * The file format should match your entity structure. Requires a browser environment and can't be used in the backend.
362319 *
363320 * @param file - File object to import.
364- * @returns Promise resolving to the import result containing status, details, and created records .
321+ * @returns Promise resolving to the import result.
365322 *
366323 * @example
367324 * ```typescript
@@ -370,8 +327,8 @@ export interface EntityHandler<T = any> {
370327 * const file = event.target.files?.[0];
371328 * if (file) {
372329 * const result = await base44.entities.MyEntity.importEntities(file);
373- * if (result.status === 'success' && result.output ) {
374- * console.log(`Imported ${result.output.length} records`);
330+ * if (result.status === 'success') {
331+ * console.log(`Imported ${result.output? .length} records`);
375332 * }
376333 * }
377334 * };
@@ -409,15 +366,13 @@ export interface EntityHandler<T = any> {
409366
410367/**
411368 * Typed entities module - maps registry keys to typed handlers.
412- * Only used when EntityTypeRegistry is augmented.
413369 */
414370type TypedEntitiesModule = {
415371 [ K in keyof EntityTypeRegistry ] : EntityHandler < EntityTypeRegistry [ K ] > ;
416372} ;
417373
418374/**
419375 * Dynamic entities module - allows any entity name with untyped handler.
420- * Used as fallback and for entities not in the registry.
421376 */
422377type DynamicEntitiesModule = {
423378 [ entityName : string ] : EntityHandler < any > ;
@@ -432,7 +387,7 @@ type DynamicEntitiesModule = {
432387 * Entities are accessed dynamically using the pattern:
433388 * `base44.entities.EntityName.method()`
434389 *
435- * When {@link EntityTypeRegistry} is augmented (via generated types.d.ts ),
390+ * When {@link EntityTypeRegistry} is augmented (via `base44 types generate` ),
436391 * entity access becomes type-safe with autocomplete and type checking.
437392 *
438393 * This module is available to use with a client in all three authentication modes:
0 commit comments