@base44-preview/sdk 0.8.19-pr.124.bb33a2f → 0.8.19-pr.127.3d92214

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, EntityRecord, EntityTypeRegistry, RealtimeEventType, RealtimeEvent, RealtimeCallback, } from "./modules/entities.types.js";
7
+ export type { DeleteManyResult, DeleteResult, EntitiesModule, EntityHandler, EntityRecord, EntityTypeRegistry, ImportResult, 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, FunctionNameRegistry, } from "./modules/functions.types.js";
11
- export type { AgentsModule, AgentNameRegistry, AgentConversation, AgentMessage, AgentMessageReasoning, AgentMessageToolCall, AgentMessageUsage, AgentMessageCustomContext, AgentMessageMetadata, CreateConversationParams, } from "./modules/agents.types.js";
10
+ export type { FunctionsModule, FunctionName, FunctionNameRegistry, } from "./modules/functions.types.js";
11
+ export type { AgentsModule, AgentName, 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";
@@ -2,13 +2,19 @@ import { AxiosInstance } from "axios";
2
2
  import { RoomsSocket } from "../utils/socket-utils.js";
3
3
  import { ModelFilterParams } from "../types.js";
4
4
  /**
5
- * Registry of agent names.
6
- * Augment this interface to enable autocomplete for agent names.
5
+ * Registry of agent names. The [`types generate`](/developers/references/cli/commands/types-generate) command fills this registry, then [`AgentName`](#agentname) resolves to a union of the keys.
7
6
  */
8
7
  export interface AgentNameRegistry {
9
8
  }
10
9
  /**
11
- * Agent name type - uses registry keys if augmented, otherwise string.
10
+ * Union of all agent names from the [`AgentNameRegistry`](#agentnameregistry). Defaults to `string` when no types have been generated.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Using generated agent name types
15
+ * // With generated types, you get autocomplete on agent names
16
+ * const conversation = await base44.agents.createConversation({ agent_name: 'SupportBot' });
17
+ * ```
12
18
  */
13
19
  export type AgentName = keyof AgentNameRegistry extends never ? string : keyof AgentNameRegistry;
14
20
  /**
@@ -184,6 +190,9 @@ export interface AgentsModuleConfig {
184
190
  * - **Anonymous or User authentication** (`base44.agents`): Access is scoped to the current user's permissions. Users must be authenticated to create and access conversations.
185
191
  * - **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.
186
192
  *
193
+ * ## Generated Types
194
+ *
195
+ * If you're working in a TypeScript project, you can generate types from your agents to get autocomplete on agent names when creating conversations or subscribing to updates. See the [Generated Types](/developers/references/sdk/getting-started/generated-types) guide to get started.
187
196
  */
188
197
  export interface AgentsModule {
189
198
  /**
@@ -208,7 +217,7 @@ export interface AgentsModule {
208
217
  * Gets a specific conversation by ID.
209
218
  *
210
219
  * Retrieves a single conversation using its unique identifier. To retrieve
211
- * all conversations, use {@linkcode getConversations | getConversations()} To filter, sort, or paginate conversations, use {@linkcode listConversations | listConversations()}.
220
+ * all conversations, use {@linkcode getConversations | getConversations()}. To filter, sort, or paginate conversations, use {@linkcode listConversations | listConversations()}.
212
221
  *
213
222
  * This function returns the complete stored conversation including full tool call results, even for large responses.
214
223
  *
@@ -312,8 +321,8 @@ export interface AgentsModule {
312
321
  * to clean up the connection.
313
322
  *
314
323
  * <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>
324
+ * 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.
325
+ * </Note>
317
326
  *
318
327
  * @param conversationId - The conversation ID to subscribe to.
319
328
  * @param onUpdate - Callback function called when the conversation is updated. The callback receives a conversation object with the following properties:
@@ -27,16 +27,16 @@ export type RealtimeCallback<T = any> = (event: RealtimeEvent<T>) => void;
27
27
  * Result returned when deleting a single entity.
28
28
  */
29
29
  export interface DeleteResult {
30
- /** Whether the deletion was successful */
30
+ /** Whether the deletion was successful. */
31
31
  success: boolean;
32
32
  }
33
33
  /**
34
34
  * Result returned when deleting multiple entities.
35
35
  */
36
36
  export interface DeleteManyResult {
37
- /** Whether the deletion was successful */
37
+ /** Whether the deletion was successful. */
38
38
  success: boolean;
39
- /** Number of entities that were deleted */
39
+ /** Number of entities that were deleted. */
40
40
  deleted: number;
41
41
  }
42
42
  /**
@@ -45,11 +45,11 @@ export interface DeleteManyResult {
45
45
  * @typeParam T - The entity type for imported records. Defaults to `any`.
46
46
  */
47
47
  export interface ImportResult<T = any> {
48
- /** Status of the import operation */
48
+ /** Status of the import operation. */
49
49
  status: "success" | "error";
50
- /** Details message, e.g., "Successfully imported 3 entities with RLS enforcement" */
50
+ /** Details message, e.g., "Successfully imported 3 entities with RLS enforcement". */
51
51
  details: string | null;
52
- /** Array of created entity objects when successful, or null on error */
52
+ /** Array of created entity objects when successful, or null on error. */
53
53
  output: T[] | null;
54
54
  }
55
55
  /**
@@ -88,13 +88,33 @@ interface ServerEntityFields {
88
88
  is_sample?: boolean;
89
89
  }
90
90
  /**
91
- * Registry mapping entity names to their TypeScript types.
92
- * Augment this interface with your entity schema (user-defined fields only).
91
+ * Registry mapping entity names to their TypeScript types. The [`types generate`](/developers/references/cli/commands/types-generate) command fills this registry, then [`EntityRecord`](#entityrecord) adds server fields.
93
92
  */
94
93
  export interface EntityTypeRegistry {
95
94
  }
96
95
  /**
97
- * Full record type for each entity: schema fields + server-injected fields (id, created_date, etc.).
96
+ * Combines the [`EntityTypeRegistry`](#entitytyperegistry) schemas with server fields like `id`, `created_date`, and `updated_date` to give the complete record type for each entity. Use this when you need to type variables holding entity data.
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * // Type-safe entity records
101
+ * import type { EntityRecord } from '@base44/sdk';
102
+ * // Import your generated entity schema
103
+ * import type { Task } from '@/base44/.types/types';
104
+ *
105
+ * // Combine your schema with server fields (id, created_date, etc.)
106
+ * type TaskRecord = EntityRecord['Task'];
107
+ *
108
+ * const task: TaskRecord = await base44.entities.Task.create({
109
+ * title: 'My task',
110
+ * status: 'pending'
111
+ * });
112
+ *
113
+ * // Task now includes both your fields and server fields:
114
+ * console.log(task.id); // Server field
115
+ * console.log(task.created_date); // Server field
116
+ * console.log(task.title); // Your field
117
+ * ```
98
118
  */
99
119
  export type EntityRecord = {
100
120
  [K in keyof EntityTypeRegistry]: EntityTypeRegistry[K] & ServerEntityFields;
@@ -401,7 +421,7 @@ type DynamicEntitiesModule = {
401
421
  * Entities are accessed dynamically using the pattern:
402
422
  * `base44.entities.EntityName.method()`
403
423
  *
404
- * This module is available to use with a client in all three authentication modes:
424
+ * This module is available to use with a client in all authentication modes:
405
425
  *
406
426
  * - **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.
407
427
  * - **Service role authentication** (`base44.asServiceRole.entities`): Operations have elevated admin-level permissions. Can access all entities that the app's admin role has access to.
@@ -412,6 +432,10 @@ type DynamicEntitiesModule = {
412
432
  *
413
433
  * Regular users can only read and update their own user record. With service role authentication, you can read, update, and delete any user. You can't create users using the entities module. Instead, use the functions of the {@link AuthModule | auth module} to invite or register new users.
414
434
  *
435
+ * ## Generated Types
436
+ *
437
+ * If you're working in a TypeScript project, you can generate types from your entity schemas to get autocomplete and type checking on all entity methods. See the [Generated Types](/developers/references/sdk/getting-started/generated-types) guide to get started.
438
+ *
415
439
  * @example
416
440
  * ```typescript
417
441
  * // Get all records from the MyEntity entity
@@ -1,11 +1,17 @@
1
1
  /**
2
- * Registry of function names.
3
- * Augment this interface to enable autocomplete for function names.
2
+ * Registry of function names. The [`types generate`](/developers/references/cli/commands/types-generate) command fills this registry, then [`FunctionName`](#functionname) resolves to a union of the keys.
4
3
  */
5
4
  export interface FunctionNameRegistry {
6
5
  }
7
6
  /**
8
- * Function name type - uses registry keys if augmented, otherwise string.
7
+ * Union of all function names from the [`FunctionNameRegistry`](#functionnameregistry). Defaults to `string` when no types have been generated.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // Using generated function name types
12
+ * // With generated types, you get autocomplete on function names
13
+ * await base44.functions.invoke('sendEmail', { to: 'user@example.com' });
14
+ * ```
9
15
  */
10
16
  export type FunctionName = keyof FunctionNameRegistry extends never ? string : keyof FunctionNameRegistry;
11
17
  /**
@@ -17,6 +23,10 @@ export type FunctionName = keyof FunctionNameRegistry extends never ? string : k
17
23
  *
18
24
  * - **Anonymous or User authentication** (`base44.functions`): Functions are invoked with the current user's permissions. Anonymous users invoke functions without authentication, while authenticated users invoke functions with their authentication context.
19
25
  * - **Service role authentication** (`base44.asServiceRole.functions`): Functions are invoked with elevated admin-level permissions. The function code receives a request with admin authentication context.
26
+ *
27
+ * ## Generated Types
28
+ *
29
+ * If you're working in a TypeScript project, you can generate types from your backend functions to get autocomplete on function names when calling `invoke()`. See the [Generated Types](/developers/references/sdk/getting-started/generated-types) guide to get started.
20
30
  */
21
31
  export interface FunctionsModule {
22
32
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.19-pr.124.bb33a2f",
3
+ "version": "0.8.19-pr.127.3d92214",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",