@base44-preview/sdk 0.8.16-pr.71.a6a0503 → 0.8.17-pr.70.19d8c0f

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/README.md CHANGED
@@ -12,7 +12,7 @@ The SDK provides access to Base44's functionality through the following modules:
12
12
  - **[`connectors`](https://docs.base44.com/sdk-docs/interfaces/connectors)**: Manage OAuth connections and access tokens for third-party services.
13
13
  - **[`entities`](https://docs.base44.com/sdk-docs/interfaces/entities)**: Work with your app's data entities using CRUD operations.
14
14
  - **[`functions`](https://docs.base44.com/sdk-docs/interfaces/functions)**: Execute backend functions.
15
- - **[`integrations`](https://docs.base44.com/sdk-docs/type-aliases/integrations)**: Access third-party integrations.
15
+ - **[`integrations`](https://docs.base44.com/sdk-docs/type-aliases/integrations)**: Pre-built server-side functions for external services.
16
16
 
17
17
  ## Example
18
18
 
@@ -78,4 +78,4 @@ Generate API documentation locally:
78
78
  npm run create-docs
79
79
  cd docs
80
80
  mintlify dev
81
- ```
81
+ ```
@@ -16,39 +16,22 @@ export function createAgentsModule({ axios, getSocket, appId, serverUrl, token,
16
16
  return axios.post(`${baseURL}/conversations`, conversation);
17
17
  };
18
18
  const addMessage = async (conversation, message) => {
19
- return axios.post(`${baseURL}/conversations/${conversation.id}/messages?api_version=v2`, message);
19
+ const room = `/agent-conversations/${conversation.id}`;
20
+ const socket = getSocket();
21
+ await socket.updateModel(room, {
22
+ ...conversation,
23
+ messages: [...(conversation.messages || []), message],
24
+ });
25
+ return axios.post(`${baseURL}/conversations/${conversation.id}/messages`, message);
20
26
  };
21
27
  const subscribeToConversation = (conversationId, onUpdate) => {
22
28
  const room = `/agent-conversations/${conversationId}`;
23
29
  const socket = getSocket();
24
- // Store the promise for initial conversation state
25
- let currentConversation;
26
- const conversationPromise = getConversation(conversationId).then((conv) => {
27
- currentConversation = conv;
28
- return conv;
29
- });
30
30
  return socket.subscribeToRoom(room, {
31
31
  connect: () => { },
32
- update_model: async ({ data: jsonStr }) => {
33
- const data = JSON.parse(jsonStr);
34
- if (data._message) {
35
- // Wait for initial conversation to be loaded
36
- await conversationPromise;
37
- const message = data._message;
38
- // Update local conversation state
39
- if (currentConversation) {
40
- const messages = currentConversation.messages || [];
41
- const existingIndex = messages.findIndex((m) => m.id === message.id);
42
- const updatedMessages = existingIndex !== -1
43
- ? messages.map((m, i) => (i === existingIndex ? message : m))
44
- : [...messages, message];
45
- currentConversation = {
46
- ...currentConversation,
47
- messages: updatedMessages,
48
- };
49
- onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(currentConversation);
50
- }
51
- }
32
+ update_model: ({ data: jsonStr }) => {
33
+ const conv = JSON.parse(jsonStr);
34
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(conv);
52
35
  },
53
36
  });
54
37
  };
@@ -72,7 +72,7 @@ export interface AgentMessageMetadata {
72
72
  export interface AgentConversation {
73
73
  /** Unique identifier for the conversation. */
74
74
  id: string;
75
- /** Application ID. */
75
+ /** App ID. */
76
76
  app_id: string;
77
77
  /** Name of the agent in this conversation. */
78
78
  agent_name: string;
@@ -140,7 +140,7 @@ export interface AgentsModuleConfig {
140
140
  axios: AxiosInstance;
141
141
  /** Function to get WebSocket instance for real-time updates (lazy initialization) */
142
142
  getSocket: () => ReturnType<typeof RoomsSocket>;
143
- /** Application ID */
143
+ /** App ID */
144
144
  appId: string;
145
145
  /** Server URL */
146
146
  serverUrl?: string;
@@ -6,8 +6,8 @@ export const ANALYTICS_SESSION_DURATION_EVENT_NAME = "__session_duration_event__
6
6
  export const ANALYTICS_CONFIG_ENABLE_URL_PARAM_KEY = "analytics-enable";
7
7
  export const ANALYTICS_SESSION_ID_LOCAL_STORAGE_KEY = "base44_analytics_session_id";
8
8
  const defaultConfiguration = {
9
- // default to disabled //
10
- enabled: false,
9
+ // default to enabled //
10
+ enabled: true,
11
11
  maxQueueSize: 1000,
12
12
  throttleTime: 1000,
13
13
  batchSize: 30,
@@ -11,9 +11,7 @@ export interface ConnectorAccessTokenResponse {
11
11
  /**
12
12
  * Connectors module for managing OAuth tokens for external services.
13
13
  *
14
- * This module allows you to retrieve OAuth access tokens for external services
15
- * that the app has connected to. Use these tokens to make API
16
- * calls to external services.
14
+ * This module allows you to retrieve OAuth access tokens for external services that the app has connected to. Connectors are app-scoped. When an app builder connects an integration like Google Calendar or Slack, all users of the app share that same connection.
17
15
  *
18
16
  * Unlike the integrations module that provides pre-built functions, connectors give you
19
17
  * raw OAuth tokens so you can call external service APIs directly with full control over
@@ -26,9 +24,9 @@ export interface ConnectorsModule {
26
24
  /**
27
25
  * Retrieves an OAuth access token for a specific external integration type.
28
26
  *
29
- * Returns the OAuth token string for an external service that the app
30
- * has connected to. You can then use this token to make authenticated API calls
31
- * to that external service.
27
+ * Returns the OAuth token string for an external service that an app builder
28
+ * has connected to. This token represents the connected app builder's account
29
+ * and can be used to make authenticated API calls to that external service on behalf of the app.
32
30
  *
33
31
  * @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, or `'github'`.
34
32
  * @returns Promise resolving to the access token string.
@@ -14,11 +14,6 @@ export interface CustomIntegrationCallParams {
14
14
  * Query string parameters to append to the URL.
15
15
  */
16
16
  queryParams?: Record<string, any>;
17
- /**
18
- * Additional headers to send with this specific request.
19
- * These are merged with the integration's configured headers.
20
- */
21
- headers?: Record<string, string>;
22
17
  }
23
18
  /**
24
19
  * Response from a custom integration call.
@@ -52,18 +47,17 @@ export interface CustomIntegrationCallResponse {
52
47
  *
53
48
  * @example
54
49
  * ```typescript
55
- * // Call a custom GitHub integration
50
+ * // Call a custom CRM integration
56
51
  * const response = await base44.integrations.custom.call(
57
- * "github", // integration slug (defined by workspace admin)
58
- * "listIssues", // operation ID from the OpenAPI spec
52
+ * "my-crm", // integration slug (defined by workspace admin)
53
+ * "get:/contacts", // endpoint: method:path format
59
54
  * {
60
- * pathParams: { owner: "myorg", repo: "myrepo" },
61
- * queryParams: { state: "open", per_page: 100 }
55
+ * queryParams: { limit: 10 }
62
56
  * }
63
57
  * );
64
58
  *
65
59
  * if (response.success) {
66
- * console.log("Issues:", response.data);
60
+ * console.log("Contacts:", response.data);
67
61
  * } else {
68
62
  * console.error("API returned error:", response.status_code);
69
63
  * }
@@ -71,10 +65,10 @@ export interface CustomIntegrationCallResponse {
71
65
  *
72
66
  * @example
73
67
  * ```typescript
74
- * // Call with request body payload
68
+ * // Call with path params and request body payload
75
69
  * const response = await base44.integrations.custom.call(
76
70
  * "github",
77
- * "createIssue",
71
+ * "post:/repos/{owner}/{repo}/issues",
78
72
  * {
79
73
  * pathParams: { owner: "myorg", repo: "myrepo" },
80
74
  * payload: {
@@ -91,15 +85,15 @@ export interface CustomIntegrationsModule {
91
85
  * Call a custom integration endpoint.
92
86
  *
93
87
  * @param slug - The integration's unique identifier (slug), as defined by the workspace admin.
94
- * @param operationId - The operation ID from the OpenAPI spec (e.g., "listIssues", "getUser").
95
- * @param params - Optional parameters including payload, pathParams, queryParams, and headers.
88
+ * @param endpoint - The endpoint in `method:path` format (e.g., `"get:/contacts"`, `"post:/users/{id}"`). The method is the HTTP verb (lowercase) and the path matches the OpenAPI specification.
89
+ * @param params - Optional parameters including payload, pathParams, and queryParams.
96
90
  * @returns Promise resolving to the integration call response.
97
91
  *
98
92
  * @throws {Error} If slug is not provided.
99
- * @throws {Error} If operationId is not provided.
100
- * @throws {Base44Error} If the integration or operation is not found (404).
93
+ * @throws {Error} If endpoint is not provided.
94
+ * @throws {Base44Error} If the integration or endpoint is not found (404).
101
95
  * @throws {Base44Error} If the external API call fails (502).
102
96
  * @throws {Base44Error} If the request times out (504).
103
97
  */
104
- call(slug: string, operationId: string, params?: CustomIntegrationCallParams): Promise<CustomIntegrationCallResponse>;
98
+ call(slug: string, endpoint: string, params?: CustomIntegrationCallParams): Promise<CustomIntegrationCallResponse>;
105
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.16-pr.71.a6a0503",
3
+ "version": "0.8.17-pr.70.19d8c0f",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",