@base44-preview/sdk 0.8.18-pr.117.1fc9d15 → 0.8.18-pr.117.2b7242d

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,30 +3,12 @@ import { RoomsSocket } from "../utils/socket-utils.js";
3
3
  import { ModelFilterParams } from "../types.js";
4
4
  /**
5
5
  * Registry of agent names.
6
- *
7
- * This interface is designed to be augmented by generated type declaration files.
8
- * When augmented, it enables autocomplete for agent names in methods like `createConversation`.
9
- *
10
- * @example
11
- * ```typescript
12
- * // In your generated types.d.ts file:
13
- * declare module '@base44/sdk' {
14
- * interface AgentNameRegistry {
15
- * support_agent: true;
16
- * sales_bot: true;
17
- * }
18
- * }
19
- *
20
- * // Then in your code:
21
- * await base44.agents.createConversation({
22
- * agent_name: 'support_agent' // ✅ Autocomplete shows: 'support_agent' | 'sales_bot'
23
- * });
24
- * ```
6
+ * Augmented by `base44 types generate` to enable autocomplete for agent names.
25
7
  */
26
8
  export interface AgentNameRegistry {
27
9
  }
28
10
  /**
29
- * Agent name type - uses registry keys if augmented, otherwise falls back to string.
11
+ * Agent name type - uses registry keys if augmented, otherwise string.
30
12
  */
31
13
  export type AgentName = keyof AgentNameRegistry extends never ? string : keyof AgentNameRegistry;
32
14
  /**
@@ -154,7 +136,7 @@ export interface AgentMessage {
154
136
  * Parameters for creating a new conversation.
155
137
  */
156
138
  export interface CreateConversationParams {
157
- /** The name of the agent to create a conversation with. When AgentNameRegistry is augmented, provides autocomplete. */
139
+ /** The name of the agent to create a conversation with. */
158
140
  agent_name: AgentName;
159
141
  /** Optional metadata to attach to the conversation. */
160
142
  metadata?: Record<string, any>;
@@ -359,7 +341,7 @@ export interface AgentsModule {
359
341
  * Generates a URL that users can use to connect with the agent through WhatsApp.
360
342
  * The URL includes authentication if a token is available.
361
343
  *
362
- * @param agentName - The name of the agent. When AgentNameRegistry is augmented, provides autocomplete.
344
+ * @param agentName - The name of the agent.
363
345
  * @returns WhatsApp connection URL.
364
346
  *
365
347
  * @example
@@ -4,9 +4,7 @@
4
4
  export type RealtimeEventType = "create" | "update" | "delete";
5
5
  /**
6
6
  * Payload received when a realtime event occurs.
7
- *
8
- * @typeParam T - The entity type for the data field. Defaults to `any`.
9
- */
7
+ g */
10
8
  export interface RealtimeEvent<T = any> {
11
9
  /** The type of change that occurred */
12
10
  type: RealtimeEventType;
@@ -19,8 +17,6 @@ export interface RealtimeEvent<T = any> {
19
17
  }
20
18
  /**
21
19
  * Callback function invoked when a realtime event occurs.
22
- *
23
- * @typeParam T - The entity type for the event data. Defaults to `any`.
24
20
  */
25
21
  export type RealtimeCallback<T = any> = (event: RealtimeEvent<T>) => void;
26
22
  /**
@@ -41,57 +37,22 @@ export interface DeleteManyResult {
41
37
  }
42
38
  /**
43
39
  * Result returned when importing entities from a file.
44
- *
45
- * @typeParam T - The entity type for imported records. Defaults to `any`.
46
40
  */
47
41
  export interface ImportResult<T = any> {
48
42
  /** Status of the import operation */
49
43
  status: "success" | "error";
50
- /** Details message, e.g., "Successfully imported 3 entities with RLS enforcement" */
44
+ /** Details message */
51
45
  details: string | null;
52
46
  /** Array of created entity objects when successful, or null on error */
53
47
  output: T[] | null;
54
48
  }
55
49
  /**
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
- * ```
50
+ * Sort field for entity queries. Prefix with `-` for descending order.
71
51
  */
72
52
  export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`;
73
53
  /**
74
54
  * Registry mapping entity names to their TypeScript types.
75
- *
76
- * This interface is designed to be augmented by generated type declaration files.
77
- * When augmented, it enables type-safe entity access throughout your application.
78
- *
79
- * @example
80
- * ```typescript
81
- * // In your generated types.d.ts file:
82
- * declare module '@base44/sdk' {
83
- * interface EntityTypeRegistry {
84
- * Task: { title: string; completed: boolean };
85
- * User: { email: string; name: string };
86
- * }
87
- * }
88
- *
89
- * // Then in your code:
90
- * const task = await base44.entities.Task.create({
91
- * title: 'Buy groceries', // ✅ Type-checked
92
- * completed: false
93
- * });
94
- * ```
55
+ * Augmented by `base44 types generate` to enable type-safe entity access.
95
56
  */
96
57
  export interface EntityTypeRegistry {
97
58
  }
@@ -99,8 +60,6 @@ export interface EntityTypeRegistry {
99
60
  * Entity handler providing CRUD operations for a specific entity type.
100
61
  *
101
62
  * Each entity in the app gets a handler with these methods for managing data.
102
- *
103
- * @typeParam T - The entity type. Defaults to `any` for backward compatibility.
104
63
  */
105
64
  export interface EntityHandler<T = any> {
106
65
  /**
@@ -111,12 +70,11 @@ export interface EntityHandler<T = any> {
111
70
  *
112
71
  * **Note:** The maximum limit is 5,000 items per request.
113
72
  *
114
- * @typeParam K - The fields to include in the response. Defaults to all fields.
115
73
  * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
116
74
  * @param limit - Maximum number of results to return. Defaults to `50`.
117
75
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
118
76
  * @param fields - Array of field names to include in the response. Defaults to all fields.
119
- * @returns Promise resolving to an array of records with selected fields.
77
+ * @returns Promise resolving to an array of records.
120
78
  *
121
79
  * @example
122
80
  * ```typescript
@@ -152,7 +110,6 @@ export interface EntityHandler<T = any> {
152
110
  *
153
111
  * **Note:** The maximum limit is 5,000 items per request.
154
112
  *
155
- * @typeParam K - The fields to include in the response. Defaults to all fields.
156
113
  * @param query - Query object with field-value pairs. Each key should be a field name
157
114
  * from your entity schema, and each value is the criteria to match. Records matching all
158
115
  * specified criteria are returned. Field names are case-sensitive.
@@ -160,7 +117,7 @@ export interface EntityHandler<T = any> {
160
117
  * @param limit - Maximum number of results to return. Defaults to `50`.
161
118
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
162
119
  * @param fields - Array of field names to include in the response. Defaults to all fields.
163
- * @returns Promise resolving to an array of filtered records with selected fields.
120
+ * @returns Promise resolving to an array of filtered records.
164
121
  *
165
122
  * @example
166
123
  * ```typescript
@@ -301,7 +258,7 @@ export interface EntityHandler<T = any> {
301
258
  * status: 'completed',
302
259
  * priority: 'low'
303
260
  * });
304
- * console.log('Deleted:', result);
261
+ * console.log('Deleted:', result.deleted);
305
262
  * ```
306
263
  */
307
264
  deleteMany(query: Partial<T>): Promise<DeleteManyResult>;
@@ -332,7 +289,7 @@ export interface EntityHandler<T = any> {
332
289
  * The file format should match your entity structure. Requires a browser environment and can't be used in the backend.
333
290
  *
334
291
  * @param file - File object to import.
335
- * @returns Promise resolving to the import result containing status, details, and created records.
292
+ * @returns Promise resolving to the import result.
336
293
  *
337
294
  * @example
338
295
  * ```typescript
@@ -341,8 +298,8 @@ export interface EntityHandler<T = any> {
341
298
  * const file = event.target.files?.[0];
342
299
  * if (file) {
343
300
  * const result = await base44.entities.MyEntity.importEntities(file);
344
- * if (result.status === 'success' && result.output) {
345
- * console.log(`Imported ${result.output.length} records`);
301
+ * if (result.status === 'success') {
302
+ * console.log(`Imported ${result.output?.length} records`);
346
303
  * }
347
304
  * }
348
305
  * };
@@ -378,14 +335,12 @@ export interface EntityHandler<T = any> {
378
335
  }
379
336
  /**
380
337
  * Typed entities module - maps registry keys to typed handlers.
381
- * Only used when EntityTypeRegistry is augmented.
382
338
  */
383
339
  type TypedEntitiesModule = {
384
340
  [K in keyof EntityTypeRegistry]: EntityHandler<EntityTypeRegistry[K]>;
385
341
  };
386
342
  /**
387
343
  * Dynamic entities module - allows any entity name with untyped handler.
388
- * Used as fallback and for entities not in the registry.
389
344
  */
390
345
  type DynamicEntitiesModule = {
391
346
  [entityName: string]: EntityHandler<any>;
@@ -399,7 +354,7 @@ type DynamicEntitiesModule = {
399
354
  * Entities are accessed dynamically using the pattern:
400
355
  * `base44.entities.EntityName.method()`
401
356
  *
402
- * When {@link EntityTypeRegistry} is augmented (via generated types.d.ts),
357
+ * When {@link EntityTypeRegistry} is augmented (via `base44 types generate`),
403
358
  * entity access becomes type-safe with autocomplete and type checking.
404
359
  *
405
360
  * This module is available to use with a client in all three authentication modes:
@@ -1,29 +1,11 @@
1
1
  /**
2
2
  * Registry of function names.
3
- *
4
- * This interface is designed to be augmented by generated type declaration files.
5
- * When augmented, it enables autocomplete for function names in the `invoke` method.
6
- *
7
- * @example
8
- * ```typescript
9
- * // In your generated types.d.ts file:
10
- * declare module '@base44/sdk' {
11
- * interface FunctionNameRegistry {
12
- * calculateTotal: true;
13
- * processImage: true;
14
- * }
15
- * }
16
- *
17
- * // Then in your code:
18
- * await base44.functions.invoke('calculateTotal', { ... });
19
- * // ^^^^^^^^^^^^^^^^
20
- * // ✅ Autocomplete shows: 'calculateTotal' | 'processImage'
21
- * ```
3
+ * Augmented by `base44 types generate` to enable autocomplete for function names.
22
4
  */
23
5
  export interface FunctionNameRegistry {
24
6
  }
25
7
  /**
26
- * Function name type - uses registry keys if augmented, otherwise falls back to string.
8
+ * Function name type - uses registry keys if augmented, otherwise string.
27
9
  */
28
10
  export type FunctionName = keyof FunctionNameRegistry extends never ? string : keyof FunctionNameRegistry;
29
11
  /**
@@ -45,7 +27,7 @@ export interface FunctionsModule {
45
27
  * the result. If any parameter is a `File` object, the request will automatically be
46
28
  * sent as `multipart/form-data`. Otherwise, it will be sent as JSON.
47
29
  *
48
- * @param functionName - The name of the function to invoke. When FunctionNameRegistry is augmented, provides autocomplete.
30
+ * @param functionName - The name of the function to invoke.
49
31
  * @param data - An object containing named parameters for the function.
50
32
  * @returns Promise resolving to the function's response. The `data` property contains the data returned by the function, if there is any.
51
33
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.18-pr.117.1fc9d15",
3
+ "version": "0.8.18-pr.117.2b7242d",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",