@base44-preview/sdk 0.8.17-pr.76.c5f9ff2 → 0.8.17-pr.77.030ba28
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/client.js +3 -1
- package/dist/client.types.d.ts +1 -4
- package/dist/index.d.ts +1 -1
- package/dist/modules/agents.types.d.ts +9 -15
- package/dist/modules/analytics.types.d.ts +0 -3
- package/dist/modules/custom-integrations.types.d.ts +0 -3
- package/dist/modules/entities.types.d.ts +9 -11
- package/dist/modules/integrations.types.d.ts +0 -1
- package/package.json +1 -3
package/dist/client.js
CHANGED
|
@@ -167,7 +167,9 @@ export function createClient(config) {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
// If authentication is required, verify token and redirect to login if needed
|
|
170
|
-
if
|
|
170
|
+
// Skip if already on login page to avoid redirect loop
|
|
171
|
+
const isOnLoginPage = typeof window !== "undefined" && window.location.pathname === "/login";
|
|
172
|
+
if (requiresAuth && typeof window !== "undefined" && !isOnLoginPage) {
|
|
171
173
|
// We perform this check asynchronously to not block client creation
|
|
172
174
|
setTimeout(async () => {
|
|
173
175
|
try {
|
package/dist/client.types.d.ts
CHANGED
|
@@ -83,10 +83,7 @@ export interface Base44Client {
|
|
|
83
83
|
agents: AgentsModule;
|
|
84
84
|
/** {@link AppLogsModule | App logs module} for tracking app usage. */
|
|
85
85
|
appLogs: AppLogsModule;
|
|
86
|
-
/**
|
|
87
|
-
* {@link AnalyticsModule | Analytics module} for tracking app usage.
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
86
|
+
/** {@link AnalyticsModule | Analytics module} for tracking app usage. */
|
|
90
87
|
analytics: AnalyticsModule;
|
|
91
88
|
/** Cleanup function to disconnect WebSocket connections. Call when you're done with the client. */
|
|
92
89
|
cleanup: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ 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, RealtimeEventType, RealtimeEvent, RealtimeCallback, Subscription, } 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
10
|
export type { FunctionsModule } from "./modules/functions.types.js";
|
|
@@ -72,7 +72,7 @@ export interface AgentMessageMetadata {
|
|
|
72
72
|
export interface AgentConversation {
|
|
73
73
|
/** Unique identifier for the conversation. */
|
|
74
74
|
id: string;
|
|
75
|
-
/**
|
|
75
|
+
/** Application ID. */
|
|
76
76
|
app_id: string;
|
|
77
77
|
/** Name of the agent in this conversation. */
|
|
78
78
|
agent_name: string;
|
|
@@ -138,9 +138,9 @@ export interface CreateConversationParams {
|
|
|
138
138
|
export interface AgentsModuleConfig {
|
|
139
139
|
/** Axios instance for HTTP requests */
|
|
140
140
|
axios: AxiosInstance;
|
|
141
|
-
/** Function to get WebSocket instance for
|
|
141
|
+
/** Function to get WebSocket instance for real-time updates (lazy initialization) */
|
|
142
142
|
getSocket: () => ReturnType<typeof RoomsSocket>;
|
|
143
|
-
/**
|
|
143
|
+
/** Application ID */
|
|
144
144
|
appId: string;
|
|
145
145
|
/** Server URL */
|
|
146
146
|
serverUrl?: string;
|
|
@@ -151,7 +151,7 @@ export interface AgentsModuleConfig {
|
|
|
151
151
|
* Agents module for managing AI agent conversations.
|
|
152
152
|
*
|
|
153
153
|
* This module provides methods to create and manage conversations with AI agents,
|
|
154
|
-
* send messages, and subscribe to
|
|
154
|
+
* send messages, and subscribe to real-time updates. Conversations can be used
|
|
155
155
|
* for chat interfaces, support systems, or any interactive AI app.
|
|
156
156
|
*
|
|
157
157
|
* The agents module enables you to:
|
|
@@ -159,7 +159,7 @@ export interface AgentsModuleConfig {
|
|
|
159
159
|
* - **Create conversations** with agents defined in the app.
|
|
160
160
|
* - **Send messages** from users to agents and receive AI-generated responses.
|
|
161
161
|
* - **Retrieve conversations** individually or as filtered lists with sorting and pagination.
|
|
162
|
-
* - **Subscribe to
|
|
162
|
+
* - **Subscribe to real-time updates** using WebSocket connections to receive instant notifications when new messages arrive.
|
|
163
163
|
* - **Attach metadata** to conversations for tracking context, categories, priorities, or linking to external systems.
|
|
164
164
|
* - **Generate WhatsApp connection URLs** for users to interact with agents through WhatsApp.
|
|
165
165
|
*
|
|
@@ -275,7 +275,7 @@ export interface AgentsModule {
|
|
|
275
275
|
* Adds a message to a conversation.
|
|
276
276
|
*
|
|
277
277
|
* Sends a message to the agent and updates the conversation. This method
|
|
278
|
-
* also updates the
|
|
278
|
+
* also updates the real-time socket to notify any subscribers.
|
|
279
279
|
*
|
|
280
280
|
* @param conversation - The conversation to add the message to.
|
|
281
281
|
* @param message - The message to add.
|
|
@@ -293,25 +293,19 @@ export interface AgentsModule {
|
|
|
293
293
|
*/
|
|
294
294
|
addMessage(conversation: AgentConversation, message: Partial<AgentMessage>): Promise<AgentMessage>;
|
|
295
295
|
/**
|
|
296
|
-
* Subscribes to
|
|
296
|
+
* Subscribes to real-time updates for a conversation.
|
|
297
297
|
*
|
|
298
298
|
* Establishes a WebSocket connection to receive instant updates when new
|
|
299
299
|
* messages are added to the conversation. Returns an unsubscribe function
|
|
300
300
|
* to clean up the connection.
|
|
301
301
|
*
|
|
302
302
|
* @param conversationId - The conversation ID to subscribe to.
|
|
303
|
-
* @param onUpdate - Callback function called when the conversation is updated.
|
|
304
|
-
* - `id`: Unique identifier for the conversation.
|
|
305
|
-
* - `agent_name`: Name of the agent in this conversation.
|
|
306
|
-
* - `created_date`: ISO 8601 timestamp of when the conversation was created.
|
|
307
|
-
* - `updated_date`: ISO 8601 timestamp of when the conversation was last updated.
|
|
308
|
-
* - `messages`: Array of messages in the conversation. Each message includes `id`, `role` (`'user'`, `'assistant'`, or `'system'`), `content`, `created_date`, and optionally `tool_calls`, `reasoning`, `file_urls`, and `usage`.
|
|
309
|
-
* - `metadata`: Optional metadata associated with the conversation.
|
|
303
|
+
* @param onUpdate - Callback function called when the conversation is updated.
|
|
310
304
|
* @returns Unsubscribe function to stop receiving updates.
|
|
311
305
|
*
|
|
312
306
|
* @example
|
|
313
307
|
* ```typescript
|
|
314
|
-
* // Subscribe to
|
|
308
|
+
* // Subscribe to real-time updates
|
|
315
309
|
* const unsubscribe = base44.agents.subscribeToConversation(
|
|
316
310
|
* 'conv-123',
|
|
317
311
|
* (updatedConversation) => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parameters for calling a custom integration endpoint.
|
|
3
|
-
* @internal
|
|
4
3
|
*/
|
|
5
4
|
export interface CustomIntegrationCallParams {
|
|
6
5
|
/**
|
|
@@ -23,7 +22,6 @@ export interface CustomIntegrationCallParams {
|
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* Response from a custom integration call.
|
|
26
|
-
* @internal
|
|
27
25
|
*/
|
|
28
26
|
export interface CustomIntegrationCallResponse {
|
|
29
27
|
/**
|
|
@@ -87,7 +85,6 @@ export interface CustomIntegrationCallResponse {
|
|
|
87
85
|
* }
|
|
88
86
|
* );
|
|
89
87
|
* ```
|
|
90
|
-
* @internal
|
|
91
88
|
*/
|
|
92
89
|
export interface CustomIntegrationsModule {
|
|
93
90
|
/**
|
|
@@ -19,6 +19,10 @@ export interface RealtimeEvent {
|
|
|
19
19
|
* Callback function invoked when a realtime event occurs.
|
|
20
20
|
*/
|
|
21
21
|
export type RealtimeCallback = (event: RealtimeEvent) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Function returned from subscribe, call it to unsubscribe.
|
|
24
|
+
*/
|
|
25
|
+
export type Subscription = () => void;
|
|
22
26
|
/**
|
|
23
27
|
* Entity handler providing CRUD operations for a specific entity type.
|
|
24
28
|
*
|
|
@@ -266,16 +270,10 @@ export interface EntityHandler {
|
|
|
266
270
|
/**
|
|
267
271
|
* Subscribes to realtime updates for all records of this entity type.
|
|
268
272
|
*
|
|
269
|
-
*
|
|
270
|
-
* record is created, updated, or deleted. Returns an unsubscribe function
|
|
271
|
-
* to clean up the connection.
|
|
273
|
+
* Receives notifications whenever any record is created, updated, or deleted.
|
|
272
274
|
*
|
|
273
|
-
* @param callback -
|
|
274
|
-
*
|
|
275
|
-
* - `data`: The entity data after the change.
|
|
276
|
-
* - `id`: The unique identifier of the affected entity.
|
|
277
|
-
* - `timestamp`: ISO 8601 timestamp of when the event occurred.
|
|
278
|
-
* @returns Unsubscribe function to stop receiving updates.
|
|
275
|
+
* @param callback - Function called when an entity changes.
|
|
276
|
+
* @returns Unsubscribe function to stop listening.
|
|
279
277
|
*
|
|
280
278
|
* @example
|
|
281
279
|
* ```typescript
|
|
@@ -284,11 +282,11 @@ export interface EntityHandler {
|
|
|
284
282
|
* console.log(`Task ${event.id} was ${event.type}d:`, event.data);
|
|
285
283
|
* });
|
|
286
284
|
*
|
|
287
|
-
* // Later,
|
|
285
|
+
* // Later, unsubscribe
|
|
288
286
|
* unsubscribe();
|
|
289
287
|
* ```
|
|
290
288
|
*/
|
|
291
|
-
subscribe(callback: RealtimeCallback):
|
|
289
|
+
subscribe(callback: RealtimeCallback): Subscription;
|
|
292
290
|
}
|
|
293
291
|
/**
|
|
294
292
|
* Entities module for managing app data.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/sdk",
|
|
3
|
-
"version": "0.8.17-pr.
|
|
3
|
+
"version": "0.8.17-pr.77.030ba28",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
"docs": "typedoc",
|
|
20
20
|
"prepublishOnly": "npm run build",
|
|
21
21
|
"create-docs": "npm run create-docs:generate && npm run create-docs:process",
|
|
22
|
-
"create-docs-local": "npm run create-docs && npm run copy-docs-local",
|
|
23
22
|
"push-docs": "node scripts/mintlify-post-processing/push-to-docs-repo.js",
|
|
24
|
-
"copy-docs-local": "node scripts/mintlify-post-processing/copy-to-local-docs.js",
|
|
25
23
|
"create-docs:generate": "typedoc",
|
|
26
24
|
"create-docs:process": "node scripts/mintlify-post-processing/file-processing/file-processing.js"
|
|
27
25
|
},
|