@base44-preview/sdk 0.8.18-pr.108.7e35c83 → 0.8.18-pr.108.d1f21b4

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.
@@ -39,37 +39,6 @@ export interface DeleteManyResult {
39
39
  /** Number of entities that were deleted */
40
40
  deleted: number;
41
41
  }
42
- /**
43
- * Result returned when importing entities from a file.
44
- *
45
- * @typeParam T - The entity type for imported records. Defaults to `any`.
46
- */
47
- export interface ImportResult<T = any> {
48
- /** Status of the import operation */
49
- status: "success" | "error";
50
- /** Details message, e.g., "Successfully imported 3 entities with RLS enforcement" */
51
- details: string | null;
52
- /** Array of created entity objects when successful, or null on error */
53
- output: T[] | null;
54
- }
55
- /**
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
- * ```
71
- */
72
- export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`;
73
42
  /**
74
43
  * Entity handler providing CRUD operations for a specific entity type.
75
44
  *
@@ -86,12 +55,11 @@ export interface EntityHandler<T = any> {
86
55
  *
87
56
  * **Note:** The maximum limit is 5,000 items per request.
88
57
  *
89
- * @typeParam K - The fields to include in the response. Defaults to all fields.
90
58
  * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
91
59
  * @param limit - Maximum number of results to return. Defaults to `50`.
92
60
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
93
61
  * @param fields - Array of field names to include in the response. Defaults to all fields.
94
- * @returns Promise resolving to an array of records with selected fields.
62
+ * @returns Promise resolving to an array of records.
95
63
  *
96
64
  * @example
97
65
  * ```typescript
@@ -118,7 +86,7 @@ export interface EntityHandler<T = any> {
118
86
  * const fields = await base44.entities.MyEntity.list('-created_date', 10, 0, ['name', 'status']);
119
87
  * ```
120
88
  */
121
- list<K extends keyof T = keyof T>(sort?: SortField<T>, limit?: number, skip?: number, fields?: K[]): Promise<Pick<T, K>[]>;
89
+ list(sort?: string, limit?: number, skip?: number, fields?: string[]): Promise<T[]>;
122
90
  /**
123
91
  * Filters records based on a query.
124
92
  *
@@ -127,7 +95,6 @@ export interface EntityHandler<T = any> {
127
95
  *
128
96
  * **Note:** The maximum limit is 5,000 items per request.
129
97
  *
130
- * @typeParam K - The fields to include in the response. Defaults to all fields.
131
98
  * @param query - Query object with field-value pairs. Each key should be a field name
132
99
  * from your entity schema, and each value is the criteria to match. Records matching all
133
100
  * specified criteria are returned. Field names are case-sensitive.
@@ -135,7 +102,7 @@ export interface EntityHandler<T = any> {
135
102
  * @param limit - Maximum number of results to return. Defaults to `50`.
136
103
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
137
104
  * @param fields - Array of field names to include in the response. Defaults to all fields.
138
- * @returns Promise resolving to an array of filtered records with selected fields.
105
+ * @returns Promise resolving to an array of filtered records.
139
106
  *
140
107
  * @example
141
108
  * ```typescript
@@ -177,7 +144,7 @@ export interface EntityHandler<T = any> {
177
144
  * );
178
145
  * ```
179
146
  */
180
- filter<K extends keyof T = keyof T>(query: Partial<T>, sort?: SortField<T>, limit?: number, skip?: number, fields?: K[]): Promise<Pick<T, K>[]>;
147
+ filter(query: Partial<T>, sort?: string, limit?: number, skip?: number, fields?: string[]): Promise<T[]>;
181
148
  /**
182
149
  * Gets a single record by ID.
183
150
  *
@@ -307,7 +274,7 @@ export interface EntityHandler<T = any> {
307
274
  * The file format should match your entity structure. Requires a browser environment and can't be used in the backend.
308
275
  *
309
276
  * @param file - File object to import.
310
- * @returns Promise resolving to the import result containing status, details, and created records.
277
+ * @returns Promise resolving to the import result.
311
278
  *
312
279
  * @example
313
280
  * ```typescript
@@ -316,14 +283,12 @@ export interface EntityHandler<T = any> {
316
283
  * const file = event.target.files?.[0];
317
284
  * if (file) {
318
285
  * const result = await base44.entities.MyEntity.importEntities(file);
319
- * if (result.status === 'success' && result.output) {
320
- * console.log(`Imported ${result.output.length} records`);
321
- * }
286
+ * console.log(`Imported ${result.count} records`);
322
287
  * }
323
288
  * };
324
289
  * ```
325
290
  */
326
- importEntities(file: File): Promise<ImportResult<T>>;
291
+ importEntities(file: File): Promise<any>;
327
292
  /**
328
293
  * Subscribes to realtime updates for all records of this entity type.
329
294
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.18-pr.108.7e35c83",
3
+ "version": "0.8.18-pr.108.d1f21b4",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",