@base44-preview/sdk 0.8.18-pr.91.cfad1b0 → 0.8.19-pr.124.bb33a2f

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.
package/dist/index.d.ts CHANGED
@@ -4,11 +4,11 @@ import { getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl } from
4
4
  export { createClient, createClientFromRequest, Base44Error, getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl, };
5
5
  export type { Base44Client, CreateClientConfig, CreateClientOptions, Base44ErrorJSON, };
6
6
  export * from "./types.js";
7
- export type { EntitiesModule, EntityHandler, RealtimeEventType, RealtimeEvent, RealtimeCallback, } from "./modules/entities.types.js";
7
+ export type { EntitiesModule, EntityHandler, EntityRecord, EntityTypeRegistry, RealtimeEventType, RealtimeEvent, RealtimeCallback, } from "./modules/entities.types.js";
8
8
  export type { AuthModule, LoginResponse, RegisterParams, VerifyOtpParams, ChangePasswordParams, ResetPasswordParams, User, } from "./modules/auth.types.js";
9
9
  export type { IntegrationsModule, IntegrationPackage, IntegrationEndpointFunction, CoreIntegrations, InvokeLLMParams, GenerateImageParams, GenerateImageResult, UploadFileParams, UploadFileResult, SendEmailParams, SendEmailResult, ExtractDataFromUploadedFileParams, ExtractDataFromUploadedFileResult, UploadPrivateFileParams, UploadPrivateFileResult, CreateFileSignedUrlParams, CreateFileSignedUrlResult, } from "./modules/integrations.types.js";
10
- export type { FunctionsModule } from "./modules/functions.types.js";
11
- export type { AgentsModule, AgentConversation, AgentMessage, AgentMessageReasoning, AgentMessageToolCall, AgentMessageUsage, AgentMessageCustomContext, AgentMessageMetadata, CreateConversationParams, } from "./modules/agents.types.js";
10
+ export type { FunctionsModule, FunctionNameRegistry, } from "./modules/functions.types.js";
11
+ export type { AgentsModule, AgentNameRegistry, AgentConversation, AgentMessage, AgentMessageReasoning, AgentMessageToolCall, AgentMessageUsage, AgentMessageCustomContext, AgentMessageMetadata, CreateConversationParams, } from "./modules/agents.types.js";
12
12
  export type { AppLogsModule } from "./modules/app-logs.types.js";
13
13
  export type { SsoModule, SsoAccessTokenResponse } from "./modules/sso.types.js";
14
14
  export type { ConnectorsModule } from "./modules/connectors.types.js";
@@ -1,6 +1,16 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { RoomsSocket } from "../utils/socket-utils.js";
3
3
  import { ModelFilterParams } from "../types.js";
4
+ /**
5
+ * Registry of agent names.
6
+ * Augment this interface to enable autocomplete for agent names.
7
+ */
8
+ export interface AgentNameRegistry {
9
+ }
10
+ /**
11
+ * Agent name type - uses registry keys if augmented, otherwise string.
12
+ */
13
+ export type AgentName = keyof AgentNameRegistry extends never ? string : keyof AgentNameRegistry;
4
14
  /**
5
15
  * Reasoning information for an agent message.
6
16
  *
@@ -127,7 +137,7 @@ export interface AgentMessage {
127
137
  */
128
138
  export interface CreateConversationParams {
129
139
  /** The name of the agent to create a conversation with. */
130
- agent_name: string;
140
+ agent_name: AgentName;
131
141
  /** Optional metadata to attach to the conversation. */
132
142
  metadata?: Record<string, any>;
133
143
  }
@@ -171,7 +181,7 @@ export interface AgentsModuleConfig {
171
181
  *
172
182
  * This module is available to use with a client in all authentication modes:
173
183
  *
174
- * - **Anonymous or User authentication** (`base44.agents`): Access is scoped to the current user's permissions. Anonymous users can create conversations but can't retrieve them later, while authenticated users can access conversations they created.
184
+ * - **Anonymous or User authentication** (`base44.agents`): Access is scoped to the current user's permissions. Users must be authenticated to create and access conversations.
175
185
  * - **Service role authentication** (`base44.asServiceRole.agents`): Operations have elevated admin-level permissions. Can access all conversations that the app's admin role has access to.
176
186
  *
177
187
  */
@@ -200,6 +210,8 @@ export interface AgentsModule {
200
210
  * Retrieves a single conversation using its unique identifier. To retrieve
201
211
  * all conversations, use {@linkcode getConversations | getConversations()} To filter, sort, or paginate conversations, use {@linkcode listConversations | listConversations()}.
202
212
  *
213
+ * This function returns the complete stored conversation including full tool call results, even for large responses.
214
+ *
203
215
  * @param conversationId - The unique identifier of the conversation.
204
216
  * @returns Promise resolving to the conversation, or undefined if not found.
205
217
  *
@@ -298,6 +310,10 @@ export interface AgentsModule {
298
310
  * Establishes a WebSocket connection to receive instant updates when new
299
311
  * messages are added to the conversation. Returns an unsubscribe function
300
312
  * to clean up the connection.
313
+ *
314
+ * <Note>
315
+ When receiving messages through this function, tool call data is truncated for efficiency. The `arguments_string` is limited to 500 characters and `results` to 50 characters. The complete tool call data is always saved in storage and can be retrieved by calling {@linkcode getConversation | getConversation()} after the message completes.
316
+ </Note>
301
317
  *
302
318
  * @param conversationId - The conversation ID to subscribe to.
303
319
  * @param onUpdate - Callback function called when the conversation is updated. The callback receives a conversation object with the following properties:
@@ -342,5 +358,5 @@ export interface AgentsModule {
342
358
  * // User can open this URL to start a WhatsApp conversation
343
359
  * ```
344
360
  */
345
- getWhatsAppConnectURL(agentName: string): string;
361
+ getWhatsAppConnectURL(agentName: AgentName): string;
346
362
  }
@@ -1,7 +1,14 @@
1
+ /**
2
+ * Registry of connector integration types.
3
+ * Augment this interface to enable autocomplete for connector integration types.
4
+ */
5
+ export interface ConnectorIntegrationTypeRegistry {
6
+ }
1
7
  /**
2
8
  * The type of external integration/connector, such as `'googlecalendar'`, `'slack'`, or `'github'`.
9
+ * Uses registry keys if augmented, otherwise falls back to string.
3
10
  */
4
- export type ConnectorIntegrationType = string;
11
+ export type ConnectorIntegrationType = keyof ConnectorIntegrationTypeRegistry extends never ? string : keyof ConnectorIntegrationTypeRegistry;
5
12
  /**
6
13
  * Response from the connectors access token endpoint.
7
14
  */
@@ -70,6 +70,35 @@ export interface ImportResult<T = any> {
70
70
  * ```
71
71
  */
72
72
  export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`;
73
+ /**
74
+ * Fields added by the server to every entity record (id, dates, created_by, etc.).
75
+ */
76
+ interface ServerEntityFields {
77
+ /** Unique identifier of the record */
78
+ id: string;
79
+ /** ISO 8601 timestamp when the record was created */
80
+ created_date: string;
81
+ /** ISO 8601 timestamp when the record was last updated */
82
+ updated_date: string;
83
+ /** Email of the user who created the record (may be hidden in some responses) */
84
+ created_by?: string | null;
85
+ /** ID of the user who created the record */
86
+ created_by_id?: string | null;
87
+ /** Whether the record is sample/seed data */
88
+ is_sample?: boolean;
89
+ }
90
+ /**
91
+ * Registry mapping entity names to their TypeScript types.
92
+ * Augment this interface with your entity schema (user-defined fields only).
93
+ */
94
+ export interface EntityTypeRegistry {
95
+ }
96
+ /**
97
+ * Full record type for each entity: schema fields + server-injected fields (id, created_date, etc.).
98
+ */
99
+ export type EntityRecord = {
100
+ [K in keyof EntityTypeRegistry]: EntityTypeRegistry[K] & ServerEntityFields;
101
+ };
73
102
  /**
74
103
  * Entity handler providing CRUD operations for a specific entity type.
75
104
  *
@@ -276,7 +305,7 @@ export interface EntityHandler<T = any> {
276
305
  * status: 'completed',
277
306
  * priority: 'low'
278
307
  * });
279
- * console.log('Deleted:', result);
308
+ * console.log('Deleted:', result.deleted);
280
309
  * ```
281
310
  */
282
311
  deleteMany(query: Partial<T>): Promise<DeleteManyResult>;
@@ -351,6 +380,18 @@ export interface EntityHandler<T = any> {
351
380
  */
352
381
  subscribe(callback: RealtimeCallback<T>): () => void;
353
382
  }
383
+ /**
384
+ * Typed entities module - maps registry keys to typed handlers (full record type).
385
+ */
386
+ type TypedEntitiesModule = {
387
+ [K in keyof EntityTypeRegistry]: EntityHandler<EntityRecord[K]>;
388
+ };
389
+ /**
390
+ * Dynamic entities module - allows any entity name with untyped handler.
391
+ */
392
+ type DynamicEntitiesModule = {
393
+ [entityName: string]: EntityHandler<any>;
394
+ };
354
395
  /**
355
396
  * Entities module for managing app data.
356
397
  *
@@ -384,18 +425,5 @@ export interface EntityHandler<T = any> {
384
425
  * const allUsers = await base44.asServiceRole.entities.User.list();
385
426
  * ```
386
427
  */
387
- export interface EntitiesModule {
388
- /**
389
- * Access any entity by name.
390
- *
391
- * Use this to access entities defined in the app.
392
- *
393
- * @example
394
- * ```typescript
395
- * // Access entities dynamically
396
- * base44.entities.MyEntity
397
- * base44.entities.AnotherEntity
398
- * ```
399
- */
400
- [entityName: string]: EntityHandler<any>;
401
- }
428
+ export type EntitiesModule = TypedEntitiesModule & DynamicEntitiesModule;
429
+ export {};
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Registry of function names.
3
+ * Augment this interface to enable autocomplete for function names.
4
+ */
5
+ export interface FunctionNameRegistry {
6
+ }
7
+ /**
8
+ * Function name type - uses registry keys if augmented, otherwise string.
9
+ */
10
+ export type FunctionName = keyof FunctionNameRegistry extends never ? string : keyof FunctionNameRegistry;
1
11
  /**
2
12
  * Functions module for invoking custom backend functions.
3
13
  *
@@ -46,5 +56,5 @@ export interface FunctionsModule {
46
56
  * };
47
57
  * ```
48
58
  */
49
- invoke(functionName: string, data: Record<string, any>): Promise<any>;
59
+ invoke(functionName: FunctionName, data?: Record<string, any>): Promise<any>;
50
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.18-pr.91.cfad1b0",
3
+ "version": "0.8.19-pr.124.bb33a2f",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",