@base44-preview/sdk 0.8.18-pr.117.2b7242d → 0.8.18-pr.117.7bd2ea5

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.
@@ -3,7 +3,7 @@ import { RoomsSocket } from "../utils/socket-utils.js";
3
3
  import { ModelFilterParams } from "../types.js";
4
4
  /**
5
5
  * Registry of agent names.
6
- * Augmented by `base44 types generate` to enable autocomplete for agent names.
6
+ * Augment this interface to enable autocomplete for agent names.
7
7
  */
8
8
  export interface AgentNameRegistry {
9
9
  }
@@ -4,7 +4,9 @@
4
4
  export type RealtimeEventType = "create" | "update" | "delete";
5
5
  /**
6
6
  * Payload received when a realtime event occurs.
7
- g */
7
+ *
8
+ * @typeParam T - The entity type for the data field. Defaults to `any`.
9
+ */
8
10
  export interface RealtimeEvent<T = any> {
9
11
  /** The type of change that occurred */
10
12
  type: RealtimeEventType;
@@ -17,6 +19,8 @@ export interface RealtimeEvent<T = any> {
17
19
  }
18
20
  /**
19
21
  * Callback function invoked when a realtime event occurs.
22
+ *
23
+ * @typeParam T - The entity type for the event data. Defaults to `any`.
20
24
  */
21
25
  export type RealtimeCallback<T = any> = (event: RealtimeEvent<T>) => void;
22
26
  /**
@@ -37,22 +41,38 @@ export interface DeleteManyResult {
37
41
  }
38
42
  /**
39
43
  * Result returned when importing entities from a file.
44
+ *
45
+ * @typeParam T - The entity type for imported records. Defaults to `any`.
40
46
  */
41
47
  export interface ImportResult<T = any> {
42
48
  /** Status of the import operation */
43
49
  status: "success" | "error";
44
- /** Details message */
50
+ /** Details message, e.g., "Successfully imported 3 entities with RLS enforcement" */
45
51
  details: string | null;
46
52
  /** Array of created entity objects when successful, or null on error */
47
53
  output: T[] | null;
48
54
  }
49
55
  /**
50
- * Sort field for entity queries. Prefix with `-` for descending order.
56
+ * Sort field type for entity queries.
57
+ *
58
+ * Supports ascending (no prefix or `'+'`) and descending (`'-'`) sorting.
59
+ *
60
+ * @typeParam T - The entity type to derive sortable fields from.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * // Ascending sort (default)
65
+ * 'created_date'
66
+ * '+created_date'
67
+ *
68
+ * // Descending sort
69
+ * '-created_date'
70
+ * ```
51
71
  */
52
72
  export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`;
53
73
  /**
54
74
  * Registry mapping entity names to their TypeScript types.
55
- * Augmented by `base44 types generate` to enable type-safe entity access.
75
+ * Augment this interface to enable type-safe entity access.
56
76
  */
57
77
  export interface EntityTypeRegistry {
58
78
  }
@@ -60,6 +80,8 @@ export interface EntityTypeRegistry {
60
80
  * Entity handler providing CRUD operations for a specific entity type.
61
81
  *
62
82
  * Each entity in the app gets a handler with these methods for managing data.
83
+ *
84
+ * @typeParam T - The entity type. Defaults to `any` for backward compatibility.
63
85
  */
64
86
  export interface EntityHandler<T = any> {
65
87
  /**
@@ -70,11 +92,12 @@ export interface EntityHandler<T = any> {
70
92
  *
71
93
  * **Note:** The maximum limit is 5,000 items per request.
72
94
  *
95
+ * @typeParam K - The fields to include in the response. Defaults to all fields.
73
96
  * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
74
97
  * @param limit - Maximum number of results to return. Defaults to `50`.
75
98
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
76
99
  * @param fields - Array of field names to include in the response. Defaults to all fields.
77
- * @returns Promise resolving to an array of records.
100
+ * @returns Promise resolving to an array of records with selected fields.
78
101
  *
79
102
  * @example
80
103
  * ```typescript
@@ -110,6 +133,7 @@ export interface EntityHandler<T = any> {
110
133
  *
111
134
  * **Note:** The maximum limit is 5,000 items per request.
112
135
  *
136
+ * @typeParam K - The fields to include in the response. Defaults to all fields.
113
137
  * @param query - Query object with field-value pairs. Each key should be a field name
114
138
  * from your entity schema, and each value is the criteria to match. Records matching all
115
139
  * specified criteria are returned. Field names are case-sensitive.
@@ -117,7 +141,7 @@ export interface EntityHandler<T = any> {
117
141
  * @param limit - Maximum number of results to return. Defaults to `50`.
118
142
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
119
143
  * @param fields - Array of field names to include in the response. Defaults to all fields.
120
- * @returns Promise resolving to an array of filtered records.
144
+ * @returns Promise resolving to an array of filtered records with selected fields.
121
145
  *
122
146
  * @example
123
147
  * ```typescript
@@ -289,7 +313,7 @@ export interface EntityHandler<T = any> {
289
313
  * The file format should match your entity structure. Requires a browser environment and can't be used in the backend.
290
314
  *
291
315
  * @param file - File object to import.
292
- * @returns Promise resolving to the import result.
316
+ * @returns Promise resolving to the import result containing status, details, and created records.
293
317
  *
294
318
  * @example
295
319
  * ```typescript
@@ -298,8 +322,8 @@ export interface EntityHandler<T = any> {
298
322
  * const file = event.target.files?.[0];
299
323
  * if (file) {
300
324
  * const result = await base44.entities.MyEntity.importEntities(file);
301
- * if (result.status === 'success') {
302
- * console.log(`Imported ${result.output?.length} records`);
325
+ * if (result.status === 'success' && result.output) {
326
+ * console.log(`Imported ${result.output.length} records`);
303
327
  * }
304
328
  * }
305
329
  * };
@@ -354,9 +378,6 @@ type DynamicEntitiesModule = {
354
378
  * Entities are accessed dynamically using the pattern:
355
379
  * `base44.entities.EntityName.method()`
356
380
  *
357
- * When {@link EntityTypeRegistry} is augmented (via `base44 types generate`),
358
- * entity access becomes type-safe with autocomplete and type checking.
359
- *
360
381
  * This module is available to use with a client in all three authentication modes:
361
382
  *
362
383
  * - **Anonymous or User authentication** (`base44.entities`): Access is scoped to the current user's permissions. Anonymous users can only access public entities, while authenticated users can access entities they have permission to view or modify.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Registry of function names.
3
- * Augmented by `base44 types generate` to enable autocomplete for function names.
3
+ * Augment this interface to enable autocomplete for function names.
4
4
  */
5
5
  export interface FunctionNameRegistry {
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.18-pr.117.2b7242d",
3
+ "version": "0.8.18-pr.117.7bd2ea5",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",