@base44-preview/sdk 0.8.18-pr.117.1fc9d15 → 0.8.18-pr.117.203ff32

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
+ * Augment this interface 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
@@ -57,8 +57,6 @@ export interface ImportResult<T = any> {
57
57
  *
58
58
  * Supports ascending (no prefix or `'+'`) and descending (`'-'`) sorting.
59
59
  *
60
- * @typeParam T - The entity type to derive sortable fields from.
61
- *
62
60
  * @example
63
61
  * ```typescript
64
62
  * // Ascending sort (default)
@@ -72,26 +70,7 @@ export interface ImportResult<T = any> {
72
70
  export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`;
73
71
  /**
74
72
  * 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
- * ```
73
+ * Augment this interface to enable type-safe entity access.
95
74
  */
96
75
  export interface EntityTypeRegistry {
97
76
  }
@@ -99,8 +78,6 @@ export interface EntityTypeRegistry {
99
78
  * Entity handler providing CRUD operations for a specific entity type.
100
79
  *
101
80
  * 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
81
  */
105
82
  export interface EntityHandler<T = any> {
106
83
  /**
@@ -116,7 +93,7 @@ export interface EntityHandler<T = any> {
116
93
  * @param limit - Maximum number of results to return. Defaults to `50`.
117
94
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
118
95
  * @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.
96
+ * @returns Promise resolving to an array of records.
120
97
  *
121
98
  * @example
122
99
  * ```typescript
@@ -160,7 +137,7 @@ export interface EntityHandler<T = any> {
160
137
  * @param limit - Maximum number of results to return. Defaults to `50`.
161
138
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
162
139
  * @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.
140
+ * @returns Promise resolving to an array of filtered records.
164
141
  *
165
142
  * @example
166
143
  * ```typescript
@@ -301,7 +278,7 @@ export interface EntityHandler<T = any> {
301
278
  * status: 'completed',
302
279
  * priority: 'low'
303
280
  * });
304
- * console.log('Deleted:', result);
281
+ * console.log('Deleted:', result.deleted);
305
282
  * ```
306
283
  */
307
284
  deleteMany(query: Partial<T>): Promise<DeleteManyResult>;
@@ -332,7 +309,7 @@ export interface EntityHandler<T = any> {
332
309
  * The file format should match your entity structure. Requires a browser environment and can't be used in the backend.
333
310
  *
334
311
  * @param file - File object to import.
335
- * @returns Promise resolving to the import result containing status, details, and created records.
312
+ * @returns Promise resolving to the import result.
336
313
  *
337
314
  * @example
338
315
  * ```typescript
@@ -341,8 +318,8 @@ export interface EntityHandler<T = any> {
341
318
  * const file = event.target.files?.[0];
342
319
  * if (file) {
343
320
  * const result = await base44.entities.MyEntity.importEntities(file);
344
- * if (result.status === 'success' && result.output) {
345
- * console.log(`Imported ${result.output.length} records`);
321
+ * if (result.status === 'success') {
322
+ * console.log(`Imported ${result.output?.length} records`);
346
323
  * }
347
324
  * }
348
325
  * };
@@ -378,14 +355,12 @@ export interface EntityHandler<T = any> {
378
355
  }
379
356
  /**
380
357
  * Typed entities module - maps registry keys to typed handlers.
381
- * Only used when EntityTypeRegistry is augmented.
382
358
  */
383
359
  type TypedEntitiesModule = {
384
360
  [K in keyof EntityTypeRegistry]: EntityHandler<EntityTypeRegistry[K]>;
385
361
  };
386
362
  /**
387
363
  * Dynamic entities module - allows any entity name with untyped handler.
388
- * Used as fallback and for entities not in the registry.
389
364
  */
390
365
  type DynamicEntitiesModule = {
391
366
  [entityName: string]: EntityHandler<any>;
@@ -399,9 +374,6 @@ type DynamicEntitiesModule = {
399
374
  * Entities are accessed dynamically using the pattern:
400
375
  * `base44.entities.EntityName.method()`
401
376
  *
402
- * When {@link EntityTypeRegistry} is augmented (via generated types.d.ts),
403
- * entity access becomes type-safe with autocomplete and type checking.
404
- *
405
377
  * This module is available to use with a client in all three authentication modes:
406
378
  *
407
379
  * - **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,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
+ * Augment this interface 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.203ff32",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",